@zenky/storefront-api 0.0.13 → 0.0.15

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.
@@ -1,7 +1,8 @@
1
1
  var g = Object.defineProperty;
2
2
  var d = (e, t, r) => t in e ? g(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var n = (e, t, r) => (d(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- class l {
4
+ var p = /* @__PURE__ */ ((e) => (e.DADATA = "dadata", e))(p || {});
5
+ class o {
5
6
  constructor(t) {
6
7
  this.client = t;
7
8
  }
@@ -12,8 +13,8 @@ class l {
12
13
  if (!Object.keys(r).length)
13
14
  return t;
14
15
  const s = [];
15
- Object.keys(r).forEach((o) => {
16
- s.push(`${o}=${r[o]}`);
16
+ Object.keys(r).forEach((a) => {
17
+ s.push(`${a}=${r[a]}`);
17
18
  });
18
19
  const i = t.includes("?") ? "&" : "?";
19
20
  return `${t}${i}${s.join("&")}`;
@@ -33,7 +34,7 @@ class l {
33
34
  return t.data;
34
35
  }
35
36
  }
36
- class p extends l {
37
+ class w extends o {
37
38
  async getArticleCategories(t) {
38
39
  const r = this.getStoreUrl(t, "/articles/categories");
39
40
  return this.getPaginatedResponse(await this.client.request("GET", r));
@@ -51,7 +52,7 @@ class p extends l {
51
52
  return this.getResponse(await this.client.request("GET", i));
52
53
  }
53
54
  }
54
- class k extends l {
55
+ class k extends o {
55
56
  async getCategories(t, r) {
56
57
  const s = this.getStoreUrl(t, "/categories", r);
57
58
  return this.getPaginatedResponse(await this.client.request("GET", s));
@@ -80,7 +81,7 @@ class h extends Error {
80
81
  this.err = s;
81
82
  }
82
83
  }
83
- class w {
84
+ class R {
84
85
  static async build(t) {
85
86
  const r = await t.json();
86
87
  switch (t.status) {
@@ -91,18 +92,18 @@ class w {
91
92
  }
92
93
  }
93
94
  }
94
- class u {
95
- constructor(t, r, s, i, o, a) {
95
+ class c {
96
+ constructor(t, r, s, i, a, u) {
96
97
  n(this, "baseUrl");
97
98
  n(this, "token");
98
99
  n(this, "client");
99
100
  n(this, "timezone");
100
101
  n(this, "fetchFunction");
101
102
  n(this, "fetchOptions");
102
- this.baseUrl = t, this.token = r, this.client = s, this.timezone = i, this.fetchFunction = typeof o == "function" ? o : fetch, this.fetchOptions = typeof a < "u" ? a : {};
103
+ this.baseUrl = t, this.token = r, this.client = s, this.timezone = i, this.fetchFunction = typeof a == "function" ? a : fetch, this.fetchOptions = typeof u < "u" ? u : {};
103
104
  }
104
105
  static build(t, r) {
105
- return new u(
106
+ return new c(
106
107
  (t == null ? void 0 : t.baseUrl) || "https://storefront.zenky.io/v1",
107
108
  (t == null ? void 0 : t.token) || null,
108
109
  (t == null ? void 0 : t.client) || "web",
@@ -115,25 +116,25 @@ class u {
115
116
  return this.token = t, this;
116
117
  }
117
118
  async request(t, r, s, i) {
118
- const o = {
119
+ const a = {
119
120
  Accept: "application/json",
120
121
  "X-Zenky-Client": this.client,
121
122
  "X-Timezone": this.timezone
122
123
  };
123
- i ? o.Authorization = `Bearer ${i}` : this.token && (o.Authorization = `Bearer ${this.token}`);
124
- const a = {
124
+ i ? a.Authorization = `Bearer ${i}` : this.token && (a.Authorization = `Bearer ${this.token}`);
125
+ const u = {
125
126
  method: t,
126
127
  mode: "cors",
127
128
  ...this.fetchOptions
128
129
  };
129
- s && (o["Content-Type"] = "application/json", a.body = JSON.stringify(s)), a.headers = o;
130
- const c = await this.fetchFunction.call(null, `${this.baseUrl}${r}`, a);
131
- if (c.ok)
132
- return c.json();
133
- throw await w.build(c);
130
+ s && (a["Content-Type"] = "application/json", u.body = JSON.stringify(s)), u.headers = a;
131
+ const l = await this.fetchFunction.call(null, `${this.baseUrl}${r}`, u);
132
+ if (l.ok)
133
+ return l.json();
134
+ throw await R.build(l);
134
135
  }
135
136
  }
136
- class m extends l {
137
+ class m extends o {
137
138
  async getStore(t) {
138
139
  const r = this.getUrl(`/store/${t}`);
139
140
  return this.getResponse(await this.client.request("GET", r));
@@ -143,7 +144,7 @@ class m extends l {
143
144
  return this.getResponse(await this.client.request("GET", r));
144
145
  }
145
146
  }
146
- class v extends l {
147
+ class U extends o {
147
148
  async getCollections(t, r) {
148
149
  const s = this.getStoreUrl(t, "/collections", r);
149
150
  return this.getPaginatedResponse(await this.client.request("GET", s));
@@ -153,7 +154,7 @@ class v extends l {
153
154
  return this.getResponse(await this.client.request("GET", s));
154
155
  }
155
156
  }
156
- class f extends l {
157
+ class q extends o {
157
158
  async getOffers(t, r) {
158
159
  const s = this.getStoreUrl(t, "/offers", r);
159
160
  return this.getPaginatedResponse(await this.client.request("GET", s));
@@ -163,7 +164,7 @@ class f extends l {
163
164
  return this.getResponse(await this.client.request("GET", i));
164
165
  }
165
166
  }
166
- class O extends l {
167
+ class O extends o {
167
168
  async createFeedback(t, r) {
168
169
  const s = this.getStoreUrl(t, "/feedback", r);
169
170
  return this.getResponse(await this.client.request("POST", s));
@@ -173,7 +174,7 @@ class O extends l {
173
174
  return await this.client.request("POST", s), !0;
174
175
  }
175
176
  }
176
- class R extends l {
177
+ class f extends o {
177
178
  async getProducts(t, r) {
178
179
  const s = this.getStoreUrl(t, "/products", r);
179
180
  return this.getPaginatedResponse(await this.client.request("GET", s));
@@ -183,14 +184,14 @@ class R extends l {
183
184
  return this.getResponse(await this.client.request("GET", i));
184
185
  }
185
186
  async getProductVariantPrice(t, r, s, i) {
186
- const o = this.getStoreUrl(t, `/products/${r}/variants/${s}/price`);
187
- return this.getResponse(await this.client.request("POST", o, i));
187
+ const a = this.getStoreUrl(t, `/products/${r}/variants/${s}/price`);
188
+ return this.getResponse(await this.client.request("POST", a, i));
188
189
  }
189
190
  }
190
- class y extends l {
191
+ class v extends o {
191
192
  getOrderUrl(t, r, s, i) {
192
- const o = typeof r == "string" ? r : r.id, a = typeof r == "string" ? void 0 : r.token;
193
- return this.getStoreUrl(t, `/orders/${o}${s}${a ? "?token=" + a : ""}`, i);
193
+ const a = typeof r == "string" ? r : r.id, u = typeof r == "string" ? void 0 : r.token;
194
+ return this.getStoreUrl(t, `/orders/${a}${s}${u ? "?token=" + u : ""}`, i);
194
195
  }
195
196
  getApiToken(t) {
196
197
  if (!(typeof t == "string" || typeof t.api_token > "u"))
@@ -301,61 +302,152 @@ class y extends l {
301
302
  );
302
303
  }
303
304
  }
304
- class Q {
305
+ class S extends o {
306
+ async getAddressSuggestions(t, r) {
307
+ const s = this.getStoreUrl(t, "/suggestions/address");
308
+ return this.getResponse(await this.client.request("POST", s, r));
309
+ }
310
+ }
311
+ class P extends o {
312
+ async getProfile(t, r, s) {
313
+ const i = this.getStoreUrl(t, "/me", r);
314
+ return this.getResponse(await this.client.request("GET", i, null, s));
315
+ }
316
+ async updateProfile(t, r, s) {
317
+ const i = this.getStoreUrl(t, "/me");
318
+ return this.getResponse(await this.client.request("PUT", i, r, s));
319
+ }
320
+ async removeProfile(t, r, s) {
321
+ const i = this.getStoreUrl(t, "/me");
322
+ return await this.client.request("DELETE", i, r, s), !0;
323
+ }
324
+ async getSettings(t, r) {
325
+ const s = this.getStoreUrl(t, "/me/settings");
326
+ return this.getResponse(await this.client.request("GET", s, null, r));
327
+ }
328
+ async updateSettings(t, r, s) {
329
+ const i = this.getStoreUrl(t, "/me/settings");
330
+ return this.getResponse(await this.client.request("PUT", i, r, s));
331
+ }
332
+ async getAddresses(t, r, s) {
333
+ const i = this.getStoreUrl(t, "/me/addresses", r);
334
+ return this.getPaginatedResponse(await this.client.request("GET", i, null, s));
335
+ }
336
+ async createAddress(t, r, s) {
337
+ const i = this.getStoreUrl(t, "/me/addresses");
338
+ return this.getResponse(await this.client.request("POST", i, r, s));
339
+ }
340
+ async updateAddress(t, r, s, i) {
341
+ const a = this.getStoreUrl(t, `/me/addresses/${r}`);
342
+ return this.getResponse(await this.client.request("PUT", a, s, i));
343
+ }
344
+ async deleteAddress(t, r, s) {
345
+ const i = this.getStoreUrl(t, `/me/addresses/${r}`);
346
+ return await this.client.request("DELETE", i, null, s), !0;
347
+ }
348
+ async getPaymentMethods(t, r, s) {
349
+ const i = this.getStoreUrl(t, "/me/payment-methods", r);
350
+ return this.getPaginatedResponse(await this.client.request("GET", i, null, s));
351
+ }
352
+ async deletePaymentMethod(t, r, s) {
353
+ const i = this.getStoreUrl(t, `/me/payment-methods/${r}`);
354
+ return await this.client.request("DELETE", i, null, s), !0;
355
+ }
356
+ async getBonusesTransactions(t, r, s) {
357
+ const i = this.getStoreUrl(t, "/me/loyalty/transactions", r);
358
+ return this.getPaginatedResponse(await this.client.request("GET", i, null, s));
359
+ }
360
+ }
361
+ class y extends o {
362
+ async checkPhone(t, r) {
363
+ const s = this.getStoreUrl(t, "/auth/check");
364
+ return this.getResponse(await this.client.request("POST", s, r));
365
+ }
366
+ async register(t, r) {
367
+ const s = this.getStoreUrl(t, "/auth/register");
368
+ return this.getResponse(await this.client.request("POST", s, r));
369
+ }
370
+ async confirmRegistration(t, r) {
371
+ const s = this.getStoreUrl(t, "/auth/register/confirm");
372
+ return this.getResponse(await this.client.request("POST", s, r));
373
+ }
374
+ async resendRegistrationConfirmation(t, r) {
375
+ const s = this.getStoreUrl(t, "/auth/register/resend");
376
+ return this.getResponse(await this.client.request("POST", s, r));
377
+ }
378
+ async login(t, r) {
379
+ const s = this.getStoreUrl(t, "/auth/login");
380
+ return this.getResponse(await this.client.request("POST", s, r));
381
+ }
382
+ async dispatchPasswordReset(t, r) {
383
+ const s = this.getStoreUrl(t, "/auth/password/request");
384
+ return this.getResponse(await this.client.request("POST", s, r));
385
+ }
386
+ async resetPassword(t, r) {
387
+ const s = this.getStoreUrl(t, "/auth/password/reset");
388
+ return this.getResponse(await this.client.request("POST", s, r));
389
+ }
390
+ }
391
+ class te {
305
392
  constructor(t, r) {
306
393
  n(this, "client");
307
394
  n(this, "store");
395
+ n(this, "auth");
396
+ n(this, "customer");
308
397
  n(this, "categories");
309
398
  n(this, "products");
399
+ n(this, "addresses");
310
400
  n(this, "orders");
311
401
  n(this, "collections");
312
402
  n(this, "offers");
313
403
  n(this, "articles");
314
404
  n(this, "feedback");
315
- const s = u.build(t, r);
316
- this.store = new m(s), this.categories = new k(s), this.products = new R(s), this.orders = new y(s), this.collections = new v(s), this.offers = new f(s), this.articles = new p(s), this.feedback = new O(s), this.client = s;
405
+ const s = c.build(t, r);
406
+ this.store = new m(s), this.auth = new y(s), this.customer = new P(s), this.categories = new k(s), this.products = new f(s), this.addresses = new S(s), this.orders = new v(s), this.collections = new U(s), this.offers = new q(s), this.articles = new w(s), this.feedback = new O(s), this.client = s;
317
407
  }
318
408
  setApiToken(t) {
319
409
  return this.client.setToken(t), this;
320
410
  }
321
411
  }
322
- var U = /* @__PURE__ */ ((e) => (e.Female = "female", e.Male = "male", e.Other = "other", e))(U || {}), b = /* @__PURE__ */ ((e) => (e.Select = "select", e.MutipleSelect = "mutiple_select", e.Checkboxes = "checkboxes", e.Radios = "radios", e.Range = "range", e.Text = "text", e))(b || {}), q = /* @__PURE__ */ ((e) => (e.Integer = "integer", e.Float = "float", e))(q || {}), P = /* @__PURE__ */ ((e) => (e.Increase = "increase", e.Decrease = "decrease", e))(P || {}), S = /* @__PURE__ */ ((e) => (e.Pending = "pending", e.Confirmed = "confirmed", e.Cancelled = "cancelled", e.Rejected = "rejected", e.Refunded = "refunded", e.PartiallyRefunded = "partially_refunded", e))(S || {}), E = /* @__PURE__ */ ((e) => (e.Manual = "manual", e.Cashback = "cashback", e.ReferralReward = "referral_reward", e.RecruitReward = "recruit_reward", e.Payment = "payment", e.Cancellation = "cancellation", e.Refund = "refund", e.Adjustment = "adjustment", e.WelcomeBonuses = "welcome_bonuses", e.PromotionReward = "promotion_reward", e.External = "external", e))(E || {}), G = /* @__PURE__ */ ((e) => (e.Delivery = "delivery", e.Pickup = "pickup", e.OnPremise = "on_premise", e))(G || {}), T = /* @__PURE__ */ ((e) => (e.Payment = "payment", e.Refund = "refund", e))(T || {}), $ = /* @__PURE__ */ ((e) => (e.Cash = "cash", e.CreditCard = "credit-card", e.CloudPayments = "cloudpayments", e.CardToken = "card_token", e.Bonuses = "bonuses", e))($ || {}), A = /* @__PURE__ */ ((e) => (e.Pending = "pending", e.Confirmed = "confirmed", e.Cancelled = "cancelled", e.PendingRefund = "pending_refund", e.Refunding = "refunding", e.Refunded = "refunded", e))(A || {}), _ = /* @__PURE__ */ ((e) => (e.Auth = "auth", e.Charge = "charge", e))(_ || {}), C = /* @__PURE__ */ ((e) => (e.PersonsCount = "persons_count", e.DeliveryTime = "delivery_time", e))(C || {}), x = /* @__PURE__ */ ((e) => (e.PriceMismatch = "price_mismatch", e.OutOfStock = "out_of_stock", e.Unavailable = "unavailable", e))(x || {}), z = /* @__PURE__ */ ((e) => (e.None = "none", e.Cleanup = "cleanup", e))(z || {}), I = /* @__PURE__ */ ((e) => (e.Sms = "sms", e.Call = "call", e))(I || {}), V = /* @__PURE__ */ ((e) => (e.Piece = "piece", e.Gram = "gram", e.Kilogram = "kilogram", e.Meter = "meter", e))(V || {}), j = /* @__PURE__ */ ((e) => (e.Weight = "weight", e.Width = "width", e.Height = "height", e.Length = "length", e))(j || {}), F = /* @__PURE__ */ ((e) => (e.Netto = "netto", e.Brutto = "brutto", e))(F || {}), N = /* @__PURE__ */ ((e) => (e.Color = "color", e))(N || {}), W = /* @__PURE__ */ ((e) => (e.Category = "category", e.Group = "group", e.VariantOption = "variant_option", e.VariantOptionValue = "variant_option_value", e))(W || {}), Z = /* @__PURE__ */ ((e) => (e.Amount = "amount", e.Percentage = "percentage", e))(Z || {}), X = /* @__PURE__ */ ((e) => (e.Email = "email", e.Website = "website", e.Vk = "vk", e.Facebook = "facebook", e.Instagram = "instagram", e.Twitter = "twitter", e.Ok = "ok", e.Tiktok = "tiktok", e))(X || {}), H = /* @__PURE__ */ ((e) => (e.Yes = "yes", e.No = "no", e.Both = "both", e))(H || {}), J = /* @__PURE__ */ ((e) => (e.Disabled = "disabled", e.Preauth = "preauth", e.Confirmation = "confirmation", e))(J || {}), L = /* @__PURE__ */ ((e) => (e.Dadata = "dadata", e.Manual = "manual", e))(L || {}), Y = /* @__PURE__ */ ((e) => (e.Registration = "registration", e.ResendRegistrationCode = "resend_registration_code", e.ResetPassword = "reset_password", e.OrderSubmission = "order_submission", e.FeedbackRequest = "feedback_request", e.CallbackRequest = "callback_request", e))(Y || {});
412
+ var b = /* @__PURE__ */ ((e) => (e.Female = "female", e.Male = "male", e.Other = "other", e))(b || {}), E = /* @__PURE__ */ ((e) => (e.CloudPayments = "cloudpayments", e))(E || {}), T = /* @__PURE__ */ ((e) => (e.Visa = "visa", e.MasterCard = "master-card", e.MIR = "mir", e.Maestro = "maestro", e.AmericanExpress = "american-express", e.DinersClub = "diners-club", e.Discover = "discover", e.JCB = "jcb", e.UnionPay = "union-pay", e))(T || {}), A = /* @__PURE__ */ ((e) => (e.Select = "select", e.MutipleSelect = "mutiple_select", e.Checkboxes = "checkboxes", e.Radios = "radios", e.Range = "range", e.Text = "text", e))(A || {}), G = /* @__PURE__ */ ((e) => (e.Integer = "integer", e.Float = "float", e))(G || {}), $ = /* @__PURE__ */ ((e) => (e.Increase = "increase", e.Decrease = "decrease", e))($ || {}), C = /* @__PURE__ */ ((e) => (e.Pending = "pending", e.Confirmed = "confirmed", e.Cancelled = "cancelled", e.Rejected = "rejected", e.Refunded = "refunded", e.PartiallyRefunded = "partially_refunded", e))(C || {}), _ = /* @__PURE__ */ ((e) => (e.Manual = "manual", e.Cashback = "cashback", e.ReferralReward = "referral_reward", e.RecruitReward = "recruit_reward", e.Payment = "payment", e.Cancellation = "cancellation", e.Refund = "refund", e.Adjustment = "adjustment", e.WelcomeBonuses = "welcome_bonuses", e.PromotionReward = "promotion_reward", e.External = "external", e))(_ || {}), x = /* @__PURE__ */ ((e) => (e.Delivery = "delivery", e.Pickup = "pickup", e.OnPremise = "on_premise", e))(x || {}), z = /* @__PURE__ */ ((e) => (e.Payment = "payment", e.Refund = "refund", e))(z || {}), I = /* @__PURE__ */ ((e) => (e.Cash = "cash", e.CreditCard = "credit-card", e.CloudPayments = "cloudpayments", e.CardToken = "card_token", e.Bonuses = "bonuses", e))(I || {}), V = /* @__PURE__ */ ((e) => (e.Pending = "pending", e.Confirmed = "confirmed", e.Cancelled = "cancelled", e.PendingRefund = "pending_refund", e.Refunding = "refunding", e.Refunded = "refunded", e))(V || {}), j = /* @__PURE__ */ ((e) => (e.Auth = "auth", e.Charge = "charge", e))(j || {}), D = /* @__PURE__ */ ((e) => (e.PersonsCount = "persons_count", e.DeliveryTime = "delivery_time", e))(D || {}), F = /* @__PURE__ */ ((e) => (e.PriceMismatch = "price_mismatch", e.OutOfStock = "out_of_stock", e.Unavailable = "unavailable", e))(F || {}), L = /* @__PURE__ */ ((e) => (e.None = "none", e.Cleanup = "cleanup", e))(L || {}), M = /* @__PURE__ */ ((e) => (e.Piece = "piece", e.Gram = "gram", e.Kilogram = "kilogram", e.Meter = "meter", e))(M || {}), N = /* @__PURE__ */ ((e) => (e.Weight = "weight", e.Width = "width", e.Height = "height", e.Length = "length", e))(N || {}), W = /* @__PURE__ */ ((e) => (e.Netto = "netto", e.Brutto = "brutto", e))(W || {}), Z = /* @__PURE__ */ ((e) => (e.Color = "color", e))(Z || {}), J = /* @__PURE__ */ ((e) => (e.Category = "category", e.Group = "group", e.VariantOption = "variant_option", e.VariantOptionValue = "variant_option_value", e))(J || {}), X = /* @__PURE__ */ ((e) => (e.Amount = "amount", e.Percentage = "percentage", e))(X || {}), H = /* @__PURE__ */ ((e) => (e.Email = "email", e.Website = "website", e.Vk = "vk", e.Facebook = "facebook", e.Instagram = "instagram", e.Twitter = "twitter", e.Ok = "ok", e.Tiktok = "tiktok", e))(H || {}), Y = /* @__PURE__ */ ((e) => (e.Yes = "yes", e.No = "no", e.Both = "both", e))(Y || {}), K = /* @__PURE__ */ ((e) => (e.Disabled = "disabled", e.Preauth = "preauth", e.Confirmation = "confirmation", e))(K || {}), Q = /* @__PURE__ */ ((e) => (e.Dadata = "dadata", e.Manual = "manual", e))(Q || {}), B = /* @__PURE__ */ ((e) => (e.Registration = "registration", e.ResendRegistrationCode = "resend_registration_code", e.ResetPassword = "reset_password", e.OrderSubmission = "order_submission", e.FeedbackRequest = "feedback_request", e.CallbackRequest = "callback_request", e))(B || {});
323
413
  export {
324
- L as AddressesProvider,
325
- p as ArticlesResource,
326
- E as BonusesTransactionReason,
327
- S as BonusesTransactionStatus,
328
- P as BonusesTransactionType,
414
+ E as AcquiringType,
415
+ p as AddressSuggestionsProvider,
416
+ Q as AddressesProvider,
417
+ w as ArticlesResource,
418
+ _ as BonusesTransactionReason,
419
+ C as BonusesTransactionStatus,
420
+ $ as BonusesTransactionType,
329
421
  k as CategoriesResource,
330
- _ as CloudpaymentsChargeType,
331
- v as CollectionsResource,
332
- X as ContactType,
333
- G as DeliveryMethod,
334
- j as Dimension,
335
- F as DimensionType,
336
- Z as DiscountType,
337
- q as FeatureRange,
338
- b as FeatureType,
422
+ j as CloudpaymentsChargeType,
423
+ U as CollectionsResource,
424
+ H as ContactType,
425
+ x as DeliveryMethod,
426
+ N as Dimension,
427
+ W as DimensionType,
428
+ X as DiscountType,
429
+ G as FeatureRange,
430
+ A as FeatureType,
339
431
  O as FeedbackResource,
340
- U as Gender,
341
- f as OffersResource,
342
- J as OrderAuthenticationMethod,
343
- z as OrderCartCheckerResultAction,
344
- x as OrderCartCheckerResultReason,
345
- I as OrderConfirmationMethod,
346
- C as OrderOptionKind,
347
- A as OrderPaymentTransactionStatus,
348
- T as OrderPaymentTransactionType,
349
- y as OrdersResource,
350
- $ as PaymentMethod,
351
- W as ProductContextType,
352
- R as ProductsResource,
353
- Y as RecaptchaAction,
432
+ b as Gender,
433
+ q as OffersResource,
434
+ K as OrderAuthenticationMethod,
435
+ L as OrderCartCheckerResultAction,
436
+ F as OrderCartCheckerResultReason,
437
+ D as OrderOptionKind,
438
+ V as OrderPaymentTransactionStatus,
439
+ z as OrderPaymentTransactionType,
440
+ v as OrdersResource,
441
+ I as PaymentMethod,
442
+ T as PaymentSystemType,
443
+ J as ProductContextType,
444
+ f as ProductsResource,
445
+ B as RecaptchaAction,
354
446
  m as StoreResource,
355
- H as TernaryFilter,
356
- V as UnitType,
357
- N as VariantOptionType,
447
+ Y as TernaryFilter,
448
+ M as UnitType,
449
+ Z as VariantOptionType,
358
450
  h as ZenkyError,
359
- w as ZenkyErrorBuilder,
360
- Q as ZenkyStorefront
451
+ R as ZenkyErrorBuilder,
452
+ te as ZenkyStorefront
361
453
  };
@@ -1 +1 @@
1
- (function(i,a){typeof exports=="object"&&typeof module<"u"?a(exports):typeof define=="function"&&define.amd?define(["exports"],a):(i=typeof globalThis<"u"?globalThis:i||self,a(i.zenkyStorefrontApi={}))})(this,function(i){"use strict";var L=Object.defineProperty;var Y=(i,a,l)=>a in i?L(i,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[a]=l;var o=(i,a,l)=>(Y(i,typeof a!="symbol"?a+"":a,l),l);class a{constructor(t){this.client=t}getStoreUrl(t,r,s={}){return this.getUrl(`/store/${t}${r}`,s)}getUrl(t,r={}){if(!Object.keys(r).length)return t;const s=[];Object.keys(r).forEach(c=>{s.push(`${c}=${r[c]}`)});const n=t.includes("?")?"&":"?";return`${t}${n}${s.join("&")}`}getPaginatedResponse(t){if(!t||!Array.isArray(t.data)||!t.meta||!t.meta.pagination)throw new Error("getPaginatedResponse(): Invalid response.");const r=t.data,s=t.meta.pagination;return{items:r,pagination:s}}getResponse(t){if(!t||!t.data)throw new Error("getResponse(): Invalid response.");return t.data}}class l extends a{async getArticleCategories(t){const r=this.getStoreUrl(t,"/articles/categories");return this.getPaginatedResponse(await this.client.request("GET",r))}async getArticleCategory(t,r){const s=this.getStoreUrl(t,`/articles/categories/${r}`);return this.getResponse(await this.client.request("GET",s))}async getArticles(t,r){const s=this.getStoreUrl(t,"/articles",r);return this.getPaginatedResponse(await this.client.request("GET",s))}async getArticle(t,r,s){const n=this.getStoreUrl(t,`/articles/${r}`,s);return this.getResponse(await this.client.request("GET",n))}}class k extends a{async getCategories(t,r){const s=this.getStoreUrl(t,"/categories",r);return this.getPaginatedResponse(await this.client.request("GET",s))}async getCategoriesTree(t,r){const s=this.getStoreUrl(t,"/categories/tree",r);return this.getResponse(await this.client.request("GET",s))}async getCategory(t,r,s){const n=this.getStoreUrl(t,`/categories/${r}`,s);return this.getResponse(await this.client.request("GET",n))}async getFeaturesGroups(t,r){const s=this.getStoreUrl(t,`/categories/${r}/features/groups`);return this.getResponse(await this.client.request("GET",s))}async getFeatures(t,r){const s=this.getStoreUrl(t,`/categories/${r}/features`);return this.getResponse(await this.client.request("GET",s))}}class h extends Error{constructor(r,s){super(r);o(this,"err");this.err=s}}class w{static async build(t){const r=await t.json();switch(t.status){case 401:return new h((r==null?void 0:r.message)||"Unauthenticated.",null);default:return new h(r==null?void 0:r.message,(r==null?void 0:r.error)||null)}}}class d{constructor(t,r,s,n,c,u){o(this,"baseUrl");o(this,"token");o(this,"client");o(this,"timezone");o(this,"fetchFunction");o(this,"fetchOptions");this.baseUrl=t,this.token=r,this.client=s,this.timezone=n,this.fetchFunction=typeof c=="function"?c:fetch,this.fetchOptions=typeof u<"u"?u:{}}static build(t,r){return new d((t==null?void 0:t.baseUrl)||"https://storefront.zenky.io/v1",(t==null?void 0:t.token)||null,(t==null?void 0:t.client)||"web",(t==null?void 0:t.timezone)||"UTC",r,t==null?void 0:t.fetchOptions)}setToken(t){return this.token=t,this}async request(t,r,s,n){const c={Accept:"application/json","X-Zenky-Client":this.client,"X-Timezone":this.timezone};n?c.Authorization=`Bearer ${n}`:this.token&&(c.Authorization=`Bearer ${this.token}`);const u={method:t,mode:"cors",...this.fetchOptions};s&&(c["Content-Type"]="application/json",u.body=JSON.stringify(s)),u.headers=c;const g=await this.fetchFunction.call(null,`${this.baseUrl}${r}`,u);if(g.ok)return g.json();throw await w.build(g)}}class p extends a{async getStore(t){const r=this.getUrl(`/store/${t}`);return this.getResponse(await this.client.request("GET",r))}async getStoreByBundleId(t){const r=this.getUrl(`/store/by-bundle/${t}`);return this.getResponse(await this.client.request("GET",r))}}class y extends a{async getCollections(t,r){const s=this.getStoreUrl(t,"/collections",r);return this.getPaginatedResponse(await this.client.request("GET",s))}async getCollection(t,r){const s=this.getStoreUrl(t,`/collections/${r}`);return this.getResponse(await this.client.request("GET",s))}}class f extends a{async getOffers(t,r){const s=this.getStoreUrl(t,"/offers",r);return this.getPaginatedResponse(await this.client.request("GET",s))}async getOffer(t,r,s){const n=this.getStoreUrl(t,`/offers/${r}`,s);return this.getResponse(await this.client.request("GET",n))}}class m extends a{async createFeedback(t,r){const s=this.getStoreUrl(t,"/feedback",r);return this.getResponse(await this.client.request("POST",s))}async createCallback(t,r){const s=this.getStoreUrl(t,"/callback",r);return await this.client.request("POST",s),!0}}class O extends a{async getProducts(t,r){const s=this.getStoreUrl(t,"/products",r);return this.getPaginatedResponse(await this.client.request("GET",s))}async getProduct(t,r,s){const n=this.getStoreUrl(t,`/products/${r}`,s);return this.getResponse(await this.client.request("GET",n))}async getProductVariantPrice(t,r,s,n){const c=this.getStoreUrl(t,`/products/${r}/variants/${s}/price`);return this.getResponse(await this.client.request("POST",c,n))}}class R extends a{getOrderUrl(t,r,s,n){const c=typeof r=="string"?r:r.id,u=typeof r=="string"?void 0:r.token;return this.getStoreUrl(t,`/orders/${c}${s}${u?"?token="+u:""}`,n)}getApiToken(t){if(!(typeof t=="string"||typeof t.api_token>"u"))return t.api_token}async getOrders(t,r,s){const n=this.getStoreUrl(t,"/orders",r);return this.getPaginatedResponse(await this.client.request("GET",n,void 0,s))}async createOrder(t,r,s){const n=this.getStoreUrl(t,"/orders");return this.getResponse(await this.client.request("POST",n,r,s))}async getOrder(t,r,s){const n=this.getOrderUrl(t,r,"",s);return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(r)))}async getOrderSettings(t,r){const s=this.getOrderUrl(t,r,"/settings");return this.getResponse(await this.client.request("GET",s,void 0,this.getApiToken(r)))}async addProductVariantToOrder(t,r,s){const n=this.getOrderUrl(t,r,"/products");return this.getResponse(await this.client.request("POST",n,s,this.getApiToken(r)))}async removeProductVariantFromOrder(t,r,s){const n=this.getOrderUrl(t,r,"/products");return this.getResponse(await this.client.request("POST",n,s,this.getApiToken(r)))}async checkProducts(t,r){const s=this.getOrderUrl(t,r,"/products/check");return this.getResponse(await this.client.request("POST",s,void 0,this.getApiToken(r)))}async setOrderCustomer(t,r,s){const n=this.getOrderUrl(t,r,"/checkout/customer");return await this.client.request("POST",n,s,this.getApiToken(r)),!0}async setOrderDeliveryMethod(t,r,s){const n=this.getOrderUrl(t,r,"/checkout/delivery");return this.getResponse(await this.client.request("POST",n,s,this.getApiToken(r)))}async setOrderPayments(t,r,s){const n=this.getOrderUrl(t,r,"/checkout/payments");return this.getResponse(await this.client.request("POST",n,s,this.getApiToken(r)))}async getOrderBonusesPreview(t,r,s){const n=this.getOrderUrl(t,r,"/checkout/bonuses/preview",{amount:s});return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(r)))}async getOrderTotal(t,r){const s=this.getOrderUrl(t,r,"/checkout/total");return this.getResponse(await this.client.request("GET",s,void 0,this.getApiToken(r)))}async checkoutOrder(t,r,s){const n=this.getOrderUrl(t,r,"/checkout");return this.getResponse(await this.client.request("POST",n,s,this.getApiToken(r)))}async confirmOrder(t,r,s){const n=this.getOrderUrl(t,r,"/confirm");return await this.client.request("POST",n,s,this.getApiToken(r)),!0}async resendOrderConfirmationCode(t,r){const s=this.getOrderUrl(t,r,"/confirm/resend");return await this.client.request("POST",s,void 0,this.getApiToken(r)),!0}async getOrderBonusesTransactions(t,r,s){const n=this.getOrderUrl(t,r,"/loyalty/transactions",s);return this.getPaginatedResponse(await this.client.request("GET",n,void 0,this.getApiToken(r)))}async getOrderCashbackTransaction(t,r){const s=this.getOrderUrl(t,r,"/loyalty/transactions/cashback");return this.getResponse(await this.client.request("GET",s,void 0,this.getApiToken(r)))}async dispatchPromotionsChecker(t,r){const s=this.getOrderUrl(t,r,"/loyalty/promotions/check");return this.getResponse(await this.client.request("POST",s,void 0,this.getApiToken(r))).dispatched}async getOrderPromotionRewards(t,r){const s=this.getOrderUrl(t,r,"/loyalty/promotions/rewards");return this.getResponse(await this.client.request("GET",s,void 0,this.getApiToken(r)))}}class K{constructor(t,r){o(this,"client");o(this,"store");o(this,"categories");o(this,"products");o(this,"orders");o(this,"collections");o(this,"offers");o(this,"articles");o(this,"feedback");const s=d.build(t,r);this.store=new p(s),this.categories=new k(s),this.products=new O(s),this.orders=new R(s),this.collections=new y(s),this.offers=new f(s),this.articles=new l(s),this.feedback=new m(s),this.client=s}setApiToken(t){return this.client.setToken(t),this}}var v=(e=>(e.Female="female",e.Male="male",e.Other="other",e))(v||{}),b=(e=>(e.Select="select",e.MutipleSelect="mutiple_select",e.Checkboxes="checkboxes",e.Radios="radios",e.Range="range",e.Text="text",e))(b||{}),U=(e=>(e.Integer="integer",e.Float="float",e))(U||{}),P=(e=>(e.Increase="increase",e.Decrease="decrease",e))(P||{}),T=(e=>(e.Pending="pending",e.Confirmed="confirmed",e.Cancelled="cancelled",e.Rejected="rejected",e.Refunded="refunded",e.PartiallyRefunded="partially_refunded",e))(T||{}),S=(e=>(e.Manual="manual",e.Cashback="cashback",e.ReferralReward="referral_reward",e.RecruitReward="recruit_reward",e.Payment="payment",e.Cancellation="cancellation",e.Refund="refund",e.Adjustment="adjustment",e.WelcomeBonuses="welcome_bonuses",e.PromotionReward="promotion_reward",e.External="external",e))(S||{}),q=(e=>(e.Delivery="delivery",e.Pickup="pickup",e.OnPremise="on_premise",e))(q||{}),E=(e=>(e.Payment="payment",e.Refund="refund",e))(E||{}),C=(e=>(e.Cash="cash",e.CreditCard="credit-card",e.CloudPayments="cloudpayments",e.CardToken="card_token",e.Bonuses="bonuses",e))(C||{}),A=(e=>(e.Pending="pending",e.Confirmed="confirmed",e.Cancelled="cancelled",e.PendingRefund="pending_refund",e.Refunding="refunding",e.Refunded="refunded",e))(A||{}),G=(e=>(e.Auth="auth",e.Charge="charge",e))(G||{}),$=(e=>(e.PersonsCount="persons_count",e.DeliveryTime="delivery_time",e))($||{}),_=(e=>(e.PriceMismatch="price_mismatch",e.OutOfStock="out_of_stock",e.Unavailable="unavailable",e))(_||{}),z=(e=>(e.None="none",e.Cleanup="cleanup",e))(z||{}),j=(e=>(e.Sms="sms",e.Call="call",e))(j||{}),F=(e=>(e.Piece="piece",e.Gram="gram",e.Kilogram="kilogram",e.Meter="meter",e))(F||{}),V=(e=>(e.Weight="weight",e.Width="width",e.Height="height",e.Length="length",e))(V||{}),I=(e=>(e.Netto="netto",e.Brutto="brutto",e))(I||{}),Z=(e=>(e.Color="color",e))(Z||{}),N=(e=>(e.Category="category",e.Group="group",e.VariantOption="variant_option",e.VariantOptionValue="variant_option_value",e))(N||{}),W=(e=>(e.Amount="amount",e.Percentage="percentage",e))(W||{}),D=(e=>(e.Email="email",e.Website="website",e.Vk="vk",e.Facebook="facebook",e.Instagram="instagram",e.Twitter="twitter",e.Ok="ok",e.Tiktok="tiktok",e))(D||{}),M=(e=>(e.Yes="yes",e.No="no",e.Both="both",e))(M||{}),X=(e=>(e.Disabled="disabled",e.Preauth="preauth",e.Confirmation="confirmation",e))(X||{}),H=(e=>(e.Dadata="dadata",e.Manual="manual",e))(H||{}),J=(e=>(e.Registration="registration",e.ResendRegistrationCode="resend_registration_code",e.ResetPassword="reset_password",e.OrderSubmission="order_submission",e.FeedbackRequest="feedback_request",e.CallbackRequest="callback_request",e))(J||{});i.AddressesProvider=H,i.ArticlesResource=l,i.BonusesTransactionReason=S,i.BonusesTransactionStatus=T,i.BonusesTransactionType=P,i.CategoriesResource=k,i.CloudpaymentsChargeType=G,i.CollectionsResource=y,i.ContactType=D,i.DeliveryMethod=q,i.Dimension=V,i.DimensionType=I,i.DiscountType=W,i.FeatureRange=U,i.FeatureType=b,i.FeedbackResource=m,i.Gender=v,i.OffersResource=f,i.OrderAuthenticationMethod=X,i.OrderCartCheckerResultAction=z,i.OrderCartCheckerResultReason=_,i.OrderConfirmationMethod=j,i.OrderOptionKind=$,i.OrderPaymentTransactionStatus=A,i.OrderPaymentTransactionType=E,i.OrdersResource=R,i.PaymentMethod=C,i.ProductContextType=N,i.ProductsResource=O,i.RecaptchaAction=J,i.StoreResource=p,i.TernaryFilter=M,i.UnitType=F,i.VariantOptionType=Z,i.ZenkyError=h,i.ZenkyErrorBuilder=w,i.ZenkyStorefront=K,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
1
+ (function(n,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(n=typeof globalThis<"u"?globalThis:n||self,c(n.zenkyStorefrontApi={}))})(this,function(n){"use strict";var ee=Object.defineProperty;var te=(n,c,o)=>c in n?ee(n,c,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[c]=o;var a=(n,c,o)=>(te(n,typeof c!="symbol"?c+"":c,o),o);var c=(e=>(e.DADATA="dadata",e))(c||{});class o{constructor(t){this.client=t}getStoreUrl(t,r,s={}){return this.getUrl(`/store/${t}${r}`,s)}getUrl(t,r={}){if(!Object.keys(r).length)return t;const s=[];Object.keys(r).forEach(u=>{s.push(`${u}=${r[u]}`)});const i=t.includes("?")?"&":"?";return`${t}${i}${s.join("&")}`}getPaginatedResponse(t){if(!t||!Array.isArray(t.data)||!t.meta||!t.meta.pagination)throw new Error("getPaginatedResponse(): Invalid response.");const r=t.data,s=t.meta.pagination;return{items:r,pagination:s}}getResponse(t){if(!t||!t.data)throw new Error("getResponse(): Invalid response.");return t.data}}class w extends o{async getArticleCategories(t){const r=this.getStoreUrl(t,"/articles/categories");return this.getPaginatedResponse(await this.client.request("GET",r))}async getArticleCategory(t,r){const s=this.getStoreUrl(t,`/articles/categories/${r}`);return this.getResponse(await this.client.request("GET",s))}async getArticles(t,r){const s=this.getStoreUrl(t,"/articles",r);return this.getPaginatedResponse(await this.client.request("GET",s))}async getArticle(t,r,s){const i=this.getStoreUrl(t,`/articles/${r}`,s);return this.getResponse(await this.client.request("GET",i))}}class p extends o{async getCategories(t,r){const s=this.getStoreUrl(t,"/categories",r);return this.getPaginatedResponse(await this.client.request("GET",s))}async getCategoriesTree(t,r){const s=this.getStoreUrl(t,"/categories/tree",r);return this.getResponse(await this.client.request("GET",s))}async getCategory(t,r,s){const i=this.getStoreUrl(t,`/categories/${r}`,s);return this.getResponse(await this.client.request("GET",i))}async getFeaturesGroups(t,r){const s=this.getStoreUrl(t,`/categories/${r}/features/groups`);return this.getResponse(await this.client.request("GET",s))}async getFeatures(t,r){const s=this.getStoreUrl(t,`/categories/${r}/features`);return this.getResponse(await this.client.request("GET",s))}}class h extends Error{constructor(r,s){super(r);a(this,"err");this.err=s}}class k{static async build(t){const r=await t.json();switch(t.status){case 401:return new h((r==null?void 0:r.message)||"Unauthenticated.",null);default:return new h(r==null?void 0:r.message,(r==null?void 0:r.error)||null)}}}class d{constructor(t,r,s,i,u,l){a(this,"baseUrl");a(this,"token");a(this,"client");a(this,"timezone");a(this,"fetchFunction");a(this,"fetchOptions");this.baseUrl=t,this.token=r,this.client=s,this.timezone=i,this.fetchFunction=typeof u=="function"?u:fetch,this.fetchOptions=typeof l<"u"?l:{}}static build(t,r){return new d((t==null?void 0:t.baseUrl)||"https://storefront.zenky.io/v1",(t==null?void 0:t.token)||null,(t==null?void 0:t.client)||"web",(t==null?void 0:t.timezone)||"UTC",r,t==null?void 0:t.fetchOptions)}setToken(t){return this.token=t,this}async request(t,r,s,i){const u={Accept:"application/json","X-Zenky-Client":this.client,"X-Timezone":this.timezone};i?u.Authorization=`Bearer ${i}`:this.token&&(u.Authorization=`Bearer ${this.token}`);const l={method:t,mode:"cors",...this.fetchOptions};s&&(u["Content-Type"]="application/json",l.body=JSON.stringify(s)),l.headers=u;const g=await this.fetchFunction.call(null,`${this.baseUrl}${r}`,l);if(g.ok)return g.json();throw await k.build(g)}}class R extends o{async getStore(t){const r=this.getUrl(`/store/${t}`);return this.getResponse(await this.client.request("GET",r))}async getStoreByBundleId(t){const r=this.getUrl(`/store/by-bundle/${t}`);return this.getResponse(await this.client.request("GET",r))}}class m extends o{async getCollections(t,r){const s=this.getStoreUrl(t,"/collections",r);return this.getPaginatedResponse(await this.client.request("GET",s))}async getCollection(t,r){const s=this.getStoreUrl(t,`/collections/${r}`);return this.getResponse(await this.client.request("GET",s))}}class y extends o{async getOffers(t,r){const s=this.getStoreUrl(t,"/offers",r);return this.getPaginatedResponse(await this.client.request("GET",s))}async getOffer(t,r,s){const i=this.getStoreUrl(t,`/offers/${r}`,s);return this.getResponse(await this.client.request("GET",i))}}class f extends o{async createFeedback(t,r){const s=this.getStoreUrl(t,"/feedback",r);return this.getResponse(await this.client.request("POST",s))}async createCallback(t,r){const s=this.getStoreUrl(t,"/callback",r);return await this.client.request("POST",s),!0}}class O extends o{async getProducts(t,r){const s=this.getStoreUrl(t,"/products",r);return this.getPaginatedResponse(await this.client.request("GET",s))}async getProduct(t,r,s){const i=this.getStoreUrl(t,`/products/${r}`,s);return this.getResponse(await this.client.request("GET",i))}async getProductVariantPrice(t,r,s,i){const u=this.getStoreUrl(t,`/products/${r}/variants/${s}/price`);return this.getResponse(await this.client.request("POST",u,i))}}class U extends o{getOrderUrl(t,r,s,i){const u=typeof r=="string"?r:r.id,l=typeof r=="string"?void 0:r.token;return this.getStoreUrl(t,`/orders/${u}${s}${l?"?token="+l:""}`,i)}getApiToken(t){if(!(typeof t=="string"||typeof t.api_token>"u"))return t.api_token}async getOrders(t,r,s){const i=this.getStoreUrl(t,"/orders",r);return this.getPaginatedResponse(await this.client.request("GET",i,void 0,s))}async createOrder(t,r,s){const i=this.getStoreUrl(t,"/orders");return this.getResponse(await this.client.request("POST",i,r,s))}async getOrder(t,r,s){const i=this.getOrderUrl(t,r,"",s);return this.getResponse(await this.client.request("GET",i,void 0,this.getApiToken(r)))}async getOrderSettings(t,r){const s=this.getOrderUrl(t,r,"/settings");return this.getResponse(await this.client.request("GET",s,void 0,this.getApiToken(r)))}async addProductVariantToOrder(t,r,s){const i=this.getOrderUrl(t,r,"/products");return this.getResponse(await this.client.request("POST",i,s,this.getApiToken(r)))}async removeProductVariantFromOrder(t,r,s){const i=this.getOrderUrl(t,r,"/products");return this.getResponse(await this.client.request("POST",i,s,this.getApiToken(r)))}async checkProducts(t,r){const s=this.getOrderUrl(t,r,"/products/check");return this.getResponse(await this.client.request("POST",s,void 0,this.getApiToken(r)))}async setOrderCustomer(t,r,s){const i=this.getOrderUrl(t,r,"/checkout/customer");return await this.client.request("POST",i,s,this.getApiToken(r)),!0}async setOrderDeliveryMethod(t,r,s){const i=this.getOrderUrl(t,r,"/checkout/delivery");return this.getResponse(await this.client.request("POST",i,s,this.getApiToken(r)))}async setOrderPayments(t,r,s){const i=this.getOrderUrl(t,r,"/checkout/payments");return this.getResponse(await this.client.request("POST",i,s,this.getApiToken(r)))}async getOrderBonusesPreview(t,r,s){const i=this.getOrderUrl(t,r,"/checkout/bonuses/preview",{amount:s});return this.getResponse(await this.client.request("GET",i,void 0,this.getApiToken(r)))}async getOrderTotal(t,r){const s=this.getOrderUrl(t,r,"/checkout/total");return this.getResponse(await this.client.request("GET",s,void 0,this.getApiToken(r)))}async checkoutOrder(t,r,s){const i=this.getOrderUrl(t,r,"/checkout");return this.getResponse(await this.client.request("POST",i,s,this.getApiToken(r)))}async confirmOrder(t,r,s){const i=this.getOrderUrl(t,r,"/confirm");return await this.client.request("POST",i,s,this.getApiToken(r)),!0}async resendOrderConfirmationCode(t,r){const s=this.getOrderUrl(t,r,"/confirm/resend");return await this.client.request("POST",s,void 0,this.getApiToken(r)),!0}async getOrderBonusesTransactions(t,r,s){const i=this.getOrderUrl(t,r,"/loyalty/transactions",s);return this.getPaginatedResponse(await this.client.request("GET",i,void 0,this.getApiToken(r)))}async getOrderCashbackTransaction(t,r){const s=this.getOrderUrl(t,r,"/loyalty/transactions/cashback");return this.getResponse(await this.client.request("GET",s,void 0,this.getApiToken(r)))}async dispatchPromotionsChecker(t,r){const s=this.getOrderUrl(t,r,"/loyalty/promotions/check");return this.getResponse(await this.client.request("POST",s,void 0,this.getApiToken(r))).dispatched}async getOrderPromotionRewards(t,r){const s=this.getOrderUrl(t,r,"/loyalty/promotions/rewards");return this.getResponse(await this.client.request("GET",s,void 0,this.getApiToken(r)))}}class K extends o{async getAddressSuggestions(t,r){const s=this.getStoreUrl(t,"/suggestions/address");return this.getResponse(await this.client.request("POST",s,r))}}class Y extends o{async getProfile(t,r,s){const i=this.getStoreUrl(t,"/me",r);return this.getResponse(await this.client.request("GET",i,null,s))}async updateProfile(t,r,s){const i=this.getStoreUrl(t,"/me");return this.getResponse(await this.client.request("PUT",i,r,s))}async removeProfile(t,r,s){const i=this.getStoreUrl(t,"/me");return await this.client.request("DELETE",i,r,s),!0}async getSettings(t,r){const s=this.getStoreUrl(t,"/me/settings");return this.getResponse(await this.client.request("GET",s,null,r))}async updateSettings(t,r,s){const i=this.getStoreUrl(t,"/me/settings");return this.getResponse(await this.client.request("PUT",i,r,s))}async getAddresses(t,r,s){const i=this.getStoreUrl(t,"/me/addresses",r);return this.getPaginatedResponse(await this.client.request("GET",i,null,s))}async createAddress(t,r,s){const i=this.getStoreUrl(t,"/me/addresses");return this.getResponse(await this.client.request("POST",i,r,s))}async updateAddress(t,r,s,i){const u=this.getStoreUrl(t,`/me/addresses/${r}`);return this.getResponse(await this.client.request("PUT",u,s,i))}async deleteAddress(t,r,s){const i=this.getStoreUrl(t,`/me/addresses/${r}`);return await this.client.request("DELETE",i,null,s),!0}async getPaymentMethods(t,r,s){const i=this.getStoreUrl(t,"/me/payment-methods",r);return this.getPaginatedResponse(await this.client.request("GET",i,null,s))}async deletePaymentMethod(t,r,s){const i=this.getStoreUrl(t,`/me/payment-methods/${r}`);return await this.client.request("DELETE",i,null,s),!0}async getBonusesTransactions(t,r,s){const i=this.getStoreUrl(t,"/me/loyalty/transactions",r);return this.getPaginatedResponse(await this.client.request("GET",i,null,s))}}class Q extends o{async checkPhone(t,r){const s=this.getStoreUrl(t,"/auth/check");return this.getResponse(await this.client.request("POST",s,r))}async register(t,r){const s=this.getStoreUrl(t,"/auth/register");return this.getResponse(await this.client.request("POST",s,r))}async confirmRegistration(t,r){const s=this.getStoreUrl(t,"/auth/register/confirm");return this.getResponse(await this.client.request("POST",s,r))}async resendRegistrationConfirmation(t,r){const s=this.getStoreUrl(t,"/auth/register/resend");return this.getResponse(await this.client.request("POST",s,r))}async login(t,r){const s=this.getStoreUrl(t,"/auth/login");return this.getResponse(await this.client.request("POST",s,r))}async dispatchPasswordReset(t,r){const s=this.getStoreUrl(t,"/auth/password/request");return this.getResponse(await this.client.request("POST",s,r))}async resetPassword(t,r){const s=this.getStoreUrl(t,"/auth/password/reset");return this.getResponse(await this.client.request("POST",s,r))}}class x{constructor(t,r){a(this,"client");a(this,"store");a(this,"auth");a(this,"customer");a(this,"categories");a(this,"products");a(this,"addresses");a(this,"orders");a(this,"collections");a(this,"offers");a(this,"articles");a(this,"feedback");const s=d.build(t,r);this.store=new R(s),this.auth=new Q(s),this.customer=new Y(s),this.categories=new p(s),this.products=new O(s),this.addresses=new K(s),this.orders=new U(s),this.collections=new m(s),this.offers=new y(s),this.articles=new w(s),this.feedback=new f(s),this.client=s}setApiToken(t){return this.client.setToken(t),this}}var S=(e=>(e.Female="female",e.Male="male",e.Other="other",e))(S||{}),v=(e=>(e.CloudPayments="cloudpayments",e))(v||{}),q=(e=>(e.Visa="visa",e.MasterCard="master-card",e.MIR="mir",e.Maestro="maestro",e.AmericanExpress="american-express",e.DinersClub="diners-club",e.Discover="discover",e.JCB="jcb",e.UnionPay="union-pay",e))(q||{}),P=(e=>(e.Select="select",e.MutipleSelect="mutiple_select",e.Checkboxes="checkboxes",e.Radios="radios",e.Range="range",e.Text="text",e))(P||{}),T=(e=>(e.Integer="integer",e.Float="float",e))(T||{}),b=(e=>(e.Increase="increase",e.Decrease="decrease",e))(b||{}),E=(e=>(e.Pending="pending",e.Confirmed="confirmed",e.Cancelled="cancelled",e.Rejected="rejected",e.Refunded="refunded",e.PartiallyRefunded="partially_refunded",e))(E||{}),A=(e=>(e.Manual="manual",e.Cashback="cashback",e.ReferralReward="referral_reward",e.RecruitReward="recruit_reward",e.Payment="payment",e.Cancellation="cancellation",e.Refund="refund",e.Adjustment="adjustment",e.WelcomeBonuses="welcome_bonuses",e.PromotionReward="promotion_reward",e.External="external",e))(A||{}),C=(e=>(e.Delivery="delivery",e.Pickup="pickup",e.OnPremise="on_premise",e))(C||{}),G=(e=>(e.Payment="payment",e.Refund="refund",e))(G||{}),$=(e=>(e.Cash="cash",e.CreditCard="credit-card",e.CloudPayments="cloudpayments",e.CardToken="card_token",e.Bonuses="bonuses",e))($||{}),_=(e=>(e.Pending="pending",e.Confirmed="confirmed",e.Cancelled="cancelled",e.PendingRefund="pending_refund",e.Refunding="refunding",e.Refunded="refunded",e))(_||{}),D=(e=>(e.Auth="auth",e.Charge="charge",e))(D||{}),j=(e=>(e.PersonsCount="persons_count",e.DeliveryTime="delivery_time",e))(j||{}),z=(e=>(e.PriceMismatch="price_mismatch",e.OutOfStock="out_of_stock",e.Unavailable="unavailable",e))(z||{}),V=(e=>(e.None="none",e.Cleanup="cleanup",e))(V||{}),F=(e=>(e.Piece="piece",e.Gram="gram",e.Kilogram="kilogram",e.Meter="meter",e))(F||{}),I=(e=>(e.Weight="weight",e.Width="width",e.Height="height",e.Length="length",e))(I||{}),M=(e=>(e.Netto="netto",e.Brutto="brutto",e))(M||{}),Z=(e=>(e.Color="color",e))(Z||{}),L=(e=>(e.Category="category",e.Group="group",e.VariantOption="variant_option",e.VariantOptionValue="variant_option_value",e))(L||{}),N=(e=>(e.Amount="amount",e.Percentage="percentage",e))(N||{}),W=(e=>(e.Email="email",e.Website="website",e.Vk="vk",e.Facebook="facebook",e.Instagram="instagram",e.Twitter="twitter",e.Ok="ok",e.Tiktok="tiktok",e))(W||{}),J=(e=>(e.Yes="yes",e.No="no",e.Both="both",e))(J||{}),X=(e=>(e.Disabled="disabled",e.Preauth="preauth",e.Confirmation="confirmation",e))(X||{}),B=(e=>(e.Dadata="dadata",e.Manual="manual",e))(B||{}),H=(e=>(e.Registration="registration",e.ResendRegistrationCode="resend_registration_code",e.ResetPassword="reset_password",e.OrderSubmission="order_submission",e.FeedbackRequest="feedback_request",e.CallbackRequest="callback_request",e))(H||{});n.AcquiringType=v,n.AddressSuggestionsProvider=c,n.AddressesProvider=B,n.ArticlesResource=w,n.BonusesTransactionReason=A,n.BonusesTransactionStatus=E,n.BonusesTransactionType=b,n.CategoriesResource=p,n.CloudpaymentsChargeType=D,n.CollectionsResource=m,n.ContactType=W,n.DeliveryMethod=C,n.Dimension=I,n.DimensionType=M,n.DiscountType=N,n.FeatureRange=T,n.FeatureType=P,n.FeedbackResource=f,n.Gender=S,n.OffersResource=y,n.OrderAuthenticationMethod=X,n.OrderCartCheckerResultAction=V,n.OrderCartCheckerResultReason=z,n.OrderOptionKind=j,n.OrderPaymentTransactionStatus=_,n.OrderPaymentTransactionType=G,n.OrdersResource=U,n.PaymentMethod=$,n.PaymentSystemType=q,n.ProductContextType=L,n.ProductsResource=O,n.RecaptchaAction=H,n.StoreResource=R,n.TernaryFilter=J,n.UnitType=F,n.VariantOptionType=Z,n.ZenkyError=h,n.ZenkyErrorBuilder=k,n.ZenkyStorefront=x,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenky/storefront-api",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "Zenky Storefront API SDK",
5
5
  "author": "Timur Zurbaev <hello@zurbaev.ru>",
6
6
  "license": "MIT",