@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.
- package/CHANGELOG.md +38 -0
- package/README.md +10 -4
- package/dist/client.cjs +99 -57
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +9 -6
- package/dist/client.d.ts +9 -6
- package/dist/client.js +99 -57
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-B-qVIBnJ.d.cts → collection-client-U70KizLf.d.cts} +3 -3
- package/dist/{collection-client-BhCMwIus.d.ts → collection-client-gWsA7BVP.d.ts} +3 -3
- package/dist/{const-pmHlwm3E.d.ts → const-BBynifk0.d.cts} +5 -5
- package/dist/{const-BiDujixF.d.cts → const-_WWHU-gX.d.ts} +5 -5
- package/dist/{index-B1UBDaKz.d.ts → index-DPi5NWU8.d.ts} +4 -4
- package/dist/{index-D78ki6Ij.d.cts → index-Dg4Y6Aq7.d.cts} +4 -4
- package/dist/index.cjs +111 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -8
- package/dist/index.d.ts +41 -8
- package/dist/index.js +111 -61
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-C7Ul4ElL.d.cts → payload-types-DLxkB7Mv.d.cts} +399 -27
- package/dist/{payload-types-C7Ul4ElL.d.ts → payload-types-DLxkB7Mv.d.ts} +399 -27
- package/dist/query.cjs +59 -7
- package/dist/query.cjs.map +1 -1
- package/dist/query.d.cts +5 -5
- package/dist/query.d.ts +5 -5
- package/dist/query.js +59 -7
- package/dist/query.js.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/server.cjs +130 -57
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +12 -7
- package/dist/server.d.ts +12 -7
- package/dist/server.js +130 -57
- package/dist/server.js.map +1 -1
- package/dist/{types-ChV1t4ei.d.cts → types-B1ngKbWI.d.cts} +1 -1
- package/dist/{types-BL7M-EUV.d.cts → types-B9lGhZlB.d.ts} +95 -6
- package/dist/{types-Bf2iCjy8.d.ts → types-BiKNBwRA.d.ts} +1 -1
- package/dist/{types-D5dSNIGs.d.ts → types-Bpx5sYKo.d.cts} +95 -6
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/webhook.cjs +3 -1
- package/dist/webhook.cjs.map +1 -1
- package/dist/webhook.d.cts +4 -4
- package/dist/webhook.d.ts +4 -4
- package/dist/webhook.js +3 -1
- package/dist/webhook.js.map +1 -1
- package/package.json +1 -1
package/dist/server.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { S as ServerCollectionClient } from './collection-client-
|
|
2
|
-
export { C as CollectionClient } from './collection-client-
|
|
3
|
-
import {
|
|
4
|
-
export { A as AddItemParams,
|
|
5
|
-
import './payload-types-
|
|
1
|
+
import { S as ServerCollectionClient } from './collection-client-U70KizLf.cjs';
|
|
2
|
+
export { C as CollectionClient } from './collection-client-U70KizLf.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-Bpx5sYKo.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-Bpx5sYKo.cjs';
|
|
5
|
+
import './payload-types-DLxkB7Mv.cjs';
|
|
6
6
|
import './metadata.cjs';
|
|
7
|
-
import './const-
|
|
8
|
-
import './types-
|
|
7
|
+
import './const-BBynifk0.cjs';
|
|
8
|
+
import './types-B1ngKbWI.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-
|
|
2
|
-
export { C as CollectionClient } from './collection-client-
|
|
3
|
-
import {
|
|
4
|
-
export { A as AddItemParams,
|
|
5
|
-
import './payload-types-
|
|
1
|
+
import { S as ServerCollectionClient } from './collection-client-gWsA7BVP.js';
|
|
2
|
+
export { C as CollectionClient } from './collection-client-gWsA7BVP.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-B9lGhZlB.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-B9lGhZlB.js';
|
|
5
|
+
import './payload-types-DLxkB7Mv.js';
|
|
6
6
|
import './metadata.js';
|
|
7
|
-
import './const-
|
|
8
|
-
import './types-
|
|
7
|
+
import './const-_WWHU-gX.js';
|
|
8
|
+
import './types-BiKNBwRA.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
|
|
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
|
|
718
|
+
return `${COMMERCE_ENDPOINTS.products.detailCatalog}?${search}`;
|
|
661
719
|
}
|
|
662
720
|
function listingGroupsQuery(params) {
|
|
663
|
-
return
|
|
721
|
+
return `${COMMERCE_ENDPOINTS.products.listingGroups}?ids=${params.productIds.map(encodeURIComponent).join(",")}`;
|
|
664
722
|
}
|
|
665
723
|
function listingGroupsCatalogQuery(params) {
|
|
666
|
-
return
|
|
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
|
|
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
|
|
747
|
+
return `${COMMERCE_ENDPOINTS.products.listingGroupsQueryCatalog}${query ? `?${query}` : ""}`;
|
|
693
748
|
}
|
|
694
749
|
function stockSnapshotQuery(params) {
|
|
695
|
-
return
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
3382
|
-
|
|
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(
|