@01.software/sdk 0.42.0 → 0.44.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 +55 -0
  2. package/README.md +27 -22
  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-BhCMwIus.d.ts → collection-client-DWooaiTr.d.ts} +3 -3
  10. package/dist/{collection-client-B-qVIBnJ.d.cts → collection-client-Dyl-CDcj.d.cts} +3 -3
  11. package/dist/{const-pmHlwm3E.d.ts → const-1vleZ6ov.d.cts} +5 -5
  12. package/dist/{const-BiDujixF.d.cts → const-pGDnsy0o.d.ts} +5 -5
  13. package/dist/{index-B1UBDaKz.d.ts → index-DUNySyxV.d.ts} +4 -4
  14. package/dist/{index-D78ki6Ij.d.cts → index-a6g7vqAD.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-CDsuOEfM.d.cts} +401 -34
  22. package/dist/{payload-types-C7Ul4ElL.d.ts → payload-types-CDsuOEfM.d.ts} +401 -34
  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-D5dSNIGs.d.ts → types-CDND3hzq.d.cts} +104 -10
  38. package/dist/{types-BL7M-EUV.d.cts → types-Dt9FJisi.d.ts} +104 -10
  39. package/dist/{types-ChV1t4ei.d.cts → types-SoXsbKhj.d.cts} +1 -1
  40. package/dist/{types-Bf2iCjy8.d.ts → types-oiae_LMm.d.ts} +1 -1
  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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,60 @@
1
1
  # @01.software/sdk
2
2
 
3
+ ## 0.44.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 14f6a6a: BREAKING (0.x minor): require `pgProvider` alongside `pgPaymentId` for paid
8
+ order creation and checkout inputs so storefronts persist the same
9
+ provider-scoped payment key used by confirmation and payment recovery. Free
10
+ orders omit both fields.
11
+
12
+ ### Patch Changes
13
+
14
+ - 2e5c223: Expose registry-backed market country and currency fields in generated Payload collection types.
15
+ - 99727ac: Expose the product `unlisted` status in generated SDK Payload types. Product
16
+ visibility now lives on `status`; Console migrations add the `unlisted` enum
17
+ value, convert legacy product visibility values into status, and remove the
18
+ legacy visibility storage.
19
+
20
+ ## 0.43.0
21
+
22
+ ### Minor Changes
23
+
24
+ - 81ef105: Expose cart item `requiresShipping` snapshots through the public cart item
25
+ types, and update the ecommerce starter so non-shipping-only carts skip shipping
26
+ address collection while legacy or mixed carts remain shippable by default.
27
+ - 5d7b26f: Expose the new `markets` collection slug through the browser-safe `COLLECTIONS`
28
+ constant so storefront and integration code can address tenant-scoped market
29
+ records without local collection-name mirrors.
30
+
31
+ ### Patch Changes
32
+
33
+ - 9789528: Add checkout shipping context fields to the SDK contract and update the
34
+ ecommerce starter to pass checkout context through the order API instead of
35
+ mutating carts through the customer-scoped SDK client.
36
+ - 9b7afab: Expose membership plan and customer membership collection slugs in the public collection surface.
37
+ - db8bd4b: Add optional `seo` (title/description) to product upsert `ProductFieldsInput` for CSV import parity.
38
+ - b95f6ac: Expose stable storefront discount validation reason codes in the SDK.
39
+ `ValidateDiscountResult.reasonCode` now carries the machine-readable discount
40
+ reason union returned by `/api/discounts/validate`, so storefronts can branch and
41
+ localize without parsing human-readable `reason` text.
42
+ - c60ec7f: fix(sdk): remove stale event calendar order field
43
+
44
+ `EventCalendar` and its select type no longer expose the stale `_order` field
45
+ because tenant-global event calendars are not operator-orderable.
46
+
47
+ - 6c71a71: chore(sdk): sync event occurrence timezone generated type docs
48
+
49
+ The generated Payload types now include the Event Occurrence timezone field
50
+ description used by Console's read-only occurrence identity timezone contract.
51
+ Type-only change; no SDK runtime or request shape changed.
52
+
53
+ - 3aa6239: Allow `events.getRange()` to omit `start` and `end` so the public events range endpoint can use the tenant calendar's public listing defaults.
54
+ - 294b7d1: Keep membership contract-parity type tests within the SDK export guard's explicit test-only private-contract allowlist.
55
+ - f87fe09: Add return approval and rejection commerce notification webhook events.
56
+ - 4362b14: Expose tenant commerce `fulfillmentMode` in tenant feature progress responses.
57
+
3
58
  ## 0.42.0
