@waffo/pancake-ts 0.5.2 → 0.7.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/dist/index.d.cts CHANGED
@@ -236,18 +236,61 @@ interface SessionToken {
236
236
  expiresAt: string;
237
237
  }
238
238
  /**
239
- * Webhook configuration for test and production environments.
239
+ * Webhook channel — HTTP for the standard RSA-signed envelope, the rest for
240
+ * IM platform native payloads (Feishu / Discord / Telegram / Slack).
241
+ */
242
+ type WebhookChannel = "http" | "feishu" | "discord" | "telegram" | "slack";
243
+ /**
244
+ * Configured webhook endpoint (one row of `store.store_webhooks`).
245
+ *
240
246
  * @see waffo-pancake-store-service/app/lib/types.ts
241
247
  */
242
- interface WebhookSettings {
243
- /** Test environment webhook URL */
244
- testWebhookUrl: string | null;
245
- /** Production environment webhook URL */
246
- prodWebhookUrl: string | null;
247
- /** Event types subscribed in test environment */
248
- testEvents: string[];
249
- /** Event types subscribed in production environment */
250
- prodEvents: string[];
248
+ interface StoreWebhook {
249
+ /** Webhook UUID (not Short ID) */
250
+ id: string;
251
+ /** Owning store Short ID (`STO_…`) */
252
+ storeId: string;
253
+ channel: WebhookChannel;
254
+ /** Target webhook URL */
255
+ url: string;
256
+ /** Subscribed event types (use `WebhookEventType` enum or its string literal) */
257
+ events: `${WebhookEventType}`[];
258
+ /** Whether this webhook fires in test or prod environment */
259
+ testMode: boolean;
260
+ /** Channel-specific credential (e.g. Telegram chat_id) */
261
+ secret: string | null;
262
+ createdAt: string;
263
+ updatedAt: string;
264
+ }
265
+ /** Parameters for creating a webhook. */
266
+ interface AddWebhookParams {
267
+ /** Store Short ID (`STO_…`) */
268
+ storeId: string;
269
+ channel: WebhookChannel;
270
+ /** Target webhook URL */
271
+ url: string;
272
+ /** Subscribed event types (use `WebhookEventType` enum or its string literal) */
273
+ events: `${WebhookEventType}`[];
274
+ /** Whether this webhook fires in test (true) or prod (false) */
275
+ testMode: boolean;
276
+ /** Channel-specific credential (e.g. Telegram chat_id) */
277
+ secret?: string | null;
278
+ }
279
+ /** Parameters for updating a webhook. `channel` and `testMode` are immutable. */
280
+ interface UpdateWebhookParams {
281
+ /** Webhook UUID */
282
+ id: string;
283
+ /** Replace target URL (must remain on the same channel host) */
284
+ url?: string;
285
+ /** Replace subscribed event types (use `WebhookEventType` enum or its string literal) */
286
+ events?: `${WebhookEventType}`[];
287
+ /** Replace channel-specific credential */
288
+ secret?: string | null;
289
+ }
290
+ /** Parameters for hard-deleting a webhook. */
291
+ interface RemoveWebhookParams {
292
+ /** Webhook UUID */
293
+ id: string;
251
294
  }
252
295
  /**
253
296
  * Notification settings (all default to true).
@@ -297,7 +340,6 @@ interface Store {
297
340
  website: string | null;
298
341
  slug: string | null;
299
342
  prodEnabled: boolean;
300
- webhookSettings: WebhookSettings | null;
301
343
  notificationSettings: NotificationSettings | null;
302
344
  checkoutSettings: CheckoutSettings | null;
303
345
  deletedAt: string | null;
@@ -315,6 +357,10 @@ interface CreateStoreParams {
315
357
  * Settings objects support partial updates — omitted sub-fields keep their
316
358
  * existing values, `null` clears a field, and a concrete value sets it.
317
359
  * Pass the entire settings object as `null` to clear all fields in the group.
360
+ *
361
+ * **BREAKING (2026-05)**: the legacy `webhookSettings` field is removed.
362
+ * Manage webhooks via `client.webhooks.add / update / remove`; query the
363
+ * webhook list through GraphQL `Store.storeWebhooks`.
318
364
  */
319
365
  interface UpdateStoreParams {
320
366
  /** Store ID */
@@ -329,8 +375,6 @@ interface UpdateStoreParams {
329
375
  supportEmail?: string | null;
330
376
  /** Store website URL (set to `null` to remove) */
331
377
  website?: string | null;
332
- /** Webhook configuration (partial update — omitted fields keep existing values, set to `null` to clear all) */
333
- webhookSettings?: Partial<WebhookSettings> | null;
334
378
  /** Notification preferences (partial update — omitted fields keep existing values, set to `null` to clear all) */
335
379
  notificationSettings?: Partial<NotificationSettings> | null;
336
380
  /** Checkout page theme configuration (partial update — omitted fields keep existing values, set to `null` to clear all) */
@@ -841,6 +885,12 @@ interface GraphQLResponse<T = Record<string, unknown>> {
841
885
  column: number;
842
886
  }>;
843
887
  path?: string[];
888
+ aiHint?: string;
889
+ }>;
890
+ warnings?: Array<{
891
+ message: string;
892
+ layer: string;
893
+ aiHint?: string;
844
894
  }>;
845
895
  }
846
896
  /**
@@ -1507,9 +1557,13 @@ declare class StoresResource {
1507
1557
  /**
1508
1558
  * Update an existing store's settings.
1509
1559
  *
1510
- * Settings objects (`webhookSettings`, `notificationSettings`, `checkoutSettings`)
1511
- * support partial updates: omitted sub-fields keep existing values, `null` clears
1512
- * a field. Pass the entire settings object as `null` to clear all fields.
1560
+ * Settings objects (`notificationSettings`, `checkoutSettings`) support
1561
+ * partial updates: omitted sub-fields keep existing values, `null` clears a
1562
+ * field. Pass the entire settings object as `null` to clear all fields.
1563
+ *
1564
+ * **BREAKING (2026-05)**: the legacy `webhookSettings` parameter is removed.
1565
+ * Use `client.webhooks.add / update / remove` to manage webhook endpoints,
1566
+ * and query the configured webhook list via GraphQL `Store.storeWebhooks`.
1513
1567
  *
1514
1568
  * @param params - Fields to update (only provided fields are changed)
1515
1569
  * @returns Updated store entity
@@ -1522,10 +1576,10 @@ declare class StoresResource {
1522
1576
  * });
1523
1577
  *
1524
1578
  * @example
1525
- * // Clear test webhook URL while keeping other webhook settings
1579
+ * // Toggle a notification preference
1526
1580
  * const { store } = await client.stores.update({
1527
1581
  * id: "STO_xxx",
1528
- * webhookSettings: { testWebhookUrl: null },
1582
+ * notificationSettings: { emailOrderConfirmation: false },
1529
1583
  * });
1530
1584
  */
1531
1585
  update(params: UpdateStoreParams): Promise<{
@@ -1682,15 +1736,96 @@ declare class SubscriptionProductsResource {
1682
1736
  }
1683
1737
 
1684
1738
  /**
1685
- * Webhook signature verification resource.
1739
+ * Webhook resource manages webhook configurations (HTTP / Feishu / Discord
1740
+ * / Telegram / Slack) and verifies inbound webhook signatures.
1686
1741
  *
1687
- * Unlike other resources, this does not use HttpClient — webhook verification
1688
- * is a local cryptographic operation that does not require API calls.
1742
+ * **Mutations only**: `add`, `update`, `remove` all hit POST endpoints.
1743
+ * To list a store's webhooks, use GraphQL `Store.storeWebhooks` via
1744
+ * `client.graphql.query`.
1745
+ *
1746
+ * Verification (`verify`) is a local cryptographic operation that does not
1747
+ * require API calls.
1689
1748
  */
1690
1749
  declare class WebhooksResource {
1750
+ private readonly http;
1691
1751
  private readonly publicKeys;
1692
- /** @param publicKeys - Optional config-level public key(s) from WaffoPancakeConfig */
1693
- constructor(publicKeys: WebhookPublicKeys | undefined);
1752
+ /**
1753
+ * @param http - HTTP client (used for add/update/remove)
1754
+ * @param publicKeys - Optional config-level public key(s) from WaffoPancakeConfig
1755
+ */
1756
+ constructor(http: HttpClient, publicKeys: WebhookPublicKeys | undefined);
1757
+ /**
1758
+ * Add a webhook endpoint to a store.
1759
+ *
1760
+ * @param params - Webhook configuration
1761
+ * @returns Created webhook entity
1762
+ *
1763
+ * @example
1764
+ * // HTTP webhook (RSA-signed envelope, default)
1765
+ * const { webhook } = await client.webhooks.add({
1766
+ * storeId: "STO_xxx",
1767
+ * channel: "http",
1768
+ * url: "https://example.com/webhook",
1769
+ * events: ["order.completed", "refund.succeeded"],
1770
+ * testMode: false,
1771
+ * });
1772
+ *
1773
+ * @example
1774
+ * // Discord webhook (uses Discord embed format)
1775
+ * await client.webhooks.add({
1776
+ * storeId: "STO_xxx",
1777
+ * channel: "discord",
1778
+ * url: "https://discord.com/api/webhooks/...",
1779
+ * events: ["order.completed"],
1780
+ * testMode: false,
1781
+ * });
1782
+ *
1783
+ * @example
1784
+ * // Telegram bot — chat_id goes in `secret`; URL is the bot's sendMessage endpoint
1785
+ * await client.webhooks.add({
1786
+ * storeId: "STO_xxx",
1787
+ * channel: "telegram",
1788
+ * url: "https://api.telegram.org/bot123:ABC/sendMessage",
1789
+ * events: ["order.completed"],
1790
+ * testMode: false,
1791
+ * secret: "8737101383",
1792
+ * });
1793
+ */
1794
+ add(params: AddWebhookParams): Promise<{
1795
+ webhook: StoreWebhook;
1796
+ }>;
1797
+ /**
1798
+ * Update an existing webhook (only `url`, `events`, and `secret` are mutable).
1799
+ *
1800
+ * `channel` and `testMode` cannot be changed — remove the webhook and
1801
+ * re-add it instead. URL changes must remain on the same channel host
1802
+ * whitelist.
1803
+ *
1804
+ * @param params - Fields to update
1805
+ * @returns Updated webhook entity
1806
+ *
1807
+ * @example
1808
+ * await client.webhooks.update({
1809
+ * id: "11111111-2222-3333-4444-555555555555",
1810
+ * events: ["order.completed", "refund.succeeded", "subscription.canceled"],
1811
+ * });
1812
+ */
1813
+ update(params: UpdateWebhookParams): Promise<{
1814
+ webhook: StoreWebhook;
1815
+ }>;
1816
+ /**
1817
+ * Hard-delete a webhook. Historical `webhook_deliveries` rows are retained
1818
+ * (with `storeWebhookId` set to null) for audit purposes.
1819
+ *
1820
+ * @param params - Webhook to remove
1821
+ * @returns The removed webhook entity (snapshot before deletion)
1822
+ *
1823
+ * @example
1824
+ * await client.webhooks.remove({ id: "11111111-..." });
1825
+ */
1826
+ remove(params: RemoveWebhookParams): Promise<{
1827
+ webhook: StoreWebhook;
1828
+ }>;
1694
1829
  /**
1695
1830
  * Verify and parse an incoming webhook event.
1696
1831
  *
@@ -1882,4 +2017,4 @@ declare class WaffoPancakeError extends Error {
1882
2017
  */
1883
2018
  declare function verifyWebhook<T = Record<string, unknown>>(payload: string, signatureHeader: string | undefined | null, options?: VerifyWebhookOptions): WebhookEvent<T>;
1884
2019
 
1885
- export { type AddMerchantParams, type AddMerchantResult, type AnonymousCheckoutParams, type ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AuthenticatedCheckoutParams, type AuthenticatedCheckoutResult, type BillingDetail, BillingPeriod, type CancelOnetimeOrderParams, type CancelOnetimeOrderResult, type CancelSubscriptionParams, type CancelSubscriptionResult, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, type CreateStoreParams, type CreateSubscriptionProductGroupParams, type CreateSubscriptionProductParams, type DeleteStoreParams, type DeleteSubscriptionProductGroupParams, EntityStatus, Environment, ErrorLayer, type GraphQLParams, type GraphQLResponse, type GroupRules, type IssueSessionTokenParams, type MediaItem, MediaType, type NotificationSettings, OnetimeOrderStatus, type OnetimeProductDetail, PaymentStatus, type PriceInfo, type Prices, ProductVersionStatus, type PublishOnetimeProductParams, type PublishSubscriptionProductGroupParams, type PublishSubscriptionProductParams, type ReactivateSubscriptionParams, type ReactivateSubscriptionResult, RefundStatus, type RefundTicket, RefundTicketStatus, type RefundTicketVersionData, type RemoveMerchantParams, type RemoveMerchantResult, type RequestedAmount, type ResubmitRefundTicketParams, type SessionToken, type Store, StoreRole, SubscriptionOrderStatus, type SubscriptionProductDetail, type SubscriptionProductGroup, TaxCategory, type UpdateOnetimeProductParams, type UpdateOnetimeStatusParams, type UpdateRoleParams, type UpdateRoleResult, type UpdateStoreParams, type UpdateSubscriptionProductGroupParams, type UpdateSubscriptionProductParams, type UpdateSubscriptionStatusParams, type VerifyWebhookOptions, WaffoPancake, type WaffoPancakeConfig, WaffoPancakeError, type WebhookEvent, type WebhookEventData, WebhookEventType, type WebhookPublicKeys, type WebhookSettings, verifyWebhook };
2020
+ export { type AddMerchantParams, type AddMerchantResult, type AddWebhookParams, type AnonymousCheckoutParams, type ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AuthenticatedCheckoutParams, type AuthenticatedCheckoutResult, type BillingDetail, BillingPeriod, type CancelOnetimeOrderParams, type CancelOnetimeOrderResult, type CancelSubscriptionParams, type CancelSubscriptionResult, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, type CreateStoreParams, type CreateSubscriptionProductGroupParams, type CreateSubscriptionProductParams, type DeleteStoreParams, type DeleteSubscriptionProductGroupParams, EntityStatus, Environment, ErrorLayer, type GraphQLParams, type GraphQLResponse, type GroupRules, type IssueSessionTokenParams, type MediaItem, MediaType, type NotificationSettings, OnetimeOrderStatus, type OnetimeProductDetail, PaymentStatus, type PriceInfo, type Prices, ProductVersionStatus, type PublishOnetimeProductParams, type PublishSubscriptionProductGroupParams, type PublishSubscriptionProductParams, type ReactivateSubscriptionParams, type ReactivateSubscriptionResult, RefundStatus, type RefundTicket, RefundTicketStatus, type RefundTicketVersionData, type RemoveMerchantParams, type RemoveMerchantResult, type RemoveWebhookParams, type RequestedAmount, type ResubmitRefundTicketParams, type SessionToken, type Store, StoreRole, type StoreWebhook, SubscriptionOrderStatus, type SubscriptionProductDetail, type SubscriptionProductGroup, TaxCategory, type UpdateOnetimeProductParams, type UpdateOnetimeStatusParams, type UpdateRoleParams, type UpdateRoleResult, type UpdateStoreParams, type UpdateSubscriptionProductGroupParams, type UpdateSubscriptionProductParams, type UpdateSubscriptionStatusParams, type UpdateWebhookParams, type VerifyWebhookOptions, WaffoPancake, type WaffoPancakeConfig, WaffoPancakeError, type WebhookChannel, type WebhookEvent, type WebhookEventData, WebhookEventType, type WebhookPublicKeys, verifyWebhook };
package/dist/index.d.ts CHANGED
@@ -236,18 +236,61 @@ interface SessionToken {
236
236
  expiresAt: string;
237
237
  }
238
238
  /**
239
- * Webhook configuration for test and production environments.
239
+ * Webhook channel — HTTP for the standard RSA-signed envelope, the rest for
240
+ * IM platform native payloads (Feishu / Discord / Telegram / Slack).
241
+ */
242
+ type WebhookChannel = "http" | "feishu" | "discord" | "telegram" | "slack";
243
+ /**
244
+ * Configured webhook endpoint (one row of `store.store_webhooks`).
245
+ *
240
246
  * @see waffo-pancake-store-service/app/lib/types.ts
241
247
  */
242
- interface WebhookSettings {
243
- /** Test environment webhook URL */
244
- testWebhookUrl: string | null;
245
- /** Production environment webhook URL */
246
- prodWebhookUrl: string | null;
247
- /** Event types subscribed in test environment */
248
- testEvents: string[];
249
- /** Event types subscribed in production environment */
250
- prodEvents: string[];
248
+ interface StoreWebhook {
249
+ /** Webhook UUID (not Short ID) */
250
+ id: string;
251
+ /** Owning store Short ID (`STO_…`) */
252
+ storeId: string;
253
+ channel: WebhookChannel;
254
+ /** Target webhook URL */
255
+ url: string;
256
+ /** Subscribed event types (use `WebhookEventType` enum or its string literal) */
257
+ events: `${WebhookEventType}`[];
258
+ /** Whether this webhook fires in test or prod environment */
259
+ testMode: boolean;
260
+ /** Channel-specific credential (e.g. Telegram chat_id) */
261
+ secret: string | null;
262
+ createdAt: string;
263
+ updatedAt: string;
264
+ }
265
+ /** Parameters for creating a webhook. */
266
+ interface AddWebhookParams {
267
+ /** Store Short ID (`STO_…`) */
268
+ storeId: string;
269
+ channel: WebhookChannel;
270
+ /** Target webhook URL */
271
+ url: string;
272
+ /** Subscribed event types (use `WebhookEventType` enum or its string literal) */
273
+ events: `${WebhookEventType}`[];
274
+ /** Whether this webhook fires in test (true) or prod (false) */
275
+ testMode: boolean;
276
+ /** Channel-specific credential (e.g. Telegram chat_id) */
277
+ secret?: string | null;
278
+ }
279
+ /** Parameters for updating a webhook. `channel` and `testMode` are immutable. */
280
+ interface UpdateWebhookParams {
281
+ /** Webhook UUID */
282
+ id: string;
283
+ /** Replace target URL (must remain on the same channel host) */
284
+ url?: string;
285
+ /** Replace subscribed event types (use `WebhookEventType` enum or its string literal) */
286
+ events?: `${WebhookEventType}`[];
287
+ /** Replace channel-specific credential */
288
+ secret?: string | null;
289
+ }
290
+ /** Parameters for hard-deleting a webhook. */
291
+ interface RemoveWebhookParams {
292
+ /** Webhook UUID */
293
+ id: string;
251
294
  }
252
295
  /**
253
296
  * Notification settings (all default to true).
@@ -297,7 +340,6 @@ interface Store {
297
340
  website: string | null;
298
341
  slug: string | null;
299
342
  prodEnabled: boolean;
300
- webhookSettings: WebhookSettings | null;
301
343
  notificationSettings: NotificationSettings | null;
302
344
  checkoutSettings: CheckoutSettings | null;
303
345
  deletedAt: string | null;
@@ -315,6 +357,10 @@ interface CreateStoreParams {
315
357
  * Settings objects support partial updates — omitted sub-fields keep their
316
358
  * existing values, `null` clears a field, and a concrete value sets it.
317
359
  * Pass the entire settings object as `null` to clear all fields in the group.
360
+ *
361
+ * **BREAKING (2026-05)**: the legacy `webhookSettings` field is removed.
362
+ * Manage webhooks via `client.webhooks.add / update / remove`; query the
363
+ * webhook list through GraphQL `Store.storeWebhooks`.
318
364
  */
319
365
  interface UpdateStoreParams {
320
366
  /** Store ID */
@@ -329,8 +375,6 @@ interface UpdateStoreParams {
329
375
  supportEmail?: string | null;
330
376
  /** Store website URL (set to `null` to remove) */
331
377
  website?: string | null;
332
- /** Webhook configuration (partial update — omitted fields keep existing values, set to `null` to clear all) */
333
- webhookSettings?: Partial<WebhookSettings> | null;
334
378
  /** Notification preferences (partial update — omitted fields keep existing values, set to `null` to clear all) */
335
379
  notificationSettings?: Partial<NotificationSettings> | null;
336
380
  /** Checkout page theme configuration (partial update — omitted fields keep existing values, set to `null` to clear all) */
@@ -841,6 +885,12 @@ interface GraphQLResponse<T = Record<string, unknown>> {
841
885
  column: number;
842
886
  }>;
843
887
  path?: string[];
888
+ aiHint?: string;
889
+ }>;
890
+ warnings?: Array<{
891
+ message: string;
892
+ layer: string;
893
+ aiHint?: string;
844
894
  }>;
845
895
  }
846
896
  /**
@@ -1507,9 +1557,13 @@ declare class StoresResource {
1507
1557
  /**
1508
1558
  * Update an existing store's settings.
1509
1559
  *
1510
- * Settings objects (`webhookSettings`, `notificationSettings`, `checkoutSettings`)
1511
- * support partial updates: omitted sub-fields keep existing values, `null` clears
1512
- * a field. Pass the entire settings object as `null` to clear all fields.
1560
+ * Settings objects (`notificationSettings`, `checkoutSettings`) support
1561
+ * partial updates: omitted sub-fields keep existing values, `null` clears a
1562
+ * field. Pass the entire settings object as `null` to clear all fields.
1563
+ *
1564
+ * **BREAKING (2026-05)**: the legacy `webhookSettings` parameter is removed.
1565
+ * Use `client.webhooks.add / update / remove` to manage webhook endpoints,
1566
+ * and query the configured webhook list via GraphQL `Store.storeWebhooks`.
1513
1567
  *
1514
1568
  * @param params - Fields to update (only provided fields are changed)
1515
1569
  * @returns Updated store entity
@@ -1522,10 +1576,10 @@ declare class StoresResource {
1522
1576
  * });
1523
1577
  *
1524
1578
  * @example
1525
- * // Clear test webhook URL while keeping other webhook settings
1579
+ * // Toggle a notification preference
1526
1580
  * const { store } = await client.stores.update({
1527
1581
  * id: "STO_xxx",
1528
- * webhookSettings: { testWebhookUrl: null },
1582
+ * notificationSettings: { emailOrderConfirmation: false },
1529
1583
  * });
1530
1584
  */
1531
1585
  update(params: UpdateStoreParams): Promise<{
@@ -1682,15 +1736,96 @@ declare class SubscriptionProductsResource {
1682
1736
  }
1683
1737
 
1684
1738
  /**
1685
- * Webhook signature verification resource.
1739
+ * Webhook resource manages webhook configurations (HTTP / Feishu / Discord
1740
+ * / Telegram / Slack) and verifies inbound webhook signatures.
1686
1741
  *
1687
- * Unlike other resources, this does not use HttpClient — webhook verification
1688
- * is a local cryptographic operation that does not require API calls.
1742
+ * **Mutations only**: `add`, `update`, `remove` all hit POST endpoints.
1743
+ * To list a store's webhooks, use GraphQL `Store.storeWebhooks` via
1744
+ * `client.graphql.query`.
1745
+ *
1746
+ * Verification (`verify`) is a local cryptographic operation that does not
1747
+ * require API calls.
1689
1748
  */
1690
1749
  declare class WebhooksResource {
1750
+ private readonly http;
1691
1751
  private readonly publicKeys;
1692
- /** @param publicKeys - Optional config-level public key(s) from WaffoPancakeConfig */
1693
- constructor(publicKeys: WebhookPublicKeys | undefined);
1752
+ /**
1753
+ * @param http - HTTP client (used for add/update/remove)
1754
+ * @param publicKeys - Optional config-level public key(s) from WaffoPancakeConfig
1755
+ */
1756
+ constructor(http: HttpClient, publicKeys: WebhookPublicKeys | undefined);
1757
+ /**
1758
+ * Add a webhook endpoint to a store.
1759
+ *
1760
+ * @param params - Webhook configuration
1761
+ * @returns Created webhook entity
1762
+ *
1763
+ * @example
1764
+ * // HTTP webhook (RSA-signed envelope, default)
1765
+ * const { webhook } = await client.webhooks.add({
1766
+ * storeId: "STO_xxx",
1767
+ * channel: "http",
1768
+ * url: "https://example.com/webhook",
1769
+ * events: ["order.completed", "refund.succeeded"],
1770
+ * testMode: false,
1771
+ * });
1772
+ *
1773
+ * @example
1774
+ * // Discord webhook (uses Discord embed format)
1775
+ * await client.webhooks.add({
1776
+ * storeId: "STO_xxx",
1777
+ * channel: "discord",
1778
+ * url: "https://discord.com/api/webhooks/...",
1779
+ * events: ["order.completed"],
1780
+ * testMode: false,
1781
+ * });
1782
+ *
1783
+ * @example
1784
+ * // Telegram bot — chat_id goes in `secret`; URL is the bot's sendMessage endpoint
1785
+ * await client.webhooks.add({
1786
+ * storeId: "STO_xxx",
1787
+ * channel: "telegram",
1788
+ * url: "https://api.telegram.org/bot123:ABC/sendMessage",
1789
+ * events: ["order.completed"],
1790
+ * testMode: false,
1791
+ * secret: "8737101383",
1792
+ * });
1793
+ */
1794
+ add(params: AddWebhookParams): Promise<{
1795
+ webhook: StoreWebhook;
1796
+ }>;
1797
+ /**
1798
+ * Update an existing webhook (only `url`, `events`, and `secret` are mutable).
1799
+ *
1800
+ * `channel` and `testMode` cannot be changed — remove the webhook and
1801
+ * re-add it instead. URL changes must remain on the same channel host
1802
+ * whitelist.
1803
+ *
1804
+ * @param params - Fields to update
1805
+ * @returns Updated webhook entity
1806
+ *
1807
+ * @example
1808
+ * await client.webhooks.update({
1809
+ * id: "11111111-2222-3333-4444-555555555555",
1810
+ * events: ["order.completed", "refund.succeeded", "subscription.canceled"],
1811
+ * });
1812
+ */
1813
+ update(params: UpdateWebhookParams): Promise<{
1814
+ webhook: StoreWebhook;
1815
+ }>;
1816
+ /**
1817
+ * Hard-delete a webhook. Historical `webhook_deliveries` rows are retained
1818
+ * (with `storeWebhookId` set to null) for audit purposes.
1819
+ *
1820
+ * @param params - Webhook to remove
1821
+ * @returns The removed webhook entity (snapshot before deletion)
1822
+ *
1823
+ * @example
1824
+ * await client.webhooks.remove({ id: "11111111-..." });
1825
+ */
1826
+ remove(params: RemoveWebhookParams): Promise<{
1827
+ webhook: StoreWebhook;
1828
+ }>;
1694
1829
  /**
1695
1830
  * Verify and parse an incoming webhook event.
1696
1831
  *
@@ -1882,4 +2017,4 @@ declare class WaffoPancakeError extends Error {
1882
2017
  */
1883
2018
  declare function verifyWebhook<T = Record<string, unknown>>(payload: string, signatureHeader: string | undefined | null, options?: VerifyWebhookOptions): WebhookEvent<T>;
1884
2019
 
1885
- export { type AddMerchantParams, type AddMerchantResult, type AnonymousCheckoutParams, type ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AuthenticatedCheckoutParams, type AuthenticatedCheckoutResult, type BillingDetail, BillingPeriod, type CancelOnetimeOrderParams, type CancelOnetimeOrderResult, type CancelSubscriptionParams, type CancelSubscriptionResult, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, type CreateStoreParams, type CreateSubscriptionProductGroupParams, type CreateSubscriptionProductParams, type DeleteStoreParams, type DeleteSubscriptionProductGroupParams, EntityStatus, Environment, ErrorLayer, type GraphQLParams, type GraphQLResponse, type GroupRules, type IssueSessionTokenParams, type MediaItem, MediaType, type NotificationSettings, OnetimeOrderStatus, type OnetimeProductDetail, PaymentStatus, type PriceInfo, type Prices, ProductVersionStatus, type PublishOnetimeProductParams, type PublishSubscriptionProductGroupParams, type PublishSubscriptionProductParams, type ReactivateSubscriptionParams, type ReactivateSubscriptionResult, RefundStatus, type RefundTicket, RefundTicketStatus, type RefundTicketVersionData, type RemoveMerchantParams, type RemoveMerchantResult, type RequestedAmount, type ResubmitRefundTicketParams, type SessionToken, type Store, StoreRole, SubscriptionOrderStatus, type SubscriptionProductDetail, type SubscriptionProductGroup, TaxCategory, type UpdateOnetimeProductParams, type UpdateOnetimeStatusParams, type UpdateRoleParams, type UpdateRoleResult, type UpdateStoreParams, type UpdateSubscriptionProductGroupParams, type UpdateSubscriptionProductParams, type UpdateSubscriptionStatusParams, type VerifyWebhookOptions, WaffoPancake, type WaffoPancakeConfig, WaffoPancakeError, type WebhookEvent, type WebhookEventData, WebhookEventType, type WebhookPublicKeys, type WebhookSettings, verifyWebhook };
2020
+ export { type AddMerchantParams, type AddMerchantResult, type AddWebhookParams, type AnonymousCheckoutParams, type ApiError, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AuthenticatedCheckoutParams, type AuthenticatedCheckoutResult, type BillingDetail, BillingPeriod, type CancelOnetimeOrderParams, type CancelOnetimeOrderResult, type CancelSubscriptionParams, type CancelSubscriptionResult, type CheckoutSessionResult, type CheckoutSettings, type CheckoutThemeSettings, type CreateCheckoutSessionParams, type CreateOnetimeProductParams, type CreateRefundTicketParams, type CreateStoreParams, type CreateSubscriptionProductGroupParams, type CreateSubscriptionProductParams, type DeleteStoreParams, type DeleteSubscriptionProductGroupParams, EntityStatus, Environment, ErrorLayer, type GraphQLParams, type GraphQLResponse, type GroupRules, type IssueSessionTokenParams, type MediaItem, MediaType, type NotificationSettings, OnetimeOrderStatus, type OnetimeProductDetail, PaymentStatus, type PriceInfo, type Prices, ProductVersionStatus, type PublishOnetimeProductParams, type PublishSubscriptionProductGroupParams, type PublishSubscriptionProductParams, type ReactivateSubscriptionParams, type ReactivateSubscriptionResult, RefundStatus, type RefundTicket, RefundTicketStatus, type RefundTicketVersionData, type RemoveMerchantParams, type RemoveMerchantResult, type RemoveWebhookParams, type RequestedAmount, type ResubmitRefundTicketParams, type SessionToken, type Store, StoreRole, type StoreWebhook, SubscriptionOrderStatus, type SubscriptionProductDetail, type SubscriptionProductGroup, TaxCategory, type UpdateOnetimeProductParams, type UpdateOnetimeStatusParams, type UpdateRoleParams, type UpdateRoleResult, type UpdateStoreParams, type UpdateSubscriptionProductGroupParams, type UpdateSubscriptionProductParams, type UpdateSubscriptionStatusParams, type UpdateWebhookParams, type VerifyWebhookOptions, WaffoPancake, type WaffoPancakeConfig, WaffoPancakeError, type WebhookChannel, type WebhookEvent, type WebhookEventData, WebhookEventType, type WebhookPublicKeys, verifyWebhook };
package/dist/index.js CHANGED
@@ -791,9 +791,13 @@ var StoresResource = class {
791
791
  /**
792
792
  * Update an existing store's settings.
793
793
  *
794
- * Settings objects (`webhookSettings`, `notificationSettings`, `checkoutSettings`)
795
- * support partial updates: omitted sub-fields keep existing values, `null` clears
796
- * a field. Pass the entire settings object as `null` to clear all fields.
794
+ * Settings objects (`notificationSettings`, `checkoutSettings`) support
795
+ * partial updates: omitted sub-fields keep existing values, `null` clears a
796
+ * field. Pass the entire settings object as `null` to clear all fields.
797
+ *
798
+ * **BREAKING (2026-05)**: the legacy `webhookSettings` parameter is removed.
799
+ * Use `client.webhooks.add / update / remove` to manage webhook endpoints,
800
+ * and query the configured webhook list via GraphQL `Store.storeWebhooks`.
797
801
  *
798
802
  * @param params - Fields to update (only provided fields are changed)
799
803
  * @returns Updated store entity
@@ -806,10 +810,10 @@ var StoresResource = class {
806
810
  * });
807
811
  *
808
812
  * @example
809
- * // Clear test webhook URL while keeping other webhook settings
813
+ * // Toggle a notification preference
810
814
  * const { store } = await client.stores.update({
811
815
  * id: "STO_xxx",
812
- * webhookSettings: { testWebhookUrl: null },
816
+ * notificationSettings: { emailOrderConfirmation: false },
813
817
  * });
814
818
  */
815
819
  async update(params) {
@@ -1090,10 +1094,91 @@ function verifyWebhook(payload, signatureHeader, options) {
1090
1094
 
1091
1095
  // src/resources/webhooks.ts
1092
1096
  var WebhooksResource = class {
1093
- /** @param publicKeys - Optional config-level public key(s) from WaffoPancakeConfig */
1094
- constructor(publicKeys) {
1097
+ /**
1098
+ * @param http - HTTP client (used for add/update/remove)
1099
+ * @param publicKeys - Optional config-level public key(s) from WaffoPancakeConfig
1100
+ */
1101
+ constructor(http, publicKeys) {
1102
+ this.http = http;
1095
1103
  this.publicKeys = publicKeys;
1096
1104
  }
1105
+ /**
1106
+ * Add a webhook endpoint to a store.
1107
+ *
1108
+ * @param params - Webhook configuration
1109
+ * @returns Created webhook entity
1110
+ *
1111
+ * @example
1112
+ * // HTTP webhook (RSA-signed envelope, default)
1113
+ * const { webhook } = await client.webhooks.add({
1114
+ * storeId: "STO_xxx",
1115
+ * channel: "http",
1116
+ * url: "https://example.com/webhook",
1117
+ * events: ["order.completed", "refund.succeeded"],
1118
+ * testMode: false,
1119
+ * });
1120
+ *
1121
+ * @example
1122
+ * // Discord webhook (uses Discord embed format)
1123
+ * await client.webhooks.add({
1124
+ * storeId: "STO_xxx",
1125
+ * channel: "discord",
1126
+ * url: "https://discord.com/api/webhooks/...",
1127
+ * events: ["order.completed"],
1128
+ * testMode: false,
1129
+ * });
1130
+ *
1131
+ * @example
1132
+ * // Telegram bot — chat_id goes in `secret`; URL is the bot's sendMessage endpoint
1133
+ * await client.webhooks.add({
1134
+ * storeId: "STO_xxx",
1135
+ * channel: "telegram",
1136
+ * url: "https://api.telegram.org/bot123:ABC/sendMessage",
1137
+ * events: ["order.completed"],
1138
+ * testMode: false,
1139
+ * secret: "8737101383",
1140
+ * });
1141
+ */
1142
+ async add(params) {
1143
+ validateShortId("storeId", params.storeId, "STO");
1144
+ validateRequired("channel", params.channel);
1145
+ validateRequired("url", params.url);
1146
+ return this.http.post("/v1/actions/store/add-webhook", params);
1147
+ }
1148
+ /**
1149
+ * Update an existing webhook (only `url`, `events`, and `secret` are mutable).
1150
+ *
1151
+ * `channel` and `testMode` cannot be changed — remove the webhook and
1152
+ * re-add it instead. URL changes must remain on the same channel host
1153
+ * whitelist.
1154
+ *
1155
+ * @param params - Fields to update
1156
+ * @returns Updated webhook entity
1157
+ *
1158
+ * @example
1159
+ * await client.webhooks.update({
1160
+ * id: "11111111-2222-3333-4444-555555555555",
1161
+ * events: ["order.completed", "refund.succeeded", "subscription.canceled"],
1162
+ * });
1163
+ */
1164
+ async update(params) {
1165
+ validateRequired("id", params.id);
1166
+ return this.http.post("/v1/actions/store/update-webhook", params);
1167
+ }
1168
+ /**
1169
+ * Hard-delete a webhook. Historical `webhook_deliveries` rows are retained
1170
+ * (with `storeWebhookId` set to null) for audit purposes.
1171
+ *
1172
+ * @param params - Webhook to remove
1173
+ * @returns The removed webhook entity (snapshot before deletion)
1174
+ *
1175
+ * @example
1176
+ * await client.webhooks.remove({ id: "11111111-..." });
1177
+ */
1178
+ async remove(params) {
1179
+ validateRequired("id", params.id);
1180
+ return this.http.post("/v1/actions/store/remove-webhook", params);
1181
+ }
1097
1182
  /**
1098
1183
  * Verify and parse an incoming webhook event.
1099
1184
  *
@@ -1157,7 +1242,7 @@ var WaffoPancake = class {
1157
1242
  this.orders = new OrdersResource(this.http);
1158
1243
  this.checkout = new CheckoutResource(this.http);
1159
1244
  this.graphql = new GraphQLResource(this.http);
1160
- this.webhooks = new WebhooksResource(config.webhookPublicKey);
1245
+ this.webhooks = new WebhooksResource(this.http, config.webhookPublicKey);
1161
1246
  }
1162
1247
  /**
1163
1248
  * Create a buyer session for self-service operations.