@01.software/sdk 0.42.0 → 0.43.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +10 -4
  3. package/dist/client.cjs +99 -57
  4. package/dist/client.cjs.map +1 -1
  5. package/dist/client.d.cts +9 -6
  6. package/dist/client.d.ts +9 -6
  7. package/dist/client.js +99 -57
  8. package/dist/client.js.map +1 -1
  9. package/dist/{collection-client-B-qVIBnJ.d.cts → collection-client-U70KizLf.d.cts} +3 -3
  10. package/dist/{collection-client-BhCMwIus.d.ts → collection-client-gWsA7BVP.d.ts} +3 -3
  11. package/dist/{const-pmHlwm3E.d.ts → const-BBynifk0.d.cts} +5 -5
  12. package/dist/{const-BiDujixF.d.cts → const-_WWHU-gX.d.ts} +5 -5
  13. package/dist/{index-B1UBDaKz.d.ts → index-DPi5NWU8.d.ts} +4 -4
  14. package/dist/{index-D78ki6Ij.d.cts → index-Dg4Y6Aq7.d.cts} +4 -4
  15. package/dist/index.cjs +111 -61
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +41 -8
  18. package/dist/index.d.ts +41 -8
  19. package/dist/index.js +111 -61
  20. package/dist/index.js.map +1 -1
  21. package/dist/{payload-types-C7Ul4ElL.d.cts → payload-types-DLxkB7Mv.d.cts} +399 -27
  22. package/dist/{payload-types-C7Ul4ElL.d.ts → payload-types-DLxkB7Mv.d.ts} +399 -27
  23. package/dist/query.cjs +59 -7
  24. package/dist/query.cjs.map +1 -1
  25. package/dist/query.d.cts +5 -5
  26. package/dist/query.d.ts +5 -5
  27. package/dist/query.js +59 -7
  28. package/dist/query.js.map +1 -1
  29. package/dist/realtime.d.cts +2 -2
  30. package/dist/realtime.d.ts +2 -2
  31. package/dist/server.cjs +130 -57
  32. package/dist/server.cjs.map +1 -1
  33. package/dist/server.d.cts +12 -7
  34. package/dist/server.d.ts +12 -7
  35. package/dist/server.js +130 -57
  36. package/dist/server.js.map +1 -1
  37. package/dist/{types-ChV1t4ei.d.cts → types-B1ngKbWI.d.cts} +1 -1
  38. package/dist/{types-BL7M-EUV.d.cts → types-B9lGhZlB.d.ts} +95 -6
  39. package/dist/{types-Bf2iCjy8.d.ts → types-BiKNBwRA.d.ts} +1 -1
  40. package/dist/{types-D5dSNIGs.d.ts → types-Bpx5sYKo.d.cts} +95 -6
  41. package/dist/ui/form.d.cts +1 -1
  42. package/dist/ui/form.d.ts +1 -1
  43. package/dist/ui/video.d.cts +1 -1
  44. package/dist/ui/video.d.ts +1 -1
  45. package/dist/webhook.cjs +3 -1
  46. package/dist/webhook.cjs.map +1 -1
  47. package/dist/webhook.d.cts +4 -4
  48. package/dist/webhook.d.ts +4 -4
  49. package/dist/webhook.js +3 -1
  50. package/dist/webhook.js.map +1 -1
  51. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- import { D as DebugConfig, x as RetryConfig, f as ApiQueryOptions, P as PayloadFindResponse, n as PayloadMutationResponse, ax as ApiDeleteOptions, ay as PublicReadQueryOptions } from './types-BL7M-EUV.cjs';
1
+ import { D as DebugConfig, y as RetryConfig, g as ApiQueryOptions, P as PayloadFindResponse, o as PayloadMutationResponse, aC as ApiDeleteOptions, aD as PublicReadQueryOptions } from './types-Bpx5sYKo.cjs';
2
2
  import { GenerateMetadataOptions, Metadata } from './metadata.cjs';
