@01.software/sdk 0.49.0 → 0.56.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +257 -1
  2. package/MIGRATION.md +56 -0
  3. package/README.md +269 -56
  4. package/dist/client.cjs +608 -190
  5. package/dist/client.cjs.map +1 -1
  6. package/dist/client.d.cts +6 -6
  7. package/dist/client.d.ts +6 -6
  8. package/dist/client.js +608 -190
  9. package/dist/client.js.map +1 -1
  10. package/dist/{collection-client-DnDt6EQz.d.ts → collection-client-Bmr53saa.d.ts} +6 -4
  11. package/dist/{collection-client-XfGLPuTf.d.cts → collection-client-DxuBDso_.d.cts} +6 -4
  12. package/dist/{const-CBba4lDo.d.cts → const-BKUqg96Q.d.ts} +5 -5
  13. package/dist/{const-DCNV5Kq7.d.ts → const-Cv1DCsp6.d.cts} +5 -5
  14. package/dist/embedded-admin/server.cjs +306 -0
  15. package/dist/embedded-admin/server.cjs.map +1 -0
  16. package/dist/embedded-admin/server.d.cts +33 -0
  17. package/dist/embedded-admin/server.d.ts +33 -0
  18. package/dist/embedded-admin/server.js +288 -0
  19. package/dist/embedded-admin/server.js.map +1 -0
  20. package/dist/embedded-admin.cjs +400 -0
  21. package/dist/embedded-admin.cjs.map +1 -0
  22. package/dist/embedded-admin.d.cts +61 -0
  23. package/dist/embedded-admin.d.ts +61 -0
  24. package/dist/embedded-admin.js +377 -0
  25. package/dist/embedded-admin.js.map +1 -0
  26. package/dist/errors.cjs +1 -0
  27. package/dist/errors.cjs.map +1 -1
  28. package/dist/errors.d.cts +3 -3
  29. package/dist/errors.d.ts +3 -3
  30. package/dist/errors.js +1 -0
  31. package/dist/errors.js.map +1 -1
  32. package/dist/{index-DUuIqUS8.d.ts → index-CGsT4AQ8.d.cts} +89 -10
  33. package/dist/{index-CbKyoEzy.d.cts → index-DFHLLqYu.d.ts} +89 -10
  34. package/dist/index.cjs +752 -436
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +12 -69
  37. package/dist/index.d.ts +12 -69
  38. package/dist/index.js +752 -436
  39. package/dist/index.js.map +1 -1
  40. package/dist/{payload-types-MKbx5MuJ.d.cts → payload-types-Bk-duc5k.d.cts} +545 -141
  41. package/dist/{payload-types-MKbx5MuJ.d.ts → payload-types-Bk-duc5k.d.ts} +545 -141
  42. package/dist/query.cjs +108 -71
  43. package/dist/query.cjs.map +1 -1
  44. package/dist/query.d.cts +5 -5
  45. package/dist/query.d.ts +5 -5
  46. package/dist/query.js +108 -71
  47. package/dist/query.js.map +1 -1
  48. package/dist/realtime.d.cts +2 -2
  49. package/dist/realtime.d.ts +2 -2
  50. package/dist/server.cjs +502 -175
  51. package/dist/server.cjs.map +1 -1
  52. package/dist/server.d.cts +9 -8
  53. package/dist/server.d.ts +9 -8
  54. package/dist/server.js +502 -175
  55. package/dist/server.js.map +1 -1
  56. package/dist/storefront-cache.cjs +1 -0
  57. package/dist/storefront-cache.cjs.map +1 -1
  58. package/dist/storefront-cache.js +1 -0
  59. package/dist/storefront-cache.js.map +1 -1
  60. package/dist/{types-1UeOk1Uy.d.cts → types-CEK8uTvU.d.ts} +287 -30
  61. package/dist/{types-BKr_2avj.d.cts → types-CNdpj2fI.d.cts} +2 -2
  62. package/dist/{types-L_nh-ED7.d.ts → types-D4mjGFj4.d.ts} +2 -2
  63. package/dist/{types-Du4s5anw.d.ts → types-Dhk5NX7Z.d.cts} +287 -30
  64. package/dist/ui/form.d.cts +1 -1
  65. package/dist/ui/form.d.ts +1 -1
  66. package/dist/ui/video.d.cts +1 -1
  67. package/dist/ui/video.d.ts +1 -1
  68. package/dist/webhook.cjs +135 -80
  69. package/dist/webhook.cjs.map +1 -1
  70. package/dist/webhook.d.cts +21 -5
  71. package/dist/webhook.d.ts +21 -5
  72. package/dist/webhook.js +135 -80
  73. package/dist/webhook.js.map +1 -1
  74. package/package.json +28 -6