4
59
 
5
60
  ### Minor Changes
package/README.md CHANGED
@@ -118,7 +118,10 @@ typo detection) and pass it as the generic. Mistyped names and out-of-enum
118
118
  values then fail to compile:
119
119
 
120
120
  ```typescript
121
- import { createAnalytics, defineAnalyticsEvents } from '@01.software/sdk/analytics'
121
+ import {
122
+ createAnalytics,
123
+ defineAnalyticsEvents,
124
+ } from '@01.software/sdk/analytics'
122
125
 
123
126
  type ShopEvents = {
124
127
  signup: { plan: 'free' | 'pro'; trial: boolean }
@@ -128,7 +131,7 @@ type ShopEvents = {
128
131
 
129
132
  const analytics = createAnalytics<ShopEvents>({ publishableKey: 'pk_xxx' })
130
133
  analytics.track('signup', { plan: 'pro', trial: false }) // ✅
131
- analytics.track('checkout_start') // ✅ no props
134
+ analytics.track('checkout_start') // ✅ no props
132
135
  // analytics.track('signpu', { plan: 'pro', trial: false }) // ❌ unknown event
133
136
  // analytics.track('signup', { plan: 'team', trial: false }) // ❌ enum violation
134
137
 
@@ -144,7 +147,10 @@ instance for its subtree:
144
147
  Reusing the `ShopEvents` type from above:
145
148
 
146
149
  ```tsx
147
- import { AnalyticsProvider, useAnalytics } from '@01.software/sdk/analytics/react'
150
+ import {
151
+ AnalyticsProvider,
152
+ useAnalytics,
153
+ } from '@01.software/sdk/analytics/react'
148
154
 
149
155
  function Root() {
150
156
  return (
@@ -220,7 +226,8 @@ const order = await server.commerce.orders.create({
220
226
  { product: productId, variant: variantId, option: optionId, quantity: 1 },
221
227
  ],
222
228
  totalAmount: 10000,
223
- pgPaymentId: 'provider-payment-id', // optional (omit for free orders)
229
+ pgProvider: 'portone', // required with pgPaymentId
230
+ pgPaymentId: 'provider-payment-id', // omit both fields for free orders
224
231
  discountCode: 'WELCOME10', // optional
225
232
  })
226
233
 
@@ -340,14 +347,13 @@ mismatches, still throw
340
347
  typed `SDKError` subclasses and preserve request IDs through the existing
341
348
  `lastRequestId` / `onRequestId` path.
342
349
 
343
- Public product visibility has two axes. Lifecycle `status` must still be
344
- `published` and `publishedAt` must be current or empty. Then
345
- `storefrontVisibility` decides storefront exposure: `listed` products appear in
346
- listing helpers and direct detail, `unlisted` products are omitted from listing
347
- helpers but can be fetched by direct detail slug/id, and `hidden` products return
348
- `{ found: false, reason: 'not_published' }` from detail and are omitted from
349
- listings. Legacy products without `storefrontVisibility` are treated as
350
- `listed`.
350
+ Public product visibility is driven by product `status` and `publishedAt`.
351
+ Listing helpers return products with `status: 'published'` when `publishedAt`
352
+ is current or empty. Direct detail and checkout admission also allow
353
+ `status: 'unlisted'`, so an unlisted product can be opened by slug/id without
354
+ appearing in PLP/search/curated listing helpers. Draft, archived, scheduled, or
355
+ malformed lifecycle states return `{ found: false, reason: 'not_published' }`
356
+ from detail and are omitted from listings.
351
357
 
352
358
  The successful product payload exposes inventory rollups without sentinel
353
359
  values: `product.totalInventory` is the tracked stock sum across non-unlimited
@@ -451,13 +457,6 @@ const { docs } = await server.collections.from('products').find({
451
457
  { publishedAt: { equals: null } },
452
458
  ],
453
459
  },
454
- {
455
- or: [
456
- { storefrontVisibility: { equals: 'listed' } },
457
- { storefrontVisibility: { exists: false } },
458
- { storefrontVisibility: { equals: null } },
459
- ],
460
- },
461
460
  ],
