@ikas/storefront 0.0.163-alpha.16 → 0.0.163-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { IkasOrderAddress } from "../../../../models/data/order/address/index";
|
|
2
2
|
import { IkasCountry, IkasState, IkasCity, IkasDistrict, IkasCustomerAddress } from "../../../../models/index";
|
|
3
|
-
import CheckoutViewModel from "../../model";
|
|
4
3
|
declare type Callback = ((value: string) => void) | null | undefined;
|
|
5
4
|
export interface AddressFormViewModelParams {
|
|
6
|
-
checkoutViewModel: CheckoutViewModel;
|
|
7
5
|
address: IkasOrderAddress | IkasCustomerAddress;
|
|
8
6
|
isCorporate?: boolean;
|
|
9
7
|
isErrorsVisible: boolean;
|
|
@@ -15,7 +13,6 @@ export interface AddressFormViewModelParams {
|
|
|
15
13
|
lastNameChangeCallback?: Callback;
|
|
16
14
|
}
|
|
17
15
|
export default class AddressFormViewModel {
|
|
18
|
-
checkoutViewModel: CheckoutViewModel;
|
|
19
16
|
address: IkasOrderAddress | IkasCustomerAddress;
|
|
20
17
|
isCorporate: boolean;
|
|
21
18
|
isErrorsVisible: boolean;
|
|
@@ -29,6 +26,7 @@ export default class AddressFormViewModel {
|
|
|
29
26
|
states: IkasState[];
|
|
30
27
|
cities: IkasCity[];
|
|
31
28
|
districts: IkasDistrict[];
|
|
29
|
+
myCountryCode?: string;
|
|
32
30
|
constructor(data: AddressFormViewModelParams);
|
|
33
31
|
get firstName(): string | null | undefined;
|
|
34
32
|
get lastName(): string | null | undefined;
|
package/build/index.es.js
CHANGED
|
@@ -22705,7 +22705,7 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
22705
22705
|
if (this.localeChecked)
|
|
22706
22706
|
return [2 /*return*/];
|
|
22707
22707
|
if (typeof window === undefined) {
|
|
22708
|
-
console.warn("
|
|
22708
|
+
console.warn("checkLocalization should be called on the client side!");
|
|
22709
22709
|
return [2 /*return*/];
|
|
22710
22710
|
}
|
|
22711
22711
|
return [4 /*yield*/, IkasCountryAPI.getMyCountry()];
|
|
@@ -59996,34 +59996,40 @@ var AddressFormViewModel = /** @class */ (function () {
|
|
|
59996
59996
|
});
|
|
59997
59997
|
}); };
|
|
59998
59998
|
this.listCountries = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
59999
|
-
var countries, currentRouting_1, currentCountry;
|
|
59999
|
+
var _a, countries, currentRouting_1, currentCountry;
|
|
60000
60000
|
var _this = this;
|
|
60001
|
-
var
|
|
60002
|
-
return __generator(this, function (
|
|
60003
|
-
switch (
|
|
60001
|
+
var _b, _c;
|
|
60002
|
+
return __generator(this, function (_d) {
|
|
60003
|
+
switch (_d.label) {
|
|
60004
60004
|
case 0:
|
|
60005
|
-
|
|
60006
|
-
|
|
60005
|
+
_d.trys.push([0, 4, , 5]);
|
|
60006
|
+
if (!!this.myCountryCode) return [3 /*break*/, 2];
|
|
60007
|
+
_a = this;
|
|
60008
|
+
return [4 /*yield*/, IkasCountryAPI.getMyCountry()];
|
|
60007
60009
|
case 1:
|
|
60008
|
-
|
|
60010
|
+
_a.myCountryCode = (_d.sent()) || undefined;
|
|
60011
|
+
_d.label = 2;
|
|
60012
|
+
case 2: return [4 /*yield*/, IkasCountryAPI.listCountries(undefined, ((_b = this.allowedCountryIds) === null || _b === void 0 ? void 0 : _b.length) ? this.allowedCountryIds : undefined)];
|
|
60013
|
+
case 3:
|
|
60014
|
+
countries = _d.sent();
|
|
60009
60015
|
currentRouting_1 = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; });
|
|
60010
|
-
if ((
|
|
60016
|
+
if ((_c = currentRouting_1 === null || currentRouting_1 === void 0 ? void 0 : currentRouting_1.countryCodes) === null || _c === void 0 ? void 0 : _c.length) {
|
|
60011
60017
|
countries = countries.filter(function (c) { var _a; return c.iso2 && ((_a = currentRouting_1.countryCodes) === null || _a === void 0 ? void 0 : _a.includes(c.iso2)); });
|
|
60012
60018
|
}
|
|
60013
60019
|
this.countries = countries;
|
|
60014
60020
|
if (this.countries.length === 1 && !this.country)
|
|
60015
60021
|
this.onCountryChange(this.countries[0].id);
|
|
60016
|
-
else if (this.
|
|
60017
|
-
currentCountry = this.countries.find(function (c) { return c.iso2 === _this.
|
|
60022
|
+
else if (this.myCountryCode && !this.country) {
|
|
60023
|
+
currentCountry = this.countries.find(function (c) { return c.iso2 === _this.myCountryCode; });
|
|
60018
60024
|
if (currentCountry) {
|
|
60019
60025
|
this.onCountryChange(currentCountry.id);
|
|
60020
60026
|
}
|
|
60021
60027
|
}
|
|
60022
|
-
return [3 /*break*/,
|
|
60023
|
-
case
|
|
60024
|
-
|
|
60025
|
-
return [3 /*break*/,
|
|
60026
|
-
case
|
|
60028
|
+
return [3 /*break*/, 5];
|
|
60029
|
+
case 4:
|
|
60030
|
+
_d.sent();
|
|
60031
|
+
return [3 /*break*/, 5];
|
|
60032
|
+
case 5: return [2 /*return*/];
|
|
60027
60033
|
}
|
|
60028
60034
|
});
|
|
60029
60035
|
}); };
|
|
@@ -60220,7 +60226,6 @@ var AddressFormViewModel = /** @class */ (function () {
|
|
|
60220
60226
|
this.onTaxOfficeChange = function (value) {
|
|
60221
60227
|
_this.address.taxOffice = value;
|
|
60222
60228
|
};
|
|
60223
|
-
this.checkoutViewModel = data.checkoutViewModel;
|
|
60224
60229
|
this.address = data.address;
|
|
60225
60230
|
this.isCorporate = data.isCorporate || false;
|
|
60226
60231
|
this.isErrorsVisible = data.isErrorsVisible || false;
|
|
@@ -60661,7 +60666,7 @@ var CustomerAddresses = function (_a) {
|
|
|
60661
60666
|
var CustomerAddresses$1 = observer(CustomerAddresses);
|
|
60662
60667
|
var CustomerAddressForm = observer(function (_a) {
|
|
60663
60668
|
var vm = _a.vm;
|
|
60664
|
-
return (createElement(AddressForm$1, {
|
|
60669
|
+
return (createElement(AddressForm$1, { address: vm.editingCustomerAddress || vm.address, isErrorsVisible: vm.isEditAddressErrorsVisible || vm.vm.isErrorsVisible, allowedCountryIds: vm.vm.shippingCountryIds || undefined, firstNameChangeCallback: vm.firstNameChangeCallback, lastNameChangeCallback: vm.lastNameChangeCallback, allowTitleChange: !!vm.editingCustomerAddress }));
|
|
60665
60670
|
});
|
|
60666
60671
|
var SaveAddressCheckboxAndTitle = observer(function (_a) {
|
|
60667
60672
|
var vm = _a.vm;
|
|
@@ -61698,7 +61703,7 @@ var IkasCheckoutPage = function (_a) {
|
|
|
61698
61703
|
" - " +
|
|
61699
61704
|
t("checkout-page:securePayment"), description: t("checkout-page:securePayment") }),
|
|
61700
61705
|
createElement("div", { id: "Checkout", className: styles$5.CheckoutPage },
|
|
61701
|
-
createElement(ReactTooltip, { place: "top", type: "dark", effect: "solid", arrowColor: "transparent", multiline: true, className: styles$5.ReactTooltipWrap }),
|
|
61706
|
+
createElement(ReactTooltip, { place: "top", type: "dark", effect: "solid", arrowColor: "transparent", multiline: true, className: styles$5.ReactTooltipWrap, event: "click", eventOff: "click" }),
|
|
61702
61707
|
createElement("div", { className: styles$5.Left },
|
|
61703
61708
|
createElement("div", { className: styles$5.LeftContent },
|
|
61704
61709
|
createElement("div", null,
|
package/build/index.js
CHANGED
|
@@ -22713,7 +22713,7 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
22713
22713
|
if (this.localeChecked)
|
|
22714
22714
|
return [2 /*return*/];
|
|
22715
22715
|
if (typeof window === undefined) {
|
|
22716
|
-
console.warn("
|
|
22716
|
+
console.warn("checkLocalization should be called on the client side!");
|
|
22717
22717
|
return [2 /*return*/];
|
|
22718
22718
|
}
|
|
22719
22719
|
return [4 /*yield*/, IkasCountryAPI.getMyCountry()];
|
|
@@ -59975,34 +59975,40 @@ var AddressFormViewModel = /** @class */ (function () {
|
|
|
59975
59975
|
});
|
|
59976
59976
|
}); };
|
|
59977
59977
|
this.listCountries = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
59978
|
-
var countries, currentRouting_1, currentCountry;
|
|
59978
|
+
var _a, countries, currentRouting_1, currentCountry;
|
|
59979
59979
|
var _this = this;
|
|
59980
|
-
var
|
|
59981
|
-
return __generator(this, function (
|
|
59982
|
-
switch (
|
|
59980
|
+
var _b, _c;
|
|
59981
|
+
return __generator(this, function (_d) {
|
|
59982
|
+
switch (_d.label) {
|
|
59983
59983
|
case 0:
|
|
59984
|
-
|
|
59985
|
-
|
|
59984
|
+
_d.trys.push([0, 4, , 5]);
|
|
59985
|
+
if (!!this.myCountryCode) return [3 /*break*/, 2];
|
|
59986
|
+
_a = this;
|
|
59987
|
+
return [4 /*yield*/, IkasCountryAPI.getMyCountry()];
|
|
59986
59988
|
case 1:
|
|
59987
|
-
|
|
59989
|
+
_a.myCountryCode = (_d.sent()) || undefined;
|
|
59990
|
+
_d.label = 2;
|
|
59991
|
+
case 2: return [4 /*yield*/, IkasCountryAPI.listCountries(undefined, ((_b = this.allowedCountryIds) === null || _b === void 0 ? void 0 : _b.length) ? this.allowedCountryIds : undefined)];
|
|
59992
|
+
case 3:
|
|
59993
|
+
countries = _d.sent();
|
|
59988
59994
|
currentRouting_1 = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; });
|
|
59989
|
-
if ((
|
|
59995
|
+
if ((_c = currentRouting_1 === null || currentRouting_1 === void 0 ? void 0 : currentRouting_1.countryCodes) === null || _c === void 0 ? void 0 : _c.length) {
|
|
59990
59996
|
countries = countries.filter(function (c) { var _a; return c.iso2 && ((_a = currentRouting_1.countryCodes) === null || _a === void 0 ? void 0 : _a.includes(c.iso2)); });
|
|
59991
59997
|
}
|
|
59992
59998
|
this.countries = countries;
|
|
59993
59999
|
if (this.countries.length === 1 && !this.country)
|
|
59994
60000
|
this.onCountryChange(this.countries[0].id);
|
|
59995
|
-
else if (this.
|
|
59996
|
-
currentCountry = this.countries.find(function (c) { return c.iso2 === _this.
|
|
60001
|
+
else if (this.myCountryCode && !this.country) {
|
|
60002
|
+
currentCountry = this.countries.find(function (c) { return c.iso2 === _this.myCountryCode; });
|
|
59997
60003
|
if (currentCountry) {
|
|
59998
60004
|
this.onCountryChange(currentCountry.id);
|
|
59999
60005
|
}
|
|
60000
60006
|
}
|
|
60001
|
-
return [3 /*break*/,
|
|
60002
|
-
case
|
|
60003
|
-
|
|
60004
|
-
return [3 /*break*/,
|
|
60005
|
-
case
|
|
60007
|
+
return [3 /*break*/, 5];
|
|
60008
|
+
case 4:
|
|
60009
|
+
_d.sent();
|
|
60010
|
+
return [3 /*break*/, 5];
|
|
60011
|
+
case 5: return [2 /*return*/];
|
|
60006
60012
|
}
|
|
60007
60013
|
});
|
|
60008
60014
|
}); };
|
|
@@ -60199,7 +60205,6 @@ var AddressFormViewModel = /** @class */ (function () {
|
|
|
60199
60205
|
this.onTaxOfficeChange = function (value) {
|
|
60200
60206
|
_this.address.taxOffice = value;
|
|
60201
60207
|
};
|
|
60202
|
-
this.checkoutViewModel = data.checkoutViewModel;
|
|
60203
60208
|
this.address = data.address;
|
|
60204
60209
|
this.isCorporate = data.isCorporate || false;
|
|
60205
60210
|
this.isErrorsVisible = data.isErrorsVisible || false;
|
|
@@ -60640,7 +60645,7 @@ var CustomerAddresses = function (_a) {
|
|
|
60640
60645
|
var CustomerAddresses$1 = mobxReactLite.observer(CustomerAddresses);
|
|
60641
60646
|
var CustomerAddressForm = mobxReactLite.observer(function (_a) {
|
|
60642
60647
|
var vm = _a.vm;
|
|
60643
|
-
return (React.createElement(AddressForm$1, {
|
|
60648
|
+
return (React.createElement(AddressForm$1, { address: vm.editingCustomerAddress || vm.address, isErrorsVisible: vm.isEditAddressErrorsVisible || vm.vm.isErrorsVisible, allowedCountryIds: vm.vm.shippingCountryIds || undefined, firstNameChangeCallback: vm.firstNameChangeCallback, lastNameChangeCallback: vm.lastNameChangeCallback, allowTitleChange: !!vm.editingCustomerAddress }));
|
|
60644
60649
|
});
|
|
60645
60650
|
var SaveAddressCheckboxAndTitle = mobxReactLite.observer(function (_a) {
|
|
60646
60651
|
var vm = _a.vm;
|
|
@@ -61677,7 +61682,7 @@ var IkasCheckoutPage = function (_a) {
|
|
|
61677
61682
|
" - " +
|
|
61678
61683
|
t("checkout-page:securePayment"), description: t("checkout-page:securePayment") }),
|
|
61679
61684
|
React.createElement("div", { id: "Checkout", className: styles$5.CheckoutPage },
|
|
61680
|
-
React.createElement(ReactTooltip, { place: "top", type: "dark", effect: "solid", arrowColor: "transparent", multiline: true, className: styles$5.ReactTooltipWrap }),
|
|
61685
|
+
React.createElement(ReactTooltip, { place: "top", type: "dark", effect: "solid", arrowColor: "transparent", multiline: true, className: styles$5.ReactTooltipWrap, event: "click", eventOff: "click" }),
|
|
61681
61686
|
React.createElement("div", { className: styles$5.Left },
|
|
61682
61687
|
React.createElement("div", { className: styles$5.LeftContent },
|
|
61683
61688
|
React.createElement("div", null,
|