arky-sdk 0.3.0 → 0.3.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/README.md +114 -0
- package/dist/{validation-C9UAYKke.d.cts → index-DEmVFs0E.d.ts} +20 -9
- package/dist/{validation-DIvAzYjG.d.ts → index-DOEos-hV.d.cts} +20 -9
- package/dist/index.cjs +1173 -815
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +393 -259
- package/dist/index.d.ts +393 -259
- package/dist/index.js +1152 -803
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +736 -2
- package/dist/types.d.ts +736 -2
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs +17 -34
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +1 -8
- package/dist/utils.d.ts +1 -8
- package/dist/utils.js +18 -34
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// src/config.ts
|
|
4
|
-
var globalConfig = null;
|
|
5
|
-
function setGlobalConfig(config) {
|
|
6
|
-
globalConfig = config;
|
|
7
|
-
}
|
|
8
|
-
function getGlobalConfig() {
|
|
9
|
-
if (!globalConfig) {
|
|
10
|
-
throw new Error(
|
|
11
|
-
"Arky SDK not initialized. Call initArky() first."
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
return globalConfig;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
3
|
// src/types/index.ts
|
|
18
4
|
var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
|
|
19
5
|
PaymentMethod2["Cash"] = "CASH";
|
|
@@ -22,725 +8,888 @@ var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
|
|
|
22
8
|
return PaymentMethod2;
|
|
23
9
|
})(PaymentMethod || {});
|
|
24
10
|
|
|
25
|
-
// src/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
async
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
11
|
+
// src/api/cms.ts
|
|
12
|
+
var createCmsApi = (apiConfig) => {
|
|
13
|
+
return {
|
|
14
|
+
// ===== COLLECTIONS =====
|
|
15
|
+
async createCollection(params, options) {
|
|
16
|
+
return apiConfig.httpClient.post(
|
|
17
|
+
`/v1/businesses/${apiConfig.businessId}/collections`,
|
|
18
|
+
params,
|
|
19
|
+
options
|
|
20
|
+
);
|
|
21
|
+
},
|
|
22
|
+
async updateCollection(params, options) {
|
|
23
|
+
return apiConfig.httpClient.put(
|
|
24
|
+
`/v1/businesses/${apiConfig.businessId}/collections/${params.id}`,
|
|
25
|
+
params,
|
|
26
|
+
options
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
async deleteCollection(params, options) {
|
|
30
|
+
return apiConfig.httpClient.delete(
|
|
31
|
+
`/v1/businesses/${apiConfig.businessId}/collections/${params.id}`,
|
|
32
|
+
options
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
async getCollection(params, options) {
|
|
36
|
+
return apiConfig.httpClient.get(
|
|
37
|
+
`/v1/businesses/${apiConfig.businessId}/collections/${params.id}`,
|
|
38
|
+
options
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
async getCollections(params, options) {
|
|
42
|
+
return apiConfig.httpClient.get(
|
|
43
|
+
`/v1/businesses/${apiConfig.businessId}/collections`,
|
|
44
|
+
{
|
|
45
|
+
...options,
|
|
46
|
+
params: params || {}
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
async generateBlocks(params, options) {
|
|
51
|
+
return apiConfig.httpClient.post(
|
|
52
|
+
`/v1/businesses/${apiConfig.businessId}/collections/blocks/generate`,
|
|
53
|
+
params,
|
|
54
|
+
options
|
|
55
|
+
);
|
|
56
|
+
},
|
|
57
|
+
// ===== ENTRIES =====
|
|
58
|
+
// Note: Backend uses /entries NOT /collections/{id}/entries
|
|
59
|
+
async getCollectionEntries(params, options) {
|
|
60
|
+
const { collectionId, ...queryParams } = params || {};
|
|
61
|
+
const finalParams = collectionId ? { ...queryParams, owner: `collection:${collectionId}` } : queryParams;
|
|
62
|
+
return apiConfig.httpClient.get(
|
|
63
|
+
`/v1/businesses/${apiConfig.businessId}/entries`,
|
|
64
|
+
{
|
|
65
|
+
...options,
|
|
66
|
+
params: finalParams
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
async createCollectionEntry(params, options) {
|
|
71
|
+
const { collectionId, owner, ...rest } = params;
|
|
72
|
+
const payload = {
|
|
73
|
+
...rest,
|
|
74
|
+
owner: owner || (collectionId ? `collection:${collectionId}` : void 0)
|
|
75
|
+
};
|
|
76
|
+
return apiConfig.httpClient.post(
|
|
77
|
+
`/v1/businesses/${apiConfig.businessId}/entries`,
|
|
78
|
+
payload,
|
|
79
|
+
options
|
|
80
|
+
);
|
|
81
|
+
},
|
|
82
|
+
async updateCollectionEntry(params, options) {
|
|
83
|
+
const { id, collectionId, owner, ...rest } = params;
|
|
84
|
+
const payload = {
|
|
85
|
+
...rest,
|
|
86
|
+
owner: owner || (collectionId ? `collection:${collectionId}` : void 0)
|
|
87
|
+
};
|
|
88
|
+
return apiConfig.httpClient.put(
|
|
89
|
+
`/v1/businesses/${apiConfig.businessId}/entries/${id}`,
|
|
90
|
+
payload,
|
|
91
|
+
options
|
|
92
|
+
);
|
|
93
|
+
},
|
|
94
|
+
async deleteCollectionEntry(params, options) {
|
|
95
|
+
return apiConfig.httpClient.delete(
|
|
96
|
+
`/v1/businesses/${apiConfig.businessId}/entries/${params.id}`,
|
|
97
|
+
options
|
|
98
|
+
);
|
|
99
|
+
},
|
|
100
|
+
async getCollectionEntry(params, options) {
|
|
101
|
+
return apiConfig.httpClient.get(
|
|
102
|
+
`/v1/businesses/${apiConfig.businessId}/entries/${params.id}`,
|
|
103
|
+
options
|
|
104
|
+
);
|
|
105
|
+
},
|
|
106
|
+
async sendEntry(params, options) {
|
|
107
|
+
const { entryId, scheduledAt } = params;
|
|
108
|
+
return apiConfig.httpClient.post(
|
|
109
|
+
`/v1/businesses/${apiConfig.businessId}/entries/${entryId}/send`,
|
|
110
|
+
{
|
|
111
|
+
businessId: apiConfig.businessId,
|
|
112
|
+
entryId,
|
|
113
|
+
scheduledAt: scheduledAt || Date.now()
|
|
114
|
+
},
|
|
115
|
+
options
|
|
116
|
+
);
|
|
117
|
+
},
|
|
118
|
+
// ===== VARIABLES / METADATA =====
|
|
119
|
+
async getVariableMetadata(params, options) {
|
|
120
|
+
return apiConfig.httpClient.get(
|
|
121
|
+
`/v1/collections/entry-types/${params.entryType}/variables`,
|
|
122
|
+
options
|
|
123
|
+
);
|
|
84
124
|
}
|
|
85
|
-
|
|
86
|
-
return {
|
|
87
|
-
value: responseData,
|
|
88
|
-
success: true
|
|
89
|
-
};
|
|
90
|
-
} catch (error) {
|
|
91
|
-
const errorMsg = error instanceof Error ? error.message : "Unknown error occurred";
|
|
92
|
-
return {
|
|
93
|
-
value: null,
|
|
94
|
-
success: false,
|
|
95
|
-
error: errorMsg
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
var httpClient = {
|
|
100
|
-
get,
|
|
101
|
-
post
|
|
125
|
+
};
|
|
102
126
|
};
|
|
103
|
-
var http_default = httpClient;
|
|
104
127
|
|
|
105
|
-
// src/api/
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
params
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
params
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
128
|
+
// src/api/eshop.ts
|
|
129
|
+
var createEshopApi = (apiConfig) => {
|
|
130
|
+
return {
|
|
131
|
+
// ===== PRODUCTS =====
|
|
132
|
+
async createProduct(params, options) {
|
|
133
|
+
return apiConfig.httpClient.post(
|
|
134
|
+
`/v1/businesses/${apiConfig.businessId}/products`,
|
|
135
|
+
params,
|
|
136
|
+
options
|
|
137
|
+
);
|
|
138
|
+
},
|
|
139
|
+
async updateProduct(params, options) {
|
|
140
|
+
return apiConfig.httpClient.put(
|
|
141
|
+
`/v1/businesses/${apiConfig.businessId}/products/${params.id}`,
|
|
142
|
+
params,
|
|
143
|
+
options
|
|
144
|
+
);
|
|
145
|
+
},
|
|
146
|
+
async deleteProduct(id, options) {
|
|
147
|
+
return apiConfig.httpClient.delete(
|
|
148
|
+
`/v1/businesses/${apiConfig.businessId}/products/${id}`,
|
|
149
|
+
options
|
|
150
|
+
);
|
|
151
|
+
},
|
|
152
|
+
async getProduct(params, options) {
|
|
153
|
+
return apiConfig.httpClient.get(
|
|
154
|
+
`/v1/businesses/${apiConfig.businessId}/products/${params.id}`,
|
|
155
|
+
options
|
|
156
|
+
);
|
|
157
|
+
},
|
|
158
|
+
async getProducts(params, options) {
|
|
159
|
+
const queryParams = params ? { ...params } : {};
|
|
160
|
+
return apiConfig.httpClient.get(
|
|
161
|
+
`/v1/businesses/${encodeURIComponent(apiConfig.businessId)}/products`,
|
|
162
|
+
{
|
|
163
|
+
...options,
|
|
164
|
+
params: queryParams
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
},
|
|
168
|
+
async getProductBySlug(params, options) {
|
|
169
|
+
const { businessId, slug } = params;
|
|
170
|
+
return apiConfig.httpClient.get(
|
|
171
|
+
`/v1/businesses/${encodeURIComponent(businessId)}/products/slug/${encodeURIComponent(businessId)}/${encodeURIComponent(slug)}`,
|
|
172
|
+
options
|
|
173
|
+
);
|
|
174
|
+
},
|
|
175
|
+
// ===== ORDERS =====
|
|
176
|
+
async createOrder(params, options) {
|
|
177
|
+
return apiConfig.httpClient.post(
|
|
178
|
+
`/v1/businesses/${apiConfig.businessId}/orders`,
|
|
179
|
+
params,
|
|
180
|
+
options
|
|
181
|
+
);
|
|
182
|
+
},
|
|
183
|
+
async updateOrder(params, options) {
|
|
184
|
+
return apiConfig.httpClient.put(
|
|
185
|
+
`/v1/businesses/${apiConfig.businessId}/orders/update`,
|
|
186
|
+
params,
|
|
187
|
+
options
|
|
188
|
+
);
|
|
189
|
+
},
|
|
190
|
+
async getOrder(params, options) {
|
|
191
|
+
return apiConfig.httpClient.get(
|
|
192
|
+
`/v1/businesses/${apiConfig.businessId}/orders/${params.id}`,
|
|
193
|
+
options
|
|
194
|
+
);
|
|
195
|
+
},
|
|
196
|
+
async getOrders(params, options) {
|
|
197
|
+
return apiConfig.httpClient.get(
|
|
198
|
+
`/v1/businesses/${apiConfig.businessId}/orders`,
|
|
199
|
+
{
|
|
200
|
+
...options,
|
|
201
|
+
params: params || {}
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
},
|
|
205
|
+
async updateOrderStatus(params, options) {
|
|
206
|
+
return apiConfig.httpClient.put(
|
|
207
|
+
`/v1/businesses/${apiConfig.businessId}/orders/${params.id}/status`,
|
|
208
|
+
params,
|
|
209
|
+
options
|
|
210
|
+
);
|
|
211
|
+
},
|
|
212
|
+
async updateOrderPaymentStatus(params, options) {
|
|
213
|
+
return apiConfig.httpClient.put(
|
|
214
|
+
`/v1/businesses/${apiConfig.businessId}/orders/${params.id}/payment-status`,
|
|
215
|
+
params,
|
|
216
|
+
options
|
|
217
|
+
);
|
|
218
|
+
},
|
|
219
|
+
// ===== PAYMENTS =====
|
|
220
|
+
async getQuote(params, options) {
|
|
221
|
+
const lines = params.items.map((item) => ({
|
|
222
|
+
type: "PRODUCT_VARIANT",
|
|
223
|
+
productId: item.productId,
|
|
224
|
+
variantId: item.variantId,
|
|
225
|
+
quantity: item.quantity
|
|
226
|
+
}));
|
|
227
|
+
const payload = {
|
|
228
|
+
businessId: apiConfig.businessId,
|
|
229
|
+
market: params.market,
|
|
230
|
+
currency: params.currency,
|
|
231
|
+
paymentMethod: params.paymentMethod,
|
|
232
|
+
lines,
|
|
233
|
+
...params.shippingMethodId && { shippingMethodId: params.shippingMethodId },
|
|
234
|
+
...params.promoCode && { promoCode: params.promoCode }
|
|
235
|
+
};
|
|
236
|
+
return apiConfig.httpClient.post(`/v1/payments/quote`, payload, options);
|
|
237
|
+
},
|
|
238
|
+
async checkout(params, options) {
|
|
239
|
+
const payload = {
|
|
240
|
+
businessId: apiConfig.businessId,
|
|
241
|
+
market: params.market,
|
|
242
|
+
paymentMethod: params.paymentMethod,
|
|
243
|
+
shippingMethodId: params.shippingMethodId,
|
|
244
|
+
items: params.items,
|
|
245
|
+
blocks: params.blocks || [],
|
|
246
|
+
...params.promoCode && { promoCode: params.promoCode }
|
|
247
|
+
};
|
|
248
|
+
return apiConfig.httpClient.post(
|
|
249
|
+
`/v1/businesses/${apiConfig.businessId}/orders/checkout`,
|
|
250
|
+
payload,
|
|
251
|
+
options
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
};
|
|
154
255
|
};
|
|
155
256
|
|
|
156
257
|
// src/api/reservation.ts
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
258
|
+
var createReservationApi = (apiConfig) => {
|
|
259
|
+
return {
|
|
260
|
+
// ===== RESERVATIONS =====
|
|
261
|
+
async createReservation(params, options) {
|
|
262
|
+
return apiConfig.httpClient.post(`/v1/reservations`, params, {
|
|
263
|
+
successMessage: "Reservation created successfully",
|
|
264
|
+
errorMessage: "Failed to create reservation",
|
|
265
|
+
...options
|
|
266
|
+
});
|
|
267
|
+
},
|
|
268
|
+
async updateReservation(params, options) {
|
|
269
|
+
const { id, ...payload } = params;
|
|
270
|
+
return apiConfig.httpClient.put(`/v1/reservations/${id}`, payload, {
|
|
271
|
+
successMessage: "Reservation updated successfully",
|
|
272
|
+
errorMessage: "Failed to update reservation",
|
|
273
|
+
...options
|
|
274
|
+
});
|
|
275
|
+
},
|
|
276
|
+
async checkout(params, options) {
|
|
277
|
+
const payload = {
|
|
278
|
+
businessId: apiConfig.businessId,
|
|
279
|
+
blocks: params.blocks || [],
|
|
280
|
+
market: params.market || "US",
|
|
281
|
+
parts: params.parts,
|
|
282
|
+
...params.paymentMethod && { paymentMethod: params.paymentMethod },
|
|
283
|
+
...params.promoCode && { promoCode: params.promoCode }
|
|
284
|
+
};
|
|
285
|
+
return apiConfig.httpClient.post(`/v1/reservations/checkout`, payload, {
|
|
286
|
+
successMessage: "Reservation checkout completed",
|
|
287
|
+
errorMessage: "Failed to complete checkout",
|
|
288
|
+
...options
|
|
289
|
+
});
|
|
290
|
+
},
|
|
291
|
+
async getReservation(params, options) {
|
|
292
|
+
return apiConfig.httpClient.get(`/v1/reservations/${params.id}`, {
|
|
293
|
+
...options,
|
|
294
|
+
params: params.businessId ? { businessId: params.businessId } : {}
|
|
295
|
+
});
|
|
296
|
+
},
|
|
297
|
+
async getReservationParts(params, options) {
|
|
298
|
+
return apiConfig.httpClient.get(`/v1/reservations/parts`, {
|
|
299
|
+
...options,
|
|
300
|
+
params: params || {}
|
|
301
|
+
});
|
|
302
|
+
},
|
|
303
|
+
async searchReservations(params, options) {
|
|
304
|
+
return apiConfig.httpClient.get(`/v1/reservations/search`, {
|
|
305
|
+
...options,
|
|
306
|
+
params
|
|
307
|
+
});
|
|
308
|
+
},
|
|
309
|
+
async searchMyReservations(params, options) {
|
|
310
|
+
return apiConfig.httpClient.get(`/v1/reservations`, {
|
|
311
|
+
...options,
|
|
312
|
+
params: params || {}
|
|
313
|
+
});
|
|
314
|
+
},
|
|
315
|
+
// ===== QUOTES =====
|
|
316
|
+
async getQuote(params, options) {
|
|
317
|
+
const lines = params.parts.map((part) => ({
|
|
172
318
|
type: "SERVICE",
|
|
173
319
|
serviceId: part.serviceId,
|
|
174
320
|
quantity: 1
|
|
175
321
|
}));
|
|
176
322
|
const payload = {
|
|
177
|
-
businessId,
|
|
178
|
-
market,
|
|
179
|
-
currency,
|
|
180
|
-
|
|
181
|
-
paymentMethod,
|
|
323
|
+
businessId: apiConfig.businessId,
|
|
324
|
+
market: params.market,
|
|
325
|
+
currency: params.currency,
|
|
326
|
+
paymentMethod: params.paymentMethod,
|
|
182
327
|
lines,
|
|
183
|
-
promoCode: promoCode
|
|
184
|
-
shippingMethodId: null
|
|
328
|
+
...params.promoCode && { promoCode: params.promoCode }
|
|
185
329
|
};
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
const json = JSON.parse(text);
|
|
198
|
-
return { success: false, error: json.reason || json.error || "Failed to fetch quote", code: json.code };
|
|
199
|
-
} catch {
|
|
200
|
-
return { success: false, error: text || "Failed to fetch quote" };
|
|
330
|
+
return apiConfig.httpClient.post(`/v1/payments/quote`, payload, options);
|
|
331
|
+
},
|
|
332
|
+
// ===== SERVICES =====
|
|
333
|
+
async createService(params, options) {
|
|
334
|
+
return apiConfig.httpClient.post(
|
|
335
|
+
`/v1/businesses/${apiConfig.businessId}/services`,
|
|
336
|
+
params,
|
|
337
|
+
{
|
|
338
|
+
successMessage: "Service created successfully",
|
|
339
|
+
errorMessage: "Failed to create service",
|
|
340
|
+
...options
|
|
201
341
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
const
|
|
233
|
-
return
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
342
|
+
);
|
|
343
|
+
},
|
|
344
|
+
async updateService(params, options) {
|
|
345
|
+
return apiConfig.httpClient.put(
|
|
346
|
+
`/v1/businesses/${apiConfig.businessId}/services/${params.id}`,
|
|
347
|
+
params,
|
|
348
|
+
{
|
|
349
|
+
successMessage: "Service updated successfully",
|
|
350
|
+
errorMessage: "Failed to update service",
|
|
351
|
+
...options
|
|
352
|
+
}
|
|
353
|
+
);
|
|
354
|
+
},
|
|
355
|
+
async deleteService(params, options) {
|
|
356
|
+
return apiConfig.httpClient.delete(
|
|
357
|
+
`/v1/businesses/${apiConfig.businessId}/services/${params.id}`,
|
|
358
|
+
{
|
|
359
|
+
successMessage: "Service deleted successfully",
|
|
360
|
+
errorMessage: "Failed to delete service",
|
|
361
|
+
...options
|
|
362
|
+
}
|
|
363
|
+
);
|
|
364
|
+
},
|
|
365
|
+
async getService(params, options) {
|
|
366
|
+
return apiConfig.httpClient.get(
|
|
367
|
+
`/v1/businesses/${apiConfig.businessId}/services/${params.id}`,
|
|
368
|
+
options
|
|
369
|
+
);
|
|
370
|
+
},
|
|
371
|
+
async getServices(params, options) {
|
|
372
|
+
const queryParams = params ? { ...params } : {};
|
|
373
|
+
return apiConfig.httpClient.get(
|
|
374
|
+
`/v1/businesses/${apiConfig.businessId}/services`,
|
|
375
|
+
{
|
|
376
|
+
...options,
|
|
377
|
+
params: queryParams
|
|
378
|
+
}
|
|
379
|
+
);
|
|
380
|
+
},
|
|
381
|
+
async getAvailableSlots(params, options) {
|
|
382
|
+
const { serviceId, ...queryParams } = params;
|
|
383
|
+
return apiConfig.httpClient.get(
|
|
384
|
+
`/v1/businesses/${apiConfig.businessId}/services/${serviceId}/available-slots`,
|
|
385
|
+
{
|
|
386
|
+
...options,
|
|
387
|
+
params: {
|
|
388
|
+
...queryParams,
|
|
389
|
+
limit: queryParams.limit || 1e3
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
);
|
|
393
|
+
},
|
|
394
|
+
// ===== PROVIDERS =====
|
|
395
|
+
async createProvider(params, options) {
|
|
396
|
+
return apiConfig.httpClient.post(
|
|
397
|
+
`/v1/businesses/${apiConfig.businessId}/providers`,
|
|
398
|
+
params,
|
|
399
|
+
{
|
|
400
|
+
successMessage: "Provider created successfully",
|
|
401
|
+
errorMessage: "Failed to create provider",
|
|
402
|
+
...options
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
},
|
|
406
|
+
async updateProvider(params, options) {
|
|
407
|
+
return apiConfig.httpClient.put(
|
|
408
|
+
`/v1/businesses/${apiConfig.businessId}/providers/${params.id}`,
|
|
409
|
+
params,
|
|
410
|
+
{
|
|
411
|
+
successMessage: "Provider updated successfully",
|
|
412
|
+
errorMessage: "Failed to update provider",
|
|
413
|
+
...options
|
|
414
|
+
}
|
|
415
|
+
);
|
|
416
|
+
},
|
|
417
|
+
async deleteProvider(params, options) {
|
|
418
|
+
return apiConfig.httpClient.delete(
|
|
419
|
+
`/v1/businesses/${apiConfig.businessId}/providers/${params.id}`,
|
|
420
|
+
{
|
|
421
|
+
successMessage: "Provider deleted successfully",
|
|
422
|
+
errorMessage: "Failed to delete provider",
|
|
423
|
+
...options
|
|
424
|
+
}
|
|
425
|
+
);
|
|
426
|
+
},
|
|
427
|
+
async getProvider(params, options) {
|
|
428
|
+
return apiConfig.httpClient.get(
|
|
429
|
+
`/v1/businesses/${apiConfig.businessId}/providers/${params.id}`,
|
|
430
|
+
options
|
|
431
|
+
);
|
|
432
|
+
},
|
|
433
|
+
async getProviders(params, options) {
|
|
434
|
+
const { businessId, ...queryParams } = params;
|
|
435
|
+
return apiConfig.httpClient.get(
|
|
436
|
+
`/v1/businesses/${apiConfig.businessId}/providers`,
|
|
437
|
+
{
|
|
438
|
+
...options,
|
|
439
|
+
params: queryParams
|
|
440
|
+
}
|
|
441
|
+
);
|
|
442
|
+
},
|
|
443
|
+
async getProviderWorkingTime(params, options) {
|
|
444
|
+
const { businessId, providerId, ...queryParams } = params;
|
|
445
|
+
return apiConfig.httpClient.get(
|
|
446
|
+
`/v1/businesses/${apiConfig.businessId}/providers/${providerId}/working-time`,
|
|
447
|
+
{
|
|
448
|
+
...options,
|
|
449
|
+
params: queryParams
|
|
450
|
+
}
|
|
451
|
+
);
|
|
269
452
|
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
// src/api/newsletter.ts
|
|
457
|
+
var createNewsletterApi = (apiConfig) => {
|
|
458
|
+
return {
|
|
459
|
+
// ===== NEWSLETTERS =====
|
|
460
|
+
async find(params, options) {
|
|
461
|
+
return apiConfig.httpClient.get(`/v1/newsletters`, {
|
|
462
|
+
...options,
|
|
463
|
+
params: { businessId: params.businessId }
|
|
279
464
|
});
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
return {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
465
|
+
},
|
|
466
|
+
async get(params, options) {
|
|
467
|
+
return apiConfig.httpClient.get(`/v1/newsletters/${params.id}`, options);
|
|
468
|
+
},
|
|
469
|
+
async create(params, options) {
|
|
470
|
+
return apiConfig.httpClient.post(`/v1/newsletters`, params, options);
|
|
471
|
+
},
|
|
472
|
+
async update(params, options) {
|
|
473
|
+
return apiConfig.httpClient.put(`/v1/newsletters/${params.id}`, params, options);
|
|
474
|
+
},
|
|
475
|
+
async delete(params, options) {
|
|
476
|
+
return apiConfig.httpClient.delete(`/v1/newsletters/${params.id}`, options);
|
|
477
|
+
},
|
|
478
|
+
// ===== SUBSCRIBERS =====
|
|
479
|
+
async getSubscribers(params, options) {
|
|
480
|
+
return apiConfig.httpClient.get(`/v1/newsletters/${params.id}/subscribers`, options);
|
|
481
|
+
},
|
|
482
|
+
async subscribe(params, options) {
|
|
483
|
+
const { newsletterId, email, customerId, payment } = params;
|
|
484
|
+
const payload = {
|
|
485
|
+
newsletterId,
|
|
486
|
+
email,
|
|
487
|
+
market: "US",
|
|
488
|
+
...customerId && { customerId },
|
|
489
|
+
...payment && { payment }
|
|
290
490
|
};
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
phoneNumber,
|
|
305
|
-
phoneNumbers: [],
|
|
306
|
-
addresses: []
|
|
307
|
-
})
|
|
491
|
+
return apiConfig.httpClient.post(
|
|
492
|
+
`/v1/newsletters/${newsletterId}/subscribe`,
|
|
493
|
+
payload,
|
|
494
|
+
options
|
|
495
|
+
);
|
|
496
|
+
},
|
|
497
|
+
async unsubscribe(params, options) {
|
|
498
|
+
return apiConfig.httpClient.post(`/v1/newsletters/unsubscribe`, params, options);
|
|
499
|
+
},
|
|
500
|
+
async unsubscribeWithToken(params, options) {
|
|
501
|
+
return apiConfig.httpClient.get(`/v1/newsletters/unsubscribe`, {
|
|
502
|
+
...options,
|
|
503
|
+
params
|
|
308
504
|
});
|
|
309
|
-
if (!res.ok) {
|
|
310
|
-
const error = await res.text() || res.statusText;
|
|
311
|
-
return {
|
|
312
|
-
success: false,
|
|
313
|
-
error
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
return {
|
|
317
|
-
success: true
|
|
318
|
-
};
|
|
319
|
-
} catch (e) {
|
|
320
|
-
return {
|
|
321
|
-
success: false,
|
|
322
|
-
error: e.message
|
|
323
|
-
};
|
|
324
505
|
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
})
|
|
340
|
-
});
|
|
341
|
-
if (!res.ok) {
|
|
342
|
-
const error = await res.text() || res.statusText;
|
|
343
|
-
return {
|
|
344
|
-
success: false,
|
|
345
|
-
error
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
return {
|
|
349
|
-
success: true
|
|
350
|
-
};
|
|
351
|
-
} catch (e) {
|
|
352
|
-
return {
|
|
353
|
-
success: false,
|
|
354
|
-
error: e.message
|
|
506
|
+
};
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
// src/api/user.ts
|
|
510
|
+
var createUserApi = (apiConfig) => {
|
|
511
|
+
return {
|
|
512
|
+
// ===== USER PROFILE =====
|
|
513
|
+
async updateUser(params, options) {
|
|
514
|
+
const payload = {
|
|
515
|
+
name: params.name,
|
|
516
|
+
phoneNumbers: params.phoneNumbers || [],
|
|
517
|
+
phoneNumber: params.phoneNumber || null,
|
|
518
|
+
addresses: params.addresses || [],
|
|
519
|
+
...params.apiTokens !== void 0 && { apiTokens: params.apiTokens }
|
|
355
520
|
};
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
async checkout({
|
|
360
|
-
token,
|
|
361
|
-
businessId,
|
|
362
|
-
parts,
|
|
363
|
-
paymentMethod = "CASH",
|
|
364
|
-
blocks = [],
|
|
365
|
-
market = "US",
|
|
366
|
-
promoCode
|
|
367
|
-
}) {
|
|
368
|
-
try {
|
|
369
|
-
const config = getGlobalConfig();
|
|
521
|
+
return apiConfig.httpClient.put("/v1/users/update", payload, options);
|
|
522
|
+
},
|
|
523
|
+
async updateProfilePhone(params, options) {
|
|
370
524
|
const payload = {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
parts: parts.map((p) => ({
|
|
375
|
-
serviceId: p.serviceId,
|
|
376
|
-
from: p.from,
|
|
377
|
-
to: p.to,
|
|
378
|
-
blocks: p.blocks,
|
|
379
|
-
reservationMethod: p.reservationMethod,
|
|
380
|
-
providerId: p.providerId
|
|
381
|
-
}))
|
|
525
|
+
phoneNumbers: [],
|
|
526
|
+
phoneNumber: params.phoneNumber,
|
|
527
|
+
addresses: []
|
|
382
528
|
};
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
529
|
+
return apiConfig.httpClient.put("/v1/users/update", payload, options);
|
|
530
|
+
},
|
|
531
|
+
async verifyPhoneCode(params, options) {
|
|
532
|
+
return apiConfig.httpClient.put("/v1/users/confirm/phone-number", params, options);
|
|
533
|
+
},
|
|
534
|
+
async getUserLocation(options) {
|
|
535
|
+
return apiConfig.httpClient.get("/v1/users/location", options);
|
|
536
|
+
},
|
|
537
|
+
async getMe(options) {
|
|
538
|
+
return apiConfig.httpClient.get("/v1/users/me", options);
|
|
539
|
+
},
|
|
540
|
+
async searchUsers(params, options) {
|
|
541
|
+
return apiConfig.httpClient.get("/v1/users/search", {
|
|
542
|
+
...options,
|
|
543
|
+
params
|
|
544
|
+
});
|
|
545
|
+
},
|
|
546
|
+
async setUserRole(params, options) {
|
|
547
|
+
return apiConfig.httpClient.put("/v1/users/set-role", params, options);
|
|
548
|
+
},
|
|
549
|
+
// ===== AUTHENTICATION =====
|
|
550
|
+
async loginUser(params, options) {
|
|
551
|
+
return apiConfig.httpClient.post("/v1/users/login", params, options);
|
|
552
|
+
},
|
|
553
|
+
async registerUser(params, options) {
|
|
554
|
+
return apiConfig.httpClient.post("/v1/users/register", params, options);
|
|
555
|
+
},
|
|
556
|
+
async logout(options) {
|
|
557
|
+
return apiConfig.httpClient.post("/v1/users/logout", {}, options);
|
|
558
|
+
},
|
|
559
|
+
async confirmUser(params, options) {
|
|
560
|
+
return apiConfig.httpClient.put("/v1/users/confirm", params, options);
|
|
561
|
+
},
|
|
562
|
+
async getLoginUrl(params, options) {
|
|
563
|
+
return apiConfig.httpClient.get("/v1/users/login/url", {
|
|
564
|
+
...options,
|
|
565
|
+
params
|
|
396
566
|
});
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
567
|
+
},
|
|
568
|
+
async getGuestToken(params, options) {
|
|
569
|
+
if (params.existingToken) {
|
|
570
|
+
return params.existingToken;
|
|
400
571
|
}
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
return
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
572
|
+
const result = await apiConfig.httpClient.post("/v1/users/login", {
|
|
573
|
+
provider: "GUEST"
|
|
574
|
+
}, options);
|
|
575
|
+
const token = result.accessToken || result.token || "";
|
|
576
|
+
if (token) {
|
|
577
|
+
apiConfig.setTokens(result);
|
|
578
|
+
}
|
|
579
|
+
return token;
|
|
580
|
+
},
|
|
581
|
+
// ===== PASSWORD MANAGEMENT =====
|
|
582
|
+
async forgotPassword(params, options) {
|
|
583
|
+
return apiConfig.httpClient.post("/v1/users/forgot-password", params, options);
|
|
584
|
+
},
|
|
585
|
+
async resetForgotPassword(params, options) {
|
|
586
|
+
return apiConfig.httpClient.post("/v1/users/reset-forgot-password", params, options);
|
|
587
|
+
},
|
|
588
|
+
async resetPassword(params, options) {
|
|
589
|
+
return apiConfig.httpClient.post("/v1/users/reset-password", params, options);
|
|
412
590
|
}
|
|
413
|
-
}
|
|
591
|
+
};
|
|
414
592
|
};
|
|
415
593
|
|
|
416
|
-
// src/api/
|
|
417
|
-
var
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
params
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
return {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
return {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
};
|
|
465
|
-
} catch (e) {
|
|
466
|
-
console.error("Error fetching product:", e);
|
|
467
|
-
return {
|
|
468
|
-
success: false,
|
|
469
|
-
error: e.message,
|
|
470
|
-
data: null
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
},
|
|
474
|
-
// Get quote for cart (pricing with promo codes, shipping, taxes)
|
|
475
|
-
async getQuote({
|
|
476
|
-
token,
|
|
477
|
-
businessId,
|
|
478
|
-
items,
|
|
479
|
-
market,
|
|
480
|
-
currency,
|
|
481
|
-
userId,
|
|
482
|
-
paymentMethod,
|
|
483
|
-
shippingMethodId,
|
|
484
|
-
promoCode
|
|
485
|
-
}) {
|
|
486
|
-
try {
|
|
487
|
-
const config = getGlobalConfig();
|
|
488
|
-
const lines = items.map((item) => ({
|
|
489
|
-
type: "PRODUCT_VARIANT",
|
|
490
|
-
productId: item.productId,
|
|
491
|
-
variantId: item.variantId,
|
|
492
|
-
quantity: item.quantity
|
|
493
|
-
}));
|
|
494
|
-
const payload = {
|
|
495
|
-
businessId,
|
|
496
|
-
market,
|
|
497
|
-
currency,
|
|
498
|
-
userId,
|
|
499
|
-
paymentMethod,
|
|
500
|
-
lines,
|
|
501
|
-
...shippingMethodId && { shippingMethodId },
|
|
502
|
-
...promoCode && { promoCode }
|
|
503
|
-
};
|
|
504
|
-
const res = await fetch(`${config.apiUrl}/v1/payments/quote`, {
|
|
505
|
-
method: "POST",
|
|
506
|
-
headers: {
|
|
507
|
-
"Content-Type": "application/json",
|
|
508
|
-
Authorization: `Bearer ${token}`
|
|
509
|
-
},
|
|
510
|
-
body: JSON.stringify(payload)
|
|
594
|
+
// src/api/business.ts
|
|
595
|
+
var createBusinessApi = (apiConfig) => {
|
|
596
|
+
return {
|
|
597
|
+
async createBusiness(params, options) {
|
|
598
|
+
return apiConfig.httpClient.post(`/v1/businesses`, params, options);
|
|
599
|
+
},
|
|
600
|
+
async updateBusiness(params, options) {
|
|
601
|
+
return apiConfig.httpClient.put(`/v1/businesses/${params.id}`, params, options);
|
|
602
|
+
},
|
|
603
|
+
async deleteBusiness(params, options) {
|
|
604
|
+
return apiConfig.httpClient.delete(`/v1/businesses/${params.id}`, options);
|
|
605
|
+
},
|
|
606
|
+
async getBusiness(params, options) {
|
|
607
|
+
return apiConfig.httpClient.get(`/v1/businesses/${params.id}`, options);
|
|
608
|
+
},
|
|
609
|
+
async getBusinesses(options) {
|
|
610
|
+
return apiConfig.httpClient.get(`/v1/businesses`, options);
|
|
611
|
+
},
|
|
612
|
+
async getBusinessParents(params, options) {
|
|
613
|
+
return apiConfig.httpClient.get(`/v1/businesses/${params.businessId}/parents`, options);
|
|
614
|
+
},
|
|
615
|
+
async triggerBuilds(params, options) {
|
|
616
|
+
return apiConfig.httpClient.post(`/v1/businesses/${params.id}/trigger-builds`, {}, options);
|
|
617
|
+
},
|
|
618
|
+
async getSubscriptionPlans(options) {
|
|
619
|
+
return apiConfig.httpClient.get("/v1/businesses/plans", options);
|
|
620
|
+
},
|
|
621
|
+
async getSubscription(params, options) {
|
|
622
|
+
return apiConfig.httpClient.get(`/v1/businesses/${params.businessId}/subscription`, options);
|
|
623
|
+
},
|
|
624
|
+
async createSubscription(params, options) {
|
|
625
|
+
return apiConfig.httpClient.post(
|
|
626
|
+
`/v1/businesses/${params.businessId}/subscription`,
|
|
627
|
+
params,
|
|
628
|
+
options
|
|
629
|
+
);
|
|
630
|
+
},
|
|
631
|
+
async updateSubscription(params, options) {
|
|
632
|
+
return apiConfig.httpClient.put(
|
|
633
|
+
`/v1/businesses/${params.businessId}/subscription`,
|
|
634
|
+
params,
|
|
635
|
+
options
|
|
636
|
+
);
|
|
637
|
+
},
|
|
638
|
+
async cancelSubscription(params, options) {
|
|
639
|
+
return apiConfig.httpClient.delete(`/v1/businesses/${params.businessId}/subscription`, {
|
|
640
|
+
...options,
|
|
641
|
+
params: { immediately: params.immediately || false }
|
|
511
642
|
});
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
643
|
+
},
|
|
644
|
+
async reactivateSubscription(params, options) {
|
|
645
|
+
return apiConfig.httpClient.post(
|
|
646
|
+
`/v1/businesses/${params.businessId}/subscription/reactivate`,
|
|
647
|
+
params,
|
|
648
|
+
options
|
|
649
|
+
);
|
|
650
|
+
},
|
|
651
|
+
async createPortalSession(params, options) {
|
|
652
|
+
return apiConfig.httpClient.post(
|
|
653
|
+
`/v1/businesses/${params.businessId}/subscription/portal`,
|
|
654
|
+
params,
|
|
655
|
+
options
|
|
656
|
+
);
|
|
657
|
+
},
|
|
658
|
+
async inviteUser(params, options) {
|
|
659
|
+
const { businessId, ...payload } = params;
|
|
660
|
+
return apiConfig.httpClient.post(
|
|
661
|
+
`/v1/businesses/${businessId}/invitation`,
|
|
662
|
+
payload,
|
|
663
|
+
options
|
|
664
|
+
);
|
|
665
|
+
},
|
|
666
|
+
async handleInvitation(params, options) {
|
|
667
|
+
const { businessId, ...payload } = params;
|
|
668
|
+
return apiConfig.httpClient.put(
|
|
669
|
+
`/v1/businesses/${businessId}/invitation`,
|
|
670
|
+
payload,
|
|
671
|
+
options
|
|
672
|
+
);
|
|
673
|
+
},
|
|
674
|
+
async testWebhook(params, options) {
|
|
675
|
+
return apiConfig.httpClient.post(
|
|
676
|
+
`/v1/businesses/${params.businessId}/webhooks/test`,
|
|
677
|
+
params.webhook,
|
|
678
|
+
options
|
|
679
|
+
);
|
|
680
|
+
},
|
|
681
|
+
async getBusinessMedia(params, options) {
|
|
682
|
+
return apiConfig.httpClient.get(
|
|
683
|
+
`/v1/businesses/${params.id}/media`,
|
|
684
|
+
{
|
|
685
|
+
...options,
|
|
686
|
+
params: {
|
|
687
|
+
cursor: params.cursor,
|
|
688
|
+
limit: params.limit || 20
|
|
689
|
+
}
|
|
519
690
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
691
|
+
);
|
|
692
|
+
},
|
|
693
|
+
async setProviderSchedule(params, options) {
|
|
694
|
+
const { id, ...payload } = params;
|
|
695
|
+
return apiConfig.httpClient.put(
|
|
696
|
+
`/v1/businesses/${id}/schedules`,
|
|
697
|
+
payload,
|
|
698
|
+
options
|
|
699
|
+
);
|
|
529
700
|
}
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
const config = getGlobalConfig();
|
|
545
|
-
const payload = {
|
|
546
|
-
businessId,
|
|
547
|
-
items,
|
|
548
|
-
paymentMethod,
|
|
549
|
-
blocks,
|
|
550
|
-
market,
|
|
551
|
-
...shippingMethodId && { shippingMethodId },
|
|
552
|
-
...promoCode && { promoCode },
|
|
553
|
-
...paymentIntentId && { paymentIntentId }
|
|
554
|
-
};
|
|
555
|
-
const res = await fetch(`${config.apiUrl}/v1/businesses/${encodeURIComponent(businessId)}/orders/checkout`, {
|
|
701
|
+
};
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
// src/api/media.ts
|
|
705
|
+
var createMediaApi = (apiConfig) => {
|
|
706
|
+
return {
|
|
707
|
+
async uploadBusinessMedia(params) {
|
|
708
|
+
const { businessId, files = [], urls = [] } = params;
|
|
709
|
+
const url = `${apiConfig.baseUrl}/v1/businesses/${businessId}/upload`;
|
|
710
|
+
const formData = new FormData();
|
|
711
|
+
files.forEach((file) => formData.append("files", file));
|
|
712
|
+
urls.forEach((url2) => formData.append("files", url2));
|
|
713
|
+
const tokens = await apiConfig.getTokens();
|
|
714
|
+
const response = await fetch(url, {
|
|
556
715
|
method: "POST",
|
|
716
|
+
body: formData,
|
|
557
717
|
headers: {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
},
|
|
561
|
-
body: JSON.stringify(payload)
|
|
718
|
+
Authorization: `Bearer ${tokens.accessToken}`
|
|
719
|
+
}
|
|
562
720
|
});
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
721
|
+
if (!response.ok) {
|
|
722
|
+
throw new Error("Upload failed, server said no");
|
|
723
|
+
}
|
|
724
|
+
return await response.json();
|
|
725
|
+
},
|
|
726
|
+
async deleteBusinessMedia(params, options) {
|
|
727
|
+
const { id, mediaId } = params;
|
|
728
|
+
return apiConfig.httpClient.delete(
|
|
729
|
+
`/v1/businesses/${id}/upload`,
|
|
730
|
+
{
|
|
731
|
+
...options,
|
|
732
|
+
params: { mediaId }
|
|
570
733
|
}
|
|
734
|
+
);
|
|
735
|
+
},
|
|
736
|
+
async getBusinessMedia(params) {
|
|
737
|
+
const { businessId, cursor = null, limit = 20 } = params;
|
|
738
|
+
const url = `${apiConfig.baseUrl}/v1/businesses/${businessId}/media`;
|
|
739
|
+
const queryParams = { limit };
|
|
740
|
+
if (cursor) queryParams.cursor = cursor;
|
|
741
|
+
const queryString = new URLSearchParams(queryParams).toString();
|
|
742
|
+
const response = await fetch(`${url}?${queryString}`);
|
|
743
|
+
if (!response.ok) {
|
|
744
|
+
const errorData = await response.json().catch(() => null);
|
|
745
|
+
throw new Error(errorData?.message || "Failed to fetch media");
|
|
571
746
|
}
|
|
572
|
-
|
|
573
|
-
return { success: true, data: json };
|
|
574
|
-
} catch (e) {
|
|
575
|
-
return {
|
|
576
|
-
success: false,
|
|
577
|
-
error: e.message
|
|
578
|
-
};
|
|
747
|
+
return await response.json();
|
|
579
748
|
}
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
749
|
+
};
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
// src/api/role.ts
|
|
753
|
+
var createRoleApi = (apiConfig) => {
|
|
754
|
+
return {
|
|
755
|
+
async createRole(params, options) {
|
|
756
|
+
return apiConfig.httpClient.post(`/v1/roles`, params, options);
|
|
757
|
+
},
|
|
758
|
+
async updateRole(params, options) {
|
|
759
|
+
return apiConfig.httpClient.put(`/v1/roles/${params.id}`, params, options);
|
|
760
|
+
},
|
|
761
|
+
async deleteRole(params, options) {
|
|
762
|
+
return apiConfig.httpClient.delete(`/v1/roles/${params.id}`, options);
|
|
763
|
+
},
|
|
764
|
+
async getRole(params, options) {
|
|
765
|
+
return apiConfig.httpClient.get(`/v1/roles/${params.id}`, options);
|
|
766
|
+
},
|
|
767
|
+
async getRoles(params, options) {
|
|
768
|
+
return apiConfig.httpClient.get(`/v1/roles`, {
|
|
769
|
+
...options,
|
|
770
|
+
params: params ? {
|
|
771
|
+
businessId: apiConfig.businessId,
|
|
772
|
+
action: params.action || "READ"
|
|
773
|
+
} : {
|
|
774
|
+
businessId: apiConfig.businessId,
|
|
775
|
+
action: "READ"
|
|
776
|
+
}
|
|
601
777
|
});
|
|
602
|
-
if (!res.ok) {
|
|
603
|
-
const error = await res.text() || res.statusText;
|
|
604
|
-
throw new Error(error);
|
|
605
|
-
}
|
|
606
|
-
const json = await res.json();
|
|
607
|
-
return {
|
|
608
|
-
success: true,
|
|
609
|
-
data: json
|
|
610
|
-
};
|
|
611
|
-
} catch (e) {
|
|
612
|
-
console.error("Payment intent creation failed:", e);
|
|
613
|
-
return {
|
|
614
|
-
success: false,
|
|
615
|
-
error: e.message
|
|
616
|
-
};
|
|
617
778
|
}
|
|
618
|
-
}
|
|
779
|
+
};
|
|
619
780
|
};
|
|
620
781
|
|
|
621
|
-
// src/api/
|
|
622
|
-
var
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
782
|
+
// src/api/notification.ts
|
|
783
|
+
var createNotificationApi = (apiConfig) => {
|
|
784
|
+
return {
|
|
785
|
+
async getNotifications(params, options) {
|
|
786
|
+
return apiConfig.httpClient.get(`/v1/notifications`, {
|
|
787
|
+
...options,
|
|
788
|
+
params: {
|
|
789
|
+
limit: params.limit,
|
|
790
|
+
previous_id: params.previous_id
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
},
|
|
794
|
+
async updateNotifications(options) {
|
|
795
|
+
return apiConfig.httpClient.put(`/v1/notifications`, { seen: true }, options);
|
|
796
|
+
},
|
|
797
|
+
async trackEmailOpen(params, options) {
|
|
798
|
+
return apiConfig.httpClient.get(
|
|
799
|
+
`/v1/notifications/track/email/${params.trackingPixelId}`,
|
|
800
|
+
options
|
|
801
|
+
);
|
|
802
|
+
},
|
|
803
|
+
async getDeliveryStats(params, options) {
|
|
804
|
+
return apiConfig.httpClient.get(
|
|
805
|
+
`/v1/notifications/track/stats/${apiConfig.businessId}`,
|
|
806
|
+
options
|
|
807
|
+
);
|
|
632
808
|
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
809
|
+
};
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
// src/api/promoCode.ts
|
|
813
|
+
var createPromoCodeApi = (apiConfig) => {
|
|
814
|
+
return {
|
|
815
|
+
async createPromoCode(params, options) {
|
|
816
|
+
return apiConfig.httpClient.post(
|
|
817
|
+
`/v1/businesses/${apiConfig.businessId}/promo-codes`,
|
|
818
|
+
params,
|
|
819
|
+
options
|
|
820
|
+
);
|
|
821
|
+
},
|
|
822
|
+
async updatePromoCode(params, options) {
|
|
823
|
+
return apiConfig.httpClient.put(
|
|
824
|
+
`/v1/businesses/${apiConfig.businessId}/promo-codes/${params.id}`,
|
|
825
|
+
params,
|
|
826
|
+
options
|
|
827
|
+
);
|
|
828
|
+
},
|
|
829
|
+
async deletePromoCode(params, options) {
|
|
830
|
+
return apiConfig.httpClient.delete(
|
|
831
|
+
`/v1/businesses/${apiConfig.businessId}/promo-codes/${params.id}`,
|
|
832
|
+
options
|
|
833
|
+
);
|
|
834
|
+
},
|
|
835
|
+
async getPromoCode(params, options) {
|
|
836
|
+
return apiConfig.httpClient.get(
|
|
837
|
+
`/v1/businesses/${apiConfig.businessId}/promo-codes/${params.id}`,
|
|
838
|
+
options
|
|
839
|
+
);
|
|
840
|
+
},
|
|
841
|
+
async getPromoCodes(params, options) {
|
|
842
|
+
const { businessId, statuses, ...restParams } = params;
|
|
843
|
+
return apiConfig.httpClient.get(`/v1/businesses/${apiConfig.businessId}/promo-codes`, {
|
|
844
|
+
...options,
|
|
845
|
+
params: {
|
|
846
|
+
...restParams,
|
|
847
|
+
statuses: statuses && statuses.length > 0 ? statuses : void 0
|
|
848
|
+
}
|
|
849
|
+
});
|
|
649
850
|
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
body: JSON.stringify({
|
|
662
|
-
newsletterId: payload.newsletterId,
|
|
663
|
-
email: payload.email,
|
|
664
|
-
market: "US",
|
|
665
|
-
// Backend resolves currency from market
|
|
666
|
-
...payload.customerId && { customerId: payload.customerId },
|
|
667
|
-
...payload.payment && { payment: payload.payment }
|
|
668
|
-
})
|
|
851
|
+
};
|
|
852
|
+
};
|
|
853
|
+
|
|
854
|
+
// src/api/analytics.ts
|
|
855
|
+
var createAnalyticsApi = (apiConfig) => {
|
|
856
|
+
return {
|
|
857
|
+
async getAnalytics(params, options) {
|
|
858
|
+
const { businessId, ...queryParams } = params;
|
|
859
|
+
return apiConfig.httpClient.get(`/v1/analytics/${apiConfig.businessId}`, {
|
|
860
|
+
...options,
|
|
861
|
+
params: queryParams
|
|
669
862
|
});
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
return
|
|
676
|
-
success: true,
|
|
677
|
-
data
|
|
678
|
-
};
|
|
679
|
-
} catch (error) {
|
|
680
|
-
console.error("Newsletter subscription error:", error);
|
|
681
|
-
return {
|
|
682
|
-
success: false,
|
|
683
|
-
error: error instanceof Error ? error.message : "Failed to subscribe to newsletter"
|
|
684
|
-
};
|
|
863
|
+
},
|
|
864
|
+
async getAnalyticsHealth(params, options) {
|
|
865
|
+
return apiConfig.httpClient.get(`/v1/analytics/${apiConfig.businessId}/health`, options);
|
|
866
|
+
},
|
|
867
|
+
async setupAnalytics(params, options) {
|
|
868
|
+
return apiConfig.httpClient.post(`/v1/analytics/admin/setup`, params, options);
|
|
685
869
|
}
|
|
686
|
-
}
|
|
870
|
+
};
|
|
687
871
|
};
|
|
688
872
|
|
|
689
|
-
// src/
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
throw new Error(response.error || "Failed to send verification code");
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
async function verifyPhoneCode(token, phoneNumber, code) {
|
|
710
|
-
if (!code) {
|
|
711
|
-
throw new Error("Verification code is required");
|
|
712
|
-
}
|
|
713
|
-
const response = await reservationApi.verifyPhoneCode({ token, phoneNumber, code });
|
|
714
|
-
if (response.success) {
|
|
715
|
-
return { success: true };
|
|
716
|
-
} else {
|
|
717
|
-
throw new Error(response.error || "Invalid verification code");
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
async function getBusinessConfig(businessId) {
|
|
721
|
-
try {
|
|
722
|
-
const config = getGlobalConfig();
|
|
723
|
-
const response = await fetch(`${config.apiUrl}/v1/businesses/${businessId}`, {
|
|
724
|
-
method: "GET",
|
|
725
|
-
headers: {
|
|
726
|
-
"Content-Type": "application/json"
|
|
727
|
-
}
|
|
728
|
-
});
|
|
729
|
-
if (!response.ok) {
|
|
730
|
-
throw new Error(`Failed to fetch business config: ${response.status}`);
|
|
873
|
+
// src/api/payment.ts
|
|
874
|
+
var createPaymentApi = (apiConfig) => {
|
|
875
|
+
return {
|
|
876
|
+
async handleStripeWebhook(params, options) {
|
|
877
|
+
return apiConfig.httpClient.post(`/v1/payments/webhooks/stripe`, params, options);
|
|
878
|
+
},
|
|
879
|
+
async getBusinessMarkets(params, options) {
|
|
880
|
+
return apiConfig.httpClient.get(
|
|
881
|
+
`/v1/payments/businesses/${apiConfig.businessId}/markets`,
|
|
882
|
+
options
|
|
883
|
+
);
|
|
884
|
+
},
|
|
885
|
+
async getBusinessMarket(params, options) {
|
|
886
|
+
return apiConfig.httpClient.get(
|
|
887
|
+
`/v1/payments/businesses/${apiConfig.businessId}/markets/${params.marketId}`,
|
|
888
|
+
options
|
|
889
|
+
);
|
|
731
890
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
success: true,
|
|
735
|
-
data: business
|
|
736
|
-
};
|
|
737
|
-
} catch (error) {
|
|
738
|
-
return {
|
|
739
|
-
success: false,
|
|
740
|
-
error: error.message
|
|
741
|
-
};
|
|
742
|
-
}
|
|
743
|
-
}
|
|
891
|
+
};
|
|
892
|
+
};
|
|
744
893
|
|
|
745
894
|
// src/utils/blocks.ts
|
|
746
895
|
function getBlockLabel(block, locale = "en") {
|
|
@@ -872,10 +1021,8 @@ var getBlockFromArray = (entry, blockKey, locale = "en") => {
|
|
|
872
1021
|
return acc;
|
|
873
1022
|
});
|
|
874
1023
|
};
|
|
875
|
-
var getImageUrl = (imageBlock, isBlock = true) => {
|
|
1024
|
+
var getImageUrl = (imageBlock, isBlock = true, storageUrl = "https://storage.arky.io/dev") => {
|
|
876
1025
|
if (!imageBlock) return null;
|
|
877
|
-
const config = getGlobalConfig();
|
|
878
|
-
const storageUrl = config.storageUrl || "https://storage.arky.io/dev";
|
|
879
1026
|
const isExternalUrl = (url) => {
|
|
880
1027
|
return url.startsWith("http://") || url.startsWith("https://");
|
|
881
1028
|
};
|
|
@@ -921,9 +1068,7 @@ function getGalleryThumbnail(gallery) {
|
|
|
921
1068
|
const res = item.media.resolutions.thumbnail || item.media.resolutions.original;
|
|
922
1069
|
return res?.url || null;
|
|
923
1070
|
}
|
|
924
|
-
function thumbnailUrl(service) {
|
|
925
|
-
const config = getGlobalConfig();
|
|
926
|
-
const storageUrl = config.storageUrl || "";
|
|
1071
|
+
function thumbnailUrl(service, storageUrl = "") {
|
|
927
1072
|
const path = getGalleryThumbnail(service.gallery);
|
|
928
1073
|
return path ? `${storageUrl}/${path}` : null;
|
|
929
1074
|
}
|
|
@@ -942,6 +1087,95 @@ var translateMap = (labels, lang, fallback = "unknown") => {
|
|
|
942
1087
|
return label;
|
|
943
1088
|
};
|
|
944
1089
|
|
|
1090
|
+
// src/utils/currency.ts
|
|
1091
|
+
function getCurrencySymbol(currency) {
|
|
1092
|
+
const currencySymbols = {
|
|
1093
|
+
USD: "$",
|
|
1094
|
+
EUR: "\u20AC",
|
|
1095
|
+
GBP: "\xA3",
|
|
1096
|
+
CAD: "C$",
|
|
1097
|
+
AUD: "A$",
|
|
1098
|
+
JPY: "\xA5",
|
|
1099
|
+
CHF: "CHF",
|
|
1100
|
+
SEK: "kr",
|
|
1101
|
+
NOK: "kr",
|
|
1102
|
+
DKK: "kr",
|
|
1103
|
+
PLN: "z\u0142",
|
|
1104
|
+
CZK: "K\u010D",
|
|
1105
|
+
HUF: "Ft",
|
|
1106
|
+
RON: "lei",
|
|
1107
|
+
BGN: "\u043B\u0432",
|
|
1108
|
+
HRK: "kn",
|
|
1109
|
+
RSD: "\u0434\u0438\u043D",
|
|
1110
|
+
BAM: "KM",
|
|
1111
|
+
MKD: "\u0434\u0435\u043D",
|
|
1112
|
+
ALL: "L",
|
|
1113
|
+
TRY: "\u20BA",
|
|
1114
|
+
RUB: "\u20BD",
|
|
1115
|
+
UAH: "\u20B4",
|
|
1116
|
+
BYN: "Br",
|
|
1117
|
+
CNY: "\xA5",
|
|
1118
|
+
INR: "\u20B9",
|
|
1119
|
+
KRW: "\u20A9",
|
|
1120
|
+
THB: "\u0E3F",
|
|
1121
|
+
VND: "\u20AB",
|
|
1122
|
+
SGD: "S$",
|
|
1123
|
+
MYR: "RM",
|
|
1124
|
+
IDR: "Rp",
|
|
1125
|
+
PHP: "\u20B1",
|
|
1126
|
+
BRL: "R$",
|
|
1127
|
+
ARS: "$",
|
|
1128
|
+
CLP: "$",
|
|
1129
|
+
COP: "$",
|
|
1130
|
+
PEN: "S/",
|
|
1131
|
+
MXN: "$",
|
|
1132
|
+
ZAR: "R",
|
|
1133
|
+
EGP: "E\xA3",
|
|
1134
|
+
NGN: "\u20A6",
|
|
1135
|
+
KES: "KSh",
|
|
1136
|
+
GHS: "\u20B5",
|
|
1137
|
+
MAD: "DH",
|
|
1138
|
+
TND: "\u062F.\u062A",
|
|
1139
|
+
DZD: "\u062F.\u062C",
|
|
1140
|
+
LYD: "\u0644.\u062F",
|
|
1141
|
+
AED: "\u062F.\u0625",
|
|
1142
|
+
SAR: "\u0631.\u0633",
|
|
1143
|
+
QAR: "\u0631.\u0642",
|
|
1144
|
+
KWD: "\u062F.\u0643",
|
|
1145
|
+
BHD: "\u0628.\u062F",
|
|
1146
|
+
OMR: "\u0631.\u0639",
|
|
1147
|
+
JOD: "\u062F.\u0623",
|
|
1148
|
+
LBP: "\u0644.\u0644",
|
|
1149
|
+
SYP: "\u0644.\u0633",
|
|
1150
|
+
IQD: "\u0639.\u062F",
|
|
1151
|
+
IRR: "\uFDFC",
|
|
1152
|
+
AFN: "\u060B",
|
|
1153
|
+
PKR: "\u20A8",
|
|
1154
|
+
LKR: "\u20A8",
|
|
1155
|
+
NPR: "\u20A8",
|
|
1156
|
+
BDT: "\u09F3",
|
|
1157
|
+
MMK: "K",
|
|
1158
|
+
LAK: "\u20AD",
|
|
1159
|
+
KHR: "\u17DB",
|
|
1160
|
+
MNT: "\u20AE",
|
|
1161
|
+
KZT: "\u20B8",
|
|
1162
|
+
UZS: "\u043B\u0432",
|
|
1163
|
+
KGS: "\u043B\u0432",
|
|
1164
|
+
TJS: "SM",
|
|
1165
|
+
TMT: "T",
|
|
1166
|
+
AZN: "\u20BC",
|
|
1167
|
+
GEL: "\u20BE",
|
|
1168
|
+
AMD: "\u058F",
|
|
1169
|
+
BYR: "p.",
|
|
1170
|
+
MDL: "L"
|
|
1171
|
+
};
|
|
1172
|
+
return currencySymbols[currency.toUpperCase()] || currency;
|
|
1173
|
+
}
|
|
1174
|
+
var SYMBOL_AFTER_CURRENCIES = ["SEK", "NOK", "DKK", "PLN", "CZK", "HUF", "RON", "BGN", "HRK"];
|
|
1175
|
+
function isSymbolAfterCurrency(currency) {
|
|
1176
|
+
return SYMBOL_AFTER_CURRENCIES.includes(currency.toUpperCase());
|
|
1177
|
+
}
|
|
1178
|
+
|
|
945
1179
|
// src/utils/errors.ts
|
|
946
1180
|
var ERROR_CODES = {
|
|
947
1181
|
// General errors
|
|
@@ -976,7 +1210,7 @@ var ERROR_CODES = {
|
|
|
976
1210
|
"BUSINESS.007": "BUSINESS.BUSINESS_ID_REQUIRED",
|
|
977
1211
|
"BUSINESS.010": "BUSINESS.DESCRIPTION_REQUIRED",
|
|
978
1212
|
"BUSINESS.011": "BUSINESS.SLUG_INVALID",
|
|
979
|
-
// Provider errors
|
|
1213
|
+
// Provider errors
|
|
980
1214
|
"PROVIDER.001": "PROVIDER.NOT_FOUND",
|
|
981
1215
|
"PROVIDER.002": "PROVIDER.FAILED_TO_CREATE",
|
|
982
1216
|
"PROVIDER.003": "PROVIDER.FAILED_TO_UPDATE",
|
|
@@ -1026,11 +1260,11 @@ var transformErrors = (zodError) => {
|
|
|
1026
1260
|
if (!zodError.issues) return customErrors;
|
|
1027
1261
|
zodError.issues.forEach((issue) => {
|
|
1028
1262
|
const field = issue.path.join(".");
|
|
1029
|
-
const
|
|
1263
|
+
const error = issue.message;
|
|
1030
1264
|
if (!customErrors.some(
|
|
1031
|
-
(customError) => customError.field === field && customError.
|
|
1265
|
+
(customError) => customError.field === field && customError.error === error
|
|
1032
1266
|
)) {
|
|
1033
|
-
customErrors.push({ field,
|
|
1267
|
+
customErrors.push({ field, error });
|
|
1034
1268
|
}
|
|
1035
1269
|
});
|
|
1036
1270
|
return customErrors;
|
|
@@ -1042,106 +1276,44 @@ var convertServerErrorToRequestError = (serverError, renameRules) => {
|
|
|
1042
1276
|
const field = renameRules && renameRules[validationError.field] ? renameRules[validationError.field] : validationError.field;
|
|
1043
1277
|
return {
|
|
1044
1278
|
field,
|
|
1045
|
-
|
|
1279
|
+
error: validationError.error || "GENERAL.VALIDATION_ERROR"
|
|
1046
1280
|
};
|
|
1047
1281
|
})
|
|
1048
1282
|
};
|
|
1049
1283
|
};
|
|
1050
1284
|
var errors = ERROR_CONSTANTS;
|
|
1051
1285
|
|
|
1052
|
-
// src/utils/
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
INR: "\u20B9",
|
|
1081
|
-
KRW: "\u20A9",
|
|
1082
|
-
THB: "\u0E3F",
|
|
1083
|
-
VND: "\u20AB",
|
|
1084
|
-
SGD: "S$",
|
|
1085
|
-
MYR: "RM",
|
|
1086
|
-
IDR: "Rp",
|
|
1087
|
-
PHP: "\u20B1",
|
|
1088
|
-
BRL: "R$",
|
|
1089
|
-
ARS: "$",
|
|
1090
|
-
CLP: "$",
|
|
1091
|
-
COP: "$",
|
|
1092
|
-
PEN: "S/",
|
|
1093
|
-
MXN: "$",
|
|
1094
|
-
ZAR: "R",
|
|
1095
|
-
EGP: "E\xA3",
|
|
1096
|
-
NGN: "\u20A6",
|
|
1097
|
-
KES: "KSh",
|
|
1098
|
-
GHS: "\u20B5",
|
|
1099
|
-
MAD: "DH",
|
|
1100
|
-
TND: "\u062F.\u062A",
|
|
1101
|
-
DZD: "\u062F.\u062C",
|
|
1102
|
-
LYD: "\u0644.\u062F",
|
|
1103
|
-
AED: "\u062F.\u0625",
|
|
1104
|
-
SAR: "\u0631.\u0633",
|
|
1105
|
-
QAR: "\u0631.\u0642",
|
|
1106
|
-
KWD: "\u062F.\u0643",
|
|
1107
|
-
BHD: "\u0628.\u062F",
|
|
1108
|
-
OMR: "\u0631.\u0639",
|
|
1109
|
-
JOD: "\u062F.\u0623",
|
|
1110
|
-
LBP: "\u0644.\u0644",
|
|
1111
|
-
SYP: "\u0644.\u0633",
|
|
1112
|
-
IQD: "\u0639.\u062F",
|
|
1113
|
-
IRR: "\uFDFC",
|
|
1114
|
-
AFN: "\u060B",
|
|
1115
|
-
PKR: "\u20A8",
|
|
1116
|
-
LKR: "\u20A8",
|
|
1117
|
-
NPR: "\u20A8",
|
|
1118
|
-
BDT: "\u09F3",
|
|
1119
|
-
MMK: "K",
|
|
1120
|
-
LAK: "\u20AD",
|
|
1121
|
-
KHR: "\u17DB",
|
|
1122
|
-
MNT: "\u20AE",
|
|
1123
|
-
KZT: "\u20B8",
|
|
1124
|
-
UZS: "\u043B\u0432",
|
|
1125
|
-
KGS: "\u043B\u0432",
|
|
1126
|
-
TJS: "SM",
|
|
1127
|
-
TMT: "T",
|
|
1128
|
-
AZN: "\u20BC",
|
|
1129
|
-
GEL: "\u20BE",
|
|
1130
|
-
AMD: "\u058F",
|
|
1131
|
-
BYR: "p.",
|
|
1132
|
-
MDL: "L"
|
|
1133
|
-
};
|
|
1134
|
-
return currencySymbols[currency.toUpperCase()] || currency;
|
|
1286
|
+
// src/utils/i18n.ts
|
|
1287
|
+
var defaultLocale = "en";
|
|
1288
|
+
function setDefaultLocale(locale) {
|
|
1289
|
+
defaultLocale = locale;
|
|
1290
|
+
}
|
|
1291
|
+
function getLocale() {
|
|
1292
|
+
if (typeof window !== "undefined" && window.navigator) {
|
|
1293
|
+
return window.navigator.language.split("-")[0] || defaultLocale;
|
|
1294
|
+
}
|
|
1295
|
+
return defaultLocale;
|
|
1296
|
+
}
|
|
1297
|
+
function getLocaleFromUrl(url) {
|
|
1298
|
+
const pathParts = url.pathname.split("/").filter(Boolean);
|
|
1299
|
+
const potentialLocale = pathParts[0];
|
|
1300
|
+
const validLocales = ["en", "fr", "es", "de", "it", "pt", "ja", "zh", "ko", "ru"];
|
|
1301
|
+
if (potentialLocale && validLocales.includes(potentialLocale)) {
|
|
1302
|
+
return potentialLocale;
|
|
1303
|
+
}
|
|
1304
|
+
return getLocale();
|
|
1305
|
+
}
|
|
1306
|
+
function getLocalizedString(value, locale) {
|
|
1307
|
+
if (!value) return "";
|
|
1308
|
+
if (typeof value === "string") return value;
|
|
1309
|
+
if (typeof value === "object") {
|
|
1310
|
+
const targetLocale = locale || getLocale();
|
|
1311
|
+
return value[targetLocale] || value["en"] || value[Object.keys(value)[0]] || "";
|
|
1312
|
+
}
|
|
1313
|
+
return String(value);
|
|
1135
1314
|
}
|
|
1136
1315
|
|
|
1137
1316
|
// src/utils/price.ts
|
|
1138
|
-
var CURRENCY_SYMBOLS = {
|
|
1139
|
-
"USD": "$",
|
|
1140
|
-
"EUR": "\u20AC",
|
|
1141
|
-
"GBP": "\xA3",
|
|
1142
|
-
"CAD": "C$",
|
|
1143
|
-
"AUD": "A$"
|
|
1144
|
-
};
|
|
1145
1317
|
var MARKET_CURRENCIES = {
|
|
1146
1318
|
"US": "USD",
|
|
1147
1319
|
"EU": "EUR",
|
|
@@ -1155,9 +1327,6 @@ function convertToMajor(minorAmount) {
|
|
|
1155
1327
|
function convertToMinor(majorAmount) {
|
|
1156
1328
|
return Math.round((majorAmount ?? 0) * 100);
|
|
1157
1329
|
}
|
|
1158
|
-
function getSymbol(currency) {
|
|
1159
|
-
return CURRENCY_SYMBOLS[currency] || "$";
|
|
1160
|
-
}
|
|
1161
1330
|
function getCurrencyFromMarket(marketId) {
|
|
1162
1331
|
return MARKET_CURRENCIES[marketId] || "USD";
|
|
1163
1332
|
}
|
|
@@ -1167,7 +1336,10 @@ function formatCurrencyAmount(amount, currency, options = {}) {
|
|
|
1167
1336
|
if (!showSymbols) {
|
|
1168
1337
|
return `${roundedAmount} ${currency}`;
|
|
1169
1338
|
}
|
|
1170
|
-
const symbol = customSymbol ||
|
|
1339
|
+
const symbol = customSymbol || getCurrencySymbol(currency);
|
|
1340
|
+
if (isSymbolAfterCurrency(currency)) {
|
|
1341
|
+
return `${roundedAmount} ${symbol}`;
|
|
1342
|
+
}
|
|
1171
1343
|
return `${symbol}${roundedAmount}`;
|
|
1172
1344
|
}
|
|
1173
1345
|
function formatMinor(amountMinor, currency, options = {}) {
|
|
@@ -1212,11 +1384,11 @@ function getMarketPrice(prices, marketId, businessMarkets, options = {}) {
|
|
|
1212
1384
|
symbol = getCurrencySymbol(currency);
|
|
1213
1385
|
} else {
|
|
1214
1386
|
currency = getCurrencyFromMarket(price.market);
|
|
1215
|
-
symbol =
|
|
1387
|
+
symbol = getCurrencySymbol(currency);
|
|
1216
1388
|
}
|
|
1217
1389
|
} else {
|
|
1218
1390
|
currency = getCurrencyFromMarket(price.market);
|
|
1219
|
-
symbol =
|
|
1391
|
+
symbol = getCurrencySymbol(currency);
|
|
1220
1392
|
}
|
|
1221
1393
|
const formattedPrice = formatMinor(price.amount ?? 0, currency, {
|
|
1222
1394
|
showSymbols,
|
|
@@ -1254,6 +1426,32 @@ function createPaymentForCheckout(subtotalMinor, marketId, currency, paymentMeth
|
|
|
1254
1426
|
};
|
|
1255
1427
|
}
|
|
1256
1428
|
|
|
1429
|
+
// src/utils/queryParams.ts
|
|
1430
|
+
function buildQueryString(params) {
|
|
1431
|
+
const queryParts = [];
|
|
1432
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
1433
|
+
if (value === null || value === void 0) {
|
|
1434
|
+
return;
|
|
1435
|
+
}
|
|
1436
|
+
if (Array.isArray(value)) {
|
|
1437
|
+
const jsonString = JSON.stringify(value);
|
|
1438
|
+
queryParts.push(`${key}=${encodeURIComponent(jsonString)}`);
|
|
1439
|
+
} else if (typeof value === "string") {
|
|
1440
|
+
queryParts.push(`${key}=${encodeURIComponent(value)}`);
|
|
1441
|
+
} else if (typeof value === "number" || typeof value === "boolean") {
|
|
1442
|
+
queryParts.push(`${key}=${value}`);
|
|
1443
|
+
} else if (typeof value === "object") {
|
|
1444
|
+
const jsonString = JSON.stringify(value);
|
|
1445
|
+
queryParts.push(`${key}=${encodeURIComponent(jsonString)}`);
|
|
1446
|
+
}
|
|
1447
|
+
});
|
|
1448
|
+
return queryParts.length > 0 ? `?${queryParts.join("&")}` : "";
|
|
1449
|
+
}
|
|
1450
|
+
function appendQueryString(url, params) {
|
|
1451
|
+
const queryString = buildQueryString(params);
|
|
1452
|
+
return queryString ? `${url}${queryString}` : url;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1257
1455
|
// src/utils/svg.ts
|
|
1258
1456
|
async function fetchSvgContent(mediaObject) {
|
|
1259
1457
|
if (!mediaObject) return null;
|
|
@@ -1419,18 +1617,169 @@ function validateRequired(value, fieldName = "This field") {
|
|
|
1419
1617
|
return { isValid: true };
|
|
1420
1618
|
}
|
|
1421
1619
|
|
|
1620
|
+
// src/services/createHttpClient.ts
|
|
1621
|
+
function createHttpClient(cfg) {
|
|
1622
|
+
const refreshEndpoint = `${cfg.baseUrl}/v1/users/refresh-access-token`;
|
|
1623
|
+
async function request(method, path, body, options) {
|
|
1624
|
+
if (options?.transformRequest) {
|
|
1625
|
+
body = options.transformRequest(body);
|
|
1626
|
+
}
|
|
1627
|
+
const headers = {
|
|
1628
|
+
Accept: "application/json",
|
|
1629
|
+
"Content-Type": "application/json",
|
|
1630
|
+
...options?.headers || {}
|
|
1631
|
+
};
|
|
1632
|
+
let { accessToken, refreshToken, provider, expiresAt } = await cfg.getTokens();
|
|
1633
|
+
const nowSec = Date.now() / 1e3;
|
|
1634
|
+
if (expiresAt && nowSec > expiresAt) {
|
|
1635
|
+
if (refreshToken) {
|
|
1636
|
+
const refRes = await fetch(refreshEndpoint, {
|
|
1637
|
+
method: "POST",
|
|
1638
|
+
headers: { Accept: "application/json", "Content-Type": "application/json" },
|
|
1639
|
+
body: JSON.stringify({ provider, refreshToken })
|
|
1640
|
+
});
|
|
1641
|
+
if (refRes.ok) {
|
|
1642
|
+
const data2 = await refRes.json();
|
|
1643
|
+
cfg.setTokens(data2);
|
|
1644
|
+
accessToken = data2.accessToken;
|
|
1645
|
+
} else {
|
|
1646
|
+
cfg.onAuthFailure();
|
|
1647
|
+
if (cfg.loginFallbackPath) {
|
|
1648
|
+
cfg.navigate?.(cfg.loginFallbackPath);
|
|
1649
|
+
}
|
|
1650
|
+
const err = new Error("Error refreshing token");
|
|
1651
|
+
err.name = "ApiError";
|
|
1652
|
+
err.statusCode = 401;
|
|
1653
|
+
throw err;
|
|
1654
|
+
}
|
|
1655
|
+
} else {
|
|
1656
|
+
cfg.onAuthFailure();
|
|
1657
|
+
if (cfg.loginFallbackPath) {
|
|
1658
|
+
cfg.navigate?.(cfg.loginFallbackPath);
|
|
1659
|
+
}
|
|
1660
|
+
const err = new Error("No refresh token");
|
|
1661
|
+
err.name = "ApiError";
|
|
1662
|
+
err.statusCode = 401;
|
|
1663
|
+
throw err;
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
if (accessToken) {
|
|
1667
|
+
headers["Authorization"] = `Bearer ${accessToken}`;
|
|
1668
|
+
}
|
|
1669
|
+
const finalPath = options?.params ? path + buildQueryString(options.params) : path;
|
|
1670
|
+
const fetchOpts = { method, headers };
|
|
1671
|
+
if (!["GET", "DELETE"].includes(method) && body !== void 0) {
|
|
1672
|
+
fetchOpts.body = JSON.stringify(body);
|
|
1673
|
+
}
|
|
1674
|
+
let res;
|
|
1675
|
+
let data;
|
|
1676
|
+
try {
|
|
1677
|
+
const fullUrl = `${cfg.baseUrl}${finalPath}`;
|
|
1678
|
+
console.log("[SDK] Fetching:", method, fullUrl, fetchOpts);
|
|
1679
|
+
res = await fetch(fullUrl, fetchOpts);
|
|
1680
|
+
data = await res.json();
|
|
1681
|
+
} catch (error) {
|
|
1682
|
+
const err = new Error(error instanceof Error ? error.message : "Network request failed");
|
|
1683
|
+
err.name = "NetworkError";
|
|
1684
|
+
throw err;
|
|
1685
|
+
}
|
|
1686
|
+
if (!res.ok) {
|
|
1687
|
+
const serverErr = data;
|
|
1688
|
+
const reqErr = convertServerErrorToRequestError(serverErr);
|
|
1689
|
+
if (options?.errorMessage && cfg.notify) {
|
|
1690
|
+
cfg.notify({ message: options.errorMessage, type: "error" });
|
|
1691
|
+
}
|
|
1692
|
+
const err = new Error(serverErr.message || "Request failed");
|
|
1693
|
+
err.name = "ApiError";
|
|
1694
|
+
err.statusCode = serverErr.statusCode;
|
|
1695
|
+
err.validationErrors = reqErr.validationErrors;
|
|
1696
|
+
throw err;
|
|
1697
|
+
}
|
|
1698
|
+
if (options?.successMessage && cfg.notify) {
|
|
1699
|
+
cfg.notify({ message: options.successMessage, type: "success" });
|
|
1700
|
+
}
|
|
1701
|
+
return data;
|
|
1702
|
+
}
|
|
1703
|
+
return {
|
|
1704
|
+
get: (path, opts) => request("GET", path, void 0, opts),
|
|
1705
|
+
post: (path, body, opts) => request("POST", path, body, opts),
|
|
1706
|
+
put: (path, body, opts) => request("PUT", path, body, opts),
|
|
1707
|
+
patch: (path, body, opts) => request("PATCH", path, body, opts),
|
|
1708
|
+
delete: (path, opts) => request("DELETE", path, void 0, opts)
|
|
1709
|
+
};
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1422
1712
|
// src/index.ts
|
|
1423
|
-
var SDK_VERSION = "0.3.
|
|
1713
|
+
var SDK_VERSION = "0.3.1";
|
|
1424
1714
|
var SUPPORTED_FRAMEWORKS = ["astro", "react", "vue", "svelte", "vanilla"];
|
|
1425
|
-
function
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1715
|
+
function createArkySDK(config) {
|
|
1716
|
+
const httpClient = createHttpClient(config);
|
|
1717
|
+
const storageUrl = config.storageUrl || "https://storage.arky.io/dev";
|
|
1718
|
+
const apiConfig = {
|
|
1719
|
+
httpClient,
|
|
1720
|
+
businessId: config.businessId,
|
|
1721
|
+
storageUrl,
|
|
1722
|
+
baseUrl: config.baseUrl,
|
|
1723
|
+
market: config.market || "US",
|
|
1724
|
+
setTokens: config.setTokens,
|
|
1725
|
+
getTokens: config.getTokens
|
|
1726
|
+
};
|
|
1727
|
+
const userApi = createUserApi(apiConfig);
|
|
1728
|
+
const autoGuest = config.autoGuest !== void 0 ? config.autoGuest : true;
|
|
1729
|
+
const sdk = {
|
|
1730
|
+
user: userApi,
|
|
1731
|
+
business: createBusinessApi(apiConfig),
|
|
1732
|
+
media: createMediaApi(apiConfig),
|
|
1733
|
+
role: createRoleApi(apiConfig),
|
|
1734
|
+
notification: createNotificationApi(apiConfig),
|
|
1735
|
+
promoCode: createPromoCodeApi(apiConfig),
|
|
1736
|
+
analytics: createAnalyticsApi(apiConfig),
|
|
1737
|
+
cms: createCmsApi(apiConfig),
|
|
1738
|
+
eshop: createEshopApi(apiConfig),
|
|
1739
|
+
reservation: createReservationApi(apiConfig),
|
|
1740
|
+
newsletter: createNewsletterApi(apiConfig),
|
|
1741
|
+
payment: createPaymentApi(apiConfig),
|
|
1742
|
+
setBusinessId: (businessId) => {
|
|
1743
|
+
apiConfig.businessId = businessId;
|
|
1744
|
+
},
|
|
1745
|
+
getBusinessId: () => apiConfig.businessId,
|
|
1746
|
+
auth: {
|
|
1747
|
+
isAuthenticated: config.isAuthenticated || (() => false),
|
|
1748
|
+
logout: config.logout || config.onAuthFailure,
|
|
1749
|
+
setUserToken: config.setUserToken || (() => {
|
|
1750
|
+
})
|
|
1751
|
+
},
|
|
1752
|
+
utils: {
|
|
1753
|
+
getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock, storageUrl),
|
|
1754
|
+
thumbnailUrl: (service) => thumbnailUrl(service, storageUrl),
|
|
1755
|
+
getGalleryThumbnail,
|
|
1756
|
+
getMarketPrice,
|
|
1757
|
+
getPriceAmount,
|
|
1758
|
+
formatPayment,
|
|
1759
|
+
formatMinor,
|
|
1760
|
+
createPaymentForCheckout,
|
|
1761
|
+
getCurrencySymbol,
|
|
1762
|
+
validatePhoneNumber,
|
|
1763
|
+
tzGroups,
|
|
1764
|
+
findTimeZone
|
|
1765
|
+
}
|
|
1766
|
+
};
|
|
1767
|
+
if (autoGuest) {
|
|
1768
|
+
Promise.resolve().then(async () => {
|
|
1769
|
+
try {
|
|
1770
|
+
const tokens = await config.getTokens();
|
|
1771
|
+
if (!tokens.accessToken && !tokens.refreshToken) {
|
|
1772
|
+
const guestToken = await userApi.getGuestToken({});
|
|
1773
|
+
console.log("[SDK Init] Created guest token:", guestToken ? "Success" : "Failed");
|
|
1774
|
+
} else {
|
|
1775
|
+
console.log("[SDK Init] Using existing token from storage");
|
|
1776
|
+
}
|
|
1777
|
+
} catch (error) {
|
|
1778
|
+
console.error("[SDK Init] Failed to initialize auth:", error);
|
|
1779
|
+
}
|
|
1780
|
+
});
|
|
1431
1781
|
}
|
|
1432
|
-
|
|
1433
|
-
return config;
|
|
1782
|
+
return sdk;
|
|
1434
1783
|
}
|
|
1435
1784
|
|
|
1436
1785
|
exports.ERROR_CODES = ERROR_CODES;
|
|
@@ -1438,14 +1787,28 @@ exports.ERROR_CONSTANTS = ERROR_CONSTANTS;
|
|
|
1438
1787
|
exports.PaymentMethod = PaymentMethod;
|
|
1439
1788
|
exports.SDK_VERSION = SDK_VERSION;
|
|
1440
1789
|
exports.SUPPORTED_FRAMEWORKS = SUPPORTED_FRAMEWORKS;
|
|
1790
|
+
exports.SYMBOL_AFTER_CURRENCIES = SYMBOL_AFTER_CURRENCIES;
|
|
1791
|
+
exports.appendQueryString = appendQueryString;
|
|
1792
|
+
exports.buildQueryString = buildQueryString;
|
|
1441
1793
|
exports.categorify = categorify;
|
|
1442
|
-
exports.cmsApi = cmsApi;
|
|
1443
1794
|
exports.convertServerErrorToRequestError = convertServerErrorToRequestError;
|
|
1444
1795
|
exports.convertToMajor = convertToMajor;
|
|
1445
1796
|
exports.convertToMinor = convertToMinor;
|
|
1797
|
+
exports.createAnalyticsApi = createAnalyticsApi;
|
|
1798
|
+
exports.createArkySDK = createArkySDK;
|
|
1799
|
+
exports.createBusinessApi = createBusinessApi;
|
|
1800
|
+
exports.createCmsApi = createCmsApi;
|
|
1801
|
+
exports.createEshopApi = createEshopApi;
|
|
1802
|
+
exports.createMediaApi = createMediaApi;
|
|
1803
|
+
exports.createNewsletterApi = createNewsletterApi;
|
|
1804
|
+
exports.createNotificationApi = createNotificationApi;
|
|
1805
|
+
exports.createPaymentApi = createPaymentApi;
|
|
1446
1806
|
exports.createPaymentForCheckout = createPaymentForCheckout;
|
|
1807
|
+
exports.createPromoCodeApi = createPromoCodeApi;
|
|
1808
|
+
exports.createReservationApi = createReservationApi;
|
|
1809
|
+
exports.createRoleApi = createRoleApi;
|
|
1810
|
+
exports.createUserApi = createUserApi;
|
|
1447
1811
|
exports.errors = errors;
|
|
1448
|
-
exports.eshopApi = eshopApi;
|
|
1449
1812
|
exports.extractBlockValues = extractBlockValues;
|
|
1450
1813
|
exports.fetchSvgContent = fetchSvgContent;
|
|
1451
1814
|
exports.findTimeZone = findTimeZone;
|
|
@@ -1460,36 +1823,31 @@ exports.getBlockObjectValues = getBlockObjectValues;
|
|
|
1460
1823
|
exports.getBlockTextValue = getBlockTextValue;
|
|
1461
1824
|
exports.getBlockValue = getBlockValue;
|
|
1462
1825
|
exports.getBlockValues = getBlockValues;
|
|
1463
|
-
exports.getBusinessConfig = getBusinessConfig;
|
|
1464
1826
|
exports.getCurrencyFromMarket = getCurrencyFromMarket;
|
|
1827
|
+
exports.getCurrencySymbol = getCurrencySymbol;
|
|
1465
1828
|
exports.getErrorMessage = getErrorMessage;
|
|
1466
1829
|
exports.getGalleryThumbnail = getGalleryThumbnail;
|
|
1467
|
-
exports.getGlobalConfig = getGlobalConfig;
|
|
1468
|
-
exports.getGuestToken = getGuestToken;
|
|
1469
1830
|
exports.getImageUrl = getImageUrl;
|
|
1831
|
+
exports.getLocale = getLocale;
|
|
1832
|
+
exports.getLocaleFromUrl = getLocaleFromUrl;
|
|
1833
|
+
exports.getLocalizedString = getLocalizedString;
|
|
1470
1834
|
exports.getMarketPrice = getMarketPrice;
|
|
1471
1835
|
exports.getPriceAmount = getPriceAmount;
|
|
1472
1836
|
exports.getSvgContentForAstro = getSvgContentForAstro;
|
|
1473
|
-
exports.getSymbol = getSymbol;
|
|
1474
|
-
exports.httpClient = http_default;
|
|
1475
1837
|
exports.humanize = humanize;
|
|
1476
|
-
exports.initArky = initArky;
|
|
1477
1838
|
exports.injectSvgIntoElement = injectSvgIntoElement;
|
|
1478
1839
|
exports.isErrorCode = isErrorCode;
|
|
1479
|
-
exports.
|
|
1840
|
+
exports.isSymbolAfterCurrency = isSymbolAfterCurrency;
|
|
1480
1841
|
exports.prepareBlocksForSubmission = prepareBlocksForSubmission;
|
|
1481
|
-
exports.
|
|
1482
|
-
exports.setGlobalConfig = setGlobalConfig;
|
|
1842
|
+
exports.setDefaultLocale = setDefaultLocale;
|
|
1483
1843
|
exports.slugify = slugify;
|
|
1484
1844
|
exports.thumbnailUrl = thumbnailUrl;
|
|
1485
1845
|
exports.transformErrors = transformErrors;
|
|
1486
1846
|
exports.translateMap = translateMap;
|
|
1487
1847
|
exports.tzGroups = tzGroups;
|
|
1488
|
-
exports.updateProfilePhone = updateProfilePhone;
|
|
1489
1848
|
exports.validateEmail = validateEmail;
|
|
1490
1849
|
exports.validatePhoneNumber = validatePhoneNumber;
|
|
1491
1850
|
exports.validateRequired = validateRequired;
|
|
1492
1851
|
exports.validateVerificationCode = validateVerificationCode;
|
|
1493
|
-
exports.verifyPhoneCode = verifyPhoneCode;
|
|
1494
1852
|
//# sourceMappingURL=index.cjs.map
|
|
1495
1853
|
//# sourceMappingURL=index.cjs.map
|