@01.software/sdk 0.56.1 → 0.65.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +192 -0
- package/README.md +174 -91
- package/dist/client.cjs +136 -7
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/client.js +136 -7
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-DxuBDso_.d.cts → collection-client-B7rsTtVj.d.cts} +6 -6
- package/dist/{collection-client-Bmr53saa.d.ts → collection-client-C2sMvfme.d.ts} +6 -6
- package/dist/{const-Cv1DCsp6.d.cts → const-CRxPTDGt.d.ts} +2 -2
- package/dist/{const-BKUqg96Q.d.ts → const-D6ZRQLxI.d.cts} +2 -2
- package/dist/{index-DFHLLqYu.d.ts → index-1auUEYrl.d.ts} +3 -3
- package/dist/{index-CGsT4AQ8.d.cts → index-Bbpf5t-l.d.cts} +3 -3
- package/dist/index.cjs +139 -205
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -9
- package/dist/index.d.ts +15 -9
- package/dist/index.js +139 -205
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-Bk-duc5k.d.cts → payload-types-BnIET0xU.d.cts} +262 -328
- package/dist/{payload-types-Bk-duc5k.d.ts → payload-types-BnIET0xU.d.ts} +262 -328
- package/dist/query.cjs +48 -2
- 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 +48 -2
- 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 +459 -7
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +13 -8
- package/dist/server.d.ts +13 -8
- package/dist/server.js +459 -7
- package/dist/server.js.map +1 -1
- package/dist/{types-D4mjGFj4.d.ts → types-D1y4TgQm.d.ts} +2 -2
- package/dist/{types-CEK8uTvU.d.ts → types-DnRC3nLG.d.ts} +256 -9
- package/dist/{types-CNdpj2fI.d.cts → types-Dp1oYpD3.d.cts} +2 -2
- package/dist/{types-Dhk5NX7Z.d.cts → types-Dzn0LD2N.d.cts} +256 -9
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.cjs +4 -2
- package/dist/ui/video.cjs.map +1 -1
- package/dist/ui/video.d.cts +4 -2
- package/dist/ui/video.d.ts +4 -2
- package/dist/ui/video.js +4 -2
- package/dist/ui/video.js.map +1 -1
- package/dist/webhook.d.cts +5 -5
- package/dist/webhook.d.ts +5 -5
- package/package.json +8 -28
- package/dist/analytics/react.cjs +0 -344
- package/dist/analytics/react.cjs.map +0 -1
- package/dist/analytics/react.d.cts +0 -24
- package/dist/analytics/react.d.ts +0 -24
- package/dist/analytics/react.js +0 -319
- package/dist/analytics/react.js.map +0 -1
- package/dist/analytics.cjs +0 -238
- package/dist/analytics.cjs.map +0 -1
- package/dist/analytics.d.cts +0 -39
- package/dist/analytics.d.ts +0 -39
- package/dist/analytics.js +0 -215
- package/dist/analytics.js.map +0 -1
package/dist/client.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { R as ReadOnlyCollectionClient } from './collection-client-
|
|
2
|
-
import { C as CommerceClient, a as CommunityClient, b as ContentClient, E as EventsClient, c as CustomerNamespace, M as MarketDiscovery, d as CustomerMembershipView, e as CancelMembershipParams, f as CancelMembershipResponse, g as ClientState, h as ClientConfig } from './types-
|
|
3
|
-
export { A as AddItemParams, i as ApiQueryOptions, j as CancelBrowserPaymentSessionParams, k as CartMergeParams, l as CartMergeResult, m as CartMineResult, n as CartMutationResult, o as CheckoutAbandonedReason, p as CheckoutAmounts, q as CheckoutOrderReference, r as CheckoutPaymentSessionRef, s as CheckoutShippingAddress, t as ClearCartParams, u as ClientMetadata, v as ContentClientOptions, w as CreateCartParams, x as CreateCartResult, y as CreateCheckoutParams, z as CreateCheckoutResult, B as CreatePaymentSessionParams, D as CreatePortOnePaymentSessionParams, F as CustomerSnapshot, G as DebugConfig, H as DeepPartial, I as ExtractArrayType, J as MembershipStatus, K as Money, O as OpenCheckoutPaymentState, P as PayloadFindResponse, L as PayloadMutationResponse, N as PaymentFailureReason, Q as PaymentNextAction, R as PaymentProviderStatus, S as PaymentReconciliationReason, T as PaymentSessionRole, U as PortOneHostedPaymentMethod, V as PortOnePaymentNextAction, W as PortOnePublicPaymentSession, X as ProductUpsertInput, Y as ProductUpsertParams, Z as ProductUpsertResponse, _ as ProductUpsertVariantInput, $ as PublicAttribute, a0 as PublicCaptureEvidence, a1 as PublicCart, a2 as PublicCartItem, a3 as PublicCartItemAdmission, a4 as PublicCartMarket, a5 as PublicCartReference, a6 as PublicCheckout, a7 as PublicCheckoutItem, a8 as PublicMediaAsset, a9 as PublicMediaSize, aa as PublicOrder, ab as PublicOrderAmounts, ac as PublicOrderItem, ad as PublicOrderReference, ae as PublicPaymentSession, af as ReconciliationRequired, ag as RemoveItemParams, ah as RetrieveBrowserPaymentSessionParams, ai as RetrieveCartParams, aj as RetrieveCheckoutParams, ak as RetryConfig, al as RootClient, al as RootClientType, am as RootCollectionClient, an as RootReadOnlyQueryBuilder, ao as ShippingLine, ap as Sort, aq as SpentCheckoutPaymentState, ar as StorefrontContentListOptions, as as StorefrontContentReference, at as StorefrontGalleryItem, au as StorefrontGalleryItemsListOptions, av as StorefrontGalleryItemsSort, aw as StorefrontLink, ax as StorefrontLinksListOptions, ay as StorefrontLinksSort, az as UpdateCartAttributesParams, aA as UpdateDiscountCodesParams, aB as UpdateItemParams, aC as VariantInput, aD as Where } from './types-
|
|
1
|
+
import { R as ReadOnlyCollectionClient } from './collection-client-B7rsTtVj.cjs';
|
|
2
|
+
import { C as CommerceClient, a as CommunityClient, b as ContentClient, E as EventsClient, c as CustomerNamespace, M as MarketDiscovery, d as CustomerMembershipView, e as CancelMembershipParams, f as CancelMembershipResponse, g as ClientState, h as ClientConfig } from './types-Dzn0LD2N.cjs';
|
|
3
|
+
export { A as AddItemParams, i as ApiQueryOptions, j as CancelBrowserPaymentSessionParams, k as CartMergeParams, l as CartMergeResult, m as CartMineResult, n as CartMutationResult, o as CheckoutAbandonedReason, p as CheckoutAmounts, q as CheckoutOrderReference, r as CheckoutPaymentSessionRef, s as CheckoutShippingAddress, t as ClearCartParams, u as ClientMetadata, v as ContentClientOptions, w as CreateCartParams, x as CreateCartResult, y as CreateCheckoutParams, z as CreateCheckoutResult, B as CreatePaymentSessionParams, D as CreatePortOnePaymentSessionParams, F as CustomerSnapshot, G as DebugConfig, H as DeepPartial, I as ExtractArrayType, J as MembershipStatus, K as Money, O as OpenCheckoutPaymentState, P as PayloadFindResponse, L as PayloadMutationResponse, N as PaymentFailureReason, Q as PaymentNextAction, R as PaymentProviderStatus, S as PaymentReconciliationReason, T as PaymentSessionRole, U as PortOneHostedPaymentMethod, V as PortOnePaymentNextAction, W as PortOnePublicPaymentSession, X as ProductUpsertInput, Y as ProductUpsertParams, Z as ProductUpsertResponse, _ as ProductUpsertVariantInput, $ as PublicAttribute, a0 as PublicCaptureEvidence, a1 as PublicCart, a2 as PublicCartItem, a3 as PublicCartItemAdmission, a4 as PublicCartMarket, a5 as PublicCartReference, a6 as PublicCheckout, a7 as PublicCheckoutItem, a8 as PublicMediaAsset, a9 as PublicMediaSize, aa as PublicOrder, ab as PublicOrderAmounts, ac as PublicOrderItem, ad as PublicOrderReference, ae as PublicPaymentSession, af as ReconciliationRequired, ag as RemoveItemParams, ah as RetrieveBrowserPaymentSessionParams, ai as RetrieveCartParams, aj as RetrieveCheckoutParams, ak as RetryConfig, al as RootClient, al as RootClientType, am as RootCollectionClient, an as RootReadOnlyQueryBuilder, ao as ShippingLine, ap as Sort, aq as SpentCheckoutPaymentState, ar as StorefrontContentListOptions, as as StorefrontContentReference, at as StorefrontGalleryItem, au as StorefrontGalleryItemsListOptions, av as StorefrontGalleryItemsSort, aw as StorefrontLink, ax as StorefrontLinksListOptions, ay as StorefrontLinksSort, az as UpdateCartAttributesParams, aA as UpdateDiscountCodesParams, aB as UpdateItemParams, aC as VariantInput, aD as Where } from './types-Dzn0LD2N.cjs';
|
|
4
4
|
export { isApiError, isAuthError, isCommerceSDKError, isConfigError, isConflictError, isGoneError, isNetworkError, isNotFoundError, isPermissionError, isRateLimitError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError } from './errors.cjs';
|
|
5
|
-
export { C as Collection, P as PublicCollection } from './const-
|
|
6
|
-
import './payload-types-
|
|
5
|
+
export { C as Collection, P as PublicCollection } from './const-D6ZRQLxI.cjs';
|
|
6
|
+
import './payload-types-BnIET0xU.cjs';
|
|
7
7
|
import './metadata.cjs';
|
|
8
|
-
import './types-
|
|
8
|
+
import './types-Dp1oYpD3.cjs';
|
|
9
9
|
|
|
10
10
|
declare class Client {
|
|
11
11
|
commerce: CommerceClient;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { R as ReadOnlyCollectionClient } from './collection-client-
|
|
2
|
-
import { C as CommerceClient, a as CommunityClient, b as ContentClient, E as EventsClient, c as CustomerNamespace, M as MarketDiscovery, d as CustomerMembershipView, e as CancelMembershipParams, f as CancelMembershipResponse, g as ClientState, h as ClientConfig } from './types-
|
|
3
|
-
export { A as AddItemParams, i as ApiQueryOptions, j as CancelBrowserPaymentSessionParams, k as CartMergeParams, l as CartMergeResult, m as CartMineResult, n as CartMutationResult, o as CheckoutAbandonedReason, p as CheckoutAmounts, q as CheckoutOrderReference, r as CheckoutPaymentSessionRef, s as CheckoutShippingAddress, t as ClearCartParams, u as ClientMetadata, v as ContentClientOptions, w as CreateCartParams, x as CreateCartResult, y as CreateCheckoutParams, z as CreateCheckoutResult, B as CreatePaymentSessionParams, D as CreatePortOnePaymentSessionParams, F as CustomerSnapshot, G as DebugConfig, H as DeepPartial, I as ExtractArrayType, J as MembershipStatus, K as Money, O as OpenCheckoutPaymentState, P as PayloadFindResponse, L as PayloadMutationResponse, N as PaymentFailureReason, Q as PaymentNextAction, R as PaymentProviderStatus, S as PaymentReconciliationReason, T as PaymentSessionRole, U as PortOneHostedPaymentMethod, V as PortOnePaymentNextAction, W as PortOnePublicPaymentSession, X as ProductUpsertInput, Y as ProductUpsertParams, Z as ProductUpsertResponse, _ as ProductUpsertVariantInput, $ as PublicAttribute, a0 as PublicCaptureEvidence, a1 as PublicCart, a2 as PublicCartItem, a3 as PublicCartItemAdmission, a4 as PublicCartMarket, a5 as PublicCartReference, a6 as PublicCheckout, a7 as PublicCheckoutItem, a8 as PublicMediaAsset, a9 as PublicMediaSize, aa as PublicOrder, ab as PublicOrderAmounts, ac as PublicOrderItem, ad as PublicOrderReference, ae as PublicPaymentSession, af as ReconciliationRequired, ag as RemoveItemParams, ah as RetrieveBrowserPaymentSessionParams, ai as RetrieveCartParams, aj as RetrieveCheckoutParams, ak as RetryConfig, al as RootClient, al as RootClientType, am as RootCollectionClient, an as RootReadOnlyQueryBuilder, ao as ShippingLine, ap as Sort, aq as SpentCheckoutPaymentState, ar as StorefrontContentListOptions, as as StorefrontContentReference, at as StorefrontGalleryItem, au as StorefrontGalleryItemsListOptions, av as StorefrontGalleryItemsSort, aw as StorefrontLink, ax as StorefrontLinksListOptions, ay as StorefrontLinksSort, az as UpdateCartAttributesParams, aA as UpdateDiscountCodesParams, aB as UpdateItemParams, aC as VariantInput, aD as Where } from './types-
|
|
1
|
+
import { R as ReadOnlyCollectionClient } from './collection-client-C2sMvfme.js';
|
|
2
|
+
import { C as CommerceClient, a as CommunityClient, b as ContentClient, E as EventsClient, c as CustomerNamespace, M as MarketDiscovery, d as CustomerMembershipView, e as CancelMembershipParams, f as CancelMembershipResponse, g as ClientState, h as ClientConfig } from './types-DnRC3nLG.js';
|
|
3
|
+
export { A as AddItemParams, i as ApiQueryOptions, j as CancelBrowserPaymentSessionParams, k as CartMergeParams, l as CartMergeResult, m as CartMineResult, n as CartMutationResult, o as CheckoutAbandonedReason, p as CheckoutAmounts, q as CheckoutOrderReference, r as CheckoutPaymentSessionRef, s as CheckoutShippingAddress, t as ClearCartParams, u as ClientMetadata, v as ContentClientOptions, w as CreateCartParams, x as CreateCartResult, y as CreateCheckoutParams, z as CreateCheckoutResult, B as CreatePaymentSessionParams, D as CreatePortOnePaymentSessionParams, F as CustomerSnapshot, G as DebugConfig, H as DeepPartial, I as ExtractArrayType, J as MembershipStatus, K as Money, O as OpenCheckoutPaymentState, P as PayloadFindResponse, L as PayloadMutationResponse, N as PaymentFailureReason, Q as PaymentNextAction, R as PaymentProviderStatus, S as PaymentReconciliationReason, T as PaymentSessionRole, U as PortOneHostedPaymentMethod, V as PortOnePaymentNextAction, W as PortOnePublicPaymentSession, X as ProductUpsertInput, Y as ProductUpsertParams, Z as ProductUpsertResponse, _ as ProductUpsertVariantInput, $ as PublicAttribute, a0 as PublicCaptureEvidence, a1 as PublicCart, a2 as PublicCartItem, a3 as PublicCartItemAdmission, a4 as PublicCartMarket, a5 as PublicCartReference, a6 as PublicCheckout, a7 as PublicCheckoutItem, a8 as PublicMediaAsset, a9 as PublicMediaSize, aa as PublicOrder, ab as PublicOrderAmounts, ac as PublicOrderItem, ad as PublicOrderReference, ae as PublicPaymentSession, af as ReconciliationRequired, ag as RemoveItemParams, ah as RetrieveBrowserPaymentSessionParams, ai as RetrieveCartParams, aj as RetrieveCheckoutParams, ak as RetryConfig, al as RootClient, al as RootClientType, am as RootCollectionClient, an as RootReadOnlyQueryBuilder, ao as ShippingLine, ap as Sort, aq as SpentCheckoutPaymentState, ar as StorefrontContentListOptions, as as StorefrontContentReference, at as StorefrontGalleryItem, au as StorefrontGalleryItemsListOptions, av as StorefrontGalleryItemsSort, aw as StorefrontLink, ax as StorefrontLinksListOptions, ay as StorefrontLinksSort, az as UpdateCartAttributesParams, aA as UpdateDiscountCodesParams, aB as UpdateItemParams, aC as VariantInput, aD as Where } from './types-DnRC3nLG.js';
|
|
4
4
|
export { isApiError, isAuthError, isCommerceSDKError, isConfigError, isConflictError, isGoneError, isNetworkError, isNotFoundError, isPermissionError, isRateLimitError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError } from './errors.js';
|
|
5
|
-
export { C as Collection, P as PublicCollection } from './const-
|
|
6
|
-
import './payload-types-
|
|
5
|
+
export { C as Collection, P as PublicCollection } from './const-CRxPTDGt.js';
|
|
6
|
+
import './payload-types-BnIET0xU.js';
|
|
7
7
|
import './metadata.js';
|
|
8
|
-
import './types-
|
|
8
|
+
import './types-D1y4TgQm.js';
|
|
9
9
|
|
|
10
10
|
declare class Client {
|
|
11
11
|
commerce: CommerceClient;
|
package/dist/client.js
CHANGED
|
@@ -1005,6 +1005,49 @@ function stockSnapshotSearchParams(params) {
|
|
|
1005
1005
|
}
|
|
1006
1006
|
|
|
1007
1007
|
// src/core/collection/http-client.ts
|
|
1008
|
+
function validateWhere(where) {
|
|
1009
|
+
if (where === void 0) return false;
|
|
1010
|
+
let hasNull = false;
|
|
1011
|
+
function visit(value, depth, key) {
|
|
1012
|
+
if (depth > 10) {
|
|
1013
|
+
throw createValidationError(
|
|
1014
|
+
"Collection where must not exceed nesting depth 10."
|
|
1015
|
+
);
|
|
1016
|
+
}
|
|
1017
|
+
if (value === null && (key === "equals" || key === "not_equals")) {
|
|
1018
|
+
hasNull = true;
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
if (value == null) {
|
|
1022
|
+
throw createValidationError(
|
|
1023
|
+
"Collection where must not contain null or undefined values."
|
|
1024
|
+
);
|
|
1025
|
+
}
|
|
1026
|
+
if (Array.isArray(value)) {
|
|
1027
|
+
if (value.length === 0) {
|
|
1028
|
+
throw createValidationError(
|
|
1029
|
+
"Collection where must not contain empty arrays, including and/or."
|
|
1030
|
+
);
|
|
1031
|
+
}
|
|
1032
|
+
if (value.length > 1e3) {
|
|
1033
|
+
throw createValidationError(
|
|
1034
|
+
"Collection where arrays must not contain more than 1000 elements."
|
|
1035
|
+
);
|
|
1036
|
+
}
|
|
1037
|
+
for (const item of value) visit(item, depth + 1);
|
|
1038
|
+
} else if (typeof value === "object" && !(value instanceof Date)) {
|
|
1039
|
+
const values = Object.entries(value);
|
|
1040
|
+
if (values.length === 0) {
|
|
1041
|
+
throw createValidationError(
|
|
1042
|
+
"Collection where must not contain empty condition objects."
|
|
1043
|
+
);
|
|
1044
|
+
}
|
|
1045
|
+
for (const [key2, item] of values) visit(item, depth + 1, key2);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
visit(where, 0);
|
|
1049
|
+
return hasNull;
|
|
1050
|
+
}
|
|
1008
1051
|
var HttpClient = class {
|
|
1009
1052
|
constructor(publishableKey, secretKey, getCustomerToken, onUnauthorized, onRequestId, apiUrl) {
|
|
1010
1053
|
this.publishableKey = requirePublishableKeyForSecret(
|
|
@@ -1051,7 +1094,8 @@ var HttpClient = class {
|
|
|
1051
1094
|
...rest,
|
|
1052
1095
|
"fallback-locale": fallbackLocale === false ? "none" : fallbackLocale
|
|
1053
1096
|
};
|
|
1054
|
-
const
|
|
1097
|
+
const encodedOptions = validateWhere(queryOptions.where) ? { ...queryOptions, where: JSON.stringify(queryOptions.where) } : queryOptions;
|
|
1098
|
+
const queryString = stringify(encodedOptions, { addQueryPrefix: true });
|
|
1055
1099
|
return queryString ? `${endpoint}${queryString}` : endpoint;
|
|
1056
1100
|
}
|
|
1057
1101
|
assertJsonResponse(response) {
|
|
@@ -1457,17 +1501,52 @@ var portOneStandardActionCapabilityOperations = /* @__PURE__ */ new Set([
|
|
|
1457
1501
|
]);
|
|
1458
1502
|
var MEMBERSHIP_ENDPOINT_OPERATIONS = {
|
|
1459
1503
|
subscribe: operation(null, "post", "/memberships/subscribe"),
|
|
1504
|
+
billingCustody: operation(null, "post", "/memberships/billing-custody"),
|
|
1460
1505
|
cancel: operation(null, "post", "/memberships/:id/cancel"),
|
|
1461
1506
|
me: operation(null, "get", "/memberships/me"),
|
|
1462
1507
|
chargeResult: operation(null, "post", "/memberships/:id/charge-result"),
|
|
1463
1508
|
refundResult: operation(null, "post", "/memberships/:id/refund-result"),
|
|
1464
1509
|
revoke: operation(null, "post", "/memberships/:id/revoke")
|
|
1465
1510
|
};
|
|
1511
|
+
var EXTERNAL_EFFECT_CLAIM_ENDPOINT_OPERATIONS = {
|
|
1512
|
+
claim: operation(null, "post", "/external-effect-claims/claim"),
|
|
1513
|
+
get: operation(null, "post", "/external-effect-claims/get"),
|
|
1514
|
+
arm: operation(null, "post", "/external-effect-claims/arm"),
|
|
1515
|
+
release: operation(null, "post", "/external-effect-claims/release"),
|
|
1516
|
+
report: operation(null, "post", "/external-effect-claims/report"),
|
|
1517
|
+
recovery: operation(null, "post", "/external-effect-claims/recovery")
|
|
1518
|
+
};
|
|
1519
|
+
var INSTALLATION_CREDENTIAL_ENDPOINT_OPERATIONS = {
|
|
1520
|
+
create: operation(null, "post", "/installation-credentials/create"),
|
|
1521
|
+
get: operation(null, "post", "/installation-credentials/get"),
|
|
1522
|
+
replace: operation(null, "post", "/installation-credentials/replace"),
|
|
1523
|
+
dispose: operation(null, "post", "/installation-credentials/dispose")
|
|
1524
|
+
};
|
|
1525
|
+
var EXTERNAL_CUSTOMER_LINK_ENDPOINT_OPERATIONS = {
|
|
1526
|
+
connect: operation("customers", "post", "/external-links/connect"),
|
|
1527
|
+
get: operation("customers", "post", "/external-links/get"),
|
|
1528
|
+
list: operation("customers", "post", "/external-links/list"),
|
|
1529
|
+
unlink: operation("customers", "post", "/external-links/unlink"),
|
|
1530
|
+
capturePreviousState: operation(
|
|
1531
|
+
"customers",
|
|
1532
|
+
"post",
|
|
1533
|
+
"/external-links/capture-previous-state"
|
|
1534
|
+
),
|
|
1535
|
+
clearPreviousState: operation(
|
|
1536
|
+
"customers",
|
|
1537
|
+
"post",
|
|
1538
|
+
"/external-links/clear-previous-state"
|
|
1539
|
+
)
|
|
1540
|
+
};
|
|
1466
1541
|
var CUSTOMER_GROUP_ENDPOINT_OPERATIONS = {
|
|
1467
1542
|
members: operation("customer-groups", "get", "/:id/members"),
|
|
1468
1543
|
grant: operation("customer-groups", "post", "/:id/members/grant"),
|
|
1469
1544
|
revoke: operation("customer-groups", "post", "/:id/members/revoke")
|
|
1470
1545
|
};
|
|
1546
|
+
var CUSTOMER_AUTH_ENDPOINT_OPERATIONS = {
|
|
1547
|
+
revokeRefresh: operation("customers", "post", "/revoke-refresh"),
|
|
1548
|
+
withdraw: operation("customers", "post", "/withdraw")
|
|
1549
|
+
};
|
|
1471
1550
|
var EMBEDDED_ADMIN_ENDPOINT_OPERATIONS = {
|
|
1472
1551
|
show: operation("tenants", "get", "/embedded-admin-app"),
|
|
1473
1552
|
configure: operation("tenants", "patch", "/embedded-admin-app"),
|
|
@@ -1491,6 +1570,14 @@ var COMMUNITY_ENDPOINT_OPERATIONS = {
|
|
|
1491
1570
|
detail: operation("posts", "get", "/detail")
|
|
1492
1571
|
}
|
|
1493
1572
|
};
|
|
1573
|
+
var GALLERY_ENDPOINT_OPERATIONS = {
|
|
1574
|
+
items: {
|
|
1575
|
+
storefront: operation("gallery-items", "get", "/storefront")
|
|
1576
|
+
}
|
|
1577
|
+
};
|
|
1578
|
+
var VIDEO_ENDPOINT_OPERATIONS = {
|
|
1579
|
+
playback: operation("videos", "post", "/:id/playback")
|
|
1580
|
+
};
|
|
1494
1581
|
function resolveOperationTemplate(descriptor) {
|
|
1495
1582
|
return descriptor.collection ? `/api/${descriptor.collection}${descriptor.path}` : `/api${descriptor.path}`;
|
|
1496
1583
|
}
|
|
@@ -2080,6 +2167,15 @@ var PublicContentApi = class extends RawCustomerScopedApi {
|
|
|
2080
2167
|
get(endpoint) {
|
|
2081
2168
|
return this.request(endpoint, { method: "GET" });
|
|
2082
2169
|
}
|
|
2170
|
+
galleryItems(options) {
|
|
2171
|
+
const operation2 = GALLERY_ENDPOINT_OPERATIONS.items.storefront;
|
|
2172
|
+
return this.request(
|
|
2173
|
+
resolveOperationPath(operation2, {
|
|
2174
|
+
query: galleryItemsListQuery(options)
|
|
2175
|
+
}),
|
|
2176
|
+
{ method: resolveOperationMethod(operation2) }
|
|
2177
|
+
);
|
|
2178
|
+
}
|
|
2083
2179
|
};
|
|
2084
2180
|
function appendCommonParams(search, options, defaultSort) {
|
|
2085
2181
|
search.set("sort", options?.sort ?? defaultSort);
|
|
@@ -2099,12 +2195,12 @@ function linksListPath(options) {
|
|
|
2099
2195
|
search.set("featured", String(options.featured));
|
|
2100
2196
|
return `/api/links/storefront?${search}`;
|
|
2101
2197
|
}
|
|
2102
|
-
function
|
|
2198
|
+
function galleryItemsListQuery(options) {
|
|
2103
2199
|
const search = new URLSearchParams();
|
|
2104
2200
|
appendCommonParams(search, options, "manual");
|
|
2105
2201
|
if (options?.galleryId) search.set("galleryId", options.galleryId);
|
|
2106
2202
|
if (options?.gallerySlug) search.set("gallerySlug", options.gallerySlug);
|
|
2107
|
-
return
|
|
2203
|
+
return search;
|
|
2108
2204
|
}
|
|
2109
2205
|
var ContentClient = class {
|
|
2110
2206
|
constructor(options) {
|
|
@@ -2118,9 +2214,7 @@ var ContentClient = class {
|
|
|
2118
2214
|
list: (params) => api.get(linksListPath(params))
|
|
2119
2215
|
};
|
|
2120
2216
|
this.galleryItems = {
|
|
2121
|
-
list: (params) => api.
|
|
2122
|
-
galleryItemsListPath(params)
|
|
2123
|
-
)
|
|
2217
|
+
list: (params) => api.galleryItems(params)
|
|
2124
2218
|
};
|
|
2125
2219
|
}
|
|
2126
2220
|
};
|
|
@@ -4170,11 +4264,46 @@ var CustomerAuth = class {
|
|
|
4170
4264
|
};
|
|
4171
4265
|
}
|
|
4172
4266
|
/**
|
|
4173
|
-
* Clear
|
|
4267
|
+
* Clear local credentials synchronously. This compatibility API cannot
|
|
4268
|
+
* revoke the server-side refresh family; use logoutAsync() for that.
|
|
4269
|
+
* @deprecated Use logoutAsync() to end the direct server session.
|
|
4174
4270
|
*/
|
|
4175
4271
|
logout() {
|
|
4176
4272
|
this.setSession(null, null);
|
|
4177
4273
|
}
|
|
4274
|
+
/**
|
|
4275
|
+
* End the current direct refresh family and clear local credentials even if
|
|
4276
|
+
* revocation fails. A legacy access-only session has no refresh family here.
|
|
4277
|
+
*/
|
|
4278
|
+
async logoutAsync() {
|
|
4279
|
+
this.syncFromPersistedStorage();
|
|
4280
|
+
const refreshToken = this.refreshTokenValue;
|
|
4281
|
+
this.logout();
|
|
4282
|
+
if (!refreshToken) return;
|
|
4283
|
+
const operation2 = CUSTOMER_AUTH_ENDPOINT_OPERATIONS.revokeRefresh;
|
|
4284
|
+
await this.requestJson(resolveOperationPath(operation2), {
|
|
4285
|
+
method: resolveOperationMethod(operation2),
|
|
4286
|
+
body: JSON.stringify({ refreshToken })
|
|
4287
|
+
});
|
|
4288
|
+
}
|
|
4289
|
+
/** Archive the current password account and clear this client's credentials on success. */
|
|
4290
|
+
async withdraw(currentPassword) {
|
|
4291
|
+
const token = this.getToken();
|
|
4292
|
+
if (!token) throw new ApiError("Not authenticated", 401);
|
|
4293
|
+
const operation2 = CUSTOMER_AUTH_ENDPOINT_OPERATIONS.withdraw;
|
|
4294
|
+
const result = await this.requestJson(
|
|
4295
|
+
resolveOperationPath(operation2),
|
|
4296
|
+
{
|
|
4297
|
+
method: resolveOperationMethod(operation2),
|
|
4298
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
4299
|
+
body: JSON.stringify({ currentPassword })
|
|
4300
|
+
}
|
|
4301
|
+
);
|
|
4302
|
+
if (!result || typeof result.withdrawnAt !== "string" || !Number.isFinite(Date.parse(result.withdrawnAt)))
|
|
4303
|
+
throw new ApiError("Invalid customer withdrawal response", 502);
|
|
4304
|
+
this.logout();
|
|
4305
|
+
return { withdrawnAt: result.withdrawnAt };
|
|
4306
|
+
}
|
|
4178
4307
|
/**
|
|
4179
4308
|
* Get the current authenticated customer's profile
|
|
4180
4309
|
*/
|