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