arky-sdk 0.7.111 → 0.7.113
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/dist/admin.cjs +112 -127
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +1 -1
- package/dist/admin.d.ts +1 -1
- package/dist/admin.js +112 -127
- package/dist/admin.js.map +1 -1
- package/dist/{index-DTg5d847.d.ts → index-C5gikdBg.d.cts} +2 -2
- package/dist/{index-BCAQZOwm.d.cts → index-MFMjlIfS.d.ts} +2 -2
- package/dist/index.cjs +137 -215
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -36
- package/dist/index.d.ts +22 -36
- package/dist/index.js +137 -215
- package/dist/index.js.map +1 -1
- package/dist/storefront.cjs +48 -87
- package/dist/storefront.cjs.map +1 -1
- package/dist/storefront.d.cts +1 -1
- package/dist/storefront.d.ts +1 -1
- package/dist/storefront.js +48 -87
- package/dist/storefront.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +152 -324
- package/dist/types.d.ts +152 -324
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/admin.d.cts
CHANGED
package/dist/admin.d.ts
CHANGED
package/dist/admin.js
CHANGED
|
@@ -124,6 +124,30 @@ var getImageUrl = (imageBlock, isBlock = true) => {
|
|
|
124
124
|
return imageBlock.resolutions?.original?.url || null;
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
+
// src/utils/orderItems.ts
|
|
128
|
+
function normalizeOrderQuoteItems(items) {
|
|
129
|
+
return items.map((item) => {
|
|
130
|
+
if ("type" in item) {
|
|
131
|
+
return item;
|
|
132
|
+
}
|
|
133
|
+
if ("product_id" in item) {
|
|
134
|
+
return { type: "product", ...item };
|
|
135
|
+
}
|
|
136
|
+
return { type: "booking", ...item };
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function normalizeOrderCheckoutItems(items) {
|
|
140
|
+
return items.map((item) => {
|
|
141
|
+
if ("type" in item) {
|
|
142
|
+
return item;
|
|
143
|
+
}
|
|
144
|
+
if ("product_id" in item) {
|
|
145
|
+
return { type: "product", ...item };
|
|
146
|
+
}
|
|
147
|
+
return { type: "booking", ...item };
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
127
151
|
// src/utils/errors.ts
|
|
128
152
|
var convertServerErrorToRequestError = (serverError, renameRules) => {
|
|
129
153
|
const validationErrors = serverError?.validationErrors ?? [];
|
|
@@ -811,6 +835,13 @@ var createCmsApi = (apiConfig) => {
|
|
|
811
835
|
};
|
|
812
836
|
|
|
813
837
|
// src/api/eshop.ts
|
|
838
|
+
var normalizeTaxonomyAliases = (payload) => {
|
|
839
|
+
const { filters, ...rest } = payload;
|
|
840
|
+
return {
|
|
841
|
+
...rest,
|
|
842
|
+
...!rest.taxonomies && filters ? { taxonomies: filters } : {}
|
|
843
|
+
};
|
|
844
|
+
};
|
|
814
845
|
var createEshopApi = (apiConfig) => {
|
|
815
846
|
return {
|
|
816
847
|
async createProduct(params, options) {
|
|
@@ -818,7 +849,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
818
849
|
const target_store_id = store_id || apiConfig.storeId;
|
|
819
850
|
return apiConfig.httpClient.post(
|
|
820
851
|
`/v1/stores/${target_store_id}/products`,
|
|
821
|
-
payload,
|
|
852
|
+
normalizeTaxonomyAliases(payload),
|
|
822
853
|
options
|
|
823
854
|
);
|
|
824
855
|
},
|
|
@@ -827,7 +858,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
827
858
|
const target_store_id = store_id || apiConfig.storeId;
|
|
828
859
|
return apiConfig.httpClient.put(
|
|
829
860
|
`/v1/stores/${target_store_id}/products/${params.id}`,
|
|
830
|
-
payload,
|
|
861
|
+
normalizeTaxonomyAliases(payload),
|
|
831
862
|
options
|
|
832
863
|
);
|
|
833
864
|
},
|
|
@@ -865,17 +896,41 @@ var createEshopApi = (apiConfig) => {
|
|
|
865
896
|
);
|
|
866
897
|
},
|
|
867
898
|
async createOrder(params, options) {
|
|
868
|
-
const { store_id, ...
|
|
899
|
+
const { store_id, items, ...rest } = params;
|
|
869
900
|
const target_store_id = store_id || apiConfig.storeId;
|
|
901
|
+
const payload = {
|
|
902
|
+
...rest,
|
|
903
|
+
market: rest.market || apiConfig.market,
|
|
904
|
+
items: normalizeOrderCheckoutItems(items)
|
|
905
|
+
};
|
|
870
906
|
return apiConfig.httpClient.post(
|
|
871
907
|
`/v1/stores/${target_store_id}/orders`,
|
|
872
908
|
payload,
|
|
873
909
|
options
|
|
874
910
|
);
|
|
875
911
|
},
|
|
912
|
+
async checkoutOrder(params, options) {
|
|
913
|
+
const { store_id, items, ...rest } = params;
|
|
914
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
915
|
+
const payload = {
|
|
916
|
+
...rest,
|
|
917
|
+
store_id: target_store_id,
|
|
918
|
+
market: rest.market || apiConfig.market,
|
|
919
|
+
items: normalizeOrderCheckoutItems(items)
|
|
920
|
+
};
|
|
921
|
+
return apiConfig.httpClient.post(
|
|
922
|
+
`/v1/stores/${target_store_id}/orders/checkout`,
|
|
923
|
+
payload,
|
|
924
|
+
options
|
|
925
|
+
);
|
|
926
|
+
},
|
|
876
927
|
async updateOrder(params, options) {
|
|
877
|
-
const { store_id, ...
|
|
928
|
+
const { store_id, items, ...rest } = params;
|
|
878
929
|
const target_store_id = store_id || apiConfig.storeId;
|
|
930
|
+
const payload = {
|
|
931
|
+
...rest,
|
|
932
|
+
...items ? { items: normalizeOrderCheckoutItems(items) } : {}
|
|
933
|
+
};
|
|
879
934
|
return apiConfig.httpClient.put(
|
|
880
935
|
`/v1/stores/${target_store_id}/orders/${params.id}`,
|
|
881
936
|
payload,
|
|
@@ -901,7 +956,8 @@ var createEshopApi = (apiConfig) => {
|
|
|
901
956
|
);
|
|
902
957
|
},
|
|
903
958
|
async getQuote(params, options) {
|
|
904
|
-
const { location, ...rest } = params;
|
|
959
|
+
const { location, store_id, items, ...rest } = params;
|
|
960
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
905
961
|
const shipping_address = location ? {
|
|
906
962
|
country: location.country || "",
|
|
907
963
|
state: location.state || "",
|
|
@@ -910,13 +966,26 @@ var createEshopApi = (apiConfig) => {
|
|
|
910
966
|
name: "",
|
|
911
967
|
street1: "",
|
|
912
968
|
street2: null
|
|
913
|
-
} :
|
|
969
|
+
} : rest.shipping_address;
|
|
914
970
|
return apiConfig.httpClient.post(
|
|
915
|
-
`/v1/stores/${
|
|
916
|
-
{
|
|
971
|
+
`/v1/stores/${target_store_id}/orders/quote`,
|
|
972
|
+
{
|
|
973
|
+
...rest,
|
|
974
|
+
items: normalizeOrderQuoteItems(items),
|
|
975
|
+
shipping_address,
|
|
976
|
+
market: rest.market || apiConfig.market
|
|
977
|
+
},
|
|
917
978
|
options
|
|
918
979
|
);
|
|
919
980
|
},
|
|
981
|
+
async getOrderAvailability(params, options) {
|
|
982
|
+
const { store_id, ...queryParams } = params;
|
|
983
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
984
|
+
return apiConfig.httpClient.get(
|
|
985
|
+
`/v1/stores/${target_store_id}/orders/availability`,
|
|
986
|
+
{ ...options, params: queryParams }
|
|
987
|
+
);
|
|
988
|
+
},
|
|
920
989
|
async processRefund(params, options) {
|
|
921
990
|
return apiConfig.httpClient.post(
|
|
922
991
|
`/v1/stores/${apiConfig.storeId}/orders/${params.id}/refund`,
|
|
@@ -927,87 +996,22 @@ var createEshopApi = (apiConfig) => {
|
|
|
927
996
|
};
|
|
928
997
|
};
|
|
929
998
|
|
|
930
|
-
// src/api/
|
|
931
|
-
var
|
|
932
|
-
|
|
999
|
+
// src/api/scheduling.ts
|
|
1000
|
+
var normalizeTaxonomyAliases2 = (payload) => {
|
|
1001
|
+
const { filters, ...rest } = payload;
|
|
1002
|
+
return {
|
|
1003
|
+
...rest,
|
|
1004
|
+
...!rest.taxonomies && filters ? { taxonomies: filters } : {}
|
|
1005
|
+
};
|
|
1006
|
+
};
|
|
1007
|
+
var createSchedulingApi = (apiConfig) => {
|
|
933
1008
|
return {
|
|
934
|
-
addToCart(slot) {
|
|
935
|
-
cart.push(slot);
|
|
936
|
-
},
|
|
937
|
-
removeFromCart(slotId) {
|
|
938
|
-
cart = cart.filter((s) => s.id !== slotId);
|
|
939
|
-
},
|
|
940
|
-
getCart() {
|
|
941
|
-
return [...cart];
|
|
942
|
-
},
|
|
943
|
-
clearCart() {
|
|
944
|
-
cart = [];
|
|
945
|
-
},
|
|
946
|
-
async createBooking(params, options) {
|
|
947
|
-
const { store_id, ...payload } = params;
|
|
948
|
-
const target_store_id = store_id || apiConfig.storeId;
|
|
949
|
-
return apiConfig.httpClient.post(
|
|
950
|
-
`/v1/stores/${target_store_id}/bookings`,
|
|
951
|
-
{ market: apiConfig.market, ...payload },
|
|
952
|
-
options
|
|
953
|
-
);
|
|
954
|
-
},
|
|
955
|
-
async updateBooking(params, options) {
|
|
956
|
-
const { id, ...payload } = params;
|
|
957
|
-
return apiConfig.httpClient.put(
|
|
958
|
-
`/v1/stores/${apiConfig.storeId}/bookings/${id}`,
|
|
959
|
-
payload,
|
|
960
|
-
options
|
|
961
|
-
);
|
|
962
|
-
},
|
|
963
|
-
async getBooking(params, options) {
|
|
964
|
-
const target_store_id = params.store_id || apiConfig.storeId;
|
|
965
|
-
return apiConfig.httpClient.get(
|
|
966
|
-
`/v1/stores/${target_store_id}/bookings/${params.id}`,
|
|
967
|
-
options
|
|
968
|
-
);
|
|
969
|
-
},
|
|
970
|
-
async searchBookings(params, options) {
|
|
971
|
-
const { store_id, ...queryParams } = params;
|
|
972
|
-
const target_store_id = store_id || apiConfig.storeId;
|
|
973
|
-
return apiConfig.httpClient.get(
|
|
974
|
-
`/v1/stores/${target_store_id}/bookings`,
|
|
975
|
-
{
|
|
976
|
-
...options,
|
|
977
|
-
params: queryParams
|
|
978
|
-
}
|
|
979
|
-
);
|
|
980
|
-
},
|
|
981
|
-
async getQuote(params, options) {
|
|
982
|
-
const { store_id, ...payload } = params;
|
|
983
|
-
const target_store_id = store_id || apiConfig.storeId;
|
|
984
|
-
return apiConfig.httpClient.post(
|
|
985
|
-
`/v1/stores/${target_store_id}/bookings/quote`,
|
|
986
|
-
{ market: apiConfig.market, ...payload },
|
|
987
|
-
options
|
|
988
|
-
);
|
|
989
|
-
},
|
|
990
|
-
async processRefund(params, options) {
|
|
991
|
-
return apiConfig.httpClient.post(
|
|
992
|
-
`/v1/stores/${apiConfig.storeId}/bookings/${params.id}/refund`,
|
|
993
|
-
{ amount: params.amount },
|
|
994
|
-
options
|
|
995
|
-
);
|
|
996
|
-
},
|
|
997
|
-
async getAvailability(params, options) {
|
|
998
|
-
const { store_id, ...query } = params;
|
|
999
|
-
const target_store_id = store_id || apiConfig.storeId;
|
|
1000
|
-
return apiConfig.httpClient.get(
|
|
1001
|
-
`/v1/stores/${target_store_id}/bookings/availability`,
|
|
1002
|
-
{ ...options, params: query }
|
|
1003
|
-
);
|
|
1004
|
-
},
|
|
1005
1009
|
async createService(params, options) {
|
|
1006
1010
|
const { store_id, ...payload } = params;
|
|
1007
1011
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1008
1012
|
return apiConfig.httpClient.post(
|
|
1009
1013
|
`/v1/stores/${target_store_id}/services`,
|
|
1010
|
-
payload,
|
|
1014
|
+
normalizeTaxonomyAliases2(payload),
|
|
1011
1015
|
options
|
|
1012
1016
|
);
|
|
1013
1017
|
},
|
|
@@ -1016,7 +1020,7 @@ var createBookingApi = (apiConfig) => {
|
|
|
1016
1020
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1017
1021
|
return apiConfig.httpClient.put(
|
|
1018
1022
|
`/v1/stores/${target_store_id}/services/${params.id}`,
|
|
1019
|
-
payload,
|
|
1023
|
+
normalizeTaxonomyAliases2(payload),
|
|
1020
1024
|
options
|
|
1021
1025
|
);
|
|
1022
1026
|
},
|
|
@@ -1058,7 +1062,7 @@ var createBookingApi = (apiConfig) => {
|
|
|
1058
1062
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1059
1063
|
return apiConfig.httpClient.post(
|
|
1060
1064
|
`/v1/stores/${target_store_id}/providers`,
|
|
1061
|
-
payload,
|
|
1065
|
+
normalizeTaxonomyAliases2(payload),
|
|
1062
1066
|
options
|
|
1063
1067
|
);
|
|
1064
1068
|
},
|
|
@@ -1067,7 +1071,7 @@ var createBookingApi = (apiConfig) => {
|
|
|
1067
1071
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1068
1072
|
return apiConfig.httpClient.put(
|
|
1069
1073
|
`/v1/stores/${target_store_id}/providers/${params.id}`,
|
|
1070
|
-
payload,
|
|
1074
|
+
normalizeTaxonomyAliases2(payload),
|
|
1071
1075
|
options
|
|
1072
1076
|
);
|
|
1073
1077
|
},
|
|
@@ -1104,15 +1108,6 @@ var createBookingApi = (apiConfig) => {
|
|
|
1104
1108
|
}
|
|
1105
1109
|
);
|
|
1106
1110
|
},
|
|
1107
|
-
async cancelBookingItem(params, options) {
|
|
1108
|
-
const { store_id, booking_id, item_id, ...payload } = params;
|
|
1109
|
-
const target_store_id = store_id || apiConfig.storeId;
|
|
1110
|
-
return apiConfig.httpClient.post(
|
|
1111
|
-
`/v1/stores/${target_store_id}/bookings/${booking_id}/items/${item_id}/cancel`,
|
|
1112
|
-
payload,
|
|
1113
|
-
options
|
|
1114
|
-
);
|
|
1115
|
-
},
|
|
1116
1111
|
async findServiceProviders(params, options) {
|
|
1117
1112
|
const { store_id, ...queryParams } = params;
|
|
1118
1113
|
const target_store_id = store_id || apiConfig.storeId;
|
|
@@ -2230,7 +2225,8 @@ function createAdmin(config) {
|
|
|
2230
2225
|
const platformApi = createPlatformApi(apiConfig);
|
|
2231
2226
|
const cmsApi = createCmsApi(apiConfig);
|
|
2232
2227
|
const eshopApi = createEshopApi(apiConfig);
|
|
2233
|
-
const
|
|
2228
|
+
const schedulingApi = createSchedulingApi(apiConfig);
|
|
2229
|
+
const promoCodeApi = createPromoCodeApi(apiConfig);
|
|
2234
2230
|
const crmApi = createCustomerApi(apiConfig);
|
|
2235
2231
|
const locationApi = createLocationApi(apiConfig);
|
|
2236
2232
|
const marketApi = createMarketApi(apiConfig);
|
|
@@ -2250,7 +2246,7 @@ function createAdmin(config) {
|
|
|
2250
2246
|
},
|
|
2251
2247
|
media: createMediaApi(apiConfig),
|
|
2252
2248
|
notification: createNotificationApi(apiConfig),
|
|
2253
|
-
promoCode:
|
|
2249
|
+
promoCode: promoCodeApi,
|
|
2254
2250
|
platform: platformApi,
|
|
2255
2251
|
shipping: createShippingApi(apiConfig),
|
|
2256
2252
|
cms: {
|
|
@@ -2303,40 +2299,29 @@ function createAdmin(config) {
|
|
|
2303
2299
|
get: eshopApi.getOrder,
|
|
2304
2300
|
find: eshopApi.getOrders,
|
|
2305
2301
|
getQuote: eshopApi.getQuote,
|
|
2302
|
+
checkout: eshopApi.checkoutOrder,
|
|
2303
|
+
getAvailability: eshopApi.getOrderAvailability,
|
|
2306
2304
|
processRefund: eshopApi.processRefund
|
|
2307
|
-
}
|
|
2308
|
-
},
|
|
2309
|
-
booking: {
|
|
2310
|
-
addToCart: bookingApi.addToCart,
|
|
2311
|
-
removeFromCart: bookingApi.removeFromCart,
|
|
2312
|
-
getCart: bookingApi.getCart,
|
|
2313
|
-
clearCart: bookingApi.clearCart,
|
|
2314
|
-
create: bookingApi.createBooking,
|
|
2315
|
-
update: bookingApi.updateBooking,
|
|
2316
|
-
get: bookingApi.getBooking,
|
|
2317
|
-
find: bookingApi.searchBookings,
|
|
2318
|
-
getQuote: bookingApi.getQuote,
|
|
2319
|
-
processRefund: bookingApi.processRefund,
|
|
2320
|
-
getAvailability: bookingApi.getAvailability,
|
|
2321
|
-
cancelItem: bookingApi.cancelBookingItem,
|
|
2305
|
+
},
|
|
2322
2306
|
service: {
|
|
2323
|
-
create:
|
|
2324
|
-
update:
|
|
2325
|
-
delete:
|
|
2326
|
-
get:
|
|
2327
|
-
find:
|
|
2328
|
-
findProviders:
|
|
2329
|
-
createProvider:
|
|
2330
|
-
updateProvider:
|
|
2331
|
-
deleteProvider:
|
|
2307
|
+
create: schedulingApi.createService,
|
|
2308
|
+
update: schedulingApi.updateService,
|
|
2309
|
+
delete: schedulingApi.deleteService,
|
|
2310
|
+
get: schedulingApi.getService,
|
|
2311
|
+
find: schedulingApi.getServices,
|
|
2312
|
+
findProviders: schedulingApi.findServiceProviders,
|
|
2313
|
+
createProvider: schedulingApi.createServiceProvider,
|
|
2314
|
+
updateProvider: schedulingApi.updateServiceProvider,
|
|
2315
|
+
deleteProvider: schedulingApi.deleteServiceProvider
|
|
2332
2316
|
},
|
|
2333
2317
|
provider: {
|
|
2334
|
-
create:
|
|
2335
|
-
update:
|
|
2336
|
-
delete:
|
|
2337
|
-
get:
|
|
2338
|
-
find:
|
|
2339
|
-
}
|
|
2318
|
+
create: schedulingApi.createProvider,
|
|
2319
|
+
update: schedulingApi.updateProvider,
|
|
2320
|
+
delete: schedulingApi.deleteProvider,
|
|
2321
|
+
get: schedulingApi.getProvider,
|
|
2322
|
+
find: schedulingApi.getProviders
|
|
2323
|
+
},
|
|
2324
|
+
promoCode: promoCodeApi
|
|
2340
2325
|
},
|
|
2341
2326
|
crm: {
|
|
2342
2327
|
customer: {
|