@waffo/pancake-ts 0.19.1 → 0.21.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,26 @@ All notable changes to `@waffo/pancake-ts` will be documented in this file.
4
4
 
5
5
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.20.0] - 2026-09-02
8
+
9
+ Subscription period and status now travel on the subscription events only; `subscription.payment_succeeded` is a pure payment event.
10
+
11
+ ### Removed
12
+
13
+ - **`WebhookEventType.SubscriptionUpdated` (`subscription.updated`)** — the platform has no publisher for it. Plan changes are published as `subscription.plan_changed`.
14
+ - **`subscription.payment_succeeded` no longer carries `billingPeriod`, `currentPeriodStart`, `currentPeriodEnd`, `canceledAt` or `orderStatus`.** Those five fields described the subscription, not the charge, and were populated from whichever channel notification happened to land first — 10.3% of first payments arrived without a period. They now travel on the subscription domain events, which write and publish inside the same request. `docs/webhook-guide.md` has the field-by-event table and a per-use-case migration path; the payment fields on this event are unchanged.
15
+
16
+ ### Added
17
+
18
+ - **`WebhookEventType.SubscriptionRenewed` (`subscription.renewed`)** — emitted when the current billing period actually rolls forward. Carries the new period. The first period is not a renewal and does not emit it; a redelivered channel notification does not emit a second one.
19
+ - **`WebhookEventType.SubscriptionRecovered` (`subscription.recovered`)** — emitted when a retried charge brings a past-due subscription back to active, closing the loop with `subscription.past_due`. Ordinary renewals and first payments do not emit it.
20
+ - **`WebhookEventType.SubscriptionPlanChanged` / `SubscriptionPlanChangeScheduled` / `SubscriptionPlanChangeFailed`** — the three plan-change events, subscribable from the dashboard.
21
+ - **`NotificationSettings.emailSubscriptionPlanChanged`** — the platform-managed toggle shared by the three plan-change customer emails. Read-only from this SDK, like the other `email*` keys.
22
+
23
+ ### Changed
24
+
25
+ - **`NotificationSettings.notifySubscriptionUpdated` renamed to `notifySubscriptionPlanChanged`** — the old key was never accepted by `update-store`, so a settings object built from the previous type was rejected by server-side validation. `MerchantWritableNotificationSettings` picks the new key.
26
+
7
27
  ## [0.19.0] - 2026-08-18
8
28
 
9
29
  Subscription products can now charge for the trial period.
package/README.md CHANGED
@@ -373,10 +373,13 @@ const { store } = await client.stores.create({ name: "My Store" });
373
373
 
374
374
  // Update settings (notification, checkout theme).
375
375
  // NOTE: webhook configuration moved to client.webhooks (see Webhooks section below).
376
- // NOTE: only merchant-facing `notify*` toggles (notifyNewOrders / notifyNewSubscriptions /
377
- // notifySubscription* / notifyChargeback / notifyPayout*) are writable here;
378
- // consumer email toggles (emailOrderConfirmation, emailSubscription*, emailTrial*) are
379
- // managed by the PANCAKE platform and silently dropped if passed.
376
+ // NOTE: writable here are all the merchant-facing `notify*` toggles (notifyNewOrders /
377
+ // notifyNewSubscriptions / notifySubscription* / notifyChargeback /
378
+ // notifyRefundSucceeded) plus emailUpcomingCharge, the buyer-facing renewal
379
+ // reminder. Every other consumer email toggle (emailOrderConfirmation,
380
+ // emailSubscription*, emailTrial*, emailRefundSucceeded) is managed by the
381
+ // PANCAKE platform and silently dropped if passed. Payout result emails are
382
+ // always delivered and have no toggle.
380
383
  // NOTE: supportEmail and website are not writable here — they are set by
381
384
  // ownership verification (email code / domain) or KYB approval.
