@ikas/storefront 0.1.12 → 0.1.14

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.
Files changed (35) hide show
  1. package/build/__generated__/global-types.d.ts +1 -0
  2. package/build/api/cart/__generated__/getCart.d.ts +2 -2
  3. package/build/api/cart/__generated__/saveItemToCart.d.ts +2 -2
  4. package/build/api/checkout/__generated__/getCheckoutById.d.ts +10 -2
  5. package/build/api/checkout/__generated__/getOrder.d.ts +2 -2
  6. package/build/api/customer/__generated__/createOrderRefundRequest.d.ts +2 -2
  7. package/build/api/customer/__generated__/getCustomerOrders.d.ts +2 -2
  8. package/build/components/checkout/components/cart-summary/cart-item/index.d.ts +2 -0
  9. package/build/components/checkout/components/{cart-summary → svg}/arrow-down.d.ts +0 -0
  10. package/build/components/checkout/components/{arrow-left.d.ts → svg/arrow-left.d.ts} +0 -0
  11. package/build/components/checkout/components/{cart-summary → svg}/arrow-right.d.ts +0 -0
  12. package/build/components/checkout/components/{cart-summary → svg}/cross.d.ts +0 -0
  13. package/build/components/checkout/components/{cross.d.ts → svg/discount.d.ts} +2 -2
  14. package/build/components/checkout/components/{external.d.ts → svg/external.d.ts} +0 -0
  15. package/build/components/checkout/components/{cart-summary → svg}/gift.d.ts +0 -0
  16. package/build/components/checkout/components/{ikas.d.ts → svg/ikas.d.ts} +0 -0
  17. package/build/components/checkout/components/{lock.d.ts → svg/lock.d.ts} +0 -0
  18. package/build/components/checkout/components/{cart-summary → svg}/shopping-cart.d.ts +0 -0
  19. package/build/components/checkout/components/{success-circle.d.ts → svg/success-circle.d.ts} +0 -0
  20. package/build/components/checkout/components/{cart-summary → svg}/tag.d.ts +0 -0
  21. package/build/components/checkout/components/{warning.d.ts → svg/warning.d.ts} +0 -0
  22. package/build/components/checkout/model.d.ts +0 -1
  23. package/build/index.css +22 -0
  24. package/build/index.es.css +22 -0
  25. package/build/index.es.js +214 -2291
  26. package/build/index.js +214 -2299
  27. package/build/models/data/checkout/index.d.ts +4 -2
  28. package/build/models/data/order/index.d.ts +6 -0
  29. package/build/pages/index.d.ts +1 -11
  30. package/package.json +3 -9
  31. package/build/pages/api/getComponentDirs.d.ts +0 -3
  32. package/build/pages/api/getTheme.d.ts +0 -3
  33. package/build/pages/api/middleware.d.ts +0 -3
  34. package/build/pages/api/updateTheme.d.ts +0 -9
  35. package/build/pages/api/uploadTheme.d.ts +0 -3
package/build/index.js CHANGED
@@ -15,14 +15,6 @@ var NextImage = require('next/image');
15
15
  var Link = require('next/link');
16
16
  var dynamic = require('next/dynamic');
17
17
  var Error$1 = require('next/error');
18
- var Cors = require('cors');
19
- var archiver = require('archiver');
20
- var Stream = require('stream');
21
- var http = require('http');
22
- var Url = require('url');
23
- var https = require('https');
24
- var zlib = require('zlib');
25
- var axios = require('axios');
26
18
 
27
19
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
28
20
 
@@ -36,14 +28,6 @@ var NextImage__default = /*#__PURE__*/_interopDefaultLegacy(NextImage);
36
28
  var Link__default = /*#__PURE__*/_interopDefaultLegacy(Link);
37
29
  var dynamic__default = /*#__PURE__*/_interopDefaultLegacy(dynamic);
38
30
  var Error__default = /*#__PURE__*/_interopDefaultLegacy(Error$1);
39
- var Cors__default = /*#__PURE__*/_interopDefaultLegacy(Cors);
40
- var archiver__default = /*#__PURE__*/_interopDefaultLegacy(archiver);
41
- var Stream__default = /*#__PURE__*/_interopDefaultLegacy(Stream);
42
- var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
43
- var Url__default = /*#__PURE__*/_interopDefaultLegacy(Url);
44
- var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
45
- var zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib);
46
- var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
47
31
 
