@waffo/pancake-ts 0.20.0 → 0.22.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,19 @@ 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.22.0] - 2026-09-17
8
+
9
+ Subscription webhooks carry the payment channel's billing period number, and merchants can switch off the trial-ending reminder their buyers receive.
10
+
11
+ ### Added
12
+
13
+ - **`WebhookEventData.periodNumber` (optional `number`)** — which billing period the event refers to, exactly as reported by the payment channel: `1` on the first charge, `N` on the Nth renewal. A failed charge still consumes a period, so it is not a count of successful charges; `0` means the channel authorized the subscription but has not charged it yet. On payment events it is the period of that charge, on refund events the period of the **refunded** charge. Present on the subscription domain events and on `subscription.payment_succeeded`; **absent on one-time orders and their refunds**. Several events in one period share the number, so it is not a deduplication key — use `id` or `eventId`.
14
+
15
+ ### Changed
16
+
17
+ - **`MerchantWritableNotificationSettings` picks `emailTrialEnding`** — the customer email sent before a paid trial ends is now a merchant decision, writable through `client.stores.update({ notificationSettings: { emailTrialEnding: false } })` and readable back from `Store.notificationSettings`. It defaults to on, is decided per store (there is no per-recipient form of it), and joins `emailUpcomingCharge` as the second `email*` key this type accepts. Every other `email*` toggle stays platform-managed: `update-store` drops it and names it in the response's `warnings`.
18
+ - **`notificationSettings: null` clears `emailTrialEnding` too.** The documented clearing semantics apply to every merchant-writable key, so a store that switched the reminder off gets it back on. Send a partial update carrying only the keys you want to change to keep it off.
19
+
7
20
  ## [0.20.0] - 2026-09-02
8
21
 
9
22
  Subscription period and status now travel on the subscription events only; `subscription.payment_succeeded` is a pure payment event.
package/README.md CHANGED
@@ -373,10 +373,16 @@ 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 the two buyer-facing reminders
379
+ // emailUpcomingCharge (renewal) and emailTrialEnding (trial ending). Every
380
+ // other consumer email toggle (emailOrderConfirmation, emailSubscription*,
381
+ // emailTrialStarted, emailRefundSucceeded) is managed by the PANCAKE
382
+ // platform and silently dropped if passed. Payout result emails are
383
+ // always delivered and have no toggle.
384
+ // NOTE: both reminders are decided per store — every buyer of the store is covered
385
+ // by the same switch, and passing notificationSettings: null puts them back on.
380
386
  // NOTE: supportEmail and website are not writable here — they are set by
381
387
  // ownership verification (email code / domain) or KYB approval.
382
388
  const { store: updated } = await client.stores.update({
@@ -384,6 +390,10 @@ const { store: updated } = await client.stores.update({
384
390
  notificationSettings: {
385
391
  notifyNewOrders: true,
386
392
  notifyNewSubscriptions: false,
393
+ // Stop reminding this store's buyers before a renewal is charged.
394
+ emailUpcomingCharge: false,
395
+ // Stop reminding this store's buyers that their paid trial is about to end.
396
+ emailTrialEnding: false,
387
397
  },
388
398
  });
389
399
 
package/dist/index.cjs CHANGED
@@ -927,6 +927,12 @@ var StoresResource = class {
927
927
  * partial updates: omitted sub-fields keep existing values, `null` clears a
928
928
  * field. Pass the entire settings object as `null` to clear all fields.
929
929
  *
930
+ * `notificationSettings` accepts the merchant-writable keys only — every
931
+ * `notify*` toggle plus the two customer reminders `emailUpcomingCharge` and
932
+ * `emailTrialEnding`. Other `email*` keys are dropped and named in `warnings`.
933
+ * Passing `notificationSettings: null` clears the writable keys back to their
934
+ * default of on, so send a partial update to keep a reminder switched off.
935
+ *
930
936
  * **BREAKING (2026-05)**: the legacy `webhookSettings` parameter is removed.
931
937
  * Use `client.webhooks.add / update / remove` to manage webhook endpoints,
932
938
  * and query the configured webhook list via GraphQL `Store.storeWebhooks`.
@@ -945,7 +951,14 @@ var StoresResource = class {
945
951
  * // Toggle a notification preference
946
952
  * const { store } = await client.stores.update({
947
953
  * id: "STO_xxx",
948
- * notificationSettings: { emailOrderConfirmation: false },
954
+ * notificationSettings: { notifyNewOrders: false },
955
+ * });
956
+ *
957
+ * @example
958
+ * // Stop reminding this store's buyers that their trial is about to end
959
+ * const { store } = await client.stores.update({
960
+ * id: "STO_xxx",
961
+ * notificationSettings: { emailTrialEnding: false },
949
962
  * });
950
963
  */
951
964
  async update(params) {