|
|
|
|
@@ -25,21 +25,32 @@ export const LineItemSchema = z
|
|
|
|
|
.describe('Unique identifier for the line item. Defined by the Provider.')
|
|
|
|
|
.min(1),
|
|
|
|
|
name: z
|
|
|
|
|
.string().describe('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().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.')
|
|
|
|
|
.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().describe('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().describe('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().describe(`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
|
|
|
|
|
@@ -78,10 +89,12 @@ export const LineItemSchema = z
|
|
|
|
|
export const PlanSchema = z
|
|
|
|
|
.object({
|
|
|
|
|
id: z
|
|
|
|
|
.string().describe('Unique identifier for the plan. Defined by yourself.')
|
|
|
|
|
.string()
|
|
|
|
|
.describe('Unique identifier for the plan. Defined by yourself.')
|
|
|
|
|
.min(1),
|
|
|
|
|
name: z
|
|
|
|
|
.string().describe('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(),
|
|
|
|
|
@@ -106,7 +119,10 @@ export const PlanSchema = z
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
trialDays: z
|
|
|
|
|
.number().describe('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,
|
|
|
|
|
@@ -188,34 +204,43 @@ export const PlanSchema = z
|
|
|
|
|
const ProductSchema = z
|
|
|
|
|
.object({
|
|
|
|
|
id: z
|
|
|
|
|
.string().describe('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().describe('Name of the product. Displayed to the user.')
|
|
|
|
|
.string()
|
|
|
|
|
.describe('Name of the product. Displayed to the user.')
|
|
|
|
|
.min(1),
|
|
|
|
|
description: z
|
|
|
|
|
.string().describe('Description of the product. Displayed to the user.')
|
|
|
|
|
.string()
|
|
|
|
|
.describe('Description of the product. Displayed to the user.')
|
|
|
|
|
.min(1),
|
|
|
|
|
currency: z
|
|
|
|
|
.string().describe('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().describe('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(),
|
|
|
|
|
).describe('Features of the product. Displayed to the user.')
|
|
|
|
|
.array(z.string())
|
|
|
|
|
.describe('Features of the product. Displayed to the user.')
|
|
|
|
|
.nonempty(),
|
|
|
|
|
enableDiscountField: z
|
|
|
|
|
.boolean().describe('Enable discount field for the product in the checkout.')
|
|
|
|
|
.boolean()
|
|
|
|
|
.describe('Enable discount field for the product in the checkout.')
|
|
|
|
|
.optional(),
|
|
|
|
|
highlighted: z
|
|
|
|
|
.boolean().describe('Highlight this product. Displayed to the user.')
|
|
|
|
|
.boolean()
|
|
|
|
|
.describe('Highlight this product. Displayed to the user.')
|
|
|
|
|
.optional(),
|
|
|
|
|
hidden: z
|
|
|
|
|
.boolean().describe('Hide this product from being displayed to users.')
|
|
|
|
|
.boolean()
|
|
|
|
|
.describe('Hide this product from being displayed to users.')
|
|
|
|
|
.optional(),
|
|
|
|
|
plans: z.array(PlanSchema),
|
|
|
|
|
})
|
|
|
|
|
|