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