@@ -1,6 +1,6 @@
1
- import { C as Collection } from './const-DCNV5Kq7.js';
2
- import { C as CollectionType } from './types-L_nh-ED7.js';
3
- import './payload-types-MKbx5MuJ.js';
1
+ import { C as Collection } from './const-Cv1DCsp6.cjs';
2
+ import { C as CollectionType } from './types-CNdpj2fI.cjs';
3
+ import './payload-types-Bk-duc5k.cjs';
4
4
 
5
5
  type WebhookOperation = string;
6
6
  /**
@@ -61,8 +61,10 @@ interface WebhookEvent<T extends Collection | string = Collection, TData = T ext
61
61
  deliveryId?: string;
62
62
  }
63
63
  type WebhookHandler<T extends Collection | string = Collection, TData = T extends Collection ? CollectionType<T> : Record<string, unknown>> = (event: WebhookEvent<T, TData>) => Promise<void> | void;
64
+ /** @deprecated Use the signed receiver options from `@01.software/sdk/webhook`. */
64
65
  interface WebhookOptions {
65
- secret?: string;
66
+ /** Nonblank HMAC-SHA256 signing secret for this receiver. */
67
+ secret: string;
66
68
  /** Max accepted skew for signed webhook delivery timestamps. Default: 300s. */
67
69
  toleranceSeconds?: number;
68
70
  }
@@ -74,13 +76,67 @@ type OrderChangedWebhookEvent<T extends Collection | string = Collection, TData
74
76
  change: WebhookOrderChange;
75
77
  };
76
78
  declare const COMMERCE_NOTIFICATION_OPERATION: "notification";
77
- declare const COMMERCE_NOTIFICATION_EVENTS: readonly ["orderPaid", "orderCanceled", "fulfillmentShipped", "orderDelivered", "returnRequested", "returnApproved", "returnRejected", "returnCanceled", "returnCompleted"];
79
+ declare const COMMERCE_NOTIFICATION_EVENTS: readonly ["orderPaid", "orderCanceled", "fulfillmentShipped", "orderDelivered", "returnRequested", "returnApproved", "returnRejected", "returnCanceled", "returnCompleted", "paymentReconciliationRequired", "paymentRefundRequiresAttention", "membershipActivated", "membershipPastDue", "membershipExpired", "membershipCancelled"];
78
80
  type CommerceNotificationEventName = (typeof COMMERCE_NOTIFICATION_EVENTS)[number];
79
- type CommerceNotificationSourceCollection = 'orders' | 'fulfillments' | 'returns';
81
+ type CustomerCommerceNotificationEventName = Exclude<CommerceNotificationEventName, PaymentIncidentNotificationEventName | MembershipNotificationEventName>;
82
+ type CommerceNotificationSourceCollection = 'orders' | 'fulfillments' | 'returns' | 'payment-sessions' | 'payment-refund-attempts' | 'customer-memberships';
80
83
  type CommerceNotificationSource = {
81
84
  collection: CommerceNotificationSourceCollection;
82
85
  id: string | number;
83
86
  };
