@kelviq/mcp-server 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +25 -7
  2. package/dist/docs/README.md +16 -0
  3. package/dist/docs/backend-integration/node-sdk.md +41 -17
  4. package/dist/docs/backend-integration/python-sdk.md +16 -17
  5. package/dist/docs/changelog.md +4076 -0
  6. package/dist/docs/cli/commands.md +140 -5
  7. package/dist/docs/cli/environments.md +3 -3
  8. package/dist/docs/cli/kelviq-config.md +28 -7
  9. package/dist/docs/cli/overview.md +11 -9
  10. package/dist/docs/guides/agent-toolkit.md +3 -3
  11. package/dist/docs/guides/mcp-server.md +36 -5
  12. package/dist/docs/guides/webhooks.md +1 -1
  13. package/dist/docs/manifest.json +5 -61
  14. package/dist/docs/product-catalog/free-and-trials.md +13 -0
  15. package/dist/docs/product-catalog/license-keys.md +13 -0
  16. package/dist/http/client.d.ts +7 -0
  17. package/dist/http/client.js +9 -0
  18. package/dist/http/client.js.map +1 -1
  19. package/dist/prompts/index.js +11 -11
  20. package/dist/prompts/index.js.map +1 -1
  21. package/dist/schemas/kelviq.d.ts +200 -0
  22. package/dist/schemas/kelviq.js +178 -3
  23. package/dist/schemas/kelviq.js.map +1 -1
  24. package/dist/server.js +2 -0
  25. package/dist/server.js.map +1 -1
  26. package/dist/tools/_resolve.d.ts +4 -0
  27. package/dist/tools/_resolve.js +46 -0
  28. package/dist/tools/_resolve.js.map +1 -0
  29. package/dist/tools/connection.d.ts +12 -0
  30. package/dist/tools/connection.js +44 -0
  31. package/dist/tools/connection.js.map +1 -0
  32. package/dist/tools/discounts.d.ts +3 -0
  33. package/dist/tools/discounts.js +86 -0
  34. package/dist/tools/discounts.js.map +1 -0
  35. package/dist/tools/index.js +7 -0
  36. package/dist/tools/index.js.map +1 -1
  37. package/dist/tools/offerings.js +6 -2
  38. package/dist/tools/offerings.js.map +1 -1
  39. package/dist/tools/plan-entitlements.js +11 -3
  40. package/dist/tools/plan-entitlements.js.map +1 -1
  41. package/dist/tools/plans.js +6 -2
  42. package/dist/tools/plans.js.map +1 -1
  43. package/dist/tools/webhooks.d.ts +10 -0
  44. package/dist/tools/webhooks.js +114 -0
  45. package/dist/tools/webhooks.js.map +1 -0
  46. package/package.json +1 -1