462
461
  },
463
462
  limit: 24,
@@ -769,7 +768,7 @@ Dotted-path filters (`where: { 'product.slug': { equals } }`) are Payload-native
769
768
 
770
769
  Checklist when `find()` returns `docs: []` unexpectedly, in order of likelihood:
771
770
 
772
- 1. **Access control filtered the document.** Many collections enforce public read filters. Products require `status: 'published'`, a current or unset `publishedAt`, and listable storefront visibility (`listed`, legacy missing, or `null`) for publishable-key raw listing reads. Draft, future, `unlisted`, `hidden`, or malformed products silently disappear from raw listing results even when their slug or ID matches. Use the shaped product detail helper for direct-link `unlisted` products. Correlate with backend logs via `client.lastRequestId` (or catch `SDKError.requestId`).
771
+ 1. **Access control filtered the document.** Many collections enforce public read filters. Product listing reads require `status: 'published'` plus a current or unset `publishedAt`. Draft, future, `unlisted`, archived, or malformed products silently disappear from raw listing results even when their slug or ID matches. Use `commerce.product.detail({ slug | id })` for `unlisted` products. Correlate with backend logs via `client.lastRequestId` (or catch `SDKError.requestId`).
773
772
  2. **Build-time publishable key / API URL differs from runtime.** SSG `generateStaticParams` / `generateMetadata` / the page render must all see the same tenant context. A wrong or missing key at build time produces a baked-in empty response.
774
773
  3. **Next.js SSG fetch cache served a stale empty response.** Use `cache: 'no-store'` or `export const revalidate = 0` on server components that should reflect live data.
775
774
  4. **`where: { slug: 'x' }` string shorthand.** Always use `{ slug: { equals: 'x' } }` — bare strings silently match nothing.
