@01.software/sdk 0.49.0 → 0.56.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 +257 -1
- package/MIGRATION.md +56 -0
- package/README.md +269 -56
- package/dist/client.cjs +608 -190
- 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 +608 -190
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-DnDt6EQz.d.ts → collection-client-Bmr53saa.d.ts} +6 -4
- package/dist/{collection-client-XfGLPuTf.d.cts → collection-client-DxuBDso_.d.cts} +6 -4
- package/dist/{const-CBba4lDo.d.cts → const-BKUqg96Q.d.ts} +5 -5
- package/dist/{const-DCNV5Kq7.d.ts → const-Cv1DCsp6.d.cts} +5 -5
- package/dist/embedded-admin/server.cjs +306 -0
- package/dist/embedded-admin/server.cjs.map +1 -0
- package/dist/embedded-admin/server.d.cts +33 -0
- package/dist/embedded-admin/server.d.ts +33 -0
- package/dist/embedded-admin/server.js +288 -0
- package/dist/embedded-admin/server.js.map +1 -0
- package/dist/embedded-admin.cjs +400 -0
- package/dist/embedded-admin.cjs.map +1 -0
- package/dist/embedded-admin.d.cts +61 -0
- package/dist/embedded-admin.d.ts +61 -0
- package/dist/embedded-admin.js +377 -0
- package/dist/embedded-admin.js.map +1 -0
- package/dist/errors.cjs +1 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +3 -3
- package/dist/errors.d.ts +3 -3
- package/dist/errors.js +1 -0
- package/dist/errors.js.map +1 -1
- package/dist/{index-DUuIqUS8.d.ts → index-CGsT4AQ8.d.cts} +89 -10
- package/dist/{index-CbKyoEzy.d.cts → index-DFHLLqYu.d.ts} +89 -10
- package/dist/index.cjs +752 -436
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -69
- package/dist/index.d.ts +12 -69
- package/dist/index.js +752 -436
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-MKbx5MuJ.d.cts → payload-types-Bk-duc5k.d.cts} +545 -141
- package/dist/{payload-types-MKbx5MuJ.d.ts → payload-types-Bk-duc5k.d.ts} +545 -141
- package/dist/query.cjs +108 -71
- 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 +108 -71
- 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 +502 -175
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +9 -8
- package/dist/server.d.ts +9 -8
- package/dist/server.js +502 -175
- package/dist/server.js.map +1 -1
- package/dist/storefront-cache.cjs +1 -0
- package/dist/storefront-cache.cjs.map +1 -1
- package/dist/storefront-cache.js +1 -0
- package/dist/storefront-cache.js.map +1 -1
- package/dist/{types-1UeOk1Uy.d.cts → types-CEK8uTvU.d.ts} +287 -30
- package/dist/{types-BKr_2avj.d.cts → types-CNdpj2fI.d.cts} +2 -2
- package/dist/{types-L_nh-ED7.d.ts → types-D4mjGFj4.d.ts} +2 -2
- package/dist/{types-Du4s5anw.d.ts → types-Dhk5NX7Z.d.cts} +287 -30
- 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 +135 -80
- package/dist/webhook.cjs.map +1 -1
- package/dist/webhook.d.cts +21 -5
- package/dist/webhook.d.ts +21 -5
- package/dist/webhook.js +135 -80
- package/dist/webhook.js.map +1 -1
- package/package.json +28 -6
package/dist/query.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { QueryClient, UseQueryResult, UseSuspenseQueryResult, InfiniteData, UseInfiniteQueryResult, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query';
|
|
3
|
-
import { i as ApiQueryOptions, P as PayloadFindResponse,
|
|
4
|
-
import './payload-types-
|
|
5
|
-
import { S as ServerCollection, P as PublicCollection } from './const-
|
|
6
|
-
import { C as CollectionClient } from './collection-client-
|
|
7
|
-
import { C as CollectionType } from './types-
|
|
3
|
+
import { i as ApiQueryOptions, P as PayloadFindResponse, cg as PublicReadQueryOptions, L as PayloadMutationResponse, ch as CustomerAuth, ci as CustomerProfile, cj as CustomerAuthResponse, ck as CustomerLoginData, cl as CustomerRegisterResponse, cm as CustomerRegisterData, cn as CustomerRefreshResponse, co as UpdateProfileData, cp as ProductListingPageParams, cq as ProductListingPageBaseParams, cr as ProductDetailParams, cs as ProductDetailCatalogResult, ct as ProductListingPageCatalogParams, cu as ProductListingPageResult, cv as ProductListingGroupsCatalogItem, cw as ProductListingPageFullParams, cx as ProductListingGroupsItem, al as RootClient, bX as RootServerClient } from './types-Dhk5NX7Z.cjs';
|
|
4
|
+
import './payload-types-Bk-duc5k.cjs';
|
|
5
|
+
import { S as ServerCollection, P as PublicCollection } from './const-Cv1DCsp6.cjs';
|
|
6
|
+
import { C as CollectionClient } from './collection-client-DxuBDso_.cjs';
|
|
7
|
+
import { C as CollectionType } from './types-CNdpj2fI.cjs';
|
|
8
8
|
import { SDKError } from './errors.cjs';
|
|
9
9
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.cjs';
|
|
10
10
|
import './metadata.cjs';
|
package/dist/query.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { QueryClient, UseQueryResult, UseSuspenseQueryResult, InfiniteData, UseInfiniteQueryResult, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query';
|
|
3
|
-
import { i as ApiQueryOptions, P as PayloadFindResponse,
|
|
4
|
-
import './payload-types-
|
|
5
|
-
import { S as ServerCollection, P as PublicCollection } from './const-
|
|
6
|
-
import { C as CollectionClient } from './collection-client-
|
|
7
|
-
import { C as CollectionType } from './types-
|
|
3
|
+
import { i as ApiQueryOptions, P as PayloadFindResponse, cg as PublicReadQueryOptions, L as PayloadMutationResponse, ch as CustomerAuth, ci as CustomerProfile, cj as CustomerAuthResponse, ck as CustomerLoginData, cl as CustomerRegisterResponse, cm as CustomerRegisterData, cn as CustomerRefreshResponse, co as UpdateProfileData, cp as ProductListingPageParams, cq as ProductListingPageBaseParams, cr as ProductDetailParams, cs as ProductDetailCatalogResult, ct as ProductListingPageCatalogParams, cu as ProductListingPageResult, cv as ProductListingGroupsCatalogItem, cw as ProductListingPageFullParams, cx as ProductListingGroupsItem, al as RootClient, bX as RootServerClient } from './types-CEK8uTvU.js';
|
|
4
|
+
import './payload-types-Bk-duc5k.js';
|
|
5
|
+
import { S as ServerCollection, P as PublicCollection } from './const-BKUqg96Q.js';
|
|
6
|
+
import { C as CollectionClient } from './collection-client-Bmr53saa.js';
|
|
7
|
+
import { C as CollectionType } from './types-D4mjGFj4.js';
|
|
8
8
|
import { SDKError } from './errors.js';
|
|
9
9
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.js';
|
|
10
10
|
import './metadata.js';
|
package/dist/query.js
CHANGED
|
@@ -570,6 +570,7 @@ var COMMERCE_ERROR_CODES = [
|
|
|
570
570
|
"payment_session_not_cancelable",
|
|
571
571
|
"payment_session_conflict",
|
|
572
572
|
"provider_identity_mismatch",
|
|
573
|
+
"managed_refund_attestation_forbidden",
|
|
573
574
|
"payment_method_unavailable",
|
|
574
575
|
"provider_unavailable",
|
|
575
576
|
"lock_timeout",
|
|
@@ -811,6 +812,10 @@ var operation = (collection, method, path, errorFamily) => Object.freeze({
|
|
|
811
812
|
...errorFamily && { errorFamily }
|
|
812
813
|
});
|
|
813
814
|
var strictCommerceOperation = (collection, method, path) => operation(collection, method, path, "commerce");
|
|
815
|
+
var selectiveCommerceOperation = (collection, method, path, typedCommerceErrorReasons) => Object.freeze({
|
|
816
|
+
...operation(collection, method, path),
|
|
817
|
+
typedCommerceErrorReasons: Object.freeze([...typedCommerceErrorReasons])
|
|
818
|
+
});
|
|
814
819
|
var COMMERCE_ENDPOINT_OPERATIONS = {
|
|
815
820
|
products: {
|
|
816
821
|
detail: operation("products", "get", "/detail"),
|
|
@@ -842,7 +847,12 @@ var COMMERCE_ENDPOINT_OPERATIONS = {
|
|
|
842
847
|
confirmPayment: operation("orders", "post", "/confirm-payment"),
|
|
843
848
|
byPayment: operation("orders", "get", "/by-payment"),
|
|
844
849
|
cancel: operation("orders", "post", "/cancel"),
|
|
845
|
-
resolveCancelRefund:
|
|
850
|
+
resolveCancelRefund: selectiveCommerceOperation(
|
|
851
|
+
"orders",
|
|
852
|
+
"post",
|
|
853
|
+
"/resolve-cancel-refund",
|
|
854
|
+
["managed_refund_attestation_forbidden"]
|
|
855
|
+
),
|
|
846
856
|
checkout: strictCommerceOperation("orders", "post", "/checkout"),
|
|
847
857
|
createFulfillment: operation("orders", "post", "/create-fulfillment"),
|
|
848
858
|
updateFulfillment: operation("orders", "post", "/update-fulfillment")
|
|
@@ -851,6 +861,11 @@ var COMMERCE_ENDPOINT_OPERATIONS = {
|
|
|
851
861
|
detail: strictCommerceOperation("checkouts", "post", "/detail"),
|
|
852
862
|
query: strictCommerceOperation("checkouts", "post", "/query")
|
|
853
863
|
},
|
|
864
|
+
draftOrders: {
|
|
865
|
+
calculate: operation("draft-orders", "post", "/:id/calculate"),
|
|
866
|
+
complete: operation("draft-orders", "post", "/:id/complete"),
|
|
867
|
+
finalize: operation("draft-orders", "post", "/:id/finalize")
|
|
868
|
+
},
|
|
854
869
|
transactions: {
|
|
855
870
|
update: operation("transactions", "post", "/update")
|
|
856
871
|
},
|
|
@@ -913,6 +928,16 @@ var COMMERCE_ENDPOINT_OPERATIONS = {
|
|
|
913
928
|
"payment-sessions",
|
|
914
929
|
"post",
|
|
915
930
|
"/server/confirm"
|
|
931
|
+
),
|
|
932
|
+
findPortOne: strictCommerceOperation(
|
|
933
|
+
"payment-sessions",
|
|
934
|
+
"post",
|
|
935
|
+
"/server/portone/find"
|
|
936
|
+
),
|
|
937
|
+
reconcilePortOne: strictCommerceOperation(
|
|
938
|
+
"payment-sessions",
|
|
939
|
+
"post",
|
|
940
|
+
"/server/portone/reconcile"
|
|
916
941
|
)
|
|
917
942
|
},
|
|
918
943
|
custom: {
|
|
@@ -932,12 +957,34 @@ var COMMERCE_ENDPOINT_OPERATIONS = {
|
|
|
932
957
|
validate: operation("discounts", "post", "/validate")
|
|
933
958
|
}
|
|
934
959
|
};
|
|
960
|
+
var portOneStandardActionCapabilityOperations = /* @__PURE__ */ new Set([
|
|
961
|
+
COMMERCE_ENDPOINT_OPERATIONS.paymentSessions.create,
|
|
962
|
+
COMMERCE_ENDPOINT_OPERATIONS.paymentSessions.retrieve,
|
|
963
|
+
COMMERCE_ENDPOINT_OPERATIONS.paymentSessions.server.create,
|
|
964
|
+
COMMERCE_ENDPOINT_OPERATIONS.paymentSessions.server.retrieve
|
|
965
|
+
]);
|
|
935
966
|
var MEMBERSHIP_ENDPOINT_OPERATIONS = {
|
|
936
967
|
subscribe: operation(null, "post", "/memberships/subscribe"),
|
|
937
968
|
cancel: operation(null, "post", "/memberships/:id/cancel"),
|
|
938
|
-
me: operation(null, "get", "/memberships/me")
|
|
969
|
+
me: operation(null, "get", "/memberships/me"),
|
|
970
|
+
chargeResult: operation(null, "post", "/memberships/:id/charge-result"),
|
|
971
|
+
refundResult: operation(null, "post", "/memberships/:id/refund-result"),
|
|
972
|
+
revoke: operation(null, "post", "/memberships/:id/revoke")
|
|
973
|
+
};
|
|
974
|
+
var CUSTOMER_GROUP_ENDPOINT_OPERATIONS = {
|
|
975
|
+
members: operation("customer-groups", "get", "/:id/members"),
|
|
976
|
+
grant: operation("customer-groups", "post", "/:id/members/grant"),
|
|
977
|
+
revoke: operation("customer-groups", "post", "/:id/members/revoke")
|
|
978
|
+
};
|
|
979
|
+
var EMBEDDED_ADMIN_ENDPOINT_OPERATIONS = {
|
|
980
|
+
show: operation("tenants", "get", "/embedded-admin-app"),
|
|
981
|
+
configure: operation("tenants", "patch", "/embedded-admin-app"),
|
|
982
|
+
disable: operation("tenants", "delete", "/embedded-admin-app")
|
|
939
983
|
};
|
|
940
984
|
var EVENTS_ENDPOINT_OPERATIONS = {
|
|
985
|
+
events: {
|
|
986
|
+
convertSchedule: operation("events", "post", "/:id/schedule")
|
|
987
|
+
},
|
|
941
988
|
occurrences: {
|
|
942
989
|
range: operation("event-occurrences", "get", "/range"),
|
|
943
990
|
admissionAvailability: operation(
|
|
@@ -975,40 +1022,48 @@ function resolveOperationPath(descriptor, options) {
|
|
|
975
1022
|
}
|
|
976
1023
|
|
|
977
1024
|
// src/core/api/endpoints.ts
|
|
978
|
-
var endpoint = (method, path) => ({ method, path });
|
|
979
1025
|
var sharedEndpoint = (descriptor) => descriptor;
|
|
980
|
-
function resolveOperationPath2(descriptor, options) {
|
|
981
|
-
if ("collection" in descriptor) {
|
|
982
|
-
return resolveOperationPath(descriptor, options);
|
|
983
|
-
}
|
|
984
|
-
const query = options?.query?.toString().replace(/^\?/, "");
|
|
985
|
-
return query ? `${descriptor.path}?${query}` : descriptor.path;
|
|
986
|
-
}
|
|
987
1026
|
var COMMERCE_ENDPOINTS = {
|
|
988
1027
|
products: {
|
|
989
|
-
detail:
|
|
990
|
-
detailCatalog:
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1028
|
+
detail: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.products.detail),
|
|
1029
|
+
detailCatalog: sharedEndpoint(
|
|
1030
|
+
COMMERCE_ENDPOINT_OPERATIONS.products.detailCatalog
|
|
1031
|
+
),
|
|
1032
|
+
listingGroups: sharedEndpoint(
|
|
1033
|
+
COMMERCE_ENDPOINT_OPERATIONS.products.listingGroups
|
|
995
1034
|
),
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
"GET",
|
|
999
|
-
"/api/products/listing-groups/query/catalog"
|
|
1035
|
+
listingGroupsCatalog: sharedEndpoint(
|
|
1036
|
+
COMMERCE_ENDPOINT_OPERATIONS.products.listingGroupsCatalog
|
|
1000
1037
|
),
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1038
|
+
// The manifest keeps the GET read and the POST body-query apart; this
|
|
1039
|
+
// semantic name has always resolved to the GET one.
|
|
1040
|
+
listingGroupsQuery: sharedEndpoint(
|
|
1041
|
+
COMMERCE_ENDPOINT_OPERATIONS.products.listingGroupsQueryGet
|
|
1042
|
+
),
|
|
1043
|
+
listingGroupsQueryCatalog: sharedEndpoint(
|
|
1044
|
+
COMMERCE_ENDPOINT_OPERATIONS.products.listingGroupsQueryCatalog
|
|
1045
|
+
),
|
|
1046
|
+
stockCheck: sharedEndpoint(
|
|
1047
|
+
COMMERCE_ENDPOINT_OPERATIONS.products.stockCheck
|
|
1048
|
+
),
|
|
1049
|
+
stockSnapshot: sharedEndpoint(
|
|
1050
|
+
COMMERCE_ENDPOINT_OPERATIONS.products.stockSnapshot
|
|
1051
|
+
),
|
|
1052
|
+
upsert: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.products.upsert)
|
|
1004
1053
|
},
|
|
1005
1054
|
orders: {
|
|
1006
|
-
update:
|
|
1007
|
-
byPayment:
|
|
1008
|
-
cancel:
|
|
1009
|
-
resolveCancelRefund:
|
|
1010
|
-
|
|
1011
|
-
|
|
1055
|
+
update: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.orders.update),
|
|
1056
|
+
byPayment: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.orders.byPayment),
|
|
1057
|
+
cancel: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.orders.cancel),
|
|
1058
|
+
resolveCancelRefund: sharedEndpoint(
|
|
1059
|
+
COMMERCE_ENDPOINT_OPERATIONS.orders.resolveCancelRefund
|
|
1060
|
+
),
|
|
1061
|
+
createFulfillment: sharedEndpoint(
|
|
1062
|
+
COMMERCE_ENDPOINT_OPERATIONS.orders.createFulfillment
|
|
1063
|
+
),
|
|
1064
|
+
updateFulfillment: sharedEndpoint(
|
|
1065
|
+
COMMERCE_ENDPOINT_OPERATIONS.orders.updateFulfillment
|
|
1066
|
+
)
|
|
1012
1067
|
},
|
|
1013
1068
|
checkouts: {
|
|
1014
1069
|
create: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.orders.checkout),
|
|
@@ -1020,18 +1075,21 @@ var COMMERCE_ENDPOINTS = {
|
|
|
1020
1075
|
}
|
|
1021
1076
|
},
|
|
1022
1077
|
returns: {
|
|
1023
|
-
create:
|
|
1024
|
-
update:
|
|
1025
|
-
returnRefund:
|
|
1078
|
+
create: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.returns.create),
|
|
1079
|
+
update: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.returns.update),
|
|
1080
|
+
returnRefund: sharedEndpoint(
|
|
1081
|
+
COMMERCE_ENDPOINT_OPERATIONS.returns.returnRefund
|
|
1082
|
+
)
|
|
1026
1083
|
},
|
|
1027
1084
|
fulfillmentOrders: {
|
|
1028
|
-
prepare:
|
|
1029
|
-
|
|
1030
|
-
"/api/fulfillment-orders/prepare-fulfillment-order"
|
|
1085
|
+
prepare: sharedEndpoint(
|
|
1086
|
+
COMMERCE_ENDPOINT_OPERATIONS.fulfillmentOrders.prepare
|
|
1031
1087
|
)
|
|
1032
1088
|
},
|
|
1033
1089
|
fulfillments: {
|
|
1034
|
-
bulkImport:
|
|
1090
|
+
bulkImport: sharedEndpoint(
|
|
1091
|
+
COMMERCE_ENDPOINT_OPERATIONS.fulfillments.bulkImport
|
|
1092
|
+
)
|
|
1035
1093
|
},
|
|
1036
1094
|
carts: {
|
|
1037
1095
|
create: sharedEndpoint(COMMERCE_ENDPOINT_OPERATIONS.carts.create),
|
|
@@ -1096,57 +1154,36 @@ var COMMERCE_ENDPOINTS = {
|
|
|
1096
1154
|
),
|
|
1097
1155
|
confirm: sharedEndpoint(
|
|
1098
1156
|
COMMERCE_ENDPOINT_OPERATIONS.paymentSessions.server.confirm
|
|
1157
|
+
),
|
|
1158
|
+
findPortOne: sharedEndpoint(
|
|
1159
|
+
COMMERCE_ENDPOINT_OPERATIONS.paymentSessions.server.findPortOne
|
|
1160
|
+
),
|
|
1161
|
+
reconcilePortOne: sharedEndpoint(
|
|
1162
|
+
COMMERCE_ENDPOINT_OPERATIONS.paymentSessions.server.reconcilePortOne
|
|
1099
1163
|
)
|
|
1100
1164
|
}
|
|
1101
1165
|
},
|
|
1102
1166
|
shippingPolicies: {
|
|
1103
|
-
calculate:
|
|
1167
|
+
calculate: sharedEndpoint(
|
|
1168
|
+
COMMERCE_ENDPOINT_OPERATIONS.shippingPolicies.calculate
|
|
1169
|
+
)
|
|
1104
1170
|
}
|
|
1105
1171
|
};
|
|
1106
|
-
function isCommerceEndpointDescriptor(value) {
|
|
1107
|
-
if (!value || typeof value !== "object") return false;
|
|
1108
|
-
const candidate = value;
|
|
1109
|
-
return typeof candidate.method === "string" && typeof candidate.path === "string";
|
|
1110
|
-
}
|
|
1111
|
-
function flattenEndpointPaths(value) {
|
|
1112
|
-
if (isCommerceEndpointDescriptor(value)) return [resolveOperationPath2(value)];
|
|
1113
|
-
if (!value || typeof value !== "object") return [];
|
|
1114
|
-
return Object.values(value).flatMap((entry) => flattenEndpointPaths(entry));
|
|
1115
|
-
}
|
|
1116
|
-
function flattenEndpointDescriptors(value) {
|
|
1117
|
-
if (isCommerceEndpointDescriptor(value)) return [value];
|
|
1118
|
-
if (!value || typeof value !== "object") return [];
|
|
1119
|
-
return Object.values(value).flatMap(
|
|
1120
|
-
(entry) => flattenEndpointDescriptors(entry)
|
|
1121
|
-
);
|
|
1122
|
-
}
|
|
1123
|
-
var COMMERCE_ENDPOINT_PATHS = flattenEndpointPaths(COMMERCE_ENDPOINTS);
|
|
1124
|
-
var COMMERCE_ENDPOINT_DESCRIPTORS = flattenEndpointDescriptors(COMMERCE_ENDPOINTS);
|
|
1125
|
-
var MEMBERSHIP_ENDPOINTS = {
|
|
1126
|
-
subscribe: "/api/memberships/subscribe",
|
|
1127
|
-
cancel: (id) => `/api/memberships/${id}/cancel`,
|
|
1128
|
-
me: "/api/memberships/me"
|
|
1129
|
-
};
|
|
1130
|
-
var MEMBERSHIP_ENDPOINT_PATHS = [
|
|
1131
|
-
MEMBERSHIP_ENDPOINTS.subscribe,
|
|
1132
|
-
MEMBERSHIP_ENDPOINTS.cancel(":id"),
|
|
1133
|
-
MEMBERSHIP_ENDPOINTS.me
|
|
1134
|
-
];
|
|
1135
1172
|
|
|
1136
1173
|
// src/core/query/query-hooks.ts
|
|
1137
1174
|
function normalizeMarket(market) {
|
|
1138
1175
|
const normalized = market?.trim();
|
|
1139
1176
|
return normalized || void 0;
|
|
1140
1177
|
}
|
|
1141
|
-
function requestCommerceFindEndpoint(collectionClient,
|
|
1142
|
-
const path =
|
|
1143
|
-
if (
|
|
1178
|
+
function requestCommerceFindEndpoint(collectionClient, endpoint, options) {
|
|
1179
|
+
const path = resolveOperationPath(endpoint, { query: options?.query });
|
|
1180
|
+
if (endpoint.method === "get") {
|
|
1144
1181
|
return collectionClient.requestFindEndpointGet(path);
|
|
1145
1182
|
}
|
|
1146
|
-
if (
|
|
1183
|
+
if (endpoint.method === "post") {
|
|
1147
1184
|
return collectionClient.requestFindEndpoint(path, options?.data);
|
|
1148
1185
|
}
|
|
1149
|
-
throw new TypeError(`Unsupported find endpoint method: ${
|
|
1186
|
+
throw new TypeError(`Unsupported find endpoint method: ${endpoint.method}`);
|
|
1150
1187
|
}
|
|
1151
1188
|
function withDefaultMarket(params, market) {
|
|
1152
1189
|
const defaultMarket = normalizeMarket(market);
|