@ikas/storefront 0.0.41 → 0.0.42
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 +155 -116
- package/build/index.js +155 -116
- 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
|
@@ -17289,7 +17289,8 @@ var Validator = /** @class */ (function () {
|
|
|
17289
17289
|
isValid = _a.sent();
|
|
17290
17290
|
if (!isValid) {
|
|
17291
17291
|
hasError = true;
|
|
17292
|
-
|
|
17292
|
+
if (rule.errorType)
|
|
17293
|
+
errorTypes.push(rule.errorType);
|
|
17293
17294
|
errorMessages.push(rule.errorMessage);
|
|
17294
17295
|
}
|
|
17295
17296
|
_a.label = 3;
|
|
@@ -17297,9 +17298,11 @@ var Validator = /** @class */ (function () {
|
|
|
17297
17298
|
i++;
|
|
17298
17299
|
return [3 /*break*/, 1];
|
|
17299
17300
|
case 4:
|
|
17300
|
-
this.results[fieldKey]
|
|
17301
|
-
|
|
17302
|
-
|
|
17301
|
+
if (this.results[fieldKey]) {
|
|
17302
|
+
this.results[fieldKey].errorTypes = errorTypes;
|
|
17303
|
+
this.results[fieldKey].messages = errorMessages;
|
|
17304
|
+
this.results[fieldKey].status = hasError ? "error" : undefined;
|
|
17305
|
+
}
|
|
17303
17306
|
return [2 /*return*/];
|
|
17304
17307
|
}
|
|
17305
17308
|
});
|
|
@@ -17687,23 +17690,30 @@ var LoginForm = /** @class */ (function () {
|
|
|
17687
17690
|
LoginForm.prototype.logIn = function () {
|
|
17688
17691
|
return __awaiter(this, void 0, void 0, function () {
|
|
17689
17692
|
var response, hasFormError, isLoginSuccess;
|
|
17690
|
-
return __generator(this, function (
|
|
17691
|
-
switch (
|
|
17693
|
+
return __generator(this, function (_b) {
|
|
17694
|
+
switch (_b.label) {
|
|
17692
17695
|
case 0:
|
|
17693
|
-
response = { isFormError: false,
|
|
17696
|
+
response = { isFormError: false, isSuccess: false };
|
|
17694
17697
|
return [4 /*yield*/, this.validateAll()];
|
|
17695
17698
|
case 1:
|
|
17696
|
-
hasFormError =
|
|
17699
|
+
hasFormError = _b.sent();
|
|
17697
17700
|
if (hasFormError) {
|
|
17698
17701
|
response.isFormError = true;
|
|
17699
17702
|
return [2 /*return*/, response];
|
|
17700
17703
|
}
|
|
17701
|
-
|
|
17704
|
+
_b.label = 2;
|
|
17702
17705
|
case 2:
|
|
17703
|
-
|
|
17704
|
-
|
|
17705
|
-
|
|
17706
|
+
_b.trys.push([2, 4, , 5]);
|
|
17707
|
+
return [4 /*yield*/, this.store.customerStore.login(this.model.email, this.model.password)];
|
|
17708
|
+
case 3:
|
|
17709
|
+
isLoginSuccess = _b.sent();
|
|
17710
|
+
if (isLoginSuccess)
|
|
17711
|
+
response.isSuccess = true;
|
|
17712
|
+
return [2 /*return*/, response];
|
|
17713
|
+
case 4:
|
|
17714
|
+
_b.sent();
|
|
17706
17715
|
return [2 /*return*/, response];
|
|
17716
|
+
case 5: return [2 /*return*/];
|
|
17707
17717
|
}
|
|
17708
17718
|
});
|
|
17709
17719
|
});
|
|
@@ -18528,6 +18538,69 @@ var AddressForm = /** @class */ (function () {
|
|
|
18528
18538
|
this._isStatesPending = false;
|
|
18529
18539
|
this._isCitiesPending = false;
|
|
18530
18540
|
this._isDistrictsPending = false;
|
|
18541
|
+
this.validatorRules = function (includePhoneRule) {
|
|
18542
|
+
if (includePhoneRule === void 0) { includePhoneRule = false; }
|
|
18543
|
+
var rules = __spreadArrays([
|
|
18544
|
+
new RequiredRule({
|
|
18545
|
+
model: _this.address,
|
|
18546
|
+
fieldKey: "firstName",
|
|
18547
|
+
valuePath: "firstName",
|
|
18548
|
+
message: _this.message.requiredRule,
|
|
18549
|
+
}),
|
|
18550
|
+
new RequiredRule({
|
|
18551
|
+
model: _this.address,
|
|
18552
|
+
fieldKey: "lastName",
|
|
18553
|
+
valuePath: "lastName",
|
|
18554
|
+
message: _this.message.requiredRule,
|
|
18555
|
+
}),
|
|
18556
|
+
new RequiredRule({
|
|
18557
|
+
model: _this.address,
|
|
18558
|
+
fieldKey: "addressLine1",
|
|
18559
|
+
valuePath: "addressLine1",
|
|
18560
|
+
message: _this.message.requiredRule,
|
|
18561
|
+
}),
|
|
18562
|
+
new RequiredRule({
|
|
18563
|
+
model: _this.address,
|
|
18564
|
+
fieldKey: "postalCode",
|
|
18565
|
+
valuePath: "postalCode",
|
|
18566
|
+
message: _this.message.requiredRule,
|
|
18567
|
+
}),
|
|
18568
|
+
new RequiredRule({
|
|
18569
|
+
model: _this.address,
|
|
18570
|
+
fieldKey: "country",
|
|
18571
|
+
valuePath: "country",
|
|
18572
|
+
message: _this.message.requiredRule,
|
|
18573
|
+
}),
|
|
18574
|
+
new RequiredRule({
|
|
18575
|
+
model: _this.address,
|
|
18576
|
+
fieldKey: "state",
|
|
18577
|
+
valuePath: "state",
|
|
18578
|
+
message: _this.message.requiredRule,
|
|
18579
|
+
}),
|
|
18580
|
+
new RequiredRule({
|
|
18581
|
+
model: _this.address,
|
|
18582
|
+
fieldKey: "city",
|
|
18583
|
+
valuePath: "city",
|
|
18584
|
+
message: _this.message.requiredRule,
|
|
18585
|
+
}),
|
|
18586
|
+
new RequiredRule({
|
|
18587
|
+
model: _this.address,
|
|
18588
|
+
fieldKey: "title",
|
|
18589
|
+
valuePath: "title",
|
|
18590
|
+
message: _this.message.requiredRule,
|
|
18591
|
+
})
|
|
18592
|
+
], (includePhoneRule
|
|
18593
|
+
? [
|
|
18594
|
+
new PhoneRule({
|
|
18595
|
+
model: _this.address,
|
|
18596
|
+
fieldKey: "phone",
|
|
18597
|
+
valuePath: "phone",
|
|
18598
|
+
message: _this.message.phoneRule,
|
|
18599
|
+
}),
|
|
18600
|
+
]
|
|
18601
|
+
: []));
|
|
18602
|
+
return rules;
|
|
18603
|
+
};
|
|
18531
18604
|
this.onTitleChange = function (value) {
|
|
18532
18605
|
_this.address.title = value;
|
|
18533
18606
|
};
|
|
@@ -18539,6 +18612,8 @@ var AddressForm = /** @class */ (function () {
|
|
|
18539
18612
|
};
|
|
18540
18613
|
this.onPhoneChange = function (value) {
|
|
18541
18614
|
_this.address.phone = value;
|
|
18615
|
+
if (!value)
|
|
18616
|
+
_this.validator.setRules(_this.validatorRules());
|
|
18542
18617
|
};
|
|
18543
18618
|
this.onAddressLine1Change = function (value) {
|
|
18544
18619
|
_this.address.addressLine1 = value;
|
|
@@ -18727,17 +18802,18 @@ var AddressForm = /** @class */ (function () {
|
|
|
18727
18802
|
};
|
|
18728
18803
|
this.submit = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
18729
18804
|
var response, hasFormError, customer, saveCustomerResponse;
|
|
18730
|
-
return __generator(this, function (
|
|
18731
|
-
switch (
|
|
18805
|
+
return __generator(this, function (_b) {
|
|
18806
|
+
switch (_b.label) {
|
|
18732
18807
|
case 0:
|
|
18733
18808
|
response = {
|
|
18734
18809
|
isFormError: false,
|
|
18735
|
-
isAPIError: false,
|
|
18736
18810
|
isSuccess: false,
|
|
18737
18811
|
};
|
|
18812
|
+
if (this.address.phone)
|
|
18813
|
+
this.validator.setRules(this.validatorRules(true));
|
|
18738
18814
|
return [4 /*yield*/, this.validateAll()];
|
|
18739
18815
|
case 1:
|
|
18740
|
-
hasFormError =
|
|
18816
|
+
hasFormError = _b.sent();
|
|
18741
18817
|
if (hasFormError) {
|
|
18742
18818
|
response.isFormError = true;
|
|
18743
18819
|
return [2 /*return*/, response];
|
|
@@ -18751,15 +18827,19 @@ var AddressForm = /** @class */ (function () {
|
|
|
18751
18827
|
else {
|
|
18752
18828
|
customer.addresses.push(this.address);
|
|
18753
18829
|
}
|
|
18754
|
-
|
|
18830
|
+
_b.label = 2;
|
|
18755
18831
|
case 2:
|
|
18756
|
-
|
|
18757
|
-
|
|
18758
|
-
|
|
18759
|
-
|
|
18760
|
-
|
|
18761
|
-
|
|
18832
|
+
_b.trys.push([2, 4, , 5]);
|
|
18833
|
+
return [4 /*yield*/, this.store.customerStore.saveCustomer(customer)];
|
|
18834
|
+
case 3:
|
|
18835
|
+
saveCustomerResponse = _b.sent();
|
|
18836
|
+
if (saveCustomerResponse)
|
|
18837
|
+
response.isSuccess = true;
|
|
18838
|
+
return [2 /*return*/, response];
|
|
18839
|
+
case 4:
|
|
18840
|
+
_b.sent();
|
|
18762
18841
|
return [2 /*return*/, response];
|
|
18842
|
+
case 5: return [2 /*return*/];
|
|
18763
18843
|
}
|
|
18764
18844
|
});
|
|
18765
18845
|
}); };
|
|
@@ -18785,69 +18865,9 @@ var AddressForm = /** @class */ (function () {
|
|
|
18785
18865
|
submit: action,
|
|
18786
18866
|
});
|
|
18787
18867
|
this.address = props.address;
|
|
18868
|
+
this.message = props.message;
|
|
18788
18869
|
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
|
-
]);
|
|
18870
|
+
this.validator = new Validator(this.address, this.validatorRules());
|
|
18851
18871
|
this.listCountries();
|
|
18852
18872
|
if (this.address.country)
|
|
18853
18873
|
this.listCities();
|
|
@@ -19112,23 +19132,30 @@ var RegisterForm = /** @class */ (function () {
|
|
|
19112
19132
|
RegisterForm.prototype.register = function () {
|
|
19113
19133
|
return __awaiter(this, void 0, void 0, function () {
|
|
19114
19134
|
var response, hasFormError, isRegisterSuccess;
|
|
19115
|
-
return __generator(this, function (
|
|
19116
|
-
switch (
|
|
19135
|
+
return __generator(this, function (_b) {
|
|
19136
|
+
switch (_b.label) {
|
|
19117
19137
|
case 0:
|
|
19118
|
-
response = { isFormError: false,
|
|
19138
|
+
response = { isFormError: false, isSuccess: false };
|
|
19119
19139
|
return [4 /*yield*/, this.validateAll()];
|
|
19120
19140
|
case 1:
|
|
19121
|
-
hasFormError =
|
|
19141
|
+
hasFormError = _b.sent();
|
|
19122
19142
|
if (hasFormError) {
|
|
19123
19143
|
response.isFormError = true;
|
|
19124
19144
|
return [2 /*return*/, response];
|
|
19125
19145
|
}
|
|
19126
|
-
|
|
19146
|
+
_b.label = 2;
|
|
19127
19147
|
case 2:
|
|
19128
|
-
|
|
19129
|
-
|
|
19130
|
-
|
|
19148
|
+
_b.trys.push([2, 4, , 5]);
|
|
19149
|
+
return [4 /*yield*/, this.store.customerStore.register(this.model.firstName, this.model.lastName, this.model.email, this.model.password)];
|
|
19150
|
+
case 3:
|
|
19151
|
+
isRegisterSuccess = _b.sent();
|
|
19152
|
+
if (isRegisterSuccess)
|
|
19153
|
+
response.isSuccess = true;
|
|
19131
19154
|
return [2 /*return*/, response];
|
|
19155
|
+
case 4:
|
|
19156
|
+
_b.sent();
|
|
19157
|
+
return [2 /*return*/, response];
|
|
19158
|
+
case 5: return [2 /*return*/];
|
|
19132
19159
|
}
|
|
19133
19160
|
});
|
|
19134
19161
|
});
|
|
@@ -19206,23 +19233,30 @@ var ForgotPasswordForm = /** @class */ (function () {
|
|
|
19206
19233
|
ForgotPasswordForm.prototype.submit = function () {
|
|
19207
19234
|
return __awaiter(this, void 0, void 0, function () {
|
|
19208
19235
|
var response, hasFormError, forgotPasswordResponse;
|
|
19209
|
-
return __generator(this, function (
|
|
19210
|
-
switch (
|
|
19236
|
+
return __generator(this, function (_b) {
|
|
19237
|
+
switch (_b.label) {
|
|
19211
19238
|
case 0:
|
|
19212
|
-
response = { isFormError: false,
|
|
19239
|
+
response = { isFormError: false, isSuccess: false };
|
|
19213
19240
|
return [4 /*yield*/, this.validateAll()];
|
|
19214
19241
|
case 1:
|
|
19215
|
-
hasFormError =
|
|
19242
|
+
hasFormError = _b.sent();
|
|
19216
19243
|
if (hasFormError) {
|
|
19217
19244
|
response.isFormError = true;
|
|
19218
19245
|
return [2 /*return*/, response];
|
|
19219
19246
|
}
|
|
19220
|
-
|
|
19247
|
+
_b.label = 2;
|
|
19221
19248
|
case 2:
|
|
19222
|
-
|
|
19223
|
-
|
|
19224
|
-
|
|
19249
|
+
_b.trys.push([2, 4, , 5]);
|
|
19250
|
+
return [4 /*yield*/, this.store.customerStore.forgotPassword(this.model.email)];
|
|
19251
|
+
case 3:
|
|
19252
|
+
forgotPasswordResponse = _b.sent();
|
|
19253
|
+
if (forgotPasswordResponse)
|
|
19254
|
+
response.isSuccess = true;
|
|
19255
|
+
return [2 /*return*/, response];
|
|
19256
|
+
case 4:
|
|
19257
|
+
_b.sent();
|
|
19225
19258
|
return [2 /*return*/, response];
|
|
19259
|
+
case 5: return [2 /*return*/];
|
|
19226
19260
|
}
|
|
19227
19261
|
});
|
|
19228
19262
|
});
|
|
@@ -19345,14 +19379,14 @@ var RecoverPasswordForm = /** @class */ (function () {
|
|
|
19345
19379
|
RecoverPasswordForm.prototype.submit = function () {
|
|
19346
19380
|
return __awaiter(this, void 0, void 0, function () {
|
|
19347
19381
|
var token, response, hasFormError, urlParams, recoverPasswordResponse;
|
|
19348
|
-
return __generator(this, function (
|
|
19349
|
-
switch (
|
|
19382
|
+
return __generator(this, function (_b) {
|
|
19383
|
+
switch (_b.label) {
|
|
19350
19384
|
case 0:
|
|
19351
19385
|
token = "";
|
|
19352
|
-
response = { isFormError: false,
|
|
19386
|
+
response = { isFormError: false, isSuccess: false };
|
|
19353
19387
|
return [4 /*yield*/, this.validateAll()];
|
|
19354
19388
|
case 1:
|
|
19355
|
-
hasFormError =
|
|
19389
|
+
hasFormError = _b.sent();
|
|
19356
19390
|
if (hasFormError) {
|
|
19357
19391
|
response.isFormError = true;
|
|
19358
19392
|
return [2 /*return*/, response];
|
|
@@ -19361,12 +19395,19 @@ var RecoverPasswordForm = /** @class */ (function () {
|
|
|
19361
19395
|
urlParams = new URLSearchParams(window.location.search);
|
|
19362
19396
|
token = urlParams.get("token") || "";
|
|
19363
19397
|
}
|
|
19364
|
-
|
|
19398
|
+
_b.label = 2;
|
|
19365
19399
|
case 2:
|
|
19366
|
-
|
|
19367
|
-
|
|
19368
|
-
|
|
19400
|
+
_b.trys.push([2, 4, , 5]);
|
|
19401
|
+
return [4 /*yield*/, this.store.customerStore.recoverPassword(this.model.password, this.model.passwordAgain, token)];
|
|
19402
|
+
case 3:
|
|
19403
|
+
recoverPasswordResponse = _b.sent();
|
|
19404
|
+
if (recoverPasswordResponse)
|
|
19405
|
+
response.isSuccess = true;
|
|
19406
|
+
return [2 /*return*/, response];
|
|
19407
|
+
case 4:
|
|
19408
|
+
_b.sent();
|
|
19369
19409
|
return [2 /*return*/, response];
|
|
19410
|
+
case 5: return [2 /*return*/];
|
|
19370
19411
|
}
|
|
19371
19412
|
});
|
|
19372
19413
|
});
|
|
@@ -19412,6 +19453,8 @@ var AccountInfoForm = /** @class */ (function () {
|
|
|
19412
19453
|
};
|
|
19413
19454
|
this.onPhoneChange = function (value) {
|
|
19414
19455
|
_this.customer.phone = value || null;
|
|
19456
|
+
if (!value)
|
|
19457
|
+
_this.validator.setRules(_this.validatorRules());
|
|
19415
19458
|
};
|
|
19416
19459
|
makeObservable(this, {
|
|
19417
19460
|
firstNameErrorMessage: computed,
|
|
@@ -19507,12 +19550,8 @@ var AccountInfoForm = /** @class */ (function () {
|
|
|
19507
19550
|
switch (_b.label) {
|
|
19508
19551
|
case 0:
|
|
19509
19552
|
response = { isFormError: false, isSuccess: false };
|
|
19510
|
-
if (this.phone)
|
|
19553
|
+
if (this.phone)
|
|
19511
19554
|
this.validator.setRules(this.validatorRules(true));
|
|
19512
|
-
}
|
|
19513
|
-
else {
|
|
19514
|
-
this.validator.setRules(this.validatorRules());
|
|
19515
|
-
}
|
|
19516
19555
|
return [4 /*yield*/, this.validateAll()];
|
|
19517
19556
|
case 1:
|
|
19518
19557
|
hasFormError = _b.sent();
|
|
@@ -20935,7 +20974,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
20935
20974
|
return __generator(this, function (_b) {
|
|
20936
20975
|
switch (_b.label) {
|
|
20937
20976
|
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 "])));
|
|
20977
|
+
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
20978
|
_b.label = 1;
|
|
20940
20979
|
case 1:
|
|
20941
20980
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -20965,7 +21004,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
20965
21004
|
return __generator(this, function (_b) {
|
|
20966
21005
|
switch (_b.label) {
|
|
20967
21006
|
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 "])));
|
|
21007
|
+
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
21008
|
_b.label = 1;
|
|
20970
21009
|
case 1:
|
|
20971
21010
|
_b.trys.push([1, 3, , 4]);
|
package/build/index.js
CHANGED
|
@@ -17272,7 +17272,8 @@ var Validator = /** @class */ (function () {
|
|
|
17272
17272
|
isValid = _a.sent();
|
|
17273
17273
|
if (!isValid) {
|
|
17274
17274
|
hasError = true;
|
|
17275
|
-
|
|
17275
|
+
if (rule.errorType)
|
|
17276
|
+
errorTypes.push(rule.errorType);
|
|
17276
17277
|
errorMessages.push(rule.errorMessage);
|
|
17277
17278
|
}
|
|
17278
17279
|
_a.label = 3;
|
|
@@ -17280,9 +17281,11 @@ var Validator = /** @class */ (function () {
|
|
|
17280
17281
|
i++;
|
|
17281
17282
|
return [3 /*break*/, 1];
|
|
17282
17283
|
case 4:
|
|
17283
|
-
this.results[fieldKey]
|
|
17284
|
-
|
|
17285
|
-
|
|
17284
|
+
if (this.results[fieldKey]) {
|
|
17285
|
+
this.results[fieldKey].errorTypes = errorTypes;
|
|
17286
|
+
this.results[fieldKey].messages = errorMessages;
|
|
17287
|
+
this.results[fieldKey].status = hasError ? "error" : undefined;
|
|
17288
|
+
}
|
|
17286
17289
|
return [2 /*return*/];
|
|
17287
17290
|
}
|
|
17288
17291
|
});
|
|
@@ -17669,23 +17672,30 @@ var LoginForm = /** @class */ (function () {
|
|
|
17669
17672
|
LoginForm.prototype.logIn = function () {
|
|
17670
17673
|
return __awaiter(this, void 0, void 0, function () {
|
|
17671
17674
|
var response, hasFormError, isLoginSuccess;
|
|
17672
|
-
return __generator(this, function (
|
|
17673
|
-
switch (
|
|
17675
|
+
return __generator(this, function (_b) {
|
|
17676
|
+
switch (_b.label) {
|
|
17674
17677
|
case 0:
|
|
17675
|
-
response = { isFormError: false,
|
|
17678
|
+
response = { isFormError: false, isSuccess: false };
|
|
17676
17679
|
return [4 /*yield*/, this.validateAll()];
|
|
17677
17680
|
case 1:
|
|
17678
|
-
hasFormError =
|
|
17681
|
+
hasFormError = _b.sent();
|
|
17679
17682
|
if (hasFormError) {
|
|
17680
17683
|
response.isFormError = true;
|
|
17681
17684
|
return [2 /*return*/, response];
|
|
17682
17685
|
}
|
|
17683
|
-
|
|
17686
|
+
_b.label = 2;
|
|
17684
17687
|
case 2:
|
|
17685
|
-
|
|
17686
|
-
|
|
17687
|
-
|
|
17688
|
+
_b.trys.push([2, 4, , 5]);
|
|
17689
|
+
return [4 /*yield*/, this.store.customerStore.login(this.model.email, this.model.password)];
|
|
17690
|
+
case 3:
|
|
17691
|
+
isLoginSuccess = _b.sent();
|
|
17692
|
+
if (isLoginSuccess)
|
|
17693
|
+
response.isSuccess = true;
|
|
17694
|
+
return [2 /*return*/, response];
|
|
17695
|
+
case 4:
|
|
17696
|
+
_b.sent();
|
|
17688
17697
|
return [2 /*return*/, response];
|
|
17698
|
+
case 5: return [2 /*return*/];
|
|
17689
17699
|
}
|
|
17690
17700
|
});
|
|
17691
17701
|
});
|
|
@@ -18510,6 +18520,69 @@ var AddressForm = /** @class */ (function () {
|
|
|
18510
18520
|
this._isStatesPending = false;
|
|
18511
18521
|
this._isCitiesPending = false;
|
|
18512
18522
|
this._isDistrictsPending = false;
|
|
18523
|
+
this.validatorRules = function (includePhoneRule) {
|
|
18524
|
+
if (includePhoneRule === void 0) { includePhoneRule = false; }
|
|
18525
|
+
var rules = __spreadArrays([
|
|
18526
|
+
new RequiredRule({
|
|
18527
|
+
model: _this.address,
|
|
18528
|
+
fieldKey: "firstName",
|
|
18529
|
+
valuePath: "firstName",
|
|
18530
|
+
message: _this.message.requiredRule,
|
|
18531
|
+
}),
|
|
18532
|
+
new RequiredRule({
|
|
18533
|
+
model: _this.address,
|
|
18534
|
+
fieldKey: "lastName",
|
|
18535
|
+
valuePath: "lastName",
|
|
18536
|
+
message: _this.message.requiredRule,
|
|
18537
|
+
}),
|
|
18538
|
+
new RequiredRule({
|
|
18539
|
+
model: _this.address,
|
|
18540
|
+
fieldKey: "addressLine1",
|
|
18541
|
+
valuePath: "addressLine1",
|
|
18542
|
+
message: _this.message.requiredRule,
|
|
18543
|
+
}),
|
|
18544
|
+
new RequiredRule({
|
|
18545
|
+
model: _this.address,
|
|
18546
|
+
fieldKey: "postalCode",
|
|
18547
|
+
valuePath: "postalCode",
|
|
18548
|
+
message: _this.message.requiredRule,
|
|
18549
|
+
}),
|
|
18550
|
+
new RequiredRule({
|
|
18551
|
+
model: _this.address,
|
|
18552
|
+
fieldKey: "country",
|
|
18553
|
+
valuePath: "country",
|
|
18554
|
+
message: _this.message.requiredRule,
|
|
18555
|
+
}),
|
|
18556
|
+
new RequiredRule({
|
|
18557
|
+
model: _this.address,
|
|
18558
|
+
fieldKey: "state",
|
|
18559
|
+
valuePath: "state",
|
|
18560
|
+
message: _this.message.requiredRule,
|
|
18561
|
+
}),
|
|
18562
|
+
new RequiredRule({
|
|
18563
|
+
model: _this.address,
|
|
18564
|
+
fieldKey: "city",
|
|
18565
|
+
valuePath: "city",
|
|
18566
|
+
message: _this.message.requiredRule,
|
|
18567
|
+
}),
|
|
18568
|
+
new RequiredRule({
|
|
18569
|
+
model: _this.address,
|
|
18570
|
+
fieldKey: "title",
|
|
18571
|
+
valuePath: "title",
|
|
18572
|
+
message: _this.message.requiredRule,
|
|
18573
|
+
})
|
|
18574
|
+
], (includePhoneRule
|
|
18575
|
+
? [
|
|
18576
|
+
new PhoneRule({
|
|
18577
|
+
model: _this.address,
|
|
18578
|
+
fieldKey: "phone",
|
|
18579
|
+
valuePath: "phone",
|
|
18580
|
+
message: _this.message.phoneRule,
|
|
18581
|
+
}),
|
|
18582
|
+
]
|
|
18583
|
+
: []));
|
|
18584
|
+
return rules;
|
|
18585
|
+
};
|
|
18513
18586
|
this.onTitleChange = function (value) {
|
|
18514
18587
|
_this.address.title = value;
|
|
18515
18588
|
};
|
|
@@ -18521,6 +18594,8 @@ var AddressForm = /** @class */ (function () {
|
|
|
18521
18594
|
};
|
|
18522
18595
|
this.onPhoneChange = function (value) {
|
|
18523
18596
|
_this.address.phone = value;
|
|
18597
|
+
if (!value)
|
|
18598
|
+
_this.validator.setRules(_this.validatorRules());
|
|
18524
18599
|
};
|
|
18525
18600
|
this.onAddressLine1Change = function (value) {
|
|
18526
18601
|
_this.address.addressLine1 = value;
|
|
@@ -18709,17 +18784,18 @@ var AddressForm = /** @class */ (function () {
|
|
|
18709
18784
|
};
|
|
18710
18785
|
this.submit = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
18711
18786
|
var response, hasFormError, customer, saveCustomerResponse;
|
|
18712
|
-
return __generator(this, function (
|
|
18713
|
-
switch (
|
|
18787
|
+
return __generator(this, function (_b) {
|
|
18788
|
+
switch (_b.label) {
|
|
18714
18789
|
case 0:
|
|
18715
18790
|
response = {
|
|
18716
18791
|
isFormError: false,
|
|
18717
|
-
isAPIError: false,
|
|
18718
18792
|
isSuccess: false,
|
|
18719
18793
|
};
|
|
18794
|
+
if (this.address.phone)
|
|
18795
|
+
this.validator.setRules(this.validatorRules(true));
|
|
18720
18796
|
return [4 /*yield*/, this.validateAll()];
|
|
18721
18797
|
case 1:
|
|
18722
|
-
hasFormError =
|
|
18798
|
+
hasFormError = _b.sent();
|
|
18723
18799
|
if (hasFormError) {
|
|
18724
18800
|
response.isFormError = true;
|
|
18725
18801
|
return [2 /*return*/, response];
|
|
@@ -18733,15 +18809,19 @@ var AddressForm = /** @class */ (function () {
|
|
|
18733
18809
|
else {
|
|
18734
18810
|
customer.addresses.push(this.address);
|
|
18735
18811
|
}
|
|
18736
|
-
|
|
18812
|
+
_b.label = 2;
|
|
18737
18813
|
case 2:
|
|
18738
|
-
|
|
18739
|
-
|
|
18740
|
-
|
|
18741
|
-
|
|
18742
|
-
|
|
18743
|
-
|
|
18814
|
+
_b.trys.push([2, 4, , 5]);
|
|
18815
|
+
return [4 /*yield*/, this.store.customerStore.saveCustomer(customer)];
|
|
18816
|
+
case 3:
|
|
18817
|
+
saveCustomerResponse = _b.sent();
|
|
18818
|
+
if (saveCustomerResponse)
|
|
18819
|
+
response.isSuccess = true;
|
|
18820
|
+
return [2 /*return*/, response];
|
|
18821
|
+
case 4:
|
|
18822
|
+
_b.sent();
|
|
18744
18823
|
return [2 /*return*/, response];
|
|
18824
|
+
case 5: return [2 /*return*/];
|
|
18745
18825
|
}
|
|
18746
18826
|
});
|
|
18747
18827
|
}); };
|
|
@@ -18767,69 +18847,9 @@ var AddressForm = /** @class */ (function () {
|
|
|
18767
18847
|
submit: mobx.action,
|
|
18768
18848
|
});
|
|
18769
18849
|
this.address = props.address;
|
|
18850
|
+
this.message = props.message;
|
|
18770
18851
|
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
|
-
]);
|
|
18852
|
+
this.validator = new Validator(this.address, this.validatorRules());
|
|
18833
18853
|
this.listCountries();
|
|
18834
18854
|
if (this.address.country)
|
|
18835
18855
|
this.listCities();
|
|
@@ -19094,23 +19114,30 @@ var RegisterForm = /** @class */ (function () {
|
|
|
19094
19114
|
RegisterForm.prototype.register = function () {
|
|
19095
19115
|
return __awaiter(this, void 0, void 0, function () {
|
|
19096
19116
|
var response, hasFormError, isRegisterSuccess;
|
|
19097
|
-
return __generator(this, function (
|
|
19098
|
-
switch (
|
|
19117
|
+
return __generator(this, function (_b) {
|
|
19118
|
+
switch (_b.label) {
|
|
19099
19119
|
case 0:
|
|
19100
|
-
response = { isFormError: false,
|
|
19120
|
+
response = { isFormError: false, isSuccess: false };
|
|
19101
19121
|
return [4 /*yield*/, this.validateAll()];
|
|
19102
19122
|
case 1:
|
|
19103
|
-
hasFormError =
|
|
19123
|
+
hasFormError = _b.sent();
|
|
19104
19124
|
if (hasFormError) {
|
|
19105
19125
|
response.isFormError = true;
|
|
19106
19126
|
return [2 /*return*/, response];
|
|
19107
19127
|
}
|
|
19108
|
-
|
|
19128
|
+
_b.label = 2;
|
|
19109
19129
|
case 2:
|
|
19110
|
-
|
|
19111
|
-
|
|
19112
|
-
|
|
19130
|
+
_b.trys.push([2, 4, , 5]);
|
|
19131
|
+
return [4 /*yield*/, this.store.customerStore.register(this.model.firstName, this.model.lastName, this.model.email, this.model.password)];
|
|
19132
|
+
case 3:
|
|
19133
|
+
isRegisterSuccess = _b.sent();
|
|
19134
|
+
if (isRegisterSuccess)
|
|
19135
|
+
response.isSuccess = true;
|
|
19113
19136
|
return [2 /*return*/, response];
|
|
19137
|
+
case 4:
|
|
19138
|
+
_b.sent();
|
|
19139
|
+
return [2 /*return*/, response];
|
|
19140
|
+
case 5: return [2 /*return*/];
|
|
19114
19141
|
}
|
|
19115
19142
|
});
|
|
19116
19143
|
});
|
|
@@ -19188,23 +19215,30 @@ var ForgotPasswordForm = /** @class */ (function () {
|
|
|
19188
19215
|
ForgotPasswordForm.prototype.submit = function () {
|
|
19189
19216
|
return __awaiter(this, void 0, void 0, function () {
|
|
19190
19217
|
var response, hasFormError, forgotPasswordResponse;
|
|
19191
|
-
return __generator(this, function (
|
|
19192
|
-
switch (
|
|
19218
|
+
return __generator(this, function (_b) {
|
|
19219
|
+
switch (_b.label) {
|
|
19193
19220
|
case 0:
|
|
19194
|
-
response = { isFormError: false,
|
|
19221
|
+
response = { isFormError: false, isSuccess: false };
|
|
19195
19222
|
return [4 /*yield*/, this.validateAll()];
|
|
19196
19223
|
case 1:
|
|
19197
|
-
hasFormError =
|
|
19224
|
+
hasFormError = _b.sent();
|
|
19198
19225
|
if (hasFormError) {
|
|
19199
19226
|
response.isFormError = true;
|
|
19200
19227
|
return [2 /*return*/, response];
|
|
19201
19228
|
}
|
|
19202
|
-
|
|
19229
|
+
_b.label = 2;
|
|
19203
19230
|
case 2:
|
|
19204
|
-
|
|
19205
|
-
|
|
19206
|
-
|
|
19231
|
+
_b.trys.push([2, 4, , 5]);
|
|
19232
|
+
return [4 /*yield*/, this.store.customerStore.forgotPassword(this.model.email)];
|
|
19233
|
+
case 3:
|
|
19234
|
+
forgotPasswordResponse = _b.sent();
|
|
19235
|
+
if (forgotPasswordResponse)
|
|
19236
|
+
response.isSuccess = true;
|
|
19237
|
+
return [2 /*return*/, response];
|
|
19238
|
+
case 4:
|
|
19239
|
+
_b.sent();
|
|
19207
19240
|
return [2 /*return*/, response];
|
|
19241
|
+
case 5: return [2 /*return*/];
|
|
19208
19242
|
}
|
|
19209
19243
|
});
|
|
19210
19244
|
});
|
|
@@ -19327,14 +19361,14 @@ var RecoverPasswordForm = /** @class */ (function () {
|
|
|
19327
19361
|
RecoverPasswordForm.prototype.submit = function () {
|
|
19328
19362
|
return __awaiter(this, void 0, void 0, function () {
|
|
19329
19363
|
var token, response, hasFormError, urlParams, recoverPasswordResponse;
|
|
19330
|
-
return __generator(this, function (
|
|
19331
|
-
switch (
|
|
19364
|
+
return __generator(this, function (_b) {
|
|
19365
|
+
switch (_b.label) {
|
|
19332
19366
|
case 0:
|
|
19333
19367
|
token = "";
|
|
19334
|
-
response = { isFormError: false,
|
|
19368
|
+
response = { isFormError: false, isSuccess: false };
|
|
19335
19369
|
return [4 /*yield*/, this.validateAll()];
|
|
19336
19370
|
case 1:
|
|
19337
|
-
hasFormError =
|
|
19371
|
+
hasFormError = _b.sent();
|
|
19338
19372
|
if (hasFormError) {
|
|
19339
19373
|
response.isFormError = true;
|
|
19340
19374
|
return [2 /*return*/, response];
|
|
@@ -19343,12 +19377,19 @@ var RecoverPasswordForm = /** @class */ (function () {
|
|
|
19343
19377
|
urlParams = new URLSearchParams(window.location.search);
|
|
19344
19378
|
token = urlParams.get("token") || "";
|
|
19345
19379
|
}
|
|
19346
|
-
|
|
19380
|
+
_b.label = 2;
|
|
19347
19381
|
case 2:
|
|
19348
|
-
|
|
19349
|
-
|
|
19350
|
-
|
|
19382
|
+
_b.trys.push([2, 4, , 5]);
|
|
19383
|
+
return [4 /*yield*/, this.store.customerStore.recoverPassword(this.model.password, this.model.passwordAgain, token)];
|
|
19384
|
+
case 3:
|
|
19385
|
+
recoverPasswordResponse = _b.sent();
|
|
19386
|
+
if (recoverPasswordResponse)
|
|
19387
|
+
response.isSuccess = true;
|
|
19388
|
+
return [2 /*return*/, response];
|
|
19389
|
+
case 4:
|
|
19390
|
+
_b.sent();
|
|
19351
19391
|
return [2 /*return*/, response];
|
|
19392
|
+
case 5: return [2 /*return*/];
|
|
19352
19393
|
}
|
|
19353
19394
|
});
|
|
19354
19395
|
});
|
|
@@ -19394,6 +19435,8 @@ var AccountInfoForm = /** @class */ (function () {
|
|
|
19394
19435
|
};
|
|
19395
19436
|
this.onPhoneChange = function (value) {
|
|
19396
19437
|
_this.customer.phone = value || null;
|
|
19438
|
+
if (!value)
|
|
19439
|
+
_this.validator.setRules(_this.validatorRules());
|
|
19397
19440
|
};
|
|
19398
19441
|
mobx.makeObservable(this, {
|
|
19399
19442
|
firstNameErrorMessage: mobx.computed,
|
|
@@ -19489,12 +19532,8 @@ var AccountInfoForm = /** @class */ (function () {
|
|
|
19489
19532
|
switch (_b.label) {
|
|
19490
19533
|
case 0:
|
|
19491
19534
|
response = { isFormError: false, isSuccess: false };
|
|
19492
|
-
if (this.phone)
|
|
19535
|
+
if (this.phone)
|
|
19493
19536
|
this.validator.setRules(this.validatorRules(true));
|
|
19494
|
-
}
|
|
19495
|
-
else {
|
|
19496
|
-
this.validator.setRules(this.validatorRules());
|
|
19497
|
-
}
|
|
19498
19537
|
return [4 /*yield*/, this.validateAll()];
|
|
19499
19538
|
case 1:
|
|
19500
19539
|
hasFormError = _b.sent();
|
|
@@ -20917,7 +20956,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
20917
20956
|
return __generator(this, function (_b) {
|
|
20918
20957
|
switch (_b.label) {
|
|
20919
20958
|
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 "])));
|
|
20959
|
+
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
20960
|
_b.label = 1;
|
|
20922
20961
|
case 1:
|
|
20923
20962
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -20947,7 +20986,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
20947
20986
|
return __generator(this, function (_b) {
|
|
20948
20987
|
switch (_b.label) {
|
|
20949
20988
|
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 "])));
|
|
20989
|
+
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
20990
|
_b.label = 1;
|
|
20952
20991
|
case 1:
|
|
20953
20992
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -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
|
}
|