@ikas/storefront 0.0.117 → 0.0.118
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/api/cart/__generated__/getCart.d.ts +1 -0
- package/build/api/checkout/index.d.ts +6 -1
- package/build/api/country/__generated__/listCountry.d.ts +4 -0
- package/build/api/country/index.d.ts +1 -1
- package/build/components/checkout/components/error-container/customer-login-required-error/index.d.ts +6 -0
- package/build/components/checkout/model.d.ts +2 -1
- package/build/index.es.js +100 -29
- package/build/index.js +100 -29
- package/build/models/data/order/address/index.d.ts +2 -0
- package/build/utils/providers/page-data.d.ts +1 -0
- package/package.json +1 -1
|
@@ -3,10 +3,11 @@ import * as SaleTransactionTypes from "./__generated__/createSaleTransactionWith
|
|
|
3
3
|
import * as CheckStocksTypes from "./__generated__/checkStocks";
|
|
4
4
|
import { IkasPaymentGateway } from "../../models/data/payment-gateway/index";
|
|
5
5
|
import { IkasCheckoutSettings } from "../../models/data/checkout-settings/index";
|
|
6
|
+
import { GraphQLError } from "graphql";
|
|
6
7
|
export declare class IkasCheckoutAPI {
|
|
7
8
|
static getCheckoutId(cartId: string): Promise<string | undefined>;
|
|
8
9
|
static getCheckoutById(id: string): Promise<IkasCheckout | undefined>;
|
|
9
|
-
static saveCheckout(checkout: IkasCheckout): Promise<
|
|
10
|
+
static saveCheckout(checkout: IkasCheckout): Promise<SaveCheckoutResponse | undefined>;
|
|
10
11
|
static createSaleTransactionWithCheckout(checkoutId: string, paymentGatewayId: string, paymentMethodDetail?: IkasPaymentMethodDetail): Promise<SaleTransactionTypes.createSaleTransactionWithCheckout_createSaleTransactionWithCheckout | undefined>;
|
|
11
12
|
static listPaymentGateway(idList?: string[]): Promise<IkasPaymentGateway[] | undefined>;
|
|
12
13
|
static retrieveInstallmentInfo(input: IkasInstallmentInfoInput): Promise<IkasInstallmentInfo | undefined>;
|
|
@@ -19,4 +20,8 @@ declare type CheckStocksLineInput = {
|
|
|
19
20
|
variantId: string;
|
|
20
21
|
productId: string;
|
|
21
22
|
};
|
|
23
|
+
declare type SaveCheckoutResponse = {
|
|
24
|
+
data: string | undefined;
|
|
25
|
+
errors: readonly GraphQLError[] | undefined;
|
|
26
|
+
};
|
|
22
27
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { StringFilterInput } from "../../../__generated__/global-types";
|
|
1
2
|
export interface listCountry_listCountry_locationTranslations {
|
|
2
3
|
__typename: "LocationTranslations";
|
|
3
4
|
tr: string;
|
|
@@ -16,3 +17,6 @@ export interface listCountry_listCountry {
|
|
|
16
17
|
export interface listCountry {
|
|
17
18
|
listCountry: listCountry_listCountry[];
|
|
18
19
|
}
|
|
20
|
+
export interface listCountryVariables {
|
|
21
|
+
iso2?: StringFilterInput | null;
|
|
22
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IkasCountry } from "../../models/index";
|
|
2
2
|
export declare class IkasCountryAPI {
|
|
3
|
-
static listCountries(): Promise<IkasCountry[]>;
|
|
3
|
+
static listCountries(iso2List?: string[]): Promise<IkasCountry[]>;
|
|
4
4
|
static listShippingCountries(salesChannelId: string): Promise<string[]>;
|
|
5
5
|
static getMyCountry(): Promise<string | null | undefined>;
|
|
6
6
|
}
|
package/build/index.es.js
CHANGED
|
@@ -12609,6 +12609,7 @@ var IkasOrderAddress = /** @class */ (function () {
|
|
|
12609
12609
|
this.identityNumber = null;
|
|
12610
12610
|
this.taxNumber = null;
|
|
12611
12611
|
this.taxOffice = null;
|
|
12612
|
+
this.isDistrictRequired = false;
|
|
12612
12613
|
this.addressLine1 = data.addressLine1 || null;
|
|
12613
12614
|
this.addressLine2 = data.addressLine2 || null;
|
|
12614
12615
|
this.country = data.country || null;
|
|
@@ -12650,7 +12651,7 @@ var IkasOrderAddress = /** @class */ (function () {
|
|
|
12650
12651
|
});
|
|
12651
12652
|
Object.defineProperty(IkasOrderAddress.prototype, "validationResult", {
|
|
12652
12653
|
get: function () {
|
|
12653
|
-
var _a, _b, _c, _d;
|
|
12654
|
+
var _a, _b, _c, _d, _e;
|
|
12654
12655
|
var isValidPhone = !!this.phone &&
|
|
12655
12656
|
this.phone.length >= 10 &&
|
|
12656
12657
|
validatePhoneNumber(this.phone);
|
|
@@ -12662,16 +12663,17 @@ var IkasOrderAddress = /** @class */ (function () {
|
|
|
12662
12663
|
country: !!this.country,
|
|
12663
12664
|
state: !!this.state,
|
|
12664
12665
|
city: !!this.city,
|
|
12665
|
-
|
|
12666
|
+
district: this.isDistrictRequired ? !!((_a = this.district) === null || _a === void 0 ? void 0 : _a.id) : true,
|
|
12667
|
+
phone: ((_b = this.checkoutSettings) === null || _b === void 0 ? void 0 : _b.phoneRequirement) ===
|
|
12666
12668
|
IkasCheckoutRequirementEnum.MANDATORY ||
|
|
12667
|
-
(((
|
|
12669
|
+
(((_c = this.checkoutSettings) === null || _c === void 0 ? void 0 : _c.phoneRequirement) ===
|
|
12668
12670
|
IkasCheckoutRequirementEnum.OPTIONAL &&
|
|
12669
12671
|
this.phone)
|
|
12670
12672
|
? isValidPhone
|
|
12671
12673
|
: true,
|
|
12672
|
-
identityNumber: ((
|
|
12674
|
+
identityNumber: ((_d = this.checkoutSettings) === null || _d === void 0 ? void 0 : _d.identityNumberRequirement) ===
|
|
12673
12675
|
IkasCheckoutRequirementEnum.MANDATORY ||
|
|
12674
|
-
(((
|
|
12676
|
+
(((_e = this.checkoutSettings) === null || _e === void 0 ? void 0 : _e.identityNumberRequirement) ===
|
|
12675
12677
|
IkasCheckoutRequirementEnum.OPTIONAL &&
|
|
12676
12678
|
this.phone)
|
|
12677
12679
|
? !!this.identityNumber
|
|
@@ -12692,6 +12694,7 @@ var IkasOrderAddress = /** @class */ (function () {
|
|
|
12692
12694
|
IkasOrderAddress.prototype.toJSON = function () {
|
|
12693
12695
|
var obj = __assign({}, this);
|
|
12694
12696
|
delete obj.checkoutSettings;
|
|
12697
|
+
delete obj.isDistrictRequired;
|
|
12695
12698
|
return obj;
|
|
12696
12699
|
};
|
|
12697
12700
|
return IkasOrderAddress;
|
|
@@ -17752,16 +17755,26 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
17752
17755
|
}); };
|
|
17753
17756
|
// VALIDATIONS END
|
|
17754
17757
|
this.saveCheckout = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
17755
|
-
var
|
|
17756
|
-
|
|
17757
|
-
|
|
17758
|
+
var response, firstError;
|
|
17759
|
+
var _a;
|
|
17760
|
+
return __generator(this, function (_b) {
|
|
17761
|
+
switch (_b.label) {
|
|
17758
17762
|
case 0: return [4 /*yield*/, IkasCheckoutAPI.saveCheckout(this.checkout)];
|
|
17759
17763
|
case 1:
|
|
17760
|
-
|
|
17761
|
-
if (
|
|
17762
|
-
|
|
17763
|
-
|
|
17764
|
-
|
|
17764
|
+
response = _b.sent();
|
|
17765
|
+
if ((response === null || response === void 0 ? void 0 : response.errors) && response.errors.length) {
|
|
17766
|
+
firstError = response.errors[0];
|
|
17767
|
+
if (((_a = firstError.extensions) === null || _a === void 0 ? void 0 : _a.code) === "CUSTOMER_LOGIN_REQUIRED") {
|
|
17768
|
+
throw {
|
|
17769
|
+
type: ErrorType.CUSTOMER_LOGIN_REQUIRED_ERROR,
|
|
17770
|
+
};
|
|
17771
|
+
}
|
|
17772
|
+
else {
|
|
17773
|
+
throw {
|
|
17774
|
+
type: ErrorType.API_ERROR,
|
|
17775
|
+
};
|
|
17776
|
+
}
|
|
17777
|
+
}
|
|
17765
17778
|
return [2 /*return*/];
|
|
17766
17779
|
}
|
|
17767
17780
|
});
|
|
@@ -17871,7 +17884,7 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
17871
17884
|
if (_pg)
|
|
17872
17885
|
orderedPaymentGateways.push(_pg);
|
|
17873
17886
|
});
|
|
17874
|
-
this.paymentGateways = orderedPaymentGateways;
|
|
17887
|
+
this.paymentGateways = isLocal ? paymentGateways : orderedPaymentGateways;
|
|
17875
17888
|
if (!this.paymentGatewayId)
|
|
17876
17889
|
this.setPaymentGateway(0);
|
|
17877
17890
|
return [2 /*return*/];
|
|
@@ -17954,6 +17967,8 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
17954
17967
|
if (address)
|
|
17955
17968
|
_this.checkout.shippingAddress = new IkasOrderAddress(address);
|
|
17956
17969
|
}
|
|
17970
|
+
if (_this.checkout.shippingAddress)
|
|
17971
|
+
_this.checkout.shippingAddress.checkoutSettings = _this.checkoutSettings;
|
|
17957
17972
|
};
|
|
17958
17973
|
this.onSelectedBillingAddressIdChange = function (value) {
|
|
17959
17974
|
var _a;
|
|
@@ -17966,6 +17981,8 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
17966
17981
|
if (address)
|
|
17967
17982
|
_this.checkout.billingAddress = new IkasOrderAddress(address);
|
|
17968
17983
|
}
|
|
17984
|
+
if (_this.checkout.billingAddress)
|
|
17985
|
+
_this.checkout.billingAddress.checkoutSettings = _this.checkoutSettings;
|
|
17969
17986
|
};
|
|
17970
17987
|
this.onTermsAndConditionsCheckedChange = function (value) {
|
|
17971
17988
|
_this.isTermsAndConditionsChecked = value;
|
|
@@ -18385,6 +18402,7 @@ var ErrorType;
|
|
|
18385
18402
|
ErrorType[ErrorType["STOCK_ERROR"] = 2] = "STOCK_ERROR";
|
|
18386
18403
|
ErrorType[ErrorType["PAYMENT_ERROR"] = 3] = "PAYMENT_ERROR";
|
|
18387
18404
|
ErrorType[ErrorType["NO_SHIPPING_ERROR"] = 4] = "NO_SHIPPING_ERROR";
|
|
18405
|
+
ErrorType[ErrorType["CUSTOMER_LOGIN_REQUIRED_ERROR"] = 5] = "CUSTOMER_LOGIN_REQUIRED_ERROR";
|
|
18388
18406
|
})(ErrorType || (ErrorType = {}));
|
|
18389
18407
|
|
|
18390
18408
|
var isServer$2 = typeof window === "undefined";
|
|
@@ -24408,7 +24426,7 @@ var IkasCartAPI = /** @class */ (function () {
|
|
|
24408
24426
|
return __generator(this, function (_b) {
|
|
24409
24427
|
switch (_b.label) {
|
|
24410
24428
|
case 0:
|
|
24411
|
-
QUERY = src(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n query getCart($cartId: String
|
|
24429
|
+
QUERY = src(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n query getCart(\n $cartId: String\n $customerId: String\n $storefrontRoutingId: String\n ) {\n getCart(\n id: $cartId\n customerId: $customerId\n storefrontRoutingId: $storefrontRoutingId\n ) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\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 slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\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 }\n "], ["\n query getCart(\n $cartId: String\n $customerId: String\n $storefrontRoutingId: String\n ) {\n getCart(\n id: $cartId\n customerId: $customerId\n storefrontRoutingId: $storefrontRoutingId\n ) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\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 slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\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 }\n "])));
|
|
24412
24430
|
_b.label = 1;
|
|
24413
24431
|
case 1:
|
|
24414
24432
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -24419,6 +24437,7 @@ var IkasCartAPI = /** @class */ (function () {
|
|
|
24419
24437
|
variables: {
|
|
24420
24438
|
cartId: cartId,
|
|
24421
24439
|
customerId: customerId,
|
|
24440
|
+
storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId,
|
|
24422
24441
|
},
|
|
24423
24442
|
})];
|
|
24424
24443
|
case 2:
|
|
@@ -24760,15 +24779,19 @@ var IkasCheckoutAPI = /** @class */ (function () {
|
|
|
24760
24779
|
})];
|
|
24761
24780
|
case 2:
|
|
24762
24781
|
_e = _f.sent(), data = _e.data, errors = _e.errors;
|
|
24763
|
-
|
|
24764
|
-
|
|
24765
|
-
|
|
24766
|
-
|
|
24767
|
-
return [2 /*return*/, data.saveCheckout.id || undefined];
|
|
24768
|
-
return [3 /*break*/, 4];
|
|
24782
|
+
return [2 /*return*/, {
|
|
24783
|
+
data: (data === null || data === void 0 ? void 0 : data.saveCheckout.id) || undefined,
|
|
24784
|
+
errors: errors,
|
|
24785
|
+
}];
|
|
24769
24786
|
case 3:
|
|
24770
24787
|
err_3 = _f.sent();
|
|
24771
24788
|
console.log(err_3);
|
|
24789
|
+
if (err_3 && err_3.graphQLErrors) {
|
|
24790
|
+
return [2 /*return*/, {
|
|
24791
|
+
data: undefined,
|
|
24792
|
+
errors: err_3.graphQLErrors,
|
|
24793
|
+
}];
|
|
24794
|
+
}
|
|
24772
24795
|
return [3 /*break*/, 4];
|
|
24773
24796
|
case 4: return [2 /*return*/];
|
|
24774
24797
|
}
|
|
@@ -25015,18 +25038,21 @@ var templateObject_1$4;
|
|
|
25015
25038
|
var IkasCountryAPI = /** @class */ (function () {
|
|
25016
25039
|
function IkasCountryAPI() {
|
|
25017
25040
|
}
|
|
25018
|
-
IkasCountryAPI.listCountries = function () {
|
|
25041
|
+
IkasCountryAPI.listCountries = function (iso2List) {
|
|
25019
25042
|
return __awaiter(this, void 0, void 0, function () {
|
|
25020
25043
|
var QUERY, _a, data, errors, err_1;
|
|
25021
25044
|
return __generator(this, function (_b) {
|
|
25022
25045
|
switch (_b.label) {
|
|
25023
25046
|
case 0:
|
|
25024
|
-
QUERY = src(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n query listCountry {\n listCountry {\n id\n name\n native\n iso2\n iso3\n phoneCode\n locationTranslations {\n tr\n en\n }\n }\n }\n "], ["\n query listCountry {\n listCountry {\n id\n name\n native\n iso2\n iso3\n phoneCode\n locationTranslations {\n tr\n en\n }\n }\n }\n "])));
|
|
25047
|
+
QUERY = src(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n query listCountry($iso2: StringFilterInput) {\n listCountry(iso2: $iso2) {\n id\n name\n native\n iso2\n iso3\n phoneCode\n locationTranslations {\n tr\n en\n }\n }\n }\n "], ["\n query listCountry($iso2: StringFilterInput) {\n listCountry(iso2: $iso2) {\n id\n name\n native\n iso2\n iso3\n phoneCode\n locationTranslations {\n tr\n en\n }\n }\n }\n "])));
|
|
25025
25048
|
_b.label = 1;
|
|
25026
25049
|
case 1:
|
|
25027
25050
|
_b.trys.push([1, 3, , 4]);
|
|
25028
25051
|
return [4 /*yield*/, apollo.getClient().query({
|
|
25029
25052
|
query: QUERY,
|
|
25053
|
+
variables: {
|
|
25054
|
+
iso2: iso2List ? { in: iso2List } : undefined,
|
|
25055
|
+
},
|
|
25030
25056
|
})];
|
|
25031
25057
|
case 2:
|
|
25032
25058
|
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
@@ -25751,6 +25777,7 @@ var IkasProductSearchAPI = /** @class */ (function () {
|
|
|
25751
25777
|
}());
|
|
25752
25778
|
function simpleToProduct(simple) {
|
|
25753
25779
|
var _a, _b, _c, _d, _e, _f;
|
|
25780
|
+
var isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
25754
25781
|
return new IkasProduct({
|
|
25755
25782
|
id: simple.id,
|
|
25756
25783
|
attributes: (_a = simple.attributes) === null || _a === void 0 ? void 0 : _a.map(function (a) {
|
|
@@ -25843,7 +25870,10 @@ function simpleToProduct(simple) {
|
|
|
25843
25870
|
: p.priceListId === null;
|
|
25844
25871
|
})),
|
|
25845
25872
|
stock: v.stocks
|
|
25846
|
-
.filter(function (s) {
|
|
25873
|
+
.filter(function (s) {
|
|
25874
|
+
var _a;
|
|
25875
|
+
return isLocal || ((_a = IkasStorefrontConfig.stockLocationIds) === null || _a === void 0 ? void 0 : _a.includes(s.stockLocationId));
|
|
25876
|
+
})
|
|
25847
25877
|
.reduce(function (total, current) { return current.stockCount + total; }, 0) || 0,
|
|
25848
25878
|
variantValues: (_d = v.variantValues) === null || _d === void 0 ? void 0 : _d.map(function (vv) {
|
|
25849
25879
|
var pvt = simple.productVariantTypes.find(function (pvt) { return pvt.variantType.id === vv.variantTypeId; });
|
|
@@ -26455,6 +26485,8 @@ var AddressFormViewModel = /** @class */ (function () {
|
|
|
26455
26485
|
return [4 /*yield*/, IkasDistrictAPI.listDistricts(this.city.id, (_c = this.state) === null || _c === void 0 ? void 0 : _c.id)];
|
|
26456
26486
|
case 2:
|
|
26457
26487
|
_a.districts = _d.sent();
|
|
26488
|
+
if (this.districts.length)
|
|
26489
|
+
this.address.isDistrictRequired = true;
|
|
26458
26490
|
return [3 /*break*/, 4];
|
|
26459
26491
|
case 3:
|
|
26460
26492
|
_d.sent();
|
|
@@ -26483,7 +26515,10 @@ var AddressFormViewModel = /** @class */ (function () {
|
|
|
26483
26515
|
_this.address.phone = value;
|
|
26484
26516
|
};
|
|
26485
26517
|
this.onIdentityNumberChange = function (value) {
|
|
26486
|
-
|
|
26518
|
+
if (!value)
|
|
26519
|
+
_this.address.identityNumber = "";
|
|
26520
|
+
else if (value.length <= 11)
|
|
26521
|
+
_this.address.identityNumber = value;
|
|
26487
26522
|
};
|
|
26488
26523
|
this.onAddressLine1Change = function (value) {
|
|
26489
26524
|
_this.address.addressLine1 = value;
|
|
@@ -26703,7 +26738,7 @@ var AddressForm$1 = observer(function (_a) {
|
|
|
26703
26738
|
createElement(FormItem, { type: FormItemType.SELECT, label: "\u00DClke", autocomplete: "country-name", value: ((_b = vm.country) === null || _b === void 0 ? void 0 : _b.id) || "", onChange: vm.onCountryChange, options: vm.countryOptions, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.country), errorText: "Ülke seçin" }),
|
|
26704
26739
|
vm.hasState && (createElement(FormItem, { type: FormItemType.SELECT, label: "Eyalet", value: ((_c = vm.state) === null || _c === void 0 ? void 0 : _c.id) || "", onChange: vm.onStateChange, options: vm.stateOptions, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.state), errorText: "Eyalet seçin" })),
|
|
26705
26740
|
createElement(FormItem, { type: FormItemType.SELECT, label: "\u0130l", value: ((_d = vm.city) === null || _d === void 0 ? void 0 : _d.id) || "", onChange: vm.onCityChange, options: vm.cityOptions, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.city), errorText: "Şehir seçin" }),
|
|
26706
|
-
vm.districtOptions.length ? (createElement(FormItem, { type: FormItemType.SELECT, label: "\u0130l\u00E7e", value: ((_e = vm.district) === null || _e === void 0 ? void 0 : _e.id) || "", onChange: vm.onDistrictChange, options: vm.districtOptions, errorText: "İlçe seçin" })) : (createElement(FormItem, { type: FormItemType.TEXT, label: "\u0130l\u00E7e", value: ((_f = vm.district) === null || _f === void 0 ? void 0 : _f.name) || "", onChange: vm.onDistrictInputChange })),
|
|
26741
|
+
vm.districtOptions.length ? (createElement(FormItem, { type: FormItemType.SELECT, label: "\u0130l\u00E7e", value: ((_e = vm.district) === null || _e === void 0 ? void 0 : _e.id) || "", onChange: vm.onDistrictChange, options: vm.districtOptions, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.district), errorText: "İlçe seçin" })) : (createElement(FormItem, { type: FormItemType.TEXT, label: "\u0130l\u00E7e", value: ((_f = vm.district) === null || _f === void 0 ? void 0 : _f.name) || "", onChange: vm.onDistrictInputChange })),
|
|
26707
26742
|
!!vm.address.checkoutSettings &&
|
|
26708
26743
|
vm.address.checkoutSettings.phoneRequirement !==
|
|
26709
26744
|
IkasCheckoutRequirementEnum.INVISIBLE && (createElement(FormItem, { type: FormItemType.TEXT, label: "Telefon", autocomplete: "tel", value: vm.phone || "", onChange: vm.onPhoneChange, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.phone), errorText: "Geçerli bir telefon girin" })),
|
|
@@ -27771,6 +27806,14 @@ function createCategoryBreadcrumbSchema(pageSpecificDataStr) {
|
|
|
27771
27806
|
catch (_a) { }
|
|
27772
27807
|
}
|
|
27773
27808
|
|
|
27809
|
+
var CustomerLoginRequiredError = observer(function (_a) {
|
|
27810
|
+
var onClose = _a.onClose;
|
|
27811
|
+
return (createElement(ErrorContainer, { onClose: onClose },
|
|
27812
|
+
createElement("div", null,
|
|
27813
|
+
" ",
|
|
27814
|
+
"Bu email ile i\u015Fleme devam edebilmek i\u00E7in l\u00FCtfen giri\u015F yap\u0131n\u0131z.")));
|
|
27815
|
+
});
|
|
27816
|
+
|
|
27774
27817
|
var IkasCheckoutPage = observer(function (_a) {
|
|
27775
27818
|
var _b, _c, _d;
|
|
27776
27819
|
var checkout = _a.checkout, checkoutSettings = _a.checkoutSettings, returnPolicy = _a.returnPolicy, privacyPolicy = _a.privacyPolicy, termsOfService = _a.termsOfService, queryParams = _a.queryParams;
|
|
@@ -27830,6 +27873,9 @@ var IkasCheckoutPage = observer(function (_a) {
|
|
|
27830
27873
|
var renderNoShipingError = function () {
|
|
27831
27874
|
return createElement(NoShippingError, { onClose: onErrorClose });
|
|
27832
27875
|
};
|
|
27876
|
+
var renderCustomerLoginRequiredError = function () {
|
|
27877
|
+
return createElement(CustomerLoginRequiredError, { onClose: onErrorClose });
|
|
27878
|
+
};
|
|
27833
27879
|
var renderError = function () {
|
|
27834
27880
|
var _a;
|
|
27835
27881
|
switch ((_a = vm.error) === null || _a === void 0 ? void 0 : _a.type) {
|
|
@@ -27839,6 +27885,8 @@ var IkasCheckoutPage = observer(function (_a) {
|
|
|
27839
27885
|
return renderPaymentError();
|
|
27840
27886
|
case ErrorType.NO_SHIPPING_ERROR:
|
|
27841
27887
|
return renderNoShipingError();
|
|
27888
|
+
case ErrorType.CUSTOMER_LOGIN_REQUIRED_ERROR:
|
|
27889
|
+
return renderCustomerLoginRequiredError();
|
|
27842
27890
|
case ErrorType.API_ERROR:
|
|
27843
27891
|
case ErrorType.UNKNOWN:
|
|
27844
27892
|
return renderUnknownError();
|
|
@@ -28675,7 +28723,8 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
28675
28723
|
id: storefront.salesChannelId,
|
|
28676
28724
|
}),
|
|
28677
28725
|
routing: storefront.routings.length
|
|
28678
|
-
? storefront.routings
|
|
28726
|
+
? storefront.routings.find(function (r) { return !r.path && !r.domain; }) ||
|
|
28727
|
+
storefront.routings[0]
|
|
28679
28728
|
: new IkasStorefrontRouting({}),
|
|
28680
28729
|
});
|
|
28681
28730
|
return [3 /*break*/, 5];
|
|
@@ -29386,6 +29435,27 @@ var _404 = /*#__PURE__*/Object.freeze({
|
|
|
29386
29435
|
getStaticProps: getStaticProps$d
|
|
29387
29436
|
});
|
|
29388
29437
|
|
|
29438
|
+
/**
|
|
29439
|
+
* Flattens `array` a single level deep.
|
|
29440
|
+
*
|
|
29441
|
+
* @static
|
|
29442
|
+
* @memberOf _
|
|
29443
|
+
* @since 0.1.0
|
|
29444
|
+
* @category Array
|
|
29445
|
+
* @param {Array} array The array to flatten.
|
|
29446
|
+
* @returns {Array} Returns the new flattened array.
|
|
29447
|
+
* @example
|
|
29448
|
+
*
|
|
29449
|
+
* _.flatten([1, [2, [3, [4]], 5]]);
|
|
29450
|
+
* // => [1, 2, [3, [4]], 5]
|
|
29451
|
+
*/
|
|
29452
|
+
function flatten(array) {
|
|
29453
|
+
var length = array == null ? 0 : array.length;
|
|
29454
|
+
return length ? _baseFlatten(array, 1) : [];
|
|
29455
|
+
}
|
|
29456
|
+
|
|
29457
|
+
var flatten_1 = flatten;
|
|
29458
|
+
|
|
29389
29459
|
configure({
|
|
29390
29460
|
enforceActions: "never",
|
|
29391
29461
|
});
|
|
@@ -29405,7 +29475,7 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
29405
29475
|
}
|
|
29406
29476
|
IkasBaseStore.prototype.checkLocalization = function () {
|
|
29407
29477
|
return __awaiter(this, void 0, void 0, function () {
|
|
29408
|
-
var myCountryCode, currentRouting, isCorrectLocale, myCountryRouting, otherCountriesRouting, countries_1, localeOptions_1;
|
|
29478
|
+
var myCountryCode, currentRouting, isCorrectLocale, myCountryRouting, otherCountriesRouting, iso2Codes, countries_1, localeOptions_1;
|
|
29409
29479
|
return __generator(this, function (_a) {
|
|
29410
29480
|
switch (_a.label) {
|
|
29411
29481
|
case 0:
|
|
@@ -29436,7 +29506,8 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
29436
29506
|
isCorrectLocale = false;
|
|
29437
29507
|
}
|
|
29438
29508
|
}
|
|
29439
|
-
|
|
29509
|
+
iso2Codes = flatten_1(IkasStorefrontConfig.routings.map(function (r) { return r.countryCodes || []; }));
|
|
29510
|
+
return [4 /*yield*/, IkasCountryAPI.listCountries(iso2Codes)];
|
|
29440
29511
|
case 2:
|
|
29441
29512
|
countries_1 = _a.sent();
|
|
29442
29513
|
localeOptions_1 = [];
|
package/build/index.js
CHANGED
|
@@ -12623,6 +12623,7 @@ var IkasOrderAddress = /** @class */ (function () {
|
|
|
12623
12623
|
this.identityNumber = null;
|
|
12624
12624
|
this.taxNumber = null;
|
|
12625
12625
|
this.taxOffice = null;
|
|
12626
|
+
this.isDistrictRequired = false;
|
|
12626
12627
|
this.addressLine1 = data.addressLine1 || null;
|
|
12627
12628
|
this.addressLine2 = data.addressLine2 || null;
|
|
12628
12629
|
this.country = data.country || null;
|
|
@@ -12664,7 +12665,7 @@ var IkasOrderAddress = /** @class */ (function () {
|
|
|
12664
12665
|
});
|
|
12665
12666
|
Object.defineProperty(IkasOrderAddress.prototype, "validationResult", {
|
|
12666
12667
|
get: function () {
|
|
12667
|
-
var _a, _b, _c, _d;
|
|
12668
|
+
var _a, _b, _c, _d, _e;
|
|
12668
12669
|
var isValidPhone = !!this.phone &&
|
|
12669
12670
|
this.phone.length >= 10 &&
|
|
12670
12671
|
validatePhoneNumber(this.phone);
|
|
@@ -12676,16 +12677,17 @@ var IkasOrderAddress = /** @class */ (function () {
|
|
|
12676
12677
|
country: !!this.country,
|
|
12677
12678
|
state: !!this.state,
|
|
12678
12679
|
city: !!this.city,
|
|
12679
|
-
|
|
12680
|
+
district: this.isDistrictRequired ? !!((_a = this.district) === null || _a === void 0 ? void 0 : _a.id) : true,
|
|
12681
|
+
phone: ((_b = this.checkoutSettings) === null || _b === void 0 ? void 0 : _b.phoneRequirement) ===
|
|
12680
12682
|
IkasCheckoutRequirementEnum.MANDATORY ||
|
|
12681
|
-
(((
|
|
12683
|
+
(((_c = this.checkoutSettings) === null || _c === void 0 ? void 0 : _c.phoneRequirement) ===
|
|
12682
12684
|
IkasCheckoutRequirementEnum.OPTIONAL &&
|
|
12683
12685
|
this.phone)
|
|
12684
12686
|
? isValidPhone
|
|
12685
12687
|
: true,
|
|
12686
|
-
identityNumber: ((
|
|
12688
|
+
identityNumber: ((_d = this.checkoutSettings) === null || _d === void 0 ? void 0 : _d.identityNumberRequirement) ===
|
|
12687
12689
|
IkasCheckoutRequirementEnum.MANDATORY ||
|
|
12688
|
-
(((
|
|
12690
|
+
(((_e = this.checkoutSettings) === null || _e === void 0 ? void 0 : _e.identityNumberRequirement) ===
|
|
12689
12691
|
IkasCheckoutRequirementEnum.OPTIONAL &&
|
|
12690
12692
|
this.phone)
|
|
12691
12693
|
? !!this.identityNumber
|
|
@@ -12706,6 +12708,7 @@ var IkasOrderAddress = /** @class */ (function () {
|
|
|
12706
12708
|
IkasOrderAddress.prototype.toJSON = function () {
|
|
12707
12709
|
var obj = __assign({}, this);
|
|
12708
12710
|
delete obj.checkoutSettings;
|
|
12711
|
+
delete obj.isDistrictRequired;
|
|
12709
12712
|
return obj;
|
|
12710
12713
|
};
|
|
12711
12714
|
return IkasOrderAddress;
|
|
@@ -17758,16 +17761,26 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
17758
17761
|
}); };
|
|
17759
17762
|
// VALIDATIONS END
|
|
17760
17763
|
this.saveCheckout = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
17761
|
-
var
|
|
17762
|
-
|
|
17763
|
-
|
|
17764
|
+
var response, firstError;
|
|
17765
|
+
var _a;
|
|
17766
|
+
return __generator(this, function (_b) {
|
|
17767
|
+
switch (_b.label) {
|
|
17764
17768
|
case 0: return [4 /*yield*/, IkasCheckoutAPI.saveCheckout(this.checkout)];
|
|
17765
17769
|
case 1:
|
|
17766
|
-
|
|
17767
|
-
if (
|
|
17768
|
-
|
|
17769
|
-
|
|
17770
|
-
|
|
17770
|
+
response = _b.sent();
|
|
17771
|
+
if ((response === null || response === void 0 ? void 0 : response.errors) && response.errors.length) {
|
|
17772
|
+
firstError = response.errors[0];
|
|
17773
|
+
if (((_a = firstError.extensions) === null || _a === void 0 ? void 0 : _a.code) === "CUSTOMER_LOGIN_REQUIRED") {
|
|
17774
|
+
throw {
|
|
17775
|
+
type: ErrorType.CUSTOMER_LOGIN_REQUIRED_ERROR,
|
|
17776
|
+
};
|
|
17777
|
+
}
|
|
17778
|
+
else {
|
|
17779
|
+
throw {
|
|
17780
|
+
type: ErrorType.API_ERROR,
|
|
17781
|
+
};
|
|
17782
|
+
}
|
|
17783
|
+
}
|
|
17771
17784
|
return [2 /*return*/];
|
|
17772
17785
|
}
|
|
17773
17786
|
});
|
|
@@ -17877,7 +17890,7 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
17877
17890
|
if (_pg)
|
|
17878
17891
|
orderedPaymentGateways.push(_pg);
|
|
17879
17892
|
});
|
|
17880
|
-
this.paymentGateways = orderedPaymentGateways;
|
|
17893
|
+
this.paymentGateways = isLocal ? paymentGateways : orderedPaymentGateways;
|
|
17881
17894
|
if (!this.paymentGatewayId)
|
|
17882
17895
|
this.setPaymentGateway(0);
|
|
17883
17896
|
return [2 /*return*/];
|
|
@@ -17960,6 +17973,8 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
17960
17973
|
if (address)
|
|
17961
17974
|
_this.checkout.shippingAddress = new IkasOrderAddress(address);
|
|
17962
17975
|
}
|
|
17976
|
+
if (_this.checkout.shippingAddress)
|
|
17977
|
+
_this.checkout.shippingAddress.checkoutSettings = _this.checkoutSettings;
|
|
17963
17978
|
};
|
|
17964
17979
|
this.onSelectedBillingAddressIdChange = function (value) {
|
|
17965
17980
|
var _a;
|
|
@@ -17972,6 +17987,8 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
17972
17987
|
if (address)
|
|
17973
17988
|
_this.checkout.billingAddress = new IkasOrderAddress(address);
|
|
17974
17989
|
}
|
|
17990
|
+
if (_this.checkout.billingAddress)
|
|
17991
|
+
_this.checkout.billingAddress.checkoutSettings = _this.checkoutSettings;
|
|
17975
17992
|
};
|
|
17976
17993
|
this.onTermsAndConditionsCheckedChange = function (value) {
|
|
17977
17994
|
_this.isTermsAndConditionsChecked = value;
|
|
@@ -18391,6 +18408,7 @@ var ErrorType;
|
|
|
18391
18408
|
ErrorType[ErrorType["STOCK_ERROR"] = 2] = "STOCK_ERROR";
|
|
18392
18409
|
ErrorType[ErrorType["PAYMENT_ERROR"] = 3] = "PAYMENT_ERROR";
|
|
18393
18410
|
ErrorType[ErrorType["NO_SHIPPING_ERROR"] = 4] = "NO_SHIPPING_ERROR";
|
|
18411
|
+
ErrorType[ErrorType["CUSTOMER_LOGIN_REQUIRED_ERROR"] = 5] = "CUSTOMER_LOGIN_REQUIRED_ERROR";
|
|
18394
18412
|
})(ErrorType || (ErrorType = {}));
|
|
18395
18413
|
|
|
18396
18414
|
var isServer$2 = typeof window === "undefined";
|
|
@@ -24388,7 +24406,7 @@ var IkasCartAPI = /** @class */ (function () {
|
|
|
24388
24406
|
return __generator(this, function (_b) {
|
|
24389
24407
|
switch (_b.label) {
|
|
24390
24408
|
case 0:
|
|
24391
|
-
QUERY = src(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n query getCart($cartId: String
|
|
24409
|
+
QUERY = src(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n query getCart(\n $cartId: String\n $customerId: String\n $storefrontRoutingId: String\n ) {\n getCart(\n id: $cartId\n customerId: $customerId\n storefrontRoutingId: $storefrontRoutingId\n ) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\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 slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\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 }\n "], ["\n query getCart(\n $cartId: String\n $customerId: String\n $storefrontRoutingId: String\n ) {\n getCart(\n id: $cartId\n customerId: $customerId\n storefrontRoutingId: $storefrontRoutingId\n ) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\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 slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\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 }\n "])));
|
|
24392
24410
|
_b.label = 1;
|
|
24393
24411
|
case 1:
|
|
24394
24412
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -24399,6 +24417,7 @@ var IkasCartAPI = /** @class */ (function () {
|
|
|
24399
24417
|
variables: {
|
|
24400
24418
|
cartId: cartId,
|
|
24401
24419
|
customerId: customerId,
|
|
24420
|
+
storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId,
|
|
24402
24421
|
},
|
|
24403
24422
|
})];
|
|
24404
24423
|
case 2:
|
|
@@ -24740,15 +24759,19 @@ var IkasCheckoutAPI = /** @class */ (function () {
|
|
|
24740
24759
|
})];
|
|
24741
24760
|
case 2:
|
|
24742
24761
|
_e = _f.sent(), data = _e.data, errors = _e.errors;
|
|
24743
|
-
|
|
24744
|
-
|
|
24745
|
-
|
|
24746
|
-
|
|
24747
|
-
return [2 /*return*/, data.saveCheckout.id || undefined];
|
|
24748
|
-
return [3 /*break*/, 4];
|
|
24762
|
+
return [2 /*return*/, {
|
|
24763
|
+
data: (data === null || data === void 0 ? void 0 : data.saveCheckout.id) || undefined,
|
|
24764
|
+
errors: errors,
|
|
24765
|
+
}];
|
|
24749
24766
|
case 3:
|
|
24750
24767
|
err_3 = _f.sent();
|
|
24751
24768
|
console.log(err_3);
|
|
24769
|
+
if (err_3 && err_3.graphQLErrors) {
|
|
24770
|
+
return [2 /*return*/, {
|
|
24771
|
+
data: undefined,
|
|
24772
|
+
errors: err_3.graphQLErrors,
|
|
24773
|
+
}];
|
|
24774
|
+
}
|
|
24752
24775
|
return [3 /*break*/, 4];
|
|
24753
24776
|
case 4: return [2 /*return*/];
|
|
24754
24777
|
}
|
|
@@ -24995,18 +25018,21 @@ var templateObject_1$4;
|
|
|
24995
25018
|
var IkasCountryAPI = /** @class */ (function () {
|
|
24996
25019
|
function IkasCountryAPI() {
|
|
24997
25020
|
}
|
|
24998
|
-
IkasCountryAPI.listCountries = function () {
|
|
25021
|
+
IkasCountryAPI.listCountries = function (iso2List) {
|
|
24999
25022
|
return __awaiter(this, void 0, void 0, function () {
|
|
25000
25023
|
var QUERY, _a, data, errors, err_1;
|
|
25001
25024
|
return __generator(this, function (_b) {
|
|
25002
25025
|
switch (_b.label) {
|
|
25003
25026
|
case 0:
|
|
25004
|
-
QUERY = src(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n query listCountry {\n listCountry {\n id\n name\n native\n iso2\n iso3\n phoneCode\n locationTranslations {\n tr\n en\n }\n }\n }\n "], ["\n query listCountry {\n listCountry {\n id\n name\n native\n iso2\n iso3\n phoneCode\n locationTranslations {\n tr\n en\n }\n }\n }\n "])));
|
|
25027
|
+
QUERY = src(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n query listCountry($iso2: StringFilterInput) {\n listCountry(iso2: $iso2) {\n id\n name\n native\n iso2\n iso3\n phoneCode\n locationTranslations {\n tr\n en\n }\n }\n }\n "], ["\n query listCountry($iso2: StringFilterInput) {\n listCountry(iso2: $iso2) {\n id\n name\n native\n iso2\n iso3\n phoneCode\n locationTranslations {\n tr\n en\n }\n }\n }\n "])));
|
|
25005
25028
|
_b.label = 1;
|
|
25006
25029
|
case 1:
|
|
25007
25030
|
_b.trys.push([1, 3, , 4]);
|
|
25008
25031
|
return [4 /*yield*/, apollo.getClient().query({
|
|
25009
25032
|
query: QUERY,
|
|
25033
|
+
variables: {
|
|
25034
|
+
iso2: iso2List ? { in: iso2List } : undefined,
|
|
25035
|
+
},
|
|
25010
25036
|
})];
|
|
25011
25037
|
case 2:
|
|
25012
25038
|
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
@@ -25731,6 +25757,7 @@ var IkasProductSearchAPI = /** @class */ (function () {
|
|
|
25731
25757
|
}());
|
|
25732
25758
|
function simpleToProduct(simple) {
|
|
25733
25759
|
var _a, _b, _c, _d, _e, _f;
|
|
25760
|
+
var isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
25734
25761
|
return new IkasProduct({
|
|
25735
25762
|
id: simple.id,
|
|
25736
25763
|
attributes: (_a = simple.attributes) === null || _a === void 0 ? void 0 : _a.map(function (a) {
|
|
@@ -25823,7 +25850,10 @@ function simpleToProduct(simple) {
|
|
|
25823
25850
|
: p.priceListId === null;
|
|
25824
25851
|
})),
|
|
25825
25852
|
stock: v.stocks
|
|
25826
|
-
.filter(function (s) {
|
|
25853
|
+
.filter(function (s) {
|
|
25854
|
+
var _a;
|
|
25855
|
+
return isLocal || ((_a = IkasStorefrontConfig.stockLocationIds) === null || _a === void 0 ? void 0 : _a.includes(s.stockLocationId));
|
|
25856
|
+
})
|
|
25827
25857
|
.reduce(function (total, current) { return current.stockCount + total; }, 0) || 0,
|
|
25828
25858
|
variantValues: (_d = v.variantValues) === null || _d === void 0 ? void 0 : _d.map(function (vv) {
|
|
25829
25859
|
var pvt = simple.productVariantTypes.find(function (pvt) { return pvt.variantType.id === vv.variantTypeId; });
|
|
@@ -26435,6 +26465,8 @@ var AddressFormViewModel = /** @class */ (function () {
|
|
|
26435
26465
|
return [4 /*yield*/, IkasDistrictAPI.listDistricts(this.city.id, (_c = this.state) === null || _c === void 0 ? void 0 : _c.id)];
|
|
26436
26466
|
case 2:
|
|
26437
26467
|
_a.districts = _d.sent();
|
|
26468
|
+
if (this.districts.length)
|
|
26469
|
+
this.address.isDistrictRequired = true;
|
|
26438
26470
|
return [3 /*break*/, 4];
|
|
26439
26471
|
case 3:
|
|
26440
26472
|
_d.sent();
|
|
@@ -26463,7 +26495,10 @@ var AddressFormViewModel = /** @class */ (function () {
|
|
|
26463
26495
|
_this.address.phone = value;
|
|
26464
26496
|
};
|
|
26465
26497
|
this.onIdentityNumberChange = function (value) {
|
|
26466
|
-
|
|
26498
|
+
if (!value)
|
|
26499
|
+
_this.address.identityNumber = "";
|
|
26500
|
+
else if (value.length <= 11)
|
|
26501
|
+
_this.address.identityNumber = value;
|
|
26467
26502
|
};
|
|
26468
26503
|
this.onAddressLine1Change = function (value) {
|
|
26469
26504
|
_this.address.addressLine1 = value;
|
|
@@ -26683,7 +26718,7 @@ var AddressForm$1 = mobxReactLite.observer(function (_a) {
|
|
|
26683
26718
|
React.createElement(FormItem, { type: FormItemType.SELECT, label: "\u00DClke", autocomplete: "country-name", value: ((_b = vm.country) === null || _b === void 0 ? void 0 : _b.id) || "", onChange: vm.onCountryChange, options: vm.countryOptions, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.country), errorText: "Ülke seçin" }),
|
|
26684
26719
|
vm.hasState && (React.createElement(FormItem, { type: FormItemType.SELECT, label: "Eyalet", value: ((_c = vm.state) === null || _c === void 0 ? void 0 : _c.id) || "", onChange: vm.onStateChange, options: vm.stateOptions, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.state), errorText: "Eyalet seçin" })),
|
|
26685
26720
|
React.createElement(FormItem, { type: FormItemType.SELECT, label: "\u0130l", value: ((_d = vm.city) === null || _d === void 0 ? void 0 : _d.id) || "", onChange: vm.onCityChange, options: vm.cityOptions, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.city), errorText: "Şehir seçin" }),
|
|
26686
|
-
vm.districtOptions.length ? (React.createElement(FormItem, { type: FormItemType.SELECT, label: "\u0130l\u00E7e", value: ((_e = vm.district) === null || _e === void 0 ? void 0 : _e.id) || "", onChange: vm.onDistrictChange, options: vm.districtOptions, errorText: "İlçe seçin" })) : (React.createElement(FormItem, { type: FormItemType.TEXT, label: "\u0130l\u00E7e", value: ((_f = vm.district) === null || _f === void 0 ? void 0 : _f.name) || "", onChange: vm.onDistrictInputChange })),
|
|
26721
|
+
vm.districtOptions.length ? (React.createElement(FormItem, { type: FormItemType.SELECT, label: "\u0130l\u00E7e", value: ((_e = vm.district) === null || _e === void 0 ? void 0 : _e.id) || "", onChange: vm.onDistrictChange, options: vm.districtOptions, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.district), errorText: "İlçe seçin" })) : (React.createElement(FormItem, { type: FormItemType.TEXT, label: "\u0130l\u00E7e", value: ((_f = vm.district) === null || _f === void 0 ? void 0 : _f.name) || "", onChange: vm.onDistrictInputChange })),
|
|
26687
26722
|
!!vm.address.checkoutSettings &&
|
|
26688
26723
|
vm.address.checkoutSettings.phoneRequirement !==
|
|
26689
26724
|
IkasCheckoutRequirementEnum.INVISIBLE && (React.createElement(FormItem, { type: FormItemType.TEXT, label: "Telefon", autocomplete: "tel", value: vm.phone || "", onChange: vm.onPhoneChange, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.phone), errorText: "Geçerli bir telefon girin" })),
|
|
@@ -27751,6 +27786,14 @@ function createCategoryBreadcrumbSchema(pageSpecificDataStr) {
|
|
|
27751
27786
|
catch (_a) { }
|
|
27752
27787
|
}
|
|
27753
27788
|
|
|
27789
|
+
var CustomerLoginRequiredError = mobxReactLite.observer(function (_a) {
|
|
27790
|
+
var onClose = _a.onClose;
|
|
27791
|
+
return (React.createElement(ErrorContainer, { onClose: onClose },
|
|
27792
|
+
React.createElement("div", null,
|
|
27793
|
+
" ",
|
|
27794
|
+
"Bu email ile i\u015Fleme devam edebilmek i\u00E7in l\u00FCtfen giri\u015F yap\u0131n\u0131z.")));
|
|
27795
|
+
});
|
|
27796
|
+
|
|
27754
27797
|
var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
|
|
27755
27798
|
var _b, _c, _d;
|
|
27756
27799
|
var checkout = _a.checkout, checkoutSettings = _a.checkoutSettings, returnPolicy = _a.returnPolicy, privacyPolicy = _a.privacyPolicy, termsOfService = _a.termsOfService, queryParams = _a.queryParams;
|
|
@@ -27810,6 +27853,9 @@ var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
|
|
|
27810
27853
|
var renderNoShipingError = function () {
|
|
27811
27854
|
return React.createElement(NoShippingError, { onClose: onErrorClose });
|
|
27812
27855
|
};
|
|
27856
|
+
var renderCustomerLoginRequiredError = function () {
|
|
27857
|
+
return React.createElement(CustomerLoginRequiredError, { onClose: onErrorClose });
|
|
27858
|
+
};
|
|
27813
27859
|
var renderError = function () {
|
|
27814
27860
|
var _a;
|
|
27815
27861
|
switch ((_a = vm.error) === null || _a === void 0 ? void 0 : _a.type) {
|
|
@@ -27819,6 +27865,8 @@ var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
|
|
|
27819
27865
|
return renderPaymentError();
|
|
27820
27866
|
case ErrorType.NO_SHIPPING_ERROR:
|
|
27821
27867
|
return renderNoShipingError();
|
|
27868
|
+
case ErrorType.CUSTOMER_LOGIN_REQUIRED_ERROR:
|
|
27869
|
+
return renderCustomerLoginRequiredError();
|
|
27822
27870
|
case ErrorType.API_ERROR:
|
|
27823
27871
|
case ErrorType.UNKNOWN:
|
|
27824
27872
|
return renderUnknownError();
|
|
@@ -28655,7 +28703,8 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
28655
28703
|
id: storefront.salesChannelId,
|
|
28656
28704
|
}),
|
|
28657
28705
|
routing: storefront.routings.length
|
|
28658
|
-
? storefront.routings
|
|
28706
|
+
? storefront.routings.find(function (r) { return !r.path && !r.domain; }) ||
|
|
28707
|
+
storefront.routings[0]
|
|
28659
28708
|
: new IkasStorefrontRouting({}),
|
|
28660
28709
|
});
|
|
28661
28710
|
return [3 /*break*/, 5];
|
|
@@ -29366,6 +29415,27 @@ var _404 = /*#__PURE__*/Object.freeze({
|
|
|
29366
29415
|
getStaticProps: getStaticProps$d
|
|
29367
29416
|
});
|
|
29368
29417
|
|
|
29418
|
+
/**
|
|
29419
|
+
* Flattens `array` a single level deep.
|
|
29420
|
+
*
|
|
29421
|
+
* @static
|
|
29422
|
+
* @memberOf _
|
|
29423
|
+
* @since 0.1.0
|
|
29424
|
+
* @category Array
|
|
29425
|
+
* @param {Array} array The array to flatten.
|
|
29426
|
+
* @returns {Array} Returns the new flattened array.
|
|
29427
|
+
* @example
|
|
29428
|
+
*
|
|
29429
|
+
* _.flatten([1, [2, [3, [4]], 5]]);
|
|
29430
|
+
* // => [1, 2, [3, [4]], 5]
|
|
29431
|
+
*/
|
|
29432
|
+
function flatten(array) {
|
|
29433
|
+
var length = array == null ? 0 : array.length;
|
|
29434
|
+
return length ? _baseFlatten(array, 1) : [];
|
|
29435
|
+
}
|
|
29436
|
+
|
|
29437
|
+
var flatten_1 = flatten;
|
|
29438
|
+
|
|
29369
29439
|
mobx.configure({
|
|
29370
29440
|
enforceActions: "never",
|
|
29371
29441
|
});
|
|
@@ -29385,7 +29455,7 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
29385
29455
|
}
|
|
29386
29456
|
IkasBaseStore.prototype.checkLocalization = function () {
|
|
29387
29457
|
return __awaiter(this, void 0, void 0, function () {
|
|
29388
|
-
var myCountryCode, currentRouting, isCorrectLocale, myCountryRouting, otherCountriesRouting, countries_1, localeOptions_1;
|
|
29458
|
+
var myCountryCode, currentRouting, isCorrectLocale, myCountryRouting, otherCountriesRouting, iso2Codes, countries_1, localeOptions_1;
|
|
29389
29459
|
return __generator(this, function (_a) {
|
|
29390
29460
|
switch (_a.label) {
|
|
29391
29461
|
case 0:
|
|
@@ -29416,7 +29486,8 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
29416
29486
|
isCorrectLocale = false;
|
|
29417
29487
|
}
|
|
29418
29488
|
}
|
|
29419
|
-
|
|
29489
|
+
iso2Codes = flatten_1(IkasStorefrontConfig.routings.map(function (r) { return r.countryCodes || []; }));
|
|
29490
|
+
return [4 /*yield*/, IkasCountryAPI.listCountries(iso2Codes)];
|
|
29420
29491
|
case 2:
|
|
29421
29492
|
countries_1 = _a.sent();
|
|
29422
29493
|
localeOptions_1 = [];
|
|
@@ -16,6 +16,7 @@ export declare class IkasOrderAddress {
|
|
|
16
16
|
taxNumber?: string | null;
|
|
17
17
|
taxOffice?: string | null;
|
|
18
18
|
checkoutSettings?: IkasCheckoutSettings;
|
|
19
|
+
isDistrictRequired?: boolean;
|
|
19
20
|
constructor(data?: Partial<IkasOrderAddress>);
|
|
20
21
|
get addressText(): string;
|
|
21
22
|
get validationResult(): IkasAddressValidationResult;
|
|
@@ -39,6 +40,7 @@ export declare type IkasAddressValidationResult = {
|
|
|
39
40
|
country: boolean;
|
|
40
41
|
state: boolean;
|
|
41
42
|
city: boolean;
|
|
43
|
+
district: boolean;
|
|
42
44
|
phone: boolean;
|
|
43
45
|
identityNumber: boolean;
|
|
44
46
|
};
|