arky-sdk 0.5.82 → 0.5.84
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/index.cjs +36 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -4
- package/dist/index.d.ts +15 -4
- package/dist/index.js +36 -44
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +0 -2
- package/dist/types.d.ts +0 -2
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -238,26 +238,6 @@ var createAccountApi = (apiConfig) => {
|
|
|
238
238
|
// src/api/auth.ts
|
|
239
239
|
var createAuthApi = (apiConfig) => {
|
|
240
240
|
return {
|
|
241
|
-
async session(options) {
|
|
242
|
-
return apiConfig.httpClient.post("/v1/auth/session", {}, options);
|
|
243
|
-
},
|
|
244
|
-
async signInAnonymously(options) {
|
|
245
|
-
const tokens = await apiConfig.getToken();
|
|
246
|
-
if (tokens?.accessToken) {
|
|
247
|
-
return tokens;
|
|
248
|
-
}
|
|
249
|
-
const result = await apiConfig.httpClient.post("/v1/auth/session", {}, options);
|
|
250
|
-
if (result?.accessToken) {
|
|
251
|
-
apiConfig.setToken({ ...result, isGuest: true });
|
|
252
|
-
}
|
|
253
|
-
return result;
|
|
254
|
-
},
|
|
255
|
-
async isGuest() {
|
|
256
|
-
const tokens = await apiConfig.getToken();
|
|
257
|
-
if (!tokens?.accessToken) return true;
|
|
258
|
-
const email = tokens.email || "";
|
|
259
|
-
return !email || email.startsWith("guest+");
|
|
260
|
-
},
|
|
261
241
|
async code(params, options) {
|
|
262
242
|
return apiConfig.httpClient.post("/v1/auth/code", params, options);
|
|
263
243
|
},
|
|
@@ -881,36 +861,16 @@ var createEshopApi = (apiConfig) => {
|
|
|
881
861
|
);
|
|
882
862
|
},
|
|
883
863
|
async getQuote(params, options) {
|
|
884
|
-
const payload = {
|
|
885
|
-
market: apiConfig.market,
|
|
886
|
-
items: params.items,
|
|
887
|
-
blocks: params.blocks || [],
|
|
888
|
-
paymentMethodId: params.paymentMethodId,
|
|
889
|
-
shippingMethodId: params.shippingMethodId,
|
|
890
|
-
promoCode: params.promoCode,
|
|
891
|
-
location: params.location
|
|
892
|
-
};
|
|
893
864
|
return apiConfig.httpClient.post(
|
|
894
865
|
`/v1/businesses/${apiConfig.businessId}/orders/quote`,
|
|
895
|
-
|
|
866
|
+
{ ...params, market: apiConfig.market },
|
|
896
867
|
options
|
|
897
868
|
);
|
|
898
869
|
},
|
|
899
870
|
async checkout(params, options) {
|
|
900
|
-
const payload = {
|
|
901
|
-
businessId: apiConfig.businessId,
|
|
902
|
-
market: apiConfig.market,
|
|
903
|
-
items: params.items,
|
|
904
|
-
blocks: params.blocks || [],
|
|
905
|
-
paymentMethodId: params.paymentMethodId,
|
|
906
|
-
shippingMethodId: params.shippingMethodId,
|
|
907
|
-
promoCodeId: params.promoCodeId,
|
|
908
|
-
shippingAddress: params.shippingAddress,
|
|
909
|
-
billingAddress: params.billingAddress
|
|
910
|
-
};
|
|
911
871
|
return apiConfig.httpClient.post(
|
|
912
872
|
`/v1/businesses/${apiConfig.businessId}/orders/checkout`,
|
|
913
|
-
|
|
873
|
+
{ ...params, businessId: apiConfig.businessId, market: apiConfig.market },
|
|
914
874
|
options
|
|
915
875
|
);
|
|
916
876
|
}
|
|
@@ -1145,9 +1105,41 @@ var createLocationApi = (apiConfig) => {
|
|
|
1145
1105
|
};
|
|
1146
1106
|
};
|
|
1147
1107
|
|
|
1148
|
-
// src/api/
|
|
1108
|
+
// src/api/crm.ts
|
|
1149
1109
|
var createCustomerApi = (apiConfig) => {
|
|
1150
1110
|
return {
|
|
1111
|
+
// Auth methods
|
|
1112
|
+
async requestCode(params, options) {
|
|
1113
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1114
|
+
return apiConfig.httpClient.post(
|
|
1115
|
+
`/v1/businesses/${businessId}/customers/auth/code`,
|
|
1116
|
+
{ email: params.email },
|
|
1117
|
+
options
|
|
1118
|
+
);
|
|
1119
|
+
},
|
|
1120
|
+
async verify(params, options) {
|
|
1121
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1122
|
+
return apiConfig.httpClient.post(
|
|
1123
|
+
`/v1/businesses/${businessId}/customers/auth/verify`,
|
|
1124
|
+
{ email: params.email, code: params.code },
|
|
1125
|
+
options
|
|
1126
|
+
);
|
|
1127
|
+
},
|
|
1128
|
+
async refreshToken(params, options) {
|
|
1129
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1130
|
+
return apiConfig.httpClient.post(
|
|
1131
|
+
`/v1/businesses/${businessId}/customers/auth/refresh`,
|
|
1132
|
+
{ refreshToken: params.refreshToken },
|
|
1133
|
+
options
|
|
1134
|
+
);
|
|
1135
|
+
},
|
|
1136
|
+
async getMe(options) {
|
|
1137
|
+
return apiConfig.httpClient.get(
|
|
1138
|
+
`/v1/businesses/${apiConfig.businessId}/customers/me`,
|
|
1139
|
+
options
|
|
1140
|
+
);
|
|
1141
|
+
},
|
|
1142
|
+
// CRUD methods
|
|
1151
1143
|
async create(params, options) {
|
|
1152
1144
|
return apiConfig.httpClient.post(
|
|
1153
1145
|
`/v1/businesses/${params.businessId || apiConfig.businessId}/customers`,
|
|
@@ -2065,7 +2057,7 @@ async function createArkySDK(config) {
|
|
|
2065
2057
|
eshop: createEshopApi(apiConfig),
|
|
2066
2058
|
booking: createBookingApi(apiConfig),
|
|
2067
2059
|
location: createLocationApi(apiConfig),
|
|
2068
|
-
|
|
2060
|
+
crm: createCustomerApi(apiConfig),
|
|
2069
2061
|
network: createNetworkApi(apiConfig),
|
|
2070
2062
|
workflow: createWorkflowApi(apiConfig),
|
|
2071
2063
|
audience: createAudienceApi(apiConfig),
|