@zenky/storefront-api 0.0.40 → 0.0.41

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.d.ts CHANGED
@@ -579,12 +579,12 @@ export interface CatalogItem {
579
579
  products: Product[];
580
580
  }
581
581
  export interface RemoteCatalog {
582
- url: string;
582
+ hash: string | null;
583
583
  city_id: string | null;
584
584
  stock_id: string | null;
585
+ url: string;
585
586
  }
586
587
  export declare class CatalogResource extends AbstractResource {
587
- getCatalog(storeId: string, request?: ShowCatalogRequest): Promise<CatalogItem[]>;
588
588
  getRemoteCatalog(storeId: string, request?: ShowCatalogRequest): Promise<RemoteCatalog>;
589
589
  getCatalogFromRemoteUrl(storeId: string, request?: ShowCatalogRequest): Promise<CatalogItem[]>;
590
590
  }
@@ -1,21 +1,21 @@
1
1
  var R = Object.defineProperty;
2
- var P = (s, t, e) => t in s ? R(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var l = (s, t, e) => (P(s, typeof t != "symbol" ? t + "" : t, e), e);
4
- var U = /* @__PURE__ */ ((s) => (s.DADATA = "dadata", s))(U || {});
2
+ var P = (r, t, e) => t in r ? R(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var l = (r, t, e) => (P(r, typeof t != "symbol" ? t + "" : t, e), e);
4
+ var U = /* @__PURE__ */ ((r) => (r.DADATA = "dadata", r))(U || {});
5
5
  class d {
6
6
  constructor(t) {
7
7
  this.client = t;
8
8
  }
9
- getStoreUrl(t, e, r = {}) {
10
- return this.client.getStoreUrl(t, e, r);
9
+ getStoreUrl(t, e, s = {}) {
10
+ return this.client.getStoreUrl(t, e, s);
11
11
  }
12
12
  getPaginatedResponse(t) {
13
13
  if (!t || !Array.isArray(t.data) || !t.meta || !t.meta.pagination)
14
14
  throw new Error("getPaginatedResponse(): Invalid response.");
15
- const e = t.data, r = t.meta.pagination;
15
+ const e = t.data, s = t.meta.pagination;
16
16
  return {
17
17
  items: e,
18
- pagination: r
18
+ pagination: s
19
19
  };
20
20
  }
21
21
  getResponse(t) {
@@ -30,59 +30,55 @@ class q extends d {
30
30
  return this.getPaginatedResponse(await this.client.request("GET", e));
31
31
  }
32
32
  async getArticleCategory(t, e) {
33
- const r = this.getStoreUrl(t, `/articles/categories/${e}`);
34
- return this.getResponse(await this.client.request("GET", r));
33
+ const s = this.getStoreUrl(t, `/articles/categories/${e}`);
34
+ return this.getResponse(await this.client.request("GET", s));
35
35
  }
36
36
  async getArticles(t, e) {
37
- const r = this.getStoreUrl(t, "/articles", e);
38
- return this.getPaginatedResponse(await this.client.request("GET", r));
37
+ const s = this.getStoreUrl(t, "/articles", e);
38
+ return this.getPaginatedResponse(await this.client.request("GET", s));
39
39
  }
40
- async getArticle(t, e, r) {
41
- const n = this.getStoreUrl(t, `/articles/${e}`, r);
40
+ async getArticle(t, e, s) {
41
+ const n = this.getStoreUrl(t, `/articles/${e}`, s);
42
42
  return this.getResponse(await this.client.request("GET", n));
43
43
  }
44
44
  }
45
45
  class S extends d {
46
- async getCatalog(t, e) {
47
- const r = this.getStoreUrl(t, "/catalog", e);
48
- return this.getResponse(await this.client.request("GET", r));
49
- }
50
46
  async getRemoteCatalog(t, e) {
51
- const r = this.getStoreUrl(t, "/catalog/url", e);
52
- return this.getResponse(await this.client.request("GET", r));
47
+ const s = this.getStoreUrl(t, "/catalog", e);
48
+ return this.getResponse(await this.client.request("GET", s));
53
49
  }
54
50
  async getCatalogFromRemoteUrl(t, e) {
55
- const r = await this.getRemoteCatalog(t, e);
56
- return this.getResponse(await this.client.request("GET", r.url));
51
+ const s = await this.getRemoteCatalog(t, e);
52
+ return this.getResponse(await this.client.request("GET", s.url));
57
53
  }
58
54
  }
59
55
  class A extends d {
60
56
  async getCategories(t, e) {
61
- const r = this.getStoreUrl(t, "/categories", e);
62
- return this.getPaginatedResponse(await this.client.request("GET", r));
57
+ const s = this.getStoreUrl(t, "/categories", e);
58
+ return this.getPaginatedResponse(await this.client.request("GET", s));
63
59
  }
64
60
  async getCategoriesTree(t, e) {
65
- const r = this.getStoreUrl(t, "/categories/tree", e);
66
- return this.getResponse(await this.client.request("GET", r));
61
+ const s = this.getStoreUrl(t, "/categories/tree", e);
62
+ return this.getResponse(await this.client.request("GET", s));
67
63
  }
68
- async getCategory(t, e, r) {
69
- const n = this.getStoreUrl(t, `/categories/${e}`, r);
64
+ async getCategory(t, e, s) {
65
+ const n = this.getStoreUrl(t, `/categories/${e}`, s);
70
66
  return this.getResponse(await this.client.request("GET", n));
71
67
  }
72
68
  async getFeaturesGroups(t, e) {
73
- const r = this.getStoreUrl(t, `/categories/${e}/features/groups`);
74
- return this.getResponse(await this.client.request("GET", r));
69
+ const s = this.getStoreUrl(t, `/categories/${e}/features/groups`);
70
+ return this.getResponse(await this.client.request("GET", s));
75
71
  }
76
72
  async getFeatures(t, e) {
77
- const r = this.getStoreUrl(t, `/categories/${e}/features`);
78
- return this.getResponse(await this.client.request("GET", r));
73
+ const s = this.getStoreUrl(t, `/categories/${e}/features`);
74
+ return this.getResponse(await this.client.request("GET", s));
79
75
  }
80
76
  }
81
- class O extends Error {
82
- constructor(e, r) {
77
+ class E extends Error {
78
+ constructor(e, s) {
83
79
  super(e);
84
80
  l(this, "err");
85
- this.err = r;
81
+ this.err = s;
86
82
  }
87
83
  }
88
84
  class b {
@@ -90,14 +86,14 @@ class b {
90
86
  const e = await t.json();
91
87
  switch (t.status) {
92
88
  case 401:
93
- return new O((e == null ? void 0 : e.message) ?? "Unauthenticated.", null);
89
+ return new E((e == null ? void 0 : e.message) ?? "Unauthenticated.", null);
94
90
  default:
95
- return new O(e == null ? void 0 : e.message, (e == null ? void 0 : e.error) || null);
91
+ return new E(e == null ? void 0 : e.message, (e == null ? void 0 : e.error) || null);
96
92
  }
97
93
  }
98
94
  }
99
95
  class k {
100
- constructor(t, e, r, n, i, a, o) {
96
+ constructor(t, e, s, n, i, a, o) {
101
97
  l(this, "baseUrl");
102
98
  l(this, "baseAuthUrl");
103
99
  l(this, "token");
@@ -105,7 +101,7 @@ class k {
105
101
  l(this, "timezone");
106
102
  l(this, "fetchFunction");
107
103
  l(this, "fetchOptions");
108
- this.baseUrl = t, this.baseAuthUrl = e, this.token = r, this.client = n, this.timezone = i, this.fetchFunction = typeof a == "function" ? a : fetch, this.fetchOptions = typeof o < "u" ? o : {};
104
+ this.baseUrl = t, this.baseAuthUrl = e, this.token = s, this.client = n, this.timezone = i, this.fetchFunction = typeof a == "function" ? a : fetch, this.fetchOptions = typeof o < "u" ? o : {};
109
105
  }
110
106
  static build(t, e) {
111
107
  return new k(
@@ -124,20 +120,20 @@ class k {
124
120
  getBaseAuthUrl() {
125
121
  return this.baseAuthUrl;
126
122
  }
127
- getStoreUrl(t, e, r = {}) {
128
- return this.getUrl(`/store/${t}${e}`, r);
123
+ getStoreUrl(t, e, s = {}) {
124
+ return this.getUrl(`/store/${t}${e}`, s);
129
125
  }
130
126
  getUrl(t, e = {}) {
131
127
  if (!Object.keys(e).length)
132
128
  return t;
133
- const r = [];
129
+ const s = [];
134
130
  Object.keys(e).forEach((i) => {
135
- e[i] === void 0 || e[i] === null || r.push(`${i}=${e[i]}`);
131
+ e[i] === void 0 || e[i] === null || s.push(`${i}=${e[i]}`);
136
132
  });
137
133
  const n = t.includes("?") ? "&" : "?";
138
- return `${t}${n}${r.join("&")}`;
134
+ return `${t}${n}${s.join("&")}`;
139
135
  }
140
- async request(t, e, r, n) {
136
+ async request(t, e, s, n) {
141
137
  const i = !e.startsWith("/"), a = {
142
138
  Accept: "application/json",
143
139
  "X-Zenky-Client": this.client,
@@ -149,7 +145,7 @@ class k {
149
145
  mode: "cors",
150
146
  ...this.fetchOptions
151
147
  };
152
- r && (a["Content-Type"] = "application/json", o.body = JSON.stringify(r)), o.headers = i ? { Accept: "application/json" } : a;
148
+ s && (a["Content-Type"] = "application/json", o.body = JSON.stringify(s)), o.headers = i ? { Accept: "application/json" } : a;
153
149
  const u = i ? e : `${this.baseUrl}${e}`, c = await this.fetchFunction.call(null, u, o);
154
150
  if (c.ok)
155
151
  return c.status === 204 ? !0 : c.json();
@@ -168,185 +164,185 @@ class T extends d {
168
164
  }
169
165
  class _ extends d {
170
166
  async getCollections(t, e) {
171
- const r = this.getStoreUrl(t, "/collections", e);
172
- return this.getPaginatedResponse(await this.client.request("GET", r));
167
+ const s = this.getStoreUrl(t, "/collections", e);
168
+ return this.getPaginatedResponse(await this.client.request("GET", s));
173
169
  }
174
170
  async getCollection(t, e) {
175
- const r = this.getStoreUrl(t, `/collections/${e}`);
176
- return this.getResponse(await this.client.request("GET", r));
171
+ const s = this.getStoreUrl(t, `/collections/${e}`);
172
+ return this.getResponse(await this.client.request("GET", s));
177
173
  }
178
174
  }
179
175
  class C extends d {
180
176
  async getOffers(t, e) {
181
- const r = this.getStoreUrl(t, "/offers", e);
182
- return this.getPaginatedResponse(await this.client.request("GET", r));
177
+ const s = this.getStoreUrl(t, "/offers", e);
178
+ return this.getPaginatedResponse(await this.client.request("GET", s));
183
179
  }
184
- async getOffer(t, e, r) {
185
- const n = this.getStoreUrl(t, `/offers/${e}`, r);
180
+ async getOffer(t, e, s) {
181
+ const n = this.getStoreUrl(t, `/offers/${e}`, s);
186
182
  return this.getResponse(await this.client.request("GET", n));
187
183
  }
188
184
  }
189
185
  class N extends d {
190
186
  async createFeedback(t, e) {
191
- const r = this.getStoreUrl(t, "/feedback", e);
192
- return this.getResponse(await this.client.request("POST", r));
187
+ const s = this.getStoreUrl(t, "/feedback", e);
188
+ return this.getResponse(await this.client.request("POST", s));
193
189
  }
194
190
  async createCallback(t, e) {
195
- const r = this.getStoreUrl(t, "/callback", e);
196
- return await this.client.request("POST", r), !0;
191
+ const s = this.getStoreUrl(t, "/callback", e);
192
+ return await this.client.request("POST", s), !0;
197
193
  }
198
194
  }
199
195
  class G extends d {
200
196
  async getProducts(t, e) {
201
- const r = this.getStoreUrl(t, "/products", e);
202
- return this.getPaginatedResponse(await this.client.request("GET", r));
197
+ const s = this.getStoreUrl(t, "/products", e);
198
+ return this.getPaginatedResponse(await this.client.request("GET", s));
203
199
  }
204
- async getProduct(t, e, r) {
205
- const n = this.getStoreUrl(t, `/products/${e}`, r);
200
+ async getProduct(t, e, s) {
201
+ const n = this.getStoreUrl(t, `/products/${e}`, s);
206
202
  return this.getResponse(await this.client.request("GET", n));
207
203
  }
208
- async getProductVariantPrice(t, e, r, n) {
209
- const i = this.getStoreUrl(t, `/products/${e}/variants/${r}/price`);
204
+ async getProductVariantPrice(t, e, s, n) {
205
+ const i = this.getStoreUrl(t, `/products/${e}/variants/${s}/price`);
210
206
  return this.getResponse(await this.client.request("POST", i, n));
211
207
  }
212
208
  }
213
209
  class $ extends d {
214
- getOrderUrl(t, e, r, n) {
210
+ getOrderUrl(t, e, s, n) {
215
211
  const i = typeof e == "string" ? e : e.id, a = typeof e == "string" ? void 0 : e.token;
216
- return this.getStoreUrl(t, `/orders/${i}${r}${a ? "?token=" + a : ""}`, n);
212
+ return this.getStoreUrl(t, `/orders/${i}${s}${a ? "?token=" + a : ""}`, n);
217
213
  }
218
214
  getApiToken(t) {
219
215
  if (!(typeof t == "string" || typeof t.api_token > "u"))
220
216
  return t.api_token;
221
217
  }
222
- async getOrders(t, e, r) {
218
+ async getOrders(t, e, s) {
223
219
  const n = this.getStoreUrl(t, "/orders", e);
224
- return this.getPaginatedResponse(await this.client.request("GET", n, void 0, r));
220
+ return this.getPaginatedResponse(await this.client.request("GET", n, void 0, s));
225
221
  }
226
- async createOrder(t, e, r) {
222
+ async createOrder(t, e, s) {
227
223
  const n = this.getStoreUrl(t, "/orders");
228
- return this.getResponse(await this.client.request("POST", n, e, r));
224
+ return this.getResponse(await this.client.request("POST", n, e, s));
229
225
  }
230
- async getOrder(t, e, r) {
231
- const n = this.getOrderUrl(t, e, "", r);
226
+ async getOrder(t, e, s) {
227
+ const n = this.getOrderUrl(t, e, "", s);
232
228
  return this.getResponse(
233
229
  await this.client.request("GET", n, void 0, this.getApiToken(e))
234
230
  );
235
231
  }
236
232
  async getOrderSettings(t, e) {
237
- const r = this.getOrderUrl(t, e, "/settings");
233
+ const s = this.getOrderUrl(t, e, "/settings");
238
234
  return this.getResponse(
239
- await this.client.request("GET", r, void 0, this.getApiToken(e))
235
+ await this.client.request("GET", s, void 0, this.getApiToken(e))
240
236
  );
241
237
  }
242
- async addProductVariantToOrder(t, e, r) {
238
+ async addProductVariantToOrder(t, e, s) {
243
239
  const n = this.getOrderUrl(t, e, "/products");
244
240
  return this.getResponse(
245
- await this.client.request("POST", n, r, this.getApiToken(e))
241
+ await this.client.request("POST", n, s, this.getApiToken(e))
246
242
  );
247
243
  }
248
- async removeProductVariantFromOrder(t, e, r) {
244
+ async removeProductVariantFromOrder(t, e, s) {
249
245
  const n = this.getOrderUrl(t, e, "/products/remove");
250
246
  return this.getResponse(
251
- await this.client.request("POST", n, r, this.getApiToken(e))
247
+ await this.client.request("POST", n, s, this.getApiToken(e))
252
248
  );
253
249
  }
254
250
  async checkProducts(t, e) {
255
- const r = this.getOrderUrl(t, e, "/products/check");
251
+ const s = this.getOrderUrl(t, e, "/products/check");
256
252
  return this.getResponse(
257
- await this.client.request("POST", r, void 0, this.getApiToken(e))
253
+ await this.client.request("POST", s, void 0, this.getApiToken(e))
258
254
  );
259
255
  }
260
- async getOrderCheckoutUrl(t, e, r) {
256
+ async getOrderCheckoutUrl(t, e, s) {
261
257
  const n = this.getOrderUrl(t, e, "/checkout/url");
262
258
  return this.getResponse(
263
- await this.client.request("POST", n, { redirect_url: r }, this.getApiToken(e))
259
+ await this.client.request("POST", n, { redirect_url: s }, this.getApiToken(e))
264
260
  ).url;
265
261
  }
266
- async setOrderCustomer(t, e, r) {
262
+ async setOrderCustomer(t, e, s) {
267
263
  const n = this.getOrderUrl(t, e, "/checkout/customer");
268
- return await this.client.request("POST", n, r, this.getApiToken(e)), !0;
264
+ return await this.client.request("POST", n, s, this.getApiToken(e)), !0;
269
265
  }
270
- async setOrderDeliveryMethod(t, e, r) {
266
+ async setOrderDeliveryMethod(t, e, s) {
271
267
  const n = this.getOrderUrl(t, e, "/checkout/delivery");
272
268
  return this.getResponse(
273
- await this.client.request("POST", n, r, this.getApiToken(e))
269
+ await this.client.request("POST", n, s, this.getApiToken(e))
274
270
  );
275
271
  }
276
- async setOrderPayments(t, e, r) {
272
+ async setOrderPayments(t, e, s) {
277
273
  const n = this.getOrderUrl(t, e, "/checkout/payments");
278
274
  return this.getResponse(
279
- await this.client.request("POST", n, r, this.getApiToken(e))
275
+ await this.client.request("POST", n, s, this.getApiToken(e))
280
276
  );
281
277
  }
282
- async getOrderPromocode(t, e, r) {
278
+ async getOrderPromocode(t, e, s) {
283
279
  const n = this.getOrderUrl(t, e, "/checkout/promocode");
284
280
  return this.getResponse(
285
- await this.client.request("GET", n, r, this.getApiToken(e))
281
+ await this.client.request("GET", n, s, this.getApiToken(e))
286
282
  );
287
283
  }
288
- async setOrderPromocode(t, e, r) {
284
+ async setOrderPromocode(t, e, s) {
289
285
  const n = this.getOrderUrl(t, e, "/checkout/promocode");
290
286
  return this.getResponse(
291
- await this.client.request("POST", n, r, this.getApiToken(e))
287
+ await this.client.request("POST", n, s, this.getApiToken(e))
292
288
  );
293
289
  }
294
290
  async removeOrderPromocode(t, e) {
295
- const r = this.getOrderUrl(t, e, "/checkout/promocode");
296
- return await this.client.request("DELETE", r, null, this.getApiToken(e)), !0;
291
+ const s = this.getOrderUrl(t, e, "/checkout/promocode");
292
+ return await this.client.request("DELETE", s, null, this.getApiToken(e)), !0;
297
293
  }
298
- async getOrderBonusesPreview(t, e, r) {
299
- const n = this.getOrderUrl(t, e, "/checkout/payments/bonuses", { amount: r });
294
+ async getOrderBonusesPreview(t, e, s) {
295
+ const n = this.getOrderUrl(t, e, "/checkout/payments/bonuses", { amount: s });
300
296
  return this.getResponse(
301
297
  await this.client.request("GET", n, void 0, this.getApiToken(e))
302
298
  );
303
299
  }
304
300
  async getOrderTotal(t, e) {
305
- const r = this.getOrderUrl(t, e, "/checkout/total");
301
+ const s = this.getOrderUrl(t, e, "/checkout/total");
306
302
  return this.getResponse(
307
- await this.client.request("GET", r, void 0, this.getApiToken(e))
303
+ await this.client.request("GET", s, void 0, this.getApiToken(e))
308
304
  );
309
305
  }
310
- async checkoutOrder(t, e, r) {
306
+ async checkoutOrder(t, e, s) {
311
307
  const n = this.getOrderUrl(t, e, "/checkout");
312
308
  return this.getResponse(
313
- await this.client.request("POST", n, r, this.getApiToken(e))
309
+ await this.client.request("POST", n, s, this.getApiToken(e))
314
310
  );
315
311
  }
316
- async confirmOrder(t, e, r) {
312
+ async confirmOrder(t, e, s) {
317
313
  const n = this.getOrderUrl(t, e, "/confirm");
318
- return await this.client.request("POST", n, r, this.getApiToken(e)), !0;
314
+ return await this.client.request("POST", n, s, this.getApiToken(e)), !0;
319
315
  }
320
316
  async resendOrderConfirmationCode(t, e) {
321
- const r = this.getOrderUrl(t, e, "/confirm/resend");
322
- return await this.client.request("POST", r, void 0, this.getApiToken(e)), !0;
317
+ const s = this.getOrderUrl(t, e, "/confirm/resend");
318
+ return await this.client.request("POST", s, void 0, this.getApiToken(e)), !0;
323
319
  }
324
- async getOrderBonusesTransactions(t, e, r) {
325
- const n = this.getOrderUrl(t, e, "/loyalty/transactions", r);
320
+ async getOrderBonusesTransactions(t, e, s) {
321
+ const n = this.getOrderUrl(t, e, "/loyalty/transactions", s);
326
322
  return this.getPaginatedResponse(
327
323
  await this.client.request("GET", n, void 0, this.getApiToken(e))
328
324
  );
329
325
  }
330
326
  async getOrderCashbackTransaction(t, e) {
331
- const r = this.getOrderUrl(t, e, "/loyalty/transactions/cashback");
327
+ const s = this.getOrderUrl(t, e, "/loyalty/transactions/cashback");
332
328
  return this.getResponse(
333
- await this.client.request("GET", r, void 0, this.getApiToken(e))
329
+ await this.client.request("GET", s, void 0, this.getApiToken(e))
334
330
  );
335
331
  }
336
332
  async dispatchPromotionsChecker(t, e) {
337
- const r = this.getOrderUrl(t, e, "/loyalty/promotions/check");
333
+ const s = this.getOrderUrl(t, e, "/loyalty/promotions/check");
338
334
  return this.getResponse(
339
- await this.client.request("POST", r, void 0, this.getApiToken(e))
335
+ await this.client.request("POST", s, void 0, this.getApiToken(e))
340
336
  ).dispatched;
341
337
  }
342
338
  async getOrderPromotionRewards(t, e) {
343
- const r = this.getOrderUrl(t, e, "/loyalty/promotions/rewards");
339
+ const s = this.getOrderUrl(t, e, "/loyalty/promotions/rewards");
344
340
  return this.getResponse(
345
- await this.client.request("GET", r, void 0, this.getApiToken(e))
341
+ await this.client.request("GET", s, void 0, this.getApiToken(e))
346
342
  );
347
343
  }
348
- async getCloudpaymentsReceipt(t, e, r) {
349
- const n = this.getOrderUrl(t, e, `/payments/${r}/receipt`);
344
+ async getCloudpaymentsReceipt(t, e, s) {
345
+ const n = this.getOrderUrl(t, e, `/payments/${s}/receipt`);
350
346
  return this.getResponse(
351
347
  await this.client.request("GET", n, void 0, this.getApiToken(e))
352
348
  );
@@ -354,66 +350,66 @@ class $ extends d {
354
350
  }
355
351
  class D extends d {
356
352
  async getAddressSuggestions(t, e) {
357
- const r = this.getStoreUrl(t, "/suggestions/address");
358
- return this.getResponse(await this.client.request("POST", r, e));
353
+ const s = this.getStoreUrl(t, "/suggestions/address");
354
+ return this.getResponse(await this.client.request("POST", s, e));
359
355
  }
360
356
  }
361
357
  class V extends d {
362
- async getProfile(t, e, r) {
358
+ async getProfile(t, e, s) {
363
359
  const n = this.getStoreUrl(t, "/me", e);
364
- return this.getResponse(await this.client.request("GET", n, null, r));
360
+ return this.getResponse(await this.client.request("GET", n, null, s));
365
361
  }
366
- async updateProfile(t, e, r) {
362
+ async updateProfile(t, e, s) {
367
363
  const n = this.getStoreUrl(t, "/me");
368
- return this.getResponse(await this.client.request("PUT", n, e, r));
364
+ return this.getResponse(await this.client.request("PUT", n, e, s));
369
365
  }
370
- async removeProfile(t, e, r) {
366
+ async removeProfile(t, e, s) {
371
367
  const n = this.getStoreUrl(t, "/me");
372
- return await this.client.request("DELETE", n, e, r), !0;
368
+ return await this.client.request("DELETE", n, e, s), !0;
373
369
  }
374
370
  async getSettings(t, e) {
375
- const r = this.getStoreUrl(t, "/me/settings");
376
- return this.getResponse(await this.client.request("GET", r, null, e));
371
+ const s = this.getStoreUrl(t, "/me/settings");
372
+ return this.getResponse(await this.client.request("GET", s, null, e));
377
373
  }
378
- async updateSettings(t, e, r) {
374
+ async updateSettings(t, e, s) {
379
375
  const n = this.getStoreUrl(t, "/me/settings");
380
- return this.getResponse(await this.client.request("PUT", n, e, r));
376
+ return this.getResponse(await this.client.request("PUT", n, e, s));
381
377
  }
382
- async getAddresses(t, e, r) {
378
+ async getAddresses(t, e, s) {
383
379
  const n = this.getStoreUrl(t, "/me/addresses", e);
384
- return this.getPaginatedResponse(await this.client.request("GET", n, null, r));
380
+ return this.getPaginatedResponse(await this.client.request("GET", n, null, s));
385
381
  }
386
- async createAddress(t, e, r) {
382
+ async createAddress(t, e, s) {
387
383
  const n = this.getStoreUrl(t, "/me/addresses");
388
- return this.getResponse(await this.client.request("POST", n, e, r));
384
+ return this.getResponse(await this.client.request("POST", n, e, s));
389
385
  }
390
- async updateAddress(t, e, r, n) {
386
+ async updateAddress(t, e, s, n) {
391
387
  const i = this.getStoreUrl(t, `/me/addresses/${e}`);
392
- return this.getResponse(await this.client.request("PUT", i, r, n));
388
+ return this.getResponse(await this.client.request("PUT", i, s, n));
393
389
  }
394
- async deleteAddress(t, e, r) {
390
+ async deleteAddress(t, e, s) {
395
391
  const n = this.getStoreUrl(t, `/me/addresses/${e}`);
396
- return await this.client.request("DELETE", n, null, r), !0;
392
+ return await this.client.request("DELETE", n, null, s), !0;
397
393
  }
398
- async getPaymentMethods(t, e, r) {
394
+ async getPaymentMethods(t, e, s) {
399
395
  const n = this.getStoreUrl(t, "/me/payment-methods", e);
400
- return this.getPaginatedResponse(await this.client.request("GET", n, null, r));
396
+ return this.getPaginatedResponse(await this.client.request("GET", n, null, s));
401
397
  }
402
- async deletePaymentMethod(t, e, r) {
398
+ async deletePaymentMethod(t, e, s) {
403
399
  const n = this.getStoreUrl(t, `/me/payment-methods/${e}`);
404
- return await this.client.request("DELETE", n, null, r), !0;
400
+ return await this.client.request("DELETE", n, null, s), !0;
405
401
  }
406
- async getBonusesTransactions(t, e, r) {
402
+ async getBonusesTransactions(t, e, s) {
407
403
  const n = this.getStoreUrl(t, "/me/loyalty/transactions", e);
408
- return this.getPaginatedResponse(await this.client.request("GET", n, null, r));
404
+ return this.getPaginatedResponse(await this.client.request("GET", n, null, s));
409
405
  }
410
406
  async getBonusesBalance(t, e) {
411
- const r = this.getStoreUrl(t, "/me/loyalty/balance");
412
- return this.getResponse(await this.client.request("GET", r, null, e));
407
+ const s = this.getStoreUrl(t, "/me/loyalty/balance");
408
+ return this.getResponse(await this.client.request("GET", s, null, e));
413
409
  }
414
410
  async revokeToken(t, e) {
415
- const r = this.getStoreUrl(t, "/me/logout");
416
- return await this.client.request("POST", r, null, e), !0;
411
+ const s = this.getStoreUrl(t, "/me/logout");
412
+ return await this.client.request("POST", s, null, e), !0;
417
413
  }
418
414
  }
419
415
  /**
@@ -431,8 +427,8 @@ var p = "application/x-postmate-v1+json", x = 5, I = 0, L = function() {
431
427
  }, M = function(t) {
432
428
  var e = document.createElement("a");
433
429
  e.href = t;
434
- var r = e.protocol.length > 4 ? e.protocol : window.location.protocol, n = e.host.length ? e.port === "80" || e.port === "443" ? e.hostname : e.host : window.location.host;
435
- return e.origin || r + "//" + n;
430
+ var s = e.protocol.length > 4 ? e.protocol : window.location.protocol, n = e.host.length ? e.port === "80" || e.port === "443" ? e.hostname : e.host : window.location.host;
431
+ return e.origin || s + "//" + n;
436
432
  }, z = {
437
433
  handshake: 1,
438
434
  "handshake-reply": 1,
@@ -446,23 +442,23 @@ var p = "application/x-postmate-v1+json", x = 5, I = 0, L = function() {
446
442
  * @param {String|Boolean} allowedOrigin The whitelisted origin or false to skip origin check
447
443
  * @return {Boolean}
448
444
  */
449
- }, E = function(t, e) {
445
+ }, O = function(t, e) {
450
446
  return !(typeof e == "string" && t.origin !== e || !t.data || typeof t.data == "object" && !("postmate" in t.data) || t.data.type !== p || !z[t.data.postmate]);
451
447
  }, j = function(t, e) {
452
- var r = typeof t[e] == "function" ? t[e]() : t[e];
453
- return g.Promise.resolve(r);
448
+ var s = typeof t[e] == "function" ? t[e]() : t[e];
449
+ return g.Promise.resolve(s);
454
450
  }, H = /* @__PURE__ */ function() {
455
- function s(e) {
456
- var r = this;
451
+ function r(e) {
452
+ var s = this;
457
453
  this.parent = e.parent, this.frame = e.frame, this.child = e.child, this.childOrigin = e.childOrigin, this.events = {}, process.env.NODE_ENV !== "production" && (h("Parent: Registering API"), h("Parent: Awaiting messages...")), this.listener = function(n) {
458
- if (!E(n, r.childOrigin))
454
+ if (!O(n, s.childOrigin))
459
455
  return !1;
460
456
  var i = ((n || {}).data || {}).value || {}, a = i.data, o = i.name;
461
- n.data.postmate === "emit" && (process.env.NODE_ENV !== "production" && h("Parent: Received event emission: " + o), o in r.events && r.events[o].call(r, a));
457
+ n.data.postmate === "emit" && (process.env.NODE_ENV !== "production" && h("Parent: Received event emission: " + o), o in s.events && s.events[o].call(s, a));
462
458
  }, this.parent.addEventListener("message", this.listener, !1), process.env.NODE_ENV !== "production" && h("Parent: Awaiting event emissions from Child");
463
459
  }
464
- var t = s.prototype;
465
- return t.get = function(r) {
460
+ var t = r.prototype;
461
+ return t.get = function(s) {
466
462
  var n = this;
467
463
  return new g.Promise(function(i) {
468
464
  var a = L(), o = function u(c) {
@@ -471,34 +467,34 @@ var p = "application/x-postmate-v1+json", x = 5, I = 0, L = function() {
471
467
  n.parent.addEventListener("message", o, !1), n.child.postMessage({
472
468
  postmate: "request",
473
469
  type: p,
474
- property: r,
470
+ property: s,
475
471
  uid: a
476
472
  }, n.childOrigin);
477
473
  });
478
- }, t.call = function(r, n) {
474
+ }, t.call = function(s, n) {
479
475
  this.child.postMessage({
480
476
  postmate: "call",
481
477
  type: p,
482
- property: r,
478
+ property: s,
483
479
  data: n
484
480
  }, this.childOrigin);
485
- }, t.on = function(r, n) {
486
- this.events[r] = n;
481
+ }, t.on = function(s, n) {
482
+ this.events[s] = n;
487
483
  }, t.destroy = function() {
488
484
  process.env.NODE_ENV !== "production" && h("Parent: Destroying Postmate instance"), window.removeEventListener("message", this.listener, !1), this.frame.parentNode.removeChild(this.frame);
489
- }, s;
485
+ }, r;
490
486
  }(), F = /* @__PURE__ */ function() {
491
- function s(e) {
492
- var r = this;
487
+ function r(e) {
488
+ var s = this;
493
489
  this.model = e.model, this.parent = e.parent, this.parentOrigin = e.parentOrigin, this.child = e.child, process.env.NODE_ENV !== "production" && (h("Child: Registering API"), h("Child: Awaiting messages...")), this.child.addEventListener("message", function(n) {
494
- if (E(n, r.parentOrigin)) {
490
+ if (O(n, s.parentOrigin)) {
495
491
  process.env.NODE_ENV !== "production" && h("Child: Received request", n.data);
496
492
  var i = n.data, a = i.property, o = i.uid, u = i.data;
497
493
  if (n.data.postmate === "call") {
498
- a in r.model && typeof r.model[a] == "function" && r.model[a](u);
494
+ a in s.model && typeof s.model[a] == "function" && s.model[a](u);
499
495
  return;
500
496
  }
501
- j(r.model, a).then(function(c) {
497
+ j(s.model, a).then(function(c) {
502
498
  return n.source.postMessage({
503
499
  property: a,
504
500
  postmate: "reply",
@@ -510,28 +506,28 @@ var p = "application/x-postmate-v1+json", x = 5, I = 0, L = function() {
510
506
  }
511
507
  });
512
508
  }
513
- var t = s.prototype;
514
- return t.emit = function(r, n) {
515
- process.env.NODE_ENV !== "production" && h('Child: Emitting Event "' + r + '"', n), this.parent.postMessage({
509
+ var t = r.prototype;
510
+ return t.emit = function(s, n) {
511
+ process.env.NODE_ENV !== "production" && h('Child: Emitting Event "' + s + '"', n), this.parent.postMessage({
516
512
  postmate: "emit",
517
513
  type: p,
518
514
  value: {
519
- name: r,
515
+ name: s,
520
516
  data: n
521
517
  }
522
518
  }, this.parentOrigin);
523
- }, s;
519
+ }, r;
524
520
  }(), g = /* @__PURE__ */ function() {
525
- function s(e) {
526
- var r = e.container, n = r === void 0 ? typeof n < "u" ? n : document.body : r, i = e.model, a = e.url, o = e.name, u = e.classListArray, c = u === void 0 ? [] : u;
521
+ function r(e) {
522
+ var s = e.container, n = s === void 0 ? typeof n < "u" ? n : document.body : s, i = e.model, a = e.url, o = e.name, u = e.classListArray, c = u === void 0 ? [] : u;
527
523
  return this.parent = window, this.frame = document.createElement("iframe"), this.frame.name = o || "", this.frame.classList.add.apply(this.frame.classList, c), n.appendChild(this.frame), this.child = this.frame.contentWindow || this.frame.contentDocument.parentWindow, this.model = i || {}, this.sendHandshake(a);
528
524
  }
529
- var t = s.prototype;
530
- return t.sendHandshake = function(r) {
531
- var n = this, i = M(r), a = 0, o;
532
- return new s.Promise(function(u, c) {
525
+ var t = r.prototype;
526
+ return t.sendHandshake = function(s) {
527
+ var n = this, i = M(s), a = 0, o;
528
+ return new r.Promise(function(u, c) {
533
529
  var m = function v(y) {
534
- return E(y, i) ? y.data.postmate === "handshake-reply" ? (clearInterval(o), process.env.NODE_ENV !== "production" && h("Parent: Received handshake reply from Child"), n.parent.removeEventListener("message", v, !1), n.childOrigin = y.origin, process.env.NODE_ENV !== "production" && h("Parent: Saving Child origin", n.childOrigin), u(new H(n))) : (process.env.NODE_ENV !== "production" && h("Parent: Invalid handshake reply"), c("Failed handshake")) : !1;
530
+ return O(y, i) ? y.data.postmate === "handshake-reply" ? (clearInterval(o), process.env.NODE_ENV !== "production" && h("Parent: Received handshake reply from Child"), n.parent.removeEventListener("message", v, !1), n.childOrigin = y.origin, process.env.NODE_ENV !== "production" && h("Parent: Saving Child origin", n.childOrigin), u(new H(n))) : (process.env.NODE_ENV !== "production" && h("Parent: Invalid handshake reply"), c("Failed handshake")) : !1;
535
531
  };
536
532
  n.parent.addEventListener("message", m, !1);
537
533
  var f = function() {
@@ -546,10 +542,10 @@ var p = "application/x-postmate-v1+json", x = 5, I = 0, L = function() {
546
542
  f(), o = setInterval(f, 500);
547
543
  };
548
544
  n.frame.attachEvent ? n.frame.attachEvent("onload", w) : n.frame.onload = w, process.env.NODE_ENV !== "production" && h("Parent: Loading frame", {
549
- url: r
550
- }), n.frame.src = r;
545
+ url: s
546
+ }), n.frame.src = s;
551
547
  });
552
- }, s;
548
+ }, r;
553
549
  }();
554
550
  g.debug = !1;
555
551
  g.Promise = function() {
@@ -560,62 +556,62 @@ g.Promise = function() {
560
556
  }
561
557
  }();
562
558
  g.Model = /* @__PURE__ */ function() {
563
- function s(e) {
559
+ function r(e) {
564
560
  return this.child = window, this.model = e, this.parent = this.child.parent, this.sendHandshakeReply();
565
561
  }
566
- var t = s.prototype;
562
+ var t = r.prototype;
567
563
  return t.sendHandshakeReply = function() {
568
- var r = this;
564
+ var s = this;
569
565
  return new g.Promise(function(n, i) {
570
566
  var a = function o(u) {
571
567
  if (u.data.postmate) {
572
568
  if (u.data.postmate === "handshake") {
573
- process.env.NODE_ENV !== "production" && h("Child: Received handshake from Parent"), r.child.removeEventListener("message", o, !1), process.env.NODE_ENV !== "production" && h("Child: Sending handshake reply to Parent"), u.source.postMessage({
569
+ process.env.NODE_ENV !== "production" && h("Child: Received handshake from Parent"), s.child.removeEventListener("message", o, !1), process.env.NODE_ENV !== "production" && h("Child: Sending handshake reply to Parent"), u.source.postMessage({
574
570
  postmate: "handshake-reply",
575
571
  type: p
576
- }, u.origin), r.parentOrigin = u.origin;
572
+ }, u.origin), s.parentOrigin = u.origin;
577
573
  var c = u.data.model;
578
574
  return c && (Object.keys(c).forEach(function(m) {
579
- r.model[m] = c[m];
580
- }), process.env.NODE_ENV !== "production" && h("Child: Inherited and extended model from Parent")), process.env.NODE_ENV !== "production" && h("Child: Saving Parent origin", r.parentOrigin), n(new F(r));
575
+ s.model[m] = c[m];
576
+ }), process.env.NODE_ENV !== "production" && h("Child: Inherited and extended model from Parent")), process.env.NODE_ENV !== "production" && h("Child: Saving Parent origin", s.parentOrigin), n(new F(s));
581
577
  }
582
578
  return i("Handshake Reply Failed");
583
579
  }
584
580
  };
585
- r.child.addEventListener("message", a, !1);
581
+ s.child.addEventListener("message", a, !1);
586
582
  });
587
- }, s;
583
+ }, r;
588
584
  }();
589
585
  class W extends d {
590
586
  async checkPhone(t, e) {
591
- const r = this.getStoreUrl(t, "/auth/check");
592
- return this.getResponse(await this.client.request("POST", r, e));
587
+ const s = this.getStoreUrl(t, "/auth/check");
588
+ return this.getResponse(await this.client.request("POST", s, e));
593
589
  }
594
590
  async register(t, e) {
595
- const r = this.getStoreUrl(t, "/auth/register");
596
- return this.getResponse(await this.client.request("POST", r, e));
591
+ const s = this.getStoreUrl(t, "/auth/register");
592
+ return this.getResponse(await this.client.request("POST", s, e));
597
593
  }
598
594
  async confirmRegistration(t, e) {
599
- const r = this.getStoreUrl(t, "/auth/register/confirm");
600
- return this.getResponse(await this.client.request("POST", r, e));
595
+ const s = this.getStoreUrl(t, "/auth/register/confirm");
596
+ return this.getResponse(await this.client.request("POST", s, e));
601
597
  }
602
598
  async resendRegistrationConfirmation(t, e) {
603
- const r = this.getStoreUrl(t, "/auth/register/resend");
604
- return this.getResponse(await this.client.request("POST", r, e));
599
+ const s = this.getStoreUrl(t, "/auth/register/resend");
600
+ return this.getResponse(await this.client.request("POST", s, e));
605
601
  }
606
602
  async login(t, e) {
607
- const r = this.getStoreUrl(t, "/auth/login");
608
- return this.getResponse(await this.client.request("POST", r, e));
603
+ const s = this.getStoreUrl(t, "/auth/login");
604
+ return this.getResponse(await this.client.request("POST", s, e));
609
605
  }
610
606
  async dispatchPasswordReset(t, e) {
611
- const r = this.getStoreUrl(t, "/auth/password/request");
612
- return this.getResponse(await this.client.request("POST", r, e));
607
+ const s = this.getStoreUrl(t, "/auth/password/request");
608
+ return this.getResponse(await this.client.request("POST", s, e));
613
609
  }
614
610
  async resetPassword(t, e) {
615
- const r = this.getStoreUrl(t, "/auth/password/reset");
616
- return this.getResponse(await this.client.request("POST", r, e));
611
+ const s = this.getStoreUrl(t, "/auth/password/reset");
612
+ return this.getResponse(await this.client.request("POST", s, e));
617
613
  }
618
- useAuthenticationModal(t, e, r, n = {}) {
614
+ useAuthenticationModal(t, e, s, n = {}) {
619
615
  const i = `${this.client.getBaseAuthUrl()}/?store_id=${t}&response_type=post_message`;
620
616
  let a = null, o = null;
621
617
  return {
@@ -626,7 +622,7 @@ class W extends d {
626
622
  container: f,
627
623
  url: i
628
624
  }), a.then((w) => {
629
- o = w, o.on("zenky:auth:token", r), o.on("zenky:auth:resize", (v) => {
625
+ o = w, o.on("zenky:auth:token", s), o.on("zenky:auth:resize", (v) => {
630
626
  o.frame.style.height = `${v}px`;
631
627
  }), m(!0);
632
628
  });
@@ -637,7 +633,7 @@ class W extends d {
637
633
  };
638
634
  }
639
635
  }
640
- class Ee {
636
+ class Oe {
641
637
  constructor(t, e) {
642
638
  l(this, "client");
643
639
  l(this, "store");
@@ -652,14 +648,14 @@ class Ee {
652
648
  l(this, "offers");
653
649
  l(this, "articles");
654
650
  l(this, "feedback");
655
- const r = k.build(t, e);
656
- this.store = new T(r), this.auth = new W(r), this.customer = new V(r), this.catalog = new S(r), this.categories = new A(r), this.products = new G(r), this.addresses = new D(r), this.orders = new $(r), this.collections = new _(r), this.offers = new C(r), this.articles = new q(r), this.feedback = new N(r), this.client = r;
651
+ const s = k.build(t, e);
652
+ this.store = new T(s), this.auth = new W(s), this.customer = new V(s), this.catalog = new S(s), this.categories = new A(s), this.products = new G(s), this.addresses = new D(s), this.orders = new $(s), this.collections = new _(s), this.offers = new C(s), this.articles = new q(s), this.feedback = new N(s), this.client = s;
657
653
  }
658
654
  setApiToken(t) {
659
655
  return this.client.setToken(t), this;
660
656
  }
661
657
  }
662
- var Z = /* @__PURE__ */ ((s) => (s.Female = "female", s.Male = "male", s.Other = "other", s))(Z || {}), J = /* @__PURE__ */ ((s) => (s.CloudPayments = "cloudpayments", s))(J || {}), X = /* @__PURE__ */ ((s) => (s.Visa = "visa", s.MasterCard = "master-card", s.MIR = "mir", s.Maestro = "maestro", s.AmericanExpress = "american-express", s.DinersClub = "diners-club", s.Discover = "discover", s.JCB = "jcb", s.UnionPay = "union-pay", s))(X || {}), B = /* @__PURE__ */ ((s) => (s.Select = "select", s.MutipleSelect = "mutiple_select", s.Checkboxes = "checkboxes", s.Radios = "radios", s.Range = "range", s.Text = "text", s))(B || {}), Y = /* @__PURE__ */ ((s) => (s.Integer = "integer", s.Float = "float", s))(Y || {}), Q = /* @__PURE__ */ ((s) => (s.Increase = "increase", s.Decrease = "decrease", s))(Q || {}), K = /* @__PURE__ */ ((s) => (s.Pending = "pending", s.Confirmed = "confirmed", s.Cancelled = "cancelled", s.Rejected = "rejected", s.Refunded = "refunded", s.PartiallyRefunded = "partially_refunded", s))(K || {}), ee = /* @__PURE__ */ ((s) => (s.Manual = "manual", s.Cashback = "cashback", s.ReferralReward = "referral_reward", s.RecruitReward = "recruit_reward", s.Payment = "payment", s.Cancellation = "cancellation", s.Refund = "refund", s.Adjustment = "adjustment", s.WelcomeBonuses = "welcome_bonuses", s.PromotionReward = "promotion_reward", s.External = "external", s))(ee || {}), te = /* @__PURE__ */ ((s) => (s.Delivery = "delivery", s.Pickup = "pickup", s.OnPremise = "on_premise", s))(te || {}), re = /* @__PURE__ */ ((s) => (s.Payment = "payment", s.Refund = "refund", s))(re || {}), se = /* @__PURE__ */ ((s) => (s.Cash = "cash", s.CreditCard = "credit-card", s.CloudPayments = "cloudpayments", s.CardToken = "card_token", s.Bonuses = "bonuses", s))(se || {}), ne = /* @__PURE__ */ ((s) => (s.Pending = "pending", s.Confirmed = "confirmed", s.Cancelled = "cancelled", s.PendingRefund = "pending_refund", s.Refunding = "refunding", s.Refunded = "refunded", s))(ne || {}), ie = /* @__PURE__ */ ((s) => (s.Auth = "auth", s.Charge = "charge", s))(ie || {}), ae = /* @__PURE__ */ ((s) => (s.PersonsCount = "persons_count", s.DeliveryTime = "delivery_time", s.DeliveryIntervals = "delivery_intervals", s))(ae || {}), oe = /* @__PURE__ */ ((s) => (s.PriceMismatch = "price_mismatch", s.OutOfStock = "out_of_stock", s.Unavailable = "unavailable", s))(oe || {}), le = /* @__PURE__ */ ((s) => (s.None = "none", s.Cleanup = "cleanup", s))(le || {}), ce = /* @__PURE__ */ ((s) => (s.Piece = "piece", s.Gram = "gram", s.Kilogram = "kilogram", s.Meter = "meter", s))(ce || {}), ue = /* @__PURE__ */ ((s) => (s.Weight = "weight", s.Width = "width", s.Height = "height", s.Length = "length", s))(ue || {}), he = /* @__PURE__ */ ((s) => (s.Netto = "netto", s.Brutto = "brutto", s))(he || {}), de = /* @__PURE__ */ ((s) => (s.Color = "color", s))(de || {}), ge = /* @__PURE__ */ ((s) => (s.Category = "category", s.Group = "group", s.VariantOption = "variant_option", s.VariantOptionValue = "variant_option_value", s))(ge || {}), pe = /* @__PURE__ */ ((s) => (s.Amount = "amount", s.Percentage = "percentage", s))(pe || {}), me = /* @__PURE__ */ ((s) => (s.Email = "email", s.Website = "website", s.Vk = "vk", s.Facebook = "facebook", s.Instagram = "instagram", s.Twitter = "twitter", s.Ok = "ok", s.Tiktok = "tiktok", s))(me || {}), ve = /* @__PURE__ */ ((s) => (s.Yes = "yes", s.No = "no", s.Both = "both", s))(ve || {}), fe = /* @__PURE__ */ ((s) => (s.Disabled = "disabled", s.Preauth = "preauth", s.Confirmation = "confirmation", s))(fe || {}), we = /* @__PURE__ */ ((s) => (s.Dadata = "dadata", s.Manual = "manual", s))(we || {}), ye = /* @__PURE__ */ ((s) => (s.Registration = "registration", s.ResendRegistrationCode = "resend_registration_code", s.ResetPassword = "reset_password", s.OrderSubmission = "order_submission", s.FeedbackRequest = "feedback_request", s.CallbackRequest = "callback_request", s))(ye || {});
658
+ var Z = /* @__PURE__ */ ((r) => (r.Female = "female", r.Male = "male", r.Other = "other", r))(Z || {}), J = /* @__PURE__ */ ((r) => (r.CloudPayments = "cloudpayments", r))(J || {}), X = /* @__PURE__ */ ((r) => (r.Visa = "visa", r.MasterCard = "master-card", r.MIR = "mir", r.Maestro = "maestro", r.AmericanExpress = "american-express", r.DinersClub = "diners-club", r.Discover = "discover", r.JCB = "jcb", r.UnionPay = "union-pay", r))(X || {}), B = /* @__PURE__ */ ((r) => (r.Select = "select", r.MutipleSelect = "mutiple_select", r.Checkboxes = "checkboxes", r.Radios = "radios", r.Range = "range", r.Text = "text", r))(B || {}), Y = /* @__PURE__ */ ((r) => (r.Integer = "integer", r.Float = "float", r))(Y || {}), Q = /* @__PURE__ */ ((r) => (r.Increase = "increase", r.Decrease = "decrease", r))(Q || {}), K = /* @__PURE__ */ ((r) => (r.Pending = "pending", r.Confirmed = "confirmed", r.Cancelled = "cancelled", r.Rejected = "rejected", r.Refunded = "refunded", r.PartiallyRefunded = "partially_refunded", r))(K || {}), ee = /* @__PURE__ */ ((r) => (r.Manual = "manual", r.Cashback = "cashback", r.ReferralReward = "referral_reward", r.RecruitReward = "recruit_reward", r.Payment = "payment", r.Cancellation = "cancellation", r.Refund = "refund", r.Adjustment = "adjustment", r.WelcomeBonuses = "welcome_bonuses", r.PromotionReward = "promotion_reward", r.External = "external", r))(ee || {}), te = /* @__PURE__ */ ((r) => (r.Delivery = "delivery", r.Pickup = "pickup", r.OnPremise = "on_premise", r))(te || {}), re = /* @__PURE__ */ ((r) => (r.Payment = "payment", r.Refund = "refund", r))(re || {}), se = /* @__PURE__ */ ((r) => (r.Cash = "cash", r.CreditCard = "credit-card", r.CloudPayments = "cloudpayments", r.CardToken = "card_token", r.Bonuses = "bonuses", r))(se || {}), ne = /* @__PURE__ */ ((r) => (r.Pending = "pending", r.Confirmed = "confirmed", r.Cancelled = "cancelled", r.PendingRefund = "pending_refund", r.Refunding = "refunding", r.Refunded = "refunded", r))(ne || {}), ie = /* @__PURE__ */ ((r) => (r.Auth = "auth", r.Charge = "charge", r))(ie || {}), ae = /* @__PURE__ */ ((r) => (r.PersonsCount = "persons_count", r.DeliveryTime = "delivery_time", r.DeliveryIntervals = "delivery_intervals", r))(ae || {}), oe = /* @__PURE__ */ ((r) => (r.PriceMismatch = "price_mismatch", r.OutOfStock = "out_of_stock", r.Unavailable = "unavailable", r))(oe || {}), le = /* @__PURE__ */ ((r) => (r.None = "none", r.Cleanup = "cleanup", r))(le || {}), ce = /* @__PURE__ */ ((r) => (r.Piece = "piece", r.Gram = "gram", r.Kilogram = "kilogram", r.Meter = "meter", r))(ce || {}), ue = /* @__PURE__ */ ((r) => (r.Weight = "weight", r.Width = "width", r.Height = "height", r.Length = "length", r))(ue || {}), he = /* @__PURE__ */ ((r) => (r.Netto = "netto", r.Brutto = "brutto", r))(he || {}), de = /* @__PURE__ */ ((r) => (r.Color = "color", r))(de || {}), ge = /* @__PURE__ */ ((r) => (r.Category = "category", r.Group = "group", r.VariantOption = "variant_option", r.VariantOptionValue = "variant_option_value", r))(ge || {}), pe = /* @__PURE__ */ ((r) => (r.Amount = "amount", r.Percentage = "percentage", r))(pe || {}), me = /* @__PURE__ */ ((r) => (r.Email = "email", r.Website = "website", r.Vk = "vk", r.Facebook = "facebook", r.Instagram = "instagram", r.Twitter = "twitter", r.Ok = "ok", r.Tiktok = "tiktok", r))(me || {}), ve = /* @__PURE__ */ ((r) => (r.Yes = "yes", r.No = "no", r.Both = "both", r))(ve || {}), fe = /* @__PURE__ */ ((r) => (r.Disabled = "disabled", r.Preauth = "preauth", r.Confirmation = "confirmation", r))(fe || {}), we = /* @__PURE__ */ ((r) => (r.Dadata = "dadata", r.Manual = "manual", r))(we || {}), ye = /* @__PURE__ */ ((r) => (r.Registration = "registration", r.ResendRegistrationCode = "resend_registration_code", r.ResetPassword = "reset_password", r.OrderSubmission = "order_submission", r.FeedbackRequest = "feedback_request", r.CallbackRequest = "callback_request", r))(ye || {});
663
659
  export {
664
660
  J as AcquiringType,
665
661
  U as AddressSuggestionsProvider,
@@ -698,7 +694,7 @@ export {
698
694
  ve as TernaryFilter,
699
695
  ce as UnitType,
700
696
  de as VariantOptionType,
701
- O as ZenkyError,
697
+ E as ZenkyError,
702
698
  b as ZenkyErrorBuilder,
703
- Ee as ZenkyStorefront
699
+ Oe as ZenkyStorefront
704
700
  };
@@ -1,4 +1,4 @@
1
- (function(i,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(i=typeof globalThis<"u"?globalThis:i||self,p(i.zenkyStorefrontApi={}))})(this,function(i){"use strict";var ke=Object.defineProperty;var Oe=(i,p,h)=>p in i?ke(i,p,{enumerable:!0,configurable:!0,writable:!0,value:h}):i[p]=h;var c=(i,p,h)=>(Oe(i,typeof p!="symbol"?p+"":p,h),h);var p=(s=>(s.DADATA="dadata",s))(p||{});class h{constructor(t){this.client=t}getStoreUrl(t,e,r={}){return this.client.getStoreUrl(t,e,r)}getPaginatedResponse(t){if(!t||!Array.isArray(t.data)||!t.meta||!t.meta.pagination)throw new Error("getPaginatedResponse(): Invalid response.");const e=t.data,r=t.meta.pagination;return{items:e,pagination:r}}getResponse(t){if(!t||!t.data)throw new Error("getResponse(): Invalid response.");return t.data}}class U extends h{async getArticleCategories(t){const e=this.getStoreUrl(t,"/articles/categories");return this.getPaginatedResponse(await this.client.request("GET",e))}async getArticleCategory(t,e){const r=this.getStoreUrl(t,`/articles/categories/${e}`);return this.getResponse(await this.client.request("GET",r))}async getArticles(t,e){const r=this.getStoreUrl(t,"/articles",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getArticle(t,e,r){const n=this.getStoreUrl(t,`/articles/${e}`,r);return this.getResponse(await this.client.request("GET",n))}}class S extends h{async getCatalog(t,e){const r=this.getStoreUrl(t,"/catalog",e);return this.getResponse(await this.client.request("GET",r))}async getRemoteCatalog(t,e){const r=this.getStoreUrl(t,"/catalog/url",e);return this.getResponse(await this.client.request("GET",r))}async getCatalogFromRemoteUrl(t,e){const r=await this.getRemoteCatalog(t,e);return this.getResponse(await this.client.request("GET",r.url))}}class T extends h{async getCategories(t,e){const r=this.getStoreUrl(t,"/categories",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getCategoriesTree(t,e){const r=this.getStoreUrl(t,"/categories/tree",e);return this.getResponse(await this.client.request("GET",r))}async getCategory(t,e,r){const n=this.getStoreUrl(t,`/categories/${e}`,r);return this.getResponse(await this.client.request("GET",n))}async getFeaturesGroups(t,e){const r=this.getStoreUrl(t,`/categories/${e}/features/groups`);return this.getResponse(await this.client.request("GET",r))}async getFeatures(t,e){const r=this.getStoreUrl(t,`/categories/${e}/features`);return this.getResponse(await this.client.request("GET",r))}}class O extends Error{constructor(e,r){super(e);c(this,"err");this.err=r}}class q{static async build(t){const e=await t.json();switch(t.status){case 401:return new O((e==null?void 0:e.message)??"Unauthenticated.",null);default:return new O(e==null?void 0:e.message,(e==null?void 0:e.error)||null)}}}class R{constructor(t,e,r,n,a,o,l){c(this,"baseUrl");c(this,"baseAuthUrl");c(this,"token");c(this,"client");c(this,"timezone");c(this,"fetchFunction");c(this,"fetchOptions");this.baseUrl=t,this.baseAuthUrl=e,this.token=r,this.client=n,this.timezone=a,this.fetchFunction=typeof o=="function"?o:fetch,this.fetchOptions=typeof l<"u"?l:{}}static build(t,e){return new R((t==null?void 0:t.baseUrl)||"https://storefront.zenky.io/v1",(t==null?void 0:t.baseAuthUrl)||"https://auth.zenky.io/",(t==null?void 0:t.token)||null,(t==null?void 0:t.client)||"web",(t==null?void 0:t.timezone)||"UTC",e,t==null?void 0:t.fetchOptions)}setToken(t){return this.token=t,this}getBaseAuthUrl(){return this.baseAuthUrl}getStoreUrl(t,e,r={}){return this.getUrl(`/store/${t}${e}`,r)}getUrl(t,e={}){if(!Object.keys(e).length)return t;const r=[];Object.keys(e).forEach(a=>{e[a]===void 0||e[a]===null||r.push(`${a}=${e[a]}`)});const n=t.includes("?")?"&":"?";return`${t}${n}${r.join("&")}`}async request(t,e,r,n){const a=!e.startsWith("/"),o={Accept:"application/json","X-Zenky-Client":this.client,"X-Timezone":this.timezone};n?o.Authorization=`Bearer ${n}`:this.token&&(o.Authorization=`Bearer ${this.token}`);const l={method:t,mode:"cors",...this.fetchOptions};r&&(o["Content-Type"]="application/json",l.body=JSON.stringify(r)),l.headers=a?{Accept:"application/json"}:o;const g=a?e:`${this.baseUrl}${e}`,u=await this.fetchFunction.call(null,g,l);if(u.ok)return u.status===204?!0:u.json();throw await q.build(u)}}class A extends h{async getStore(t){const e=this.client.getUrl(`/store/${t}`);return this.getResponse(await this.client.request("GET",e))}async getStoreByBundleId(t){const e=this.client.getUrl(`/store/by-bundle/${t}`);return this.getResponse(await this.client.request("GET",e))}}class b extends h{async getCollections(t,e){const r=this.getStoreUrl(t,"/collections",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getCollection(t,e){const r=this.getStoreUrl(t,`/collections/${e}`);return this.getResponse(await this.client.request("GET",r))}}class C extends h{async getOffers(t,e){const r=this.getStoreUrl(t,"/offers",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getOffer(t,e,r){const n=this.getStoreUrl(t,`/offers/${e}`,r);return this.getResponse(await this.client.request("GET",n))}}class _ extends h{async createFeedback(t,e){const r=this.getStoreUrl(t,"/feedback",e);return this.getResponse(await this.client.request("POST",r))}async createCallback(t,e){const r=this.getStoreUrl(t,"/callback",e);return await this.client.request("POST",r),!0}}class N extends h{async getProducts(t,e){const r=this.getStoreUrl(t,"/products",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getProduct(t,e,r){const n=this.getStoreUrl(t,`/products/${e}`,r);return this.getResponse(await this.client.request("GET",n))}async getProductVariantPrice(t,e,r,n){const a=this.getStoreUrl(t,`/products/${e}/variants/${r}/price`);return this.getResponse(await this.client.request("POST",a,n))}}class G extends h{getOrderUrl(t,e,r,n){const a=typeof e=="string"?e:e.id,o=typeof e=="string"?void 0:e.token;return this.getStoreUrl(t,`/orders/${a}${r}${o?"?token="+o:""}`,n)}getApiToken(t){if(!(typeof t=="string"||typeof t.api_token>"u"))return t.api_token}async getOrders(t,e,r){const n=this.getStoreUrl(t,"/orders",e);return this.getPaginatedResponse(await this.client.request("GET",n,void 0,r))}async createOrder(t,e,r){const n=this.getStoreUrl(t,"/orders");return this.getResponse(await this.client.request("POST",n,e,r))}async getOrder(t,e,r){const n=this.getOrderUrl(t,e,"",r);return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderSettings(t,e){const r=this.getOrderUrl(t,e,"/settings");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async addProductVariantToOrder(t,e,r){const n=this.getOrderUrl(t,e,"/products");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async removeProductVariantFromOrder(t,e,r){const n=this.getOrderUrl(t,e,"/products/remove");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async checkProducts(t,e){const r=this.getOrderUrl(t,e,"/products/check");return this.getResponse(await this.client.request("POST",r,void 0,this.getApiToken(e)))}async getOrderCheckoutUrl(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/url");return this.getResponse(await this.client.request("POST",n,{redirect_url:r},this.getApiToken(e))).url}async setOrderCustomer(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/customer");return await this.client.request("POST",n,r,this.getApiToken(e)),!0}async setOrderDeliveryMethod(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/delivery");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async setOrderPayments(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/payments");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async getOrderPromocode(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/promocode");return this.getResponse(await this.client.request("GET",n,r,this.getApiToken(e)))}async setOrderPromocode(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/promocode");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async removeOrderPromocode(t,e){const r=this.getOrderUrl(t,e,"/checkout/promocode");return await this.client.request("DELETE",r,null,this.getApiToken(e)),!0}async getOrderBonusesPreview(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/payments/bonuses",{amount:r});return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderTotal(t,e){const r=this.getOrderUrl(t,e,"/checkout/total");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async checkoutOrder(t,e,r){const n=this.getOrderUrl(t,e,"/checkout");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async confirmOrder(t,e,r){const n=this.getOrderUrl(t,e,"/confirm");return await this.client.request("POST",n,r,this.getApiToken(e)),!0}async resendOrderConfirmationCode(t,e){const r=this.getOrderUrl(t,e,"/confirm/resend");return await this.client.request("POST",r,void 0,this.getApiToken(e)),!0}async getOrderBonusesTransactions(t,e,r){const n=this.getOrderUrl(t,e,"/loyalty/transactions",r);return this.getPaginatedResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderCashbackTransaction(t,e){const r=this.getOrderUrl(t,e,"/loyalty/transactions/cashback");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async dispatchPromotionsChecker(t,e){const r=this.getOrderUrl(t,e,"/loyalty/promotions/check");return this.getResponse(await this.client.request("POST",r,void 0,this.getApiToken(e))).dispatched}async getOrderPromotionRewards(t,e){const r=this.getOrderUrl(t,e,"/loyalty/promotions/rewards");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async getCloudpaymentsReceipt(t,e,r){const n=this.getOrderUrl(t,e,`/payments/${r}/receipt`);return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}}class le extends h{async getAddressSuggestions(t,e){const r=this.getStoreUrl(t,"/suggestions/address");return this.getResponse(await this.client.request("POST",r,e))}}class ce extends h{async getProfile(t,e,r){const n=this.getStoreUrl(t,"/me",e);return this.getResponse(await this.client.request("GET",n,null,r))}async updateProfile(t,e,r){const n=this.getStoreUrl(t,"/me");return this.getResponse(await this.client.request("PUT",n,e,r))}async removeProfile(t,e,r){const n=this.getStoreUrl(t,"/me");return await this.client.request("DELETE",n,e,r),!0}async getSettings(t,e){const r=this.getStoreUrl(t,"/me/settings");return this.getResponse(await this.client.request("GET",r,null,e))}async updateSettings(t,e,r){const n=this.getStoreUrl(t,"/me/settings");return this.getResponse(await this.client.request("PUT",n,e,r))}async getAddresses(t,e,r){const n=this.getStoreUrl(t,"/me/addresses",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async createAddress(t,e,r){const n=this.getStoreUrl(t,"/me/addresses");return this.getResponse(await this.client.request("POST",n,e,r))}async updateAddress(t,e,r,n){const a=this.getStoreUrl(t,`/me/addresses/${e}`);return this.getResponse(await this.client.request("PUT",a,r,n))}async deleteAddress(t,e,r){const n=this.getStoreUrl(t,`/me/addresses/${e}`);return await this.client.request("DELETE",n,null,r),!0}async getPaymentMethods(t,e,r){const n=this.getStoreUrl(t,"/me/payment-methods",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async deletePaymentMethod(t,e,r){const n=this.getStoreUrl(t,`/me/payment-methods/${e}`);return await this.client.request("DELETE",n,null,r),!0}async getBonusesTransactions(t,e,r){const n=this.getStoreUrl(t,"/me/loyalty/transactions",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async getBonusesBalance(t,e){const r=this.getStoreUrl(t,"/me/loyalty/balance");return this.getResponse(await this.client.request("GET",r,null,e))}async revokeToken(t,e){const r=this.getStoreUrl(t,"/me/logout");return await this.client.request("POST",r,null,e),!0}}/**
1
+ (function(i,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(i=typeof globalThis<"u"?globalThis:i||self,p(i.zenkyStorefrontApi={}))})(this,function(i){"use strict";var ke=Object.defineProperty;var Oe=(i,p,h)=>p in i?ke(i,p,{enumerable:!0,configurable:!0,writable:!0,value:h}):i[p]=h;var c=(i,p,h)=>(Oe(i,typeof p!="symbol"?p+"":p,h),h);var p=(s=>(s.DADATA="dadata",s))(p||{});class h{constructor(t){this.client=t}getStoreUrl(t,e,r={}){return this.client.getStoreUrl(t,e,r)}getPaginatedResponse(t){if(!t||!Array.isArray(t.data)||!t.meta||!t.meta.pagination)throw new Error("getPaginatedResponse(): Invalid response.");const e=t.data,r=t.meta.pagination;return{items:e,pagination:r}}getResponse(t){if(!t||!t.data)throw new Error("getResponse(): Invalid response.");return t.data}}class U extends h{async getArticleCategories(t){const e=this.getStoreUrl(t,"/articles/categories");return this.getPaginatedResponse(await this.client.request("GET",e))}async getArticleCategory(t,e){const r=this.getStoreUrl(t,`/articles/categories/${e}`);return this.getResponse(await this.client.request("GET",r))}async getArticles(t,e){const r=this.getStoreUrl(t,"/articles",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getArticle(t,e,r){const n=this.getStoreUrl(t,`/articles/${e}`,r);return this.getResponse(await this.client.request("GET",n))}}class S extends h{async getRemoteCatalog(t,e){const r=this.getStoreUrl(t,"/catalog",e);return this.getResponse(await this.client.request("GET",r))}async getCatalogFromRemoteUrl(t,e){const r=await this.getRemoteCatalog(t,e);return this.getResponse(await this.client.request("GET",r.url))}}class T extends h{async getCategories(t,e){const r=this.getStoreUrl(t,"/categories",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getCategoriesTree(t,e){const r=this.getStoreUrl(t,"/categories/tree",e);return this.getResponse(await this.client.request("GET",r))}async getCategory(t,e,r){const n=this.getStoreUrl(t,`/categories/${e}`,r);return this.getResponse(await this.client.request("GET",n))}async getFeaturesGroups(t,e){const r=this.getStoreUrl(t,`/categories/${e}/features/groups`);return this.getResponse(await this.client.request("GET",r))}async getFeatures(t,e){const r=this.getStoreUrl(t,`/categories/${e}/features`);return this.getResponse(await this.client.request("GET",r))}}class O extends Error{constructor(e,r){super(e);c(this,"err");this.err=r}}class q{static async build(t){const e=await t.json();switch(t.status){case 401:return new O((e==null?void 0:e.message)??"Unauthenticated.",null);default:return new O(e==null?void 0:e.message,(e==null?void 0:e.error)||null)}}}class R{constructor(t,e,r,n,a,o,l){c(this,"baseUrl");c(this,"baseAuthUrl");c(this,"token");c(this,"client");c(this,"timezone");c(this,"fetchFunction");c(this,"fetchOptions");this.baseUrl=t,this.baseAuthUrl=e,this.token=r,this.client=n,this.timezone=a,this.fetchFunction=typeof o=="function"?o:fetch,this.fetchOptions=typeof l<"u"?l:{}}static build(t,e){return new R((t==null?void 0:t.baseUrl)||"https://storefront.zenky.io/v1",(t==null?void 0:t.baseAuthUrl)||"https://auth.zenky.io/",(t==null?void 0:t.token)||null,(t==null?void 0:t.client)||"web",(t==null?void 0:t.timezone)||"UTC",e,t==null?void 0:t.fetchOptions)}setToken(t){return this.token=t,this}getBaseAuthUrl(){return this.baseAuthUrl}getStoreUrl(t,e,r={}){return this.getUrl(`/store/${t}${e}`,r)}getUrl(t,e={}){if(!Object.keys(e).length)return t;const r=[];Object.keys(e).forEach(a=>{e[a]===void 0||e[a]===null||r.push(`${a}=${e[a]}`)});const n=t.includes("?")?"&":"?";return`${t}${n}${r.join("&")}`}async request(t,e,r,n){const a=!e.startsWith("/"),o={Accept:"application/json","X-Zenky-Client":this.client,"X-Timezone":this.timezone};n?o.Authorization=`Bearer ${n}`:this.token&&(o.Authorization=`Bearer ${this.token}`);const l={method:t,mode:"cors",...this.fetchOptions};r&&(o["Content-Type"]="application/json",l.body=JSON.stringify(r)),l.headers=a?{Accept:"application/json"}:o;const g=a?e:`${this.baseUrl}${e}`,u=await this.fetchFunction.call(null,g,l);if(u.ok)return u.status===204?!0:u.json();throw await q.build(u)}}class A extends h{async getStore(t){const e=this.client.getUrl(`/store/${t}`);return this.getResponse(await this.client.request("GET",e))}async getStoreByBundleId(t){const e=this.client.getUrl(`/store/by-bundle/${t}`);return this.getResponse(await this.client.request("GET",e))}}class b extends h{async getCollections(t,e){const r=this.getStoreUrl(t,"/collections",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getCollection(t,e){const r=this.getStoreUrl(t,`/collections/${e}`);return this.getResponse(await this.client.request("GET",r))}}class C extends h{async getOffers(t,e){const r=this.getStoreUrl(t,"/offers",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getOffer(t,e,r){const n=this.getStoreUrl(t,`/offers/${e}`,r);return this.getResponse(await this.client.request("GET",n))}}class _ extends h{async createFeedback(t,e){const r=this.getStoreUrl(t,"/feedback",e);return this.getResponse(await this.client.request("POST",r))}async createCallback(t,e){const r=this.getStoreUrl(t,"/callback",e);return await this.client.request("POST",r),!0}}class N extends h{async getProducts(t,e){const r=this.getStoreUrl(t,"/products",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getProduct(t,e,r){const n=this.getStoreUrl(t,`/products/${e}`,r);return this.getResponse(await this.client.request("GET",n))}async getProductVariantPrice(t,e,r,n){const a=this.getStoreUrl(t,`/products/${e}/variants/${r}/price`);return this.getResponse(await this.client.request("POST",a,n))}}class G extends h{getOrderUrl(t,e,r,n){const a=typeof e=="string"?e:e.id,o=typeof e=="string"?void 0:e.token;return this.getStoreUrl(t,`/orders/${a}${r}${o?"?token="+o:""}`,n)}getApiToken(t){if(!(typeof t=="string"||typeof t.api_token>"u"))return t.api_token}async getOrders(t,e,r){const n=this.getStoreUrl(t,"/orders",e);return this.getPaginatedResponse(await this.client.request("GET",n,void 0,r))}async createOrder(t,e,r){const n=this.getStoreUrl(t,"/orders");return this.getResponse(await this.client.request("POST",n,e,r))}async getOrder(t,e,r){const n=this.getOrderUrl(t,e,"",r);return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderSettings(t,e){const r=this.getOrderUrl(t,e,"/settings");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async addProductVariantToOrder(t,e,r){const n=this.getOrderUrl(t,e,"/products");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async removeProductVariantFromOrder(t,e,r){const n=this.getOrderUrl(t,e,"/products/remove");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async checkProducts(t,e){const r=this.getOrderUrl(t,e,"/products/check");return this.getResponse(await this.client.request("POST",r,void 0,this.getApiToken(e)))}async getOrderCheckoutUrl(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/url");return this.getResponse(await this.client.request("POST",n,{redirect_url:r},this.getApiToken(e))).url}async setOrderCustomer(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/customer");return await this.client.request("POST",n,r,this.getApiToken(e)),!0}async setOrderDeliveryMethod(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/delivery");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async setOrderPayments(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/payments");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async getOrderPromocode(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/promocode");return this.getResponse(await this.client.request("GET",n,r,this.getApiToken(e)))}async setOrderPromocode(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/promocode");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async removeOrderPromocode(t,e){const r=this.getOrderUrl(t,e,"/checkout/promocode");return await this.client.request("DELETE",r,null,this.getApiToken(e)),!0}async getOrderBonusesPreview(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/payments/bonuses",{amount:r});return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderTotal(t,e){const r=this.getOrderUrl(t,e,"/checkout/total");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async checkoutOrder(t,e,r){const n=this.getOrderUrl(t,e,"/checkout");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async confirmOrder(t,e,r){const n=this.getOrderUrl(t,e,"/confirm");return await this.client.request("POST",n,r,this.getApiToken(e)),!0}async resendOrderConfirmationCode(t,e){const r=this.getOrderUrl(t,e,"/confirm/resend");return await this.client.request("POST",r,void 0,this.getApiToken(e)),!0}async getOrderBonusesTransactions(t,e,r){const n=this.getOrderUrl(t,e,"/loyalty/transactions",r);return this.getPaginatedResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderCashbackTransaction(t,e){const r=this.getOrderUrl(t,e,"/loyalty/transactions/cashback");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async dispatchPromotionsChecker(t,e){const r=this.getOrderUrl(t,e,"/loyalty/promotions/check");return this.getResponse(await this.client.request("POST",r,void 0,this.getApiToken(e))).dispatched}async getOrderPromotionRewards(t,e){const r=this.getOrderUrl(t,e,"/loyalty/promotions/rewards");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async getCloudpaymentsReceipt(t,e,r){const n=this.getOrderUrl(t,e,`/payments/${r}/receipt`);return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}}class le extends h{async getAddressSuggestions(t,e){const r=this.getStoreUrl(t,"/suggestions/address");return this.getResponse(await this.client.request("POST",r,e))}}class ce extends h{async getProfile(t,e,r){const n=this.getStoreUrl(t,"/me",e);return this.getResponse(await this.client.request("GET",n,null,r))}async updateProfile(t,e,r){const n=this.getStoreUrl(t,"/me");return this.getResponse(await this.client.request("PUT",n,e,r))}async removeProfile(t,e,r){const n=this.getStoreUrl(t,"/me");return await this.client.request("DELETE",n,e,r),!0}async getSettings(t,e){const r=this.getStoreUrl(t,"/me/settings");return this.getResponse(await this.client.request("GET",r,null,e))}async updateSettings(t,e,r){const n=this.getStoreUrl(t,"/me/settings");return this.getResponse(await this.client.request("PUT",n,e,r))}async getAddresses(t,e,r){const n=this.getStoreUrl(t,"/me/addresses",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async createAddress(t,e,r){const n=this.getStoreUrl(t,"/me/addresses");return this.getResponse(await this.client.request("POST",n,e,r))}async updateAddress(t,e,r,n){const a=this.getStoreUrl(t,`/me/addresses/${e}`);return this.getResponse(await this.client.request("PUT",a,r,n))}async deleteAddress(t,e,r){const n=this.getStoreUrl(t,`/me/addresses/${e}`);return await this.client.request("DELETE",n,null,r),!0}async getPaymentMethods(t,e,r){const n=this.getStoreUrl(t,"/me/payment-methods",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async deletePaymentMethod(t,e,r){const n=this.getStoreUrl(t,`/me/payment-methods/${e}`);return await this.client.request("DELETE",n,null,r),!0}async getBonusesTransactions(t,e,r){const n=this.getStoreUrl(t,"/me/loyalty/transactions",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async getBonusesBalance(t,e){const r=this.getStoreUrl(t,"/me/loyalty/balance");return this.getResponse(await this.client.request("GET",r,null,e))}async revokeToken(t,e){const r=this.getStoreUrl(t,"/me/logout");return await this.client.request("POST",r,null,e),!0}}/**
2
2
  postmate - A powerful, simple, promise-based postMessage library
3
3
  @version v1.5.2
4
4
  @link https://github.com/dollarshaveclub/postmate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenky/storefront-api",
3
- "version": "0.0.40",
3
+ "version": "0.0.41",
4
4
  "description": "Zenky Storefront API SDK",
5
5
  "author": "Timur Zurbaev <hello@zurbaev.ru>",
6
6
  "license": "MIT",