3
- import { S as ServerCollection, P as PublicCollection } from './const-BiDujixF.cjs';
4
- import { C as CollectionType } from './types-ChV1t4ei.cjs';
3
+ import { S as ServerCollection, P as PublicCollection } from './const-BBynifk0.cjs';
4
+ import { C as CollectionType } from './types-B1ngKbWI.cjs';
5
5
 
6
6
  interface FetchOptions extends RequestInit {
7
7
  apiUrl?: string;
@@ -1,7 +1,7 @@
1
- import { D as DebugConfig, x as RetryConfig, f as ApiQueryOptions, P as PayloadFindResponse, n as PayloadMutationResponse, ax as ApiDeleteOptions, ay as PublicReadQueryOptions } from './types-D5dSNIGs.js';
1
+ import { D as DebugConfig, y as RetryConfig, g as ApiQueryOptions, P as PayloadFindResponse, o as PayloadMutationResponse, aC as ApiDeleteOptions, aD as PublicReadQueryOptions } from './types-B9lGhZlB.js';
2
2
  import { GenerateMetadataOptions, Metadata } from './metadata.js';
3
- import { S as ServerCollection, P as PublicCollection } from './const-pmHlwm3E.js';
4
- import { C as CollectionType } from './types-Bf2iCjy8.js';
3
+ import { S as ServerCollection, P as PublicCollection } from './const-_WWHU-gX.js';
4
+ import { C as CollectionType } from './types-BiKNBwRA.js';
5
5
 
6
6
  interface FetchOptions extends RequestInit {
7
7
  apiUrl?: string;
@@ -1,4 +1,4 @@
1
- import { d as Config } from './payload-types-C7Ul4ElL.js';
1
+ import { d as Config } from './payload-types-DLxkB7Mv.cjs';
2
2
 
3
3
  /**
4
4
  * Collection type derived from Payload Config.
@@ -9,24 +9,24 @@ type Collection = keyof Config['collections'];
9
9
  * Internal collections that should not be exposed via SDK.
10
10
  * Includes Payload system collections and admin-only collections.
11
11
  */
12
- declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-locked-documents", "payload-preferences", "payload-migrations", "payload-folders", "field-configs", "system-media", "track-assets", "audiences", "email-logs", "api-usage", "tenant-analytics-daily", "tenant-web-analytics-config", "analytics-event-schemas", "subscriptions", "billing-history", "inventory-reservations", "inventory-adjustments", "commerce-notification-intents", "product-collection-items", "order-status-logs", "tenant-commerce-config", "api-keys", "personal-access-tokens", "tenant-entitlements", "tenant-purge-jobs", "direct-upload-sessions", "webhook-events", "webhook-deliveries", "audit-logs", "plans", "webhooks", "event-registrations"];
12
+ declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-locked-documents", "payload-preferences", "payload-migrations", "payload-folders", "field-configs", "system-media", "track-assets", "audiences", "email-logs", "api-usage", "tenant-analytics-daily", "tenant-web-analytics-config", "analytics-event-schemas", "subscriptions", "billing-history", "inventory-reservations", "inventory-adjustments", "commerce-notification-intents", "product-collection-items", "order-status-logs", "tenant-commerce-config", "api-keys", "personal-access-tokens", "tenant-entitlements", "tenant-purge-jobs", "direct-upload-sessions", "webhook-events", "webhook-deliveries", "audit-logs", "plans", "webhooks", "event-registrations", "customer-payment-methods", "tenant-payment-credentials"];
13
13
  /**
14
14
  * Array of browser-public collection names for runtime use (e.g., Zod enum validation).
15
15
  * This is the single source of truth for publishable-key collection discovery.
16
16
  */
17
- declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "customer-profiles", "customer-profile-stats", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags"];
17
+ declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "markets", "brands", "customer-profiles", "customer-profile-stats", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags", "membership-plans", "customer-memberships"];
18
18
  /**
19
19
  * Server-auth collection names for runtime use. These collections are safe for
20
20
  * secret-key/PAT SDK and MCP server tools, but must not appear in browser or
21
21
  * publishable-key collection discovery.
22
22
  */
23
- declare const SERVER_ONLY_COLLECTIONS: readonly ["tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "checkouts", "checkout-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "canvas-nodes", "canvas-edges", "customer-groups", "reports", "community-bans", "order-export-profiles"];
23
+ declare const SERVER_ONLY_COLLECTIONS: readonly ["tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "checkouts", "checkout-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "canvas-nodes", "canvas-edges", "customer-groups", "reports", "community-bans", "order-export-profiles", "membership-charges"];
24
24
  /**
25
25
  * Browser-public collections available for publishable-key SDK access.
26
26
  * Derived from the COLLECTIONS array (single source of truth).
27
27
  */
28
28
  type PublicCollection = (typeof COLLECTIONS)[number];
29
- declare const SERVER_COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "customer-profiles", "customer-profile-stats", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags", "tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "checkouts", "checkout-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "canvas-nodes", "canvas-edges", "customer-groups", "reports", "community-bans", "order-export-profiles"];
29
+ declare const SERVER_COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "markets", "brands", "customer-profiles", "customer-profile-stats", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags", "membership-plans", "customer-memberships", "tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "checkouts", "checkout-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "canvas-nodes", "canvas-edges", "customer-groups", "reports", "community-bans", "order-export-profiles", "membership-charges"];
30
30
  type ServerCollection = (typeof SERVER_COLLECTIONS)[number];
31
31
 
32
32
  export { type Collection as C, INTERNAL_COLLECTIONS as I, type PublicCollection as P, type ServerCollection as S, COLLECTIONS as a, SERVER_COLLECTIONS as b, SERVER_ONLY_COLLECTIONS as c };
@@ -1,4 +1,4 @@
1
- import { d as Config } from './payload-types-C7Ul4ElL.cjs';
1
+ import { d as Config } from './payload-types-DLxkB7Mv.js';
2
2
 
3
3
  /**
4
4
  * Collection type derived from Payload Config.
@@ -9,24 +9,24 @@ type Collection = keyof Config['collections'];
9
9
  * Internal collections that should not be exposed via SDK.
10
10
  * Includes Payload system collections and admin-only collections.
11
11
  */
12
- declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-locked-documents", "payload-preferences", "payload-migrations", "payload-folders", "field-configs", "system-media", "track-assets", "audiences", "email-logs", "api-usage", "tenant-analytics-daily", "tenant-web-analytics-config", "analytics-event-schemas", "subscriptions", "billing-history", "inventory-reservations", "inventory-adjustments", "commerce-notification-intents", "product-collection-items", "order-status-logs", "tenant-commerce-config", "api-keys", "personal-access-tokens", "tenant-entitlements", "tenant-purge-jobs", "direct-upload-sessions", "webhook-events", "webhook-deliveries", "audit-logs", "plans", "webhooks", "event-registrations"];
12
+ declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-locked-documents", "payload-preferences", "payload-migrations", "payload-folders", "field-configs", "system-media", "track-assets", "audiences", "email-logs", "api-usage", "tenant-analytics-daily", "tenant-web-analytics-config", "analytics-event-schemas", "subscriptions", "billing-history", "inventory-reservations", "inventory-adjustments", "commerce-notification-intents", "product-collection-items", "order-status-logs", "tenant-commerce-config", "api-keys", "personal-access-tokens", "tenant-entitlements", "tenant-purge-jobs", "direct-upload-sessions", "webhook-events", "webhook-deliveries", "audit-logs", "plans", "webhooks", "event-registrations", "customer-payment-methods", "tenant-payment-credentials"];
13
13
  /**
14
14
  * Array of browser-public collection names for runtime use (e.g., Zod enum validation).
15
15
  * This is the single source of truth for publishable-key collection discovery.
16
16
  */
17
- declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "customer-profiles", "customer-profile-stats", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags"];
17
+ declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "markets", "brands", "customer-profiles", "customer-profile-stats", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags", "membership-plans", "customer-memberships"];
18
18
  /**
19
19
  * Server-auth collection names for runtime use. These collections are safe for
20
20
  * secret-key/PAT SDK and MCP server tools, but must not appear in browser or
21
21
  * publishable-key collection discovery.
22
22
  */
23
- declare const SERVER_ONLY_COLLECTIONS: readonly ["tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "checkouts", "checkout-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "canvas-nodes", "canvas-edges", "customer-groups", "reports", "community-bans", "order-export-profiles"];
23
+ declare const SERVER_ONLY_COLLECTIONS: readonly ["tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "checkouts", "checkout-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "canvas-nodes", "canvas-edges", "customer-groups", "reports", "community-bans", "order-export-profiles", "membership-charges"];
24
24
  /**
25
25
  * Browser-public collections available for publishable-key SDK access.
26
26
  * Derived from the COLLECTIONS array (single source of truth).
27
27
  */
28
28
  type PublicCollection = (typeof COLLECTIONS)[number];
29
- declare const SERVER_COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "customer-profiles", "customer-profile-stats", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags", "tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "checkouts", "checkout-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "canvas-nodes", "canvas-edges", "customer-groups", "reports", "community-bans", "order-export-profiles"];
29
+ declare const SERVER_COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "markets", "brands", "customer-profiles", "customer-profile-stats", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags", "membership-plans", "customer-memberships", "tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "checkouts", "checkout-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "canvas-nodes", "canvas-edges", "customer-groups", "reports", "community-bans", "order-export-profiles", "membership-charges"];
30
30
  type ServerCollection = (typeof SERVER_COLLECTIONS)[number];
31
31
 
32
32
  export { type Collection as C, INTERNAL_COLLECTIONS as I, type PublicCollection as P, type ServerCollection as S, COLLECTIONS as a, SERVER_COLLECTIONS as b, SERVER_ONLY_COLLECTIONS as c };
@@ -1,6 +1,6 @@
1
- import { C as Collection } from './const-pmHlwm3E.js';
2
- import { C as CollectionType } from './types-Bf2iCjy8.js';
3
- import './payload-types-C7Ul4ElL.js';
1
+ import { C as Collection } from './const-_WWHU-gX.js';
2
+ import { C as CollectionType } from './types-BiKNBwRA.js';
3
+ import './payload-types-DLxkB7Mv.js';
4
4
 
5
5
  type WebhookOperation = string;
6
6
  /**
@@ -74,7 +74,7 @@ type OrderChangedWebhookEvent<T extends Collection | string = Collection, TData
74
74
  change: WebhookOrderChange;
75
75
  };
76
76
  declare const COMMERCE_NOTIFICATION_OPERATION: "notification";
77
- declare const COMMERCE_NOTIFICATION_EVENTS: readonly ["orderPaid", "orderCanceled", "fulfillmentShipped", "orderDelivered", "returnRequested", "returnCompleted"];
77
+ declare const COMMERCE_NOTIFICATION_EVENTS: readonly ["orderPaid", "orderCanceled", "fulfillmentShipped", "orderDelivered", "returnRequested", "returnApproved", "returnRejected", "returnCompleted"];
78
78
  type CommerceNotificationEventName = (typeof COMMERCE_NOTIFICATION_EVENTS)[number];
79
79
  type CommerceNotificationSourceCollection = 'orders' | 'fulfillments' | 'returns';
80
80
  type CommerceNotificationSource = {
@@ -1,6 +1,6 @@
1
- import { C as Collection } from './const-BiDujixF.cjs';
2
- import { C as CollectionType } from './types-ChV1t4ei.cjs';
3
- import './payload-types-C7Ul4ElL.cjs';
1
+ import { C as Collection } from './const-BBynifk0.cjs';
2
+ import { C as CollectionType } from './types-B1ngKbWI.cjs';
3
+ import './payload-types-DLxkB7Mv.cjs';
4
4
 
5
5
  type WebhookOperation = string;
6
6
  /**
@@ -74,7 +74,7 @@ type OrderChangedWebhookEvent<T extends Collection | string = Collection, TData
74
74
  change: WebhookOrderChange;
75
75
  };
76
76
  declare const COMMERCE_NOTIFICATION_OPERATION: "notification";
77
- declare const COMMERCE_NOTIFICATION_EVENTS: readonly ["orderPaid", "orderCanceled", "fulfillmentShipped", "orderDelivered", "returnRequested", "returnCompleted"];
77
+ declare const COMMERCE_NOTIFICATION_EVENTS: readonly ["orderPaid", "orderCanceled", "fulfillmentShipped", "orderDelivered", "returnRequested", "returnApproved", "returnRejected", "returnCompleted"];
78
78
  type CommerceNotificationEventName = (typeof COMMERCE_NOTIFICATION_EVENTS)[number];
79
79
  type CommerceNotificationSourceCollection = 'orders' | 'fulfillments' | 'returns';
80
80
  type CommerceNotificationSource = {
package/dist/index.cjs CHANGED
@@ -824,6 +824,64 @@ async function httpFetch(url, options) {
824
824
  throw lastError ?? new NetworkError("Request failed after retries");
825
825
  }
826
826
 
827
+ // src/core/api/endpoints.ts
828
+ var COMMERCE_ENDPOINTS = {
829
+ orders: {
830
+ create: "/api/orders/create",
831
+ update: "/api/orders/update",
832
+ confirmPayment: "/api/orders/confirm-payment",
833
+ byPayment: "/api/orders/by-payment",
834
+ cancel: "/api/orders/cancel",
835
+ resolveCancelRefund: "/api/orders/resolve-cancel-refund",
836
+ checkout: "/api/orders/checkout",
837
+ createFulfillment: "/api/orders/create-fulfillment",
838
+ updateFulfillment: "/api/orders/update-fulfillment"
839
+ },
840
+ transactions: {
841
+ update: "/api/transactions/update"
842
+ },
843
+ returns: {
844
+ create: "/api/returns/create",
845
+ update: "/api/returns/update",
846
+ returnRefund: "/api/returns/return-refund"
847
+ },
848
+ fulfillmentOrders: {
849
+ prepare: "/api/fulfillment-orders/prepare-fulfillment-order"
850
+ },
851
+ fulfillments: {
852
+ bulkImport: "/api/fulfillments/bulk-import"
853
+ },
854
+ carts: {
855
+ mine: "/api/carts/mine",
856
+ merge: "/api/carts/merge",
857
+ addItem: "/api/carts/add-item",
858
+ updateItem: "/api/carts/update-item",
859
+ removeItem: "/api/carts/remove-item",
860
+ applyDiscount: "/api/carts/apply-discount",
861
+ removeDiscount: "/api/carts/remove-discount",
862
+ clear: "/api/carts/clear"
863
+ },
864
+ products: {
865
+ stockCheck: "/api/products/stock-check",
866
+ stockSnapshot: "/api/products/stock",
867
+ listingGroups: "/api/products/listing-groups",
868
+ listingGroupsCatalog: "/api/products/listing-groups/catalog",
869
+ listingGroupsQuery: "/api/products/listing-groups/query",
870
+ listingGroupsQueryCatalog: "/api/products/listing-groups/query/catalog",
871
+ detail: "/api/products/detail",
872
+ detailCatalog: "/api/products/detail/catalog",
873
+ upsert: "/api/products/upsert"
874
+ }
875
+ };
876
+ var COMMERCE_ENDPOINT_PATHS = Object.values(
877
+ COMMERCE_ENDPOINTS
878
+ ).flatMap((group) => Object.values(group));
879
+ var MEMBERSHIP_ENDPOINTS = {
880
+ subscribe: "/api/memberships/subscribe",
881
+ cancel: (id) => `/api/memberships/${id}/cancel`,
882
+ me: "/api/memberships/me"
883
+ };
884
+
827
885
  // src/core/internal/utils/query-string.ts
828
886
  function productDetailQuery(params) {
829
887
  const search = new URLSearchParams();
@@ -832,7 +890,7 @@ function productDetailQuery(params) {
832
890
  } else {
833
891
  search.set("id", params.id);
834
892
  }
835
- return `/api/products/detail?${search}`;
893
+ return `${COMMERCE_ENDPOINTS.products.detail}?${search}`;
836
894
  }
837
895
  function productDetailCatalogQuery(params) {
838
896
  const search = new URLSearchParams();
@@ -841,20 +899,17 @@ function productDetailCatalogQuery(params) {
841
899
  } else {
842
900
  search.set("id", params.id);
843
901
  }
844
- return `/api/products/detail/catalog?${search}`;
902
+ return `${COMMERCE_ENDPOINTS.products.detailCatalog}?${search}`;
845
903
  }
846
904
  function listingGroupsCatalogQuery(params) {
847
- return `/api/products/listing-groups/catalog?ids=${params.productIds.map(encodeURIComponent).join(",")}`;
905
+ return `${COMMERCE_ENDPOINTS.products.listingGroupsCatalog}?ids=${params.productIds.map(encodeURIComponent).join(",")}`;
848
906
  }
849
907
  function appendListingGroupsQuerySearchParams(search, options) {
850
908
  if (options?.page != null) search.set("page", String(options.page));
851
909
  if (options?.limit != null) search.set("limit", String(options.limit));
852
910
  if (options?.sort != null) {
853
911
  const sort = options.sort;
854
- search.set(
855
- "sort",
856
- Array.isArray(sort) ? sort.join(",") : sort
857
- );
912
+ search.set("sort", Array.isArray(sort) ? sort.join(",") : sort);
858
913
  }
859
914
  if (options?.where != null) {
860
915
  search.set("whereJson", JSON.stringify(options.where));
@@ -864,16 +919,16 @@ function listingGroupsQueryUrl(options) {
864
919
  const search = new URLSearchParams();
865
920
  appendListingGroupsQuerySearchParams(search, options);
866
921
  const query = search.toString();
867
- return `/api/products/listing-groups/query${query ? `?${query}` : ""}`;
922
+ return `${COMMERCE_ENDPOINTS.products.listingGroupsQuery}${query ? `?${query}` : ""}`;
868
923
  }
869
924
  function listingGroupsQueryCatalogUrl(options) {
870
925
  const search = new URLSearchParams();
871
926
  appendListingGroupsQuerySearchParams(search, options);
872
927
  const query = search.toString();
873
- return `/api/products/listing-groups/query/catalog${query ? `?${query}` : ""}`;
928
+ return `${COMMERCE_ENDPOINTS.products.listingGroupsQueryCatalog}${query ? `?${query}` : ""}`;
874
929
  }
875
930
  function stockSnapshotQuery(params) {
876
- return `/api/products/stock?variantIds=${params.variantIds.map(encodeURIComponent).join(",")}`;
931
+ return `${COMMERCE_ENDPOINTS.products.stockSnapshot}?variantIds=${params.variantIds.map(encodeURIComponent).join(",")}`;
877
932
  }
878
933
 
879
934
  // src/core/collection/http-client.ts
@@ -1769,48 +1824,6 @@ var CustomerNamespace = class {
1769
1824
  }
1770
1825
  };
1771
1826
 
1772
- // src/core/api/endpoints.ts
1773
- var COMMERCE_ENDPOINTS = {
1774
- orders: {
1775
- create: "/api/orders/create",
1776
- update: "/api/orders/update",
1777
- confirmPayment: "/api/orders/confirm-payment",
1778
- byPayment: "/api/orders/by-payment",
1779
- cancel: "/api/orders/cancel",
1780
- resolveCancelRefund: "/api/orders/resolve-cancel-refund",
1781
- checkout: "/api/orders/checkout",
1782
- createFulfillment: "/api/orders/create-fulfillment",
1783
- updateFulfillment: "/api/orders/update-fulfillment"
1784
- },
1785
- transactions: {
1786
- update: "/api/transactions/update"
1787
- },
1788
- returns: {
1789
- create: "/api/returns/create",
1790
- update: "/api/returns/update",
1791
- returnRefund: "/api/returns/return-refund"
1792
- },
1793
- fulfillmentOrders: {
1794
- prepare: "/api/fulfillment-orders/prepare-fulfillment-order"
1795
- },
1796
- fulfillments: {
1797
- bulkImport: "/api/fulfillments/bulk-import"
1798
- },
1799
- carts: {
1800
- mine: "/api/carts/mine",
1801
- merge: "/api/carts/merge",
1802
- addItem: "/api/carts/add-item",
1803
- updateItem: "/api/carts/update-item",
1804
- removeItem: "/api/carts/remove-item",
1805
- applyDiscount: "/api/carts/apply-discount",
1806
- removeDiscount: "/api/carts/remove-discount",
1807
- clear: "/api/carts/clear"
1808
- }
1809
- };
1810
- var COMMERCE_ENDPOINT_PATHS = Object.values(
1811
- COMMERCE_ENDPOINTS
1812
- ).flatMap((group) => Object.values(group));
1813
-
1814
1827
  // src/core/api/cart-api.ts
1815
1828
  var CartApi = class extends CustomerScopedApi {
1816
1829
  constructor(options) {
@@ -3746,7 +3759,10 @@ var CommerceClient = class {
3746
3759
  onRequestId: options.onRequestId
3747
3760
  });
3748
3761
  this.product = {
3749
- stockCheck: (params) => api.post("/api/products/stock-check", params),
3762
+ stockCheck: (params) => api.post(
3763
+ COMMERCE_ENDPOINTS.products.stockCheck,
3764
+ params
3765
+ ),
3750
3766
  stockSnapshot: (params) => api.get(stockSnapshotQuery(params)),
3751
3767
  listingGroups: (params) => api.get(
3752
3768
  listingGroupsCatalogQuery(params)
@@ -3764,7 +3780,9 @@ var CommerceClient = class {
3764
3780
  },
3765
3781
  detail: async (params) => {
3766
3782
  try {
3767
- const product = await api.get(productDetailQuery(params));
3783
+ const product = await api.get(
3784
+ productDetailQuery(params)
3785
+ );
3768
3786
  return { found: true, product };
3769
3787
  } catch (err) {
3770
3788
  const notFoundResult = productDetailResultFromError(err);
@@ -3812,7 +3830,10 @@ var CommerceClient = class {
3812
3830
  validate: (params) => api.post("/api/discounts/validate", params)
3813
3831
  };
3814
3832
  this.shipping = {
3815
- calculate: (params) => api.post("/api/shipping-policies/calculate", params)
3833
+ calculate: (params) => api.post(
3834
+ "/api/shipping-policies/calculate",
3835
+ params
3836
+ )
3816
3837
  };
3817
3838
  }
3818
3839
  };
@@ -3901,8 +3922,12 @@ function buildGuestCancelRequestBody(token, params) {
3901
3922
  }
3902
3923
  function buildRangeEndpoint(params) {
3903
3924
  const urlParams = new URLSearchParams();
3904
- urlParams.set("start", formatDateParam(params.start));
3905
- urlParams.set("end", formatDateParam(params.end));
3925
+ if (params.start !== void 0) {
3926
+ urlParams.set("start", formatDateParam(params.start));
3927
+ }
3928
+ if (params.end !== void 0) {
3929
+ urlParams.set("end", formatDateParam(params.end));
3930
+ }
3906
3931
  if (params.limit !== void 0) urlParams.set("limit", String(params.limit));
3907
3932
  if (params.page !== void 0) urlParams.set("page", String(params.page));
3908
3933
  appendValues(urlParams, "calendar", params.calendar);
@@ -3925,6 +3950,13 @@ function appendValues(params, key, value) {
3925
3950
  }
3926
3951
 
3927
3952
  // src/core/client/client.ts
3953
+ var BrowserMembershipApi = class extends CustomerScopedApi {
3954
+ me() {
3955
+ return this.request(MEMBERSHIP_ENDPOINTS.me, {
3956
+ method: "GET"
3957
+ });
3958
+ }
3959
+ };
3928
3960
  var Client = class {
3929
3961
  constructor(options) {
3930
3962
  this.lastRequestId = null;
@@ -3989,6 +4021,16 @@ var Client = class {
3989
4021
  onRequestId,
3990
4022
  this.config.apiUrl
3991
4023
  );
4024
+ const membershipApi = new BrowserMembershipApi("MembershipApi", {
4025
+ publishableKey: this.config.publishableKey,
4026
+ apiUrl: this.config.apiUrl,
4027
+ customerToken: () => this.customer.auth.getToken(),
4028
+ onUnauthorized,
4029
+ onRequestId
4030
+ });
4031
+ this.memberships = {
4032
+ me: membershipApi.me.bind(membershipApi)
4033
+ };
3992
4034
  }
3993
4035
  getState() {
3994
4036
  return { ...this.state };
@@ -4056,6 +4098,8 @@ var COMMERCE_NOTIFICATION_EVENTS = [
4056
4098
  "fulfillmentShipped",
4057
4099
  "orderDelivered",
4058
4100
  "returnRequested",
4101
+ "returnApproved",
4102
+ "returnRejected",
4059
4103
  "returnCompleted"
4060
4104
  ];
4061
4105
  function isStringOrNumber(value) {
@@ -4144,7 +4188,7 @@ function isCommerceNotificationWebhookEvent(event) {
4144
4188
  if (notification.event === "fulfillmentShipped") {
4145
4189
  return sourceCollection === "fulfillments" && matchesOptionalId(data.fulfillmentId, sourceId) && typeof notification.fulfillmentId === "string" && notification.fulfillmentId.length > 0 && matchesOptionalId(notification.fulfillmentId, sourceId) && matchesOptionalId(data.fulfillmentId, notification.fulfillmentId) && matchesOptionalId(changeSourceId, notification.fulfillmentId);
4146
4190
  }
4147
- if (notification.event === "returnRequested" || notification.event === "returnCompleted") {
4191
+ if (notification.event === "returnRequested" || notification.event === "returnApproved" || notification.event === "returnRejected" || notification.event === "returnCompleted") {
4148
4192
  return sourceCollection === "returns" && matchesOptionalId(data.returnId, sourceId) && typeof notification.returnId === "string" && notification.returnId.length > 0 && matchesOptionalId(notification.returnId, sourceId) && matchesOptionalId(data.returnId, notification.returnId) && matchesOptionalId(changeSourceId, notification.returnId);
4149
4193
  }
4150
4194
  return false;
@@ -4327,7 +4371,9 @@ var INTERNAL_COLLECTIONS = [
4327
4371
  "audit-logs",
4328
4372
  "plans",
4329
4373
  "webhooks",
4330
- "event-registrations"
4374
+ "event-registrations",
4375
+ "customer-payment-methods",
4376
+ "tenant-payment-credentials"
4331
4377
  ];
4332
4378
  var COLLECTIONS = [
4333
4379
  "tenants",
@@ -4339,6 +4385,7 @@ var COLLECTIONS = [
4339
4385
  "product-categories",
4340
4386
  "product-tags",
4341
4387
  "product-collections",
4388
+ "markets",
4342
4389
  "brands",
4343
4390
  "customer-profiles",
4344
4391
  "customer-profile-stats",
@@ -4383,7 +4430,9 @@ var COLLECTIONS = [
4383
4430
  "events",
4384
4431
  "event-categories",
4385
4432
  "event-occurrences",
4386
- "event-tags"
4433
+ "event-tags",
4434
+ "membership-plans",
4435
+ "customer-memberships"
4387
4436
  ];
4388
4437
  var SERVER_ONLY_COLLECTIONS = [
4389
4438
  "tenant-logos",
@@ -4416,7 +4465,8 @@ var SERVER_ONLY_COLLECTIONS = [
4416
4465
  "customer-groups",
4417
4466
  "reports",
4418
4467
  "community-bans",
4419
- "order-export-profiles"
4468
+ "order-export-profiles",
4469
+ "membership-charges"
4420
4470
  ];
4421
4471
  var SERVER_COLLECTIONS = [
4422
4472
  ...COLLECTIONS,