@commet/node 8.0.0 → 8.0.1

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.
package/README.md CHANGED
@@ -97,6 +97,52 @@ const portal = await commet.portal.getUrl({
97
97
  });
98
98
  ```
99
99
 
100
+ ## Offers and selectable pricing
101
+
102
+ Create reusable country Markets and attach market prices to a base price or an inherited selectable variant:
103
+
104
+ ```typescript
105
+ const argentina = await commet.pricing.createMarketGroup({
106
+ name: 'Argentina',
107
+ countryCodes: ['AR'],
108
+ });
109
+
110
+ const variant = await commet.plans.addPrice({
111
+ id: 'pln_pro',
112
+ billingInterval: 'monthly',
113
+ inheritsFromPriceId: 'pp_monthly',
114
+ marketPrices: [{
115
+ marketGroupId: argentina.id,
116
+ currency: 'ars',
117
+ price: 1_500_000,
118
+ }],
119
+ });
120
+
121
+ await commet.subscriptions.create({
122
+ customerId: 'cus_123',
123
+ planId: 'pln_pro',
124
+ priceId: variant.id,
125
+ });
126
+ ```
127
+
128
+ Offers own discount phases. Promo Codes reference Promotional Offers instead of duplicating discount fields:
129
+
130
+ ```typescript
131
+ const offer = await commet.offers.create({
132
+ name: 'First three months at 25% off',
133
+ purpose: 'promotional',
134
+ planPriceIds: ['pp_monthly'],
135
+ phases: [{ type: 'percentage', percentage: 2500, durationCycles: 3 }],
136
+ });
137
+
138
+ await commet.promoCodes.create({
139
+ code: 'LAUNCH25',
140
+ offerId: offer.id,
141
+ });
142
+ ```
143
+
144
+ Omitting `priceId` preserves default price resolution and still applies Currency Pricing and Markets. A subscription keeps the selected price identity and renews from that catalog price's current value.
145
+
100
146
  ## Type Safety
101
147
 
102
148
  Use the [Commet CLI](https://www.npmjs.com/package/commet) to generate TypeScript types from your organization:
package/dist/index.d.mts CHANGED
@@ -2888,7 +2888,7 @@ declare class SubscriptionsResource {
2888
2888
  purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<CreditGrant>;
2889
2889
  /** Creates a hosted checkout session for the customer to update the subscription's default payment method. */
2890
2890
  updatePaymentMethod(params: UpdatePaymentMethodParams, options?: RequestOptions): Promise<PaymentMethodUpdateCheckout>;
2891
- /** Preview proration details for an immediate plan change (an upgrade or a longer interval) without applying it. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. Downgrades — a cheaper plan in the same group, or a shorter interval — are scheduled for the end of the current period instead of being prorated, so they return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with a Promotional Offer. */
2891
+ /** Preview proration details for an immediate plan change (a higher-sort-order plan or a longer interval) without applying it. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. Downgrades — a lower-sort-order plan in the same group, or a shorter interval — are scheduled for the end of the current period instead of being prorated, so they return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with a Promotional Offer. */
2892
2892
  previewChange(params: PreviewChangePlanParams, options?: RequestOptions): Promise<PreviewChange>;
2893
2893
  /** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply a Promotional Offer by offerId; past-due recovery cannot. */
2894
2894
  reactivate(params: ReactivateSubscriptionParams, options?: RequestOptions): Promise<ReactivatedSubscription>;
package/dist/index.d.ts CHANGED
@@ -2888,7 +2888,7 @@ declare class SubscriptionsResource {
2888
2888
  purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<CreditGrant>;
2889
2889
  /** Creates a hosted checkout session for the customer to update the subscription's default payment method. */
2890
2890
  updatePaymentMethod(params: UpdatePaymentMethodParams, options?: RequestOptions): Promise<PaymentMethodUpdateCheckout>;
2891
- /** Preview proration details for an immediate plan change (an upgrade or a longer interval) without applying it. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. Downgrades — a cheaper plan in the same group, or a shorter interval — are scheduled for the end of the current period instead of being prorated, so they return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with a Promotional Offer. */
2891
+ /** Preview proration details for an immediate plan change (a higher-sort-order plan or a longer interval) without applying it. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. Downgrades — a lower-sort-order plan in the same group, or a shorter interval — are scheduled for the end of the current period instead of being prorated, so they return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with a Promotional Offer. */
2892
2892
  previewChange(params: PreviewChangePlanParams, options?: RequestOptions): Promise<PreviewChange>;
2893
2893
  /** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply a Promotional Offer by offerId; past-due recovery cannot. */
2894
2894
  reactivate(params: ReactivateSubscriptionParams, options?: RequestOptions): Promise<ReactivatedSubscription>;
package/dist/index.js CHANGED
@@ -685,7 +685,7 @@ var SubscriptionsResource = class {
685
685
  options
686
686
  );
687
687
  }
688
- /** Preview proration details for an immediate plan change (an upgrade or a longer interval) without applying it. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. Downgrades — a cheaper plan in the same group, or a shorter interval — are scheduled for the end of the current period instead of being prorated, so they return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with a Promotional Offer. */
688
+ /** Preview proration details for an immediate plan change (a higher-sort-order plan or a longer interval) without applying it. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. Downgrades — a lower-sort-order plan in the same group, or a shorter interval — are scheduled for the end of the current period instead of being prorated, so they return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with a Promotional Offer. */
689
689
  async previewChange(params, options) {
690
690
  const { id, ...rest } = params;
691
691
  return this.httpClient.post(
@@ -948,7 +948,7 @@ var CommetValidationError = class extends CommetError {
948
948
 
949
949
  // src/version.ts
950
950
  var API_VERSION = "2026-07-24";
951
- var SDK_VERSION = "8.0.0";
951
+ var SDK_VERSION = "8.0.1";
952
952
 
953
953
  // src/utils/telemetry.ts
954
954
  var registeredIntegrations = /* @__PURE__ */ new Set();