@@ -5,6 +5,15 @@ export class KelviqHttpClient {
5
5
  constructor(config) {
6
6
  this.config = config;
7
7
  }
8
+ /** Where requests go, for diagnostics. Deliberately excludes the API keys. */
9
+ connectionInfo() {
10
+ return {
11
+ env: this.config.env,
12
+ envExplicit: this.config.envExplicit ?? true,
13
+ baseUrl: this.config.baseUrl,
14
+ edgeUrl: this.config.edgeUrl,
15
+ };
16
+ }
8
17
  async request(init) {
9
18
  let key;
10
19
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/http/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAuB,QAAQ,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAkB7F,MAAM,OAAO,gBAAgB;IACE;IAA7B,YAA6B,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAErD,KAAK,CAAC,OAAO,CAAc,IAAiB;QAC1C,IAAI,GAAW,CAAC;QAChB,IAAI,CAAC;YACH,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,eAAe,EAAE,CAAC;gBACnC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC;YACrD,CAAC;YACD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,GAAG,CAAC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,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;QAC3F,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3C,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS;oBAAE,SAAS;gBAC5C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAEO,eAAe,CAAC,GAAoB;QAC1C,OAAO;YACL,KAAK,EAAE;gBACL,MAAM,EAAE,qBAAqB;gBAC7B,OAAO,EAAE,GAAG,CAAC,OAAO;aACrB;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -5,21 +5,21 @@ function setupProductText(productName, planName) {
5
5
  return [
6
6
  `Set up a sellable product ${productLabel} end-to-end, in order:`,
7
7
  '',
8
- `1. Create the product with \`product_create\`. Required fields: \`name\` and \`taxCode\`. If the tax code is not known, ask the user — valid values include \`saas\`, \`saas_business\`, \`software\`, \`ebook\`, \`videocontent\`, \`videogame\`, \`informationservice\`, \`digitalgraphic\`, \`eservice\`, and \`training\`. The response includes the product's UUID — keep it for the next steps.`,
8
+ `1. Create the product with \`product_create\`. Required fields: \`name\` and \`taxCode\`. If the tax code is not known, ask the user — valid values include \`saas\`, \`saas_business\`, \`software\`, \`ebook\`, \`videocontent\`, \`videogame\`, \`informationservice\`, \`digitalgraphic\`, \`eservice\`, and \`training\`. The response includes the product's UUID and identifier — either works in the next steps.`,
9
9
  '',
10
- '2. For each feature the product should gate, create it with `feature_create`. Choose `featureType`: `BOOLEAN` for a simple on/off flag, `CUSTOMIZABLE` for a configurable quantity (e.g. seats), or `METER` for usage-tracked consumption (e.g. API calls). Each response includes the feature\'s UUID.',
10
+ '2. For each feature the product should gate, create it with `feature_create`. Choose `featureType`: `BOOLEAN` for a simple on/off flag, `CUSTOMIZABLE` for a configurable quantity (e.g. seats), or `METER` for usage-tracked consumption (e.g. API calls). Each response includes the feature\'s UUID and identifier — either works below.',
11
11
  '',
12
- `3. Create the plan ${planLabel} with \`plan_create\`, passing the product **UUID** from step 1 (not its identifier) as \`product\`. The new plan is created in DRAFT state and is not visible or purchasable until it is published — do not tell the user the plan is live yet.`,
12
+ `3. Create the plan ${planLabel} with \`plan_create\`, passing the product from step 1 as \`product\` (UUID or identifier). The new plan is created in DRAFT state and is not visible or purchasable until it is published — do not tell the user the plan is live yet.`,
13
13
  '',
14
- '4. Attach entitlements with `plan_entitlements_add`, referencing each feature by its **UUID** from step 2 (not its identifier), e.g. `planEntitlements: [{ feature: <uuid>, details: {...} }]`. The `details` shape depends on the feature\'s type.',
14
+ '4. Attach entitlements with `plan_entitlements_add`, referencing each feature from step 2 by UUID or identifier, e.g. `planEntitlements: [{ feature: <uuid or identifier>, details: {...} }]`. The `details` shape depends on the feature\'s type.',
15
15
  '',
16
16
  '5. Prices are not set through this MCP server — it has no price-writing tool. Direct the user to set prices for the plan in the Kelviq dashboard, or with the Kelviq CLI\'s pricing-as-code push flow (`kelviq push`). Do not attempt to write prices yourself; once prices exist, `plan_prices_list` can read them back to confirm.',
17
17
  '',
18
18
  '6. Publish the plan with `plan_publish` to make it live. This is the step that actually exposes the plan (and its DRAFT-only entitlements from step 4) to customers.',
19
19
  '',
20
- '7. Verify the result: `plan_retrieve` to confirm the plan is published, `plan_prices_list` to confirm prices were set (in the dashboard or via the CLI), and `offering_get_product` (by product UUID) to see the public pricing view a customer would see.',
20
+ '7. Verify the result: `plan_retrieve` to confirm the plan is published, `plan_prices_list` to confirm prices were set (in the dashboard or via the CLI), and `offering_get_product` (by product UUID or identifier) to see the public pricing view a customer would see.',
21
21
  '',
22
- 'Summarize what was created (product UUID, feature UUIDs, plan identifier) and remind the user to set prices in the dashboard or via `kelviq push` if step 5 has not happened yet.',
22
+ 'Summarize what was created (product identifier, feature identifiers, plan identifier) and remind the user to set prices in the dashboard or via `kelviq push` if step 5 has not happened yet.',
23
23
  ].join('\n');
24
24
  }
25
25
  function launchPlanText(productId, planName) {
@@ -28,19 +28,19 @@ function launchPlanText(productId, planName) {
28
28
  return [
29
29
  `Launch a new plan ${planLabel} on an existing product, in order:`,
30
30
  '',
31
- `1. Confirm the product exists with \`product_retrieve\` for ${productLabel}, and note its UUID.`,
31
+ `1. Confirm the product exists with \`product_retrieve\` for ${productLabel}.`,
32
32
  '',
33
- '2. List the features already defined on the account with `feature_list` — reuse existing features rather than creating duplicates; note the UUIDs of the ones this plan needs.',
33
+ '2. List the features already defined on the account with `feature_list` — reuse existing features rather than creating duplicates; note the identifiers of the ones this plan needs.',
34
34
  '',
35
- "3. Create the plan with `plan_create`, passing the product **UUID** (not its identifier) as `product`. The new plan is created in DRAFT state and is not visible or purchasable until it is published.",
35
+ "3. Create the plan with `plan_create`, passing the product's UUID or identifier as `product`. The new plan is created in DRAFT state and is not visible or purchasable until it is published.",
36
36
  '',
37
- '4. Attach entitlements with `plan_entitlements_add`, referencing each feature by its **UUID** from step 2, e.g. `planEntitlements: [{ feature: <uuid>, details: {...} }]`.',
37
+ '4. Attach entitlements with `plan_entitlements_add`, referencing each feature from step 2 by UUID or identifier, e.g. `planEntitlements: [{ feature: <uuid or identifier>, details: {...} }]`.',
38
38
  '',
39
39
  "5. Prices are not set through this MCP server — it has no price-writing tool. Direct the user to set prices in the Kelviq dashboard, or with the Kelviq CLI's pricing-as-code push flow (`kelviq push`); `plan_prices_list` can read them back afterward.",
40
40
  '',
41
41
  '6. Publish the plan with `plan_publish` to make it live. If this plan is replacing an already-published plan and you instead used `plan_update` on it, remember that patching a published (`is_latest`) plan creates a **new draft** — you must call `plan_publish` again to release that new draft; the previous version stays live until you do.',
42
42
  '',
43
- '7. Verify with `plan_retrieve`, `plan_prices_list`, `plan_entitlements_list`, and `offering_get_product` (by product UUID) to confirm the plan is live with the right entitlements and pricing.',
43
+ '7. Verify with `plan_retrieve`, `plan_prices_list`, `plan_entitlements_list`, and `offering_get_product` (by product UUID or identifier) to confirm the plan is live with the right entitlements and pricing.',
44
44
  ].join('\n');
45
45
  }
46
46
  function diagnoseCustomerText(customerId) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,SAAS,gBAAgB,CAAC,WAAoB,EAAE,QAAiB;IAC/D,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC,UAAU,WAAW,GAAG,CAAC,CAAC,CAAC,sBAAsB,CAAC;IACrF,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,UAAU,QAAQ,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC;IAE9D,OAAO;QACL,6BAA6B,YAAY,wBAAwB;QACjE,EAAE;QACF,uYAAuY;QACvY,EAAE;QACF,ySAAyS;QACzS,EAAE;QACF,sBAAsB,SAAS,kPAAkP;QACjR,EAAE;QACF,qPAAqP;QACrP,EAAE;QACF,sUAAsU;QACtU,EAAE;QACF,sKAAsK;QACtK,EAAE;QACF,4PAA4P;QAC5P,EAAE;QACF,mLAAmL;KACpL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,SAAS,cAAc,CAAC,SAAkB,EAAE,QAAiB;IAC3D,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,aAAa,SAAS,IAAI,CAAC,CAAC,CAAC,oBAAoB,CAAC;IACnF,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,UAAU,QAAQ,GAAG,CAAC,CAAC,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EAAE,qDAAqD;QAC5D,WAAW,EACT,2NAA2N;QAC7N,UAAU,EAAE;YACV,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;SAChE;KACF,EACD,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;QACnB,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,CAAC,UAAU,CAAC,EAAE;aAClE;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -175,12 +175,16 @@ export declare const CreateCheckoutSession: z.ZodObject<{
175
175
  lockEmail: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
176
176
  defaultBillingCountry: z.ZodOptional<z.ZodNullable<z.ZodString>>;
177
177
  discountCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
178
+ trialPeriod: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
179
+ billingPeriodsEnabled: z.ZodOptional<z.ZodNullable<z.ZodString>>;
180
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
178
181
  metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
179
182
  }, "strip", z.ZodTypeAny, {
180
183
  planIdentifier: string;
181
184
  successUrl: string;
182
185
  chargePeriod: "ONE_TIME" | "MONTHLY" | "YEARLY" | "WEEKLY" | "DAILY" | "THREE_MONTHS" | "SIX_MONTHS";
183
186
  customerId?: string | null | undefined;
187
+ email?: string | null | undefined;
184
188
  metadata?: Record<string, unknown> | null | undefined;
185
189
  features?: {
186
190
  identifier: string;
@@ -196,11 +200,14 @@ export declare const CreateCheckoutSession: z.ZodObject<{
196
200
  lockEmail?: boolean | null | undefined;
197
201
  defaultBillingCountry?: string | null | undefined;
198
202
  discountCode?: string | null | undefined;
203
+ trialPeriod?: number | null | undefined;
204
+ billingPeriodsEnabled?: string | null | undefined;
199
205
  }, {
200
206
  planIdentifier: string;
201
207
  successUrl: string;
202
208
  chargePeriod: "ONE_TIME" | "MONTHLY" | "YEARLY" | "WEEKLY" | "DAILY" | "THREE_MONTHS" | "SIX_MONTHS";
203
209
  customerId?: string | null | undefined;
210
+ email?: string | null | undefined;
204
211
  metadata?: Record<string, unknown> | null | undefined;
205
212
  features?: {
206
213
  identifier: string;
@@ -216,6 +223,8 @@ export declare const CreateCheckoutSession: z.ZodObject<{
216
223
  lockEmail?: boolean | null | undefined;
217
224
  defaultBillingCountry?: string | null | undefined;
218
225
  discountCode?: string | null | undefined;
226
+ trialPeriod?: number | null | undefined;
227
+ billingPeriodsEnabled?: string | null | undefined;
219
228
  }>;
220
229
  export declare const GetEntitlements: z.ZodObject<{
221
230
  customerId: z.ZodString;
@@ -346,6 +355,7 @@ export declare const UpdateSubscription: z.ZodObject<{
346
355
  ipAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
347
356
  trialEnd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
348
357
  paymentBehavior: z.ZodOptional<z.ZodNullable<z.ZodEnum<["activate_on_payment"]>>>;
358
+ prorationBehavior: z.ZodOptional<z.ZodNullable<z.ZodEnum<["IMMEDIATE_CHARGE", "PRORATE_NEXT_INVOICE", "NO_PRORATION"]>>>;
349
359
  }, "strip", z.ZodTypeAny, {
350
360
  planIdentifier: string;
351
361
  chargePeriod: "ONE_TIME" | "MONTHLY" | "YEARLY" | "WEEKLY" | "DAILY" | "THREE_MONTHS" | "SIX_MONTHS";
@@ -357,6 +367,7 @@ export declare const UpdateSubscription: z.ZodObject<{
357
367
  ipAddress?: string | null | undefined;
358
368
  trialEnd?: string | null | undefined;
359
369
  paymentBehavior?: "activate_on_payment" | null | undefined;
370
+ prorationBehavior?: "IMMEDIATE_CHARGE" | "PRORATE_NEXT_INVOICE" | "NO_PRORATION" | null | undefined;
360
371
  }, {
361
372
  planIdentifier: string;
362
373
  chargePeriod: "ONE_TIME" | "MONTHLY" | "YEARLY" | "WEEKLY" | "DAILY" | "THREE_MONTHS" | "SIX_MONTHS";
@@ -368,20 +379,28 @@ export declare const UpdateSubscription: z.ZodObject<{
368
379
  ipAddress?: string | null | undefined;
369
380
  trialEnd?: string | null | undefined;
370
381
  paymentBehavior?: "activate_on_payment" | null | undefined;
382
+ prorationBehavior?: "IMMEDIATE_CHARGE" | "PRORATE_NEXT_INVOICE" | "NO_PRORATION" | null | undefined;
371
383
  }>;
372
384
  export declare const CancelSubscription: z.ZodObject<{
373
385
  subscriptionId: z.ZodString;
374
386
  cancellationType: z.ZodEnum<["IMMEDIATE", "CURRENT_PERIOD_ENDS", "SPECIFIC_DATE"]>;
375
387
  cancellationDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
388
+ cancellationFeedback: z.ZodOptional<z.ZodNullable<z.ZodEnum<["TOO_EXPENSIVE", "MISSING_FEATURES", "SWITCHED_SERVICE", "UNUSED", "CUSTOMER_SERVICE", "LOW_QUALITY", "TOO_COMPLEX", "OTHER"]>>>;
389
+ cancellationComment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
376
390
  }, "strip", z.ZodTypeAny, {
377
391
  subscriptionId: string;
378
392
  cancellationType: "IMMEDIATE" | "CURRENT_PERIOD_ENDS" | "SPECIFIC_DATE";
379
393
  cancellationDate?: string | null | undefined;
394
+ cancellationFeedback?: "TOO_EXPENSIVE" | "MISSING_FEATURES" | "SWITCHED_SERVICE" | "UNUSED" | "CUSTOMER_SERVICE" | "LOW_QUALITY" | "TOO_COMPLEX" | "OTHER" | null | undefined;
395
+ cancellationComment?: string | null | undefined;
380
396
  }, {
381
397
  subscriptionId: string;
382
398
  cancellationType: "IMMEDIATE" | "CURRENT_PERIOD_ENDS" | "SPECIFIC_DATE";
383
399
  cancellationDate?: string | null | undefined;
400
+ cancellationFeedback?: "TOO_EXPENSIVE" | "MISSING_FEATURES" | "SWITCHED_SERVICE" | "UNUSED" | "CUSTOMER_SERVICE" | "LOW_QUALITY" | "TOO_COMPLEX" | "OTHER" | null | undefined;
401
+ cancellationComment?: string | null | undefined;
384
402
  }>;
403
+ export declare const ConnectionCheck: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
385
404
  export declare const GetProductOffering: z.ZodObject<{
386
405
  productId: z.ZodString;
387
406
  customerId: z.ZodOptional<z.ZodString>;
@@ -1204,3 +1223,184 @@ export declare const PlanFileDownload: z.ZodObject<{
1204
1223
  planIdentifier: string;
1205
1224
  fileId: string;
1206
1225
  }>;
1226
+ export declare const ListDiscounts: z.ZodObject<{
1227
+ search: z.ZodOptional<z.ZodString>;
1228
+ page: z.ZodOptional<z.ZodNumber>;
1229
+ pageSize: z.ZodOptional<z.ZodNumber>;
1230
+ }, "strip", z.ZodTypeAny, {
1231
+ page?: number | undefined;
1232
+ pageSize?: number | undefined;
1233
+ search?: string | undefined;
1234
+ }, {
1235
+ page?: number | undefined;
1236
+ pageSize?: number | undefined;
1237
+ search?: string | undefined;
1238
+ }>;
1239
+ export declare const DiscountAppliesToItem: z.ZodObject<{
1240
+ product: z.ZodString;
1241
+ plans: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1242
+ }, "strip", z.ZodTypeAny, {
1243
+ product: string;
1244
+ plans?: string[] | undefined;
1245
+ }, {
1246
+ product: string;
1247
+ plans?: string[] | undefined;
1248
+ }>;
1249
+ export declare const DiscountCreate: z.ZodObject<{
1250
+ discountType: z.ZodEnum<["PERCENTAGE", "FIXED_AMOUNT"]>;
1251
+ percentageOff: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1252
+ amountOff: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1253
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1254
+ name: z.ZodString;
1255
+ code: z.ZodString;
1256
+ duration: z.ZodOptional<z.ZodEnum<["ONCE", "REPEATING", "FOREVER"]>>;
1257
+ durationInMonths: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1258
+ redeemBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1259
+ maxRedemptions: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1260
+ appliesTo: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
1261
+ product: z.ZodString;
1262
+ plans: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1263
+ }, "strip", z.ZodTypeAny, {
1264
+ product: string;
1265
+ plans?: string[] | undefined;
1266
+ }, {
1267
+ product: string;
1268
+ plans?: string[] | undefined;
1269
+ }>, "many">>>;
1270
+ }, "strip", z.ZodTypeAny, {
1271
+ code: string;
1272
+ name: string;
1273
+ discountType: "PERCENTAGE" | "FIXED_AMOUNT";
1274
+ currency?: string | null | undefined;
1275
+ percentageOff?: number | null | undefined;
1276
+ amountOff?: string | null | undefined;
1277
+ duration?: "ONCE" | "REPEATING" | "FOREVER" | undefined;
1278
+ durationInMonths?: number | null | undefined;
1279
+ redeemBy?: string | null | undefined;
1280
+ maxRedemptions?: number | null | undefined;
1281
+ appliesTo?: {
1282
+ product: string;
1283
+ plans?: string[] | undefined;
1284
+ }[] | null | undefined;
1285
+ }, {
1286
+ code: string;
1287
+ name: string;
1288
+ discountType: "PERCENTAGE" | "FIXED_AMOUNT";
1289
+ currency?: string | null | undefined;
1290
+ percentageOff?: number | null | undefined;
1291
+ amountOff?: string | null | undefined;
1292
+ duration?: "ONCE" | "REPEATING" | "FOREVER" | undefined;
1293
+ durationInMonths?: number | null | undefined;
1294
+ redeemBy?: string | null | undefined;
1295
+ maxRedemptions?: number | null | undefined;
1296
+ appliesTo?: {
1297
+ product: string;
1298
+ plans?: string[] | undefined;
1299
+ }[] | null | undefined;
1300
+ }>;
1301
+ export declare const DiscountRetrieve: z.ZodObject<{
1302
+ discountId: z.ZodString;
1303
+ }, "strip", z.ZodTypeAny, {
1304
+ discountId: string;
1305
+ }, {
1306
+ discountId: string;
1307
+ }>;
1308
+ export declare const DiscountUpdate: z.ZodObject<{
1309
+ discountId: z.ZodString;
1310
+ isActive: z.ZodBoolean;
1311
+ }, "strip", z.ZodTypeAny, {
1312
+ discountId: string;
1313
+ isActive: boolean;
1314
+ }, {
1315
+ discountId: string;
1316
+ isActive: boolean;
1317
+ }>;
1318
+ export declare const DiscountArchive: z.ZodObject<{
1319
+ discountId: z.ZodString;
1320
+ }, "strip", z.ZodTypeAny, {
1321
+ discountId: string;
1322
+ }, {
1323
+ discountId: string;
1324
+ }>;
1325
+ export declare const WebhookEventType: z.ZodEnum<["checkout.completed", "customer.created", "customer.updated", "order.created", "order.updated", "order.refunded", "subscription.created", "subscription.updated", "subscription.cancelled", "subscription.plan_changed", "subscription.trial_will_end", "invoice.created", "invoice.paid", "invoice.payment_failed", "refund.created", "refund.updated", "feature.usage_alert", "payment_method.created", "payment_method.updated", "payment_method.deleted"]>;
1326
+ export declare const ListWebhookEndpoints: z.ZodObject<{
1327
+ page: z.ZodOptional<z.ZodNumber>;
1328
+ pageSize: z.ZodOptional<z.ZodNumber>;
1329
+ revealSecret: z.ZodOptional<z.ZodBoolean>;
1330
+ }, "strip", z.ZodTypeAny, {
1331
+ page?: number | undefined;
1332
+ pageSize?: number | undefined;
1333
+ revealSecret?: boolean | undefined;
1334
+ }, {
1335
+ page?: number | undefined;
1336
+ pageSize?: number | undefined;
1337
+ revealSecret?: boolean | undefined;
1338
+ }>;
1339
+ export declare const WebhookEndpointCreate: z.ZodObject<{
1340
+ url: z.ZodString;
1341
+ events: z.ZodArray<z.ZodEnum<["checkout.completed", "customer.created", "customer.updated", "order.created", "order.updated", "order.refunded", "subscription.created", "subscription.updated", "subscription.cancelled", "subscription.plan_changed", "subscription.trial_will_end", "invoice.created", "invoice.paid", "invoice.payment_failed", "refund.created", "refund.updated", "feature.usage_alert", "payment_method.created", "payment_method.updated", "payment_method.deleted"]>, "many">;
1342
+ enabled: z.ZodOptional<z.ZodBoolean>;
1343
+ revealSecret: z.ZodOptional<z.ZodBoolean>;
1344
+ }, "strip", z.ZodTypeAny, {
1345
+ url: string;
1346
+ events: ("checkout.completed" | "customer.created" | "customer.updated" | "order.created" | "order.updated" | "order.refunded" | "subscription.created" | "subscription.updated" | "subscription.cancelled" | "subscription.plan_changed" | "subscription.trial_will_end" | "invoice.created" | "invoice.paid" | "invoice.payment_failed" | "refund.created" | "refund.updated" | "feature.usage_alert" | "payment_method.created" | "payment_method.updated" | "payment_method.deleted")[];
1347
+ enabled?: boolean | undefined;
1348
+ revealSecret?: boolean | undefined;
1349
+ }, {
1350
+ url: string;
1351
+ events: ("checkout.completed" | "customer.created" | "customer.updated" | "order.created" | "order.updated" | "order.refunded" | "subscription.created" | "subscription.updated" | "subscription.cancelled" | "subscription.plan_changed" | "subscription.trial_will_end" | "invoice.created" | "invoice.paid" | "invoice.payment_failed" | "refund.created" | "refund.updated" | "feature.usage_alert" | "payment_method.created" | "payment_method.updated" | "payment_method.deleted")[];
1352
+ enabled?: boolean | undefined;
1353
+ revealSecret?: boolean | undefined;
1354
+ }>;
1355
+ export declare const WebhookEndpointRetrieve: z.ZodObject<{
1356
+ endpointId: z.ZodString;
1357
+ revealSecret: z.ZodOptional<z.ZodBoolean>;
1358
+ }, "strip", z.ZodTypeAny, {
1359
+ endpointId: string;
1360
+ revealSecret?: boolean | undefined;
1361
+ }, {
1362
+ endpointId: string;
1363
+ revealSecret?: boolean | undefined;
1364
+ }>;
1365
+ export declare const WebhookEndpointUpdate: z.ZodObject<{
1366
+ endpointId: z.ZodString;
1367
+ url: z.ZodOptional<z.ZodString>;
1368
+ events: z.ZodOptional<z.ZodArray<z.ZodEnum<["checkout.completed", "customer.created", "customer.updated", "order.created", "order.updated", "order.refunded", "subscription.created", "subscription.updated", "subscription.cancelled", "subscription.plan_changed", "subscription.trial_will_end", "invoice.created", "invoice.paid", "invoice.payment_failed", "refund.created", "refund.updated", "feature.usage_alert", "payment_method.created", "payment_method.updated", "payment_method.deleted"]>, "many">>;
1369
+ enabled: z.ZodOptional<z.ZodBoolean>;
1370
+ revealSecret: z.ZodOptional<z.ZodBoolean>;
1371
+ }, "strip", z.ZodTypeAny, {
1372
+ endpointId: string;
1373
+ enabled?: boolean | undefined;
1374
+ url?: string | undefined;
1375
+ revealSecret?: boolean | undefined;
1376
+ events?: ("checkout.completed" | "customer.created" | "customer.updated" | "order.created" | "order.updated" | "order.refunded" | "subscription.created" | "subscription.updated" | "subscription.cancelled" | "subscription.plan_changed" | "subscription.trial_will_end" | "invoice.created" | "invoice.paid" | "invoice.payment_failed" | "refund.created" | "refund.updated" | "feature.usage_alert" | "payment_method.created" | "payment_method.updated" | "payment_method.deleted")[] | undefined;
1377
+ }, {
1378
+ endpointId: string;
1379
+ enabled?: boolean | undefined;
1380
+ url?: string | undefined;
1381
+ revealSecret?: boolean | undefined;
1382
+ events?: ("checkout.completed" | "customer.created" | "customer.updated" | "order.created" | "order.updated" | "order.refunded" | "subscription.created" | "subscription.updated" | "subscription.cancelled" | "subscription.plan_changed" | "subscription.trial_will_end" | "invoice.created" | "invoice.paid" | "invoice.payment_failed" | "refund.created" | "refund.updated" | "feature.usage_alert" | "payment_method.created" | "payment_method.updated" | "payment_method.deleted")[] | undefined;
1383
+ }>;
1384
+ export declare const WebhookEndpointDelete: z.ZodObject<{
1385
+ endpointId: z.ZodString;
1386
+ }, "strip", z.ZodTypeAny, {
1387
+ endpointId: string;
1388
+ }, {
1389
+ endpointId: string;
1390
+ }>;
1391
+ export declare const ListWebhookLogs: z.ZodObject<{
1392
+ startDate: z.ZodOptional<z.ZodString>;
1393
+ endDate: z.ZodOptional<z.ZodString>;
1394
+ page: z.ZodOptional<z.ZodNumber>;
1395
+ pageSize: z.ZodOptional<z.ZodNumber>;
1396
+ }, "strip", z.ZodTypeAny, {
1397
+ page?: number | undefined;
1398
+ pageSize?: number | undefined;
1399
+ startDate?: string | undefined;
1400
+ endDate?: string | undefined;
1401
+ }, {
1402
+ page?: number | undefined;
1403
+ pageSize?: number | undefined;
1404
+ startDate?: string | undefined;
1405
+ endDate?: string | undefined;
1406
+ }>;
@@ -112,6 +112,24 @@ export const CreateCheckoutSession = z.object({
112
112
  .nullable()
113
113
  .optional()
114
114
  .describe('Discount/coupon code to pre-apply to the checkout session. Applied only if active, unexpired, and valid for the selected plan; otherwise the request fails.'),
115
+ trialPeriod: z
116
+ .number()
117
+ .int()
118
+ .min(1)
119
+ .nullable()
120
+ .optional()
121
+ .describe('Trial days for the subscription this checkout creates. Overrides the trial configured on the plan.'),
122
+ billingPeriodsEnabled: z
123
+ .string()
124
+ .nullable()
125
+ .optional()
126
+ .describe('Comma-separated billing periods to show and allow on the checkout page, e.g. "MONTHLY,YEARLY".'),
127
+ email: z
128
+ .string()
129
+ .email()
130
+ .nullable()
131
+ .optional()
132
+ .describe('Email to pre-fill on the checkout page. Combine with lockEmail to stop the customer changing it.'),
115
133
  metadata: z
116
134
  .record(z.unknown())
117
135
  .nullable()
@@ -184,6 +202,11 @@ export const UpdateSubscription = z.object({
184
202
  .nullable()
185
203
  .optional()
186
204
  .describe('Set to "activate_on_payment" to keep the current subscription active while payment is pending and apply the new plan/charge period/features only after payment succeeds.'),
205
+ prorationBehavior: z
206
+ .enum(['IMMEDIATE_CHARGE', 'PRORATE_NEXT_INVOICE', 'NO_PRORATION'])
207
+ .nullable()
208
+ .optional()
209
+ .describe('When the customer is billed for the change: IMMEDIATE_CHARGE prorates and invoices the difference now; PRORATE_NEXT_INVOICE prorates now but bills on the next invoice; NO_PRORATION changes the plan without crediting or charging the partial period.'),
187
210
  });
188
211
  export const CancelSubscription = z.object({
189
212
  subscriptionId: z.string().uuid().describe('UUID of the subscription to cancel (path parameter).'),
@@ -194,10 +217,18 @@ export const CancelSubscription = z.object({
194
217
  .nullable()
195
218
  .optional()
196
219
  .describe('Required when cancellationType is SPECIFIC_DATE. Format: YYYY-MM-DD.'),
220
+ cancellationFeedback: z
221
+ .enum(['TOO_EXPENSIVE', 'MISSING_FEATURES', 'SWITCHED_SERVICE', 'UNUSED', 'CUSTOMER_SERVICE', 'LOW_QUALITY', 'TOO_COMPLEX', 'OTHER'])
222
+ .nullable()
223
+ .optional()
224
+ .describe('Optional structured reason for the cancellation.'),
225
+ cancellationComment: z.string().nullable().optional().describe('Optional free-form cancellation comment.'),
197
226
  });
227
+ // -- Connection -----------------------------------------------------------
228
+ export const ConnectionCheck = z.object({}).describe('No input; reports the environment and whether the server key works.');
198
229
  // -- Offerings ------------------------------------------------------------
199
230
  export const GetProductOffering = z.object({
200
- productId: z.string().uuid().describe('UUID of the product.'),
231
+ productId: z.string().describe('Product UUID or identifier.'),
201
232
  customerId: z.string().optional(),
202
233
  plansEnabled: z
203
234
  .string()
@@ -347,7 +378,7 @@ export const PlanLicenseConfig = z.object({
347
378
  export const ListPlans = z.object({}).describe('No filters; returns all plans for the account.');
348
379
  export const PlanCreate = z.object({
349
380
  name: z.string().describe('Plan display name.'),
350
- product: z.string().uuid().describe('UUID of the parent product.'),
381
+ product: z.string().describe('Product UUID or identifier of the parent product.'),
351
382
  identifier: z.string().optional().describe('URL-safe slug; auto-generated if omitted.'),
352
383
  description: z.string().optional(),
353
384
  metadata: z.record(z.unknown()).optional(),
@@ -422,7 +453,7 @@ export const PlanEntitlementsAdd = z.object({
422
453
  planIdentifier: z.string().describe('Plan identifier.'),
423
454
  planEntitlements: z
424
455
  .array(z.object({
425
- feature: z.string().uuid().describe('Feature UUID.'),
456
+ feature: z.string().describe('Feature UUID or identifier.'),
426
457
  details: PlanEntitlementDetails,
427
458
  }))
428
459
  .describe('Feature → entitlement-details pairs to attach to this plan.'),
@@ -452,4 +483,148 @@ export const PlanFileDownload = z.object({
452
483
  planIdentifier: z.string().describe('Plan identifier.'),
453
484
  fileId: z.string().describe('File UUID.'),
454
485
  });
486
+ // =========================================================================
487
+ // Discounts
488
+ // =========================================================================
489
+ const PageSize = z.number().int().min(1).max(100).optional().describe('Results per page (default 10, max 100).');
490
+ export const ListDiscounts = z.object({
491
+ search: z.string().optional().describe("Free-text search across the discount's name and code."),
492
+ page: z.number().int().positive().optional(),
493
+ pageSize: PageSize,
494
+ });
495
+ export const DiscountAppliesToItem = z.object({
496
+ product: z.string().describe('Product UUID or identifier this discount applies to.'),
497
+ plans: z
498
+ .array(z.string())
499
+ .optional()
500
+ .describe('Plan identifiers within the product. Omit or leave empty to apply to every plan of the product.'),
501
+ });
502
+ export const DiscountCreate = z.object({
503
+ discountType: z.enum(['PERCENTAGE', 'FIXED_AMOUNT']),
504
+ percentageOff: z
505
+ .number()
506
+ .int()
507
+ .nullable()
508
+ .optional()
509
+ .describe('Required (and only used) when discountType is PERCENTAGE, e.g. 20.'),
510
+ amountOff: z
511
+ .string()
512
+ .nullable()
513
+ .optional()
514
+ .describe('Required (and only used) when discountType is FIXED_AMOUNT, as a decimal string, e.g. "10.00".'),
515
+ currency: z
516
+ .string()
517
+ .nullable()
518
+ .optional()
519
+ .describe('3-letter ISO currency code. Required when discountType is FIXED_AMOUNT.'),
520
+ name: z.string().describe("Shown on the customer's invoice."),
521
+ code: z
522
+ .string()
523
+ .describe('The code customers enter at checkout. Uppercase letters and numbers only; must be unique among active discounts.'),
524
+ duration: z
525
+ .enum(['ONCE', 'REPEATING', 'FOREVER'])
526
+ .optional()
527
+ .describe('ONCE applies to the first payment; REPEATING applies for durationInMonths billing periods; FOREVER applies to every payment.'),
528
+ durationInMonths: z
529
+ .number()
530
+ .int()
531
+ .positive()
532
+ .nullable()
533
+ .optional()
534
+ .describe('With duration REPEATING: how many billing periods the discount applies for (billing cycles, not calendar months).'),
535
+ redeemBy: z
536
+ .string()
537
+ .nullable()
538
+ .optional()
539
+ .describe('UTC datetime after which the code can no longer be redeemed. Must be in the future.'),
540
+ maxRedemptions: z
541
+ .number()
542
+ .int()
543
+ .positive()
544
+ .nullable()
545
+ .optional()
546
+ .describe('Total number of times the code can be redeemed across all customers.'),
547
+ appliesTo: z
548
+ .array(DiscountAppliesToItem)
549
+ .nullable()
550
+ .optional()
551
+ .describe('Restrict the discount to specific products and plans. Omit to apply to all products.'),
552
+ });
553
+ export const DiscountRetrieve = z.object({
554
+ discountId: z.string().describe('Discount ID (path param `pk`).'),
555
+ });
556
+ export const DiscountUpdate = z.object({
557
+ discountId: z.string().describe('Discount ID (path param `pk`).'),
558
+ isActive: z.boolean().describe('true enables the code, false disables it. No other field can change after creation.'),
559
+ });
560
+ export const DiscountArchive = z.object({
561
+ discountId: z.string().describe('Discount ID to archive.'),
562
+ });
563
+ // =========================================================================
564
+ // Webhooks
565
+ // =========================================================================
566
+ export const WebhookEventType = z.enum([
567
+ 'checkout.completed',
568
+ 'customer.created',
569
+ 'customer.updated',
570
+ 'order.created',
571
+ 'order.updated',
572
+ 'order.refunded',
573
+ 'subscription.created',
574
+ 'subscription.updated',
575
+ 'subscription.cancelled',
576
+ 'subscription.plan_changed',
577
+ 'subscription.trial_will_end',
578
+ 'invoice.created',
579
+ 'invoice.paid',
580
+ 'invoice.payment_failed',
581
+ 'refund.created',
582
+ 'refund.updated',
583
+ 'feature.usage_alert',
584
+ 'payment_method.created',
585
+ 'payment_method.updated',
586
+ 'payment_method.deleted',
587
+ ]);
588
+ const RevealSecret = z
589
+ .boolean()
590
+ .optional()
591
+ .describe('Include the signing secret in the result. Default false: the secret is hidden so it never enters the conversation. Prefer writing it straight to the app env file with a command.');
592
+ export const ListWebhookEndpoints = z.object({
593
+ page: z.number().int().positive().optional(),
594
+ pageSize: PageSize,
595
+ revealSecret: RevealSecret,
596
+ });
597
+ export const WebhookEndpointCreate = z.object({
598
+ url: z
599
+ .string()
600
+ .url()
601
+ .describe('Public URL that receives events. Private, loopback and internal addresses (such as localhost) are rejected.'),
602
+ events: z.array(WebhookEventType).min(1).describe('Event types to deliver to this endpoint.'),
603
+ enabled: z.boolean().optional().describe('Whether the endpoint receives deliveries.'),
604
+ revealSecret: RevealSecret,
605
+ });
606
+ export const WebhookEndpointRetrieve = z.object({
607
+ endpointId: z.string().describe('Webhook endpoint ID (path param `pk`).'),
608
+ revealSecret: RevealSecret,
609
+ });
610
+ export const WebhookEndpointUpdate = z.object({
611
+ endpointId: z.string().describe('Webhook endpoint ID (path param `pk`).'),
612
+ url: z.string().url().optional(),
613
+ events: z.array(WebhookEventType).min(1).optional(),
614
+ enabled: z.boolean().optional(),
615
+ revealSecret: RevealSecret,
616
+ });
617
+ export const WebhookEndpointDelete = z.object({
618
+ endpointId: z.string().describe('Webhook endpoint ID to delete.'),
619
+ });
620
+ export const ListWebhookLogs = z.object({
621
+ startDate: z
622
+ .string()
623
+ .regex(/^\d{4}-\d{2}-\d{2}$/)
624
+ .optional()
625
+ .describe('YYYY-MM-DD. Results never go back more than 30 days.'),
626
+ endDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe('YYYY-MM-DD.'),
627
+ page: z.number().int().positive().optional(),
628
+ pageSize: PageSize,
629
+ });
455
630
  //# sourceMappingURL=kelviq.js.map