48
32
  /*! *****************************************************************************
49
33
  Copyright (c) Microsoft Corporation.
@@ -19985,7 +19969,9 @@ var IkasCheckout = /** @class */ (function () {
19985
19969
  this.shippingSettingsId = data.shippingSettingsId;
19986
19970
  this.shippingZoneRateId = data.shippingZoneRateId;
19987
19971
  this.availableShippingMethods = data.availableShippingMethods || [];
19988
- this.customer = data.customer;
19972
+ this.customer = data.customer
19973
+ ? new IkasCheckoutCustomer(data.customer)
19974
+ : null;
19989
19975
  this.billingAddress = data.billingAddress
19990
19976
  ? new IkasOrderAddress(data.billingAddress)
19991
19977
  : null;
@@ -20018,19 +20004,6 @@ var IkasCheckout = /** @class */ (function () {
20018
20004
  get: function () {
20019
20005
  var _a;
20020
20006
  return ((_a = this.cart) === null || _a === void 0 ? void 0 : _a.totalTax) || 0;
20021
- // const cartTotalTax =
20022
- // this.cart?.items.reduce((total, current) => total + current.tax, 0) || 0;
20023
- // const shippingTotalTax =
20024
- // this.shippingLines?.reduce(
20025
- // (total, current) => total + (current.taxValue || 0),
20026
- // 0
20027
- // ) || 0;
20028
- // const giftTotalTax =
20029
- // this.giftPackageLines?.reduce(
20030
- // (total, current) => total + (current.taxValue || 0),
20031
- // 0
20032
- // ) || 0;
20033
- // return cartTotalTax;
20034
20007
  },
20035
20008
  enumerable: false,
20036
20009
  configurable: true
@@ -20080,7 +20053,6 @@ var IkasCheckout = /** @class */ (function () {
20080
20053
  var newDate = new Date();
20081
20054
  newDate.setTime(parseFloat(this.updatedAt));
20082
20055
  return formatDate(newDate);
20083
- // return newDate.toLocaleString("en-GB");
20084
20056
  },
20085
20057
  enumerable: false,
20086
20058
  configurable: true
@@ -20119,6 +20091,17 @@ var IkasCheckout = /** @class */ (function () {
20119
20091
  });
20120
20092
  return IkasCheckout;
20121
20093
  }());
20094
+ var IkasCheckoutCustomer = /** @class */ (function () {
20095
+ function IkasCheckoutCustomer(data) {
20096
+ this.id = data.id || "";
20097
+ this.email = data.email || "";
20098
+ this.firstName = data.firstName || "";
20099
+ this.lastName = data.lastName || "";
20100
+ this.notificationsAccepted = data.notificationsAccepted || false;
20101
+ mobx.makeAutoObservable(this);
20102
+ }
20103
+ return IkasCheckoutCustomer;
20104
+ }());
20122
20105
  (function (IkasShippingMethod) {
20123
20106
  IkasShippingMethod["CLICK_AND_COLLECT"] = "CLICK_AND_COLLECT";
20124
20107
  IkasShippingMethod["NO_SHIPMENT"] = "NO_SHIPMENT";
@@ -23495,7 +23478,6 @@ var CheckoutViewModel = /** @class */ (function () {
23495
23478
  this.policyModalTitle = "";
23496
23479
  this.policyModalText = "";
23497
23480
  this.error = null;
23498
- this.customerConsentGranted = false;
23499
23481
  this.init = function () { return __awaiter(_this, void 0, void 0, function () {
23500
23482
  return __generator(this, function (_a) {
23501
23483
  switch (_a.label) {
@@ -23811,10 +23793,10 @@ var CheckoutViewModel = /** @class */ (function () {
23811
23793
  this.createCustomer = function () {
23812
23794
  if (_this.store.customerStore.customer) {
23813
23795
  _this.store.customerStore.customer.addresses.forEach(function (address) { return (address.checkoutSettings = _this.checkoutSettings); });
23814
- _this.checkout.customer = _this.store.customerStore.customer;
23796
+ _this.checkout.customer = new IkasCheckoutCustomer(_this.store.customerStore.customer);
23815
23797
  }
23816
23798
  else if (!_this.checkout.customer)
23817
- _this.checkout.customer = new IkasCustomer({});
23799
+ _this.checkout.customer = new IkasCheckoutCustomer({});
23818
23800
  };
23819
23801
  this.createShippingAddress = function () {
23820
23802
  var _a;
@@ -23935,7 +23917,9 @@ var CheckoutViewModel = /** @class */ (function () {
23935
23917
  var originalValue = value.split(" ").join("");
23936
23918
  if (originalValue.length > MAX_CARD_NUMBER_LENGTH)
23937
23919
  return;
23938
- if (oldOriginalValue.length < 6 && originalValue.length >= 6) {
23920
+ if (oldOriginalValue.length < 6 &&
23921
+ originalValue.length >= 6 &&
23922
+ !_this.installmentInfo) {
23939
23923
  _this.retrieveInstallmentInfo({
23940
23924
  binNumber: originalValue.slice(0, 6),
23941
23925
  paymentGatewayId: _this.checkout.selectedPaymentGateway.id,
@@ -24219,16 +24203,16 @@ var CheckoutViewModel = /** @class */ (function () {
24219
24203
  });
24220
24204
  }); };
24221
24205
  this.onCheckoutTransactionSuccess = function () { return __awaiter(_this, void 0, void 0, function () {
24222
- var _a;
24223
- return __generator(this, function (_b) {
24224
- switch (_b.label) {
24206
+ var _a, _b;
24207
+ return __generator(this, function (_c) {
24208
+ switch (_c.label) {
24225
24209
  case 0:
24226
24210
  localStorage.removeItem(USE_DIFFERENT_ADDRESS_KEY);
24227
- if (!(!this.checkout.hasCustomer && ((_a = this.checkout.customer) === null || _a === void 0 ? void 0 : _a.email))) return [3 /*break*/, 2];
24228
- return [4 /*yield*/, this.store.customerStore.createEmailSubscription(this.checkout.customer.email)];
24211
+ if (!((_a = this.checkout.customer) === null || _a === void 0 ? void 0 : _a.notificationsAccepted)) return [3 /*break*/, 2];
24212
+ return [4 /*yield*/, this.store.customerStore.createEmailSubscription(((_b = this.checkout.customer) === null || _b === void 0 ? void 0 : _b.email) || "")];
24229
24213
  case 1:
24230
- _b.sent();
24231
- _b.label = 2;
24214
+ _c.sent();
24215
+ _c.label = 2;
24232
24216
  case 2:
24233
24217
  this.changeStep(CheckoutStep.SUCCESS);
24234
24218
  return [2 /*return*/];
@@ -24242,7 +24226,8 @@ var CheckoutViewModel = /** @class */ (function () {
24242
24226
  _this.changeStep(CheckoutStep.SHIPPING);
24243
24227
  };
24244
24228
  this.setCustomerConsentGranted = function (value) {
24245
- _this.customerConsentGranted = value;
24229
+ if (_this.checkout.customer)
24230
+ _this.checkout.customer.notificationsAccepted = value;
24246
24231
  };
24247
24232
  this.setUseDifferentAddress = function (value) {
24248
24233
  _this.useDifferentAddress = value;
@@ -33735,9 +33720,6 @@ var IkasCustomerStore = /** @class */ (function () {
33735
33720
  orders = _a.sent();
33736
33721
  if (!Array.isArray(orders) || !orders.length)
33737
33722
  return [2 /*return*/, null];
33738
- return [4 /*yield*/, this.getOrderRefundSettings()];
33739
- case 2:
33740
- _a.sent();
33741
33723
  order = orders[0];
33742
33724
  //@ts-ignore
33743
33725
  order._refundSettings = this._refundSettings;
@@ -33949,6 +33931,9 @@ var IkasCustomerStore = /** @class */ (function () {
33949
33931
  _a.sent();
33950
33932
  return [4 /*yield*/, this.getCustomer()];
33951
33933
  case 2:
33934
+ _a.sent();
33935
+ return [4 /*yield*/, this.getOrderRefundSettings()];
33936
+ case 3:
33952
33937
  _a.sent();
33953
33938
  this._initialized = true;
33954
33939
  if (this.customer)
@@ -34242,7 +34227,8 @@ var IkasOrder = /** @class */ (function () {
34242
34227
  Object.defineProperty(IkasOrder.prototype, "refundableItems", {
34243
34228
  get: function () {
34244
34229
  var _this = this;
34245
- if (this._refundSettings && !this._refundSettings.isActiveRefundSection)
34230
+ if (!this._refundSettings ||
34231
+ (this._refundSettings && !this._refundSettings.isActiveRefundSection))
34246
34232
  return [];
34247
34233
  return this.orderLineItems.filter(function (item) {
34248
34234
  var _a;
@@ -41310,7 +41296,7 @@ var IkasCheckoutAPI = /** @class */ (function () {
41310
41296
  return __generator(this, function (_b) {
41311
41297
  switch (_b.label) {
41312
41298
  case 0:
41313
- QUERY = src(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n query getCheckoutById($id: String!) {\n getCheckoutById(id: $id) {\n totalFinalPrice\n note\n availableShippingMethods {\n price\n rateName\n shippingMethod\n shippingSettingsId\n shippingZoneRateId\n }\n billingAddress {\n id\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n code\n id\n name\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n code\n id\n name\n }\n taxNumber\n taxOffice\n }\n cartId\n couponCode\n createdAt\n customer {\n email\n firstName\n id\n lastName\n }\n deleted\n id\n merchantId\n orderId\n orderNumber\n recoverEmailStatus\n recoveryStatus\n shippingAddress {\n id\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n id\n code\n name\n }\n district {\n name\n id\n code\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n }\n shippingLines {\n title\n taxValue\n price\n shippingSettingsId\n shippingZoneRateId\n }\n shippingMethod\n shippingSettingsId\n shippingZoneRateId\n status\n updatedAt\n cart {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n taxLines {\n price\n rate\n }\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n slug\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n adjustments {\n amount\n amountType\n name\n order\n type\n couponId\n }\n giftPackageLines {\n price\n taxValue\n }\n isGiftPackage\n giftPackageNote\n }\n }\n "], ["\n query getCheckoutById($id: String!) {\n getCheckoutById(id: $id) {\n totalFinalPrice\n note\n availableShippingMethods {\n price\n rateName\n shippingMethod\n shippingSettingsId\n shippingZoneRateId\n }\n billingAddress {\n id\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n code\n id\n name\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n code\n id\n name\n }\n taxNumber\n taxOffice\n }\n cartId\n couponCode\n createdAt\n customer {\n email\n firstName\n id\n lastName\n }\n deleted\n id\n merchantId\n orderId\n orderNumber\n recoverEmailStatus\n recoveryStatus\n shippingAddress {\n id\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n id\n code\n name\n }\n district {\n name\n id\n code\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n }\n shippingLines {\n title\n taxValue\n price\n shippingSettingsId\n shippingZoneRateId\n }\n shippingMethod\n shippingSettingsId\n shippingZoneRateId\n status\n updatedAt\n cart {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n taxLines {\n price\n rate\n }\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n slug\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n adjustments {\n amount\n amountType\n name\n order\n type\n couponId\n }\n giftPackageLines {\n price\n taxValue\n }\n isGiftPackage\n giftPackageNote\n }\n }\n "])));
41299
+ QUERY = src(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n query getCheckoutById($id: String!) {\n getCheckoutById(id: $id) {\n totalFinalPrice\n note\n availableShippingMethods {\n price\n rateName\n shippingMethod\n shippingSettingsId\n shippingZoneRateId\n }\n billingAddress {\n id\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n code\n id\n name\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n code\n id\n name\n }\n taxNumber\n taxOffice\n }\n cartId\n couponCode\n createdAt\n customer {\n email\n firstName\n id\n lastName\n notificationsAccepted\n }\n deleted\n id\n merchantId\n orderId\n orderNumber\n recoverEmailStatus\n recoveryStatus\n shippingAddress {\n id\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n id\n code\n name\n }\n district {\n name\n id\n code\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n }\n shippingLines {\n title\n taxValue\n price\n shippingSettingsId\n shippingZoneRateId\n }\n shippingMethod\n shippingSettingsId\n shippingZoneRateId\n status\n updatedAt\n cart {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n taxLines {\n price\n rate\n }\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n slug\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n adjustments {\n amount\n amountType\n name\n order\n type\n couponId\n appliedOrderLines {\n amount\n appliedQuantity\n orderLineId\n }\n }\n giftPackageLines {\n price\n taxValue\n }\n isGiftPackage\n giftPackageNote\n }\n }\n "], ["\n query getCheckoutById($id: String!) {\n getCheckoutById(id: $id) {\n totalFinalPrice\n note\n availableShippingMethods {\n price\n rateName\n shippingMethod\n shippingSettingsId\n shippingZoneRateId\n }\n billingAddress {\n id\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n code\n id\n name\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n code\n id\n name\n }\n taxNumber\n taxOffice\n }\n cartId\n couponCode\n createdAt\n customer {\n email\n firstName\n id\n lastName\n notificationsAccepted\n }\n deleted\n id\n merchantId\n orderId\n orderNumber\n recoverEmailStatus\n recoveryStatus\n shippingAddress {\n id\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n id\n code\n name\n }\n district {\n name\n id\n code\n }\n firstName\n identityNumber\n isDefault\n lastName\n phone\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n }\n shippingLines {\n title\n taxValue\n price\n shippingSettingsId\n shippingZoneRateId\n }\n shippingMethod\n shippingSettingsId\n shippingZoneRateId\n status\n updatedAt\n cart {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n taxLines {\n price\n rate\n }\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n slug\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n adjustments {\n amount\n amountType\n name\n order\n type\n couponId\n appliedOrderLines {\n amount\n appliedQuantity\n orderLineId\n }\n }\n giftPackageLines {\n price\n taxValue\n }\n isGiftPackage\n giftPackageNote\n }\n }\n "])));
41314
41300
  _b.label = 1;
41315
41301
  case 1:
41316
41302
  _b.trys.push([1, 3, , 4]);
@@ -41440,6 +41426,7 @@ var IkasCheckoutAPI = /** @class */ (function () {
41440
41426
  email: (_b = checkout.customer) === null || _b === void 0 ? void 0 : _b.email,
41441
41427
  firstName: (_c = checkout.customer) === null || _c === void 0 ? void 0 : _c.firstName,
41442
41428
  lastName: (_d = checkout.customer) === null || _d === void 0 ? void 0 : _d.lastName,
41429
+ notificationsAccepted: checkout.customer.notificationsAccepted || false,
41443
41430
  }
41444
41431
  : null,
41445
41432
  note: checkout.note,
@@ -68814,6 +68801,8 @@ var AddressFormViewModel = /** @class */ (function () {
68814
68801
  _a.districts = _d.sent();
68815
68802
  if (this.districts.length)
68816
68803
  this.address.isDistrictRequired = true;
68804
+ else
68805
+ this.address.isDistrictRequired = false;
68817
68806
  return [3 /*break*/, 4];
68818
68807
  case 3:
68819
68808
  _d.sent();
@@ -69397,7 +69386,7 @@ var SaveAddressCheckboxAndTitle = mobxReactLite.observer(function (_a) {
69397
69386
  });
69398
69387
 
69399
69388
  var CheckoutStepInfo = function (_a) {
69400
- var _b, _c;
69389
+ var _b, _c, _d;
69401
69390
  var vm = _a.vm;
69402
69391
  var t = useTranslation().t;
69403
69392
  var onEmailChange = React.useCallback(function (value) {
@@ -69412,7 +69401,7 @@ var CheckoutStepInfo = function (_a) {
69412
69401
  React.createElement("div", { className: commonStyles.FormSectionTitle },
69413
69402
  React.createElement("div", { className: commonStyles.Title }, t("checkout-page:contactInfo"))),
69414
69403
  React.createElement(FormItem, { type: FormItemType.TEXT, inputType: FormItemInputType.EMAIL, label: t("checkout-page:email"), autocomplete: "email", value: ((_b = vm.checkout.customer) === null || _b === void 0 ? void 0 : _b.email) || "", onChange: onEmailChange, hasError: vm.isErrorsVisible && !((_c = vm.checkout.customer) === null || _c === void 0 ? void 0 : _c.email), errorText: t("checkout-page:emailError"), tooltipText: t("checkout-page:guestEmailTooltip") }),
69415
- React.createElement(Checkbox, { value: vm.customerConsentGranted, label: t("checkout-page:customerConsentCta"), onChange: vm.setCustomerConsentGranted }))),
69404
+ React.createElement(Checkbox, { value: ((_d = vm.checkout.customer) === null || _d === void 0 ? void 0 : _d.notificationsAccepted) || false, label: t("checkout-page:customerConsentCta"), onChange: vm.setCustomerConsentGranted }))),
69416
69405
  React.createElement(CustomerAddresses$1, { vm: customerAddressesViewModel }),
69417
69406
  !customerAddressesViewModel.editingCustomerAddress && (React.createElement(Button, { style: {
69418
69407
  width: "100%",
@@ -69704,15 +69693,28 @@ var InputWithButton = function (_a) {
69704
69693
  };
69705
69694
  var InputWithButton$1 = mobxReactLite.observer(InputWithButton);
69706
69695
 
69707
- var styles$e = {"CheckoutItem":"style-module_CheckoutItem__2JjSt","ImageContainer":"style-module_ImageContainer__2K2RG","Image":"style-module_Image__w2Q_P","Right":"style-module_Right__2HN2l","Name":"style-module_Name__nPgw1","LightText":"style-module_LightText__2P69D","Price":"style-module_Price__1Vw31","GrayPrice":"style-module_GrayPrice__2wDyJ"};
69696
+ var styles$e = {"CheckoutItem":"style-module_CheckoutItem__2JjSt","ImageContainer":"style-module_ImageContainer__2K2RG","Image":"style-module_Image__w2Q_P","Right":"style-module_Right__2HN2l","Name":"style-module_Name__nPgw1","LightText":"style-module_LightText__2P69D","Price":"style-module_Price__1Vw31","GrayPrice":"style-module_GrayPrice__2wDyJ","DiscountIcon":"style-module_DiscountIcon__39hOP","DiscountTooltip":"style-module_DiscountTooltip__2hO7z","DiscountAdjustment":"style-module_DiscountAdjustment__3QUlC"};
69697
+
69698
+ var SVGDiscount = function (_a) {
69699
+ var className = _a.className;
69700
+ return (React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className },
69701
+ React.createElement("circle", { cx: "8", cy: "8", r: "8", fill: "#CFCED3" }),
69702
+ React.createElement("path", { d: "M10.9167 5.08301L5.08334 10.9163", stroke: "white", "stroke-linecap": "square", "stroke-linejoin": "round" }),
69703
+ React.createElement("path", { d: "M5.70832 6.75033C6.28362 6.75033 6.74999 6.28396 6.74999 5.70866C6.74999 5.13336 6.28362 4.66699 5.70832 4.66699C5.13303 4.66699 4.66666 5.13336 4.66666 5.70866C4.66666 6.28396 5.13303 6.75033 5.70832 6.75033Z", fill: "white" }),
69704
+ React.createElement("path", { d: "M10.2917 11.3333C10.867 11.3333 11.3333 10.867 11.3333 10.2917C11.3333 9.71637 10.867 9.25 10.2917 9.25C9.71637 9.25 9.25 9.71637 9.25 10.2917C9.25 10.867 9.71637 11.3333 10.2917 11.3333Z", fill: "white" })));
69705
+ };
69708
69706
 
69709
69707
  var CartItem = mobxReactLite.observer(function (_a) {
69710
- var _b;
69711
- var currencyCode = _a.currencyCode, cartItem = _a.cartItem;
69708
+ var _b, _c;
69709
+ var vm = _a.vm, currencyCode = _a.currencyCode, cartItem = _a.cartItem;
69712
69710
  var t = useTranslation().t;
69711
+ var adjustments = (_b = vm.checkout.adjustments) === null || _b === void 0 ? void 0 : _b.filter(function (a) {
69712
+ return a.appliedOrderLines &&
69713
+ a.appliedOrderLines.some(function (aol) { return aol.orderLineId === cartItem.id; });
69714
+ });
69713
69715
  return (React.createElement("div", { className: styles$e.CheckoutItem },
69714
69716
  React.createElement("div", { className: styles$e.ImageContainer },
69715
- React.createElement("img", { className: styles$e.Image, src: (_b = cartItem.variant.mainImage) === null || _b === void 0 ? void 0 : _b.thumbnailSrc })),
69717
+ React.createElement("img", { className: styles$e.Image, src: (_c = cartItem.variant.mainImage) === null || _c === void 0 ? void 0 : _c.thumbnailSrc })),
69716
69718
  React.createElement("div", { className: styles$e.Right },
69717
69719
  React.createElement("div", { className: styles$e.Name }, cartItem.variant.name),
69718
69720
  React.createElement("div", { className: styles$e.LightText }, t("checkout-page:quantity") + ": " + cartItem.quantity),
@@ -69721,7 +69723,10 @@ var CartItem = mobxReactLite.observer(function (_a) {
69721
69723
  .join(" / ")),
69722
69724
  React.createElement("div", { className: styles$e.Price },
69723
69725
  !!cartItem.overridenPriceWithQuantity && (React.createElement("span", { className: styles$e.GrayPrice }, formatMoney(cartItem.overridenPriceWithQuantity, currencyCode))),
69724
- formatMoney(cartItem.finalPriceWithQuantity, currencyCode)))));
69726
+ formatMoney(cartItem.finalPriceWithQuantity, currencyCode),
69727
+ !!(adjustments === null || adjustments === void 0 ? void 0 : adjustments.length) && (React.createElement("div", { className: styles$e.DiscountIcon, tabIndex: Date.now() },
69728
+ React.createElement(SVGDiscount, null),
69729
+ React.createElement("div", { className: styles$e.DiscountTooltip }, adjustments === null || adjustments === void 0 ? void 0 : adjustments.map(function (adjustment, index) { return (React.createElement("div", { key: index }, adjustment.name + " (-" + formatMoney(adjustment.amount, currencyCode) + ")")); }))))))));
69725
69730
  });
69726
69731
 
69727
69732
  var styles$f = {"TooltipContainer":"style-module_TooltipContainer__1IW8v","Tooltip":"style-module_Tooltip__1Pxw6","TooltipArrow":"style-module_TooltipArrow__1l6q_","Top":"style-module_Top__1_7C6","Bottom":"style-module_Bottom__2qCpQ","Left":"style-module_Left__1T6gj","Right":"style-module_Right__uCMMF"};
@@ -69821,7 +69826,7 @@ var CartSummary = mobxReactLite.observer(function (_a) {
69821
69826
  React.createElement("div", { className: styles$g.DetailsContainer, style: detailsContainerStyle },
69822
69827
  React.createElement("div", { className: styles$g.Details, ref: setDetailsContainer }, cart === null || cart === void 0 ? void 0 :
69823
69828
  cart.items.map(function (item, index) { return (React.createElement("div", { key: index },
69824
- React.createElement(CartItem, { cartItem: item, currencyCode: cart.currencyCode }))); }),
69829
+ React.createElement(CartItem, { vm: vm, cartItem: item, currencyCode: cart.currencyCode }))); }),
69825
69830
  React.createElement("div", { className: styles$g.Divider }),
69826
69831
  React.createElement("div", { className: styles$g.SubTotalInfo },
69827
69832
  hasCouponError && (React.createElement("div", { className: styles$g.NotificationContainer },
@@ -70010,13 +70015,6 @@ var ExpandableSection = function (_a) {
70010
70015
  };
70011
70016
  var ExpandableSection$1 = mobxReactLite.observer(ExpandableSection);
70012
70017
 
70013
- var SVGCross$1 = function (_a) {
70014
- var className = _a.className;
70015
- return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "24", height: "24", className: className },
70016
- React.createElement("path", { fill: "none", d: "M0 0h24v24H0z" }),
70017
- React.createElement("path", { fill: "currentColor", d: "M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z" })));
70018
- };
70019
-
70020
70018
  var styles$j = {"ModalContainer":"style-module_ModalContainer__3JCG6","Modal":"style-module_Modal__s3oha","ModalHeader":"style-module_ModalHeader__vEeDs","CloseButton":"style-module_CloseButton__3VdYY","ModalContent":"style-module_ModalContent__2jGi3"};
70021
70019
 
70022
70020
  var Modal = mobxReactLite.observer(function (_a) {
@@ -70037,7 +70035,7 @@ var Modal = mobxReactLite.observer(function (_a) {
70037
70035
  React.createElement("div", { className: styles$j.ModalHeader },
70038
70036
  React.createElement("div", null, title),
70039
70037
  React.createElement("div", { className: styles$j.CloseButton, onClick: onClose },
70040
- React.createElement(SVGCross$1, null))),
70038
+ React.createElement(SVGCross, null))),
70041
70039
  typeof modalContent === "string" ? (React.createElement("div", { className: styles$j.ModalContent, dangerouslySetInnerHTML: { __html: modalContent } })) : (React.createElement("div", { className: styles$j.ModalContent }, modalContent)))));
70042
70040
  });
70043
70041
 
@@ -70379,7 +70377,7 @@ var StockError = mobxReactLite.observer(function (_a) {
70379
70377
  data.map(function (item, index) {
70380
70378
  var _a;
70381
70379
  return (React.createElement("div", { key: index },
70382
- React.createElement(CartItem, { cartItem: item, currencyCode: ((_a = vm.checkout.cart) === null || _a === void 0 ? void 0 : _a.currencyCode) || "" })));
70380
+ React.createElement(CartItem, { vm: vm, cartItem: item, currencyCode: ((_a = vm.checkout.cart) === null || _a === void 0 ? void 0 : _a.currencyCode) || "" })));
70383
70381
  }),
70384
70382
  React.createElement("div", { className: styles$l.Actions },
70385
70383
  React.createElement(Button, { style: {
@@ -71568,1797 +71566,170 @@ var _slug_$3 = /*#__PURE__*/Object.freeze({
71568
71566
  getStaticProps: getStaticProps$h
71569
71567
  });
71570
71568
 
71571
- var cors = Cors__default['default']();
71572
- function runMiddleware(req, res, fn) {
71573
- return new Promise(function (resolve, reject) {
71574
- fn(req, res, function (result) {
71575
- if (result instanceof Error) {
71576
- return reject(result);
71577
- }
71578
- return resolve(result);
71579
- });
71580
- });
71581
- }
71582
- function corsMiddleware(req, res) {
71583
- return runMiddleware(req, res, cors);
71584
- }
71585
-
71586
- var serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
71587
- var componentsPath = path__default['default'].join(serverRuntimeConfig.PROJECT_ROOT, "src", "components");
71588
- var getComponentDirs = function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
71589
- var componentDirNames;
71590
- return __generator(this, function (_a) {
71591
- switch (_a.label) {
71592
- case 0: return [4 /*yield*/, corsMiddleware(req, res)];
71593
- case 1:
71594
- _a.sent();
71595
- return [4 /*yield*/, getComponentDirNames()];
71596
- case 2:
71597
- componentDirNames = _a.sent();
71598
- res.statusCode = 200;
71599
- res.setHeader("Content-Type", "application/json");
71600
- res.json({
71601
- componentDirNames: componentDirNames.filter(function (name) { return name !== "__generated__"; }),
71602
- });
71603
- return [2 /*return*/];
71604
- }
71605
- });
71606
- }); };
71607
- var config = {};
71608
- function getComponentDirNames() {
71609
- return new Promise(function (resolve, reject) {
71610
- fs__default['default'].readdir(componentsPath, function (err, files) {
71611
- if (err) {
71612
- return reject(err);
71613
- }
71614
- resolve(files.filter(function (file) {
71615
- return fs__default['default'].lstatSync(path__default['default'].join(componentsPath, file)).isDirectory();
71616
- }));
71617
- });
71618
- });
71619
- }
71620
-
71621
- var GetComponentDirs = /*#__PURE__*/Object.freeze({
71622
- __proto__: null,
71623
- getComponentDirs: getComponentDirs,
71624
- config: config
71625
- });
71626
-
71627
- var getTheme = function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
71628
- var theme;
71629
- return __generator(this, function (_a) {
71630
- switch (_a.label) {
71631
- case 0: return [4 /*yield*/, corsMiddleware(req, res)];
71632
- case 1:
71633
- _a.sent();
71634
- return [4 /*yield*/, _getTheme()];
71635
- case 2:
71636
- theme = _a.sent();
71637
- res.statusCode = 200;
71638
- res.setHeader("Content-Type", "application/json");
71639
- res.json({
71640
- theme: theme,
71641
- });
71642
- return [2 /*return*/];
71643
- }
71644
- });
71645
- }); };
71646
- var config$1 = {};
71647
- function _getTheme() {
71648
- return new Promise(function (resolve, reject) {
71649
- var serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
71650
- var themePath = path__default['default'].join(serverRuntimeConfig.PROJECT_ROOT, "src", "theme.json");
71651
- fs__default['default'].readFile(themePath, {
71652
- flag: "a+",
71653
- }, function (err, file) {
71654
- if (err) {
71655
- return reject(err);
71656
- }
71657
- var result = file.length ? JSON.parse(file.toString()) : {};
71658
- resolve(result);
71659
- });
71660
- });
71661
- }
71662
-
71663
- var GetTheme = /*#__PURE__*/Object.freeze({
71664
- __proto__: null,
71665
- getTheme: getTheme,
71666
- config: config$1
71667
- });
71668
-
71669
- var serverRuntimeConfig$1 = getConfig__default['default']().serverRuntimeConfig;
71670
- var updateTheme = function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
71671
- var theme;
71672
- return __generator(this, function (_a) {
71673
- switch (_a.label) {
71674
- case 0: return [4 /*yield*/, corsMiddleware(req, res)];
71675
- case 1:
71676
- _a.sent();
71677
- theme = req.body;
71678
- fs__default['default'].writeFileSync(path__default['default'].join(serverRuntimeConfig$1.PROJECT_ROOT, "src", "theme.json"), JSON.stringify(theme, null, 2));
71679
- saveCssFile(theme);
71680
- saveComponentsFile(theme);
71681
- res.statusCode = 200;
71682
- res.setHeader("Content-Type", "application/json");
71683
- res.end();
71684
- return [2 /*return*/];
71685
- }
71686
- });
71687
- }); };
71688
- var config$2 = {
71689
- api: {
71690
- bodyParser: {
71691
- sizeLimit: "50mb",
71692
- },
71693
- },
71694
- };
71695
- function saveCssFile(theme) {
71696
- var themeCss = ":root { \r\n";
71697
- theme.settings.colors.map(function (sc) { return (themeCss += sc.key + ": " + sc.color + "; \r\n"); });
71698
- themeCss += " }";
71699
- var generatedFolderPath = path__default['default'].join(serverRuntimeConfig$1.PROJECT_ROOT, "src/styles");
71700
- if (!fs__default['default'].existsSync(generatedFolderPath)) {
71701
- fs__default['default'].mkdirSync(generatedFolderPath);
71702
- }
71703
- fs__default['default'].writeFileSync(path__default['default'].join(generatedFolderPath, "ikas-styles.css"), themeCss);
71704
- }
71705
- function saveComponentsFile(theme) {
71706
- var fileStr = "";
71707
- fileStr += "\r\n";
71708
- var components = theme.components.filter(function (tc) { return tc.id !== "checkout"; });
71709
- // Component imports
71710
- components
71711
- .filter(function (c) { return c.id !== "checkout"; })
71712
- .forEach(function (component, index) {
71713
- fileStr += "import Component" + index + " from \"../" + component.dir + "\" \r\n";
71714
- });
71715
- fileStr += "\r\n";
71716
- fileStr += "\nconst Components = {\n " + components.map(function (component, index) { return "\"" + component.id + "\": Component" + index; }) + "\n};\n ";
71717
- fileStr += "\r\n";
71718
- fileStr += "\r\n";
71719
- fileStr += "export default Components;";
71720
- var generatedFolderPath = path__default['default'].join(serverRuntimeConfig$1.PROJECT_ROOT, "src", "components", "__generated__");
71721
- if (!fs__default['default'].existsSync(generatedFolderPath)) {
71722
- fs__default['default'].mkdirSync(generatedFolderPath);
71723
- }
71724
- fs__default['default'].writeFileSync(path__default['default'].join(generatedFolderPath, "index.js"), fileStr);
71725
- }
71726
-
71727
- var UpdateTheme = /*#__PURE__*/Object.freeze({
71728
- __proto__: null,
71729
- updateTheme: updateTheme,
71730
- config: config$2
71731
- });
71732
-
71733
- // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js
71734
-
71735
- // fix for "Readable" isn't a named export issue
71736
- const Readable = Stream__default['default'].Readable;
71737
-
71738
- const BUFFER = Symbol('buffer');
71739
- const TYPE = Symbol('type');
71740
-
71741
- class Blob {
71742
- constructor() {
71743
- this[TYPE] = '';
71744
-
71745
- const blobParts = arguments[0];
71746
- const options = arguments[1];
71747
-
71748
- const buffers = [];
71749
- let size = 0;
71750
-
71751
- if (blobParts) {
71752
- const a = blobParts;
71753
- const length = Number(a.length);
71754
- for (let i = 0; i < length; i++) {
71755
- const element = a[i];
71756
- let buffer;
71757
- if (element instanceof Buffer) {
71758
- buffer = element;
71759
- } else if (ArrayBuffer.isView(element)) {
71760
- buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);
71761
- } else if (element instanceof ArrayBuffer) {
71762
- buffer = Buffer.from(element);
71763
- } else if (element instanceof Blob) {
71764
- buffer = element[BUFFER];
71765
- } else {
71766
- buffer = Buffer.from(typeof element === 'string' ? element : String(element));
71767
- }
71768
- size += buffer.length;
71769
- buffers.push(buffer);
71770
- }
71771
- }
71772
-
71773
- this[BUFFER] = Buffer.concat(buffers);
71774
-
71775
- let type = options && options.type !== undefined && String(options.type).toLowerCase();
71776
- if (type && !/[^\u0020-\u007E]/.test(type)) {
71777
- this[TYPE] = type;
71778
- }
71779
- }
71780
- get size() {
71781
- return this[BUFFER].length;
71782
- }
71783
- get type() {
71784
- return this[TYPE];
71785
- }
71786
- text() {
71787
- return Promise.resolve(this[BUFFER].toString());
71788
- }
71789
- arrayBuffer() {
71790
- const buf = this[BUFFER];
71791
- const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
71792
- return Promise.resolve(ab);
71793
- }
71794
- stream() {
71795
- const readable = new Readable();
71796
- readable._read = function () {};
71797
- readable.push(this[BUFFER]);
71798
- readable.push(null);
71799
- return readable;
71800
- }
71801
- toString() {
71802
- return '[object Blob]';
71803
- }
71804
- slice() {
71805
- const size = this.size;
71806
-
71807
- const start = arguments[0];
71808
- const end = arguments[1];
71809
- let relativeStart, relativeEnd;
71810
- if (start === undefined) {
71811
- relativeStart = 0;
71812
- } else if (start < 0) {
71813
- relativeStart = Math.max(size + start, 0);
71814
- } else {
71815
- relativeStart = Math.min(start, size);
71816
- }
71817
- if (end === undefined) {
71818
- relativeEnd = size;
71819
- } else if (end < 0) {
71820
- relativeEnd = Math.max(size + end, 0);
71821
- } else {
71822
- relativeEnd = Math.min(end, size);
71823
- }
71824
- const span = Math.max(relativeEnd - relativeStart, 0);
71825
-
71826
- const buffer = this[BUFFER];
71827
- const slicedBuffer = buffer.slice(relativeStart, relativeStart + span);
71828
- const blob = new Blob([], { type: arguments[2] });
71829
- blob[BUFFER] = slicedBuffer;
71830
- return blob;
71831
- }
71832
- }
71833
-
71834
- Object.defineProperties(Blob.prototype, {
71835
- size: { enumerable: true },
71836
- type: { enumerable: true },
71837
- slice: { enumerable: true }
71838
- });
71839
-
71840
- Object.defineProperty(Blob.prototype, Symbol.toStringTag, {
71841
- value: 'Blob',
71842
- writable: false,
71843
- enumerable: false,
71844
- configurable: true
71845
- });
71846
-
71847
- /**
71848
- * fetch-error.js
71849
- *
71850
- * FetchError interface for operational errors
71851
- */
71852
-
71853
- /**
71854
- * Create FetchError instance
71855
- *
71856
- * @param String message Error message for human
71857
- * @param String type Error type for machine
71858
- * @param String systemError For Node.js system error
71859
- * @return FetchError
71860
- */
71861
- function FetchError(message, type, systemError) {
71862
- Error.call(this, message);
71863
-
71864
- this.message = message;
71865
- this.type = type;
71866
-
71867
- // when err.type is `system`, err.code contains system error code
71868
- if (systemError) {
71869
- this.code = this.errno = systemError.code;
71870
- }
71871
-
71872
- // hide custom error implementation details from end-users
71873
- Error.captureStackTrace(this, this.constructor);
71874
- }
71875
-
71876
- FetchError.prototype = Object.create(Error.prototype);
71877
- FetchError.prototype.constructor = FetchError;
71878
- FetchError.prototype.name = 'FetchError';
71879
-
71880
- let convert;
71881
- try {
71882
- convert = require('encoding').convert;
71883
- } catch (e) {}
71884
-
71885
- const INTERNALS = Symbol('Body internals');
71886
-
71887
- // fix an issue where "PassThrough" isn't a named export for node <10
71888
- const PassThrough = Stream__default['default'].PassThrough;
71889
-
71890
- /**
71891
- * Body mixin
71892
- *
71893
- * Ref: https://fetch.spec.whatwg.org/#body
71894
- *
71895
- * @param Stream body Readable stream
71896
- * @param Object opts Response options
71897
- * @return Void
71898
- */
71899
- function Body(body) {
71900
- var _this = this;
71901
-
71902
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
71903
- _ref$size = _ref.size;
71904
-
71905
- let size = _ref$size === undefined ? 0 : _ref$size;
71906
- var _ref$timeout = _ref.timeout;
71907
- let timeout = _ref$timeout === undefined ? 0 : _ref$timeout;
71908
-
71909
- if (body == null) {
71910
- // body is undefined or null
71911
- body = null;
71912
- } else if (isURLSearchParams(body)) {
71913
- // body is a URLSearchParams
71914
- body = Buffer.from(body.toString());
71915
- } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') {
71916
- // body is ArrayBuffer
71917
- body = Buffer.from(body);
71918
- } else if (ArrayBuffer.isView(body)) {
71919
- // body is ArrayBufferView
71920
- body = Buffer.from(body.buffer, body.byteOffset, body.byteLength);
71921
- } else if (body instanceof Stream__default['default']) ; else {
71922
- // none of the above
71923
- // coerce to string then buffer
71924
- body = Buffer.from(String(body));
71925
- }
71926
- this[INTERNALS] = {
71927
- body,
71928
- disturbed: false,
71929
- error: null
71930
- };
71931
- this.size = size;
71932
- this.timeout = timeout;
71933
-
71934
- if (body instanceof Stream__default['default']) {
71935
- body.on('error', function (err) {
71936
- const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err);
71937
- _this[INTERNALS].error = error;
71938
- });
71939
- }
71940
- }
71941
-
71942
- Body.prototype = {
71943
- get body() {
71944
- return this[INTERNALS].body;
71945
- },
71946
-
71947
- get bodyUsed() {
71948
- return this[INTERNALS].disturbed;
71949
- },
71950
-
71951
- /**
71952
- * Decode response as ArrayBuffer
71953
- *
71954
- * @return Promise
71955
- */
71956
- arrayBuffer() {
71957
- return consumeBody.call(this).then(function (buf) {
71958
- return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
71959
- });
71960
- },
71961
-
71962
- /**
71963
- * Return raw response as Blob
71964
- *
71965
- * @return Promise
71966
- */
71967
- blob() {
71968
- let ct = this.headers && this.headers.get('content-type') || '';
71969
- return consumeBody.call(this).then(function (buf) {
71970
- return Object.assign(
71971
- // Prevent copying
71972
- new Blob([], {
71973
- type: ct.toLowerCase()
71974
- }), {
71975
- [BUFFER]: buf
71976
- });
71977
- });
71978
- },
71979
-
71980
- /**
71981
- * Decode response as json
71982
- *
71983
- * @return Promise
71984
- */
71985
- json() {
71986
- var _this2 = this;
71987
-
71988
- return consumeBody.call(this).then(function (buffer) {
71989
- try {
71990
- return JSON.parse(buffer.toString());
71991
- } catch (err) {
71992
- return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));
71993
- }
71994
- });
71995
- },
71996
-
71997
- /**
71998
- * Decode response as text
71999
- *
72000
- * @return Promise
72001
- */
72002
- text() {
72003
- return consumeBody.call(this).then(function (buffer) {
72004
- return buffer.toString();
72005
- });
72006
- },
72007
-
72008
- /**
72009
- * Decode response as buffer (non-spec api)
72010
- *
72011
- * @return Promise
72012
- */
72013
- buffer() {
72014
- return consumeBody.call(this);
72015
- },
72016
-
72017
- /**
72018
- * Decode response as text, while automatically detecting the encoding and
72019
- * trying to decode to UTF-8 (non-spec api)
72020
- *
72021
- * @return Promise
72022
- */
72023
- textConverted() {
72024
- var _this3 = this;
72025
-
72026
- return consumeBody.call(this).then(function (buffer) {
72027
- return convertBody(buffer, _this3.headers);
72028
- });
72029
- }
72030
- };
72031
-
72032
- // In browsers, all properties are enumerable.
72033
- Object.defineProperties(Body.prototype, {
72034
- body: { enumerable: true },
72035
- bodyUsed: { enumerable: true },
72036
- arrayBuffer: { enumerable: true },
72037
- blob: { enumerable: true },
72038
- json: { enumerable: true },
72039
- text: { enumerable: true }
72040
- });
72041
-
72042
- Body.mixIn = function (proto) {
72043
- for (const name of Object.getOwnPropertyNames(Body.prototype)) {
72044
- // istanbul ignore else: future proof
72045
- if (!(name in proto)) {
72046
- const desc = Object.getOwnPropertyDescriptor(Body.prototype, name);
72047
- Object.defineProperty(proto, name, desc);
72048
- }
72049
- }
72050
- };
72051
-
72052
- /**
72053
- * Consume and convert an entire Body to a Buffer.
72054
- *
72055
- * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body
72056
- *
72057
- * @return Promise
72058
- */
72059
- function consumeBody() {
72060
- var _this4 = this;
72061
-
72062
- if (this[INTERNALS].disturbed) {
72063
- return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`));
72064
- }
72065
-
72066
- this[INTERNALS].disturbed = true;
72067
-
72068
- if (this[INTERNALS].error) {
72069
- return Body.Promise.reject(this[INTERNALS].error);
72070
- }
72071
-
72072
- let body = this.body;
72073
-
72074
- // body is null
72075
- if (body === null) {
72076
- return Body.Promise.resolve(Buffer.alloc(0));
72077
- }
72078
-
72079
- // body is blob
72080
- if (isBlob(body)) {
72081
- body = body.stream();
72082
- }
72083
-
72084
- // body is buffer
72085
- if (Buffer.isBuffer(body)) {
72086
- return Body.Promise.resolve(body);
72087
- }
72088
-
72089
- // istanbul ignore if: should never happen
72090
- if (!(body instanceof Stream__default['default'])) {
72091
- return Body.Promise.resolve(Buffer.alloc(0));
72092
- }
72093
-
72094
- // body is stream
72095
- // get ready to actually consume the body
72096
- let accum = [];
72097
- let accumBytes = 0;
72098
- let abort = false;
72099
-
72100
- return new Body.Promise(function (resolve, reject) {
72101
- let resTimeout;
72102
-
72103
- // allow timeout on slow response body
72104
- if (_this4.timeout) {
72105
- resTimeout = setTimeout(function () {
72106
- abort = true;
72107
- reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout'));
72108
- }, _this4.timeout);
72109
- }
72110
-
72111
- // handle stream errors
72112
- body.on('error', function (err) {
72113
- if (err.name === 'AbortError') {
72114
- // if the request was aborted, reject with this Error
72115
- abort = true;
72116
- reject(err);
72117
- } else {
72118
- // other errors, such as incorrect content-encoding
72119
- reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err));
72120
- }
72121
- });
72122
-
72123
- body.on('data', function (chunk) {
72124
- if (abort || chunk === null) {
72125
- return;
72126
- }
72127
-
72128
- if (_this4.size && accumBytes + chunk.length > _this4.size) {
72129
- abort = true;
72130
- reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size'));
72131
- return;
72132
- }
72133
-
72134
- accumBytes += chunk.length;
72135
- accum.push(chunk);
72136
- });
72137
-
72138
- body.on('end', function () {
72139
- if (abort) {
72140
- return;
72141
- }
72142
-
72143
- clearTimeout(resTimeout);
72144
-
72145
- try {
72146
- resolve(Buffer.concat(accum, accumBytes));
72147
- } catch (err) {
72148
- // handle streams that have accumulated too much data (issue #414)
72149
- reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err));
72150
- }
72151
- });
72152
- });
72153
- }
72154
-
72155
- /**
72156
- * Detect buffer encoding and convert to target encoding
72157
- * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding
72158
- *
72159
- * @param Buffer buffer Incoming buffer
72160
- * @param String encoding Target encoding
72161
- * @return String
72162
- */
72163
- function convertBody(buffer, headers) {
72164
- if (typeof convert !== 'function') {
72165
- throw new Error('The package `encoding` must be installed to use the textConverted() function');
72166
- }
72167
-
72168
- const ct = headers.get('content-type');
72169
- let charset = 'utf-8';
72170
- let res, str;
72171
-
72172
- // header
72173
- if (ct) {
72174
- res = /charset=([^;]*)/i.exec(ct);
72175
- }
72176
-
72177
- // no charset in content type, peek at response body for at most 1024 bytes
72178
- str = buffer.slice(0, 1024).toString();
72179
-
72180
- // html5
72181
- if (!res && str) {
72182
- res = /<meta.+?charset=(['"])(.+?)\1/i.exec(str);
72183
- }
72184
-
72185
- // html4
72186
- if (!res && str) {
72187
- res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str);
72188
- if (!res) {
72189
- res = /<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(str);
72190
- if (res) {
72191
- res.pop(); // drop last quote
72192
- }
72193
- }
72194
-
72195
- if (res) {
72196
- res = /charset=(.*)/i.exec(res.pop());
72197
- }
72198
- }
72199
-
72200
- // xml
72201
- if (!res && str) {
72202
- res = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(str);
72203
- }
72204
-
72205
- // found charset
72206
- if (res) {
72207
- charset = res.pop();
72208
-
72209
- // prevent decode issues when sites use incorrect encoding
72210
- // ref: https://hsivonen.fi/encoding-menu/
72211
- if (charset === 'gb2312' || charset === 'gbk') {
72212
- charset = 'gb18030';
72213
- }
72214
- }
72215
-
72216
- // turn raw buffers into a single utf-8 buffer
72217
- return convert(buffer, 'UTF-8', charset).toString();
72218
- }
72219
-
72220
- /**
72221
- * Detect a URLSearchParams object
72222
- * ref: https://github.com/bitinn/node-fetch/issues/296#issuecomment-307598143
72223
- *
72224
- * @param Object obj Object to detect by type or brand
72225
- * @return String
72226
- */
72227
- function isURLSearchParams(obj) {
72228
- // Duck-typing as a necessary condition.
72229
- if (typeof obj !== 'object' || typeof obj.append !== 'function' || typeof obj.delete !== 'function' || typeof obj.get !== 'function' || typeof obj.getAll !== 'function' || typeof obj.has !== 'function' || typeof obj.set !== 'function') {
72230
- return false;
72231
- }
72232
-
72233
- // Brand-checking and more duck-typing as optional condition.
72234
- return obj.constructor.name === 'URLSearchParams' || Object.prototype.toString.call(obj) === '[object URLSearchParams]' || typeof obj.sort === 'function';
72235
- }
72236
-
72237
- /**
72238
- * Check if `obj` is a W3C `Blob` object (which `File` inherits from)
72239
- * @param {*} obj
72240
- * @return {boolean}
72241
- */
72242
- function isBlob(obj) {
72243
- return typeof obj === 'object' && typeof obj.arrayBuffer === 'function' && typeof obj.type === 'string' && typeof obj.stream === 'function' && typeof obj.constructor === 'function' && typeof obj.constructor.name === 'string' && /^(Blob|File)$/.test(obj.constructor.name) && /^(Blob|File)$/.test(obj[Symbol.toStringTag]);
72244
- }
72245
-
72246
- /**
72247
- * Clone body given Res/Req instance
72248
- *
72249
- * @param Mixed instance Response or Request instance
72250
- * @return Mixed
72251
- */
72252
- function clone(instance) {
72253
- let p1, p2;
72254
- let body = instance.body;
72255
-
72256
- // don't allow cloning a used body
72257
- if (instance.bodyUsed) {
72258
- throw new Error('cannot clone body after it is used');
72259
- }
72260
-
72261
- // check that body is a stream and not form-data object
72262
- // note: we can't clone the form-data object without having it as a dependency
72263
- if (body instanceof Stream__default['default'] && typeof body.getBoundary !== 'function') {
72264
- // tee instance body
72265
- p1 = new PassThrough();
72266
- p2 = new PassThrough();
72267
- body.pipe(p1);
72268
- body.pipe(p2);
72269
- // set instance body to teed body and return the other teed body
72270
- instance[INTERNALS].body = p1;
72271
- body = p2;
72272
- }
72273
-
72274
- return body;
72275
- }
72276
-
72277
- /**
72278
- * Performs the operation "extract a `Content-Type` value from |object|" as
72279
- * specified in the specification:
72280
- * https://fetch.spec.whatwg.org/#concept-bodyinit-extract
72281
- *
72282
- * This function assumes that instance.body is present.
72283
- *
72284
- * @param Mixed instance Any options.body input
72285
- */
72286
- function extractContentType(body) {
72287
- if (body === null) {
72288
- // body is null
72289
- return null;
72290
- } else if (typeof body === 'string') {
72291
- // body is string
72292
- return 'text/plain;charset=UTF-8';
72293
- } else if (isURLSearchParams(body)) {
72294
- // body is a URLSearchParams
72295
- return 'application/x-www-form-urlencoded;charset=UTF-8';
72296
- } else if (isBlob(body)) {
72297
- // body is blob
72298
- return body.type || null;
72299
- } else if (Buffer.isBuffer(body)) {
72300
- // body is buffer
72301
- return null;
72302
- } else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') {
72303
- // body is ArrayBuffer
72304
- return null;
72305
- } else if (ArrayBuffer.isView(body)) {
72306
- // body is ArrayBufferView
72307
- return null;
72308
- } else if (typeof body.getBoundary === 'function') {
72309
- // detect form data input from form-data module
72310
- return `multipart/form-data;boundary=${body.getBoundary()}`;
72311
- } else if (body instanceof Stream__default['default']) {
72312
- // body is stream
72313
- // can't really do much about this
72314
- return null;
72315
- } else {
72316
- // Body constructor defaults other things to string
72317
- return 'text/plain;charset=UTF-8';
72318
- }
72319
- }
72320
-
72321
- /**
72322
- * The Fetch Standard treats this as if "total bytes" is a property on the body.
72323
- * For us, we have to explicitly get it with a function.
72324
- *
72325
- * ref: https://fetch.spec.whatwg.org/#concept-body-total-bytes
72326
- *
72327
- * @param Body instance Instance of Body
72328
- * @return Number? Number of bytes, or null if not possible
72329
- */
72330
- function getTotalBytes(instance) {
72331
- const body = instance.body;
72332
-
72333
-
72334
- if (body === null) {
72335
- // body is null
72336
- return 0;
72337
- } else if (isBlob(body)) {
72338
- return body.size;
72339
- } else if (Buffer.isBuffer(body)) {
72340
- // body is buffer
72341
- return body.length;
72342
- } else if (body && typeof body.getLengthSync === 'function') {
72343
- // detect form data input from form-data module
72344
- if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || // 1.x
72345
- body.hasKnownLength && body.hasKnownLength()) {
72346
- // 2.x
72347
- return body.getLengthSync();
72348
- }
72349
- return null;
72350
- } else {
72351
- // body is stream
72352
- return null;
72353
- }
72354
- }
72355
-
72356
- /**
72357
- * Write a Body to a Node.js WritableStream (e.g. http.Request) object.
72358
- *
72359
- * @param Body instance Instance of Body
72360
- * @return Void
72361
- */
72362
- function writeToStream(dest, instance) {
72363
- const body = instance.body;
72364
-
72365
-
72366
- if (body === null) {
72367
- // body is null
72368
- dest.end();
72369
- } else if (isBlob(body)) {
72370
- body.stream().pipe(dest);
72371
- } else if (Buffer.isBuffer(body)) {
72372
- // body is buffer
72373
- dest.write(body);
72374
- dest.end();
72375
- } else {
72376
- // body is stream
72377
- body.pipe(dest);
72378
- }
72379
- }
72380
-
72381
- // expose Promise
72382
- Body.Promise = global.Promise;
72383
-
72384
- /**
72385
- * headers.js
72386
- *
72387
- * Headers class offers convenient helpers
72388
- */
72389
-
72390
- const invalidTokenRegex = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/;
72391
- const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
72392
-
72393
- function validateName(name) {
72394
- name = `${name}`;
72395
- if (invalidTokenRegex.test(name) || name === '') {
72396
- throw new TypeError(`${name} is not a legal HTTP header name`);
72397
- }
72398
- }
72399
-
72400
- function validateValue(value) {
72401
- value = `${value}`;
72402
- if (invalidHeaderCharRegex.test(value)) {
72403
- throw new TypeError(`${value} is not a legal HTTP header value`);
72404
- }
72405
- }
72406
-
72407
- /**
72408
- * Find the key in the map object given a header name.
72409
- *
72410
- * Returns undefined if not found.
72411
- *
72412
- * @param String name Header name
72413
- * @return String|Undefined
72414
- */
72415
- function find(map, name) {
72416
- name = name.toLowerCase();
72417
- for (const key in map) {
72418
- if (key.toLowerCase() === name) {
72419
- return key;
72420
- }
72421
- }
72422
- return undefined;
72423
- }
72424
-
72425
- const MAP = Symbol('map');
72426
- class Headers {
72427
- /**
72428
- * Headers class
72429
- *
72430
- * @param Object headers Response headers
72431
- * @return Void
72432
- */
72433
- constructor() {
72434
- let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
72435
-
72436
- this[MAP] = Object.create(null);
72437
-
72438
- if (init instanceof Headers) {
72439
- const rawHeaders = init.raw();
72440
- const headerNames = Object.keys(rawHeaders);
72441
-
72442
- for (const headerName of headerNames) {
72443
- for (const value of rawHeaders[headerName]) {
72444
- this.append(headerName, value);
72445
- }
72446
- }
72447
-
72448
- return;
72449
- }
72450
-
72451
- // We don't worry about converting prop to ByteString here as append()
72452
- // will handle it.
72453
- if (init == null) ; else if (typeof init === 'object') {
72454
- const method = init[Symbol.iterator];
72455
- if (method != null) {
72456
- if (typeof method !== 'function') {
72457
- throw new TypeError('Header pairs must be iterable');
72458
- }
72459
-
72460
- // sequence<sequence<ByteString>>
72461
- // Note: per spec we have to first exhaust the lists then process them
72462
- const pairs = [];
72463
- for (const pair of init) {
72464
- if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') {
72465
- throw new TypeError('Each header pair must be iterable');
72466
- }
72467
- pairs.push(Array.from(pair));
72468
- }
72469
-
72470
- for (const pair of pairs) {
72471
- if (pair.length !== 2) {
72472
- throw new TypeError('Each header pair must be a name/value tuple');
72473
- }
72474
- this.append(pair[0], pair[1]);
72475
- }
72476
- } else {
72477
- // record<ByteString, ByteString>
72478
- for (const key of Object.keys(init)) {
72479
- const value = init[key];
72480
- this.append(key, value);
72481
- }
72482
- }
72483
- } else {
72484
- throw new TypeError('Provided initializer must be an object');
72485
- }
72486
- }
72487
-
72488
- /**
72489
- * Return combined header value given name
72490
- *
72491
- * @param String name Header name
72492
- * @return Mixed
72493
- */
72494
- get(name) {
72495
- name = `${name}`;
72496
- validateName(name);
72497
- const key = find(this[MAP], name);
72498
- if (key === undefined) {
72499
- return null;
72500
- }
72501
-
72502
- return this[MAP][key].join(', ');
72503
- }
72504
-
72505
- /**
72506
- * Iterate over all headers
72507
- *
72508
- * @param Function callback Executed for each item with parameters (value, name, thisArg)
72509
- * @param Boolean thisArg `this` context for callback function
72510
- * @return Void
72511
- */
72512
- forEach(callback) {
72513
- let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
72514
-
72515
- let pairs = getHeaders(this);
72516
- let i = 0;
72517
- while (i < pairs.length) {
72518
- var _pairs$i = pairs[i];
72519
- const name = _pairs$i[0],
72520
- value = _pairs$i[1];
72521
-
72522
- callback.call(thisArg, value, name, this);
72523
- pairs = getHeaders(this);
72524
- i++;
72525
- }
72526
- }
72527
-
72528
- /**
72529
- * Overwrite header values given name
72530
- *
72531
- * @param String name Header name
72532
- * @param String value Header value
72533
- * @return Void
72534
- */
72535
- set(name, value) {
72536
- name = `${name}`;
72537
- value = `${value}`;
72538
- validateName(name);
72539
- validateValue(value);
72540
- const key = find(this[MAP], name);
72541
- this[MAP][key !== undefined ? key : name] = [value];
72542
- }
72543
-
72544
- /**
72545
- * Append a value onto existing header
72546
- *
72547
- * @param String name Header name
72548
- * @param String value Header value
72549
- * @return Void
72550
- */
72551
- append(name, value) {
72552
- name = `${name}`;
72553
- value = `${value}`;
72554
- validateName(name);
72555
- validateValue(value);
72556
- const key = find(this[MAP], name);
72557
- if (key !== undefined) {
72558
- this[MAP][key].push(value);
72559
- } else {
72560
- this[MAP][name] = [value];
72561
- }
72562
- }
72563
-
72564
- /**
72565
- * Check for header name existence
72566
- *
72567
- * @param String name Header name
72568
- * @return Boolean
72569
- */
72570
- has(name) {
72571
- name = `${name}`;
72572
- validateName(name);
72573
- return find(this[MAP], name) !== undefined;
72574
- }
72575
-
72576
- /**
72577
- * Delete all header values given name
72578
- *
72579
- * @param String name Header name
72580
- * @return Void
72581
- */
72582
- delete(name) {
72583
- name = `${name}`;
72584
- validateName(name);
72585
- const key = find(this[MAP], name);
72586
- if (key !== undefined) {
72587
- delete this[MAP][key];
72588
- }
72589
- }
72590
-
72591
- /**
72592
- * Return raw headers (non-spec api)
72593
- *
72594
- * @return Object
72595
- */
72596
- raw() {
72597
- return this[MAP];
72598
- }
72599
-
72600
- /**
72601
- * Get an iterator on keys.
72602
- *
72603
- * @return Iterator
72604
- */
72605
- keys() {
72606
- return createHeadersIterator(this, 'key');
72607
- }
72608
-
72609
- /**
72610
- * Get an iterator on values.
72611
- *
72612
- * @return Iterator
72613
- */
72614
- values() {
72615
- return createHeadersIterator(this, 'value');
72616
- }
72617
-
72618
- /**
72619
- * Get an iterator on entries.
72620
- *
72621
- * This is the default iterator of the Headers object.
72622
- *
72623
- * @return Iterator
72624
- */
72625
- [Symbol.iterator]() {
72626
- return createHeadersIterator(this, 'key+value');
72627
- }
72628
- }
72629
- Headers.prototype.entries = Headers.prototype[Symbol.iterator];
72630
-
72631
- Object.defineProperty(Headers.prototype, Symbol.toStringTag, {
72632
- value: 'Headers',
72633
- writable: false,
72634
- enumerable: false,
72635
- configurable: true
72636
- });
72637
-
72638
- Object.defineProperties(Headers.prototype, {
72639
- get: { enumerable: true },
72640
- forEach: { enumerable: true },
72641
- set: { enumerable: true },
72642
- append: { enumerable: true },
72643
- has: { enumerable: true },
72644
- delete: { enumerable: true },
72645
- keys: { enumerable: true },
72646
- values: { enumerable: true },
72647
- entries: { enumerable: true }
72648
- });
72649
-
72650
- function getHeaders(headers) {
72651
- let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value';
72652
-
72653
- const keys = Object.keys(headers[MAP]).sort();
72654
- return keys.map(kind === 'key' ? function (k) {
72655
- return k.toLowerCase();
72656
- } : kind === 'value' ? function (k) {
72657
- return headers[MAP][k].join(', ');
72658
- } : function (k) {
72659
- return [k.toLowerCase(), headers[MAP][k].join(', ')];
72660
- });
72661
- }
72662
-
72663
- const INTERNAL = Symbol('internal');
72664
-
72665
- function createHeadersIterator(target, kind) {
72666
- const iterator = Object.create(HeadersIteratorPrototype);
72667
- iterator[INTERNAL] = {
72668
- target,
72669
- kind,
72670
- index: 0
72671
- };
72672
- return iterator;
72673
- }
72674
-
72675
- const HeadersIteratorPrototype = Object.setPrototypeOf({
72676
- next() {
72677
- // istanbul ignore if
72678
- if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) {
72679
- throw new TypeError('Value of `this` is not a HeadersIterator');
72680
- }
72681
-
72682
- var _INTERNAL = this[INTERNAL];
72683
- const target = _INTERNAL.target,
72684
- kind = _INTERNAL.kind,
72685
- index = _INTERNAL.index;
72686
-
72687
- const values = getHeaders(target, kind);
72688
- const len = values.length;
72689
- if (index >= len) {
72690
- return {
72691
- value: undefined,
72692
- done: true
72693
- };
72694
- }
72695
-
72696
- this[INTERNAL].index = index + 1;
72697
-
72698
- return {
72699
- value: values[index],
72700
- done: false
72701
- };
72702
- }
72703
- }, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));
72704
-
72705
- Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, {
72706
- value: 'HeadersIterator',
72707
- writable: false,
72708
- enumerable: false,
72709
- configurable: true
72710
- });
72711
-
72712
- /**
72713
- * Export the Headers object in a form that Node.js can consume.
72714
- *
72715
- * @param Headers headers
72716
- * @return Object
72717
- */
72718
- function exportNodeCompatibleHeaders(headers) {
72719
- const obj = Object.assign({ __proto__: null }, headers[MAP]);
72720
-
72721
- // http.request() only supports string as Host header. This hack makes
72722
- // specifying custom Host header possible.
72723
- const hostHeaderKey = find(headers[MAP], 'Host');
72724
- if (hostHeaderKey !== undefined) {
72725
- obj[hostHeaderKey] = obj[hostHeaderKey][0];
72726
- }
72727
-
72728
- return obj;
72729
- }
72730
-
72731
- /**
72732
- * Create a Headers object from an object of headers, ignoring those that do
72733
- * not conform to HTTP grammar productions.
72734
- *
72735
- * @param Object obj Object of headers
72736
- * @return Headers
72737
- */
72738
- function createHeadersLenient(obj) {
72739
- const headers = new Headers();
72740
- for (const name of Object.keys(obj)) {
72741
- if (invalidTokenRegex.test(name)) {
72742
- continue;
72743
- }
72744
- if (Array.isArray(obj[name])) {
72745
- for (const val of obj[name]) {
72746
- if (invalidHeaderCharRegex.test(val)) {
72747
- continue;
72748
- }
72749
- if (headers[MAP][name] === undefined) {
72750
- headers[MAP][name] = [val];
72751
- } else {
72752
- headers[MAP][name].push(val);
72753
- }
72754
- }
72755
- } else if (!invalidHeaderCharRegex.test(obj[name])) {
72756
- headers[MAP][name] = [obj[name]];
72757
- }
72758
- }
72759
- return headers;
72760
- }
72761
-
72762
- const INTERNALS$1 = Symbol('Response internals');
72763
-
72764
- // fix an issue where "STATUS_CODES" aren't a named export for node <10
72765
- const STATUS_CODES = http__default['default'].STATUS_CODES;
72766
-
72767
- /**
72768
- * Response class
72769
- *
72770
- * @param Stream body Readable stream
72771
- * @param Object opts Response options
72772
- * @return Void
72773
- */
72774
- class Response {
72775
- constructor() {
72776
- let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
72777
- let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
72778
-
72779
- Body.call(this, body, opts);
72780
-
72781
- const status = opts.status || 200;
72782
- const headers = new Headers(opts.headers);
72783
-
72784
- if (body != null && !headers.has('Content-Type')) {
72785
- const contentType = extractContentType(body);
72786
- if (contentType) {
72787
- headers.append('Content-Type', contentType);
72788
- }
72789
- }
72790
-
72791
- this[INTERNALS$1] = {
72792
- url: opts.url,
72793
- status,
72794
- statusText: opts.statusText || STATUS_CODES[status],
72795
- headers,
72796
- counter: opts.counter
72797
- };
72798
- }
72799
-
72800
- get url() {
72801
- return this[INTERNALS$1].url || '';
72802
- }
72803
-
72804
- get status() {
72805
- return this[INTERNALS$1].status;
72806
- }
72807
-
72808
- /**
72809
- * Convenience property representing if the request ended normally
72810
- */
72811
- get ok() {
72812
- return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;
72813
- }
72814
-
72815
- get redirected() {
72816
- return this[INTERNALS$1].counter > 0;
72817
- }
72818
-
72819
- get statusText() {
72820
- return this[INTERNALS$1].statusText;
72821
- }
72822
-
72823
- get headers() {
72824
- return this[INTERNALS$1].headers;
72825
- }
72826
-
72827
- /**
72828
- * Clone this response
72829
- *
72830
- * @return Response
72831
- */
72832
- clone() {
72833
- return new Response(clone(this), {
72834
- url: this.url,
72835
- status: this.status,
72836
- statusText: this.statusText,
72837
- headers: this.headers,
72838
- ok: this.ok,
72839
- redirected: this.redirected
72840
- });
72841
- }
72842
- }
72843
-
72844
- Body.mixIn(Response.prototype);
72845
-
72846
- Object.defineProperties(Response.prototype, {
72847
- url: { enumerable: true },
72848
- status: { enumerable: true },
72849
- ok: { enumerable: true },
72850
- redirected: { enumerable: true },
72851
- statusText: { enumerable: true },
72852
- headers: { enumerable: true },
72853
- clone: { enumerable: true }
72854
- });
72855
-
72856
- Object.defineProperty(Response.prototype, Symbol.toStringTag, {
72857
- value: 'Response',
72858
- writable: false,
72859
- enumerable: false,
72860
- configurable: true
72861
- });
72862
-
72863
- const INTERNALS$2 = Symbol('Request internals');
72864
-
72865
- // fix an issue where "format", "parse" aren't a named export for node <10
72866
- const parse_url = Url__default['default'].parse;
72867
- const format_url = Url__default['default'].format;
72868
-
72869
- const streamDestructionSupported = 'destroy' in Stream__default['default'].Readable.prototype;
72870
-
72871
- /**
72872
- * Check if a value is an instance of Request.
72873
- *
72874
- * @param Mixed input
72875
- * @return Boolean
72876
- */
72877
- function isRequest(input) {
72878
- return typeof input === 'object' && typeof input[INTERNALS$2] === 'object';
72879
- }
72880
-
72881
- function isAbortSignal(signal) {
72882
- const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal);
72883
- return !!(proto && proto.constructor.name === 'AbortSignal');
72884
- }
72885
-
72886
- /**
72887
- * Request class
72888
- *
72889
- * @param Mixed input Url or Request instance
72890
- * @param Object init Custom options
72891
- * @return Void
72892
- */
72893
- class Request {
72894
- constructor(input) {
72895
- let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
72896
-
72897
- let parsedURL;
72898
-
72899
- // normalize input
72900
- if (!isRequest(input)) {
72901
- if (input && input.href) {
72902
- // in order to support Node.js' Url objects; though WHATWG's URL objects
72903
- // will fall into this branch also (since their `toString()` will return
72904
- // `href` property anyway)
72905
- parsedURL = parse_url(input.href);
72906
- } else {
72907
- // coerce input to a string before attempting to parse
72908
- parsedURL = parse_url(`${input}`);
72909
- }
72910
- input = {};
72911
- } else {
72912
- parsedURL = parse_url(input.url);
72913
- }
72914
-
72915
- let method = init.method || input.method || 'GET';
72916
- method = method.toUpperCase();
72917
-
72918
- if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) {
72919
- throw new TypeError('Request with GET/HEAD method cannot have body');
72920
- }
72921
-
72922
- let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
72923
-
72924
- Body.call(this, inputBody, {
72925
- timeout: init.timeout || input.timeout || 0,
72926
- size: init.size || input.size || 0
72927
- });
72928
-
72929
- const headers = new Headers(init.headers || input.headers || {});
72930
-
72931
- if (inputBody != null && !headers.has('Content-Type')) {
72932
- const contentType = extractContentType(inputBody);
72933
- if (contentType) {
72934
- headers.append('Content-Type', contentType);
72935
- }
72936
- }
72937
-
72938
- let signal = isRequest(input) ? input.signal : null;
72939
- if ('signal' in init) signal = init.signal;
72940
-
72941
- if (signal != null && !isAbortSignal(signal)) {
72942
- throw new TypeError('Expected signal to be an instanceof AbortSignal');
72943
- }
72944
-
72945
- this[INTERNALS$2] = {
72946
- method,
72947
- redirect: init.redirect || input.redirect || 'follow',
72948
- headers,
72949
- parsedURL,
72950
- signal
72951
- };
72952
-
72953
- // node-fetch-only options
72954
- this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20;
72955
- this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true;
72956
- this.counter = init.counter || input.counter || 0;
72957
- this.agent = init.agent || input.agent;
72958
- }
72959
-
72960
- get method() {
72961
- return this[INTERNALS$2].method;
72962
- }
72963
-
72964
- get url() {
72965
- return format_url(this[INTERNALS$2].parsedURL);
72966
- }
72967
-
72968
- get headers() {
72969
- return this[INTERNALS$2].headers;
72970
- }
72971
-
72972
- get redirect() {
72973
- return this[INTERNALS$2].redirect;
72974
- }
72975
-
72976
- get signal() {
72977
- return this[INTERNALS$2].signal;
72978
- }
72979
-
72980
- /**
72981
- * Clone this request
72982
- *
72983
- * @return Request
72984
- */
72985
- clone() {
72986
- return new Request(this);
72987
- }
72988
- }
72989
-
72990
- Body.mixIn(Request.prototype);
72991
-
72992
- Object.defineProperty(Request.prototype, Symbol.toStringTag, {
72993
- value: 'Request',
72994
- writable: false,
72995
- enumerable: false,
72996
- configurable: true
72997
- });
72998
-
72999
- Object.defineProperties(Request.prototype, {
73000
- method: { enumerable: true },
73001
- url: { enumerable: true },
73002
- headers: { enumerable: true },
73003
- redirect: { enumerable: true },
73004
- clone: { enumerable: true },
73005
- signal: { enumerable: true }
73006
- });
73007
-
73008
- /**
73009
- * Convert a Request to Node.js http request options.
73010
- *
73011
- * @param Request A Request instance
73012
- * @return Object The options object to be passed to http.request
73013
- */
73014
- function getNodeRequestOptions(request) {
73015
- const parsedURL = request[INTERNALS$2].parsedURL;
73016
- const headers = new Headers(request[INTERNALS$2].headers);
73017
-
73018
- // fetch step 1.3
73019
- if (!headers.has('Accept')) {
73020
- headers.set('Accept', '*/*');
73021
- }
73022
-
73023
- // Basic fetch
73024
- if (!parsedURL.protocol || !parsedURL.hostname) {
73025
- throw new TypeError('Only absolute URLs are supported');
73026
- }
73027
-
73028
- if (!/^https?:$/.test(parsedURL.protocol)) {
73029
- throw new TypeError('Only HTTP(S) protocols are supported');
73030
- }
73031
-
73032
- if (request.signal && request.body instanceof Stream__default['default'].Readable && !streamDestructionSupported) {
73033
- throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8');
73034
- }
73035
-
73036
- // HTTP-network-or-cache fetch steps 2.4-2.7
73037
- let contentLengthValue = null;
73038
- if (request.body == null && /^(POST|PUT)$/i.test(request.method)) {
73039
- contentLengthValue = '0';
73040
- }
73041
- if (request.body != null) {
73042
- const totalBytes = getTotalBytes(request);
73043
- if (typeof totalBytes === 'number') {
73044
- contentLengthValue = String(totalBytes);
73045
- }
73046
- }
73047
- if (contentLengthValue) {
73048
- headers.set('Content-Length', contentLengthValue);
73049
- }
73050
-
73051
- // HTTP-network-or-cache fetch step 2.11
73052
- if (!headers.has('User-Agent')) {
73053
- headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)');
73054
- }
73055
-
73056
- // HTTP-network-or-cache fetch step 2.15
73057
- if (request.compress && !headers.has('Accept-Encoding')) {
73058
- headers.set('Accept-Encoding', 'gzip,deflate');
73059
- }
73060
-
73061
- let agent = request.agent;
73062
- if (typeof agent === 'function') {
73063
- agent = agent(parsedURL);
73064
- }
73065
-
73066
- if (!headers.has('Connection') && !agent) {
73067
- headers.set('Connection', 'close');
73068
- }
73069
-
73070
- // HTTP-network fetch step 4.2
73071
- // chunked encoding is handled by Node.js
73072
-
73073
- return Object.assign({}, parsedURL, {
73074
- method: request.method,
73075
- headers: exportNodeCompatibleHeaders(headers),
73076
- agent
73077
- });
73078
- }
73079
-
73080
- /**
73081
- * abort-error.js
73082
- *
73083
- * AbortError interface for cancelled requests
73084
- */
73085
-
73086
- /**
73087
- * Create AbortError instance
73088
- *
73089
- * @param String message Error message for human
73090
- * @return AbortError
73091
- */
73092
- function AbortError(message) {
73093
- Error.call(this, message);
73094
-
73095
- this.type = 'aborted';
73096
- this.message = message;
73097
-
73098
- // hide custom error implementation details from end-users
73099
- Error.captureStackTrace(this, this.constructor);
73100
- }
73101
-
73102
- AbortError.prototype = Object.create(Error.prototype);
73103
- AbortError.prototype.constructor = AbortError;
73104
- AbortError.prototype.name = 'AbortError';
73105
-
73106
- // fix an issue where "PassThrough", "resolve" aren't a named export for node <10
73107
- const PassThrough$1 = Stream__default['default'].PassThrough;
73108
- const resolve_url = Url__default['default'].resolve;
73109
-
73110
- /**
73111
- * Fetch function
73112
- *
73113
- * @param Mixed url Absolute url or Request instance
73114
- * @param Object opts Fetch options
73115
- * @return Promise
73116
- */
73117
- function fetch$1(url, opts) {
73118
-
73119
- // allow custom promise
73120
- if (!fetch$1.Promise) {
73121
- throw new Error('native promise missing, set fetch.Promise to your favorite alternative');
73122
- }
73123
-
73124
- Body.Promise = fetch$1.Promise;
73125
-
73126
- // wrap http.request into fetch
73127
- return new fetch$1.Promise(function (resolve, reject) {
73128
- // build request object
73129
- const request = new Request(url, opts);
73130
- const options = getNodeRequestOptions(request);
73131
-
73132
- const send = (options.protocol === 'https:' ? https__default['default'] : http__default['default']).request;
73133
- const signal = request.signal;
73134
-
73135
- let response = null;
73136
-
73137
- const abort = function abort() {
73138
- let error = new AbortError('The user aborted a request.');
73139
- reject(error);
73140
- if (request.body && request.body instanceof Stream__default['default'].Readable) {
73141
- request.body.destroy(error);
73142
- }
73143
- if (!response || !response.body) return;
73144
- response.body.emit('error', error);
73145
- };
73146
-
73147
- if (signal && signal.aborted) {
73148
- abort();
73149
- return;
73150
- }
73151
-
73152
- const abortAndFinalize = function abortAndFinalize() {
73153
- abort();
73154
- finalize();
73155
- };
73156
-
73157
- // send request
73158
- const req = send(options);
73159
- let reqTimeout;
73160
-
73161
- if (signal) {
73162
- signal.addEventListener('abort', abortAndFinalize);
73163
- }
71569
+ var tr = {
71570
+ actions: {
71571
+ login: "Giriş Yap",
71572
+ edit: "Düzenle",
71573
+ apply: "Uygula",
71574
+ close: "Kapat",
71575
+ cancel: "Vazgeç",
71576
+ save: "Kaydet",
71577
+ continue: "Devam Et",
71578
+ show: "Göster",
71579
+ hide: "Gizle",
71580
+ sendMessage: "Mesajı Gönder",
71581
+ continueWithShipping: "Kargo ile Devam Et",
71582
+ continueWithPayment: "Ödeme ile Devam Et",
71583
+ completeOrder: "Siparişi Tamamla",
71584
+ backToShopping: "Alışverişe Dön",
71585
+ backToCart: "Sepete Dön",
71586
+ },
71587
+ securePayment: "Güvenli Ödeme",
71588
+ alreadyHaveAnAccount: "Zaten hesabınız var mı?",
73164
71589
 
73165
- function finalize() {
73166
- req.abort();
73167
- if (signal) signal.removeEventListener('abort', abortAndFinalize);
73168
- clearTimeout(reqTimeout);
73169
- }
71590
+ address: "Adres",
71591
+ addressError: "Adres girin",
71592
+ missingAddressFields: "Adres bilgilerinde bazı zorunlu alanlar eksik.",
71593
+ editAddress: "Adres Düzenle",
71594
+ deleteAddress: "Adresi Sil",
71595
+ saveAddressCta: "Bir sonraki işlem için bu adresi kaydet",
71596
+ firstName: "Ad",
71597
+ firstNameError: "Ad girin",
71598
+ lastName: "Soyad",
71599
+ lastNameError: "Soyad girin",
71600
+ identityNumber: "TC Kimlik No",
71601
+ identityNumberError: "TC kimlik no girin",
71602
+ addressTitle: "Adres Başlığı",
71603
+ adressTitleError: "Adres başlığı girin",
71604
+ addressLine2: "Apartman, daire, vb.",
71605
+ postalCode: "Posta Kodu",
71606
+ postalCodeError: "Posta kodu girin",
71607
+ country: "Ülke",
71608
+ countryError: "Ülke seçin",
71609
+ state: "Eyalet",
71610
+ stateError: "Eyalet seçin",
71611
+ city: "İl",
71612
+ cityError: "İl seçin",
71613
+ district: "İlçe",
71614
+ districtError: "İlçe seçin",
71615
+ phone: "Telefon",
71616
+ phoneError: "Geçerli bir telefon girin",
71617
+ companyName: "Firma Adı",
71618
+ taxOffice: "Vergi Dairesi",
71619
+ taxNumber: "Vergi Numarası",
73170
71620
 
73171
- if (request.timeout) {
73172
- req.once('socket', function (socket) {
73173
- reqTimeout = setTimeout(function () {
73174
- reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout'));
73175
- finalize();
73176
- }, request.timeout);
73177
- });
73178
- }
71621
+ shipping: "Kargo",
71622
+ payment: "Ödeme",
71623
+ summary: "Özet",
73179
71624
 
73180
- req.on('error', function (err) {
73181
- reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
73182
- finalize();
73183
- });
71625
+ free: "Ücretsiz",
71626
+ standartShipping: "Standart Kargo",
71627
+ returnPolicy: "Para İade Politikası",
71628
+ privacyPolicy: "Gizlilik Politikası",
71629
+ termsOfService: "Hizmet Şartları",
71630
+ newAddress: "Yeni Adres",
71631
+ billingAddress: "Fatura Adresi",
71632
+ shippingAddress: "Teslimat Adresi",
71633
+ corporateInvoice: "Kurumsal fatura",
71634
+ contactInfo: "İletişim Bilgileri",
71635
+ email: "E-Posta",
71636
+ emailError: "Geçerli bir e-posta girin",
71637
+ guestEmailTooltip: "Sipariş bilgileri bu e-posta adresine gönderilecektir",
71638
+ customerConsentCta: "Beni haberlerden ve özel tekliflerden haberdar et",
71639
+ useShippingForBilling: "Fatura adresim teslimat adresimle aynı",
71640
+ installmentOptions: "Taksit Seçenekleri",
71641
+ singleInstallment: "Tek Çekim",
71642
+ installments: "Taksit",
71643
+ creditCard: "Kredi Kartı",
73184
71644
 
73185
- req.on('response', function (res) {
73186
- clearTimeout(reqTimeout);
73187
-
73188
- const headers = createHeadersLenient(res.headers);
73189
-
73190
- // HTTP fetch step 5
73191
- if (fetch$1.isRedirect(res.statusCode)) {
73192
- // HTTP fetch step 5.2
73193
- const location = headers.get('Location');
73194
-
73195
- // HTTP fetch step 5.3
73196
- const locationURL = location === null ? null : resolve_url(request.url, location);
73197
-
73198
- // HTTP fetch step 5.5
73199
- switch (request.redirect) {
73200
- case 'error':
73201
- reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));
73202
- finalize();
73203
- return;
73204
- case 'manual':
73205
- // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL.
73206
- if (locationURL !== null) {
73207
- // handle corrupted header
73208
- try {
73209
- headers.set('Location', locationURL);
73210
- } catch (err) {
73211
- // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request
73212
- reject(err);
73213
- }
73214
- }
73215
- break;
73216
- case 'follow':
73217
- // HTTP-redirect fetch step 2
73218
- if (locationURL === null) {
73219
- break;
73220
- }
73221
-
73222
- // HTTP-redirect fetch step 5
73223
- if (request.counter >= request.follow) {
73224
- reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));
73225
- finalize();
73226
- return;
73227
- }
73228
-
73229
- // HTTP-redirect fetch step 6 (counter increment)
73230
- // Create a new Request object.
73231
- const requestOpts = {
73232
- headers: new Headers(request.headers),
73233
- follow: request.follow,
73234
- counter: request.counter + 1,
73235
- agent: request.agent,
73236
- compress: request.compress,
73237
- method: request.method,
73238
- body: request.body,
73239
- signal: request.signal,
73240
- timeout: request.timeout,
73241
- size: request.size
73242
- };
73243
-
73244
- // HTTP-redirect fetch step 9
73245
- if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
73246
- reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));
73247
- finalize();
73248
- return;
73249
- }
73250
-
73251
- // HTTP-redirect fetch step 11
73252
- if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') {
73253
- requestOpts.method = 'GET';
73254
- requestOpts.body = undefined;
73255
- requestOpts.headers.delete('content-length');
73256
- }
73257
-
73258
- // HTTP-redirect fetch step 15
73259
- resolve(fetch$1(new Request(locationURL, requestOpts)));
73260
- finalize();
73261
- return;
73262
- }
73263
- }
71645
+ ackPrivacyPolicy: "Gizlilik Sözleşmesini",
71646
+ ackTermsOfService: "Satış Sözleşmesini",
71647
+ ackPoliciesSentence:
71648
+ "{{ ackPrivacyPolicy }} ve {{ ackTermsOfService }} okudum, onaylıyorum.",
73264
71649
 
73265
- // prepare response
73266
- res.once('end', function () {
73267
- if (signal) signal.removeEventListener('abort', abortAndFinalize);
73268
- });
73269
- let body = res.pipe(new PassThrough$1());
73270
-
73271
- const response_options = {
73272
- url: request.url,
73273
- status: res.statusCode,
73274
- statusText: res.statusMessage,
73275
- headers: headers,
73276
- size: request.size,
73277
- timeout: request.timeout,
73278
- counter: request.counter
73279
- };
71650
+ securePaymentTooltip: "Ödemeler güvenli ve şifrelidir",
71651
+ giftPackage: "Hediye Paketi",
71652
+ giftPackageCta: "Hediye paketi istiyorum",
71653
+ giftPackageCtaPlaceholder: "Hediye mesajınızı giriniz",
73280
71654
 
73281
- // HTTP-network fetch step 12.1.1.3
73282
- const codings = headers.get('Content-Encoding');
73283
-
73284
- // HTTP-network fetch step 12.1.1.4: handle content codings
73285
-
73286
- // in following scenarios we ignore compression support
73287
- // 1. compression support is disabled
73288
- // 2. HEAD request
73289
- // 3. no Content-Encoding header
73290
- // 4. no content response (204)
73291
- // 5. content not modified response (304)
73292
- if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) {
73293
- response = new Response(body, response_options);
73294
- resolve(response);
73295
- return;
73296
- }
71655
+ paymentMethod: "Ödeme Yöntemi",
71656
+ paymentMethodDiscount: "İndirim",
71657
+ paymentMethodAdditionalPrice: "İşlem Bedeli",
73297
71658
 
73298
- // For Node v6+
73299
- // Be less strict when decoding compressed responses, since sometimes
73300
- // servers send slightly invalid responses that are still accepted
73301
- // by common browsers.
73302
- // Always using Z_SYNC_FLUSH is what cURL does.
73303
- const zlibOptions = {
73304
- flush: zlib__default['default'].Z_SYNC_FLUSH,
73305
- finishFlush: zlib__default['default'].Z_SYNC_FLUSH
73306
- };
71659
+ orderSuccessTitle: "Siparişiniz için teşekkür ederiz!",
71660
+ orderSuccessDescription:
71661
+ "Sevgili {{ customerName }}, siparişiniz bize ulaşmıştır. Siparişiniz kargoya verildiğinde sizi e-posta ile bilgilendireceğiz.",
71662
+ orderNoAndDate: "Sipariş No / Tarih",
71663
+ paymentSummary: "Ödeme Özeti",
71664
+ shippingSummary: "Teslimat Özeti",
71665
+ helpCtaQuestion: "Yardıma mı ihtiyacınız var?",
71666
+ helpCta: "Bizimle iletişime geçin",
73307
71667
 
73308
- // for gzip
73309
- if (codings == 'gzip' || codings == 'x-gzip') {
73310
- body = body.pipe(zlib__default['default'].createGunzip(zlibOptions));
73311
- response = new Response(body, response_options);
73312
- resolve(response);
73313
- return;
73314
- }
71668
+ contactForm: "İletişim Formu",
71669
+ contactFormSent: "Mesaj başarıyla gönderildi",
71670
+ contactFormDescription:
71671
+ "Mesajınızla ilgili olarak size en kısa zamanda e-posta veya telefon aracılığıyla geri dönüş yapılacaktır.",
71672
+ contactFormCta: "Mesajınızı yazın",
73315
71673
 
73316
- // for deflate
73317
- if (codings == 'deflate' || codings == 'x-deflate') {
73318
- // handle the infamous raw deflate response from old servers
73319
- // a hack for old IIS and Apache servers
73320
- const raw = res.pipe(new PassThrough$1());
73321
- raw.once('data', function (chunk) {
73322
- // see http://stackoverflow.com/questions/37519828
73323
- if ((chunk[0] & 0x0F) === 0x08) {
73324
- body = body.pipe(zlib__default['default'].createInflate());
73325
- } else {
73326
- body = body.pipe(zlib__default['default'].createInflateRaw());
73327
- }
73328
- response = new Response(body, response_options);
73329
- resolve(response);
73330
- });
73331
- return;
73332
- }
71674
+ orderPackageStatus: {
71675
+ unfulfilled: "Oluşturuldu",
71676
+ readyForShipment: "Kargoya Hazır",
71677
+ fulfilled: "Gönderildi",
71678
+ partiallyFulfilled: "Kısmi Gönderildi",
71679
+ delivered: "Teslim Edildi",
71680
+ unableToDeliver: "Teslim Edilemedi",
71681
+ cancelled: "İptal Edildi",
71682
+ cancelRejected: "İptal Talebi Reddedildi",
71683
+ cancelRequested: "İptal İstendi",
71684
+ refunded: "İade Edildi",
71685
+ refundRequestAccepted: "İade Talebi Onaylandı",
71686
+ refundRejected: "İade Talebi Reddedildi",
71687
+ refundRequested: "İade Talep Edildi",
71688
+ },
73333
71689
 
73334
- // for br
73335
- if (codings == 'br' && typeof zlib__default['default'].createBrotliDecompress === 'function') {
73336
- body = body.pipe(zlib__default['default'].createBrotliDecompress());
73337
- response = new Response(body, response_options);
73338
- resolve(response);
73339
- return;
73340
- }
71690
+ quantity: "Adet",
71691
+ cartItemProduct: "ürün",
71692
+ giftCodeErrorTitle: "İndirim Kodu Hatası",
71693
+ giftCodeErrorDescription:
71694
+ "İndirim kodunuz geçersiz veya sepetinizdeki ürünlere uygulanabilir değil. Lütfen kodunuzu kontrol edip tekrar deneyin.",
71695
+ subtotal: "Ara Toplam",
71696
+ total: "Toplam",
71697
+ subtotalTooltip:
71698
+ "Ara toplam, tüm geçerli indirimlerden önce siparişinizin toplam fiyatını yansıtır. kargo ücretini içermez.",
71699
+ cartShippingTitle: "Teslimat / Kargo",
71700
+ cartTaxTitle: "Vergi",
71701
+ cartInterest: "Vade Farkı",
71702
+ couponCode: "İndirim Kodu",
71703
+ addCouponCode: "İndirim kodu ekle",
71704
+ addOrderNote: "Sipariş notu ekle",
71705
+ editOrderNote: "Sipariş notu düzenle",
71706
+ orderNote: "Sipariş Notu",
71707
+ enterPhoneNumber: "Telefon numarası girin",
73341
71708
 
73342
- // otherwise, use response as-is
73343
- response = new Response(body, response_options);
73344
- resolve(response);
73345
- });
71709
+ cardNumber: "Kart Numarası",
71710
+ cardNumberError: "Geçerli bir kart numarası girin",
71711
+ cardHolderName: "Kart Üzerindeki İsim",
71712
+ cardHolderError: "Ad soyad girin",
71713
+ cardExpiry: "Ay / Yıl",
71714
+ cardExpiryError: "Geçerli bir tarih girin",
71715
+ cardCVC: "CVC",
71716
+ cardCVCError: "Geçerli bir güvenlik kodu girin",
71717
+ cardCVCTooltip: "Kartınızın arkasındaki 3 haneli güvenlik kodu",
73346
71718
 
73347
- writeToStream(req, request);
73348
- });
73349
- }
73350
- /**
73351
- * Redirect code matching
73352
- *
73353
- * @param Number code Status code
73354
- * @return Boolean
73355
- */
73356
- fetch$1.isRedirect = function (code) {
73357
- return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
71719
+ errorCustomerRequired:
71720
+ "Bu e-posta adresine ait kayıtlı bir hesap bulunuyor. Lütfen hesabınıza giriş yapınız.",
71721
+ errorNoShipping: "Bulunduğunuz konuma gönderim yapılmamaktadır.",
71722
+ errorPayment:
71723
+ "Ödemeniz alınamadı. Lütfen bilgilerinizi kontrol edip tekrar deneyin.",
71724
+ errorStockTitle: "Stoklar Güncellendi!",
71725
+ errorStockDescription:
71726
+ "Sepetinizdeki bazı ürünlerin stoğu tükenmiştir. Bu ürünleri sepetinizden çıkararak devam etmek ister misiniz?",
71727
+ errorUnknown: "Beklenmedik bir hata oluştu. Lütfen tekrar deneyin.",
73358
71728
  };
73359
71729
 
73360
- // expose Promise
73361
- fetch$1.Promise = global.Promise;
71730
+ var tr$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(null), tr, {
71731
+ 'default': tr
71732
+ }));
73362
71733
 
73363
71734
  var en = {
73364
71735
  actions: {
@@ -73526,462 +71897,6 @@ var en$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.assign(/*#__PURE__*/Ob
73526
71897
  'default': en
73527
71898
  }));
73528
71899
 
73529
- var tr = {
73530
- actions: {
73531
- login: "Giriş Yap",
73532
- edit: "Düzenle",
73533
- apply: "Uygula",
73534
- close: "Kapat",
73535
- cancel: "Vazgeç",
73536
- save: "Kaydet",
73537
- continue: "Devam Et",
73538
- show: "Göster",
73539
- hide: "Gizle",
73540
- sendMessage: "Mesajı Gönder",
73541
- continueWithShipping: "Kargo ile Devam Et",
73542
- continueWithPayment: "Ödeme ile Devam Et",
73543
- completeOrder: "Siparişi Tamamla",
73544
- backToShopping: "Alışverişe Dön",
73545
- backToCart: "Sepete Dön",
73546
- },
73547
- securePayment: "Güvenli Ödeme",
73548
- alreadyHaveAnAccount: "Zaten hesabınız var mı?",
73549
-
73550
- address: "Adres",
73551
- addressError: "Adres girin",
73552
- missingAddressFields: "Adres bilgilerinde bazı zorunlu alanlar eksik.",
73553
- editAddress: "Adres Düzenle",
73554
- deleteAddress: "Adresi Sil",
73555
- saveAddressCta: "Bir sonraki işlem için bu adresi kaydet",
73556
- firstName: "Ad",
73557
- firstNameError: "Ad girin",
73558
- lastName: "Soyad",
73559
- lastNameError: "Soyad girin",
73560
- identityNumber: "TC Kimlik No",
73561
- identityNumberError: "TC kimlik no girin",
73562
- addressTitle: "Adres Başlığı",
73563
- adressTitleError: "Adres başlığı girin",
73564
- addressLine2: "Apartman, daire, vb.",
73565
- postalCode: "Posta Kodu",
73566
- postalCodeError: "Posta kodu girin",
73567
- country: "Ülke",
73568
- countryError: "Ülke seçin",
73569
- state: "Eyalet",
73570
- stateError: "Eyalet seçin",
73571
- city: "İl",
73572
- cityError: "İl seçin",
73573
- district: "İlçe",
73574
- districtError: "İlçe seçin",
73575
- phone: "Telefon",
73576
- phoneError: "Geçerli bir telefon girin",
73577
- companyName: "Firma Adı",
73578
- taxOffice: "Vergi Dairesi",
73579
- taxNumber: "Vergi Numarası",
73580
-
73581
- shipping: "Kargo",
73582
- payment: "Ödeme",
73583
- summary: "Özet",
73584
-
73585
- free: "Ücretsiz",
73586
- standartShipping: "Standart Kargo",
73587
- returnPolicy: "Para İade Politikası",
73588
- privacyPolicy: "Gizlilik Politikası",
73589
- termsOfService: "Hizmet Şartları",
73590
- newAddress: "Yeni Adres",
73591
- billingAddress: "Fatura Adresi",
73592
- shippingAddress: "Teslimat Adresi",
73593
- corporateInvoice: "Kurumsal fatura",
73594
- contactInfo: "İletişim Bilgileri",
73595
- email: "E-Posta",
73596
- emailError: "Geçerli bir e-posta girin",
73597
- guestEmailTooltip: "Sipariş bilgileri bu e-posta adresine gönderilecektir",
73598
- customerConsentCta: "Beni haberlerden ve özel tekliflerden haberdar et",
73599
- useShippingForBilling: "Fatura adresim teslimat adresimle aynı",
73600
- installmentOptions: "Taksit Seçenekleri",
73601
- singleInstallment: "Tek Çekim",
73602
- installments: "Taksit",
73603
- creditCard: "Kredi Kartı",
73604
-
73605
- ackPrivacyPolicy: "Gizlilik Sözleşmesini",
73606
- ackTermsOfService: "Satış Sözleşmesini",
73607
- ackPoliciesSentence:
73608
- "{{ ackPrivacyPolicy }} ve {{ ackTermsOfService }} okudum, onaylıyorum.",
73609
-
73610
- securePaymentTooltip: "Ödemeler güvenli ve şifrelidir",
73611
- giftPackage: "Hediye Paketi",
73612
- giftPackageCta: "Hediye paketi istiyorum",
73613
- giftPackageCtaPlaceholder: "Hediye mesajınızı giriniz",
73614
-
73615
- paymentMethod: "Ödeme Yöntemi",
73616
- paymentMethodDiscount: "İndirim",
73617
- paymentMethodAdditionalPrice: "İşlem Bedeli",
73618
-
73619
- orderSuccessTitle: "Siparişiniz için teşekkür ederiz!",
73620
- orderSuccessDescription:
73621
- "Sevgili {{ customerName }}, siparişiniz bize ulaşmıştır. Siparişiniz kargoya verildiğinde sizi e-posta ile bilgilendireceğiz.",
73622
- orderNoAndDate: "Sipariş No / Tarih",
73623
- paymentSummary: "Ödeme Özeti",
73624
- shippingSummary: "Teslimat Özeti",
73625
- helpCtaQuestion: "Yardıma mı ihtiyacınız var?",
73626
- helpCta: "Bizimle iletişime geçin",
73627
-
73628
- contactForm: "İletişim Formu",
73629
- contactFormSent: "Mesaj başarıyla gönderildi",
73630
- contactFormDescription:
73631
- "Mesajınızla ilgili olarak size en kısa zamanda e-posta veya telefon aracılığıyla geri dönüş yapılacaktır.",
73632
- contactFormCta: "Mesajınızı yazın",
73633
-
73634
- orderPackageStatus: {
73635
- unfulfilled: "Oluşturuldu",
73636
- readyForShipment: "Kargoya Hazır",
73637
- fulfilled: "Gönderildi",
73638
- partiallyFulfilled: "Kısmi Gönderildi",
73639
- delivered: "Teslim Edildi",
73640
- unableToDeliver: "Teslim Edilemedi",
73641
- cancelled: "İptal Edildi",
73642
- cancelRejected: "İptal Talebi Reddedildi",
73643
- cancelRequested: "İptal İstendi",
73644
- refunded: "İade Edildi",
73645
- refundRequestAccepted: "İade Talebi Onaylandı",
73646
- refundRejected: "İade Talebi Reddedildi",
73647
- refundRequested: "İade Talep Edildi",
73648
- },
73649
-
73650
- quantity: "Adet",
73651
- cartItemProduct: "ürün",
73652
- giftCodeErrorTitle: "İndirim Kodu Hatası",
73653
- giftCodeErrorDescription:
73654
- "İndirim kodunuz geçersiz veya sepetinizdeki ürünlere uygulanabilir değil. Lütfen kodunuzu kontrol edip tekrar deneyin.",
73655
- subtotal: "Ara Toplam",
73656
- total: "Toplam",
73657
- subtotalTooltip:
73658
- "Ara toplam, tüm geçerli indirimlerden önce siparişinizin toplam fiyatını yansıtır. kargo ücretini içermez.",
73659
- cartShippingTitle: "Teslimat / Kargo",
73660
- cartTaxTitle: "Vergi",
73661
- cartInterest: "Vade Farkı",
73662
- couponCode: "İndirim Kodu",
73663
- addCouponCode: "İndirim kodu ekle",
73664
- addOrderNote: "Sipariş notu ekle",
73665
- editOrderNote: "Sipariş notu düzenle",
73666
- orderNote: "Sipariş Notu",
73667
- enterPhoneNumber: "Telefon numarası girin",
73668
-
73669
- cardNumber: "Kart Numarası",
73670
- cardNumberError: "Geçerli bir kart numarası girin",
73671
- cardHolderName: "Kart Üzerindeki İsim",
73672
- cardHolderError: "Ad soyad girin",
73673
- cardExpiry: "Ay / Yıl",
73674
- cardExpiryError: "Geçerli bir tarih girin",
73675
- cardCVC: "CVC",
73676
- cardCVCError: "Geçerli bir güvenlik kodu girin",
73677
- cardCVCTooltip: "Kartınızın arkasındaki 3 haneli güvenlik kodu",
73678
-
73679
- errorCustomerRequired:
73680
- "Bu e-posta adresine ait kayıtlı bir hesap bulunuyor. Lütfen hesabınıza giriş yapınız.",
73681
- errorNoShipping: "Bulunduğunuz konuma gönderim yapılmamaktadır.",
73682
- errorPayment:
73683
- "Ödemeniz alınamadı. Lütfen bilgilerinizi kontrol edip tekrar deneyin.",
73684
- errorStockTitle: "Stoklar Güncellendi!",
73685
- errorStockDescription:
73686
- "Sepetinizdeki bazı ürünlerin stoğu tükenmiştir. Bu ürünleri sepetinizden çıkararak devam etmek ister misiniz?",
73687
- errorUnknown: "Beklenmedik bir hata oluştu. Lütfen tekrar deneyin.",
73688
- };
73689
-
73690
- var tr$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(null), tr, {
73691
- 'default': tr
73692
- }));
73693
-
73694
- var serverRuntimeConfig$2 = getConfig__default['default']().serverRuntimeConfig;
73695
- var themePath = path__default['default'].join(serverRuntimeConfig$2.PROJECT_ROOT);
73696
- var uploadTheme = function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
73697
- var theme, localization, uploadUrl, zipDir, stat, success, err_1;
73698
- return __generator(this, function (_a) {
73699
- switch (_a.label) {
73700
- case 0: return [4 /*yield*/, corsMiddleware(req, res)];
73701
- case 1:
73702
- _a.sent();
73703
- _a.label = 2;
73704
- case 2:
73705
- _a.trys.push([2, 9, , 10]);
73706
- return [4 /*yield*/, getTheme$1()];
73707
- case 3:
73708
- theme = _a.sent();
73709
- return [4 /*yield*/, readLocalizationFiles()];
73710
- case 4:
73711
- localization = _a.sent();
73712
- return [4 /*yield*/, saveTheme(theme, localization)];
73713
- case 5:
73714
- uploadUrl = _a.sent();
73715
- if (!(typeof uploadUrl === "string")) return [3 /*break*/, 8];
73716
- return [4 /*yield*/, archiveThemeCode()];
73717
- case 6:
73718
- zipDir = _a.sent();
73719
- stat = fs__default['default'].statSync(zipDir);
73720
- return [4 /*yield*/, _uploadTheme(uploadUrl, fs__default['default'].readFileSync(zipDir), stat.size)];
73721
- case 7:
73722
- success = _a.sent();
73723
- console.log(success);
73724
- if (success) {
73725
- buildTheme();
73726
- }
73727
- deleteThemeZip(zipDir);
73728
- _a.label = 8;
73729
- case 8:
73730
- res.statusCode = 200;
73731
- res.setHeader("Content-Type", "application/json");
73732
- res.json({ status: "ok" });
73733
- return [3 /*break*/, 10];
73734
- case 9:
73735
- err_1 = _a.sent();
73736
- console.log(err_1);
73737
- res.statusCode = 400;
73738
- res.setHeader("Content-Type", "application/json");
73739
- res.json({ status: "failed" });
73740
- return [3 /*break*/, 10];
73741
- case 10: return [2 /*return*/];
73742
- }
73743
- });
73744
- }); };
73745
- var config$3 = {};
73746
- function archiveThemeCode() {
73747
- return __awaiter(this, void 0, void 0, function () {
73748
- var filename, dirname, output, archive, excludedDirs, files;
73749
- return __generator(this, function (_a) {
73750
- switch (_a.label) {
73751
- case 0:
73752
- filename = "theme.zip";
73753
- dirname = path__default['default'].join(serverRuntimeConfig$2.PROJECT_ROOT, filename);
73754
- output = fs__default['default'].createWriteStream(dirname);
73755
- archive = archiver__default['default']("zip", {
73756
- zlib: {
73757
- level: 9,
73758
- },
73759
- });
73760
- archive.on("warning", function (err) {
73761
- if (err.code !== "ENOENT") {
73762
- throw err;
73763
- }
73764
- });
73765
- archive.on("error", function (err) {
73766
- throw err;
73767
- });
73768
- archive.pipe(output);
73769
- excludedDirs = ["node_modules", ".next", "out", ".git"];
73770
- files = fs__default['default'].readdirSync(themePath);
73771
- files.forEach(function (file) {
73772
- var filePath = path__default['default'].join(themePath, file);
73773
- var stat = fs__default['default'].lstatSync(filePath);
73774
- if (stat.isDirectory()) {
73775
- if (excludedDirs.includes(file))
73776
- return;
73777
- archive.directory(filePath, file);
73778
- }
73779
- else {
73780
- archive.file(filePath, { name: file });
73781
- }
73782
- });
73783
- return [4 /*yield*/, archive.finalize()];
73784
- case 1:
73785
- _a.sent();
73786
- return [2 /*return*/, new Promise(function (resolve) {
73787
- setTimeout(function () {
73788
- resolve(dirname);
73789
- }, 2000);
73790
- })];
73791
- }
73792
- });
73793
- });
73794
- }
73795
- function saveTheme(theme, localization) {
73796
- return __awaiter(this, void 0, void 0, function () {
73797
- var locales, defaultLocale_1, response, responseJSON, err_2;
73798
- return __generator(this, function (_a) {
73799
- switch (_a.label) {
73800
- case 0:
73801
- _a.trys.push([0, 3, , 4]);
73802
- locales = Object.keys(localization);
73803
- defaultLocale_1 = locales.some(function (l) { return l === "en"; }) ? "en" : locales[0];
73804
- return [4 /*yield*/, fetch$1(process.env.NEXT_PUBLIC_UPLOAD_GQL_URL, {
73805
- method: "POST",
73806
- body: JSON.stringify({
73807
- query: /* GraphQL */ "\n mutation saveTheme($saveThemeInput: SaveThemeInput!) {\n saveTheme(input: $saveThemeInput) {\n themeVersionId\n uploadUrl\n }\n }\n ",
73808
- variables: {
73809
- saveThemeInput: {
73810
- id: IkasStorefrontConfig.config.themeId,
73811
- themeJson: JSON.stringify(theme),
73812
- locales: Object.entries(localization).map(function (_a) {
73813
- var locale = _a[0], localeTranslations = _a[1];
73814
- return ({
73815
- isDefaultLocale: locale === defaultLocale_1,
73816
- locale: locale,
73817
- localeJson: JSON.stringify(localeTranslations),
73818
- });
73819
- }),
73820
- },
73821
- },
73822
- }),
73823
- headers: {
73824
- "x-api-key": IkasStorefrontConfig.config.apiKey,
73825
- "Content-Type": "application/json",
73826
- },
73827
- })];
73828
- case 1:
73829
- response = _a.sent();
73830
- return [4 /*yield*/, response.json()];
73831
- case 2:
73832
- responseJSON = _a.sent();
73833
- if (responseJSON.data && responseJSON.data.saveTheme) {
73834
- return [2 /*return*/, responseJSON.data.saveTheme.uploadUrl];
73835
- }
73836
- return [3 /*break*/, 4];
73837
- case 3:
73838
- err_2 = _a.sent();
73839
- console.log(err_2);
73840
- return [3 /*break*/, 4];
73841
- case 4: return [2 /*return*/];
73842
- }
73843
- });
73844
- });
73845
- }
73846
- function _uploadTheme(uploadUrl, file, size) {
73847
- return __awaiter(this, void 0, void 0, function () {
73848
- var config, res, err_3;
73849
- return __generator(this, function (_a) {
73850
- switch (_a.label) {
73851
- case 0:
73852
- config = {
73853
- headers: {
73854
- "Content-Type": "application/zip",
73855
- "Content-Length": size + "",
73856
- },
73857
- };
73858
- _a.label = 1;
73859
- case 1:
73860
- _a.trys.push([1, 3, , 4]);
73861
- return [4 /*yield*/, axios__default['default'].put(uploadUrl, file, config)];
73862
- case 2:
73863
- res = _a.sent();
73864
- return [2 /*return*/, res.status === 200];
73865
- case 3:
73866
- err_3 = _a.sent();
73867
- console.log(err_3);
73868
- return [2 /*return*/, false];
73869
- case 4: return [2 /*return*/];
73870
- }
73871
- });
73872
- });
73873
- }
73874
- function buildTheme() {
73875
- return __awaiter(this, void 0, void 0, function () {
73876
- var response, responseJSON, err_4;
73877
- return __generator(this, function (_a) {
73878
- switch (_a.label) {
73879
- case 0:
73880
- _a.trys.push([0, 3, , 4]);
73881
- return [4 /*yield*/, fetch$1(process.env.NEXT_PUBLIC_UPLOAD_GQL_URL, {
73882
- method: "POST",
73883
- body: JSON.stringify({
73884
- query: /* GraphQL */ "\n mutation buildTheme($buildThemeThemeId: String!) {\n buildTheme(themeId: $buildThemeThemeId)\n }\n ",
73885
- variables: {
73886
- buildThemeThemeId: IkasStorefrontConfig.config.themeId,
73887
- },
73888
- }),
73889
- headers: {
73890
- "x-api-key": IkasStorefrontConfig.config.apiKey,
73891
- "Content-Type": "application/json",
73892
- },
73893
- })];
73894
- case 1:
73895
- response = _a.sent();
73896
- return [4 /*yield*/, response.json()];
73897
- case 2:
73898
- responseJSON = _a.sent();
73899
- console.log(responseJSON);
73900
- return [3 /*break*/, 4];
73901
- case 3:
73902
- err_4 = _a.sent();
73903
- console.log(err_4);
73904
- return [3 /*break*/, 4];
73905
- case 4: return [2 /*return*/];
73906
- }
73907
- });
73908
- });
73909
- }
73910
- function getTheme$1() {
73911
- return new Promise(function (resolve, reject) {
73912
- var serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
73913
- var themePath = path__default['default'].join(serverRuntimeConfig.PROJECT_ROOT, "src", "theme.json");
73914
- fs__default['default'].readFile(themePath, function (err, file) {
73915
- if (err) {
73916
- return reject(err);
73917
- }
73918
- resolve(JSON.parse(file.toString()));
73919
- });
73920
- });
73921
- }
73922
- function deleteThemeZip(zipDir) {
73923
- fs__default['default'].unlinkSync(zipDir);
73924
- }
73925
- function readLocalizationFiles() {
73926
- return new Promise(function (resolve, reject) {
73927
- var serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
73928
- var localesPath = path__default['default'].join(serverRuntimeConfig.PROJECT_ROOT, "public", "locales");
73929
- var stripExtension = function (path) {
73930
- return path.length ? path.split(".")[0] : path;
73931
- };
73932
- fs__default['default'].readdir(localesPath, function (err, files) {
73933
- if (err) {
73934
- return reject(err);
73935
- }
73936
- var localeDirs = files.filter(function (file) {
73937
- return fs__default['default'].lstatSync(path__default['default'].join(localesPath, file)).isDirectory();
73938
- });
73939
- var locales = {};
73940
- var hasError = false;
73941
- localeDirs.forEach(function (locale) {
73942
- var localeDirPath = path__default['default'].join(serverRuntimeConfig.PROJECT_ROOT, "public", "locales", locale);
73943
- locales[locale] = {};
73944
- try {
73945
- var localeFiles = fs__default['default'].readdirSync(localeDirPath);
73946
- localeFiles.forEach(function (localeFile) {
73947
- var file = fs__default['default'].readFileSync(path__default['default'].join(serverRuntimeConfig.PROJECT_ROOT, "public", "locales", locale, localeFile));
73948
- var strippedLocale = stripExtension(locale).toLowerCase();
73949
- var namespace = stripExtension(localeFile).toLowerCase();
73950
- locales[strippedLocale][namespace] = JSON.parse(file.toString());
73951
- if (strippedLocale === "tr") {
73952
- locales[strippedLocale]["checkout-page"] = tr;
73953
- }
73954
- else {
73955
- locales[strippedLocale]["checkout-page"] = en;
73956
- }
73957
- });
73958
- }
73959
- catch (err) {
73960
- console.error(err);
73961
- hasError = true;
73962
- }
73963
- });
73964
- if (hasError)
73965
- reject(null);
73966
- else
73967
- resolve(locales);
73968
- });
73969
- });
73970
- }
73971
-
73972
- var UploadTheme = /*#__PURE__*/Object.freeze({
73973
- __proto__: null,
73974
- uploadTheme: uploadTheme,
73975
- config: config$3
73976
- });
73977
-
73978
- var IkasLocalThemeAPI = {
73979
- GetComponentDirs: GetComponentDirs,
73980
- GetTheme: GetTheme,
73981
- UpdateTheme: UpdateTheme,
73982
- UploadTheme: UploadTheme,
73983
- };
73984
-
73985
71900
  exports.AccountInfoForm = AccountInfoForm;
73986
71901
  exports.AccountPage = index$4;
73987
71902
  exports.AddressForm = AddressForm;
@@ -74031,6 +71946,7 @@ exports.IkasCategoryListPropValue = IkasCategoryListPropValue;
74031
71946
  exports.IkasCategoryPropValue = IkasCategoryPropValue;
74032
71947
  exports.IkasCheckout = IkasCheckout;
74033
71948
  exports.IkasCheckoutAPI = IkasCheckoutAPI;
71949
+ exports.IkasCheckoutCustomer = IkasCheckoutCustomer;
74034
71950
  exports.IkasCityAPI = IkasCityAPI;
74035
71951
  exports.IkasComponentRenderer = IkasComponentRenderer;
74036
71952
  exports.IkasContactForm = IkasContactForm;
@@ -74046,7 +71962,6 @@ exports.IkasHTMLMetaData = IkasHTMLMetaData;
74046
71962
  exports.IkasHTMLMetaDataAPI = IkasHTMLMetaDataAPI;
74047
71963
  exports.IkasImage = IkasImage;
74048
71964
  exports.IkasLinkPropValue = IkasLinkPropValue;
74049
- exports.IkasLocalThemeAPI = IkasLocalThemeAPI;
74050
71965
  exports.IkasMerchantAPI = IkasMerchantAPI;
74051
71966
  exports.IkasMerchantSettings = IkasMerchantSettings;
74052
71967
  exports.IkasNavigationLink = IkasNavigationLink;