@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/dist/server.d.cts CHANGED
@@ -1,11 +1,11 @@
1
- import { S as ServerCollectionClient } from './collection-client-B-qVIBnJ.cjs';
2
- export { C as CollectionClient } from './collection-client-B-qVIBnJ.cjs';
3
- import { N as BaseApi, O as ServerApiOptions, Q as ServerCommerceClient, T as TenantIntrospectionClient, a as CommunityClient, V as BanCustomerParams, X as CommunityBan, Y as UnbanCustomerParams, d as ClientState, Z as ClientServerConfig, E as EventsClient, _ as RootServerClientWithEvents } from './types-BL7M-EUV.cjs';
4
- export { A as AddItemParams, g as ApplyDiscountParams, h as CheckoutParams, i as ClearCartParams, $ as CollectionFieldSchema, a0 as CollectionSchemaResponse, a1 as EventGuestCancelParams, a2 as EventGuestRegistration, a3 as EventGuestRegistrationResponse, a4 as EventRegistrationAnswerInput, a5 as EventRegistrationAttendeeInput, a6 as EventRegistrationPublic, a7 as EventRegistrationRegisterParams, a8 as EventRegistrationRegisterResponse, a9 as EventsCalendarItem, aa as EventsClientOptions, ab as EventsDateParam, ac as EventsExternalSource, ad as EventsLocation, ae as EventsOccurrenceLocation, af as EventsRangeEvent, ag as EventsRangeOccurrence, ah as EventsRangeParams, ai as EventsRangeResponse, aj as EventsTaxonomyItem, ak as ModerationApi, o as PublicCart, p as PublicCartItem, q as PublicCartReference, r as PublicMediaAsset, s as PublicMediaSize, t as PublicOrder, u as PublicOrderItem, v as PublicOrderReference, R as RemoveDiscountParams, w as RemoveItemParams, al as RootServerClient, am as TenantFeatureProgressEvidenceValue, an as TenantFeatureProgressFeature, ao as TenantFeatureProgressGroup, ap as TenantFeatureProgressInput, aq as TenantFeatureProgressItem, ar as TenantFeatureProgressItemState, as as TenantFeatureProgressResponse, at as TenantFeatureProgressSeverity, au as TenantFeatureProgressStatus, av as TenantIntrospectionApi, aw as TenantIntrospectionApiOptions, U as UpdateItemParams } from './types-BL7M-EUV.cjs';
5
- import './payload-types-C7Ul4ElL.cjs';
1
+ import { S as ServerCollectionClient } from './collection-client-Dyl-CDcj.cjs';
2
+ export { C as CollectionClient } from './collection-client-Dyl-CDcj.cjs';
3
+ import { O as BaseApi, Q as ServerApiOptions, T as ServerCommerceClient, V as TenantIntrospectionClient, X as SubscribeMembershipParams, Y as SubscribeMembershipResponse, Z as CancelMembershipParams, _ as CancelMembershipResponse, d as CustomerMembershipView, a as CommunityClient, $ as BanCustomerParams, a0 as CommunityBan, a1 as UnbanCustomerParams, e as ClientState, a2 as ClientServerConfig, E as EventsClient, a3 as RootServerClientWithEvents } from './types-CDND3hzq.cjs';
4
+ export { A as AddItemParams, h as ApplyDiscountParams, i as CheckoutParams, j as ClearCartParams, a4 as CollectionFieldSchema, a5 as CollectionSchemaResponse, a6 as EventGuestCancelParams, a7 as EventGuestRegistration, a8 as EventGuestRegistrationResponse, a9 as EventRegistrationAnswerInput, aa as EventRegistrationAttendeeInput, ab as EventRegistrationPublic, ac as EventRegistrationRegisterParams, ad as EventRegistrationRegisterResponse, ae as EventsCalendarItem, af as EventsClientOptions, ag as EventsDateParam, ah as EventsExternalSource, ai as EventsLocation, aj as EventsOccurrenceLocation, ak as EventsRangeEvent, al as EventsRangeOccurrence, am as EventsRangeParams, an as EventsRangeResponse, ao as EventsTaxonomyItem, ap as ModerationApi, p as PublicCart, q as PublicCartItem, r as PublicCartReference, s as PublicMediaAsset, t as PublicMediaSize, u as PublicOrder, v as PublicOrderItem, w as PublicOrderReference, R as RemoveDiscountParams, x as RemoveItemParams, aq as RootServerClient, ar as TenantFeatureProgressEvidenceValue, as as TenantFeatureProgressFeature, at as TenantFeatureProgressGroup, au as TenantFeatureProgressInput, av as TenantFeatureProgressItem, aw as TenantFeatureProgressItemState, ax as TenantFeatureProgressResponse, ay as TenantFeatureProgressSeverity, az as TenantFeatureProgressStatus, aA as TenantIntrospectionApi, aB as TenantIntrospectionApiOptions, U as UpdateItemParams } from './types-CDND3hzq.cjs';
5
+ import './payload-types-CDsuOEfM.cjs';
6
6
  import './metadata.cjs';