87
+ type PaymentIncidentNotificationEventName = 'paymentReconciliationRequired' | 'paymentRefundRequiresAttention';
88
+ type MembershipNotificationEventName = 'membershipActivated' | 'membershipPastDue' | 'membershipExpired' | 'membershipCancelled';
89
+ type MembershipNotificationData = {
90
+ membershipId: string;
91
+ planId: string;
92
+ /** Tenant-scoped pseudonymous identifier; this is not a PII-free claim. */
93
+ customerId: string;
94
+ fromStatus: string;
95
+ toStatus: 'active' | 'past_due' | 'expired' | 'cancelled';
96
+ occurredAt: string;
97
+ };
98
+ type PaymentIncidentNotificationSourceCollection = 'payment-sessions' | 'payment-refund-attempts';
99
+ type PaymentIncidentNotificationReason = 'orderless_capture' | 'local_commit_ambiguous';
100
+ type PaymentIncidentNotificationStatus = 'reconciliation_required' | 'requires_attention';
101
+ type PaymentIncidentProviderObject = {
102
+ provider: string;
103
+ kind: 'payment' | 'refund';
104
+ id: string;
105
+ };
106
+ type PaymentIncidentMoney = {
107
+ amountMinor: number;
108
+ currency: string;
109
+ };
110
+ type PaymentIncidentNotificationBase = {
111
+ paymentSessionId: string;
112
+ checkoutId?: string;
113
+ orderId?: string;
114
+ providerObject: PaymentIncidentProviderObject;
115
+ money: PaymentIncidentMoney;
116
+ observedAt: string;
117
+ };
118
+ type PaymentReconciliationRequiredNotificationData = PaymentIncidentNotificationBase & {
119
+ source: {
120
+ collection: 'payment-sessions';
121
+ id: string;
122
+ };
123
+ providerObject: PaymentIncidentProviderObject & {
124
+ kind: 'payment';
125
+ };
126
+ status: 'reconciliation_required';
127
+ reason: 'orderless_capture';
128
+ refundAttemptId?: never;
129
+ };
130
+ type PaymentRefundRequiresAttentionNotificationData = PaymentIncidentNotificationBase & {
131
+ source: {
132
+ collection: 'payment-refund-attempts';
133
+ id: string;
134
+ };
135
+ refundAttemptId: string;
136
+ status: 'requires_attention';
137
+ reason: 'local_commit_ambiguous';
138
+ };
139
+ type PaymentIncidentNotificationData = PaymentReconciliationRequiredNotificationData | PaymentRefundRequiresAttentionNotificationData;
84
140
  type CommerceNotificationData = {
85
141
  source?: CommerceNotificationSource;
86
142
  orderId?: string | number;
@@ -95,6 +151,19 @@ type CommerceNotificationData = {
95
151
  returnStatus?: string;
96
152
  refundAmount?: number;
97
153
  completedAt?: string;
154
+ paymentSessionId?: string;
155
+ checkoutId?: string;
156
+ refundAttemptId?: string;
157
+ providerObject?: PaymentIncidentProviderObject;
158
+ money?: PaymentIncidentMoney;
159
+ reason?: PaymentIncidentNotificationReason;
160
+ observedAt?: string;
161
+ membershipId?: string;
162
+ planId?: string;
163
+ customerId?: string;
164
+ fromStatus?: string;
165
+ toStatus?: string;
166
+ occurredAt?: string;
98
167
  };
99
168
  type CommerceNotification = {
100
169
  event: CommerceNotificationEventName;
@@ -103,6 +172,9 @@ type CommerceNotification = {
103
172
  orderId?: string;
104
173
  fulfillmentId?: string;
105
174
  returnId?: string;
175
+ paymentSessionId?: string;
176
+ refundAttemptId?: string;
177
+ membershipId?: string;
106
178
  };
107
179
  type WebhookCommerceNotificationChange = {
108
180
  type: 'notification';
@@ -126,7 +198,7 @@ type CommerceEmailEventConfig = {
126
198
  };
127
199
  type CommerceEmailConfig = {
128
200
  version: 1;
129
- commerceNotifications: Partial<Record<CommerceNotificationEventName, CommerceEmailEventConfig>>;
201
+ commerceNotifications: Partial<Record<CustomerCommerceNotificationEventName, CommerceEmailEventConfig>>;
130
202
  };
131
203
  type CommerceNotificationHandlerContext = {
132
204
  event: CommerceNotificationWebhookEvent;
@@ -137,7 +209,9 @@ type CommerceNotificationEventHandlers = Partial<Record<CommerceNotificationEven
137
209
  unhandled?: (event: WebhookEvent<string, unknown>) => MaybePromise<void>;
138
210
  };
139
211
  type CommerceEmailHandlerContext = CommerceNotificationHandlerContext;
140
- type CommerceEmailEventHandlers = CommerceNotificationEventHandlers;
212
+ type CommerceEmailEventHandlers = Partial<Record<CustomerCommerceNotificationEventName, (context: CommerceEmailHandlerContext) => MaybePromise<void>>> & {
213
+ unhandled?: (event: WebhookEvent<string, unknown>) => MaybePromise<void>;
214
+ };
141
215
  /**
142
216
  * Returns true for semantic order-change webhooks emitted as update events.
143
217
  *
@@ -183,7 +257,12 @@ interface CustomerAuthWebhookHandlers {
183
257
  }
184
258
  declare function isCustomerPasswordResetWebhookEvent(event: WebhookEvent<string, unknown>): event is CustomerPasswordResetWebhookEvent;
185
259
  declare function createCustomerAuthWebhookHandler(handlers: CustomerAuthWebhookHandlers): WebhookHandler<string, unknown>;
186
- declare function handleWebhook<T extends Collection | string = Collection, TData = T extends Collection ? CollectionType<T> : Record<string, unknown>>(request: Request, handler: WebhookHandler<T, TData>, options?: WebhookOptions): Promise<Response>;
260
+ /**
261
+ * @deprecated Import `handleSignedWebhook()` from `@01.software/sdk/webhook`.
262
+ * This compatibility alias is signed and fails closed when its required secret
263
+ * is missing or blank.
264
+ */
265
+ declare function handleWebhook<T extends Collection | string = Collection, TData = T extends Collection ? CollectionType<T> : Record<string, unknown>>(request: Request, handler: WebhookHandler<T, TData>, options: WebhookOptions): Promise<Response>;
187
266
  declare function createTypedWebhookHandler<T extends Collection>(collection: T, handler: (event: WebhookEvent<T>) => Promise<void> | void): WebhookHandler<T>;
188
267
 
189
- export { type WebhookOperation as A, type WebhookOptions as B, COMMERCE_NOTIFICATION_EVENTS as C, type WebhookOrderChange as D, type WebhookOrderMoved as E, type WebhookOrderScope as F, createCommerceEmailWebhookHandler as G, createCommerceNotificationWebhookHandler as H, createCustomerAuthWebhookHandler as I, createTypedWebhookHandler as J, defineCommerceEmailConfig as K, getCommerceNotificationIdempotencyKey as L, handleWebhook as M, isCommerceNotificationWebhookEvent as N, ORDER_CHANGED_EVENT_TYPE as O, isCustomerPasswordResetWebhookEvent as P, isOrderChangedWebhookEvent as Q, isValidWebhookEvent as R, isWebhookCollection as S, isWebhookOperation as T, type WebhookChange as W, COMMERCE_NOTIFICATION_EVENT_TYPE as a, COMMERCE_NOTIFICATION_OPERATION as b, CUSTOMER_PASSWORD_RESET_OPERATION as c, type CollectionWebhookOperation as d, type CommerceEmailChannel as e, type CommerceEmailConfig as f, type CommerceEmailEventConfig as g, type CommerceEmailEventHandlers as h, type CommerceEmailHandlerContext as i, type CommerceNotification as j, type CommerceNotificationData as k, type CommerceNotificationEventHandlers as l, type CommerceNotificationEventName as m, type CommerceNotificationHandlerContext as n, type CommerceNotificationSource as o, type CommerceNotificationSourceCollection as p, type CommerceNotificationWebhookEvent as q, type CustomerAuthWebhookEvent as r, type CustomerAuthWebhookHandlers as s, type CustomerPasswordResetWebhookData as t, type CustomerPasswordResetWebhookEvent as u, type OrderChangedWebhookEvent as v, type WebhookCommerceNotificationChange as w, type WebhookEvent as x, type WebhookHandler as y, type WebhookKnownOperation as z };
268
+ export { isValidWebhookEvent as $, type PaymentIncidentNotificationSourceCollection as A, type PaymentIncidentNotificationStatus as B, COMMERCE_NOTIFICATION_EVENTS as C, type PaymentIncidentProviderObject as D, type WebhookChange as E, type WebhookCommerceNotificationChange as F, type WebhookEvent as G, type WebhookKnownOperation as H, type WebhookOperation as I, type WebhookOptions as J, type WebhookOrderChange as K, type WebhookOrderMoved as L, type MembershipNotificationData as M, type WebhookOrderScope as N, ORDER_CHANGED_EVENT_TYPE as O, type PaymentIncidentMoney as P, createCommerceEmailWebhookHandler as Q, createCommerceNotificationWebhookHandler as R, createCustomerAuthWebhookHandler as S, createTypedWebhookHandler as T, defineCommerceEmailConfig as U, getCommerceNotificationIdempotencyKey as V, type WebhookHandler as W, handleWebhook as X, isCommerceNotificationWebhookEvent as Y, isCustomerPasswordResetWebhookEvent as Z, isOrderChangedWebhookEvent as _, COMMERCE_NOTIFICATION_EVENT_TYPE as a, isWebhookCollection as a0, isWebhookOperation as a1, type CustomerCommerceNotificationEventName as a2, type PaymentReconciliationRequiredNotificationData as a3, type PaymentRefundRequiresAttentionNotificationData as a4, COMMERCE_NOTIFICATION_OPERATION as b, CUSTOMER_PASSWORD_RESET_OPERATION as c, type CollectionWebhookOperation as d, type CommerceEmailChannel as e, type CommerceEmailConfig as f, type CommerceEmailEventConfig as g, type CommerceEmailEventHandlers as h, type CommerceEmailHandlerContext as i, type CommerceNotification as j, type CommerceNotificationData as k, type CommerceNotificationEventHandlers as l, type CommerceNotificationEventName as m, type CommerceNotificationHandlerContext as n, type CommerceNotificationSource as o, type CommerceNotificationSourceCollection as p, type CommerceNotificationWebhookEvent as q, type CustomerAuthWebhookEvent as r, type CustomerAuthWebhookHandlers as s, type CustomerPasswordResetWebhookData as t, type CustomerPasswordResetWebhookEvent as u, type MembershipNotificationEventName as v, type OrderChangedWebhookEvent as w, type PaymentIncidentNotificationData as x, type PaymentIncidentNotificationEventName as y, type PaymentIncidentNotificationReason as z };
@@ -1,6 +1,6 @@
1
- import { C as Collection } from './const-CBba4lDo.cjs';
2
- import { C as CollectionType } from './types-BKr_2avj.cjs';
3
- import './payload-types-MKbx5MuJ.cjs';
1
+ import { C as Collection } from './const-BKUqg96Q.js';
2
+ import { C as CollectionType } from './types-D4mjGFj4.js';
3
+ import './payload-types-Bk-duc5k.js';
4
4
 
5
5
  type WebhookOperation = string;
6
6
  /**
@@ -61,8 +61,10 @@ interface WebhookEvent<T extends Collection | string = Collection, TData = T ext
61
61
  deliveryId?: string;
62
62
  }
63
63
  type WebhookHandler<T extends Collection | string = Collection, TData = T extends Collection ? CollectionType<T> : Record<string, unknown>> = (event: WebhookEvent<T, TData>) => Promise<void> | void;
64
+ /** @deprecated Use the signed receiver options from `@01.software/sdk/webhook`. */
64
65
  interface WebhookOptions {
65
- secret?: string;
66
+ /** Nonblank HMAC-SHA256 signing secret for this receiver. */
67
+ secret: string;
66
68
  /** Max accepted skew for signed webhook delivery timestamps. Default: 300s. */
67
69
  toleranceSeconds?: number;
68
70
  }
@@ -74,13 +76,67 @@ type OrderChangedWebhookEvent<T extends Collection | string = Collection, TData
74
76
  change: WebhookOrderChange;
75
77
  };
76
78
  declare const COMMERCE_NOTIFICATION_OPERATION: "notification";
77
- declare const COMMERCE_NOTIFICATION_EVENTS: readonly ["orderPaid", "orderCanceled", "fulfillmentShipped", "orderDelivered", "returnRequested", "returnApproved", "returnRejected", "returnCanceled", "returnCompleted"];
79
+ declare const COMMERCE_NOTIFICATION_EVENTS: readonly ["orderPaid", "orderCanceled", "fulfillmentShipped", "orderDelivered", "returnRequested", "returnApproved", "returnRejected", "returnCanceled", "returnCompleted", "paymentReconciliationRequired", "paymentRefundRequiresAttention", "membershipActivated", "membershipPastDue", "membershipExpired", "membershipCancelled"];
78
80
  type CommerceNotificationEventName = (typeof COMMERCE_NOTIFICATION_EVENTS)[number];
79
- type CommerceNotificationSourceCollection = 'orders' | 'fulfillments' | 'returns';
81
+ type CustomerCommerceNotificationEventName = Exclude<CommerceNotificationEventName, PaymentIncidentNotificationEventName | MembershipNotificationEventName>;
82
+ type CommerceNotificationSourceCollection = 'orders' | 'fulfillments' | 'returns' | 'payment-sessions' | 'payment-refund-attempts' | 'customer-memberships';
80
83
  type CommerceNotificationSource = {
81
84
  collection: CommerceNotificationSourceCollection;
82
85
  id: string | number;
83
86
  };
87
+ type PaymentIncidentNotificationEventName = 'paymentReconciliationRequired' | 'paymentRefundRequiresAttention';
88
+ type MembershipNotificationEventName = 'membershipActivated' | 'membershipPastDue' | 'membershipExpired' | 'membershipCancelled';
89
+ type MembershipNotificationData = {
90
+ membershipId: string;
91
+ planId: string;
92
+ /** Tenant-scoped pseudonymous identifier; this is not a PII-free claim. */
93
+ customerId: string;
94
+ fromStatus: string;
95
+ toStatus: 'active' | 'past_due' | 'expired' | 'cancelled';
96
+ occurredAt: string;
97
+ };
98
+ type PaymentIncidentNotificationSourceCollection = 'payment-sessions' | 'payment-refund-attempts';
99
+ type PaymentIncidentNotificationReason = 'orderless_capture' | 'local_commit_ambiguous';
100
+ type PaymentIncidentNotificationStatus = 'reconciliation_required' | 'requires_attention';
101
+ type PaymentIncidentProviderObject = {
102
+ provider: string;
103
+ kind: 'payment' | 'refund';
104
+ id: string;
105
+ };
106
+ type PaymentIncidentMoney = {
107
+ amountMinor: number;
108
+ currency: string;
109
+ };
110
+ type PaymentIncidentNotificationBase = {
111
+ paymentSessionId: string;
112
+ checkoutId?: string;
113
+ orderId?: string;
114
+ providerObject: PaymentIncidentProviderObject;
115
+ money: PaymentIncidentMoney;
116
+ observedAt: string;
117
+ };
118
+ type PaymentReconciliationRequiredNotificationData = PaymentIncidentNotificationBase & {
119
+ source: {
120
+ collection: 'payment-sessions';
121
+ id: string;
122
+ };
123
+ providerObject: PaymentIncidentProviderObject & {
124
+ kind: 'payment';
125
+ };
126
+ status: 'reconciliation_required';
127
+ reason: 'orderless_capture';
128
+ refundAttemptId?: never;
129
+ };
130
+ type PaymentRefundRequiresAttentionNotificationData = PaymentIncidentNotificationBase & {
131
+ source: {
132
+ collection: 'payment-refund-attempts';
133
+ id: string;
134
+ };
135
+ refundAttemptId: string;
136
+ status: 'requires_attention';
137
+ reason: 'local_commit_ambiguous';
138
+ };
139
+ type PaymentIncidentNotificationData = PaymentReconciliationRequiredNotificationData | PaymentRefundRequiresAttentionNotificationData;
84
140
  type CommerceNotificationData = {
85
141
  source?: CommerceNotificationSource;
86
142
  orderId?: string | number;
@@ -95,6 +151,19 @@ type CommerceNotificationData = {
95
151
  returnStatus?: string;
96
152
  refundAmount?: number;
97
153
  completedAt?: string;
154
+ paymentSessionId?: string;
155
+ checkoutId?: string;
156
+ refundAttemptId?: string;
157
+ providerObject?: PaymentIncidentProviderObject;
158
+ money?: PaymentIncidentMoney;
159
+ reason?: PaymentIncidentNotificationReason;
160
+ observedAt?: string;
161
+ membershipId?: string;
162
+ planId?: string;
163
+ customerId?: string;
164
+ fromStatus?: string;
165
+ toStatus?: string;
166
+ occurredAt?: string;
98
167
  };
99
168
  type CommerceNotification = {
100
169
  event: CommerceNotificationEventName;
@@ -103,6 +172,9 @@ type CommerceNotification = {
103
172
  orderId?: string;
104
173
  fulfillmentId?: string;
105
174
  returnId?: string;
175
+ paymentSessionId?: string;
176
+ refundAttemptId?: string;
177
+ membershipId?: string;
106
178
  };
107
179
  type WebhookCommerceNotificationChange = {
108
180
  type: 'notification';
@@ -126,7 +198,7 @@ type CommerceEmailEventConfig = {
126
198
  };
127
199
  type CommerceEmailConfig = {
128
200
  version: 1;
129
- commerceNotifications: Partial<Record<CommerceNotificationEventName, CommerceEmailEventConfig>>;
201
+ commerceNotifications: Partial<Record<CustomerCommerceNotificationEventName, CommerceEmailEventConfig>>;
130
202
  };
131
203
  type CommerceNotificationHandlerContext = {
132
204
  event: CommerceNotificationWebhookEvent;
@@ -137,7 +209,9 @@ type CommerceNotificationEventHandlers = Partial<Record<CommerceNotificationEven
137
209
  unhandled?: (event: WebhookEvent<string, unknown>) => MaybePromise<void>;
138
210
  };
139
211
  type CommerceEmailHandlerContext = CommerceNotificationHandlerContext;
140
- type CommerceEmailEventHandlers = CommerceNotificationEventHandlers;
212
+ type CommerceEmailEventHandlers = Partial<Record<CustomerCommerceNotificationEventName, (context: CommerceEmailHandlerContext) => MaybePromise<void>>> & {
213
+ unhandled?: (event: WebhookEvent<string, unknown>) => MaybePromise<void>;
214
+ };
141
215
  /**
142
216
  * Returns true for semantic order-change webhooks emitted as update events.
143
217
  *
@@ -183,7 +257,12 @@ interface CustomerAuthWebhookHandlers {
183
257
  }
184
258
  declare function isCustomerPasswordResetWebhookEvent(event: WebhookEvent<string, unknown>): event is CustomerPasswordResetWebhookEvent;
185
259
  declare function createCustomerAuthWebhookHandler(handlers: CustomerAuthWebhookHandlers): WebhookHandler<string, unknown>;
186
- declare function handleWebhook<T extends Collection | string = Collection, TData = T extends Collection ? CollectionType<T> : Record<string, unknown>>(request: Request, handler: WebhookHandler<T, TData>, options?: WebhookOptions): Promise<Response>;
260
+ /**
261
+ * @deprecated Import `handleSignedWebhook()` from `@01.software/sdk/webhook`.
262
+ * This compatibility alias is signed and fails closed when its required secret
263
+ * is missing or blank.
264
+ */
265
+ declare function handleWebhook<T extends Collection | string = Collection, TData = T extends Collection ? CollectionType<T> : Record<string, unknown>>(request: Request, handler: WebhookHandler<T, TData>, options: WebhookOptions): Promise<Response>;
187
266
  declare function createTypedWebhookHandler<T extends Collection>(collection: T, handler: (event: WebhookEvent<T>) => Promise<void> | void): WebhookHandler<T>;
188
267
 
189
- export { type WebhookOperation as A, type WebhookOptions as B, COMMERCE_NOTIFICATION_EVENTS as C, type WebhookOrderChange as D, type WebhookOrderMoved as E, type WebhookOrderScope as F, createCommerceEmailWebhookHandler as G, createCommerceNotificationWebhookHandler as H, createCustomerAuthWebhookHandler as I, createTypedWebhookHandler as J, defineCommerceEmailConfig as K, getCommerceNotificationIdempotencyKey as L, handleWebhook as M, isCommerceNotificationWebhookEvent as N, ORDER_CHANGED_EVENT_TYPE as O, isCustomerPasswordResetWebhookEvent as P, isOrderChangedWebhookEvent as Q, isValidWebhookEvent as R, isWebhookCollection as S, isWebhookOperation as T, type WebhookChange as W, COMMERCE_NOTIFICATION_EVENT_TYPE as a, COMMERCE_NOTIFICATION_OPERATION as b, CUSTOMER_PASSWORD_RESET_OPERATION as c, type CollectionWebhookOperation as d, type CommerceEmailChannel as e, type CommerceEmailConfig as f, type CommerceEmailEventConfig as g, type CommerceEmailEventHandlers as h, type CommerceEmailHandlerContext as i, type CommerceNotification as j, type CommerceNotificationData as k, type CommerceNotificationEventHandlers as l, type CommerceNotificationEventName as m, type CommerceNotificationHandlerContext as n, type CommerceNotificationSource as o, type CommerceNotificationSourceCollection as p, type CommerceNotificationWebhookEvent as q, type CustomerAuthWebhookEvent as r, type CustomerAuthWebhookHandlers as s, type CustomerPasswordResetWebhookData as t, type CustomerPasswordResetWebhookEvent as u, type OrderChangedWebhookEvent as v, type WebhookCommerceNotificationChange as w, type WebhookEvent as x, type WebhookHandler as y, type WebhookKnownOperation as z };
268
+ export { isValidWebhookEvent as $, type PaymentIncidentNotificationSourceCollection as A, type PaymentIncidentNotificationStatus as B, COMMERCE_NOTIFICATION_EVENTS as C, type PaymentIncidentProviderObject as D, type WebhookChange as E, type WebhookCommerceNotificationChange as F, type WebhookEvent as G, type WebhookKnownOperation as H, type WebhookOperation as I, type WebhookOptions as J, type WebhookOrderChange as K, type WebhookOrderMoved as L, type MembershipNotificationData as M, type WebhookOrderScope as N, ORDER_CHANGED_EVENT_TYPE as O, type PaymentIncidentMoney as P, createCommerceEmailWebhookHandler as Q, createCommerceNotificationWebhookHandler as R, createCustomerAuthWebhookHandler as S, createTypedWebhookHandler as T, defineCommerceEmailConfig as U, getCommerceNotificationIdempotencyKey as V, type WebhookHandler as W, handleWebhook as X, isCommerceNotificationWebhookEvent as Y, isCustomerPasswordResetWebhookEvent as Z, isOrderChangedWebhookEvent as _, COMMERCE_NOTIFICATION_EVENT_TYPE as a, isWebhookCollection as a0, isWebhookOperation as a1, type CustomerCommerceNotificationEventName as a2, type PaymentReconciliationRequiredNotificationData as a3, type PaymentRefundRequiresAttentionNotificationData as a4, COMMERCE_NOTIFICATION_OPERATION as b, CUSTOMER_PASSWORD_RESET_OPERATION as c, type CollectionWebhookOperation as d, type CommerceEmailChannel as e, type CommerceEmailConfig as f, type CommerceEmailEventConfig as g, type CommerceEmailEventHandlers as h, type CommerceEmailHandlerContext as i, type CommerceNotification as j, type CommerceNotificationData as k, type CommerceNotificationEventHandlers as l, type CommerceNotificationEventName as m, type CommerceNotificationHandlerContext as n, type CommerceNotificationSource as o, type CommerceNotificationSourceCollection as p, type CommerceNotificationWebhookEvent as q, type CustomerAuthWebhookEvent as r, type CustomerAuthWebhookHandlers as s, type CustomerPasswordResetWebhookData as t, type CustomerPasswordResetWebhookEvent as u, type MembershipNotificationEventName as v, type OrderChangedWebhookEvent as w, type PaymentIncidentNotificationData as x, type PaymentIncidentNotificationEventName as y, type PaymentIncidentNotificationReason as z };