@ikas/storefront 0.0.86 → 0.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/api/contact-form/__generated__/sendContactFormToMerchant.d.ts +9 -0
- package/build/api/contact-form/index.d.ts +10 -0
- package/build/api/index.d.ts +1 -0
- package/build/index.es.js +256 -5
- package/build/index.js +258 -4
- package/build/models/data/contact-form/index.d.ts +7 -0
- package/build/models/data/index.d.ts +1 -0
- package/build/models/ui/index.d.ts +1 -0
- package/build/models/ui/validator/form/contact-form.d.ts +45 -0
- package/build/store/customer.d.ts +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare type SaveContactForm = {
|
|
2
|
+
firstName: string;
|
|
3
|
+
lastName: string;
|
|
4
|
+
email: string;
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class IkasContactFormAPI {
|
|
8
|
+
static sendContactFormToMerchant(input: SaveContactForm): Promise<boolean | undefined>;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
package/build/api/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export { IkasProductAPI } from "./product/index";
|
|
|
12
12
|
export { IkasProductSearchAPI } from "./product-search/index";
|
|
13
13
|
export { IkasProductAttributeAPI } from "./product-attribute/index";
|
|
14
14
|
export { IkasFavoriteProductAPI } from "./favorite-product/index";
|
|
15
|
+
export { IkasContactFormAPI } from "./contact-form/index";
|
|
15
16
|
export { IkasStateAPI } from "./state/index";
|
|
16
17
|
export { IkasStorefrontAPI } from "./storefront/index";
|
|
17
18
|
export { IkasThemeAPI } from "./theme/index";
|
package/build/index.es.js
CHANGED
|
@@ -17951,6 +17951,17 @@ var IkasFavoriteProduct = /** @class */ (function () {
|
|
|
17951
17951
|
return IkasFavoriteProduct;
|
|
17952
17952
|
}());
|
|
17953
17953
|
|
|
17954
|
+
var IkasContactForm = /** @class */ (function () {
|
|
17955
|
+
function IkasContactForm(data) {
|
|
17956
|
+
this.email = data.email || "";
|
|
17957
|
+
this.firstName = data.firstName || "";
|
|
17958
|
+
this.lastName = data.lastName || "";
|
|
17959
|
+
this.message = data.message || "";
|
|
17960
|
+
makeAutoObservable(this);
|
|
17961
|
+
}
|
|
17962
|
+
return IkasContactForm;
|
|
17963
|
+
}());
|
|
17964
|
+
|
|
17954
17965
|
var IkasOrderTransaction = /** @class */ (function () {
|
|
17955
17966
|
function IkasOrderTransaction(data) {
|
|
17956
17967
|
if (data === void 0) { data = {}; }
|
|
@@ -19964,6 +19975,14 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
19964
19975
|
}
|
|
19965
19976
|
});
|
|
19966
19977
|
}); };
|
|
19978
|
+
this.saveContactForm = function (input) { return __awaiter(_this, void 0, void 0, function () {
|
|
19979
|
+
return __generator(this, function (_a) {
|
|
19980
|
+
switch (_a.label) {
|
|
19981
|
+
case 0: return [4 /*yield*/, IkasContactFormAPI.sendContactFormToMerchant(input)];
|
|
19982
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
19983
|
+
}
|
|
19984
|
+
});
|
|
19985
|
+
}); };
|
|
19967
19986
|
this.checkEmail = function (email) { return __awaiter(_this, void 0, void 0, function () {
|
|
19968
19987
|
return __generator(this, function (_a) {
|
|
19969
19988
|
switch (_a.label) {
|
|
@@ -23338,6 +23357,195 @@ var RegisterForm = /** @class */ (function () {
|
|
|
23338
23357
|
return RegisterForm;
|
|
23339
23358
|
}());
|
|
23340
23359
|
|
|
23360
|
+
var ContactForm = /** @class */ (function () {
|
|
23361
|
+
function ContactForm(props) {
|
|
23362
|
+
var _this = this;
|
|
23363
|
+
this.model = {
|
|
23364
|
+
firstName: "",
|
|
23365
|
+
lastName: "",
|
|
23366
|
+
email: "",
|
|
23367
|
+
message: "",
|
|
23368
|
+
};
|
|
23369
|
+
this.onFirstNameChange = function (value) {
|
|
23370
|
+
_this.firstName = value;
|
|
23371
|
+
};
|
|
23372
|
+
this.onLastNameChange = function (value) {
|
|
23373
|
+
_this.lastName = value;
|
|
23374
|
+
};
|
|
23375
|
+
this.onEmailChange = function (value) {
|
|
23376
|
+
_this.email = value;
|
|
23377
|
+
};
|
|
23378
|
+
this.onMessageChange = function (value) {
|
|
23379
|
+
_this.message = value;
|
|
23380
|
+
};
|
|
23381
|
+
makeObservable(this, {
|
|
23382
|
+
emailErrorMessage: computed,
|
|
23383
|
+
messageErrorMessage: computed,
|
|
23384
|
+
firstNameErrorMessage: computed,
|
|
23385
|
+
lastNameErrorMessage: computed,
|
|
23386
|
+
hasError: computed,
|
|
23387
|
+
redirect: computed,
|
|
23388
|
+
model: observable,
|
|
23389
|
+
validateAll: action,
|
|
23390
|
+
saveContactForm: action,
|
|
23391
|
+
});
|
|
23392
|
+
this.store = props.store;
|
|
23393
|
+
this.validator = new Validator(this.model, [
|
|
23394
|
+
new RequiredRule({
|
|
23395
|
+
fieldKey: "firstName",
|
|
23396
|
+
valuePath: "firstName",
|
|
23397
|
+
message: props.message.requiredRule,
|
|
23398
|
+
}),
|
|
23399
|
+
new RequiredRule({
|
|
23400
|
+
fieldKey: "lastName",
|
|
23401
|
+
valuePath: "lastName",
|
|
23402
|
+
message: props.message.requiredRule,
|
|
23403
|
+
}),
|
|
23404
|
+
new RequiredRule({
|
|
23405
|
+
fieldKey: "email",
|
|
23406
|
+
valuePath: "email",
|
|
23407
|
+
message: props.message.requiredRule,
|
|
23408
|
+
}),
|
|
23409
|
+
new RequiredRule({
|
|
23410
|
+
fieldKey: "message",
|
|
23411
|
+
valuePath: "message",
|
|
23412
|
+
message: props.message.requiredRule,
|
|
23413
|
+
}),
|
|
23414
|
+
new EmailRule({
|
|
23415
|
+
fieldKey: "email",
|
|
23416
|
+
valuePath: "email",
|
|
23417
|
+
message: props.message.emailRule,
|
|
23418
|
+
}),
|
|
23419
|
+
]);
|
|
23420
|
+
}
|
|
23421
|
+
Object.defineProperty(ContactForm.prototype, "firstName", {
|
|
23422
|
+
get: function () {
|
|
23423
|
+
return this.model.firstName;
|
|
23424
|
+
},
|
|
23425
|
+
set: function (value) {
|
|
23426
|
+
this.model.firstName = value;
|
|
23427
|
+
},
|
|
23428
|
+
enumerable: false,
|
|
23429
|
+
configurable: true
|
|
23430
|
+
});
|
|
23431
|
+
Object.defineProperty(ContactForm.prototype, "lastName", {
|
|
23432
|
+
get: function () {
|
|
23433
|
+
return this.model.lastName;
|
|
23434
|
+
},
|
|
23435
|
+
set: function (value) {
|
|
23436
|
+
this.model.lastName = value;
|
|
23437
|
+
},
|
|
23438
|
+
enumerable: false,
|
|
23439
|
+
configurable: true
|
|
23440
|
+
});
|
|
23441
|
+
Object.defineProperty(ContactForm.prototype, "email", {
|
|
23442
|
+
get: function () {
|
|
23443
|
+
return this.model.email;
|
|
23444
|
+
},
|
|
23445
|
+
set: function (value) {
|
|
23446
|
+
this.model.email = value;
|
|
23447
|
+
},
|
|
23448
|
+
enumerable: false,
|
|
23449
|
+
configurable: true
|
|
23450
|
+
});
|
|
23451
|
+
Object.defineProperty(ContactForm.prototype, "message", {
|
|
23452
|
+
get: function () {
|
|
23453
|
+
return this.model.message;
|
|
23454
|
+
},
|
|
23455
|
+
set: function (value) {
|
|
23456
|
+
this.model.message = value;
|
|
23457
|
+
},
|
|
23458
|
+
enumerable: false,
|
|
23459
|
+
configurable: true
|
|
23460
|
+
});
|
|
23461
|
+
Object.defineProperty(ContactForm.prototype, "hasError", {
|
|
23462
|
+
get: function () {
|
|
23463
|
+
return this.validator.hasError;
|
|
23464
|
+
},
|
|
23465
|
+
enumerable: false,
|
|
23466
|
+
configurable: true
|
|
23467
|
+
});
|
|
23468
|
+
Object.defineProperty(ContactForm.prototype, "firstNameErrorMessage", {
|
|
23469
|
+
get: function () {
|
|
23470
|
+
return this.validator.results.firstName.errorMessage;
|
|
23471
|
+
},
|
|
23472
|
+
enumerable: false,
|
|
23473
|
+
configurable: true
|
|
23474
|
+
});
|
|
23475
|
+
Object.defineProperty(ContactForm.prototype, "lastNameErrorMessage", {
|
|
23476
|
+
get: function () {
|
|
23477
|
+
return this.validator.results.lastName.errorMessage;
|
|
23478
|
+
},
|
|
23479
|
+
enumerable: false,
|
|
23480
|
+
configurable: true
|
|
23481
|
+
});
|
|
23482
|
+
Object.defineProperty(ContactForm.prototype, "emailErrorMessage", {
|
|
23483
|
+
get: function () {
|
|
23484
|
+
return this.validator.results.email.errorMessage;
|
|
23485
|
+
},
|
|
23486
|
+
enumerable: false,
|
|
23487
|
+
configurable: true
|
|
23488
|
+
});
|
|
23489
|
+
Object.defineProperty(ContactForm.prototype, "messageErrorMessage", {
|
|
23490
|
+
get: function () {
|
|
23491
|
+
return this.validator.results.message.errorMessage;
|
|
23492
|
+
},
|
|
23493
|
+
enumerable: false,
|
|
23494
|
+
configurable: true
|
|
23495
|
+
});
|
|
23496
|
+
Object.defineProperty(ContactForm.prototype, "redirect", {
|
|
23497
|
+
get: function () {
|
|
23498
|
+
if (typeof window !== "undefined") {
|
|
23499
|
+
var urlSearch = new URLSearchParams(window.location.search);
|
|
23500
|
+
return urlSearch.get("redirect");
|
|
23501
|
+
}
|
|
23502
|
+
},
|
|
23503
|
+
enumerable: false,
|
|
23504
|
+
configurable: true
|
|
23505
|
+
});
|
|
23506
|
+
ContactForm.prototype.validateAll = function () {
|
|
23507
|
+
return this.validator.validateAll();
|
|
23508
|
+
};
|
|
23509
|
+
ContactForm.prototype.saveContactForm = function () {
|
|
23510
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23511
|
+
var response, hasFormError, isContactFormSuccess;
|
|
23512
|
+
return __generator(this, function (_b) {
|
|
23513
|
+
switch (_b.label) {
|
|
23514
|
+
case 0:
|
|
23515
|
+
response = { isFormError: false, isSuccess: false };
|
|
23516
|
+
return [4 /*yield*/, this.validateAll()];
|
|
23517
|
+
case 1:
|
|
23518
|
+
hasFormError = _b.sent();
|
|
23519
|
+
if (hasFormError) {
|
|
23520
|
+
response.isFormError = true;
|
|
23521
|
+
return [2 /*return*/, response];
|
|
23522
|
+
}
|
|
23523
|
+
_b.label = 2;
|
|
23524
|
+
case 2:
|
|
23525
|
+
_b.trys.push([2, 4, , 5]);
|
|
23526
|
+
return [4 /*yield*/, this.store.customerStore.saveContactForm({
|
|
23527
|
+
firstName: this.model.firstName,
|
|
23528
|
+
lastName: this.model.lastName,
|
|
23529
|
+
email: this.model.email,
|
|
23530
|
+
message: this.model.message,
|
|
23531
|
+
})];
|
|
23532
|
+
case 3:
|
|
23533
|
+
isContactFormSuccess = _b.sent();
|
|
23534
|
+
if (isContactFormSuccess) {
|
|
23535
|
+
response.isSuccess = true;
|
|
23536
|
+
}
|
|
23537
|
+
return [2 /*return*/, response];
|
|
23538
|
+
case 4:
|
|
23539
|
+
_b.sent();
|
|
23540
|
+
return [2 /*return*/, response];
|
|
23541
|
+
case 5: return [2 /*return*/];
|
|
23542
|
+
}
|
|
23543
|
+
});
|
|
23544
|
+
});
|
|
23545
|
+
};
|
|
23546
|
+
return ContactForm;
|
|
23547
|
+
}());
|
|
23548
|
+
|
|
23341
23549
|
var ForgotPasswordForm = /** @class */ (function () {
|
|
23342
23550
|
function ForgotPasswordForm(props) {
|
|
23343
23551
|
var _this = this;
|
|
@@ -25727,6 +25935,49 @@ var IkasFavoriteProductAPI = /** @class */ (function () {
|
|
|
25727
25935
|
}());
|
|
25728
25936
|
var templateObject_1$g, templateObject_2$6, templateObject_3$2;
|
|
25729
25937
|
|
|
25938
|
+
var IkasContactFormAPI = /** @class */ (function () {
|
|
25939
|
+
function IkasContactFormAPI() {
|
|
25940
|
+
}
|
|
25941
|
+
IkasContactFormAPI.sendContactFormToMerchant = function (input) {
|
|
25942
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25943
|
+
var MUTATION, _a, data, errors, err_1;
|
|
25944
|
+
return __generator(this, function (_b) {
|
|
25945
|
+
switch (_b.label) {
|
|
25946
|
+
case 0:
|
|
25947
|
+
MUTATION = src(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n mutation sendContactFormToMerchant(\n $email: String!\n $message: String!\n $firstName: String!\n $lastName: String!\n ) {\n sendContactFormToMerchant(\n email: $email\n message: $message\n firstName: $firstName\n lastName: $lastName\n )\n }\n "], ["\n mutation sendContactFormToMerchant(\n $email: String!\n $message: String!\n $firstName: String!\n $lastName: String!\n ) {\n sendContactFormToMerchant(\n email: $email\n message: $message\n firstName: $firstName\n lastName: $lastName\n )\n }\n "])));
|
|
25948
|
+
_b.label = 1;
|
|
25949
|
+
case 1:
|
|
25950
|
+
_b.trys.push([1, 3, , 4]);
|
|
25951
|
+
return [4 /*yield*/, apollo
|
|
25952
|
+
.getClient()
|
|
25953
|
+
.mutate({
|
|
25954
|
+
mutation: MUTATION,
|
|
25955
|
+
variables: {
|
|
25956
|
+
email: input.email,
|
|
25957
|
+
message: input.message,
|
|
25958
|
+
firstName: input.firstName,
|
|
25959
|
+
lastName: input.lastName,
|
|
25960
|
+
},
|
|
25961
|
+
})];
|
|
25962
|
+
case 2:
|
|
25963
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
25964
|
+
if (errors && errors.length) {
|
|
25965
|
+
console.log(errors);
|
|
25966
|
+
}
|
|
25967
|
+
return [2 /*return*/, data === null || data === void 0 ? void 0 : data.sendContactFormToMerchant];
|
|
25968
|
+
case 3:
|
|
25969
|
+
err_1 = _b.sent();
|
|
25970
|
+
console.log(err_1);
|
|
25971
|
+
return [3 /*break*/, 4];
|
|
25972
|
+
case 4: return [2 /*return*/];
|
|
25973
|
+
}
|
|
25974
|
+
});
|
|
25975
|
+
});
|
|
25976
|
+
};
|
|
25977
|
+
return IkasContactFormAPI;
|
|
25978
|
+
}());
|
|
25979
|
+
var templateObject_1$h;
|
|
25980
|
+
|
|
25730
25981
|
var IkasStateAPI = /** @class */ (function () {
|
|
25731
25982
|
function IkasStateAPI() {
|
|
25732
25983
|
}
|
|
@@ -25736,7 +25987,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
25736
25987
|
return __generator(this, function (_b) {
|
|
25737
25988
|
switch (_b.label) {
|
|
25738
25989
|
case 0:
|
|
25739
|
-
QUERY = src(templateObject_1$
|
|
25990
|
+
QUERY = src(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "], ["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "])));
|
|
25740
25991
|
_b.label = 1;
|
|
25741
25992
|
case 1:
|
|
25742
25993
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -25773,7 +26024,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
25773
26024
|
};
|
|
25774
26025
|
return IkasStateAPI;
|
|
25775
26026
|
}());
|
|
25776
|
-
var templateObject_1$
|
|
26027
|
+
var templateObject_1$i;
|
|
25777
26028
|
|
|
25778
26029
|
var IkasStorefrontDomain = /** @class */ (function () {
|
|
25779
26030
|
function IkasStorefrontDomain(data) {
|
|
@@ -25866,7 +26117,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
25866
26117
|
return __generator(this, function (_b) {
|
|
25867
26118
|
switch (_b.label) {
|
|
25868
26119
|
case 0:
|
|
25869
|
-
QUERY = src(templateObject_1$
|
|
26120
|
+
QUERY = src(templateObject_1$j || (templateObject_1$j = __makeTemplateObject(["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "], ["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "])));
|
|
25870
26121
|
_b.label = 1;
|
|
25871
26122
|
case 1:
|
|
25872
26123
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -25896,7 +26147,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
25896
26147
|
};
|
|
25897
26148
|
return IkasStorefrontAPI;
|
|
25898
26149
|
}());
|
|
25899
|
-
var templateObject_1$
|
|
26150
|
+
var templateObject_1$j;
|
|
25900
26151
|
|
|
25901
26152
|
var IkasThemeAPI = /** @class */ (function () {
|
|
25902
26153
|
function IkasThemeAPI() {
|
|
@@ -28782,4 +29033,4 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
28782
29033
|
return IkasBaseStore;
|
|
28783
29034
|
}());
|
|
28784
29035
|
|
|
28785
|
-
export { AccountInfoForm, index$3 as AccountPage, AddressForm, addresses as AddressesPage, Analytics, AnalyticsBody, AnalyticsHead, cart as CartPage, _id_$1 as CheckoutPage, _slug_ as CustomPage, editor$1 as EditorPage, EmailRule, EqualsRule, favoriteProducts as FavoriteProductsPage, ForgotPasswordForm, forgotPassword as ForgotPasswordPage, IkasAmountTypeEnum$1 as IkasAmountTypeEnum, IkasApplicableProductFilterValue, IkasBaseStore, IkasBrand, IkasBrandAPI, IkasBrandList, IkasBrandListPropValue, IkasBrandListSortType, IkasBrandListType, IkasBrandPropValue, IkasCardAssociation, IkasCardType, IkasCartAPI, IkasCategory, IkasCategoryAPI, IkasCategoryList, IkasCategoryListPropValue, IkasCategoryListSortType, IkasCategoryListType, IkasCategoryPropValue, IkasCheckout, IkasCheckoutAPI, IkasCheckoutPage, IkasCheckoutRecoveryEmailStatus, IkasCheckoutRecoveryStatus, IkasCheckoutStatus, IkasCityAPI, IkasCountryAPI, IkasCustomer, IkasCustomerAPI, IkasCustomerAddress, IkasDistrictAPI, IkasFavoriteProduct, IkasFavoriteProductAPI, IkasHTMLMetaData, IkasHTMLMetaDataAPI, IkasHTMLMetaDataTargetType, IkasImage, IkasLinkPropValue, IkasLinkType, IkasMerchantAPI, IkasMerchantSettings, IkasNavigationLink, IkasOrder, IkasOrderCancelledReason, IkasOrderLineItem, IkasOrderPackageFulfillStatus, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderShippingMethod, IkasOrderStatus, IkasOrderTransaction, IkasPage, IkasPageComponentPropValue, IkasPageDataProvider, IkasPageEditor, IkasPageHead, IkasPaymentMethod, IkasProduct, IkasProductAPI, IkasProductAttribute, IkasProductAttributeAPI, IkasProductAttributeValue, IkasProductDetail, IkasProductDetailPropValue, IkasProductFilter, IkasProductFilterDisplayType, IkasProductFilterSettings, IkasProductFilterSortType, IkasProductFilterType, IkasProductFilterValue, IkasProductList, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductPrice, IkasProductSearchAPI, IkasProductType, IkasProductVariant, IkasProductVariantType, IkasShippingMethod, IkasShippingMethodEnum, IkasStateAPI, IkasStorefrontAPI, IkasStorefrontConfig, IkasTheme, IkasThemeAPI, IkasThemeComponent, IkasThemeComponentProp, IkasThemeComponentPropType, IkasThemeCustomData, IkasThemeCustomDataType, IkasThemePage, IkasThemePageComponent, IkasThemePageType, IkasThemeSettings, IkasTransactionStatusEnum, IkasTransactionTypeEnum, IkasVariantSelectionType, IkasVariantType, IkasVariantTypeAPI, IkasVariantValue, Image, home as IndexPage, LessThanRule, LoginForm, login as LoginPage, MaxRule, MinRule, _404 as NotFoundPage, _id_$2 as OrderDetailPage, index$4 as OrdersPage, PhoneRule, RangeValue, RecoverPasswordForm, recoverPassword as RecoverPasswordPage, RegisterForm, register as RegisterPage, RequiredRule, search as SearchPage, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, decodeBase64, formatMoney, parseRangeStr, pascalCase, stringToSlug, validatePhoneNumber };
|
|
29036
|
+
export { AccountInfoForm, index$3 as AccountPage, AddressForm, addresses as AddressesPage, Analytics, AnalyticsBody, AnalyticsHead, cart as CartPage, _id_$1 as CheckoutPage, ContactForm, _slug_ as CustomPage, editor$1 as EditorPage, EmailRule, EqualsRule, favoriteProducts as FavoriteProductsPage, ForgotPasswordForm, forgotPassword as ForgotPasswordPage, IkasAmountTypeEnum$1 as IkasAmountTypeEnum, IkasApplicableProductFilterValue, IkasBaseStore, IkasBrand, IkasBrandAPI, IkasBrandList, IkasBrandListPropValue, IkasBrandListSortType, IkasBrandListType, IkasBrandPropValue, IkasCardAssociation, IkasCardType, IkasCartAPI, IkasCategory, IkasCategoryAPI, IkasCategoryList, IkasCategoryListPropValue, IkasCategoryListSortType, IkasCategoryListType, IkasCategoryPropValue, IkasCheckout, IkasCheckoutAPI, IkasCheckoutPage, IkasCheckoutRecoveryEmailStatus, IkasCheckoutRecoveryStatus, IkasCheckoutStatus, IkasCityAPI, IkasContactForm, IkasContactFormAPI, IkasCountryAPI, IkasCustomer, IkasCustomerAPI, IkasCustomerAddress, IkasDistrictAPI, IkasFavoriteProduct, IkasFavoriteProductAPI, IkasHTMLMetaData, IkasHTMLMetaDataAPI, IkasHTMLMetaDataTargetType, IkasImage, IkasLinkPropValue, IkasLinkType, IkasMerchantAPI, IkasMerchantSettings, IkasNavigationLink, IkasOrder, IkasOrderCancelledReason, IkasOrderLineItem, IkasOrderPackageFulfillStatus, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderShippingMethod, IkasOrderStatus, IkasOrderTransaction, IkasPage, IkasPageComponentPropValue, IkasPageDataProvider, IkasPageEditor, IkasPageHead, IkasPaymentMethod, IkasProduct, IkasProductAPI, IkasProductAttribute, IkasProductAttributeAPI, IkasProductAttributeValue, IkasProductDetail, IkasProductDetailPropValue, IkasProductFilter, IkasProductFilterDisplayType, IkasProductFilterSettings, IkasProductFilterSortType, IkasProductFilterType, IkasProductFilterValue, IkasProductList, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductPrice, IkasProductSearchAPI, IkasProductType, IkasProductVariant, IkasProductVariantType, IkasShippingMethod, IkasShippingMethodEnum, IkasStateAPI, IkasStorefrontAPI, IkasStorefrontConfig, IkasTheme, IkasThemeAPI, IkasThemeComponent, IkasThemeComponentProp, IkasThemeComponentPropType, IkasThemeCustomData, IkasThemeCustomDataType, IkasThemePage, IkasThemePageComponent, IkasThemePageType, IkasThemeSettings, IkasTransactionStatusEnum, IkasTransactionTypeEnum, IkasVariantSelectionType, IkasVariantType, IkasVariantTypeAPI, IkasVariantValue, Image, home as IndexPage, LessThanRule, LoginForm, login as LoginPage, MaxRule, MinRule, _404 as NotFoundPage, _id_$2 as OrderDetailPage, index$4 as OrdersPage, PhoneRule, RangeValue, RecoverPasswordForm, recoverPassword as RecoverPasswordPage, RegisterForm, register as RegisterPage, RequiredRule, search as SearchPage, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, decodeBase64, formatMoney, parseRangeStr, pascalCase, stringToSlug, validatePhoneNumber };
|
package/build/index.js
CHANGED
|
@@ -17944,6 +17944,17 @@ var IkasFavoriteProduct = /** @class */ (function () {
|
|
|
17944
17944
|
return IkasFavoriteProduct;
|
|
17945
17945
|
}());
|
|
17946
17946
|
|
|
17947
|
+
var IkasContactForm = /** @class */ (function () {
|
|
17948
|
+
function IkasContactForm(data) {
|
|
17949
|
+
this.email = data.email || "";
|
|
17950
|
+
this.firstName = data.firstName || "";
|
|
17951
|
+
this.lastName = data.lastName || "";
|
|
17952
|
+
this.message = data.message || "";
|
|
17953
|
+
mobx.makeAutoObservable(this);
|
|
17954
|
+
}
|
|
17955
|
+
return IkasContactForm;
|
|
17956
|
+
}());
|
|
17957
|
+
|
|
17947
17958
|
var IkasOrderTransaction = /** @class */ (function () {
|
|
17948
17959
|
function IkasOrderTransaction(data) {
|
|
17949
17960
|
if (data === void 0) { data = {}; }
|
|
@@ -19947,6 +19958,14 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
19947
19958
|
}
|
|
19948
19959
|
});
|
|
19949
19960
|
}); };
|
|
19961
|
+
this.saveContactForm = function (input) { return __awaiter(_this, void 0, void 0, function () {
|
|
19962
|
+
return __generator(this, function (_a) {
|
|
19963
|
+
switch (_a.label) {
|
|
19964
|
+
case 0: return [4 /*yield*/, IkasContactFormAPI.sendContactFormToMerchant(input)];
|
|
19965
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
19966
|
+
}
|
|
19967
|
+
});
|
|
19968
|
+
}); };
|
|
19950
19969
|
this.checkEmail = function (email) { return __awaiter(_this, void 0, void 0, function () {
|
|
19951
19970
|
return __generator(this, function (_a) {
|
|
19952
19971
|
switch (_a.label) {
|
|
@@ -23318,6 +23337,195 @@ var RegisterForm = /** @class */ (function () {
|
|
|
23318
23337
|
return RegisterForm;
|
|
23319
23338
|
}());
|
|
23320
23339
|
|
|
23340
|
+
var ContactForm = /** @class */ (function () {
|
|
23341
|
+
function ContactForm(props) {
|
|
23342
|
+
var _this = this;
|
|
23343
|
+
this.model = {
|
|
23344
|
+
firstName: "",
|
|
23345
|
+
lastName: "",
|
|
23346
|
+
email: "",
|
|
23347
|
+
message: "",
|
|
23348
|
+
};
|
|
23349
|
+
this.onFirstNameChange = function (value) {
|
|
23350
|
+
_this.firstName = value;
|
|
23351
|
+
};
|
|
23352
|
+
this.onLastNameChange = function (value) {
|
|
23353
|
+
_this.lastName = value;
|
|
23354
|
+
};
|
|
23355
|
+
this.onEmailChange = function (value) {
|
|
23356
|
+
_this.email = value;
|
|
23357
|
+
};
|
|
23358
|
+
this.onMessageChange = function (value) {
|
|
23359
|
+
_this.message = value;
|
|
23360
|
+
};
|
|
23361
|
+
mobx.makeObservable(this, {
|
|
23362
|
+
emailErrorMessage: mobx.computed,
|
|
23363
|
+
messageErrorMessage: mobx.computed,
|
|
23364
|
+
firstNameErrorMessage: mobx.computed,
|
|
23365
|
+
lastNameErrorMessage: mobx.computed,
|
|
23366
|
+
hasError: mobx.computed,
|
|
23367
|
+
redirect: mobx.computed,
|
|
23368
|
+
model: mobx.observable,
|
|
23369
|
+
validateAll: mobx.action,
|
|
23370
|
+
saveContactForm: mobx.action,
|
|
23371
|
+
});
|
|
23372
|
+
this.store = props.store;
|
|
23373
|
+
this.validator = new Validator(this.model, [
|
|
23374
|
+
new RequiredRule({
|
|
23375
|
+
fieldKey: "firstName",
|
|
23376
|
+
valuePath: "firstName",
|
|
23377
|
+
message: props.message.requiredRule,
|
|
23378
|
+
}),
|
|
23379
|
+
new RequiredRule({
|
|
23380
|
+
fieldKey: "lastName",
|
|
23381
|
+
valuePath: "lastName",
|
|
23382
|
+
message: props.message.requiredRule,
|
|
23383
|
+
}),
|
|
23384
|
+
new RequiredRule({
|
|
23385
|
+
fieldKey: "email",
|
|
23386
|
+
valuePath: "email",
|
|
23387
|
+
message: props.message.requiredRule,
|
|
23388
|
+
}),
|
|
23389
|
+
new RequiredRule({
|
|
23390
|
+
fieldKey: "message",
|
|
23391
|
+
valuePath: "message",
|
|
23392
|
+
message: props.message.requiredRule,
|
|
23393
|
+
}),
|
|
23394
|
+
new EmailRule({
|
|
23395
|
+
fieldKey: "email",
|
|
23396
|
+
valuePath: "email",
|
|
23397
|
+
message: props.message.emailRule,
|
|
23398
|
+
}),
|
|
23399
|
+
]);
|
|
23400
|
+
}
|
|
23401
|
+
Object.defineProperty(ContactForm.prototype, "firstName", {
|
|
23402
|
+
get: function () {
|
|
23403
|
+
return this.model.firstName;
|
|
23404
|
+
},
|
|
23405
|
+
set: function (value) {
|
|
23406
|
+
this.model.firstName = value;
|
|
23407
|
+
},
|
|
23408
|
+
enumerable: false,
|
|
23409
|
+
configurable: true
|
|
23410
|
+
});
|
|
23411
|
+
Object.defineProperty(ContactForm.prototype, "lastName", {
|
|
23412
|
+
get: function () {
|
|
23413
|
+
return this.model.lastName;
|
|
23414
|
+
},
|
|
23415
|
+
set: function (value) {
|
|
23416
|
+
this.model.lastName = value;
|
|
23417
|
+
},
|
|
23418
|
+
enumerable: false,
|
|
23419
|
+
configurable: true
|
|
23420
|
+
});
|
|
23421
|
+
Object.defineProperty(ContactForm.prototype, "email", {
|
|
23422
|
+
get: function () {
|
|
23423
|
+
return this.model.email;
|
|
23424
|
+
},
|
|
23425
|
+
set: function (value) {
|
|
23426
|
+
this.model.email = value;
|
|
23427
|
+
},
|
|
23428
|
+
enumerable: false,
|
|
23429
|
+
configurable: true
|
|
23430
|
+
});
|
|
23431
|
+
Object.defineProperty(ContactForm.prototype, "message", {
|
|
23432
|
+
get: function () {
|
|
23433
|
+
return this.model.message;
|
|
23434
|
+
},
|
|
23435
|
+
set: function (value) {
|
|
23436
|
+
this.model.message = value;
|
|
23437
|
+
},
|
|
23438
|
+
enumerable: false,
|
|
23439
|
+
configurable: true
|
|
23440
|
+
});
|
|
23441
|
+
Object.defineProperty(ContactForm.prototype, "hasError", {
|
|
23442
|
+
get: function () {
|
|
23443
|
+
return this.validator.hasError;
|
|
23444
|
+
},
|
|
23445
|
+
enumerable: false,
|
|
23446
|
+
configurable: true
|
|
23447
|
+
});
|
|
23448
|
+
Object.defineProperty(ContactForm.prototype, "firstNameErrorMessage", {
|
|
23449
|
+
get: function () {
|
|
23450
|
+
return this.validator.results.firstName.errorMessage;
|
|
23451
|
+
},
|
|
23452
|
+
enumerable: false,
|
|
23453
|
+
configurable: true
|
|
23454
|
+
});
|
|
23455
|
+
Object.defineProperty(ContactForm.prototype, "lastNameErrorMessage", {
|
|
23456
|
+
get: function () {
|
|
23457
|
+
return this.validator.results.lastName.errorMessage;
|
|
23458
|
+
},
|
|
23459
|
+
enumerable: false,
|
|
23460
|
+
configurable: true
|
|
23461
|
+
});
|
|
23462
|
+
Object.defineProperty(ContactForm.prototype, "emailErrorMessage", {
|
|
23463
|
+
get: function () {
|
|
23464
|
+
return this.validator.results.email.errorMessage;
|
|
23465
|
+
},
|
|
23466
|
+
enumerable: false,
|
|
23467
|
+
configurable: true
|
|
23468
|
+
});
|
|
23469
|
+
Object.defineProperty(ContactForm.prototype, "messageErrorMessage", {
|
|
23470
|
+
get: function () {
|
|
23471
|
+
return this.validator.results.message.errorMessage;
|
|
23472
|
+
},
|
|
23473
|
+
enumerable: false,
|
|
23474
|
+
configurable: true
|
|
23475
|
+
});
|
|
23476
|
+
Object.defineProperty(ContactForm.prototype, "redirect", {
|
|
23477
|
+
get: function () {
|
|
23478
|
+
if (typeof window !== "undefined") {
|
|
23479
|
+
var urlSearch = new URLSearchParams(window.location.search);
|
|
23480
|
+
return urlSearch.get("redirect");
|
|
23481
|
+
}
|
|
23482
|
+
},
|
|
23483
|
+
enumerable: false,
|
|
23484
|
+
configurable: true
|
|
23485
|
+
});
|
|
23486
|
+
ContactForm.prototype.validateAll = function () {
|
|
23487
|
+
return this.validator.validateAll();
|
|
23488
|
+
};
|
|
23489
|
+
ContactForm.prototype.saveContactForm = function () {
|
|
23490
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23491
|
+
var response, hasFormError, isContactFormSuccess;
|
|
23492
|
+
return __generator(this, function (_b) {
|
|
23493
|
+
switch (_b.label) {
|
|
23494
|
+
case 0:
|
|
23495
|
+
response = { isFormError: false, isSuccess: false };
|
|
23496
|
+
return [4 /*yield*/, this.validateAll()];
|
|
23497
|
+
case 1:
|
|
23498
|
+
hasFormError = _b.sent();
|
|
23499
|
+
if (hasFormError) {
|
|
23500
|
+
response.isFormError = true;
|
|
23501
|
+
return [2 /*return*/, response];
|
|
23502
|
+
}
|
|
23503
|
+
_b.label = 2;
|
|
23504
|
+
case 2:
|
|
23505
|
+
_b.trys.push([2, 4, , 5]);
|
|
23506
|
+
return [4 /*yield*/, this.store.customerStore.saveContactForm({
|
|
23507
|
+
firstName: this.model.firstName,
|
|
23508
|
+
lastName: this.model.lastName,
|
|
23509
|
+
email: this.model.email,
|
|
23510
|
+
message: this.model.message,
|
|
23511
|
+
})];
|
|
23512
|
+
case 3:
|
|
23513
|
+
isContactFormSuccess = _b.sent();
|
|
23514
|
+
if (isContactFormSuccess) {
|
|
23515
|
+
response.isSuccess = true;
|
|
23516
|
+
}
|
|
23517
|
+
return [2 /*return*/, response];
|
|
23518
|
+
case 4:
|
|
23519
|
+
_b.sent();
|
|
23520
|
+
return [2 /*return*/, response];
|
|
23521
|
+
case 5: return [2 /*return*/];
|
|
23522
|
+
}
|
|
23523
|
+
});
|
|
23524
|
+
});
|
|
23525
|
+
};
|
|
23526
|
+
return ContactForm;
|
|
23527
|
+
}());
|
|
23528
|
+
|
|
23321
23529
|
var ForgotPasswordForm = /** @class */ (function () {
|
|
23322
23530
|
function ForgotPasswordForm(props) {
|
|
23323
23531
|
var _this = this;
|
|
@@ -25707,6 +25915,49 @@ var IkasFavoriteProductAPI = /** @class */ (function () {
|
|
|
25707
25915
|
}());
|
|
25708
25916
|
var templateObject_1$g, templateObject_2$6, templateObject_3$2;
|
|
25709
25917
|
|
|
25918
|
+
var IkasContactFormAPI = /** @class */ (function () {
|
|
25919
|
+
function IkasContactFormAPI() {
|
|
25920
|
+
}
|
|
25921
|
+
IkasContactFormAPI.sendContactFormToMerchant = function (input) {
|
|
25922
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25923
|
+
var MUTATION, _a, data, errors, err_1;
|
|
25924
|
+
return __generator(this, function (_b) {
|
|
25925
|
+
switch (_b.label) {
|
|
25926
|
+
case 0:
|
|
25927
|
+
MUTATION = src(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n mutation sendContactFormToMerchant(\n $email: String!\n $message: String!\n $firstName: String!\n $lastName: String!\n ) {\n sendContactFormToMerchant(\n email: $email\n message: $message\n firstName: $firstName\n lastName: $lastName\n )\n }\n "], ["\n mutation sendContactFormToMerchant(\n $email: String!\n $message: String!\n $firstName: String!\n $lastName: String!\n ) {\n sendContactFormToMerchant(\n email: $email\n message: $message\n firstName: $firstName\n lastName: $lastName\n )\n }\n "])));
|
|
25928
|
+
_b.label = 1;
|
|
25929
|
+
case 1:
|
|
25930
|
+
_b.trys.push([1, 3, , 4]);
|
|
25931
|
+
return [4 /*yield*/, apollo
|
|
25932
|
+
.getClient()
|
|
25933
|
+
.mutate({
|
|
25934
|
+
mutation: MUTATION,
|
|
25935
|
+
variables: {
|
|
25936
|
+
email: input.email,
|
|
25937
|
+
message: input.message,
|
|
25938
|
+
firstName: input.firstName,
|
|
25939
|
+
lastName: input.lastName,
|
|
25940
|
+
},
|
|
25941
|
+
})];
|
|
25942
|
+
case 2:
|
|
25943
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
25944
|
+
if (errors && errors.length) {
|
|
25945
|
+
console.log(errors);
|
|
25946
|
+
}
|
|
25947
|
+
return [2 /*return*/, data === null || data === void 0 ? void 0 : data.sendContactFormToMerchant];
|
|
25948
|
+
case 3:
|
|
25949
|
+
err_1 = _b.sent();
|
|
25950
|
+
console.log(err_1);
|
|
25951
|
+
return [3 /*break*/, 4];
|
|
25952
|
+
case 4: return [2 /*return*/];
|
|
25953
|
+
}
|
|
25954
|
+
});
|
|
25955
|
+
});
|
|
25956
|
+
};
|
|
25957
|
+
return IkasContactFormAPI;
|
|
25958
|
+
}());
|
|
25959
|
+
var templateObject_1$h;
|
|
25960
|
+
|
|
25710
25961
|
var IkasStateAPI = /** @class */ (function () {
|
|
25711
25962
|
function IkasStateAPI() {
|
|
25712
25963
|
}
|
|
@@ -25716,7 +25967,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
25716
25967
|
return __generator(this, function (_b) {
|
|
25717
25968
|
switch (_b.label) {
|
|
25718
25969
|
case 0:
|
|
25719
|
-
QUERY = src(templateObject_1$
|
|
25970
|
+
QUERY = src(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "], ["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "])));
|
|
25720
25971
|
_b.label = 1;
|
|
25721
25972
|
case 1:
|
|
25722
25973
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -25753,7 +26004,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
25753
26004
|
};
|
|
25754
26005
|
return IkasStateAPI;
|
|
25755
26006
|
}());
|
|
25756
|
-
var templateObject_1$
|
|
26007
|
+
var templateObject_1$i;
|
|
25757
26008
|
|
|
25758
26009
|
var IkasStorefrontDomain = /** @class */ (function () {
|
|
25759
26010
|
function IkasStorefrontDomain(data) {
|
|
@@ -25846,7 +26097,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
25846
26097
|
return __generator(this, function (_b) {
|
|
25847
26098
|
switch (_b.label) {
|
|
25848
26099
|
case 0:
|
|
25849
|
-
QUERY = src(templateObject_1$
|
|
26100
|
+
QUERY = src(templateObject_1$j || (templateObject_1$j = __makeTemplateObject(["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "], ["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "])));
|
|
25850
26101
|
_b.label = 1;
|
|
25851
26102
|
case 1:
|
|
25852
26103
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -25876,7 +26127,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
25876
26127
|
};
|
|
25877
26128
|
return IkasStorefrontAPI;
|
|
25878
26129
|
}());
|
|
25879
|
-
var templateObject_1$
|
|
26130
|
+
var templateObject_1$j;
|
|
25880
26131
|
|
|
25881
26132
|
var IkasThemeAPI = /** @class */ (function () {
|
|
25882
26133
|
function IkasThemeAPI() {
|
|
@@ -28771,6 +29022,7 @@ exports.AnalyticsBody = AnalyticsBody;
|
|
|
28771
29022
|
exports.AnalyticsHead = AnalyticsHead;
|
|
28772
29023
|
exports.CartPage = cart;
|
|
28773
29024
|
exports.CheckoutPage = _id_$1;
|
|
29025
|
+
exports.ContactForm = ContactForm;
|
|
28774
29026
|
exports.CustomPage = _slug_;
|
|
28775
29027
|
exports.EditorPage = editor$1;
|
|
28776
29028
|
exports.EmailRule = EmailRule;
|
|
@@ -28795,6 +29047,8 @@ exports.IkasCheckout = IkasCheckout;
|
|
|
28795
29047
|
exports.IkasCheckoutAPI = IkasCheckoutAPI;
|
|
28796
29048
|
exports.IkasCheckoutPage = IkasCheckoutPage;
|
|
28797
29049
|
exports.IkasCityAPI = IkasCityAPI;
|
|
29050
|
+
exports.IkasContactForm = IkasContactForm;
|
|
29051
|
+
exports.IkasContactFormAPI = IkasContactFormAPI;
|
|
28798
29052
|
exports.IkasCountryAPI = IkasCountryAPI;
|
|
28799
29053
|
exports.IkasCustomer = IkasCustomer;
|
|
28800
29054
|
exports.IkasCustomerAPI = IkasCustomerAPI;
|
|
@@ -21,6 +21,7 @@ export { IkasProductAttribute } from "./product-attribute/index";
|
|
|
21
21
|
export { IkasProductAttributeValue } from "./product/attribute-value/index";
|
|
22
22
|
export * from "./product-filter/index";
|
|
23
23
|
export { IkasFavoriteProduct } from "./favorite-product/index";
|
|
24
|
+
export { IkasContactForm } from "./contact-form/index";
|
|
24
25
|
export type { IkasState } from "./state/index";
|
|
25
26
|
export * from "./variant-type/index";
|
|
26
27
|
export { IkasVariantValue } from "./variant-type/variant-value/index";
|
|
@@ -9,6 +9,7 @@ export * from "./validator/rules/index";
|
|
|
9
9
|
export { LoginForm } from "./validator/form/login";
|
|
10
10
|
export { AddressForm } from "./validator/form/address";
|
|
11
11
|
export { RegisterForm } from "./validator/form/register";
|
|
12
|
+
export { ContactForm } from "./validator/form/contact-form";
|
|
12
13
|
export { ForgotPasswordForm } from "./validator/form/forgot-password";
|
|
13
14
|
export { RecoverPasswordForm } from "./validator/form/recover-password";
|
|
14
15
|
export { AccountInfoForm } from "./validator/form/account-info";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { IkasBaseStore } from "../../../../store/index";
|
|
2
|
+
declare type ContactFormProps<T> = {
|
|
3
|
+
message: {
|
|
4
|
+
requiredRule: ((model: T) => string) | string;
|
|
5
|
+
emailRule: ((model: T) => string) | string;
|
|
6
|
+
minRule: ((model: T) => string) | string;
|
|
7
|
+
};
|
|
8
|
+
store: IkasBaseStore;
|
|
9
|
+
};
|
|
10
|
+
declare type ContactFormModel = {
|
|
11
|
+
firstName: string;
|
|
12
|
+
lastName: string;
|
|
13
|
+
email: string;
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
export declare class ContactForm {
|
|
17
|
+
private model;
|
|
18
|
+
private validator;
|
|
19
|
+
private store;
|
|
20
|
+
constructor(props: ContactFormProps<ContactFormModel>);
|
|
21
|
+
get firstName(): string;
|
|
22
|
+
set firstName(value: string);
|
|
23
|
+
get lastName(): string;
|
|
24
|
+
set lastName(value: string);
|
|
25
|
+
get email(): string;
|
|
26
|
+
set email(value: string);
|
|
27
|
+
get message(): string;
|
|
28
|
+
set message(value: string);
|
|
29
|
+
get hasError(): boolean;
|
|
30
|
+
get firstNameErrorMessage(): string | undefined;
|
|
31
|
+
get lastNameErrorMessage(): string | undefined;
|
|
32
|
+
get emailErrorMessage(): string | undefined;
|
|
33
|
+
get messageErrorMessage(): string | undefined;
|
|
34
|
+
get redirect(): string | null | undefined;
|
|
35
|
+
onFirstNameChange: (value: string) => void;
|
|
36
|
+
onLastNameChange: (value: string) => void;
|
|
37
|
+
onEmailChange: (value: string) => void;
|
|
38
|
+
onMessageChange: (value: string) => void;
|
|
39
|
+
validateAll(): Promise<boolean>;
|
|
40
|
+
saveContactForm(): Promise<{
|
|
41
|
+
isFormError: boolean;
|
|
42
|
+
isSuccess: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { IkasCustomer, IkasFavoriteProduct, IkasOrderTransaction, IkasProduct } from "../models/index";
|
|
2
2
|
import { IkasBaseStore } from "./base";
|
|
3
|
+
declare type SaveContactForm = {
|
|
4
|
+
firstName: string;
|
|
5
|
+
lastName: string;
|
|
6
|
+
email: string;
|
|
7
|
+
message: string;
|
|
8
|
+
};
|
|
3
9
|
export declare class IkasCustomerStore {
|
|
4
10
|
customer?: IkasCustomer | null;
|
|
5
11
|
token?: string | null;
|
|
@@ -10,6 +16,7 @@ export declare class IkasCustomerStore {
|
|
|
10
16
|
get initialized(): boolean;
|
|
11
17
|
login: (email: string, password: string) => Promise<boolean>;
|
|
12
18
|
register: (firstName: string, lastName: string, email: string, password: string) => Promise<boolean>;
|
|
19
|
+
saveContactForm: (input: SaveContactForm) => Promise<boolean | undefined>;
|
|
13
20
|
checkEmail: (email: string) => Promise<boolean>;
|
|
14
21
|
forgotPassword: (email: string) => Promise<boolean>;
|
|
15
22
|
recoverPassword: (password: string, passwordAgain: string, token: string) => Promise<boolean>;
|
|
@@ -35,3 +42,4 @@ export declare class IkasCustomerStore {
|
|
|
35
42
|
private setToken;
|
|
36
43
|
private loadToken;
|
|
37
44
|
}
|
|
45
|
+
export {};
|