7
- import './const-BiDujixF.cjs';
8
- import './types-ChV1t4ei.cjs';
7
+ import './const-1vleZ6ov.cjs';
8
+ import './types-SoXsbKhj.cjs';
9
9
 
10
10
  type PreviewDetailParams = {
11
11
  collection: string;
@@ -31,6 +31,11 @@ declare class ServerPreviewClient extends BaseApi {
31
31
  declare class ServerClient {
32
32
  commerce: ServerCommerceClient;
33
33
  tenant: TenantIntrospectionClient;
34
+ memberships: {
35
+ subscribe: (params: SubscribeMembershipParams) => Promise<SubscribeMembershipResponse>;
36
+ cancel: (params: CancelMembershipParams) => Promise<CancelMembershipResponse>;
37
+ me: () => Promise<CustomerMembershipView | null>;
38
+ };
34
39
  private _events?;
35
40
  community: CommunityClient & {
36
41
  moderation: {
package/dist/server.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { S as ServerCollectionClient } from './collection-client-BhCMwIus.js';
2
- export { C as CollectionClient } from './collection-client-BhCMwIus.js';
3
- import { N as BaseApi, O as ServerApiOptions, Q as ServerCommerceClient, T as TenantIntrospectionClient, a as CommunityClient, V as BanCustomerParams, X as CommunityBan, Y as UnbanCustomerParams, d as ClientState, Z as ClientServerConfig, E as EventsClient, _ as RootServerClientWithEvents } from './types-D5dSNIGs.js';
4
- export { A as AddItemParams, g as ApplyDiscountParams, h as CheckoutParams, i as ClearCartParams, $ as CollectionFieldSchema, a0 as CollectionSchemaResponse, a1 as EventGuestCancelParams, a2 as EventGuestRegistration, a3 as EventGuestRegistrationResponse, a4 as EventRegistrationAnswerInput, a5 as EventRegistrationAttendeeInput, a6 as EventRegistrationPublic, a7 as EventRegistrationRegisterParams, a8 as EventRegistrationRegisterResponse, a9 as EventsCalendarItem, aa as EventsClientOptions, ab as EventsDateParam, ac as EventsExternalSource, ad as EventsLocation, ae as EventsOccurrenceLocation, af as EventsRangeEvent, ag as EventsRangeOccurrence, ah as EventsRangeParams, ai as EventsRangeResponse, aj as EventsTaxonomyItem, ak as ModerationApi, o as PublicCart, p as PublicCartItem, q as PublicCartReference, r as PublicMediaAsset, s as PublicMediaSize, t as PublicOrder, u as PublicOrderItem, v as PublicOrderReference, R as RemoveDiscountParams, w as RemoveItemParams, al as RootServerClient, am as TenantFeatureProgressEvidenceValue, an as TenantFeatureProgressFeature, ao as TenantFeatureProgressGroup, ap as TenantFeatureProgressInput, aq as TenantFeatureProgressItem, ar as TenantFeatureProgressItemState, as as TenantFeatureProgressResponse, at as TenantFeatureProgressSeverity, au as TenantFeatureProgressStatus, av as TenantIntrospectionApi, aw as TenantIntrospectionApiOptions, U as UpdateItemParams } from './types-D5dSNIGs.js';
5
- import './payload-types-C7Ul4ElL.js';
1
+ import { S as ServerCollectionClient } from './collection-client-DWooaiTr.js';
2
+ export { C as CollectionClient } from './collection-client-DWooaiTr.js';
3
+ import { O as BaseApi, Q as ServerApiOptions, T as ServerCommerceClient, V as TenantIntrospectionClient, X as SubscribeMembershipParams, Y as SubscribeMembershipResponse, Z as CancelMembershipParams, _ as CancelMembershipResponse, d as CustomerMembershipView, a as CommunityClient, $ as BanCustomerParams, a0 as CommunityBan, a1 as UnbanCustomerParams, e as ClientState, a2 as ClientServerConfig, E as EventsClient, a3 as RootServerClientWithEvents } from './types-Dt9FJisi.js';
4
+ export { A as AddItemParams, h as ApplyDiscountParams, i as CheckoutParams, j as ClearCartParams, a4 as CollectionFieldSchema, a5 as CollectionSchemaResponse, a6 as EventGuestCancelParams, a7 as EventGuestRegistration, a8 as EventGuestRegistrationResponse, a9 as EventRegistrationAnswerInput, aa as EventRegistrationAttendeeInput, ab as EventRegistrationPublic, ac as EventRegistrationRegisterParams, ad as EventRegistrationRegisterResponse, ae as EventsCalendarItem, af as EventsClientOptions, ag as EventsDateParam, ah as EventsExternalSource, ai as EventsLocation, aj as EventsOccurrenceLocation, ak as EventsRangeEvent, al as EventsRangeOccurrence, am as EventsRangeParams, an as EventsRangeResponse, ao as EventsTaxonomyItem, ap as ModerationApi, p as PublicCart, q as PublicCartItem, r as PublicCartReference, s as PublicMediaAsset, t as PublicMediaSize, u as PublicOrder, v as PublicOrderItem, w as PublicOrderReference, R as RemoveDiscountParams, x as RemoveItemParams, aq as RootServerClient, ar as TenantFeatureProgressEvidenceValue, as as TenantFeatureProgressFeature, at as TenantFeatureProgressGroup, au as TenantFeatureProgressInput, av as TenantFeatureProgressItem, aw as TenantFeatureProgressItemState, ax as TenantFeatureProgressResponse, ay as TenantFeatureProgressSeverity, az as TenantFeatureProgressStatus, aA as TenantIntrospectionApi, aB as TenantIntrospectionApiOptions, U as UpdateItemParams } from './types-Dt9FJisi.js';
5
+ import './payload-types-CDsuOEfM.js';
6
6
  import './metadata.js';
7
- import './const-pmHlwm3E.js';
8
- import './types-Bf2iCjy8.js';
7
+ import './const-pGDnsy0o.js';
8
+ import './types-oiae_LMm.js';
9
9
 
10
10
  type PreviewDetailParams = {
11
11
  collection: string;
@@ -31,6 +31,11 @@ declare class ServerPreviewClient extends BaseApi {
31
31
  declare class ServerClient {
32
32
  commerce: ServerCommerceClient;
33
33
  tenant: TenantIntrospectionClient;
34
+ memberships: {
35
+ subscribe: (params: SubscribeMembershipParams) => Promise<SubscribeMembershipResponse>;
36
+ cancel: (params: CancelMembershipParams) => Promise<CancelMembershipResponse>;
37
+ me: () => Promise<CustomerMembershipView | null>;
38
+ };
34
39
  private _events?;
35
40
  community: CommunityClient & {
36
41
  moderation: {
package/dist/server.js CHANGED
@@ -640,6 +640,64 @@ async function httpFetch(url, options) {
640
640
  throw lastError ?? new NetworkError("Request failed after retries");
641
641
  }
642
642
 
643
+ // src/core/api/endpoints.ts
644
+ var COMMERCE_ENDPOINTS = {
645
+ orders: {
646
+ create: "/api/orders/create",
647
+ update: "/api/orders/update",
648
+ confirmPayment: "/api/orders/confirm-payment",
649
+ byPayment: "/api/orders/by-payment",
650
+ cancel: "/api/orders/cancel",
651
+ resolveCancelRefund: "/api/orders/resolve-cancel-refund",
652
+ checkout: "/api/orders/checkout",
653
+ createFulfillment: "/api/orders/create-fulfillment",
654
+ updateFulfillment: "/api/orders/update-fulfillment"
655
+ },
656
+ transactions: {
657
+ update: "/api/transactions/update"
658
+ },
659
+ returns: {
660
+ create: "/api/returns/create",
661
+ update: "/api/returns/update",
662
+ returnRefund: "/api/returns/return-refund"
663
+ },
664
+ fulfillmentOrders: {
665
+ prepare: "/api/fulfillment-orders/prepare-fulfillment-order"
666
+ },
667
+ fulfillments: {
668
+ bulkImport: "/api/fulfillments/bulk-import"
669
+ },
670
+ carts: {
671
+ mine: "/api/carts/mine",
672
+ merge: "/api/carts/merge",
673
+ addItem: "/api/carts/add-item",
674
+ updateItem: "/api/carts/update-item",
675
+ removeItem: "/api/carts/remove-item",
676
+ applyDiscount: "/api/carts/apply-discount",
677
+ removeDiscount: "/api/carts/remove-discount",
678
+ clear: "/api/carts/clear"
679
+ },
680
+ products: {
681
+ stockCheck: "/api/products/stock-check",
682
+ stockSnapshot: "/api/products/stock",
683
+ listingGroups: "/api/products/listing-groups",
684
+ listingGroupsCatalog: "/api/products/listing-groups/catalog",
685
+ listingGroupsQuery: "/api/products/listing-groups/query",
686
+ listingGroupsQueryCatalog: "/api/products/listing-groups/query/catalog",
687
+ detail: "/api/products/detail",
688
+ detailCatalog: "/api/products/detail/catalog",
689
+ upsert: "/api/products/upsert"
690
+ }
691
+ };
692
+ var COMMERCE_ENDPOINT_PATHS = Object.values(
693
+ COMMERCE_ENDPOINTS
694
+ ).flatMap((group) => Object.values(group));
695
+ var MEMBERSHIP_ENDPOINTS = {
696
+ subscribe: "/api/memberships/subscribe",
697
+ cancel: (id) => `/api/memberships/${id}/cancel`,
698
+ me: "/api/memberships/me"
699
+ };
700
+
643
701
  // src/core/internal/utils/query-string.ts
644
702
  function productDetailQuery(params) {
645
703
  const search = new URLSearchParams();
@@ -648,7 +706,7 @@ function productDetailQuery(params) {
648
706
  } else {
649
707
  search.set("id", params.id);
650
708
  }
651
- return `/api/products/detail?${search}`;
709
+ return `${COMMERCE_ENDPOINTS.products.detail}?${search}`;
652
710
  }
653
711
  function productDetailCatalogQuery(params) {
654
712
  const search = new URLSearchParams();
@@ -657,23 +715,20 @@ function productDetailCatalogQuery(params) {
657
715
  } else {
658
716
  search.set("id", params.id);
659
717
  }
660
- return `/api/products/detail/catalog?${search}`;
718
+ return `${COMMERCE_ENDPOINTS.products.detailCatalog}?${search}`;
661
719
  }
662
720
  function listingGroupsQuery(params) {
663
- return `/api/products/listing-groups?ids=${params.productIds.map(encodeURIComponent).join(",")}`;
721
+ return `${COMMERCE_ENDPOINTS.products.listingGroups}?ids=${params.productIds.map(encodeURIComponent).join(",")}`;
664
722
  }
665
723
  function listingGroupsCatalogQuery(params) {
666
- return `/api/products/listing-groups/catalog?ids=${params.productIds.map(encodeURIComponent).join(",")}`;
724
+ return `${COMMERCE_ENDPOINTS.products.listingGroupsCatalog}?ids=${params.productIds.map(encodeURIComponent).join(",")}`;
667
725
  }
668
726
  function appendListingGroupsQuerySearchParams(search, options) {
669
727
  if (options?.page != null) search.set("page", String(options.page));
670
728
  if (options?.limit != null) search.set("limit", String(options.limit));
671
729
  if (options?.sort != null) {
672
730
  const sort = options.sort;
673
- search.set(
674
- "sort",
675
- Array.isArray(sort) ? sort.join(",") : sort
676
- );
731
+ search.set("sort", Array.isArray(sort) ? sort.join(",") : sort);
677
732
  }
678
733
  if (options?.where != null) {
679
734
  search.set("whereJson", JSON.stringify(options.where));
@@ -683,16 +738,16 @@ function listingGroupsQueryUrl(options) {
683
738
  const search = new URLSearchParams();
684
739
  appendListingGroupsQuerySearchParams(search, options);
685
740
  const query = search.toString();
686
- return `/api/products/listing-groups/query${query ? `?${query}` : ""}`;
741
+ return `${COMMERCE_ENDPOINTS.products.listingGroupsQuery}${query ? `?${query}` : ""}`;
687
742
  }
688
743
  function listingGroupsQueryCatalogUrl(options) {
689
744
  const search = new URLSearchParams();
690
745
  appendListingGroupsQuerySearchParams(search, options);
691
746
  const query = search.toString();
692
- return `/api/products/listing-groups/query/catalog${query ? `?${query}` : ""}`;
747
+ return `${COMMERCE_ENDPOINTS.products.listingGroupsQueryCatalog}${query ? `?${query}` : ""}`;
693
748
  }
694
749
  function stockSnapshotQuery(params) {
695
- return `/api/products/stock?variantIds=${params.variantIds.map(encodeURIComponent).join(",")}`;
750
+ return `${COMMERCE_ENDPOINTS.products.stockSnapshot}?variantIds=${params.variantIds.map(encodeURIComponent).join(",")}`;
696
751
  }
697
752
 
698
753
  // src/core/collection/http-client.ts
@@ -1638,48 +1693,6 @@ var ModerationApi = class extends BaseApi {
1638
1693
  }
1639
1694
  };
1640
1695
 
1641
- // src/core/api/endpoints.ts
1642
- var COMMERCE_ENDPOINTS = {
1643
- orders: {
1644
- create: "/api/orders/create",
1645
- update: "/api/orders/update",
1646
- confirmPayment: "/api/orders/confirm-payment",
1647
- byPayment: "/api/orders/by-payment",
1648
- cancel: "/api/orders/cancel",
1649
- resolveCancelRefund: "/api/orders/resolve-cancel-refund",
1650
- checkout: "/api/orders/checkout",
1651
- createFulfillment: "/api/orders/create-fulfillment",
1652
- updateFulfillment: "/api/orders/update-fulfillment"
1653
- },
1654
- transactions: {
1655
- update: "/api/transactions/update"
1656
- },
1657
- returns: {
1658
- create: "/api/returns/create",
1659
- update: "/api/returns/update",
1660
- returnRefund: "/api/returns/return-refund"
1661
- },
1662
- fulfillmentOrders: {
1663
- prepare: "/api/fulfillment-orders/prepare-fulfillment-order"
1664
- },
1665
- fulfillments: {
1666
- bulkImport: "/api/fulfillments/bulk-import"
1667
- },
1668
- carts: {
1669
- mine: "/api/carts/mine",
1670
- merge: "/api/carts/merge",
1671
- addItem: "/api/carts/add-item",
1672
- updateItem: "/api/carts/update-item",
1673
- removeItem: "/api/carts/remove-item",
1674
- applyDiscount: "/api/carts/apply-discount",
1675
- removeDiscount: "/api/carts/remove-discount",
1676
- clear: "/api/carts/clear"
1677
- }
1678
- };
1679
- var COMMERCE_ENDPOINT_PATHS = Object.values(
1680
- COMMERCE_ENDPOINTS
1681
- ).flatMap((group) => Object.values(group));
1682
-
1683
1696
  // src/core/api/cart-api.ts
1684
1697
  var CartApi = class extends CustomerScopedApi {
1685
1698
  constructor(options) {
@@ -2904,7 +2917,10 @@ var ProductApi = class extends BaseApi {
2904
2917
  * to remain available by the time an order is placed.
2905
2918
  */
2906
2919
  stockCheck(params) {
2907
- return this.request("/api/products/stock-check", params);
2920
+ return this.request(
2921
+ COMMERCE_ENDPOINTS.products.stockCheck,
2922
+ params
2923
+ );
2908
2924
  }
2909
2925
  stockSnapshot(params) {
2910
2926
  return this.request(
@@ -2981,7 +2997,7 @@ var ProductApi = class extends BaseApi {
2981
2997
  */
2982
2998
  upsert(params) {
2983
2999
  return this.request(
2984
- "/api/products/upsert",
3000
+ COMMERCE_ENDPOINTS.products.upsert,
2985
3001
  normalizeProductUpsertParams(params)
2986
3002
  );
2987
3003
  }
@@ -3378,8 +3394,12 @@ function buildGuestCancelRequestBody(token, params) {
3378
3394
  }
3379
3395
  function buildRangeEndpoint(params) {
3380
3396
  const urlParams = new URLSearchParams();
3381
- urlParams.set("start", formatDateParam(params.start));
3382
- urlParams.set("end", formatDateParam(params.end));
3397
+ if (params.start !== void 0) {
3398
+ urlParams.set("start", formatDateParam(params.start));
3399
+ }
3400
+ if (params.end !== void 0) {
3401
+ urlParams.set("end", formatDateParam(params.end));
3402
+ }
3383
3403
  if (params.limit !== void 0) urlParams.set("limit", String(params.limit));
3384
3404
  if (params.page !== void 0) urlParams.set("page", String(params.page));
3385
3405
  appendValues(urlParams, "calendar", params.calendar);
@@ -3424,6 +3444,53 @@ var TenantIntrospectionApi = class extends BaseApi {
3424
3444
  }
3425
3445
  };
3426
3446
 
3447
+ // src/core/api/membership-api.ts
3448
+ var MembershipApi = class extends BaseApi {
3449
+ constructor(options) {
3450
+ super("MembershipApi", options);
3451
+ }
3452
+ /**
3453
+ * Record a delegated first-charge and activate a membership.
3454
+ * The storefront collected the payment; this endpoint deduplicates by
3455
+ * `subscribeIntentKey` and records the already-paid charge.
3456
+ *
3457
+ * `subscribeIntentKey` is used as the HTTP idempotency key so the call is
3458
+ * safely retryable.
3459
+ */
3460
+ subscribe(params) {
3461
+ const { subscribeIntentKey, ...body } = params;
3462
+ return this.request(
3463
+ MEMBERSHIP_ENDPOINTS.subscribe,
3464
+ body,
3465
+ idempotencyRequestOptions(subscribeIntentKey)
3466
+ );
3467
+ }
3468
+ /**
3469
+ * Cancel a membership by id.
3470
+ * `immediate=false` (default) sets `cancelAtPeriodEnd`; the customer retains
3471
+ * benefits until `currentPeriodEnd`. `immediate=true` cancels now and revokes
3472
+ * membership groups immediately.
3473
+ */
3474
+ cancel(params) {
3475
+ const { id, immediate } = params;
3476
+ return this.request(
3477
+ MEMBERSHIP_ENDPOINTS.cancel(id),
3478
+ immediate !== void 0 ? { immediate } : {}
3479
+ );
3480
+ }
3481
+ /**
3482
+ * Retrieve the authenticated customer's own membership view.
3483
+ * Never returns payment tokens or internal keys.
3484
+ */
3485
+ me() {
3486
+ return this.request(
3487
+ MEMBERSHIP_ENDPOINTS.me,
3488
+ void 0,
3489
+ { method: "GET" }
3490
+ );
3491
+ }
3492
+ };
3493
+
3427
3494
  // src/core/client/client.server.ts
3428
3495
  var ServerClient = class {
3429
3496
  constructor(options) {
@@ -3457,6 +3524,12 @@ var ServerClient = class {
3457
3524
  onRequestId
3458
3525
  };
3459
3526
  this.commerce = new ServerCommerceClient(serverOptions);
3527
+ const membershipApi = new MembershipApi(serverOptions);
3528
+ this.memberships = {
3529
+ subscribe: membershipApi.subscribe.bind(membershipApi),
3530
+ cancel: membershipApi.cancel.bind(membershipApi),
3531
+ me: membershipApi.me.bind(membershipApi)
3532
+ };
3460
3533
  const tenantIntrospectionApi = new TenantIntrospectionApi(serverOptions);
3461
3534
  this.tenant = {
3462
3535
  collectionSchema: tenantIntrospectionApi.collectionSchema.bind(