MED-151: add profile view and working smoking dashboard card (#71)

* MED-151: add profile view and working smoking dashboard card

* update zod

* move some components to shared

* move some components to shared

* remove console.logs

* remove unused password form components

* only check null for variant

* use pathsconfig
This commit is contained in:
Helena
2025-09-04 12:17:54 +03:00
committed by GitHub
parent 152ec5f36b
commit 9122acc89f
74 changed files with 4081 additions and 3531 deletions

View File

@@ -21,39 +21,25 @@ export const PaymentTypeSchema = z.enum(['one-time', 'recurring']);
export const LineItemSchema = z
.object({
id: z
.string({
description:
'Unique identifier for the line item. Defined by the Provider.',
})
.string()
.describe('Unique identifier for the line item. Defined by the Provider.')
.min(1),
name: z
.string({
description: 'Name of the line item. Displayed to the user.',
})
.string().describe('Name of the line item. Displayed to the user.')
.min(1),
description: z
.string({
description:
'Description of the line item. Displayed to the user and will replace the auto-generated description inferred' +
' from the line item. This is useful if you want to provide a more detailed description to the user.',
})
.string().describe('Description of the line item. Displayed to the user and will replace the auto-generated description inferred' +
' from the line item. This is useful if you want to provide a more detailed description to the user.')
.optional(),
cost: z
.number({
description: 'Cost of the line item. Displayed to the user.',
})
.number().describe('Cost of the line item. Displayed to the user.')
.min(0),
type: LineItemTypeSchema,
unit: z
.string({
description:
'Unit of the line item. Displayed to the user. Example "seat" or "GB"',
})
.string().describe('Unit of the line item. Displayed to the user. Example "seat" or "GB"')
.optional(),
setupFee: z
.number({
description: `Lemon Squeezy only: If true, in addition to the cost, a setup fee will be charged.`,
})
.number().describe(`Lemon Squeezy only: If true, in addition to the cost, a setup fee will be charged.`)
.positive()
.optional(),
tiers: z
@@ -92,14 +78,10 @@ export const LineItemSchema = z
export const PlanSchema = z
.object({
id: z
.string({
description: 'Unique identifier for the plan. Defined by yourself.',
})
.string().describe('Unique identifier for the plan. Defined by yourself.')
.min(1),
name: z
.string({
description: 'Name of the plan. Displayed to the user.',
})
.string().describe('Name of the plan. Displayed to the user.')
.min(1),
interval: BillingIntervalSchema.optional(),
custom: z.boolean().default(false).optional(),
@@ -124,10 +106,7 @@ export const PlanSchema = z
},
),
trialDays: z
.number({
description:
'Number of days for the trial period. Leave empty for no trial.',
})
.number().describe('Number of days for the trial period. Leave empty for no trial.')
.positive()
.optional(),
paymentType: PaymentTypeSchema,
@@ -209,54 +188,34 @@ export const PlanSchema = z
const ProductSchema = z
.object({
id: z
.string({
description:
'Unique identifier for the product. Defined by th Provider.',
})
.string().describe('Unique identifier for the product. Defined by th Provider.')
.min(1),
name: z
.string({
description: 'Name of the product. Displayed to the user.',
})
.string().describe('Name of the product. Displayed to the user.')
.min(1),
description: z
.string({
description: 'Description of the product. Displayed to the user.',
})
.string().describe('Description of the product. Displayed to the user.')
.min(1),
currency: z
.string({
description: 'Currency code for the product. Displayed to the user.',
})
.string().describe('Currency code for the product. Displayed to the user.')
.min(3)
.max(3),
badge: z
.string({
description:
'Badge for the product. Displayed to the user. Example: "Popular"',
})
.string().describe('Badge for the product. Displayed to the user. Example: "Popular"')
.optional(),
features: z
.array(
z.string({
description: 'Features of the product. Displayed to the user.',
}),
)
z.string(),
).describe('Features of the product. Displayed to the user.')
.nonempty(),
enableDiscountField: z
.boolean({
description: 'Enable discount field for the product in the checkout.',
})
.boolean().describe('Enable discount field for the product in the checkout.')
.optional(),
highlighted: z
.boolean({
description: 'Highlight this product. Displayed to the user.',
})
.boolean().describe('Highlight this product. Displayed to the user.')
.optional(),
hidden: z
.boolean({
description: 'Hide this product from being displayed to users.',
})
.boolean().describe('Hide this product from being displayed to users.')
.optional(),
plans: z.array(PlanSchema),
})

View File

@@ -1,14 +1,10 @@
import { z } from 'zod';
export const ReportBillingUsageSchema = z.object({
id: z.string({
description:
'The id of the usage record. For Stripe a customer ID, for LS a subscription item ID.',
}),
id: z.string().describe('The id of the usage record. For Stripe a customer ID, for LS a subscription item ID.'),
eventName: z
.string({
description: 'The name of the event that triggered the usage',
})
.string()
.describe('The name of the event that triggered the usage')
.optional(),
usage: z.object({
quantity: z.number(),

View File

@@ -3,8 +3,8 @@ import { z } from 'zod';
export const UpdateHealthBenefitSchema = z.object({
occurance: z
.string({
required_error: 'Occurance is required',
error: 'Occurance is required',
})
.nonempty(),
amount: z.number({ required_error: 'Amount is required' }),
amount: z.number({ error: 'Amount is required' }),
});

View File

@@ -4,12 +4,12 @@ export const MontonioServerEnvSchema = z
.object({
secretKey: z
.string({
required_error: `Please provide the variable MONTONIO_SECRET_KEY`,
error: `Please provide the variable MONTONIO_SECRET_KEY`,
})
.min(1),
apiUrl: z
.string({
required_error: `Please provide the variable MONTONIO_API_URL`,
error: `Please provide the variable MONTONIO_API_URL`,
})
.min(1),
});

View File

@@ -4,12 +4,12 @@ export const StripeServerEnvSchema = z
.object({
secretKey: z
.string({
required_error: `Please provide the variable STRIPE_SECRET_KEY`,
error: `Please provide the variable STRIPE_SECRET_KEY`,
})
.min(1),
webhooksSecret: z
.string({
required_error: `Please provide the variable STRIPE_WEBHOOK_SECRET`,
error: `Please provide the variable STRIPE_WEBHOOK_SECRET`,
})
.min(1),
})