@ikas/storefront 0.0.41 → 0.0.43
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/index.es.js +167 -117
- package/build/index.js +167 -117
- package/build/models/theme/page/component/prop-value/product-list.d.ts +1 -0
- package/build/models/ui/product-list/index.d.ts +2 -1
- package/build/models/ui/validator/form/address.d.ts +8 -5
- package/build/models/ui/validator/form/forgot-password.d.ts +1 -1
- package/build/models/ui/validator/form/login.d.ts +1 -1
- package/build/models/ui/validator/form/recover-password.d.ts +1 -1
- package/build/models/ui/validator/form/register.d.ts +1 -1
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -10944,8 +10944,8 @@ var IkasProductListPropValueProvider = /** @class */ (function () {
|
|
|
10944
10944
|
return __generator(this, function (_a) {
|
|
10945
10945
|
switch (_a.label) {
|
|
10946
10946
|
case 0:
|
|
10947
|
+
filters = new IkasProductListFilter();
|
|
10947
10948
|
if (this.productListPropValue.productListType === IkasProductListType.ALL) {
|
|
10948
|
-
filters = new IkasProductListFilter();
|
|
10949
10949
|
// TODO use pageParams to insert filters
|
|
10950
10950
|
if (this.productListPropValue.usePageFilter) {
|
|
10951
10951
|
if (this.pageType === IkasThemePageType.CATEGORY) {
|
|
@@ -10958,6 +10958,14 @@ var IkasProductListPropValueProvider = /** @class */ (function () {
|
|
|
10958
10958
|
}
|
|
10959
10959
|
}
|
|
10960
10960
|
}
|
|
10961
|
+
if (this.productListPropValue.productListType === IkasProductListType.CATEGORY) {
|
|
10962
|
+
if (this.productListPropValue.category) {
|
|
10963
|
+
filters.category = this.productListPropValue.category;
|
|
10964
|
+
}
|
|
10965
|
+
}
|
|
10966
|
+
else {
|
|
10967
|
+
filters.category = null;
|
|
10968
|
+
}
|
|
10961
10969
|
productList = new IkasProductList({
|
|
10962
10970
|
productListPropValue: this.productListPropValue,
|
|
10963
10971
|
filters: filters,
|
|
@@ -14081,6 +14089,7 @@ var IkasProductListType;
|
|
|
14081
14089
|
IkasProductListType["STATIC"] = "STATIC";
|
|
14082
14090
|
IkasProductListType["DISCOUNTED"] = "DISCOUNTED";
|
|
14083
14091
|
IkasProductListType["RECOMMENDED"] = "RECOMMENDED";
|
|
14092
|
+
IkasProductListType["CATEGORY"] = "CATEGORY";
|
|
14084
14093
|
})(IkasProductListType || (IkasProductListType = {}));
|
|
14085
14094
|
var IkasProductListSortType;
|
|
14086
14095
|
(function (IkasProductListSortType) {
|
|
@@ -17289,7 +17298,8 @@ var Validator = /** @class */ (function () {
|
|
|
17289
17298
|
isValid = _a.sent();
|
|
17290
17299
|
if (!isValid) {
|
|
17291
17300
|
hasError = true;
|
|
17292
|
-
|
|
17301
|
+
if (rule.errorType)
|
|
17302
|
+
errorTypes.push(rule.errorType);
|
|
17293
17303
|
errorMessages.push(rule.errorMessage);
|
|
17294
17304
|
}
|
|
17295
17305
|
_a.label = 3;
|
|
@@ -17297,9 +17307,11 @@ var Validator = /** @class */ (function () {
|
|
|
17297
17307
|
i++;
|
|
17298
17308
|
return [3 /*break*/, 1];
|
|
17299
17309
|
case 4:
|
|
17300
|
-
this.results[fieldKey]
|
|
17301
|
-
|
|
17302
|
-
|
|
17310
|
+
if (this.results[fieldKey]) {
|
|
17311
|
+
this.results[fieldKey].errorTypes = errorTypes;
|
|
17312
|
+
this.results[fieldKey].messages = errorMessages;
|
|
17313
|
+
this.results[fieldKey].status = hasError ? "error" : undefined;
|
|
17314
|
+
}
|
|
17303
17315
|
return [2 /*return*/];
|
|
17304
17316
|
}
|
|
17305
17317
|
});
|
|
@@ -17687,23 +17699,30 @@ var LoginForm = /** @class */ (function () {
|
|
|
17687
17699
|
LoginForm.prototype.logIn = function () {
|
|
17688
17700
|
return __awaiter(this, void 0, void 0, function () {
|
|
17689
17701
|
var response, hasFormError, isLoginSuccess;
|
|
17690
|
-
return __generator(this, function (
|
|
17691
|
-
switch (
|
|
17702
|
+
return __generator(this, function (_b) {
|
|
17703
|
+
switch (_b.label) {
|
|
17692
17704
|
case 0:
|
|
17693
|
-
response = { isFormError: false,
|
|
17705
|
+
response = { isFormError: false, isSuccess: false };
|
|
17694
17706
|
return [4 /*yield*/, this.validateAll()];
|
|
17695
17707
|
case 1:
|
|
17696
|
-
hasFormError =
|
|
17708
|
+
hasFormError = _b.sent();
|
|
17697
17709
|
if (hasFormError) {
|
|
17698
17710
|
response.isFormError = true;
|
|
17699
17711
|
return [2 /*return*/, response];
|
|
17700
17712
|
}
|
|
17701
|
-
|
|
17713
|
+
_b.label = 2;
|
|
17702
17714
|
case 2:
|
|
17703
|
-
|
|
17704
|
-
|
|
17705
|
-
|
|
17715
|
+
_b.trys.push([2, 4, , 5]);
|
|
17716
|
+
return [4 /*yield*/, this.store.customerStore.login(this.model.email, this.model.password)];
|
|
17717
|
+
case 3:
|
|
17718
|
+
isLoginSuccess = _b.sent();
|
|
17719
|
+
if (isLoginSuccess)
|
|
17720
|
+
response.isSuccess = true;
|
|
17706
17721
|
return [2 /*return*/, response];
|
|
17722
|
+
case 4:
|
|
17723
|
+
_b.sent();
|
|
17724
|
+
return [2 /*return*/, response];
|
|
17725
|
+
case 5: return [2 /*return*/];
|
|
17707
17726
|
}
|
|
17708
17727
|
});
|
|
17709
17728
|
});
|
|
@@ -18528,6 +18547,69 @@ var AddressForm = /** @class */ (function () {
|
|
|
18528
18547
|
this._isStatesPending = false;
|
|
18529
18548
|
this._isCitiesPending = false;
|
|
18530
18549
|
this._isDistrictsPending = false;
|
|
18550
|
+
this.validatorRules = function (includePhoneRule) {
|
|
18551
|
+
if (includePhoneRule === void 0) { includePhoneRule = false; }
|
|
18552
|
+
var rules = __spreadArrays([
|
|
18553
|
+
new RequiredRule({
|
|
18554
|
+
model: _this.address,
|
|
18555
|
+
fieldKey: "firstName",
|
|
18556
|
+
valuePath: "firstName",
|
|
18557
|
+
message: _this.message.requiredRule,
|
|
18558
|
+
}),
|
|
18559
|
+
new RequiredRule({
|
|
18560
|
+
model: _this.address,
|
|
18561
|
+
fieldKey: "lastName",
|
|
18562
|
+
valuePath: "lastName",
|
|
18563
|
+
message: _this.message.requiredRule,
|
|
18564
|
+
}),
|
|
18565
|
+
new RequiredRule({
|
|
18566
|
+
model: _this.address,
|
|
18567
|
+
fieldKey: "addressLine1",
|
|
18568
|
+
valuePath: "addressLine1",
|
|
18569
|
+
message: _this.message.requiredRule,
|
|
18570
|
+
}),
|
|
18571
|
+
new RequiredRule({
|
|
18572
|
+
model: _this.address,
|
|
18573
|
+
fieldKey: "postalCode",
|
|
18574
|
+
valuePath: "postalCode",
|
|
18575
|
+
message: _this.message.requiredRule,
|
|
18576
|
+
}),
|
|
18577
|
+
new RequiredRule({
|
|
18578
|
+
model: _this.address,
|
|
18579
|
+
fieldKey: "country",
|
|
18580
|
+
valuePath: "country",
|
|
18581
|
+
message: _this.message.requiredRule,
|
|
18582
|
+
}),
|
|
18583
|
+
new RequiredRule({
|
|
18584
|
+
model: _this.address,
|
|
18585
|
+
fieldKey: "state",
|
|
18586
|
+
valuePath: "state",
|
|
18587
|
+
message: _this.message.requiredRule,
|
|
18588
|
+
}),
|
|
18589
|
+
new RequiredRule({
|
|
18590
|
+
model: _this.address,
|
|
18591
|
+
fieldKey: "city",
|
|
18592
|
+
valuePath: "city",
|
|
18593
|
+
message: _this.message.requiredRule,
|
|
18594
|
+
}),
|
|
18595
|
+
new RequiredRule({
|
|
18596
|
+
model: _this.address,
|
|
18597
|
+
fieldKey: "title",
|
|
18598
|
+
valuePath: "title",
|
|
18599
|
+
message: _this.message.requiredRule,
|
|
18600
|
+
})
|
|
18601
|
+
], (includePhoneRule
|
|
18602
|
+
? [
|
|
18603
|
+
new PhoneRule({
|
|
18604
|
+
model: _this.address,
|
|
18605
|
+
fieldKey: "phone",
|
|
18606
|
+
valuePath: "phone",
|
|
18607
|
+
message: _this.message.phoneRule,
|
|
18608
|
+
}),
|
|
18609
|
+
]
|
|
18610
|
+
: []));
|
|
18611
|
+
return rules;
|
|
18612
|
+
};
|
|
18531
18613
|
this.onTitleChange = function (value) {
|
|
18532
18614
|
_this.address.title = value;
|
|
18533
18615
|
};
|
|
@@ -18539,6 +18621,8 @@ var AddressForm = /** @class */ (function () {
|
|
|
18539
18621
|
};
|
|
18540
18622
|
this.onPhoneChange = function (value) {
|
|
18541
18623
|
_this.address.phone = value;
|
|
18624
|
+
if (!value)
|
|
18625
|
+
_this.validator.setRules(_this.validatorRules());
|
|
18542
18626
|
};
|
|
18543
18627
|
this.onAddressLine1Change = function (value) {
|
|
18544
18628
|
_this.address.addressLine1 = value;
|
|
@@ -18727,17 +18811,18 @@ var AddressForm = /** @class */ (function () {
|
|
|
18727
18811
|
};
|
|
18728
18812
|
this.submit = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
18729
18813
|
var response, hasFormError, customer, saveCustomerResponse;
|
|
18730
|
-
return __generator(this, function (
|
|
18731
|
-
switch (
|
|
18814
|
+
return __generator(this, function (_b) {
|
|
18815
|
+
switch (_b.label) {
|
|
18732
18816
|
case 0:
|
|
18733
18817
|
response = {
|
|
18734
18818
|
isFormError: false,
|
|
18735
|
-
isAPIError: false,
|
|
18736
18819
|
isSuccess: false,
|
|
18737
18820
|
};
|
|
18821
|
+
if (this.address.phone)
|
|
18822
|
+
this.validator.setRules(this.validatorRules(true));
|
|
18738
18823
|
return [4 /*yield*/, this.validateAll()];
|
|
18739
18824
|
case 1:
|
|
18740
|
-
hasFormError =
|
|
18825
|
+
hasFormError = _b.sent();
|
|
18741
18826
|
if (hasFormError) {
|
|
18742
18827
|
response.isFormError = true;
|
|
18743
18828
|
return [2 /*return*/, response];
|
|
@@ -18751,15 +18836,19 @@ var AddressForm = /** @class */ (function () {
|
|
|
18751
18836
|
else {
|
|
18752
18837
|
customer.addresses.push(this.address);
|
|
18753
18838
|
}
|
|
18754
|
-
|
|
18839
|
+
_b.label = 2;
|
|
18755
18840
|
case 2:
|
|
18756
|
-
|
|
18757
|
-
|
|
18758
|
-
|
|
18759
|
-
|
|
18760
|
-
|
|
18761
|
-
|
|
18841
|
+
_b.trys.push([2, 4, , 5]);
|
|
18842
|
+
return [4 /*yield*/, this.store.customerStore.saveCustomer(customer)];
|
|
18843
|
+
case 3:
|
|
18844
|
+
saveCustomerResponse = _b.sent();
|
|
18845
|
+
if (saveCustomerResponse)
|
|
18846
|
+
response.isSuccess = true;
|
|
18847
|
+
return [2 /*return*/, response];
|
|
18848
|
+
case 4:
|
|
18849
|
+
_b.sent();
|
|
18762
18850
|
return [2 /*return*/, response];
|
|
18851
|
+
case 5: return [2 /*return*/];
|
|
18763
18852
|
}
|
|
18764
18853
|
});
|
|
18765
18854
|
}); };
|
|
@@ -18785,69 +18874,9 @@ var AddressForm = /** @class */ (function () {
|
|
|
18785
18874
|
submit: action,
|
|
18786
18875
|
});
|
|
18787
18876
|
this.address = props.address;
|
|
18877
|
+
this.message = props.message;
|
|
18788
18878
|
this.store = props.store;
|
|
18789
|
-
this.validator = new Validator(this.address,
|
|
18790
|
-
new RequiredRule({
|
|
18791
|
-
model: this.address,
|
|
18792
|
-
fieldKey: "firstName",
|
|
18793
|
-
valuePath: "firstName",
|
|
18794
|
-
message: props.message.requiredRule,
|
|
18795
|
-
}),
|
|
18796
|
-
new RequiredRule({
|
|
18797
|
-
model: this.address,
|
|
18798
|
-
fieldKey: "lastName",
|
|
18799
|
-
valuePath: "lastName",
|
|
18800
|
-
message: props.message.requiredRule,
|
|
18801
|
-
}),
|
|
18802
|
-
new RequiredRule({
|
|
18803
|
-
model: this.address,
|
|
18804
|
-
fieldKey: "addressLine1",
|
|
18805
|
-
valuePath: "addressLine1",
|
|
18806
|
-
message: props.message.requiredRule,
|
|
18807
|
-
}),
|
|
18808
|
-
new RequiredRule({
|
|
18809
|
-
model: this.address,
|
|
18810
|
-
fieldKey: "postalCode",
|
|
18811
|
-
valuePath: "postalCode",
|
|
18812
|
-
message: props.message.requiredRule,
|
|
18813
|
-
}),
|
|
18814
|
-
new RequiredRule({
|
|
18815
|
-
model: this.address,
|
|
18816
|
-
fieldKey: "country",
|
|
18817
|
-
valuePath: "country",
|
|
18818
|
-
message: props.message.requiredRule,
|
|
18819
|
-
}),
|
|
18820
|
-
new RequiredRule({
|
|
18821
|
-
model: this.address,
|
|
18822
|
-
fieldKey: "state",
|
|
18823
|
-
valuePath: "state",
|
|
18824
|
-
message: props.message.requiredRule,
|
|
18825
|
-
}),
|
|
18826
|
-
new RequiredRule({
|
|
18827
|
-
model: this.address,
|
|
18828
|
-
fieldKey: "city",
|
|
18829
|
-
valuePath: "city",
|
|
18830
|
-
message: props.message.requiredRule,
|
|
18831
|
-
}),
|
|
18832
|
-
new RequiredRule({
|
|
18833
|
-
model: this.address,
|
|
18834
|
-
fieldKey: "phone",
|
|
18835
|
-
valuePath: "phone",
|
|
18836
|
-
message: props.message.requiredRule,
|
|
18837
|
-
}),
|
|
18838
|
-
new RequiredRule({
|
|
18839
|
-
model: this.address,
|
|
18840
|
-
fieldKey: "title",
|
|
18841
|
-
valuePath: "title",
|
|
18842
|
-
message: props.message.requiredRule,
|
|
18843
|
-
}),
|
|
18844
|
-
new PhoneRule({
|
|
18845
|
-
model: this.address,
|
|
18846
|
-
fieldKey: "phone",
|
|
18847
|
-
valuePath: "phone",
|
|
18848
|
-
message: props.message.phoneRule,
|
|
18849
|
-
}),
|
|
18850
|
-
]);
|
|
18879
|
+
this.validator = new Validator(this.address, this.validatorRules());
|
|
18851
18880
|
this.listCountries();
|
|
18852
18881
|
if (this.address.country)
|
|
18853
18882
|
this.listCities();
|
|
@@ -19112,23 +19141,30 @@ var RegisterForm = /** @class */ (function () {
|
|
|
19112
19141
|
RegisterForm.prototype.register = function () {
|
|
19113
19142
|
return __awaiter(this, void 0, void 0, function () {
|
|
19114
19143
|
var response, hasFormError, isRegisterSuccess;
|
|
19115
|
-
return __generator(this, function (
|
|
19116
|
-
switch (
|
|
19144
|
+
return __generator(this, function (_b) {
|
|
19145
|
+
switch (_b.label) {
|
|
19117
19146
|
case 0:
|
|
19118
|
-
response = { isFormError: false,
|
|
19147
|
+
response = { isFormError: false, isSuccess: false };
|
|
19119
19148
|
return [4 /*yield*/, this.validateAll()];
|
|
19120
19149
|
case 1:
|
|
19121
|
-
hasFormError =
|
|
19150
|
+
hasFormError = _b.sent();
|
|
19122
19151
|
if (hasFormError) {
|
|
19123
19152
|
response.isFormError = true;
|
|
19124
19153
|
return [2 /*return*/, response];
|
|
19125
19154
|
}
|
|
19126
|
-
|
|
19155
|
+
_b.label = 2;
|
|
19127
19156
|
case 2:
|
|
19128
|
-
|
|
19129
|
-
|
|
19130
|
-
|
|
19157
|
+
_b.trys.push([2, 4, , 5]);
|
|
19158
|
+
return [4 /*yield*/, this.store.customerStore.register(this.model.firstName, this.model.lastName, this.model.email, this.model.password)];
|
|
19159
|
+
case 3:
|
|
19160
|
+
isRegisterSuccess = _b.sent();
|
|
19161
|
+
if (isRegisterSuccess)
|
|
19162
|
+
response.isSuccess = true;
|
|
19163
|
+
return [2 /*return*/, response];
|
|
19164
|
+
case 4:
|
|
19165
|
+
_b.sent();
|
|
19131
19166
|
return [2 /*return*/, response];
|
|
19167
|
+
case 5: return [2 /*return*/];
|
|
19132
19168
|
}
|
|
19133
19169
|
});
|
|
19134
19170
|
});
|
|
@@ -19206,23 +19242,30 @@ var ForgotPasswordForm = /** @class */ (function () {
|
|
|
19206
19242
|
ForgotPasswordForm.prototype.submit = function () {
|
|
19207
19243
|
return __awaiter(this, void 0, void 0, function () {
|
|
19208
19244
|
var response, hasFormError, forgotPasswordResponse;
|
|
19209
|
-
return __generator(this, function (
|
|
19210
|
-
switch (
|
|
19245
|
+
return __generator(this, function (_b) {
|
|
19246
|
+
switch (_b.label) {
|
|
19211
19247
|
case 0:
|
|
19212
|
-
response = { isFormError: false,
|
|
19248
|
+
response = { isFormError: false, isSuccess: false };
|
|
19213
19249
|
return [4 /*yield*/, this.validateAll()];
|
|
19214
19250
|
case 1:
|
|
19215
|
-
hasFormError =
|
|
19251
|
+
hasFormError = _b.sent();
|
|
19216
19252
|
if (hasFormError) {
|
|
19217
19253
|
response.isFormError = true;
|
|
19218
19254
|
return [2 /*return*/, response];
|
|
19219
19255
|
}
|
|
19220
|
-
|
|
19256
|
+
_b.label = 2;
|
|
19221
19257
|
case 2:
|
|
19222
|
-
|
|
19223
|
-
|
|
19224
|
-
|
|
19258
|
+
_b.trys.push([2, 4, , 5]);
|
|
19259
|
+
return [4 /*yield*/, this.store.customerStore.forgotPassword(this.model.email)];
|
|
19260
|
+
case 3:
|
|
19261
|
+
forgotPasswordResponse = _b.sent();
|
|
19262
|
+
if (forgotPasswordResponse)
|
|
19263
|
+
response.isSuccess = true;
|
|
19225
19264
|
return [2 /*return*/, response];
|
|
19265
|
+
case 4:
|
|
19266
|
+
_b.sent();
|
|
19267
|
+
return [2 /*return*/, response];
|
|
19268
|
+
case 5: return [2 /*return*/];
|
|
19226
19269
|
}
|
|
19227
19270
|
});
|
|
19228
19271
|
});
|
|
@@ -19345,14 +19388,14 @@ var RecoverPasswordForm = /** @class */ (function () {
|
|
|
19345
19388
|
RecoverPasswordForm.prototype.submit = function () {
|
|
19346
19389
|
return __awaiter(this, void 0, void 0, function () {
|
|
19347
19390
|
var token, response, hasFormError, urlParams, recoverPasswordResponse;
|
|
19348
|
-
return __generator(this, function (
|
|
19349
|
-
switch (
|
|
19391
|
+
return __generator(this, function (_b) {
|
|
19392
|
+
switch (_b.label) {
|
|
19350
19393
|
case 0:
|
|
19351
19394
|
token = "";
|
|
19352
|
-
response = { isFormError: false,
|
|
19395
|
+
response = { isFormError: false, isSuccess: false };
|
|
19353
19396
|
return [4 /*yield*/, this.validateAll()];
|
|
19354
19397
|
case 1:
|
|
19355
|
-
hasFormError =
|
|
19398
|
+
hasFormError = _b.sent();
|
|
19356
19399
|
if (hasFormError) {
|
|
19357
19400
|
response.isFormError = true;
|
|
19358
19401
|
return [2 /*return*/, response];
|
|
@@ -19361,12 +19404,19 @@ var RecoverPasswordForm = /** @class */ (function () {
|
|
|
19361
19404
|
urlParams = new URLSearchParams(window.location.search);
|
|
19362
19405
|
token = urlParams.get("token") || "";
|
|
19363
19406
|
}
|
|
19364
|
-
|
|
19407
|
+
_b.label = 2;
|
|
19365
19408
|
case 2:
|
|
19366
|
-
|
|
19367
|
-
|
|
19368
|
-
|
|
19409
|
+
_b.trys.push([2, 4, , 5]);
|
|
19410
|
+
return [4 /*yield*/, this.store.customerStore.recoverPassword(this.model.password, this.model.passwordAgain, token)];
|
|
19411
|
+
case 3:
|
|
19412
|
+
recoverPasswordResponse = _b.sent();
|
|
19413
|
+
if (recoverPasswordResponse)
|
|
19414
|
+
response.isSuccess = true;
|
|
19415
|
+
return [2 /*return*/, response];
|
|
19416
|
+
case 4:
|
|
19417
|
+
_b.sent();
|
|
19369
19418
|
return [2 /*return*/, response];
|
|
19419
|
+
case 5: return [2 /*return*/];
|
|
19370
19420
|
}
|
|
19371
19421
|
});
|
|
19372
19422
|
});
|
|
@@ -19412,6 +19462,8 @@ var AccountInfoForm = /** @class */ (function () {
|
|
|
19412
19462
|
};
|
|
19413
19463
|
this.onPhoneChange = function (value) {
|
|
19414
19464
|
_this.customer.phone = value || null;
|
|
19465
|
+
if (!value)
|
|
19466
|
+
_this.validator.setRules(_this.validatorRules());
|
|
19415
19467
|
};
|
|
19416
19468
|
makeObservable(this, {
|
|
19417
19469
|
firstNameErrorMessage: computed,
|
|
@@ -19507,12 +19559,8 @@ var AccountInfoForm = /** @class */ (function () {
|
|
|
19507
19559
|
switch (_b.label) {
|
|
19508
19560
|
case 0:
|
|
19509
19561
|
response = { isFormError: false, isSuccess: false };
|
|
19510
|
-
if (this.phone)
|
|
19562
|
+
if (this.phone)
|
|
19511
19563
|
this.validator.setRules(this.validatorRules(true));
|
|
19512
|
-
}
|
|
19513
|
-
else {
|
|
19514
|
-
this.validator.setRules(this.validatorRules());
|
|
19515
|
-
}
|
|
19516
19564
|
return [4 /*yield*/, this.validateAll()];
|
|
19517
19565
|
case 1:
|
|
19518
19566
|
hasFormError = _b.sent();
|
|
@@ -19550,11 +19598,13 @@ var IkasProductListPropValue = /** @class */ (function () {
|
|
|
19550
19598
|
// Only for collection and brand pages
|
|
19551
19599
|
// Example collections/man -> lists products inside the "man" category
|
|
19552
19600
|
this.usePageFilter = null;
|
|
19601
|
+
this.category = null;
|
|
19553
19602
|
this.productListType = data.productListType || IkasProductListType.ALL;
|
|
19554
19603
|
this.initialSort = data.initialSort || IkasProductListSortType.A_Z;
|
|
19555
19604
|
this.initialLimit = data.initialLimit || 20;
|
|
19556
19605
|
this.productCount = data.productCount;
|
|
19557
19606
|
this.productIds = data.productIds;
|
|
19607
|
+
this.category = data.category;
|
|
19558
19608
|
this.usePageFilter = data.usePageFilter;
|
|
19559
19609
|
makeAutoObservable(this);
|
|
19560
19610
|
}
|
|
@@ -20935,7 +20985,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
20935
20985
|
return __generator(this, function (_b) {
|
|
20936
20986
|
switch (_b.label) {
|
|
20937
20987
|
case 0:
|
|
20938
|
-
QUERY = src(templateObject_7$1 || (templateObject_7$1 = __makeTemplateObject(["\n query getMyCustomer {\n getMyCustomer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "], ["\n query getMyCustomer {\n getMyCustomer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "])));
|
|
20988
|
+
QUERY = src(templateObject_7$1 || (templateObject_7$1 = __makeTemplateObject(["\n query getMyCustomer {\n getMyCustomer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "], ["\n query getMyCustomer {\n getMyCustomer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "])));
|
|
20939
20989
|
_b.label = 1;
|
|
20940
20990
|
case 1:
|
|
20941
20991
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -20965,7 +21015,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
20965
21015
|
return __generator(this, function (_b) {
|
|
20966
21016
|
switch (_b.label) {
|
|
20967
21017
|
case 0:
|
|
20968
|
-
MUTATION = src(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "], ["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "])));
|
|
21018
|
+
MUTATION = src(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "], ["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "])));
|
|
20969
21019
|
_b.label = 1;
|
|
20970
21020
|
case 1:
|
|
20971
21021
|
_b.trys.push([1, 3, , 4]);
|
package/build/index.js
CHANGED
|
@@ -10956,8 +10956,8 @@ var IkasProductListPropValueProvider = /** @class */ (function () {
|
|
|
10956
10956
|
return __generator(this, function (_a) {
|
|
10957
10957
|
switch (_a.label) {
|
|
10958
10958
|
case 0:
|
|
10959
|
+
filters = new IkasProductListFilter();
|
|
10959
10960
|
if (this.productListPropValue.productListType === exports.IkasProductListType.ALL) {
|
|
10960
|
-
filters = new IkasProductListFilter();
|
|
10961
10961
|
// TODO use pageParams to insert filters
|
|
10962
10962
|
if (this.productListPropValue.usePageFilter) {
|
|
10963
10963
|
if (this.pageType === exports.IkasThemePageType.CATEGORY) {
|
|
@@ -10970,6 +10970,14 @@ var IkasProductListPropValueProvider = /** @class */ (function () {
|
|
|
10970
10970
|
}
|
|
10971
10971
|
}
|
|
10972
10972
|
}
|
|
10973
|
+
if (this.productListPropValue.productListType === exports.IkasProductListType.CATEGORY) {
|
|
10974
|
+
if (this.productListPropValue.category) {
|
|
10975
|
+
filters.category = this.productListPropValue.category;
|
|
10976
|
+
}
|
|
10977
|
+
}
|
|
10978
|
+
else {
|
|
10979
|
+
filters.category = null;
|
|
10980
|
+
}
|
|
10973
10981
|
productList = new IkasProductList({
|
|
10974
10982
|
productListPropValue: this.productListPropValue,
|
|
10975
10983
|
filters: filters,
|
|
@@ -14065,6 +14073,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
14065
14073
|
IkasProductListType["STATIC"] = "STATIC";
|
|
14066
14074
|
IkasProductListType["DISCOUNTED"] = "DISCOUNTED";
|
|
14067
14075
|
IkasProductListType["RECOMMENDED"] = "RECOMMENDED";
|
|
14076
|
+
IkasProductListType["CATEGORY"] = "CATEGORY";
|
|
14068
14077
|
})(exports.IkasProductListType || (exports.IkasProductListType = {}));
|
|
14069
14078
|
(function (IkasProductListSortType) {
|
|
14070
14079
|
IkasProductListSortType["MOST_SOLD"] = "MOST_SOLD";
|
|
@@ -17272,7 +17281,8 @@ var Validator = /** @class */ (function () {
|
|
|
17272
17281
|
isValid = _a.sent();
|
|
17273
17282
|
if (!isValid) {
|
|
17274
17283
|
hasError = true;
|
|
17275
|
-
|
|
17284
|
+
if (rule.errorType)
|
|
17285
|
+
errorTypes.push(rule.errorType);
|
|
17276
17286
|
errorMessages.push(rule.errorMessage);
|
|
17277
17287
|
}
|
|
17278
17288
|
_a.label = 3;
|
|
@@ -17280,9 +17290,11 @@ var Validator = /** @class */ (function () {
|
|
|
17280
17290
|
i++;
|
|
17281
17291
|
return [3 /*break*/, 1];
|
|
17282
17292
|
case 4:
|
|
17283
|
-
this.results[fieldKey]
|
|
17284
|
-
|
|
17285
|
-
|
|
17293
|
+
if (this.results[fieldKey]) {
|
|
17294
|
+
this.results[fieldKey].errorTypes = errorTypes;
|
|
17295
|
+
this.results[fieldKey].messages = errorMessages;
|
|
17296
|
+
this.results[fieldKey].status = hasError ? "error" : undefined;
|
|
17297
|
+
}
|
|
17286
17298
|
return [2 /*return*/];
|
|
17287
17299
|
}
|
|
17288
17300
|
});
|
|
@@ -17669,23 +17681,30 @@ var LoginForm = /** @class */ (function () {
|
|
|
17669
17681
|
LoginForm.prototype.logIn = function () {
|
|
17670
17682
|
return __awaiter(this, void 0, void 0, function () {
|
|
17671
17683
|
var response, hasFormError, isLoginSuccess;
|
|
17672
|
-
return __generator(this, function (
|
|
17673
|
-
switch (
|
|
17684
|
+
return __generator(this, function (_b) {
|
|
17685
|
+
switch (_b.label) {
|
|
17674
17686
|
case 0:
|
|
17675
|
-
response = { isFormError: false,
|
|
17687
|
+
response = { isFormError: false, isSuccess: false };
|
|
17676
17688
|
return [4 /*yield*/, this.validateAll()];
|
|
17677
17689
|
case 1:
|
|
17678
|
-
hasFormError =
|
|
17690
|
+
hasFormError = _b.sent();
|
|
17679
17691
|
if (hasFormError) {
|
|
17680
17692
|
response.isFormError = true;
|
|
17681
17693
|
return [2 /*return*/, response];
|
|
17682
17694
|
}
|
|
17683
|
-
|
|
17695
|
+
_b.label = 2;
|
|
17684
17696
|
case 2:
|
|
17685
|
-
|
|
17686
|
-
|
|
17687
|
-
|
|
17697
|
+
_b.trys.push([2, 4, , 5]);
|
|
17698
|
+
return [4 /*yield*/, this.store.customerStore.login(this.model.email, this.model.password)];
|
|
17699
|
+
case 3:
|
|
17700
|
+
isLoginSuccess = _b.sent();
|
|
17701
|
+
if (isLoginSuccess)
|
|
17702
|
+
response.isSuccess = true;
|
|
17688
17703
|
return [2 /*return*/, response];
|
|
17704
|
+
case 4:
|
|
17705
|
+
_b.sent();
|
|
17706
|
+
return [2 /*return*/, response];
|
|
17707
|
+
case 5: return [2 /*return*/];
|
|
17689
17708
|
}
|
|
17690
17709
|
});
|
|
17691
17710
|
});
|
|
@@ -18510,6 +18529,69 @@ var AddressForm = /** @class */ (function () {
|
|
|
18510
18529
|
this._isStatesPending = false;
|
|
18511
18530
|
this._isCitiesPending = false;
|
|
18512
18531
|
this._isDistrictsPending = false;
|
|
18532
|
+
this.validatorRules = function (includePhoneRule) {
|
|
18533
|
+
if (includePhoneRule === void 0) { includePhoneRule = false; }
|
|
18534
|
+
var rules = __spreadArrays([
|
|
18535
|
+
new RequiredRule({
|
|
18536
|
+
model: _this.address,
|
|
18537
|
+
fieldKey: "firstName",
|
|
18538
|
+
valuePath: "firstName",
|
|
18539
|
+
message: _this.message.requiredRule,
|
|
18540
|
+
}),
|
|
18541
|
+
new RequiredRule({
|
|
18542
|
+
model: _this.address,
|
|
18543
|
+
fieldKey: "lastName",
|
|
18544
|
+
valuePath: "lastName",
|
|
18545
|
+
message: _this.message.requiredRule,
|
|
18546
|
+
}),
|
|
18547
|
+
new RequiredRule({
|
|
18548
|
+
model: _this.address,
|
|
18549
|
+
fieldKey: "addressLine1",
|
|
18550
|
+
valuePath: "addressLine1",
|
|
18551
|
+
message: _this.message.requiredRule,
|
|
18552
|
+
}),
|
|
18553
|
+
new RequiredRule({
|
|
18554
|
+
model: _this.address,
|
|
18555
|
+
fieldKey: "postalCode",
|
|
18556
|
+
valuePath: "postalCode",
|
|
18557
|
+
message: _this.message.requiredRule,
|
|
18558
|
+
}),
|
|
18559
|
+
new RequiredRule({
|
|
18560
|
+
model: _this.address,
|
|
18561
|
+
fieldKey: "country",
|
|
18562
|
+
valuePath: "country",
|
|
18563
|
+
message: _this.message.requiredRule,
|
|
18564
|
+
}),
|
|
18565
|
+
new RequiredRule({
|
|
18566
|
+
model: _this.address,
|
|
18567
|
+
fieldKey: "state",
|
|
18568
|
+
valuePath: "state",
|
|
18569
|
+
message: _this.message.requiredRule,
|
|
18570
|
+
}),
|
|
18571
|
+
new RequiredRule({
|
|
18572
|
+
model: _this.address,
|
|
18573
|
+
fieldKey: "city",
|
|
18574
|
+
valuePath: "city",
|
|
18575
|
+
message: _this.message.requiredRule,
|
|
18576
|
+
}),
|
|
18577
|
+
new RequiredRule({
|
|
18578
|
+
model: _this.address,
|
|
18579
|
+
fieldKey: "title",
|
|
18580
|
+
valuePath: "title",
|
|
18581
|
+
message: _this.message.requiredRule,
|
|
18582
|
+
})
|
|
18583
|
+
], (includePhoneRule
|
|
18584
|
+
? [
|
|
18585
|
+
new PhoneRule({
|
|
18586
|
+
model: _this.address,
|
|
18587
|
+
fieldKey: "phone",
|
|
18588
|
+
valuePath: "phone",
|
|
18589
|
+
message: _this.message.phoneRule,
|
|
18590
|
+
}),
|
|
18591
|
+
]
|
|
18592
|
+
: []));
|
|
18593
|
+
return rules;
|
|
18594
|
+
};
|
|
18513
18595
|
this.onTitleChange = function (value) {
|
|
18514
18596
|
_this.address.title = value;
|
|
18515
18597
|
};
|
|
@@ -18521,6 +18603,8 @@ var AddressForm = /** @class */ (function () {
|
|
|
18521
18603
|
};
|
|
18522
18604
|
this.onPhoneChange = function (value) {
|
|
18523
18605
|
_this.address.phone = value;
|
|
18606
|
+
if (!value)
|
|
18607
|
+
_this.validator.setRules(_this.validatorRules());
|
|
18524
18608
|
};
|
|
18525
18609
|
this.onAddressLine1Change = function (value) {
|
|
18526
18610
|
_this.address.addressLine1 = value;
|
|
@@ -18709,17 +18793,18 @@ var AddressForm = /** @class */ (function () {
|
|
|
18709
18793
|
};
|
|
18710
18794
|
this.submit = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
18711
18795
|
var response, hasFormError, customer, saveCustomerResponse;
|
|
18712
|
-
return __generator(this, function (
|
|
18713
|
-
switch (
|
|
18796
|
+
return __generator(this, function (_b) {
|
|
18797
|
+
switch (_b.label) {
|
|
18714
18798
|
case 0:
|
|
18715
18799
|
response = {
|
|
18716
18800
|
isFormError: false,
|
|
18717
|
-
isAPIError: false,
|
|
18718
18801
|
isSuccess: false,
|
|
18719
18802
|
};
|
|
18803
|
+
if (this.address.phone)
|
|
18804
|
+
this.validator.setRules(this.validatorRules(true));
|
|
18720
18805
|
return [4 /*yield*/, this.validateAll()];
|
|
18721
18806
|
case 1:
|
|
18722
|
-
hasFormError =
|
|
18807
|
+
hasFormError = _b.sent();
|
|
18723
18808
|
if (hasFormError) {
|
|
18724
18809
|
response.isFormError = true;
|
|
18725
18810
|
return [2 /*return*/, response];
|
|
@@ -18733,15 +18818,19 @@ var AddressForm = /** @class */ (function () {
|
|
|
18733
18818
|
else {
|
|
18734
18819
|
customer.addresses.push(this.address);
|
|
18735
18820
|
}
|
|
18736
|
-
|
|
18821
|
+
_b.label = 2;
|
|
18737
18822
|
case 2:
|
|
18738
|
-
|
|
18739
|
-
|
|
18740
|
-
|
|
18741
|
-
|
|
18742
|
-
|
|
18743
|
-
|
|
18823
|
+
_b.trys.push([2, 4, , 5]);
|
|
18824
|
+
return [4 /*yield*/, this.store.customerStore.saveCustomer(customer)];
|
|
18825
|
+
case 3:
|
|
18826
|
+
saveCustomerResponse = _b.sent();
|
|
18827
|
+
if (saveCustomerResponse)
|
|
18828
|
+
response.isSuccess = true;
|
|
18829
|
+
return [2 /*return*/, response];
|
|
18830
|
+
case 4:
|
|
18831
|
+
_b.sent();
|
|
18744
18832
|
return [2 /*return*/, response];
|
|
18833
|
+
case 5: return [2 /*return*/];
|
|
18745
18834
|
}
|
|
18746
18835
|
});
|
|
18747
18836
|
}); };
|
|
@@ -18767,69 +18856,9 @@ var AddressForm = /** @class */ (function () {
|
|
|
18767
18856
|
submit: mobx.action,
|
|
18768
18857
|
});
|
|
18769
18858
|
this.address = props.address;
|
|
18859
|
+
this.message = props.message;
|
|
18770
18860
|
this.store = props.store;
|
|
18771
|
-
this.validator = new Validator(this.address,
|
|
18772
|
-
new RequiredRule({
|
|
18773
|
-
model: this.address,
|
|
18774
|
-
fieldKey: "firstName",
|
|
18775
|
-
valuePath: "firstName",
|
|
18776
|
-
message: props.message.requiredRule,
|
|
18777
|
-
}),
|
|
18778
|
-
new RequiredRule({
|
|
18779
|
-
model: this.address,
|
|
18780
|
-
fieldKey: "lastName",
|
|
18781
|
-
valuePath: "lastName",
|
|
18782
|
-
message: props.message.requiredRule,
|
|
18783
|
-
}),
|
|
18784
|
-
new RequiredRule({
|
|
18785
|
-
model: this.address,
|
|
18786
|
-
fieldKey: "addressLine1",
|
|
18787
|
-
valuePath: "addressLine1",
|
|
18788
|
-
message: props.message.requiredRule,
|
|
18789
|
-
}),
|
|
18790
|
-
new RequiredRule({
|
|
18791
|
-
model: this.address,
|
|
18792
|
-
fieldKey: "postalCode",
|
|
18793
|
-
valuePath: "postalCode",
|
|
18794
|
-
message: props.message.requiredRule,
|
|
18795
|
-
}),
|
|
18796
|
-
new RequiredRule({
|
|
18797
|
-
model: this.address,
|
|
18798
|
-
fieldKey: "country",
|
|
18799
|
-
valuePath: "country",
|
|
18800
|
-
message: props.message.requiredRule,
|
|
18801
|
-
}),
|
|
18802
|
-
new RequiredRule({
|
|
18803
|
-
model: this.address,
|
|
18804
|
-
fieldKey: "state",
|
|
18805
|
-
valuePath: "state",
|
|
18806
|
-
message: props.message.requiredRule,
|
|
18807
|
-
}),
|
|
18808
|
-
new RequiredRule({
|
|
18809
|
-
model: this.address,
|
|
18810
|
-
fieldKey: "city",
|
|
18811
|
-
valuePath: "city",
|
|
18812
|
-
message: props.message.requiredRule,
|
|
18813
|
-
}),
|
|
18814
|
-
new RequiredRule({
|
|
18815
|
-
model: this.address,
|
|
18816
|
-
fieldKey: "phone",
|
|
18817
|
-
valuePath: "phone",
|
|
18818
|
-
message: props.message.requiredRule,
|
|
18819
|
-
}),
|
|
18820
|
-
new RequiredRule({
|
|
18821
|
-
model: this.address,
|
|
18822
|
-
fieldKey: "title",
|
|
18823
|
-
valuePath: "title",
|
|
18824
|
-
message: props.message.requiredRule,
|
|
18825
|
-
}),
|
|
18826
|
-
new PhoneRule({
|
|
18827
|
-
model: this.address,
|
|
18828
|
-
fieldKey: "phone",
|
|
18829
|
-
valuePath: "phone",
|
|
18830
|
-
message: props.message.phoneRule,
|
|
18831
|
-
}),
|
|
18832
|
-
]);
|
|
18861
|
+
this.validator = new Validator(this.address, this.validatorRules());
|
|
18833
18862
|
this.listCountries();
|
|
18834
18863
|
if (this.address.country)
|
|
18835
18864
|
this.listCities();
|
|
@@ -19094,23 +19123,30 @@ var RegisterForm = /** @class */ (function () {
|
|
|
19094
19123
|
RegisterForm.prototype.register = function () {
|
|
19095
19124
|
return __awaiter(this, void 0, void 0, function () {
|
|
19096
19125
|
var response, hasFormError, isRegisterSuccess;
|
|
19097
|
-
return __generator(this, function (
|
|
19098
|
-
switch (
|
|
19126
|
+
return __generator(this, function (_b) {
|
|
19127
|
+
switch (_b.label) {
|
|
19099
19128
|
case 0:
|
|
19100
|
-
response = { isFormError: false,
|
|
19129
|
+
response = { isFormError: false, isSuccess: false };
|
|
19101
19130
|
return [4 /*yield*/, this.validateAll()];
|
|
19102
19131
|
case 1:
|
|
19103
|
-
hasFormError =
|
|
19132
|
+
hasFormError = _b.sent();
|
|
19104
19133
|
if (hasFormError) {
|
|
19105
19134
|
response.isFormError = true;
|
|
19106
19135
|
return [2 /*return*/, response];
|
|
19107
19136
|
}
|
|
19108
|
-
|
|
19137
|
+
_b.label = 2;
|
|
19109
19138
|
case 2:
|
|
19110
|
-
|
|
19111
|
-
|
|
19112
|
-
|
|
19139
|
+
_b.trys.push([2, 4, , 5]);
|
|
19140
|
+
return [4 /*yield*/, this.store.customerStore.register(this.model.firstName, this.model.lastName, this.model.email, this.model.password)];
|
|
19141
|
+
case 3:
|
|
19142
|
+
isRegisterSuccess = _b.sent();
|
|
19143
|
+
if (isRegisterSuccess)
|
|
19144
|
+
response.isSuccess = true;
|
|
19145
|
+
return [2 /*return*/, response];
|
|
19146
|
+
case 4:
|
|
19147
|
+
_b.sent();
|
|
19113
19148
|
return [2 /*return*/, response];
|
|
19149
|
+
case 5: return [2 /*return*/];
|
|
19114
19150
|
}
|
|
19115
19151
|
});
|
|
19116
19152
|
});
|
|
@@ -19188,23 +19224,30 @@ var ForgotPasswordForm = /** @class */ (function () {
|
|
|
19188
19224
|
ForgotPasswordForm.prototype.submit = function () {
|
|
19189
19225
|
return __awaiter(this, void 0, void 0, function () {
|
|
19190
19226
|
var response, hasFormError, forgotPasswordResponse;
|
|
19191
|
-
return __generator(this, function (
|
|
19192
|
-
switch (
|
|
19227
|
+
return __generator(this, function (_b) {
|
|
19228
|
+
switch (_b.label) {
|
|
19193
19229
|
case 0:
|
|
19194
|
-
response = { isFormError: false,
|
|
19230
|
+
response = { isFormError: false, isSuccess: false };
|
|
19195
19231
|
return [4 /*yield*/, this.validateAll()];
|
|
19196
19232
|
case 1:
|
|
19197
|
-
hasFormError =
|
|
19233
|
+
hasFormError = _b.sent();
|
|
19198
19234
|
if (hasFormError) {
|
|
19199
19235
|
response.isFormError = true;
|
|
19200
19236
|
return [2 /*return*/, response];
|
|
19201
19237
|
}
|
|
19202
|
-
|
|
19238
|
+
_b.label = 2;
|
|
19203
19239
|
case 2:
|
|
19204
|
-
|
|
19205
|
-
|
|
19206
|
-
|
|
19240
|
+
_b.trys.push([2, 4, , 5]);
|
|
19241
|
+
return [4 /*yield*/, this.store.customerStore.forgotPassword(this.model.email)];
|
|
19242
|
+
case 3:
|
|
19243
|
+
forgotPasswordResponse = _b.sent();
|
|
19244
|
+
if (forgotPasswordResponse)
|
|
19245
|
+
response.isSuccess = true;
|
|
19207
19246
|
return [2 /*return*/, response];
|
|
19247
|
+
case 4:
|
|
19248
|
+
_b.sent();
|
|
19249
|
+
return [2 /*return*/, response];
|
|
19250
|
+
case 5: return [2 /*return*/];
|
|
19208
19251
|
}
|
|
19209
19252
|
});
|
|
19210
19253
|
});
|
|
@@ -19327,14 +19370,14 @@ var RecoverPasswordForm = /** @class */ (function () {
|
|
|
19327
19370
|
RecoverPasswordForm.prototype.submit = function () {
|
|
19328
19371
|
return __awaiter(this, void 0, void 0, function () {
|
|
19329
19372
|
var token, response, hasFormError, urlParams, recoverPasswordResponse;
|
|
19330
|
-
return __generator(this, function (
|
|
19331
|
-
switch (
|
|
19373
|
+
return __generator(this, function (_b) {
|
|
19374
|
+
switch (_b.label) {
|
|
19332
19375
|
case 0:
|
|
19333
19376
|
token = "";
|
|
19334
|
-
response = { isFormError: false,
|
|
19377
|
+
response = { isFormError: false, isSuccess: false };
|
|
19335
19378
|
return [4 /*yield*/, this.validateAll()];
|
|
19336
19379
|
case 1:
|
|
19337
|
-
hasFormError =
|
|
19380
|
+
hasFormError = _b.sent();
|
|
19338
19381
|
if (hasFormError) {
|
|
19339
19382
|
response.isFormError = true;
|
|
19340
19383
|
return [2 /*return*/, response];
|
|
@@ -19343,12 +19386,19 @@ var RecoverPasswordForm = /** @class */ (function () {
|
|
|
19343
19386
|
urlParams = new URLSearchParams(window.location.search);
|
|
19344
19387
|
token = urlParams.get("token") || "";
|
|
19345
19388
|
}
|
|
19346
|
-
|
|
19389
|
+
_b.label = 2;
|
|
19347
19390
|
case 2:
|
|
19348
|
-
|
|
19349
|
-
|
|
19350
|
-
|
|
19391
|
+
_b.trys.push([2, 4, , 5]);
|
|
19392
|
+
return [4 /*yield*/, this.store.customerStore.recoverPassword(this.model.password, this.model.passwordAgain, token)];
|
|
19393
|
+
case 3:
|
|
19394
|
+
recoverPasswordResponse = _b.sent();
|
|
19395
|
+
if (recoverPasswordResponse)
|
|
19396
|
+
response.isSuccess = true;
|
|
19397
|
+
return [2 /*return*/, response];
|
|
19398
|
+
case 4:
|
|
19399
|
+
_b.sent();
|
|
19351
19400
|
return [2 /*return*/, response];
|
|
19401
|
+
case 5: return [2 /*return*/];
|
|
19352
19402
|
}
|
|
19353
19403
|
});
|
|
19354
19404
|
});
|
|
@@ -19394,6 +19444,8 @@ var AccountInfoForm = /** @class */ (function () {
|
|
|
19394
19444
|
};
|
|
19395
19445
|
this.onPhoneChange = function (value) {
|
|
19396
19446
|
_this.customer.phone = value || null;
|
|
19447
|
+
if (!value)
|
|
19448
|
+
_this.validator.setRules(_this.validatorRules());
|
|
19397
19449
|
};
|
|
19398
19450
|
mobx.makeObservable(this, {
|
|
19399
19451
|
firstNameErrorMessage: mobx.computed,
|
|
@@ -19489,12 +19541,8 @@ var AccountInfoForm = /** @class */ (function () {
|
|
|
19489
19541
|
switch (_b.label) {
|
|
19490
19542
|
case 0:
|
|
19491
19543
|
response = { isFormError: false, isSuccess: false };
|
|
19492
|
-
if (this.phone)
|
|
19544
|
+
if (this.phone)
|
|
19493
19545
|
this.validator.setRules(this.validatorRules(true));
|
|
19494
|
-
}
|
|
19495
|
-
else {
|
|
19496
|
-
this.validator.setRules(this.validatorRules());
|
|
19497
|
-
}
|
|
19498
19546
|
return [4 /*yield*/, this.validateAll()];
|
|
19499
19547
|
case 1:
|
|
19500
19548
|
hasFormError = _b.sent();
|
|
@@ -19532,11 +19580,13 @@ var IkasProductListPropValue = /** @class */ (function () {
|
|
|
19532
19580
|
// Only for collection and brand pages
|
|
19533
19581
|
// Example collections/man -> lists products inside the "man" category
|
|
19534
19582
|
this.usePageFilter = null;
|
|
19583
|
+
this.category = null;
|
|
19535
19584
|
this.productListType = data.productListType || exports.IkasProductListType.ALL;
|
|
19536
19585
|
this.initialSort = data.initialSort || exports.IkasProductListSortType.A_Z;
|
|
19537
19586
|
this.initialLimit = data.initialLimit || 20;
|
|
19538
19587
|
this.productCount = data.productCount;
|
|
19539
19588
|
this.productIds = data.productIds;
|
|
19589
|
+
this.category = data.category;
|
|
19540
19590
|
this.usePageFilter = data.usePageFilter;
|
|
19541
19591
|
mobx.makeAutoObservable(this);
|
|
19542
19592
|
}
|
|
@@ -20917,7 +20967,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
20917
20967
|
return __generator(this, function (_b) {
|
|
20918
20968
|
switch (_b.label) {
|
|
20919
20969
|
case 0:
|
|
20920
|
-
QUERY = src(templateObject_7$1 || (templateObject_7$1 = __makeTemplateObject(["\n query getMyCustomer {\n getMyCustomer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "], ["\n query getMyCustomer {\n getMyCustomer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "])));
|
|
20970
|
+
QUERY = src(templateObject_7$1 || (templateObject_7$1 = __makeTemplateObject(["\n query getMyCustomer {\n getMyCustomer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "], ["\n query getMyCustomer {\n getMyCustomer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "])));
|
|
20921
20971
|
_b.label = 1;
|
|
20922
20972
|
case 1:
|
|
20923
20973
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -20947,7 +20997,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
20947
20997
|
return __generator(this, function (_b) {
|
|
20948
20998
|
switch (_b.label) {
|
|
20949
20999
|
case 0:
|
|
20950
|
-
MUTATION = src(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "], ["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "])));
|
|
21000
|
+
MUTATION = src(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "], ["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\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 id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "])));
|
|
20951
21001
|
_b.label = 1;
|
|
20952
21002
|
case 1:
|
|
20953
21003
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -6,6 +6,7 @@ export declare class IkasProductListPropValue {
|
|
|
6
6
|
productCount?: number | null;
|
|
7
7
|
productIds?: IkasProductVariantId[] | null;
|
|
8
8
|
usePageFilter?: boolean | null;
|
|
9
|
+
category?: string | null;
|
|
9
10
|
constructor(data: Partial<IkasProductListPropValue>);
|
|
10
11
|
}
|
|
11
12
|
declare type IkasProductVariantId = {
|
|
@@ -62,7 +62,8 @@ export declare enum IkasProductListType {
|
|
|
62
62
|
ALL = "ALL",
|
|
63
63
|
STATIC = "STATIC",
|
|
64
64
|
DISCOUNTED = "DISCOUNTED",
|
|
65
|
-
RECOMMENDED = "RECOMMENDED"
|
|
65
|
+
RECOMMENDED = "RECOMMENDED",
|
|
66
|
+
CATEGORY = "CATEGORY"
|
|
66
67
|
}
|
|
67
68
|
export declare enum IkasProductListSortType {
|
|
68
69
|
MOST_SOLD = "MOST_SOLD",
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { IkasCity, IkasCountry, IkasCustomerAddress, IkasDistrict, IkasState } from "../../../data/index";
|
|
2
2
|
import { IkasBaseStore } from "../../../../store/index";
|
|
3
|
+
import { PhoneRule, RequiredRule } from "../rules/index";
|
|
4
|
+
declare type AddressFormPropsValidatorMessage<T> = {
|
|
5
|
+
requiredRule: ((model: T) => string) | string;
|
|
6
|
+
phoneRule?: ((model: T) => string) | string;
|
|
7
|
+
};
|
|
3
8
|
declare type AddressFormProps<T> = {
|
|
4
|
-
message:
|
|
5
|
-
requiredRule: ((model: T) => string) | string;
|
|
6
|
-
phoneRule: ((model: T) => string) | string;
|
|
7
|
-
};
|
|
9
|
+
message: AddressFormPropsValidatorMessage<T>;
|
|
8
10
|
address: IkasCustomerAddress;
|
|
9
11
|
store: IkasBaseStore;
|
|
10
12
|
};
|
|
@@ -20,7 +22,9 @@ export declare class AddressForm {
|
|
|
20
22
|
private _isDistrictsPending;
|
|
21
23
|
private store;
|
|
22
24
|
private validator;
|
|
25
|
+
private message;
|
|
23
26
|
constructor(props: AddressFormProps<IkasCustomerAddress>);
|
|
27
|
+
validatorRules: (includePhoneRule?: boolean) => (RequiredRule<IkasCustomerAddress> | PhoneRule<IkasCustomerAddress>)[];
|
|
24
28
|
onTitleChange: (value: string) => void;
|
|
25
29
|
onFirstNameChange: (value: string) => void;
|
|
26
30
|
onLastNameChange: (value: string) => void;
|
|
@@ -65,7 +69,6 @@ export declare class AddressForm {
|
|
|
65
69
|
validateAll: () => Promise<boolean>;
|
|
66
70
|
submit: () => Promise<{
|
|
67
71
|
isFormError: boolean;
|
|
68
|
-
isAPIError: boolean;
|
|
69
72
|
isSuccess: boolean;
|
|
70
73
|
}>;
|
|
71
74
|
}
|