382
385
  const { store: updated } = await client.stores.update({
@@ -384,6 +387,8 @@ const { store: updated } = await client.stores.update({
384
387
  notificationSettings: {
385
388
  notifyNewOrders: true,
386
389
  notifyNewSubscriptions: false,
390
+ // Stop reminding this store's buyers before a renewal is charged.
391
+ emailUpcomingCharge: false,
387
392
  },
388
393
  });
389
394
 
@@ -581,23 +586,23 @@ try {
581
586
 
582
587
  ### Enums
583
588
 
584
- | Export | Values |
585
- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
586
- | `Environment` | `Test`, `Prod` |
587
- | `TaxCategory` | `DigitalGoods`, `SaaS`, `Software`, `Ebook`, `OnlineCourse`, `Consulting`, `ProfessionalService` |
588
- | `BillingPeriod` | `Weekly`, `Monthly`, `Quarterly`, `Yearly` |
589
- | `ProductVersionStatus` | `Active`, `Inactive` |
590
- | `EntityStatus` | `Active`, `Inactive`, `Suspended` |
591
- | `StoreRole` | `Owner`, `Admin`, `Member` |
592
- | `OnetimeOrderStatus` | `Pending`, `Completed`, `Canceled` |
593
- | `SubscriptionOrderStatus` | `Pending`, `Active`, `Canceling`, `PastDue`, `Closed`, `Canceled`, `Expired` |
594
- | `PaymentStatus` | `Pending`, `Succeeded`, `Failed`, `Canceled` |
595
- | `RefundTicketStatus` | `Pending`, `Approved`, `Rejected`, `Processing`, `Succeeded`, `Failed` |
596
- | `RefundStatus` | `Succeeded`, `Failed` |
597
- | `MediaType` | `Image`, `Video` |
598
- | `CheckoutSessionProductType` | `Onetime`, `Subscription` |
599
- | `ErrorLayer` | `Gateway`, `User`, `Store`, `Product`, `Order`, `Ticket`, `GraphQL`, `Resource`, `Email` |
600
- | `WebhookEventType` | `OrderCompleted`, `SubscriptionActivated`, `SubscriptionPaymentSucceeded`, `SubscriptionCanceling`, `SubscriptionUncanceled`, `SubscriptionUpdated`, `SubscriptionCanceled`, `SubscriptionPastDue`, `RefundSucceeded`, `RefundFailed` |
589
+ | Export | Values |
590
+ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
591
+ | `Environment` | `Test`, `Prod` |
592
+ | `TaxCategory` | `DigitalGoods`, `SaaS`, `Software`, `Ebook`, `OnlineCourse`, `Consulting`, `ProfessionalService` |
593
+ | `BillingPeriod` | `Weekly`, `Monthly`, `Quarterly`, `Yearly` |
594
+ | `ProductVersionStatus` | `Active`, `Inactive` |
595
+ | `EntityStatus` | `Active`, `Inactive`, `Suspended` |
596
+ | `StoreRole` | `Owner`, `Admin`, `Member` |
597
+ | `OnetimeOrderStatus` | `Pending`, `Completed`, `Canceled` |
598
+ | `SubscriptionOrderStatus` | `Pending`, `Active`, `Canceling`, `PastDue`, `Closed`, `Canceled`, `Expired` |
599
+ | `PaymentStatus` | `Pending`, `Succeeded`, `Failed`, `Canceled` |
600
+ | `RefundTicketStatus` | `Pending`, `Approved`, `Rejected`, `Processing`, `Succeeded`, `Failed` |
601
+ | `RefundStatus` | `Succeeded`, `Failed` |
602
+ | `MediaType` | `Image`, `Video` |
603
+ | `CheckoutSessionProductType` | `Onetime`, `Subscription` |
604
+ | `ErrorLayer` | `Gateway`, `User`, `Store`, `Product`, `Order`, `Ticket`, `GraphQL`, `Resource`, `Email` |
605
+ | `WebhookEventType` | `OrderCompleted`, `SubscriptionActivated`, `SubscriptionPaymentSucceeded`, `SubscriptionRenewed`, `SubscriptionRecovered`, `SubscriptionPlanChanged`, `SubscriptionPlanChangeScheduled`, `SubscriptionPlanChangeFailed`, `SubscriptionCanceling`, `SubscriptionUncanceled`, `SubscriptionCanceled`, `SubscriptionPastDue`, `RefundSucceeded`, `RefundFailed` |
601
606
 
602
607
  ### Types
603
608
 
package/dist/index.cjs CHANGED
@@ -1564,9 +1564,13 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
1564
1564
  WebhookEventType2["OrderCompleted"] = "order.completed";
1565
1565
  WebhookEventType2["SubscriptionActivated"] = "subscription.activated";
1566
1566
  WebhookEventType2["SubscriptionPaymentSucceeded"] = "subscription.payment_succeeded";
1567
+ WebhookEventType2["SubscriptionRenewed"] = "subscription.renewed";
1568
+ WebhookEventType2["SubscriptionRecovered"] = "subscription.recovered";
1569
+ WebhookEventType2["SubscriptionPlanChanged"] = "subscription.plan_changed";
1570
+ WebhookEventType2["SubscriptionPlanChangeScheduled"] = "subscription.plan_change_scheduled";
1571
+ WebhookEventType2["SubscriptionPlanChangeFailed"] = "subscription.plan_change_failed";
1567
1572
  WebhookEventType2["SubscriptionCanceling"] = "subscription.canceling";
1568
1573
  WebhookEventType2["SubscriptionUncanceled"] = "subscription.uncanceled";
1569
- WebhookEventType2["SubscriptionUpdated"] = "subscription.updated";
1570
1574
  WebhookEventType2["SubscriptionCanceled"] = "subscription.canceled";
1571
1575
  WebhookEventType2["SubscriptionPastDue"] = "subscription.past_due";
1572
1576
  WebhookEventType2["RefundSucceeded"] = "refund.succeeded";