@zenky/storefront-api 0.0.44 → 0.0.46

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
@@ -1347,6 +1347,7 @@ export declare class OrdersResource extends AbstractResource {
1347
1347
  getOrderTotal(storeId: string, credentials: OrderCredentials): Promise<OrderCheckoutTotal>;
1348
1348
  checkoutOrder(storeId: string, credentials: OrderCredentials, request: OrderCheckoutRequest): Promise<OrderCheckoutResult>;
1349
1349
  confirmOrder(storeId: string, credentials: OrderCredentials, request: ConfirmOrderRequest): Promise<boolean>;
1350
+ cancelOrder(storeId: string, credentials: OrderCredentials): Promise<boolean>;
1350
1351
  resendOrderConfirmationCode(storeId: string, credentials: OrderCredentials): Promise<boolean>;
1351
1352
  getOrderBonusesTransactions(storeId: string, credentials: OrderCredentials, request?: ListBonusesTransactionsRequest): Promise<PaginatedResponse<BonusesTransaction>>;
1352
1353
  getOrderCashbackTransaction(storeId: string, credentials: OrderCredentials): Promise<BonusesTransaction>;
@@ -1,21 +1,21 @@
1
1
  var R = Object.defineProperty;
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 || {});
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 || {});
5
5
  class d {
6
6
  constructor(t) {
7
7
  this.client = t;
8
8
  }
9
- getStoreUrl(t, e, s = {}) {
10
- return this.client.getStoreUrl(t, e, s);
9
+ getStoreUrl(t, e, r = {}) {
10
+ return this.client.getStoreUrl(t, e, r);
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, s = t.meta.pagination;
15
+ const e = t.data, r = t.meta.pagination;
16
16
  return {
17
17
  items: e,
18
- pagination: s
18
+ pagination: r
19
19
  };
20
20
  }
21
21
  getResponse(t) {
@@ -30,58 +30,58 @@ 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 s = this.getStoreUrl(t, `/articles/categories/${e}`);
34
- return this.getResponse(await this.client.request("GET", s));
33
+ const r = this.getStoreUrl(t, `/articles/categories/${e}`);
34
+ return this.getResponse(await this.client.request("GET", r));
35
35
  }
36
36
  async getArticles(t, e) {
37
- const s = this.getStoreUrl(t, "/articles", e);
38
- return this.getPaginatedResponse(await this.client.request("GET", s));
37
+ const r = this.getStoreUrl(t, "/articles", e);
38
+ return this.getPaginatedResponse(await this.client.request("GET", r));
39
39
  }
40
- async getArticle(t, e, s) {
41
- const n = this.getStoreUrl(t, `/articles/${e}`, s);
40
+ async getArticle(t, e, r) {
41
+ const n = this.getStoreUrl(t, `/articles/${e}`, r);
42
42
  return this.getResponse(await this.client.request("GET", n));
43
43
  }
44
44
  }
45
45
  class S extends d {
46
46
  async getRemoteCatalog(t, e) {
47
- const s = this.getStoreUrl(t, "/catalog", e);
48
- return this.getResponse(await this.client.request("GET", s));
47
+ const r = this.getStoreUrl(t, "/catalog", e);
48
+ return this.getResponse(await this.client.request("GET", r));
49
49
  }
50
50
  async getCatalogFromRemoteUrl(t, e) {
51
- const s = await this.getRemoteCatalog(t, e);
52
- return this.getResponse(await this.client.request("GET", s.url));
51
+ const r = await this.getRemoteCatalog(t, e);
52
+ return this.getResponse(await this.client.request("GET", r.url));
53
53
  }
54
54
  }
55
55
  class A extends d {
56
56
  async getCategories(t, e) {
57
- const s = this.getStoreUrl(t, "/categories", e);
58
- return this.getPaginatedResponse(await this.client.request("GET", s));
57
+ const r = this.getStoreUrl(t, "/categories", e);
58
+ return this.getPaginatedResponse(await this.client.request("GET", r));
59
59
  }
60
60
  async getCategoriesTree(t, e) {
61
- const s = this.getStoreUrl(t, "/categories/tree", e);
62
- return this.getResponse(await this.client.request("GET", s));
61
+ const r = this.getStoreUrl(t, "/categories/tree", e);
62
+ return this.getResponse(await this.client.request("GET", r));
63
63
  }
64
- async getCategory(t, e, s) {
65
- const n = this.getStoreUrl(t, `/categories/${e}`, s);
64
+ async getCategory(t, e, r) {
65
+ const n = this.getStoreUrl(t, `/categories/${e}`, r);
66
66
  return this.getResponse(await this.client.request("GET", n));
67
67
  }
68
68
  async getFeaturesGroups(t, e) {
69
- const s = this.getStoreUrl(t, `/categories/${e}/features/groups`);
70
- return this.getResponse(await this.client.request("GET", s));
69
+ const r = this.getStoreUrl(t, `/categories/${e}/features/groups`);
70
+ return this.getResponse(await this.client.request("GET", r));
71
71
  }
72
72
  async getFeatures(t, e) {
73
- const s = this.getStoreUrl(t, `/categories/${e}/features`);
74
- return this.getResponse(await this.client.request("GET", s));
73
+ const r = this.getStoreUrl(t, `/categories/${e}/features`);
74
+ return this.getResponse(await this.client.request("GET", r));
75
75
  }
76
76
  }
77
77
  class E extends Error {
78
- constructor(e, s) {
78
+ constructor(e, r) {
79
79
  super(e);
80
80
  l(this, "err");
81
- this.err = s;
81
+ this.err = r;
82
82
  }
83
83
  }
84
- class b {
84
+ class T {
85
85
  static async build(t) {
86
86
  const e = await t.json();
87
87
  switch (t.status) {
@@ -93,7 +93,7 @@ class b {
93
93
  }
94
94
  }
95
95
  class k {
96
- constructor(t, e, s, n, i, a, o) {
96
+ constructor(t, e, r, n, i, a, o) {
97
97
  l(this, "baseUrl");
98
98
  l(this, "baseAuthUrl");
99
99
  l(this, "token");
@@ -101,7 +101,7 @@ class k {
101
101
  l(this, "timezone");
102
102
  l(this, "fetchFunction");
103
103
  l(this, "fetchOptions");
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 : {};
104
+ 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 : {};
105
105
  }
106
106
  static build(t, e) {
107
107
  return new k(
@@ -120,20 +120,20 @@ class k {
120
120
  getBaseAuthUrl() {
121
121
  return this.baseAuthUrl;
122
122
  }
123
- getStoreUrl(t, e, s = {}) {
124
- return this.getUrl(`/store/${t}${e}`, s);
123
+ getStoreUrl(t, e, r = {}) {
124
+ return this.getUrl(`/store/${t}${e}`, r);
125
125
  }
126
126
  getUrl(t, e = {}) {
127
127
  if (!Object.keys(e).length)
128
128
  return t;
129
- const s = [];
129
+ const r = [];
130
130
  Object.keys(e).forEach((i) => {
131
- e[i] === void 0 || e[i] === null || s.push(`${i}=${e[i]}`);
131
+ e[i] === void 0 || e[i] === null || r.push(`${i}=${e[i]}`);
132
132
  });
133
133
  const n = t.includes("?") ? "&" : "?";
134
- return `${t}${n}${s.join("&")}`;
134
+ return `${t}${n}${r.join("&")}`;
135
135
  }
136
- async request(t, e, s, n) {
136
+ async request(t, e, r, n) {
137
137
  const i = !e.startsWith("/"), a = {
138
138
  Accept: "application/json",
139
139
  "X-Zenky-Client": this.client,
@@ -145,14 +145,14 @@ class k {
145
145
  mode: "cors",
146
146
  ...this.fetchOptions
147
147
  };
148
- s && (a["Content-Type"] = "application/json", o.body = JSON.stringify(s)), o.headers = i ? { Accept: "application/json" } : a;
148
+ r && (a["Content-Type"] = "application/json", o.body = JSON.stringify(r)), o.headers = i ? { Accept: "application/json" } : a;
149
149
  const u = i ? e : `${this.baseUrl}${e}`, c = await this.fetchFunction.call(null, u, o);
150
150
  if (c.ok)
151
151
  return c.status === 204 ? !0 : c.json();
152
- throw await b.build(c);
152
+ throw await T.build(c);
153
153
  }
154
154
  }
155
- class T extends d {
155
+ class b extends d {
156
156
  async getStore(t) {
157
157
  const e = this.client.getUrl(`/store/${t}`);
158
158
  return this.getResponse(await this.client.request("GET", e));
@@ -164,258 +164,262 @@ class T extends d {
164
164
  }
165
165
  class _ extends d {
166
166
  async getCollections(t, e) {
167
- const s = this.getStoreUrl(t, "/collections", e);
168
- return this.getPaginatedResponse(await this.client.request("GET", s));
167
+ const r = this.getStoreUrl(t, "/collections", e);
168
+ return this.getPaginatedResponse(await this.client.request("GET", r));
169
169
  }
170
170
  async getCollection(t, e) {
171
- const s = this.getStoreUrl(t, `/collections/${e}`);
172
- return this.getResponse(await this.client.request("GET", s));
171
+ const r = this.getStoreUrl(t, `/collections/${e}`);
172
+ return this.getResponse(await this.client.request("GET", r));
173
173
  }
174
174
  }
175
175
  class C extends d {
176
176
  async getOffers(t, e) {
177
- const s = this.getStoreUrl(t, "/offers", e);
178
- return this.getPaginatedResponse(await this.client.request("GET", s));
177
+ const r = this.getStoreUrl(t, "/offers", e);
178
+ return this.getPaginatedResponse(await this.client.request("GET", r));
179
179
  }
180
- async getOffer(t, e, s) {
181
- const n = this.getStoreUrl(t, `/offers/${e}`, s);
180
+ async getOffer(t, e, r) {
181
+ const n = this.getStoreUrl(t, `/offers/${e}`, r);
182
182
  return this.getResponse(await this.client.request("GET", n));
183
183
  }
184
184
  }
185
185
  class N extends d {
186
186
  async createFeedback(t, e) {
187
- const s = this.getStoreUrl(t, "/feedback", e);
188
- return this.getResponse(await this.client.request("POST", s));
187
+ const r = this.getStoreUrl(t, "/feedback", e);
188
+ return this.getResponse(await this.client.request("POST", r));
189
189
  }
190
190
  async createCallback(t, e) {
191
- const s = this.getStoreUrl(t, "/callback", e);
192
- return await this.client.request("POST", s), !0;
191
+ const r = this.getStoreUrl(t, "/callback", e);
192
+ return await this.client.request("POST", r), !0;
193
193
  }
194
194
  }
195
195
  class $ extends d {
196
196
  async getProducts(t, e) {
197
- const s = this.getStoreUrl(t, "/products", e);
198
- return this.getPaginatedResponse(await this.client.request("GET", s));
197
+ const r = this.getStoreUrl(t, "/products", e);
198
+ return this.getPaginatedResponse(await this.client.request("GET", r));
199
199
  }
200
- async getProduct(t, e, s) {
201
- const n = this.getStoreUrl(t, `/products/${e}`, s);
200
+ async getProduct(t, e, r) {
201
+ const n = this.getStoreUrl(t, `/products/${e}`, r);
202
202
  return this.getResponse(await this.client.request("GET", n));
203
203
  }
204
- async getProductVariantPrice(t, e, s, n) {
205
- const i = this.getStoreUrl(t, `/products/${e}/variants/${s}/price`);
204
+ async getProductVariantPrice(t, e, r, n) {
205
+ const i = this.getStoreUrl(t, `/products/${e}/variants/${r}/price`);
206
206
  return this.getResponse(await this.client.request("POST", i, n));
207
207
  }
208
208
  }
209
209
  class G extends d {
210
- getOrderUrl(t, e, s, n) {
210
+ getOrderUrl(t, e, r, n) {
211
211
  const i = typeof e == "string" ? e : e.id, a = typeof e == "string" ? void 0 : e.token;
212
- return this.getStoreUrl(t, `/orders/${i}${s}${a ? "?token=" + a : ""}`, n);
212
+ return this.getStoreUrl(t, `/orders/${i}${r}${a ? "?token=" + a : ""}`, n);
213
213
  }
214
214
  getApiToken(t) {
215
215
  if (!(typeof t == "string" || typeof t.api_token > "u"))
216
216
  return t.api_token;
217
217
  }
218
- async getOrders(t, e, s) {
218
+ async getOrders(t, e, r) {
219
219
  const n = this.getStoreUrl(t, "/orders", e);
220
- return this.getPaginatedResponse(await this.client.request("GET", n, void 0, s));
220
+ return this.getPaginatedResponse(await this.client.request("GET", n, void 0, r));
221
221
  }
222
- async createOrder(t, e, s) {
222
+ async createOrder(t, e, r) {
223
223
  const n = this.getStoreUrl(t, "/orders");
224
- return this.getResponse(await this.client.request("POST", n, e, s));
224
+ return this.getResponse(await this.client.request("POST", n, e, r));
225
225
  }
226
- async getOrder(t, e, s) {
227
- const n = this.getOrderUrl(t, e, "", s);
226
+ async getOrder(t, e, r) {
227
+ const n = this.getOrderUrl(t, e, "", r);
228
228
  return this.getResponse(
229
229
  await this.client.request("GET", n, void 0, this.getApiToken(e))
230
230
  );
231
231
  }
232
232
  async getOrderSettings(t, e) {
233
- const s = this.getOrderUrl(t, e, "/settings");
233
+ const r = this.getOrderUrl(t, e, "/settings");
234
234
  return this.getResponse(
235
- await this.client.request("GET", s, void 0, this.getApiToken(e))
235
+ await this.client.request("GET", r, void 0, this.getApiToken(e))
236
236
  );
237
237
  }
238
- async addProductVariantToOrder(t, e, s) {
238
+ async addProductVariantToOrder(t, e, r) {
239
239
  const n = this.getOrderUrl(t, e, "/products");
240
240
  return this.getResponse(
241
- await this.client.request("POST", n, s, this.getApiToken(e))
241
+ await this.client.request("POST", n, r, this.getApiToken(e))
242
242
  );
243
243
  }
244
- async removeProductVariantFromOrder(t, e, s) {
244
+ async removeProductVariantFromOrder(t, e, r) {
245
245
  const n = this.getOrderUrl(t, e, "/products/remove");
246
246
  return this.getResponse(
247
- await this.client.request("POST", n, s, this.getApiToken(e))
247
+ await this.client.request("POST", n, r, this.getApiToken(e))
248
248
  );
249
249
  }
250
250
  async checkProducts(t, e) {
251
- const s = this.getOrderUrl(t, e, "/products/check");
251
+ const r = this.getOrderUrl(t, e, "/products/check");
252
252
  return this.getResponse(
253
- await this.client.request("POST", s, void 0, this.getApiToken(e))
253
+ await this.client.request("POST", r, void 0, this.getApiToken(e))
254
254
  );
255
255
  }
256
- async getOrderCheckoutUrl(t, e, s) {
256
+ async getOrderCheckoutUrl(t, e, r) {
257
257
  const n = this.getOrderUrl(t, e, "/checkout/url");
258
258
  return this.getResponse(
259
- await this.client.request("POST", n, { redirect_url: s }, this.getApiToken(e))
259
+ await this.client.request("POST", n, { redirect_url: r }, this.getApiToken(e))
260
260
  ).url;
261
261
  }
262
- async setOrderCustomer(t, e, s) {
262
+ async setOrderCustomer(t, e, r) {
263
263
  const n = this.getOrderUrl(t, e, "/checkout/customer");
264
- return await this.client.request("POST", n, s, this.getApiToken(e)), !0;
264
+ return await this.client.request("POST", n, r, this.getApiToken(e)), !0;
265
265
  }
266
- async setOrderDeliveryMethod(t, e, s) {
266
+ async setOrderDeliveryMethod(t, e, r) {
267
267
  const n = this.getOrderUrl(t, e, "/checkout/delivery");
268
268
  return this.getResponse(
269
- await this.client.request("POST", n, s, this.getApiToken(e))
269
+ await this.client.request("POST", n, r, this.getApiToken(e))
270
270
  );
271
271
  }
272
- async setOrderPayments(t, e, s) {
272
+ async setOrderPayments(t, e, r) {
273
273
  const n = this.getOrderUrl(t, e, "/checkout/payments");
274
274
  return this.getResponse(
275
- await this.client.request("POST", n, s, this.getApiToken(e))
275
+ await this.client.request("POST", n, r, this.getApiToken(e))
276
276
  );
277
277
  }
278
- async getOrderPromocode(t, e, s) {
278
+ async getOrderPromocode(t, e, r) {
279
279
  const n = this.getOrderUrl(t, e, "/checkout/promocode");
280
280
  return this.getResponse(
281
- await this.client.request("GET", n, s, this.getApiToken(e))
281
+ await this.client.request("GET", n, r, this.getApiToken(e))
282
282
  );
283
283
  }
284
- async setOrderPromocode(t, e, s) {
284
+ async setOrderPromocode(t, e, r) {
285
285
  const n = this.getOrderUrl(t, e, "/checkout/promocode");
286
286
  return this.getResponse(
287
- await this.client.request("POST", n, s, this.getApiToken(e))
287
+ await this.client.request("POST", n, r, this.getApiToken(e))
288
288
  );
289
289
  }
290
290
  async removeOrderPromocode(t, e) {
291
- const s = this.getOrderUrl(t, e, "/checkout/promocode");
292
- return await this.client.request("DELETE", s, null, this.getApiToken(e)), !0;
291
+ const r = this.getOrderUrl(t, e, "/checkout/promocode");
292
+ return await this.client.request("DELETE", r, null, this.getApiToken(e)), !0;
293
293
  }
294
- async getOrderBonusesPreview(t, e, s) {
295
- const n = this.getOrderUrl(t, e, "/checkout/payments/bonuses", { amount: s });
294
+ async getOrderBonusesPreview(t, e, r) {
295
+ const n = this.getOrderUrl(t, e, "/checkout/payments/bonuses", { amount: r });
296
296
  return this.getResponse(
297
297
  await this.client.request("GET", n, void 0, this.getApiToken(e))
298
298
  );
299
299
  }
300
300
  async getOrderTotal(t, e) {
301
- const s = this.getOrderUrl(t, e, "/checkout/total");
301
+ const r = this.getOrderUrl(t, e, "/checkout/total");
302
302
  return this.getResponse(
303
- await this.client.request("GET", s, void 0, this.getApiToken(e))
303
+ await this.client.request("GET", r, void 0, this.getApiToken(e))
304
304
  );
305
305
  }
306
- async checkoutOrder(t, e, s) {
306
+ async checkoutOrder(t, e, r) {
307
307
  const n = this.getOrderUrl(t, e, "/checkout");
308
308
  return this.getResponse(
309
- await this.client.request("POST", n, s, this.getApiToken(e))
309
+ await this.client.request("POST", n, r, this.getApiToken(e))
310
310
  );
311
311
  }
312
- async confirmOrder(t, e, s) {
312
+ async confirmOrder(t, e, r) {
313
313
  const n = this.getOrderUrl(t, e, "/confirm");
314
- return await this.client.request("POST", n, s, this.getApiToken(e)), !0;
314
+ return await this.client.request("POST", n, r, this.getApiToken(e)), !0;
315
+ }
316
+ async cancelOrder(t, e) {
317
+ const r = this.getOrderUrl(t, e, "/cancel");
318
+ return await this.client.request("POST", r, void 0, this.getApiToken(e)), !0;
315
319
  }
316
320
  async resendOrderConfirmationCode(t, e) {
317
- const s = this.getOrderUrl(t, e, "/confirm/resend");
318
- return await this.client.request("POST", s, void 0, this.getApiToken(e)), !0;
321
+ const r = this.getOrderUrl(t, e, "/confirm/resend");
322
+ return await this.client.request("POST", r, void 0, this.getApiToken(e)), !0;
319
323
  }
320
- async getOrderBonusesTransactions(t, e, s) {
321
- const n = this.getOrderUrl(t, e, "/loyalty/transactions", s);
324
+ async getOrderBonusesTransactions(t, e, r) {
325
+ const n = this.getOrderUrl(t, e, "/loyalty/transactions", r);
322
326
  return this.getPaginatedResponse(
323
327
  await this.client.request("GET", n, void 0, this.getApiToken(e))
324
328
  );
325
329
  }
326
330
  async getOrderCashbackTransaction(t, e) {
327
- const s = this.getOrderUrl(t, e, "/loyalty/transactions/cashback");
331
+ const r = this.getOrderUrl(t, e, "/loyalty/transactions/cashback");
328
332
  return this.getResponse(
329
- await this.client.request("GET", s, void 0, this.getApiToken(e))
333
+ await this.client.request("GET", r, void 0, this.getApiToken(e))
330
334
  );
331
335
  }
332
336
  async dispatchPromotionsChecker(t, e) {
333
- const s = this.getOrderUrl(t, e, "/loyalty/promotions/check");
337
+ const r = this.getOrderUrl(t, e, "/loyalty/promotions/check");
334
338
  return this.getResponse(
335
- await this.client.request("POST", s, void 0, this.getApiToken(e))
339
+ await this.client.request("POST", r, void 0, this.getApiToken(e))
336
340
  ).dispatched;
337
341
  }
338
342
  async getOrderPromotionRewards(t, e) {
339
- const s = this.getOrderUrl(t, e, "/loyalty/promotions/rewards");
343
+ const r = this.getOrderUrl(t, e, "/loyalty/promotions/rewards");
340
344
  return this.getResponse(
341
- await this.client.request("GET", s, void 0, this.getApiToken(e))
345
+ await this.client.request("GET", r, void 0, this.getApiToken(e))
342
346
  );
343
347
  }
344
- async getCloudpaymentsReceipt(t, e, s) {
345
- const n = this.getOrderUrl(t, e, `/payments/${s}/receipt`);
348
+ async getCloudpaymentsReceipt(t, e, r) {
349
+ const n = this.getOrderUrl(t, e, `/payments/${r}/receipt`);
346
350
  return this.getResponse(
347
351
  await this.client.request("GET", n, void 0, this.getApiToken(e))
348
352
  );
349
353
  }
350
- async getOnlinePaymentRedirect(t, e, s, n) {
351
- const i = this.getOrderUrl(t, e, `/payments/${s}/redirect`, n);
354
+ async getOnlinePaymentRedirect(t, e, r, n) {
355
+ const i = this.getOrderUrl(t, e, `/payments/${r}/redirect`);
352
356
  return this.getResponse(
353
- await this.client.request("POST", i, void 0, this.getApiToken(e))
357
+ await this.client.request("POST", i, n, this.getApiToken(e))
354
358
  );
355
359
  }
356
360
  }
357
361
  class D extends d {
358
362
  async getAddressSuggestions(t, e) {
359
- const s = this.getStoreUrl(t, "/suggestions/address");
360
- return this.getResponse(await this.client.request("POST", s, e));
363
+ const r = this.getStoreUrl(t, "/suggestions/address");
364
+ return this.getResponse(await this.client.request("POST", r, e));
361
365
  }
362
366
  }
363
367
  class V extends d {
364
- async getProfile(t, e, s) {
368
+ async getProfile(t, e, r) {
365
369
  const n = this.getStoreUrl(t, "/me", e);
366
- return this.getResponse(await this.client.request("GET", n, null, s));
370
+ return this.getResponse(await this.client.request("GET", n, null, r));
367
371
  }
368
- async updateProfile(t, e, s) {
372
+ async updateProfile(t, e, r) {
369
373
  const n = this.getStoreUrl(t, "/me");
370
- return this.getResponse(await this.client.request("PUT", n, e, s));
374
+ return this.getResponse(await this.client.request("PUT", n, e, r));
371
375
  }
372
- async removeProfile(t, e, s) {
376
+ async removeProfile(t, e, r) {
373
377
  const n = this.getStoreUrl(t, "/me");
374
- return await this.client.request("DELETE", n, e, s), !0;
378
+ return await this.client.request("DELETE", n, e, r), !0;
375
379
  }
376
380
  async getSettings(t, e) {
377
- const s = this.getStoreUrl(t, "/me/settings");
378
- return this.getResponse(await this.client.request("GET", s, null, e));
381
+ const r = this.getStoreUrl(t, "/me/settings");
382
+ return this.getResponse(await this.client.request("GET", r, null, e));
379
383
  }
380
- async updateSettings(t, e, s) {
384
+ async updateSettings(t, e, r) {
381
385
  const n = this.getStoreUrl(t, "/me/settings");
382
- return this.getResponse(await this.client.request("PUT", n, e, s));
386
+ return this.getResponse(await this.client.request("PUT", n, e, r));
383
387
  }
384
- async getAddresses(t, e, s) {
388
+ async getAddresses(t, e, r) {
385
389
  const n = this.getStoreUrl(t, "/me/addresses", e);
386
- return this.getPaginatedResponse(await this.client.request("GET", n, null, s));
390
+ return this.getPaginatedResponse(await this.client.request("GET", n, null, r));
387
391
  }
388
- async createAddress(t, e, s) {
392
+ async createAddress(t, e, r) {
389
393
  const n = this.getStoreUrl(t, "/me/addresses");
390
- return this.getResponse(await this.client.request("POST", n, e, s));
394
+ return this.getResponse(await this.client.request("POST", n, e, r));
391
395
  }
392
- async updateAddress(t, e, s, n) {
396
+ async updateAddress(t, e, r, n) {
393
397
  const i = this.getStoreUrl(t, `/me/addresses/${e}`);
394
- return this.getResponse(await this.client.request("PUT", i, s, n));
398
+ return this.getResponse(await this.client.request("PUT", i, r, n));
395
399
  }
396
- async deleteAddress(t, e, s) {
400
+ async deleteAddress(t, e, r) {
397
401
  const n = this.getStoreUrl(t, `/me/addresses/${e}`);
398
- return await this.client.request("DELETE", n, null, s), !0;
402
+ return await this.client.request("DELETE", n, null, r), !0;
399
403
  }
400
- async getPaymentMethods(t, e, s) {
404
+ async getPaymentMethods(t, e, r) {
401
405
  const n = this.getStoreUrl(t, "/me/payment-methods", e);
402
- return this.getPaginatedResponse(await this.client.request("GET", n, null, s));
406
+ return this.getPaginatedResponse(await this.client.request("GET", n, null, r));
403
407
  }
404
- async deletePaymentMethod(t, e, s) {
408
+ async deletePaymentMethod(t, e, r) {
405
409
  const n = this.getStoreUrl(t, `/me/payment-methods/${e}`);
406
- return await this.client.request("DELETE", n, null, s), !0;
410
+ return await this.client.request("DELETE", n, null, r), !0;
407
411
  }
408
- async getBonusesTransactions(t, e, s) {
412
+ async getBonusesTransactions(t, e, r) {
409
413
  const n = this.getStoreUrl(t, "/me/loyalty/transactions", e);
410
- return this.getPaginatedResponse(await this.client.request("GET", n, null, s));
414
+ return this.getPaginatedResponse(await this.client.request("GET", n, null, r));
411
415
  }
412
416
  async getBonusesBalance(t, e) {
413
- const s = this.getStoreUrl(t, "/me/loyalty/balance");
414
- return this.getResponse(await this.client.request("GET", s, null, e));
417
+ const r = this.getStoreUrl(t, "/me/loyalty/balance");
418
+ return this.getResponse(await this.client.request("GET", r, null, e));
415
419
  }
416
420
  async revokeToken(t, e) {
417
- const s = this.getStoreUrl(t, "/me/logout");
418
- return await this.client.request("POST", s, null, e), !0;
421
+ const r = this.getStoreUrl(t, "/me/logout");
422
+ return await this.client.request("POST", r, null, e), !0;
419
423
  }
420
424
  }
421
425
  /**
@@ -433,8 +437,8 @@ var p = "application/x-postmate-v1+json", x = 5, I = 0, L = function() {
433
437
  }, M = function(t) {
434
438
  var e = document.createElement("a");
435
439
  e.href = t;
436
- 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;
437
- return e.origin || s + "//" + n;
440
+ 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;
441
+ return e.origin || r + "//" + n;
438
442
  }, z = {
439
443
  handshake: 1,
440
444
  "handshake-reply": 1,
@@ -451,20 +455,20 @@ var p = "application/x-postmate-v1+json", x = 5, I = 0, L = function() {
451
455
  }, O = function(t, e) {
452
456
  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]);
453
457
  }, j = function(t, e) {
454
- var s = typeof t[e] == "function" ? t[e]() : t[e];
455
- return g.Promise.resolve(s);
458
+ var r = typeof t[e] == "function" ? t[e]() : t[e];
459
+ return g.Promise.resolve(r);
456
460
  }, H = /* @__PURE__ */ function() {
457
- function r(e) {
458
- var s = this;
461
+ function s(e) {
462
+ var r = this;
459
463
  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) {
460
- if (!O(n, s.childOrigin))
464
+ if (!O(n, r.childOrigin))
461
465
  return !1;
462
466
  var i = ((n || {}).data || {}).value || {}, a = i.data, o = i.name;
463
- 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));
467
+ 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));
464
468
  }, this.parent.addEventListener("message", this.listener, !1), process.env.NODE_ENV !== "production" && h("Parent: Awaiting event emissions from Child");
465
469
  }
466
- var t = r.prototype;
467
- return t.get = function(s) {
470
+ var t = s.prototype;
471
+ return t.get = function(r) {
468
472
  var n = this;
469
473
  return new g.Promise(function(i) {
470
474
  var a = L(), o = function u(c) {
@@ -473,34 +477,34 @@ var p = "application/x-postmate-v1+json", x = 5, I = 0, L = function() {
473
477
  n.parent.addEventListener("message", o, !1), n.child.postMessage({
474
478
  postmate: "request",
475
479
  type: p,
476
- property: s,
480
+ property: r,
477
481
  uid: a
478
482
  }, n.childOrigin);
479
483
  });
480
- }, t.call = function(s, n) {
484
+ }, t.call = function(r, n) {
481
485
  this.child.postMessage({
482
486
  postmate: "call",
483
487
  type: p,
484
- property: s,
488
+ property: r,
485
489
  data: n
486
490
  }, this.childOrigin);
487
- }, t.on = function(s, n) {
488
- this.events[s] = n;
491
+ }, t.on = function(r, n) {
492
+ this.events[r] = n;
489
493
  }, t.destroy = function() {
490
494
  process.env.NODE_ENV !== "production" && h("Parent: Destroying Postmate instance"), window.removeEventListener("message", this.listener, !1), this.frame.parentNode.removeChild(this.frame);
491
- }, r;
495
+ }, s;
492
496
  }(), F = /* @__PURE__ */ function() {
493
- function r(e) {
494
- var s = this;
497
+ function s(e) {
498
+ var r = this;
495
499
  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) {
496
- if (O(n, s.parentOrigin)) {
500
+ if (O(n, r.parentOrigin)) {
497
501
  process.env.NODE_ENV !== "production" && h("Child: Received request", n.data);
498
502
  var i = n.data, a = i.property, o = i.uid, u = i.data;
499
503
  if (n.data.postmate === "call") {
500
- a in s.model && typeof s.model[a] == "function" && s.model[a](u);
504
+ a in r.model && typeof r.model[a] == "function" && r.model[a](u);
501
505
  return;
502
506
  }
503
- j(s.model, a).then(function(c) {
507
+ j(r.model, a).then(function(c) {
504
508
  return n.source.postMessage({
505
509
  property: a,
506
510
  postmate: "reply",
@@ -512,26 +516,26 @@ var p = "application/x-postmate-v1+json", x = 5, I = 0, L = function() {
512
516
  }
513
517
  });
514
518
  }
515
- var t = r.prototype;
516
- return t.emit = function(s, n) {
517
- process.env.NODE_ENV !== "production" && h('Child: Emitting Event "' + s + '"', n), this.parent.postMessage({
519
+ var t = s.prototype;
520
+ return t.emit = function(r, n) {
521
+ process.env.NODE_ENV !== "production" && h('Child: Emitting Event "' + r + '"', n), this.parent.postMessage({
518
522
  postmate: "emit",
519
523
  type: p,
520
524
  value: {
521
- name: s,
525
+ name: r,
522
526
  data: n
523
527
  }
524
528
  }, this.parentOrigin);
525
- }, r;
529
+ }, s;
526
530
  }(), g = /* @__PURE__ */ function() {
527
- function r(e) {
528
- 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;
531
+ function s(e) {
532
+ 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;
529
533
  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);
530
534
  }
531
- var t = r.prototype;
532
- return t.sendHandshake = function(s) {
533
- var n = this, i = M(s), a = 0, o;
534
- return new r.Promise(function(u, c) {
535
+ var t = s.prototype;
536
+ return t.sendHandshake = function(r) {
537
+ var n = this, i = M(r), a = 0, o;
538
+ return new s.Promise(function(u, c) {
535
539
  var m = function v(y) {
536
540
  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;
537
541
  };
@@ -548,10 +552,10 @@ var p = "application/x-postmate-v1+json", x = 5, I = 0, L = function() {
548
552
  f(), o = setInterval(f, 500);
549
553
  };
550
554
  n.frame.attachEvent ? n.frame.attachEvent("onload", w) : n.frame.onload = w, process.env.NODE_ENV !== "production" && h("Parent: Loading frame", {
551
- url: s
552
- }), n.frame.src = s;
555
+ url: r
556
+ }), n.frame.src = r;
553
557
  });
554
- }, r;
558
+ }, s;
555
559
  }();
556
560
  g.debug = !1;
557
561
  g.Promise = function() {
@@ -562,62 +566,62 @@ g.Promise = function() {
562
566
  }
563
567
  }();
564
568
  g.Model = /* @__PURE__ */ function() {
565
- function r(e) {
569
+ function s(e) {
566
570
  return this.child = window, this.model = e, this.parent = this.child.parent, this.sendHandshakeReply();
567
571
  }
568
- var t = r.prototype;
572
+ var t = s.prototype;
569
573
  return t.sendHandshakeReply = function() {
570
- var s = this;
574
+ var r = this;
571
575
  return new g.Promise(function(n, i) {
572
576
  var a = function o(u) {
573
577
  if (u.data.postmate) {
574
578
  if (u.data.postmate === "handshake") {
575
- 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({
579
+ 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({
576
580
  postmate: "handshake-reply",
577
581
  type: p
578
- }, u.origin), s.parentOrigin = u.origin;
582
+ }, u.origin), r.parentOrigin = u.origin;
579
583
  var c = u.data.model;
580
584
  return c && (Object.keys(c).forEach(function(m) {
581
- s.model[m] = c[m];
582
- }), 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));
585
+ r.model[m] = c[m];
586
+ }), 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));
583
587
  }
584
588
  return i("Handshake Reply Failed");
585
589
  }
586
590
  };
587
- s.child.addEventListener("message", a, !1);
591
+ r.child.addEventListener("message", a, !1);
588
592
  });
589
- }, r;
593
+ }, s;
590
594
  }();
591
595
  class W extends d {
592
596
  async checkPhone(t, e) {
593
- const s = this.getStoreUrl(t, "/auth/check");
594
- return this.getResponse(await this.client.request("POST", s, e));
597
+ const r = this.getStoreUrl(t, "/auth/check");
598
+ return this.getResponse(await this.client.request("POST", r, e));
595
599
  }
596
600
  async register(t, e) {
597
- const s = this.getStoreUrl(t, "/auth/register");
598
- return this.getResponse(await this.client.request("POST", s, e));
601
+ const r = this.getStoreUrl(t, "/auth/register");
602
+ return this.getResponse(await this.client.request("POST", r, e));
599
603
  }
600
604
  async confirmRegistration(t, e) {
601
- const s = this.getStoreUrl(t, "/auth/register/confirm");
602
- return this.getResponse(await this.client.request("POST", s, e));
605
+ const r = this.getStoreUrl(t, "/auth/register/confirm");
606
+ return this.getResponse(await this.client.request("POST", r, e));
603
607
  }
604
608
  async resendRegistrationConfirmation(t, e) {
605
- const s = this.getStoreUrl(t, "/auth/register/resend");
606
- return this.getResponse(await this.client.request("POST", s, e));
609
+ const r = this.getStoreUrl(t, "/auth/register/resend");
610
+ return this.getResponse(await this.client.request("POST", r, e));
607
611
  }
608
612
  async login(t, e) {
609
- const s = this.getStoreUrl(t, "/auth/login");
610
- return this.getResponse(await this.client.request("POST", s, e));
613
+ const r = this.getStoreUrl(t, "/auth/login");
614
+ return this.getResponse(await this.client.request("POST", r, e));
611
615
  }
612
616
  async dispatchPasswordReset(t, e) {
613
- const s = this.getStoreUrl(t, "/auth/password/request");
614
- return this.getResponse(await this.client.request("POST", s, e));
617
+ const r = this.getStoreUrl(t, "/auth/password/request");
618
+ return this.getResponse(await this.client.request("POST", r, e));
615
619
  }
616
620
  async resetPassword(t, e) {
617
- const s = this.getStoreUrl(t, "/auth/password/reset");
618
- return this.getResponse(await this.client.request("POST", s, e));
621
+ const r = this.getStoreUrl(t, "/auth/password/reset");
622
+ return this.getResponse(await this.client.request("POST", r, e));
619
623
  }
620
- useAuthenticationModal(t, e, s, n = {}) {
624
+ useAuthenticationModal(t, e, r, n = {}) {
621
625
  const i = `${this.client.getBaseAuthUrl()}/?store_id=${t}&response_type=post_message`;
622
626
  let a = null, o = null;
623
627
  return {
@@ -628,7 +632,7 @@ class W extends d {
628
632
  container: f,
629
633
  url: i
630
634
  }), a.then((w) => {
631
- o = w, o.on("zenky:auth:token", s), o.on("zenky:auth:resize", (v) => {
635
+ o = w, o.on("zenky:auth:token", r), o.on("zenky:auth:resize", (v) => {
632
636
  o.frame.style.height = `${v}px`;
633
637
  }), m(!0);
634
638
  });
@@ -654,14 +658,14 @@ class Oe {
654
658
  l(this, "offers");
655
659
  l(this, "articles");
656
660
  l(this, "feedback");
657
- const s = k.build(t, e);
658
- 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 $(s), this.addresses = new D(s), this.orders = new G(s), this.collections = new _(s), this.offers = new C(s), this.articles = new q(s), this.feedback = new N(s), this.client = s;
661
+ const r = k.build(t, e);
662
+ this.store = new b(r), this.auth = new W(r), this.customer = new V(r), this.catalog = new S(r), this.categories = new A(r), this.products = new $(r), this.addresses = new D(r), this.orders = new G(r), this.collections = new _(r), this.offers = new C(r), this.articles = new q(r), this.feedback = new N(r), this.client = r;
659
663
  }
660
664
  setApiToken(t) {
661
665
  return this.client.setToken(t), this;
662
666
  }
663
667
  }
664
- 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 || {}), Y = /* @__PURE__ */ ((r) => (r.Select = "select", r.MutipleSelect = "mutiple_select", r.Checkboxes = "checkboxes", r.Radios = "radios", r.Range = "range", r.Text = "text", r))(Y || {}), B = /* @__PURE__ */ ((r) => (r.Integer = "integer", r.Float = "float", r))(B || {}), K = /* @__PURE__ */ ((r) => (r.Increase = "increase", r.Decrease = "decrease", r))(K || {}), Q = /* @__PURE__ */ ((r) => (r.Pending = "pending", r.Confirmed = "confirmed", r.Cancelled = "cancelled", r.Rejected = "rejected", r.Refunded = "refunded", r.PartiallyRefunded = "partially_refunded", r))(Q || {}), 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.YooKassa = "yookassa", 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 || {});
668
+ 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 || {}), Y = /* @__PURE__ */ ((s) => (s.Select = "select", s.MutipleSelect = "mutiple_select", s.Checkboxes = "checkboxes", s.Radios = "radios", s.Range = "range", s.Text = "text", s))(Y || {}), B = /* @__PURE__ */ ((s) => (s.Integer = "integer", s.Float = "float", s))(B || {}), K = /* @__PURE__ */ ((s) => (s.Increase = "increase", s.Decrease = "decrease", s))(K || {}), Q = /* @__PURE__ */ ((s) => (s.Pending = "pending", s.Confirmed = "confirmed", s.Cancelled = "cancelled", s.Rejected = "rejected", s.Refunded = "refunded", s.PartiallyRefunded = "partially_refunded", s))(Q || {}), 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.YooKassa = "yookassa", 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 || {});
665
669
  export {
666
670
  J as AcquiringType,
667
671
  U as AddressSuggestionsProvider,
@@ -696,11 +700,11 @@ export {
696
700
  ge as ProductContextType,
697
701
  $ as ProductsResource,
698
702
  ye as RecaptchaAction,
699
- T as StoreResource,
703
+ b as StoreResource,
700
704
  ve as TernaryFilter,
701
705
  ce as UnitType,
702
706
  de as VariantOptionType,
703
707
  E as ZenkyError,
704
- b as ZenkyErrorBuilder,
708
+ T as ZenkyErrorBuilder,
705
709
  Oe as ZenkyStorefront
706
710
  };
@@ -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 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)))}async getOnlinePaymentRedirect(t,e,r,n){const a=this.getOrderUrl(t,e,`/payments/${r}/redirect`,n);return this.getResponse(await this.client.request("POST",a,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 cancelOrder(t,e){const r=this.getOrderUrl(t,e,"/cancel");return await this.client.request("POST",r,void 0,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)))}async getOnlinePaymentRedirect(t,e,r,n){const a=this.getOrderUrl(t,e,`/payments/${r}/redirect`);return this.getResponse(await this.client.request("POST",a,n,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.44",
3
+ "version": "0.0.46",
4
4
  "description": "Zenky Storefront API SDK",
5
5
  "author": "Timur Zurbaev <hello@zurbaev.ru>",
6
6
  "license": "MIT",