@@ -1097,7 +1096,7 @@ Available on ServerClient via `server.commerce.orders.*`. `checkout` and `listMi
1097
1096
  // Orders
1098
1097
  await server.commerce.orders.create(params)
1099
1098
  await server.commerce.orders.update({ orderNumber, status: 'confirmed' })
1100
- await server.commerce.orders.checkout({ cartId, pgPaymentId?, orderNumber, customerSnapshot, discountCode? })
1099
+ await server.commerce.orders.checkout({ cartId, orderNumber, customerSnapshot, pgProvider, pgPaymentId, discountCode? })
1101
1100
 
1102
1101
  // Single-order lookup (getOrder endpoint removed — use collection find)
1103
1102
  const { docs: [order] } = await server.collections.from('orders').find({
@@ -1123,6 +1122,12 @@ await server.commerce.orders.confirmPayment({
1123
1122
  providerEventId,
1124
1123
  })
1125
1124
 
1125
+ // For paid create/checkout flows, pass pgProvider with the same provider slug
1126
+ // you will later use for confirmPayment and getByPaymentId. pgProvider and
1127
+ // pgPaymentId are a pair: omit both for free orders, or provide both for paid
1128
+ // payment windows. getByPaymentId({ pgProvider, pgPaymentId }) is strict and
1129
+ // only resolves payment transactions stored with the same provider.
1130
+
1126
1131
  // Low-level transaction annotation / compatibility path. Prefer confirmPayment()
1127
1132
  // for normal provider-verified paid transitions.
1128
1133
  // status: 'failed' records a retryable PG failure on the Transaction only; the
@@ -1411,7 +1416,7 @@ Source of truth: `packages/sdk/src/core/collection/const.ts` (`COLLECTIONS`).
1411
1416
  | Category | Browser-public generic collections |
1412
1417
  | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1413
1418
  | Tenant | `tenants`, `tenant-metadata` |
1414
- | Products | `products`, `product-variants`, `product-options`, `product-option-values`, `product-categories`, `product-tags`, `product-collections`, `brands` |
1419
+ | Products | `products`, `product-variants`, `product-options`, `product-option-values`, `product-categories`, `product-tags`, `product-collections`, `markets`, `brands` |
1415
1420
  | Customers | `customer-profiles` |
1416
1421
  | Commerce | `discounts`, `shipping-policies`, `shipping-zones` |
1417
1422
  | Content | `documents`, `document-categories`, `document-types`, `articles`, `article-authors`, `article-categories`, `article-tags`, `links`, `link-categories`, `link-tags` |
package/dist/client.cjs CHANGED
@@ -668,6 +668,64 @@ async function httpFetch(url, options) {
668
668
  throw lastError ?? new NetworkError("Request failed after retries");
669
669
  }
670
670
 
671
+ // src/core/api/endpoints.ts
672
+ var COMMERCE_ENDPOINTS = {
673
+ orders: {
674
+ create: "/api/orders/create",
675
+ update: "/api/orders/update",
676
+ confirmPayment: "/api/orders/confirm-payment",
677
+ byPayment: "/api/orders/by-payment",
678
+ cancel: "/api/orders/cancel",
679
+ resolveCancelRefund: "/api/orders/resolve-cancel-refund",
680
+ checkout: "/api/orders/checkout",
681
+ createFulfillment: "/api/orders/create-fulfillment",
682
+ updateFulfillment: "/api/orders/update-fulfillment"
683
+ },
684
+ transactions: {
685
+ update: "/api/transactions/update"
686
+ },
687
+ returns: {
688
+ create: "/api/returns/create",
689
+ update: "/api/returns/update",
690
+ returnRefund: "/api/returns/return-refund"
691
+ },
692
+ fulfillmentOrders: {
693
+ prepare: "/api/fulfillment-orders/prepare-fulfillment-order"
694
+ },
695
+ fulfillments: {
696
+ bulkImport: "/api/fulfillments/bulk-import"
697
+ },
698
+ carts: {
699
+ mine: "/api/carts/mine",
700
+ merge: "/api/carts/merge",
701
+ addItem: "/api/carts/add-item",
702
+ updateItem: "/api/carts/update-item",
703
+ removeItem: "/api/carts/remove-item",
704
+ applyDiscount: "/api/carts/apply-discount",
705
+ removeDiscount: "/api/carts/remove-discount",
706
+ clear: "/api/carts/clear"
707
+ },
708
+ products: {
709
+ stockCheck: "/api/products/stock-check",
710
+ stockSnapshot: "/api/products/stock",
711
+ listingGroups: "/api/products/listing-groups",
712
+ listingGroupsCatalog: "/api/products/listing-groups/catalog",
713
+ listingGroupsQuery: "/api/products/listing-groups/query",
714
+ listingGroupsQueryCatalog: "/api/products/listing-groups/query/catalog",
715
+ detail: "/api/products/detail",
716
+ detailCatalog: "/api/products/detail/catalog",
717
+ upsert: "/api/products/upsert"
718
+ }
719
+ };
720
+ var COMMERCE_ENDPOINT_PATHS = Object.values(
721
+ COMMERCE_ENDPOINTS
722
+ ).flatMap((group) => Object.values(group));
723
+ var MEMBERSHIP_ENDPOINTS = {
724
+ subscribe: "/api/memberships/subscribe",
725
+ cancel: (id) => `/api/memberships/${id}/cancel`,
726
+ me: "/api/memberships/me"
727
+ };
728
+
671
729
  // src/core/internal/utils/query-string.ts
672
730
  function productDetailQuery(params) {
673
731
  const search = new URLSearchParams();
@@ -676,7 +734,7 @@ function productDetailQuery(params) {
676
734
  } else {
677
735
  search.set("id", params.id);
678
736
  }
679
- return `/api/products/detail?${search}`;
737
+ return `${COMMERCE_ENDPOINTS.products.detail}?${search}`;
680
738
  }
681
739
  function productDetailCatalogQuery(params) {
682
740
  const search = new URLSearchParams();
@@ -685,20 +743,17 @@ function productDetailCatalogQuery(params) {
685
743
  } else {
686
744
  search.set("id", params.id);
687
745
  }
688
- return `/api/products/detail/catalog?${search}`;
746
+ return `${COMMERCE_ENDPOINTS.products.detailCatalog}?${search}`;
689
747
  }
690
748
  function listingGroupsCatalogQuery(params) {
691
- return `/api/products/listing-groups/catalog?ids=${params.productIds.map(encodeURIComponent).join(",")}`;
749
+ return `${COMMERCE_ENDPOINTS.products.listingGroupsCatalog}?ids=${params.productIds.map(encodeURIComponent).join(",")}`;
692
750
  }
693
751
  function appendListingGroupsQuerySearchParams(search, options) {
694
752
  if (options?.page != null) search.set("page", String(options.page));
695
753
  if (options?.limit != null) search.set("limit", String(options.limit));
696
754
  if (options?.sort != null) {
697
755
  const sort = options.sort;
698
- search.set(
699
- "sort",
700
- Array.isArray(sort) ? sort.join(",") : sort
701
- );
756
+ search.set("sort", Array.isArray(sort) ? sort.join(",") : sort);
702
757
  }
703
758
  if (options?.where != null) {
704
759
  search.set("whereJson", JSON.stringify(options.where));
@@ -708,16 +763,16 @@ function listingGroupsQueryUrl(options) {
708
763
  const search = new URLSearchParams();
709
764
  appendListingGroupsQuerySearchParams(search, options);
710
765
  const query = search.toString();
711
- return `/api/products/listing-groups/query${query ? `?${query}` : ""}`;
766
+ return `${COMMERCE_ENDPOINTS.products.listingGroupsQuery}${query ? `?${query}` : ""}`;
712
767
  }
713
768
  function listingGroupsQueryCatalogUrl(options) {
714
769
  const search = new URLSearchParams();
715
770
  appendListingGroupsQuerySearchParams(search, options);
716
771
  const query = search.toString();
717
- return `/api/products/listing-groups/query/catalog${query ? `?${query}` : ""}`;
772
+ return `${COMMERCE_ENDPOINTS.products.listingGroupsQueryCatalog}${query ? `?${query}` : ""}`;
718
773
  }
719
774
  function stockSnapshotQuery(params) {
720
- return `/api/products/stock?variantIds=${params.variantIds.map(encodeURIComponent).join(",")}`;
775
+ return `${COMMERCE_ENDPOINTS.products.stockSnapshot}?variantIds=${params.variantIds.map(encodeURIComponent).join(",")}`;
721
776
  }
722
777
 
723
778
  // src/core/collection/http-client.ts
@@ -1606,48 +1661,6 @@ var CustomerNamespace = class {
1606
1661
  }
1607
1662
  };
1608
1663
 
1609
- // src/core/api/endpoints.ts
1610
- var COMMERCE_ENDPOINTS = {
1611
- orders: {
1612
- create: "/api/orders/create",
1613
- update: "/api/orders/update",
1614
- confirmPayment: "/api/orders/confirm-payment",
1615
- byPayment: "/api/orders/by-payment",
1616
- cancel: "/api/orders/cancel",
1617
- resolveCancelRefund: "/api/orders/resolve-cancel-refund",
1618
- checkout: "/api/orders/checkout",
1619
- createFulfillment: "/api/orders/create-fulfillment",
1620
- updateFulfillment: "/api/orders/update-fulfillment"
1621
- },
1622
- transactions: {
1623
- update: "/api/transactions/update"
1624
- },
1625
- returns: {
1626
- create: "/api/returns/create",
1627
- update: "/api/returns/update",
1628
- returnRefund: "/api/returns/return-refund"
1629
- },
1630
- fulfillmentOrders: {
1631
- prepare: "/api/fulfillment-orders/prepare-fulfillment-order"
1632
- },
1633
- fulfillments: {
1634
- bulkImport: "/api/fulfillments/bulk-import"
1635
- },
1636
- carts: {
1637
- mine: "/api/carts/mine",
1638
- merge: "/api/carts/merge",
1639
- addItem: "/api/carts/add-item",
1640
- updateItem: "/api/carts/update-item",
1641
- removeItem: "/api/carts/remove-item",
1642
- applyDiscount: "/api/carts/apply-discount",
1643
- removeDiscount: "/api/carts/remove-discount",
1644
- clear: "/api/carts/clear"
1645
- }
1646
- };
1647
- var COMMERCE_ENDPOINT_PATHS = Object.values(
1648
- COMMERCE_ENDPOINTS
1649
- ).flatMap((group) => Object.values(group));
1650
-
1651
1664
  // src/core/api/cart-api.ts
1652
1665
  var CartApi = class extends CustomerScopedApi {
1653
1666
  constructor(options) {
@@ -2871,7 +2884,10 @@ var CommerceClient = class {
2871
2884
  onRequestId: options.onRequestId
2872
2885
  });
2873
2886
  this.product = {
2874
- stockCheck: (params) => api.post("/api/products/stock-check", params),
2887
+ stockCheck: (params) => api.post(
2888
+ COMMERCE_ENDPOINTS.products.stockCheck,
2889
+ params
2890
+ ),
2875
2891
  stockSnapshot: (params) => api.get(stockSnapshotQuery(params)),
2876
2892
  listingGroups: (params) => api.get(
2877
2893
  listingGroupsCatalogQuery(params)
@@ -2889,7 +2905,9 @@ var CommerceClient = class {
2889
2905
  },
2890
2906
  detail: async (params) => {
2891
2907
  try {
2892
- const product = await api.get(productDetailQuery(params));
2908
+ const product = await api.get(
2909
+ productDetailQuery(params)
2910
+ );
2893
2911
  return { found: true, product };
2894
2912
  } catch (err) {
2895
2913
  const notFoundResult = productDetailResultFromError(err);
@@ -2937,7 +2955,10 @@ var CommerceClient = class {
2937
2955
  validate: (params) => api.post("/api/discounts/validate", params)
2938
2956
  };
2939
2957
  this.shipping = {
2940
- calculate: (params) => api.post("/api/shipping-policies/calculate", params)
2958
+ calculate: (params) => api.post(
2959
+ "/api/shipping-policies/calculate",
2960
+ params
2961
+ )
2941
2962
  };
2942
2963
  }
2943
2964
  };
@@ -3026,8 +3047,12 @@ function buildGuestCancelRequestBody(token, params) {
3026
3047
  }
3027
3048
  function buildRangeEndpoint(params) {
3028
3049
  const urlParams = new URLSearchParams();
3029
- urlParams.set("start", formatDateParam(params.start));
3030
- urlParams.set("end", formatDateParam(params.end));
3050
+ if (params.start !== void 0) {
3051
+ urlParams.set("start", formatDateParam(params.start));
3052
+ }
3053
+ if (params.end !== void 0) {
3054
+ urlParams.set("end", formatDateParam(params.end));
3055
+ }
3031
3056
  if (params.limit !== void 0) urlParams.set("limit", String(params.limit));
3032
3057
  if (params.page !== void 0) urlParams.set("page", String(params.page));
3033
3058
  appendValues(urlParams, "calendar", params.calendar);
@@ -3050,6 +3075,13 @@ function appendValues(params, key, value) {
3050
3075
  }
3051
3076
 
3052
3077
  // src/core/client/client.ts
3078
+ var BrowserMembershipApi = class extends CustomerScopedApi {
3079
+ me() {
3080
+ return this.request(MEMBERSHIP_ENDPOINTS.me, {
3081
+ method: "GET"
3082
+ });
3083
+ }
3084
+ };
3053
3085
  var Client = class {
3054
3086
  constructor(options) {
3055
3087
  this.lastRequestId = null;
@@ -3114,6 +3146,16 @@ var Client = class {
3114
3146
  onRequestId,
3115
3147
  this.config.apiUrl
3116
3148
  );
3149
+ const membershipApi = new BrowserMembershipApi("MembershipApi", {
3150
+ publishableKey: this.config.publishableKey,
3151
+ apiUrl: this.config.apiUrl,
3152
+ customerToken: () => this.customer.auth.getToken(),
3153
+ onUnauthorized,
3154
+ onRequestId
3155
+ });
3156
+ this.memberships = {
3157
+ me: membershipApi.me.bind(membershipApi)
3158
+ };
3117
3159
  }
3118
3160
  getState() {
3119
3161
  return { ...this.state };