@ikas/storefront 0.0.86 → 0.0.88
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/analytics/analytics.d.ts +1 -4
- package/build/analytics/googleTagManager.d.ts +0 -3
- 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 +257 -75
- package/build/index.js +259 -74
- 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
|
@@ -3,10 +3,7 @@ import { CheckoutStep } from "../components/checkout/model";
|
|
|
3
3
|
import { IkasCart } from "../models/data/cart/index";
|
|
4
4
|
export declare class Analytics {
|
|
5
5
|
constructor();
|
|
6
|
-
static pageView(url: string):
|
|
7
|
-
event: string;
|
|
8
|
-
page: string;
|
|
9
|
-
} | undefined;
|
|
6
|
+
static pageView(url: string): void;
|
|
10
7
|
static productView(productDetail: IkasProductDetail): void;
|
|
11
8
|
static addToCart(item: IkasProductDetail | IkasOrderLineItem, quantity: number): void;
|
|
12
9
|
static removeFromCart(item: IkasProductDetail | IkasOrderLineItem, quantity: number): void;
|
|
@@ -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) {
|
|
@@ -21184,57 +21203,6 @@ var GoogleTagManager = /** @class */ (function () {
|
|
|
21184
21203
|
console.error(err);
|
|
21185
21204
|
}
|
|
21186
21205
|
};
|
|
21187
|
-
GoogleTagManager.addToWishlist = function (id) {
|
|
21188
|
-
var serverRuntimeConfig = getConfig().serverRuntimeConfig;
|
|
21189
|
-
var fbpId = serverRuntimeConfig.FBP_ID;
|
|
21190
|
-
var event = {};
|
|
21191
|
-
try {
|
|
21192
|
-
if (fbpId) {
|
|
21193
|
-
!isServer$3 &&
|
|
21194
|
-
window.fbq("track", "AddToWishlist", {
|
|
21195
|
-
content_ids: [id],
|
|
21196
|
-
});
|
|
21197
|
-
}
|
|
21198
|
-
return event;
|
|
21199
|
-
}
|
|
21200
|
-
catch (err) {
|
|
21201
|
-
console.error(err);
|
|
21202
|
-
}
|
|
21203
|
-
};
|
|
21204
|
-
GoogleTagManager.search = function (searchKeyword) {
|
|
21205
|
-
var serverRuntimeConfig = getConfig().serverRuntimeConfig;
|
|
21206
|
-
var fbpId = serverRuntimeConfig.FBP_ID;
|
|
21207
|
-
var event = {};
|
|
21208
|
-
try {
|
|
21209
|
-
if (fbpId) {
|
|
21210
|
-
!isServer$3 &&
|
|
21211
|
-
window.fbq("track", "Search", {
|
|
21212
|
-
search_string: searchKeyword,
|
|
21213
|
-
});
|
|
21214
|
-
}
|
|
21215
|
-
return event;
|
|
21216
|
-
}
|
|
21217
|
-
catch (err) {
|
|
21218
|
-
console.error(err);
|
|
21219
|
-
}
|
|
21220
|
-
};
|
|
21221
|
-
GoogleTagManager.completeRegistration = function () {
|
|
21222
|
-
var serverRuntimeConfig = getConfig().serverRuntimeConfig;
|
|
21223
|
-
var fbpId = serverRuntimeConfig.FBP_ID;
|
|
21224
|
-
var event = {};
|
|
21225
|
-
try {
|
|
21226
|
-
if (fbpId) {
|
|
21227
|
-
!isServer$3 &&
|
|
21228
|
-
window.fbq("track", "CompleteRegistration", {
|
|
21229
|
-
status: true,
|
|
21230
|
-
});
|
|
21231
|
-
}
|
|
21232
|
-
return event;
|
|
21233
|
-
}
|
|
21234
|
-
catch (err) {
|
|
21235
|
-
console.error(err);
|
|
21236
|
-
}
|
|
21237
|
-
};
|
|
21238
21206
|
return GoogleTagManager;
|
|
21239
21207
|
}());
|
|
21240
21208
|
function productToGTMItem(productDetail, quantity) {
|
|
@@ -21288,20 +21256,13 @@ function orderLineItemToGTMItem(orderLineItem, quantity) {
|
|
|
21288
21256
|
}
|
|
21289
21257
|
|
|
21290
21258
|
var LS_BEGIN_CHECKOUT_KEY = "gtmBeginCheckout";
|
|
21291
|
-
var isServer$4 = typeof window === "undefined";
|
|
21292
21259
|
var Analytics = /** @class */ (function () {
|
|
21293
21260
|
function Analytics() {
|
|
21294
21261
|
makeAutoObservable(this);
|
|
21295
21262
|
}
|
|
21296
21263
|
Analytics.pageView = function (url) {
|
|
21297
21264
|
try {
|
|
21298
|
-
|
|
21299
|
-
event: "page-view",
|
|
21300
|
-
page: url,
|
|
21301
|
-
};
|
|
21302
|
-
//@ts-ignore
|
|
21303
|
-
!isServer$4 && window.dataLayer && window.dataLayer.push(event_1);
|
|
21304
|
-
return event_1;
|
|
21265
|
+
GoogleTagManager.pageView(url);
|
|
21305
21266
|
}
|
|
21306
21267
|
catch (err) {
|
|
21307
21268
|
console.error(err);
|
|
@@ -21311,7 +21272,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21311
21272
|
try {
|
|
21312
21273
|
FacebookPixel.productView(productDetail);
|
|
21313
21274
|
GoogleTagManager.productView(productDetail);
|
|
21314
|
-
return;
|
|
21315
21275
|
}
|
|
21316
21276
|
catch (err) {
|
|
21317
21277
|
console.error(err);
|
|
@@ -21321,7 +21281,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21321
21281
|
try {
|
|
21322
21282
|
FacebookPixel.addToCart(item, quantity);
|
|
21323
21283
|
GoogleTagManager.addToCart(item, quantity);
|
|
21324
|
-
return;
|
|
21325
21284
|
}
|
|
21326
21285
|
catch (err) {
|
|
21327
21286
|
console.error(err);
|
|
@@ -21330,7 +21289,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21330
21289
|
Analytics.removeFromCart = function (item, quantity) {
|
|
21331
21290
|
try {
|
|
21332
21291
|
GoogleTagManager.removeFromCart(item, quantity);
|
|
21333
|
-
return;
|
|
21334
21292
|
}
|
|
21335
21293
|
catch (err) {
|
|
21336
21294
|
console.error(err);
|
|
@@ -21344,7 +21302,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21344
21302
|
localStorage.setItem(LS_BEGIN_CHECKOUT_KEY, checkout.id);
|
|
21345
21303
|
FacebookPixel.beginCheckout(checkout);
|
|
21346
21304
|
GoogleTagManager.beginCheckout(checkout);
|
|
21347
|
-
return;
|
|
21348
21305
|
}
|
|
21349
21306
|
catch (err) {
|
|
21350
21307
|
console.error(err);
|
|
@@ -21355,7 +21312,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21355
21312
|
localStorage.removeItem(LS_BEGIN_CHECKOUT_KEY);
|
|
21356
21313
|
FacebookPixel.purchase(checkout, orderId);
|
|
21357
21314
|
GoogleTagManager.purchase(checkout, orderId);
|
|
21358
|
-
return;
|
|
21359
21315
|
}
|
|
21360
21316
|
catch (err) {
|
|
21361
21317
|
console.error(err);
|
|
@@ -21364,7 +21320,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21364
21320
|
Analytics.checkoutStep = function (checkout, step) {
|
|
21365
21321
|
try {
|
|
21366
21322
|
GoogleTagManager.checkoutStep(checkout, step);
|
|
21367
|
-
return;
|
|
21368
21323
|
}
|
|
21369
21324
|
catch (err) {
|
|
21370
21325
|
console.error(err);
|
|
@@ -21381,7 +21336,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21381
21336
|
Analytics.addToWishlist = function (id) {
|
|
21382
21337
|
try {
|
|
21383
21338
|
FacebookPixel.addToWishlist(id);
|
|
21384
|
-
return;
|
|
21385
21339
|
}
|
|
21386
21340
|
catch (err) {
|
|
21387
21341
|
console.error(err);
|
|
@@ -21390,7 +21344,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21390
21344
|
Analytics.search = function (searchKeyword) {
|
|
21391
21345
|
try {
|
|
21392
21346
|
FacebookPixel.search(searchKeyword);
|
|
21393
|
-
return;
|
|
21394
21347
|
}
|
|
21395
21348
|
catch (err) {
|
|
21396
21349
|
console.error(err);
|
|
@@ -21399,7 +21352,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21399
21352
|
Analytics.completeRegistration = function () {
|
|
21400
21353
|
try {
|
|
21401
21354
|
FacebookPixel.completeRegistration();
|
|
21402
|
-
return;
|
|
21403
21355
|
}
|
|
21404
21356
|
catch (err) {
|
|
21405
21357
|
console.error(err);
|
|
@@ -21410,7 +21362,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21410
21362
|
if (cart) {
|
|
21411
21363
|
FacebookPixel.viewCart(cart);
|
|
21412
21364
|
}
|
|
21413
|
-
return;
|
|
21414
21365
|
}
|
|
21415
21366
|
catch (err) {
|
|
21416
21367
|
console.error(err);
|
|
@@ -21419,7 +21370,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21419
21370
|
Analytics.viewCategory = function (categoryPath) {
|
|
21420
21371
|
try {
|
|
21421
21372
|
FacebookPixel.viewCategory(categoryPath);
|
|
21422
|
-
return;
|
|
21423
21373
|
}
|
|
21424
21374
|
catch (err) {
|
|
21425
21375
|
console.error(err);
|
|
@@ -23338,6 +23288,195 @@ var RegisterForm = /** @class */ (function () {
|
|
|
23338
23288
|
return RegisterForm;
|
|
23339
23289
|
}());
|
|
23340
23290
|
|
|
23291
|
+
var ContactForm = /** @class */ (function () {
|
|
23292
|
+
function ContactForm(props) {
|
|
23293
|
+
var _this = this;
|
|
23294
|
+
this.model = {
|
|
23295
|
+
firstName: "",
|
|
23296
|
+
lastName: "",
|
|
23297
|
+
email: "",
|
|
23298
|
+
message: "",
|
|
23299
|
+
};
|
|
23300
|
+
this.onFirstNameChange = function (value) {
|
|
23301
|
+
_this.firstName = value;
|
|
23302
|
+
};
|
|
23303
|
+
this.onLastNameChange = function (value) {
|
|
23304
|
+
_this.lastName = value;
|
|
23305
|
+
};
|
|
23306
|
+
this.onEmailChange = function (value) {
|
|
23307
|
+
_this.email = value;
|
|
23308
|
+
};
|
|
23309
|
+
this.onMessageChange = function (value) {
|
|
23310
|
+
_this.message = value;
|
|
23311
|
+
};
|
|
23312
|
+
makeObservable(this, {
|
|
23313
|
+
emailErrorMessage: computed,
|
|
23314
|
+
messageErrorMessage: computed,
|
|
23315
|
+
firstNameErrorMessage: computed,
|
|
23316
|
+
lastNameErrorMessage: computed,
|
|
23317
|
+
hasError: computed,
|
|
23318
|
+
redirect: computed,
|
|
23319
|
+
model: observable,
|
|
23320
|
+
validateAll: action,
|
|
23321
|
+
saveContactForm: action,
|
|
23322
|
+
});
|
|
23323
|
+
this.store = props.store;
|
|
23324
|
+
this.validator = new Validator(this.model, [
|
|
23325
|
+
new RequiredRule({
|
|
23326
|
+
fieldKey: "firstName",
|
|
23327
|
+
valuePath: "firstName",
|
|
23328
|
+
message: props.message.requiredRule,
|
|
23329
|
+
}),
|
|
23330
|
+
new RequiredRule({
|
|
23331
|
+
fieldKey: "lastName",
|
|
23332
|
+
valuePath: "lastName",
|
|
23333
|
+
message: props.message.requiredRule,
|
|
23334
|
+
}),
|
|
23335
|
+
new RequiredRule({
|
|
23336
|
+
fieldKey: "email",
|
|
23337
|
+
valuePath: "email",
|
|
23338
|
+
message: props.message.requiredRule,
|
|
23339
|
+
}),
|
|
23340
|
+
new RequiredRule({
|
|
23341
|
+
fieldKey: "message",
|
|
23342
|
+
valuePath: "message",
|
|
23343
|
+
message: props.message.requiredRule,
|
|
23344
|
+
}),
|
|
23345
|
+
new EmailRule({
|
|
23346
|
+
fieldKey: "email",
|
|
23347
|
+
valuePath: "email",
|
|
23348
|
+
message: props.message.emailRule,
|
|
23349
|
+
}),
|
|
23350
|
+
]);
|
|
23351
|
+
}
|
|
23352
|
+
Object.defineProperty(ContactForm.prototype, "firstName", {
|
|
23353
|
+
get: function () {
|
|
23354
|
+
return this.model.firstName;
|
|
23355
|
+
},
|
|
23356
|
+
set: function (value) {
|
|
23357
|
+
this.model.firstName = value;
|
|
23358
|
+
},
|
|
23359
|
+
enumerable: false,
|
|
23360
|
+
configurable: true
|
|
23361
|
+
});
|
|
23362
|
+
Object.defineProperty(ContactForm.prototype, "lastName", {
|
|
23363
|
+
get: function () {
|
|
23364
|
+
return this.model.lastName;
|
|
23365
|
+
},
|
|
23366
|
+
set: function (value) {
|
|
23367
|
+
this.model.lastName = value;
|
|
23368
|
+
},
|
|
23369
|
+
enumerable: false,
|
|
23370
|
+
configurable: true
|
|
23371
|
+
});
|
|
23372
|
+
Object.defineProperty(ContactForm.prototype, "email", {
|
|
23373
|
+
get: function () {
|
|
23374
|
+
return this.model.email;
|
|
23375
|
+
},
|
|
23376
|
+
set: function (value) {
|
|
23377
|
+
this.model.email = value;
|
|
23378
|
+
},
|
|
23379
|
+
enumerable: false,
|
|
23380
|
+
configurable: true
|
|
23381
|
+
});
|
|
23382
|
+
Object.defineProperty(ContactForm.prototype, "message", {
|
|
23383
|
+
get: function () {
|
|
23384
|
+
return this.model.message;
|
|
23385
|
+
},
|
|
23386
|
+
set: function (value) {
|
|
23387
|
+
this.model.message = value;
|
|
23388
|
+
},
|
|
23389
|
+
enumerable: false,
|
|
23390
|
+
configurable: true
|
|
23391
|
+
});
|
|
23392
|
+
Object.defineProperty(ContactForm.prototype, "hasError", {
|
|
23393
|
+
get: function () {
|
|
23394
|
+
return this.validator.hasError;
|
|
23395
|
+
},
|
|
23396
|
+
enumerable: false,
|
|
23397
|
+
configurable: true
|
|
23398
|
+
});
|
|
23399
|
+
Object.defineProperty(ContactForm.prototype, "firstNameErrorMessage", {
|
|
23400
|
+
get: function () {
|
|
23401
|
+
return this.validator.results.firstName.errorMessage;
|
|
23402
|
+
},
|
|
23403
|
+
enumerable: false,
|
|
23404
|
+
configurable: true
|
|
23405
|
+
});
|
|
23406
|
+
Object.defineProperty(ContactForm.prototype, "lastNameErrorMessage", {
|
|
23407
|
+
get: function () {
|
|
23408
|
+
return this.validator.results.lastName.errorMessage;
|
|
23409
|
+
},
|
|
23410
|
+
enumerable: false,
|
|
23411
|
+
configurable: true
|
|
23412
|
+
});
|
|
23413
|
+
Object.defineProperty(ContactForm.prototype, "emailErrorMessage", {
|
|
23414
|
+
get: function () {
|
|
23415
|
+
return this.validator.results.email.errorMessage;
|
|
23416
|
+
},
|
|
23417
|
+
enumerable: false,
|
|
23418
|
+
configurable: true
|
|
23419
|
+
});
|
|
23420
|
+
Object.defineProperty(ContactForm.prototype, "messageErrorMessage", {
|
|
23421
|
+
get: function () {
|
|
23422
|
+
return this.validator.results.message.errorMessage;
|
|
23423
|
+
},
|
|
23424
|
+
enumerable: false,
|
|
23425
|
+
configurable: true
|
|
23426
|
+
});
|
|
23427
|
+
Object.defineProperty(ContactForm.prototype, "redirect", {
|
|
23428
|
+
get: function () {
|
|
23429
|
+
if (typeof window !== "undefined") {
|
|
23430
|
+
var urlSearch = new URLSearchParams(window.location.search);
|
|
23431
|
+
return urlSearch.get("redirect");
|
|
23432
|
+
}
|
|
23433
|
+
},
|
|
23434
|
+
enumerable: false,
|
|
23435
|
+
configurable: true
|
|
23436
|
+
});
|
|
23437
|
+
ContactForm.prototype.validateAll = function () {
|
|
23438
|
+
return this.validator.validateAll();
|
|
23439
|
+
};
|
|
23440
|
+
ContactForm.prototype.saveContactForm = function () {
|
|
23441
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23442
|
+
var response, hasFormError, isContactFormSuccess;
|
|
23443
|
+
return __generator(this, function (_b) {
|
|
23444
|
+
switch (_b.label) {
|
|
23445
|
+
case 0:
|
|
23446
|
+
response = { isFormError: false, isSuccess: false };
|
|
23447
|
+
return [4 /*yield*/, this.validateAll()];
|
|
23448
|
+
case 1:
|
|
23449
|
+
hasFormError = _b.sent();
|
|
23450
|
+
if (hasFormError) {
|
|
23451
|
+
response.isFormError = true;
|
|
23452
|
+
return [2 /*return*/, response];
|
|
23453
|
+
}
|
|
23454
|
+
_b.label = 2;
|
|
23455
|
+
case 2:
|
|
23456
|
+
_b.trys.push([2, 4, , 5]);
|
|
23457
|
+
return [4 /*yield*/, this.store.customerStore.saveContactForm({
|
|
23458
|
+
firstName: this.model.firstName,
|
|
23459
|
+
lastName: this.model.lastName,
|
|
23460
|
+
email: this.model.email,
|
|
23461
|
+
message: this.model.message,
|
|
23462
|
+
})];
|
|
23463
|
+
case 3:
|
|
23464
|
+
isContactFormSuccess = _b.sent();
|
|
23465
|
+
if (isContactFormSuccess) {
|
|
23466
|
+
response.isSuccess = true;
|
|
23467
|
+
}
|
|
23468
|
+
return [2 /*return*/, response];
|
|
23469
|
+
case 4:
|
|
23470
|
+
_b.sent();
|
|
23471
|
+
return [2 /*return*/, response];
|
|
23472
|
+
case 5: return [2 /*return*/];
|
|
23473
|
+
}
|
|
23474
|
+
});
|
|
23475
|
+
});
|
|
23476
|
+
};
|
|
23477
|
+
return ContactForm;
|
|
23478
|
+
}());
|
|
23479
|
+
|
|
23341
23480
|
var ForgotPasswordForm = /** @class */ (function () {
|
|
23342
23481
|
function ForgotPasswordForm(props) {
|
|
23343
23482
|
var _this = this;
|
|
@@ -25727,6 +25866,49 @@ var IkasFavoriteProductAPI = /** @class */ (function () {
|
|
|
25727
25866
|
}());
|
|
25728
25867
|
var templateObject_1$g, templateObject_2$6, templateObject_3$2;
|
|
25729
25868
|
|
|
25869
|
+
var IkasContactFormAPI = /** @class */ (function () {
|
|
25870
|
+
function IkasContactFormAPI() {
|
|
25871
|
+
}
|
|
25872
|
+
IkasContactFormAPI.sendContactFormToMerchant = function (input) {
|
|
25873
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25874
|
+
var MUTATION, _a, data, errors, err_1;
|
|
25875
|
+
return __generator(this, function (_b) {
|
|
25876
|
+
switch (_b.label) {
|
|
25877
|
+
case 0:
|
|
25878
|
+
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 "])));
|
|
25879
|
+
_b.label = 1;
|
|
25880
|
+
case 1:
|
|
25881
|
+
_b.trys.push([1, 3, , 4]);
|
|
25882
|
+
return [4 /*yield*/, apollo
|
|
25883
|
+
.getClient()
|
|
25884
|
+
.mutate({
|
|
25885
|
+
mutation: MUTATION,
|
|
25886
|
+
variables: {
|
|
25887
|
+
email: input.email,
|
|
25888
|
+
message: input.message,
|
|
25889
|
+
firstName: input.firstName,
|
|
25890
|
+
lastName: input.lastName,
|
|
25891
|
+
},
|
|
25892
|
+
})];
|
|
25893
|
+
case 2:
|
|
25894
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
25895
|
+
if (errors && errors.length) {
|
|
25896
|
+
console.log(errors);
|
|
25897
|
+
}
|
|
25898
|
+
return [2 /*return*/, data === null || data === void 0 ? void 0 : data.sendContactFormToMerchant];
|
|
25899
|
+
case 3:
|
|
25900
|
+
err_1 = _b.sent();
|
|
25901
|
+
console.log(err_1);
|
|
25902
|
+
return [3 /*break*/, 4];
|
|
25903
|
+
case 4: return [2 /*return*/];
|
|
25904
|
+
}
|
|
25905
|
+
});
|
|
25906
|
+
});
|
|
25907
|
+
};
|
|
25908
|
+
return IkasContactFormAPI;
|
|
25909
|
+
}());
|
|
25910
|
+
var templateObject_1$h;
|
|
25911
|
+
|
|
25730
25912
|
var IkasStateAPI = /** @class */ (function () {
|
|
25731
25913
|
function IkasStateAPI() {
|
|
25732
25914
|
}
|
|
@@ -25736,7 +25918,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
25736
25918
|
return __generator(this, function (_b) {
|
|
25737
25919
|
switch (_b.label) {
|
|
25738
25920
|
case 0:
|
|
25739
|
-
QUERY = src(templateObject_1$
|
|
25921
|
+
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
25922
|
_b.label = 1;
|
|
25741
25923
|
case 1:
|
|
25742
25924
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -25773,7 +25955,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
25773
25955
|
};
|
|
25774
25956
|
return IkasStateAPI;
|
|
25775
25957
|
}());
|
|
25776
|
-
var templateObject_1$
|
|
25958
|
+
var templateObject_1$i;
|
|
25777
25959
|
|
|
25778
25960
|
var IkasStorefrontDomain = /** @class */ (function () {
|
|
25779
25961
|
function IkasStorefrontDomain(data) {
|
|
@@ -25866,7 +26048,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
25866
26048
|
return __generator(this, function (_b) {
|
|
25867
26049
|
switch (_b.label) {
|
|
25868
26050
|
case 0:
|
|
25869
|
-
QUERY = src(templateObject_1$
|
|
26051
|
+
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
26052
|
_b.label = 1;
|
|
25871
26053
|
case 1:
|
|
25872
26054
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -25896,7 +26078,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
25896
26078
|
};
|
|
25897
26079
|
return IkasStorefrontAPI;
|
|
25898
26080
|
}());
|
|
25899
|
-
var templateObject_1$
|
|
26081
|
+
var templateObject_1$j;
|
|
25900
26082
|
|
|
25901
26083
|
var IkasThemeAPI = /** @class */ (function () {
|
|
25902
26084
|
function IkasThemeAPI() {
|
|
@@ -28782,4 +28964,4 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
28782
28964
|
return IkasBaseStore;
|
|
28783
28965
|
}());
|
|
28784
28966
|
|
|
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 };
|
|
28967
|
+
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) {
|
|
@@ -21167,57 +21186,6 @@ var GoogleTagManager = /** @class */ (function () {
|
|
|
21167
21186
|
console.error(err);
|
|
21168
21187
|
}
|
|
21169
21188
|
};
|
|
21170
|
-
GoogleTagManager.addToWishlist = function (id) {
|
|
21171
|
-
var serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
|
|
21172
|
-
var fbpId = serverRuntimeConfig.FBP_ID;
|
|
21173
|
-
var event = {};
|
|
21174
|
-
try {
|
|
21175
|
-
if (fbpId) {
|
|
21176
|
-
!isServer$3 &&
|
|
21177
|
-
window.fbq("track", "AddToWishlist", {
|
|
21178
|
-
content_ids: [id],
|
|
21179
|
-
});
|
|
21180
|
-
}
|
|
21181
|
-
return event;
|
|
21182
|
-
}
|
|
21183
|
-
catch (err) {
|
|
21184
|
-
console.error(err);
|
|
21185
|
-
}
|
|
21186
|
-
};
|
|
21187
|
-
GoogleTagManager.search = function (searchKeyword) {
|
|
21188
|
-
var serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
|
|
21189
|
-
var fbpId = serverRuntimeConfig.FBP_ID;
|
|
21190
|
-
var event = {};
|
|
21191
|
-
try {
|
|
21192
|
-
if (fbpId) {
|
|
21193
|
-
!isServer$3 &&
|
|
21194
|
-
window.fbq("track", "Search", {
|
|
21195
|
-
search_string: searchKeyword,
|
|
21196
|
-
});
|
|
21197
|
-
}
|
|
21198
|
-
return event;
|
|
21199
|
-
}
|
|
21200
|
-
catch (err) {
|
|
21201
|
-
console.error(err);
|
|
21202
|
-
}
|
|
21203
|
-
};
|
|
21204
|
-
GoogleTagManager.completeRegistration = function () {
|
|
21205
|
-
var serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
|
|
21206
|
-
var fbpId = serverRuntimeConfig.FBP_ID;
|
|
21207
|
-
var event = {};
|
|
21208
|
-
try {
|
|
21209
|
-
if (fbpId) {
|
|
21210
|
-
!isServer$3 &&
|
|
21211
|
-
window.fbq("track", "CompleteRegistration", {
|
|
21212
|
-
status: true,
|
|
21213
|
-
});
|
|
21214
|
-
}
|
|
21215
|
-
return event;
|
|
21216
|
-
}
|
|
21217
|
-
catch (err) {
|
|
21218
|
-
console.error(err);
|
|
21219
|
-
}
|
|
21220
|
-
};
|
|
21221
21189
|
return GoogleTagManager;
|
|
21222
21190
|
}());
|
|
21223
21191
|
function productToGTMItem(productDetail, quantity) {
|
|
@@ -21271,20 +21239,13 @@ function orderLineItemToGTMItem(orderLineItem, quantity) {
|
|
|
21271
21239
|
}
|
|
21272
21240
|
|
|
21273
21241
|
var LS_BEGIN_CHECKOUT_KEY = "gtmBeginCheckout";
|
|
21274
|
-
var isServer$4 = typeof window === "undefined";
|
|
21275
21242
|
var Analytics = /** @class */ (function () {
|
|
21276
21243
|
function Analytics() {
|
|
21277
21244
|
mobx.makeAutoObservable(this);
|
|
21278
21245
|
}
|
|
21279
21246
|
Analytics.pageView = function (url) {
|
|
21280
21247
|
try {
|
|
21281
|
-
|
|
21282
|
-
event: "page-view",
|
|
21283
|
-
page: url,
|
|
21284
|
-
};
|
|
21285
|
-
//@ts-ignore
|
|
21286
|
-
!isServer$4 && window.dataLayer && window.dataLayer.push(event_1);
|
|
21287
|
-
return event_1;
|
|
21248
|
+
GoogleTagManager.pageView(url);
|
|
21288
21249
|
}
|
|
21289
21250
|
catch (err) {
|
|
21290
21251
|
console.error(err);
|
|
@@ -21294,7 +21255,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21294
21255
|
try {
|
|
21295
21256
|
FacebookPixel.productView(productDetail);
|
|
21296
21257
|
GoogleTagManager.productView(productDetail);
|
|
21297
|
-
return;
|
|
21298
21258
|
}
|
|
21299
21259
|
catch (err) {
|
|
21300
21260
|
console.error(err);
|
|
@@ -21304,7 +21264,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21304
21264
|
try {
|
|
21305
21265
|
FacebookPixel.addToCart(item, quantity);
|
|
21306
21266
|
GoogleTagManager.addToCart(item, quantity);
|
|
21307
|
-
return;
|
|
21308
21267
|
}
|
|
21309
21268
|
catch (err) {
|
|
21310
21269
|
console.error(err);
|
|
@@ -21313,7 +21272,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21313
21272
|
Analytics.removeFromCart = function (item, quantity) {
|
|
21314
21273
|
try {
|
|
21315
21274
|
GoogleTagManager.removeFromCart(item, quantity);
|
|
21316
|
-
return;
|
|
21317
21275
|
}
|
|
21318
21276
|
catch (err) {
|
|
21319
21277
|
console.error(err);
|
|
@@ -21327,7 +21285,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21327
21285
|
localStorage.setItem(LS_BEGIN_CHECKOUT_KEY, checkout.id);
|
|
21328
21286
|
FacebookPixel.beginCheckout(checkout);
|
|
21329
21287
|
GoogleTagManager.beginCheckout(checkout);
|
|
21330
|
-
return;
|
|
21331
21288
|
}
|
|
21332
21289
|
catch (err) {
|
|
21333
21290
|
console.error(err);
|
|
@@ -21338,7 +21295,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21338
21295
|
localStorage.removeItem(LS_BEGIN_CHECKOUT_KEY);
|
|
21339
21296
|
FacebookPixel.purchase(checkout, orderId);
|
|
21340
21297
|
GoogleTagManager.purchase(checkout, orderId);
|
|
21341
|
-
return;
|
|
21342
21298
|
}
|
|
21343
21299
|
catch (err) {
|
|
21344
21300
|
console.error(err);
|
|
@@ -21347,7 +21303,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21347
21303
|
Analytics.checkoutStep = function (checkout, step) {
|
|
21348
21304
|
try {
|
|
21349
21305
|
GoogleTagManager.checkoutStep(checkout, step);
|
|
21350
|
-
return;
|
|
21351
21306
|
}
|
|
21352
21307
|
catch (err) {
|
|
21353
21308
|
console.error(err);
|
|
@@ -21364,7 +21319,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21364
21319
|
Analytics.addToWishlist = function (id) {
|
|
21365
21320
|
try {
|
|
21366
21321
|
FacebookPixel.addToWishlist(id);
|
|
21367
|
-
return;
|
|
21368
21322
|
}
|
|
21369
21323
|
catch (err) {
|
|
21370
21324
|
console.error(err);
|
|
@@ -21373,7 +21327,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21373
21327
|
Analytics.search = function (searchKeyword) {
|
|
21374
21328
|
try {
|
|
21375
21329
|
FacebookPixel.search(searchKeyword);
|
|
21376
|
-
return;
|
|
21377
21330
|
}
|
|
21378
21331
|
catch (err) {
|
|
21379
21332
|
console.error(err);
|
|
@@ -21382,7 +21335,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21382
21335
|
Analytics.completeRegistration = function () {
|
|
21383
21336
|
try {
|
|
21384
21337
|
FacebookPixel.completeRegistration();
|
|
21385
|
-
return;
|
|
21386
21338
|
}
|
|
21387
21339
|
catch (err) {
|
|
21388
21340
|
console.error(err);
|
|
@@ -21393,7 +21345,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21393
21345
|
if (cart) {
|
|
21394
21346
|
FacebookPixel.viewCart(cart);
|
|
21395
21347
|
}
|
|
21396
|
-
return;
|
|
21397
21348
|
}
|
|
21398
21349
|
catch (err) {
|
|
21399
21350
|
console.error(err);
|
|
@@ -21402,7 +21353,6 @@ var Analytics = /** @class */ (function () {
|
|
|
21402
21353
|
Analytics.viewCategory = function (categoryPath) {
|
|
21403
21354
|
try {
|
|
21404
21355
|
FacebookPixel.viewCategory(categoryPath);
|
|
21405
|
-
return;
|
|
21406
21356
|
}
|
|
21407
21357
|
catch (err) {
|
|
21408
21358
|
console.error(err);
|
|
@@ -23318,6 +23268,195 @@ var RegisterForm = /** @class */ (function () {
|
|
|
23318
23268
|
return RegisterForm;
|
|
23319
23269
|
}());
|
|
23320
23270
|
|
|
23271
|
+
var ContactForm = /** @class */ (function () {
|
|
23272
|
+
function ContactForm(props) {
|
|
23273
|
+
var _this = this;
|
|
23274
|
+
this.model = {
|
|
23275
|
+
firstName: "",
|
|
23276
|
+
lastName: "",
|
|
23277
|
+
email: "",
|
|
23278
|
+
message: "",
|
|
23279
|
+
};
|
|
23280
|
+
this.onFirstNameChange = function (value) {
|
|
23281
|
+
_this.firstName = value;
|
|
23282
|
+
};
|
|
23283
|
+
this.onLastNameChange = function (value) {
|
|
23284
|
+
_this.lastName = value;
|
|
23285
|
+
};
|
|
23286
|
+
this.onEmailChange = function (value) {
|
|
23287
|
+
_this.email = value;
|
|
23288
|
+
};
|
|
23289
|
+
this.onMessageChange = function (value) {
|
|
23290
|
+
_this.message = value;
|
|
23291
|
+
};
|
|
23292
|
+
mobx.makeObservable(this, {
|
|
23293
|
+
emailErrorMessage: mobx.computed,
|
|
23294
|
+
messageErrorMessage: mobx.computed,
|
|
23295
|
+
firstNameErrorMessage: mobx.computed,
|
|
23296
|
+
lastNameErrorMessage: mobx.computed,
|
|
23297
|
+
hasError: mobx.computed,
|
|
23298
|
+
redirect: mobx.computed,
|
|
23299
|
+
model: mobx.observable,
|
|
23300
|
+
validateAll: mobx.action,
|
|
23301
|
+
saveContactForm: mobx.action,
|
|
23302
|
+
});
|
|
23303
|
+
this.store = props.store;
|
|
23304
|
+
this.validator = new Validator(this.model, [
|
|
23305
|
+
new RequiredRule({
|
|
23306
|
+
fieldKey: "firstName",
|
|
23307
|
+
valuePath: "firstName",
|
|
23308
|
+
message: props.message.requiredRule,
|
|
23309
|
+
}),
|
|
23310
|
+
new RequiredRule({
|
|
23311
|
+
fieldKey: "lastName",
|
|
23312
|
+
valuePath: "lastName",
|
|
23313
|
+
message: props.message.requiredRule,
|
|
23314
|
+
}),
|
|
23315
|
+
new RequiredRule({
|
|
23316
|
+
fieldKey: "email",
|
|
23317
|
+
valuePath: "email",
|
|
23318
|
+
message: props.message.requiredRule,
|
|
23319
|
+
}),
|
|
23320
|
+
new RequiredRule({
|
|
23321
|
+
fieldKey: "message",
|
|
23322
|
+
valuePath: "message",
|
|
23323
|
+
message: props.message.requiredRule,
|
|
23324
|
+
}),
|
|
23325
|
+
new EmailRule({
|
|
23326
|
+
fieldKey: "email",
|
|
23327
|
+
valuePath: "email",
|
|
23328
|
+
message: props.message.emailRule,
|
|
23329
|
+
}),
|
|
23330
|
+
]);
|
|
23331
|
+
}
|
|
23332
|
+
Object.defineProperty(ContactForm.prototype, "firstName", {
|
|
23333
|
+
get: function () {
|
|
23334
|
+
return this.model.firstName;
|
|
23335
|
+
},
|
|
23336
|
+
set: function (value) {
|
|
23337
|
+
this.model.firstName = value;
|
|
23338
|
+
},
|
|
23339
|
+
enumerable: false,
|
|
23340
|
+
configurable: true
|
|
23341
|
+
});
|
|
23342
|
+
Object.defineProperty(ContactForm.prototype, "lastName", {
|
|
23343
|
+
get: function () {
|
|
23344
|
+
return this.model.lastName;
|
|
23345
|
+
},
|
|
23346
|
+
set: function (value) {
|
|
23347
|
+
this.model.lastName = value;
|
|
23348
|
+
},
|
|
23349
|
+
enumerable: false,
|
|
23350
|
+
configurable: true
|
|
23351
|
+
});
|
|
23352
|
+
Object.defineProperty(ContactForm.prototype, "email", {
|
|
23353
|
+
get: function () {
|
|
23354
|
+
return this.model.email;
|
|
23355
|
+
},
|
|
23356
|
+
set: function (value) {
|
|
23357
|
+
this.model.email = value;
|
|
23358
|
+
},
|
|
23359
|
+
enumerable: false,
|
|
23360
|
+
configurable: true
|
|
23361
|
+
});
|
|
23362
|
+
Object.defineProperty(ContactForm.prototype, "message", {
|
|
23363
|
+
get: function () {
|
|
23364
|
+
return this.model.message;
|
|
23365
|
+
},
|
|
23366
|
+
set: function (value) {
|
|
23367
|
+
this.model.message = value;
|
|
23368
|
+
},
|
|
23369
|
+
enumerable: false,
|
|
23370
|
+
configurable: true
|
|
23371
|
+
});
|
|
23372
|
+
Object.defineProperty(ContactForm.prototype, "hasError", {
|
|
23373
|
+
get: function () {
|
|
23374
|
+
return this.validator.hasError;
|
|
23375
|
+
},
|
|
23376
|
+
enumerable: false,
|
|
23377
|
+
configurable: true
|
|
23378
|
+
});
|
|
23379
|
+
Object.defineProperty(ContactForm.prototype, "firstNameErrorMessage", {
|
|
23380
|
+
get: function () {
|
|
23381
|
+
return this.validator.results.firstName.errorMessage;
|
|
23382
|
+
},
|
|
23383
|
+
enumerable: false,
|
|
23384
|
+
configurable: true
|
|
23385
|
+
});
|
|
23386
|
+
Object.defineProperty(ContactForm.prototype, "lastNameErrorMessage", {
|
|
23387
|
+
get: function () {
|
|
23388
|
+
return this.validator.results.lastName.errorMessage;
|
|
23389
|
+
},
|
|
23390
|
+
enumerable: false,
|
|
23391
|
+
configurable: true
|
|
23392
|
+
});
|
|
23393
|
+
Object.defineProperty(ContactForm.prototype, "emailErrorMessage", {
|
|
23394
|
+
get: function () {
|
|
23395
|
+
return this.validator.results.email.errorMessage;
|
|
23396
|
+
},
|
|
23397
|
+
enumerable: false,
|
|
23398
|
+
configurable: true
|
|
23399
|
+
});
|
|
23400
|
+
Object.defineProperty(ContactForm.prototype, "messageErrorMessage", {
|
|
23401
|
+
get: function () {
|
|
23402
|
+
return this.validator.results.message.errorMessage;
|
|
23403
|
+
},
|
|
23404
|
+
enumerable: false,
|
|
23405
|
+
configurable: true
|
|
23406
|
+
});
|
|
23407
|
+
Object.defineProperty(ContactForm.prototype, "redirect", {
|
|
23408
|
+
get: function () {
|
|
23409
|
+
if (typeof window !== "undefined") {
|
|
23410
|
+
var urlSearch = new URLSearchParams(window.location.search);
|
|
23411
|
+
return urlSearch.get("redirect");
|
|
23412
|
+
}
|
|
23413
|
+
},
|
|
23414
|
+
enumerable: false,
|
|
23415
|
+
configurable: true
|
|
23416
|
+
});
|
|
23417
|
+
ContactForm.prototype.validateAll = function () {
|
|
23418
|
+
return this.validator.validateAll();
|
|
23419
|
+
};
|
|
23420
|
+
ContactForm.prototype.saveContactForm = function () {
|
|
23421
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23422
|
+
var response, hasFormError, isContactFormSuccess;
|
|
23423
|
+
return __generator(this, function (_b) {
|
|
23424
|
+
switch (_b.label) {
|
|
23425
|
+
case 0:
|
|
23426
|
+
response = { isFormError: false, isSuccess: false };
|
|
23427
|
+
return [4 /*yield*/, this.validateAll()];
|
|
23428
|
+
case 1:
|
|
23429
|
+
hasFormError = _b.sent();
|
|
23430
|
+
if (hasFormError) {
|
|
23431
|
+
response.isFormError = true;
|
|
23432
|
+
return [2 /*return*/, response];
|
|
23433
|
+
}
|
|
23434
|
+
_b.label = 2;
|
|
23435
|
+
case 2:
|
|
23436
|
+
_b.trys.push([2, 4, , 5]);
|
|
23437
|
+
return [4 /*yield*/, this.store.customerStore.saveContactForm({
|
|
23438
|
+
firstName: this.model.firstName,
|
|
23439
|
+
lastName: this.model.lastName,
|
|
23440
|
+
email: this.model.email,
|
|
23441
|
+
message: this.model.message,
|
|
23442
|
+
})];
|
|
23443
|
+
case 3:
|
|
23444
|
+
isContactFormSuccess = _b.sent();
|
|
23445
|
+
if (isContactFormSuccess) {
|
|
23446
|
+
response.isSuccess = true;
|
|
23447
|
+
}
|
|
23448
|
+
return [2 /*return*/, response];
|
|
23449
|
+
case 4:
|
|
23450
|
+
_b.sent();
|
|
23451
|
+
return [2 /*return*/, response];
|
|
23452
|
+
case 5: return [2 /*return*/];
|
|
23453
|
+
}
|
|
23454
|
+
});
|
|
23455
|
+
});
|
|
23456
|
+
};
|
|
23457
|
+
return ContactForm;
|
|
23458
|
+
}());
|
|
23459
|
+
|
|
23321
23460
|
var ForgotPasswordForm = /** @class */ (function () {
|
|
23322
23461
|
function ForgotPasswordForm(props) {
|
|
23323
23462
|
var _this = this;
|
|
@@ -25707,6 +25846,49 @@ var IkasFavoriteProductAPI = /** @class */ (function () {
|
|
|
25707
25846
|
}());
|
|
25708
25847
|
var templateObject_1$g, templateObject_2$6, templateObject_3$2;
|
|
25709
25848
|
|
|
25849
|
+
var IkasContactFormAPI = /** @class */ (function () {
|
|
25850
|
+
function IkasContactFormAPI() {
|
|
25851
|
+
}
|
|
25852
|
+
IkasContactFormAPI.sendContactFormToMerchant = function (input) {
|
|
25853
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25854
|
+
var MUTATION, _a, data, errors, err_1;
|
|
25855
|
+
return __generator(this, function (_b) {
|
|
25856
|
+
switch (_b.label) {
|
|
25857
|
+
case 0:
|
|
25858
|
+
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 "])));
|
|
25859
|
+
_b.label = 1;
|
|
25860
|
+
case 1:
|
|
25861
|
+
_b.trys.push([1, 3, , 4]);
|
|
25862
|
+
return [4 /*yield*/, apollo
|
|
25863
|
+
.getClient()
|
|
25864
|
+
.mutate({
|
|
25865
|
+
mutation: MUTATION,
|
|
25866
|
+
variables: {
|
|
25867
|
+
email: input.email,
|
|
25868
|
+
message: input.message,
|
|
25869
|
+
firstName: input.firstName,
|
|
25870
|
+
lastName: input.lastName,
|
|
25871
|
+
},
|
|
25872
|
+
})];
|
|
25873
|
+
case 2:
|
|
25874
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
25875
|
+
if (errors && errors.length) {
|
|
25876
|
+
console.log(errors);
|
|
25877
|
+
}
|
|
25878
|
+
return [2 /*return*/, data === null || data === void 0 ? void 0 : data.sendContactFormToMerchant];
|
|
25879
|
+
case 3:
|
|
25880
|
+
err_1 = _b.sent();
|
|
25881
|
+
console.log(err_1);
|
|
25882
|
+
return [3 /*break*/, 4];
|
|
25883
|
+
case 4: return [2 /*return*/];
|
|
25884
|
+
}
|
|
25885
|
+
});
|
|
25886
|
+
});
|
|
25887
|
+
};
|
|
25888
|
+
return IkasContactFormAPI;
|
|
25889
|
+
}());
|
|
25890
|
+
var templateObject_1$h;
|
|
25891
|
+
|
|
25710
25892
|
var IkasStateAPI = /** @class */ (function () {
|
|
25711
25893
|
function IkasStateAPI() {
|
|
25712
25894
|
}
|
|
@@ -25716,7 +25898,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
25716
25898
|
return __generator(this, function (_b) {
|
|
25717
25899
|
switch (_b.label) {
|
|
25718
25900
|
case 0:
|
|
25719
|
-
QUERY = src(templateObject_1$
|
|
25901
|
+
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
25902
|
_b.label = 1;
|
|
25721
25903
|
case 1:
|
|
25722
25904
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -25753,7 +25935,7 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
25753
25935
|
};
|
|
25754
25936
|
return IkasStateAPI;
|
|
25755
25937
|
}());
|
|
25756
|
-
var templateObject_1$
|
|
25938
|
+
var templateObject_1$i;
|
|
25757
25939
|
|
|
25758
25940
|
var IkasStorefrontDomain = /** @class */ (function () {
|
|
25759
25941
|
function IkasStorefrontDomain(data) {
|
|
@@ -25846,7 +26028,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
25846
26028
|
return __generator(this, function (_b) {
|
|
25847
26029
|
switch (_b.label) {
|
|
25848
26030
|
case 0:
|
|
25849
|
-
QUERY = src(templateObject_1$
|
|
26031
|
+
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
26032
|
_b.label = 1;
|
|
25851
26033
|
case 1:
|
|
25852
26034
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -25876,7 +26058,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
|
|
|
25876
26058
|
};
|
|
25877
26059
|
return IkasStorefrontAPI;
|
|
25878
26060
|
}());
|
|
25879
|
-
var templateObject_1$
|
|
26061
|
+
var templateObject_1$j;
|
|
25880
26062
|
|
|
25881
26063
|
var IkasThemeAPI = /** @class */ (function () {
|
|
25882
26064
|
function IkasThemeAPI() {
|
|
@@ -28771,6 +28953,7 @@ exports.AnalyticsBody = AnalyticsBody;
|
|
|
28771
28953
|
exports.AnalyticsHead = AnalyticsHead;
|
|
28772
28954
|
exports.CartPage = cart;
|
|
28773
28955
|
exports.CheckoutPage = _id_$1;
|
|
28956
|
+
exports.ContactForm = ContactForm;
|
|
28774
28957
|
exports.CustomPage = _slug_;
|
|
28775
28958
|
exports.EditorPage = editor$1;
|
|
28776
28959
|
exports.EmailRule = EmailRule;
|
|
@@ -28795,6 +28978,8 @@ exports.IkasCheckout = IkasCheckout;
|
|
|
28795
28978
|
exports.IkasCheckoutAPI = IkasCheckoutAPI;
|
|
28796
28979
|
exports.IkasCheckoutPage = IkasCheckoutPage;
|
|
28797
28980
|
exports.IkasCityAPI = IkasCityAPI;
|
|
28981
|
+
exports.IkasContactForm = IkasContactForm;
|
|
28982
|
+
exports.IkasContactFormAPI = IkasContactFormAPI;
|
|
28798
28983
|
exports.IkasCountryAPI = IkasCountryAPI;
|
|
28799
28984
|
exports.IkasCustomer = IkasCustomer;
|
|
28800
28985
|
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 {};
|