@ikas/storefront 0.0.163-alpha.15 → 0.0.163-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,9 @@
|
|
|
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";
|
|
3
4
|
declare type Callback = ((value: string) => void) | null | undefined;
|
|
4
5
|
export interface AddressFormViewModelParams {
|
|
6
|
+
checkoutViewModel: CheckoutViewModel;
|
|
5
7
|
address: IkasOrderAddress | IkasCustomerAddress;
|
|
6
8
|
isCorporate?: boolean;
|
|
7
9
|
isErrorsVisible: boolean;
|
|
@@ -13,6 +15,7 @@ export interface AddressFormViewModelParams {
|
|
|
13
15
|
lastNameChangeCallback?: Callback;
|
|
14
16
|
}
|
|
15
17
|
export default class AddressFormViewModel {
|
|
18
|
+
checkoutViewModel: CheckoutViewModel;
|
|
16
19
|
address: IkasOrderAddress | IkasCustomerAddress;
|
|
17
20
|
isCorporate: boolean;
|
|
18
21
|
isErrorsVisible: boolean;
|
package/build/index.es.js
CHANGED
|
@@ -59996,7 +59996,8 @@ 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;
|
|
59999
|
+
var countries, currentRouting_1, currentCountry;
|
|
60000
|
+
var _this = this;
|
|
60000
60001
|
var _a, _b;
|
|
60001
60002
|
return __generator(this, function (_c) {
|
|
60002
60003
|
switch (_c.label) {
|
|
@@ -60012,6 +60013,12 @@ var AddressFormViewModel = /** @class */ (function () {
|
|
|
60012
60013
|
this.countries = countries;
|
|
60013
60014
|
if (this.countries.length === 1 && !this.country)
|
|
60014
60015
|
this.onCountryChange(this.countries[0].id);
|
|
60016
|
+
else if (this.checkoutViewModel.store.currentCountryCode) {
|
|
60017
|
+
currentCountry = this.countries.find(function (c) { return c.iso2 === _this.checkoutViewModel.store.currentCountryCode; });
|
|
60018
|
+
if (currentCountry) {
|
|
60019
|
+
this.onCountryChange(currentCountry.id);
|
|
60020
|
+
}
|
|
60021
|
+
}
|
|
60015
60022
|
return [3 /*break*/, 3];
|
|
60016
60023
|
case 2:
|
|
60017
60024
|
_c.sent();
|
|
@@ -60213,6 +60220,7 @@ var AddressFormViewModel = /** @class */ (function () {
|
|
|
60213
60220
|
this.onTaxOfficeChange = function (value) {
|
|
60214
60221
|
_this.address.taxOffice = value;
|
|
60215
60222
|
};
|
|
60223
|
+
this.checkoutViewModel = data.checkoutViewModel;
|
|
60216
60224
|
this.address = data.address;
|
|
60217
60225
|
this.isCorporate = data.isCorporate || false;
|
|
60218
60226
|
this.isErrorsVisible = data.isErrorsVisible || false;
|
|
@@ -60653,7 +60661,7 @@ var CustomerAddresses = function (_a) {
|
|
|
60653
60661
|
var CustomerAddresses$1 = observer(CustomerAddresses);
|
|
60654
60662
|
var CustomerAddressForm = observer(function (_a) {
|
|
60655
60663
|
var vm = _a.vm;
|
|
60656
|
-
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 }));
|
|
60664
|
+
return (createElement(AddressForm$1, { checkoutViewModel: vm.vm, 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 }));
|
|
60657
60665
|
});
|
|
60658
60666
|
var SaveAddressCheckboxAndTitle = observer(function (_a) {
|
|
60659
60667
|
var vm = _a.vm;
|
package/build/index.js
CHANGED
|
@@ -59975,7 +59975,8 @@ 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;
|
|
59978
|
+
var countries, currentRouting_1, currentCountry;
|
|
59979
|
+
var _this = this;
|
|
59979
59980
|
var _a, _b;
|
|
59980
59981
|
return __generator(this, function (_c) {
|
|
59981
59982
|
switch (_c.label) {
|
|
@@ -59991,6 +59992,12 @@ var AddressFormViewModel = /** @class */ (function () {
|
|
|
59991
59992
|
this.countries = countries;
|
|
59992
59993
|
if (this.countries.length === 1 && !this.country)
|
|
59993
59994
|
this.onCountryChange(this.countries[0].id);
|
|
59995
|
+
else if (this.checkoutViewModel.store.currentCountryCode) {
|
|
59996
|
+
currentCountry = this.countries.find(function (c) { return c.iso2 === _this.checkoutViewModel.store.currentCountryCode; });
|
|
59997
|
+
if (currentCountry) {
|
|
59998
|
+
this.onCountryChange(currentCountry.id);
|
|
59999
|
+
}
|
|
60000
|
+
}
|
|
59994
60001
|
return [3 /*break*/, 3];
|
|
59995
60002
|
case 2:
|
|
59996
60003
|
_c.sent();
|
|
@@ -60192,6 +60199,7 @@ var AddressFormViewModel = /** @class */ (function () {
|
|
|
60192
60199
|
this.onTaxOfficeChange = function (value) {
|
|
60193
60200
|
_this.address.taxOffice = value;
|
|
60194
60201
|
};
|
|
60202
|
+
this.checkoutViewModel = data.checkoutViewModel;
|
|
60195
60203
|
this.address = data.address;
|
|
60196
60204
|
this.isCorporate = data.isCorporate || false;
|
|
60197
60205
|
this.isErrorsVisible = data.isErrorsVisible || false;
|
|
@@ -60632,7 +60640,7 @@ var CustomerAddresses = function (_a) {
|
|
|
60632
60640
|
var CustomerAddresses$1 = mobxReactLite.observer(CustomerAddresses);
|
|
60633
60641
|
var CustomerAddressForm = mobxReactLite.observer(function (_a) {
|
|
60634
60642
|
var vm = _a.vm;
|
|
60635
|
-
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 }));
|
|
60643
|
+
return (React.createElement(AddressForm$1, { checkoutViewModel: vm.vm, 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 }));
|
|
60636
60644
|
});
|
|
60637
60645
|
var SaveAddressCheckboxAndTitle = mobxReactLite.observer(function (_a) {
|
|
60638
60646
|
var vm = _a.vm;
|