@ikas/storefront 0.0.85 → 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.
@@ -1,5 +1,6 @@
1
1
  import { IkasProductDetail, IkasOrderLineItem, IkasCheckout } from "../models/index";
2
2
  import { CheckoutStep } from "../components/checkout/model";
3
+ import { IkasCart } from "../models/data/cart/index";
3
4
  export declare class Analytics {
4
5
  constructor();
5
6
  static pageView(url: string): {
@@ -16,4 +17,6 @@ export declare class Analytics {
16
17
  static addToWishlist(id: string): void;
17
18
  static search(searchKeyword: string): void;
18
19
  static completeRegistration(): void;
20
+ static viewCart(cart: IkasCart | null | undefined): void;
21
+ static viewCategory(categoryPath: string): void;
19
22
  }
@@ -1,4 +1,5 @@
1
1
  import { IkasProductDetail, IkasOrderLineItem, IkasCheckout } from "../models/index";
2
+ import { IkasCart } from "../models/data/cart/index";
2
3
  export declare class FacebookPixel {
3
4
  constructor();
4
5
  static productView(productDetail: IkasProductDetail): void;
@@ -8,4 +9,6 @@ export declare class FacebookPixel {
8
9
  static addToWishlist(id: string): void;
9
10
  static search(searchKeyword: string): void;
10
11
  static completeRegistration(): void;
12
+ static viewCart(cart: IkasCart): void;
13
+ static viewCategory(categoryPath: string): void;
11
14
  }
@@ -0,0 +1,9 @@
1
+ export interface sendContactFormToMerchant {
2
+ sendContactFormToMerchant: boolean;
3
+ }
4
+ export interface sendContactFormToMerchantVariables {
5
+ email: string;
6
+ message: string;
7
+ firstName: string;
8
+ lastName: string;
9
+ }
@@ -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 {};
@@ -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 = {}; }
@@ -19807,6 +19818,32 @@ var FacebookPixel = /** @class */ (function () {
19807
19818
  window.fbq &&
19808
19819
  window.fbq("track", "CompleteRegistration", {
19809
19820
  status: true,
19821
+ value: 0,
19822
+ currency: "TRY",
19823
+ });
19824
+ return;
19825
+ }
19826
+ catch (err) {
19827
+ console.error(err);
19828
+ }
19829
+ };
19830
+ FacebookPixel.viewCart = function (cart) {
19831
+ try {
19832
+ !isServer &&
19833
+ window.fbq &&
19834
+ window.fbq("track", "ViewCart", viewCartFBPItem(cart));
19835
+ return;
19836
+ }
19837
+ catch (err) {
19838
+ console.error(err);
19839
+ }
19840
+ };
19841
+ FacebookPixel.viewCategory = function (categoryPath) {
19842
+ try {
19843
+ !isServer &&
19844
+ window.fbq &&
19845
+ window.fbq("track", "ViewCategory", {
19846
+ content_name: categoryPath,
19810
19847
  });
19811
19848
  return;
19812
19849
  }
@@ -19817,7 +19854,6 @@ var FacebookPixel = /** @class */ (function () {
19817
19854
  return FacebookPixel;
19818
19855
  }());
19819
19856
  function productToFBPItem(productDetail, quantity) {
19820
- if (quantity === void 0) { quantity = 1; }
19821
19857
  return {
19822
19858
  content_name: productDetail.product.name,
19823
19859
  content_category: productDetail.product.categories.length > 0
@@ -19831,7 +19867,6 @@ function productToFBPItem(productDetail, quantity) {
19831
19867
  currency: productDetail.selectedVariant.price.currency === ""
19832
19868
  ? "TRY"
19833
19869
  : productDetail.selectedVariant.price.currency,
19834
- num_items: quantity,
19835
19870
  };
19836
19871
  }
19837
19872
  function beginCheckoutFBPItem(checkout) {
@@ -19845,12 +19880,29 @@ function beginCheckoutFBPItem(checkout) {
19845
19880
  return {
19846
19881
  contents: contents,
19847
19882
  content_category: "",
19883
+ content_type: "product_group",
19848
19884
  content_ids: contentIds,
19849
19885
  currency: (_b = checkout.cart) === null || _b === void 0 ? void 0 : _b.items[0].currencyCode,
19850
19886
  value: (_c = checkout.cart) === null || _c === void 0 ? void 0 : _c.totalPrice,
19851
19887
  num_items: (_d = checkout.cart) === null || _d === void 0 ? void 0 : _d.items.length,
19852
19888
  };
19853
19889
  }
19890
+ function viewCartFBPItem(cart) {
19891
+ var contentIds = [];
19892
+ var contents = [];
19893
+ cart.items.map(function (item) {
19894
+ contentIds.push(item.id);
19895
+ contents.push({ id: item.id, quantity: item.quantity });
19896
+ });
19897
+ return {
19898
+ contents: contents,
19899
+ content_type: "product_group",
19900
+ content_ids: contentIds,
19901
+ currency: cart.items[0].currencyCode,
19902
+ value: cart.totalPrice,
19903
+ num_items: cart.items.length,
19904
+ };
19905
+ }
19854
19906
  function orderLineItemToFBPItem(orderLineItem, quantity) {
19855
19907
  return {
19856
19908
  content_name: orderLineItem.variant.name,
@@ -19923,6 +19975,14 @@ var IkasCustomerStore = /** @class */ (function () {
19923
19975
  }
19924
19976
  });
19925
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
+ }); };
19926
19986
  this.checkEmail = function (email) { return __awaiter(_this, void 0, void 0, function () {
19927
19987
  return __generator(this, function (_a) {
19928
19988
  switch (_a.label) {
@@ -21364,6 +21424,26 @@ var Analytics = /** @class */ (function () {
21364
21424
  console.error(err);
21365
21425
  }
21366
21426
  };
21427
+ Analytics.viewCart = function (cart) {
21428
+ try {
21429
+ if (cart) {
21430
+ FacebookPixel.viewCart(cart);
21431
+ }
21432
+ return;
21433
+ }
21434
+ catch (err) {
21435
+ console.error(err);
21436
+ }
21437
+ };
21438
+ Analytics.viewCategory = function (categoryPath) {
21439
+ try {
21440
+ FacebookPixel.viewCategory(categoryPath);
21441
+ return;
21442
+ }
21443
+ catch (err) {
21444
+ console.error(err);
21445
+ }
21446
+ };
21367
21447
  return Analytics;
21368
21448
  }());
21369
21449
 
@@ -23277,6 +23357,195 @@ var RegisterForm = /** @class */ (function () {
23277
23357
  return RegisterForm;
23278
23358
  }());
23279
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
+
23280
23549
  var ForgotPasswordForm = /** @class */ (function () {
23281
23550
  function ForgotPasswordForm(props) {
23282
23551
  var _this = this;
@@ -25666,6 +25935,49 @@ var IkasFavoriteProductAPI = /** @class */ (function () {
25666
25935
  }());
25667
25936
  var templateObject_1$g, templateObject_2$6, templateObject_3$2;
25668
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
+
25669
25981
  var IkasStateAPI = /** @class */ (function () {
25670
25982
  function IkasStateAPI() {
25671
25983
  }
@@ -25675,7 +25987,7 @@ var IkasStateAPI = /** @class */ (function () {
25675
25987
  return __generator(this, function (_b) {
25676
25988
  switch (_b.label) {
25677
25989
  case 0:
25678
- QUERY = src(templateObject_1$h || (templateObject_1$h = __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 "])));
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 "])));
25679
25991
  _b.label = 1;
25680
25992
  case 1:
25681
25993
  _b.trys.push([1, 3, , 4]);
@@ -25712,7 +26024,7 @@ var IkasStateAPI = /** @class */ (function () {
25712
26024
  };
25713
26025
  return IkasStateAPI;
25714
26026
  }());
25715
- var templateObject_1$h;
26027
+ var templateObject_1$i;
25716
26028
 
25717
26029
  var IkasStorefrontDomain = /** @class */ (function () {
25718
26030
  function IkasStorefrontDomain(data) {
@@ -25805,7 +26117,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
25805
26117
  return __generator(this, function (_b) {
25806
26118
  switch (_b.label) {
25807
26119
  case 0:
25808
- QUERY = src(templateObject_1$i || (templateObject_1$i = __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 "])));
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 "])));
25809
26121
  _b.label = 1;
25810
26122
  case 1:
25811
26123
  _b.trys.push([1, 3, , 4]);
@@ -25835,7 +26147,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
25835
26147
  };
25836
26148
  return IkasStorefrontAPI;
25837
26149
  }());
25838
- var templateObject_1$i;
26150
+ var templateObject_1$j;
25839
26151
 
25840
26152
  var IkasThemeAPI = /** @class */ (function () {
25841
26153
  function IkasThemeAPI() {
@@ -27447,6 +27759,10 @@ var IkasCheckoutPage = observer(function (_a) {
27447
27759
  var checkout = _a.checkout, queryParams = _a.queryParams;
27448
27760
  var router = useRouter();
27449
27761
  var vm = useState(function () { return new CheckoutViewModel(checkout, queryParams, router); })[0];
27762
+ useEffect(function () {
27763
+ Analytics.beginCheckout(vm.checkout);
27764
+ Analytics.checkoutStep(vm.checkout, vm.step);
27765
+ }, []);
27450
27766
  var _e = useState(""), policyModalTitle = _e[0], setPolicyModalTitle = _e[1];
27451
27767
  var _f = useState(""), policyModalText = _f[0], setPolicyModalText = _f[1];
27452
27768
  var step;
@@ -27540,8 +27856,6 @@ var IkasCheckoutPage = observer(function (_a) {
27540
27856
  };
27541
27857
  if (!vm.isCheckoutLoaded || !vm.customerStore.initialized)
27542
27858
  return null;
27543
- Analytics.beginCheckout(vm.checkout);
27544
- Analytics.checkoutStep(vm.checkout, vm.step);
27545
27859
  return (createElement(Fragment, null,
27546
27860
  createElement(IkasPageHead, { pageTitle: (((_b = vm.merchantSettings) === null || _b === void 0 ? void 0 : _b.merchantName) || "") + " - Güvenli Ödeme", description: "Güvenli ödeme" }),
27547
27861
  createElement("div", { id: "Checkout", className: styles$2.CheckoutPage },
@@ -28126,9 +28440,7 @@ var Page$1 = function (_a) {
28126
28440
  var _c = useState(initialPropValues), propValues = _c[0], setPropValues = _c[1];
28127
28441
  useEffect(function () {
28128
28442
  setIsBrowser(typeof window !== "undefined");
28129
- if (isBrowser) {
28130
- handleAnalytics(page, pageSpecificDataStr);
28131
- }
28443
+ handleAnalytics(page, pageSpecificDataStr);
28132
28444
  }, []);
28133
28445
  useEffect(function () {
28134
28446
  setPropValues(IkasPageDataProvider.initPropValues(propValuesStr, router, isBrowser));
@@ -28228,6 +28540,17 @@ function handleAnalytics(page, pageSpecificDataStr) {
28228
28540
  var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
28229
28541
  Analytics.productView(productDetail);
28230
28542
  }
28543
+ if (page.type === IkasThemePageType.CATEGORY) {
28544
+ var category = JSON.parse(pageSpecificDataStr);
28545
+ var categoryPath = category.path.map(function (cat) { return cat.name; }).join(" > ");
28546
+ if (category.path.length > 0) {
28547
+ categoryPath = categoryPath + " > " + category.name;
28548
+ }
28549
+ else {
28550
+ categoryPath = category.name;
28551
+ }
28552
+ Analytics.viewCategory(categoryPath);
28553
+ }
28231
28554
  }
28232
28555
  catch (err) {
28233
28556
  console.error(err);
@@ -28564,6 +28887,10 @@ var Page$b = function (_a) {
28564
28887
  var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
28565
28888
  var router = useRouter();
28566
28889
  var propValues = useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router); }, [propValuesStr]);
28890
+ var store = IkasStorefrontConfig.store;
28891
+ useEffect(function () {
28892
+ Analytics.viewCart(store.cartStore.cart);
28893
+ }, []);
28567
28894
  return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28568
28895
  };
28569
28896
  var getStaticProps$a = function (context) { return __awaiter(void 0, void 0, void 0, function () {
@@ -28706,4 +29033,4 @@ var IkasBaseStore = /** @class */ (function () {
28706
29033
  return IkasBaseStore;
28707
29034
  }());
28708
29035
 
28709
- 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 = {}; }
@@ -19790,6 +19801,32 @@ var FacebookPixel = /** @class */ (function () {
19790
19801
  window.fbq &&
19791
19802
  window.fbq("track", "CompleteRegistration", {
19792
19803
  status: true,
19804
+ value: 0,
19805
+ currency: "TRY",
19806
+ });
19807
+ return;
19808
+ }
19809
+ catch (err) {
19810
+ console.error(err);
19811
+ }
19812
+ };
19813
+ FacebookPixel.viewCart = function (cart) {
19814
+ try {
19815
+ !isServer &&
19816
+ window.fbq &&
19817
+ window.fbq("track", "ViewCart", viewCartFBPItem(cart));
19818
+ return;
19819
+ }
19820
+ catch (err) {
19821
+ console.error(err);
19822
+ }
19823
+ };
19824
+ FacebookPixel.viewCategory = function (categoryPath) {
19825
+ try {
19826
+ !isServer &&
19827
+ window.fbq &&
19828
+ window.fbq("track", "ViewCategory", {
19829
+ content_name: categoryPath,
19793
19830
  });
19794
19831
  return;
19795
19832
  }
@@ -19800,7 +19837,6 @@ var FacebookPixel = /** @class */ (function () {
19800
19837
  return FacebookPixel;
19801
19838
  }());
19802
19839
  function productToFBPItem(productDetail, quantity) {
19803
- if (quantity === void 0) { quantity = 1; }
19804
19840
  return {
19805
19841
  content_name: productDetail.product.name,
19806
19842
  content_category: productDetail.product.categories.length > 0
@@ -19814,7 +19850,6 @@ function productToFBPItem(productDetail, quantity) {
19814
19850
  currency: productDetail.selectedVariant.price.currency === ""
19815
19851
  ? "TRY"
19816
19852
  : productDetail.selectedVariant.price.currency,
19817
- num_items: quantity,
19818
19853
  };
19819
19854
  }
19820
19855
  function beginCheckoutFBPItem(checkout) {
@@ -19828,12 +19863,29 @@ function beginCheckoutFBPItem(checkout) {
19828
19863
  return {
19829
19864
  contents: contents,
19830
19865
  content_category: "",
19866
+ content_type: "product_group",
19831
19867
  content_ids: contentIds,
19832
19868
  currency: (_b = checkout.cart) === null || _b === void 0 ? void 0 : _b.items[0].currencyCode,
19833
19869
  value: (_c = checkout.cart) === null || _c === void 0 ? void 0 : _c.totalPrice,
19834
19870
  num_items: (_d = checkout.cart) === null || _d === void 0 ? void 0 : _d.items.length,
19835
19871
  };
19836
19872
  }
19873
+ function viewCartFBPItem(cart) {
19874
+ var contentIds = [];
19875
+ var contents = [];
19876
+ cart.items.map(function (item) {
19877
+ contentIds.push(item.id);
19878
+ contents.push({ id: item.id, quantity: item.quantity });
19879
+ });
19880
+ return {
19881
+ contents: contents,
19882
+ content_type: "product_group",
19883
+ content_ids: contentIds,
19884
+ currency: cart.items[0].currencyCode,
19885
+ value: cart.totalPrice,
19886
+ num_items: cart.items.length,
19887
+ };
19888
+ }
19837
19889
  function orderLineItemToFBPItem(orderLineItem, quantity) {
19838
19890
  return {
19839
19891
  content_name: orderLineItem.variant.name,
@@ -19906,6 +19958,14 @@ var IkasCustomerStore = /** @class */ (function () {
19906
19958
  }
19907
19959
  });
19908
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
+ }); };
19909
19969
  this.checkEmail = function (email) { return __awaiter(_this, void 0, void 0, function () {
19910
19970
  return __generator(this, function (_a) {
19911
19971
  switch (_a.label) {
@@ -21347,6 +21407,26 @@ var Analytics = /** @class */ (function () {
21347
21407
  console.error(err);
21348
21408
  }
21349
21409
  };
21410
+ Analytics.viewCart = function (cart) {
21411
+ try {
21412
+ if (cart) {
21413
+ FacebookPixel.viewCart(cart);
21414
+ }
21415
+ return;
21416
+ }
21417
+ catch (err) {
21418
+ console.error(err);
21419
+ }
21420
+ };
21421
+ Analytics.viewCategory = function (categoryPath) {
21422
+ try {
21423
+ FacebookPixel.viewCategory(categoryPath);
21424
+ return;
21425
+ }
21426
+ catch (err) {
21427
+ console.error(err);
21428
+ }
21429
+ };
21350
21430
  return Analytics;
21351
21431
  }());
21352
21432
 
@@ -23257,6 +23337,195 @@ var RegisterForm = /** @class */ (function () {
23257
23337
  return RegisterForm;
23258
23338
  }());
23259
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
+
23260
23529
  var ForgotPasswordForm = /** @class */ (function () {
23261
23530
  function ForgotPasswordForm(props) {
23262
23531
  var _this = this;
@@ -25646,6 +25915,49 @@ var IkasFavoriteProductAPI = /** @class */ (function () {
25646
25915
  }());
25647
25916
  var templateObject_1$g, templateObject_2$6, templateObject_3$2;
25648
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
+
25649
25961
  var IkasStateAPI = /** @class */ (function () {
25650
25962
  function IkasStateAPI() {
25651
25963
  }
@@ -25655,7 +25967,7 @@ var IkasStateAPI = /** @class */ (function () {
25655
25967
  return __generator(this, function (_b) {
25656
25968
  switch (_b.label) {
25657
25969
  case 0:
25658
- QUERY = src(templateObject_1$h || (templateObject_1$h = __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 "])));
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 "])));
25659
25971
  _b.label = 1;
25660
25972
  case 1:
25661
25973
  _b.trys.push([1, 3, , 4]);
@@ -25692,7 +26004,7 @@ var IkasStateAPI = /** @class */ (function () {
25692
26004
  };
25693
26005
  return IkasStateAPI;
25694
26006
  }());
25695
- var templateObject_1$h;
26007
+ var templateObject_1$i;
25696
26008
 
25697
26009
  var IkasStorefrontDomain = /** @class */ (function () {
25698
26010
  function IkasStorefrontDomain(data) {
@@ -25785,7 +26097,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
25785
26097
  return __generator(this, function (_b) {
25786
26098
  switch (_b.label) {
25787
26099
  case 0:
25788
- QUERY = src(templateObject_1$i || (templateObject_1$i = __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 "])));
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 "])));
25789
26101
  _b.label = 1;
25790
26102
  case 1:
25791
26103
  _b.trys.push([1, 3, , 4]);
@@ -25815,7 +26127,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
25815
26127
  };
25816
26128
  return IkasStorefrontAPI;
25817
26129
  }());
25818
- var templateObject_1$i;
26130
+ var templateObject_1$j;
25819
26131
 
25820
26132
  var IkasThemeAPI = /** @class */ (function () {
25821
26133
  function IkasThemeAPI() {
@@ -27427,6 +27739,10 @@ var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
27427
27739
  var checkout = _a.checkout, queryParams = _a.queryParams;
27428
27740
  var router$1 = router.useRouter();
27429
27741
  var vm = React.useState(function () { return new CheckoutViewModel(checkout, queryParams, router$1); })[0];
27742
+ React.useEffect(function () {
27743
+ Analytics.beginCheckout(vm.checkout);
27744
+ Analytics.checkoutStep(vm.checkout, vm.step);
27745
+ }, []);
27430
27746
  var _e = React.useState(""), policyModalTitle = _e[0], setPolicyModalTitle = _e[1];
27431
27747
  var _f = React.useState(""), policyModalText = _f[0], setPolicyModalText = _f[1];
27432
27748
  var step;
@@ -27520,8 +27836,6 @@ var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
27520
27836
  };
27521
27837
  if (!vm.isCheckoutLoaded || !vm.customerStore.initialized)
27522
27838
  return null;
27523
- Analytics.beginCheckout(vm.checkout);
27524
- Analytics.checkoutStep(vm.checkout, vm.step);
27525
27839
  return (React.createElement(React.Fragment, null,
27526
27840
  React.createElement(IkasPageHead, { pageTitle: (((_b = vm.merchantSettings) === null || _b === void 0 ? void 0 : _b.merchantName) || "") + " - Güvenli Ödeme", description: "Güvenli ödeme" }),
27527
27841
  React.createElement("div", { id: "Checkout", className: styles$2.CheckoutPage },
@@ -28106,9 +28420,7 @@ var Page$1 = function (_a) {
28106
28420
  var _c = React.useState(initialPropValues), propValues = _c[0], setPropValues = _c[1];
28107
28421
  React.useEffect(function () {
28108
28422
  setIsBrowser(typeof window !== "undefined");
28109
- if (isBrowser) {
28110
- handleAnalytics(page, pageSpecificDataStr);
28111
- }
28423
+ handleAnalytics(page, pageSpecificDataStr);
28112
28424
  }, []);
28113
28425
  React.useEffect(function () {
28114
28426
  setPropValues(IkasPageDataProvider.initPropValues(propValuesStr, router$1, isBrowser));
@@ -28208,6 +28520,17 @@ function handleAnalytics(page, pageSpecificDataStr) {
28208
28520
  var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
28209
28521
  Analytics.productView(productDetail);
28210
28522
  }
28523
+ if (page.type === exports.IkasThemePageType.CATEGORY) {
28524
+ var category = JSON.parse(pageSpecificDataStr);
28525
+ var categoryPath = category.path.map(function (cat) { return cat.name; }).join(" > ");
28526
+ if (category.path.length > 0) {
28527
+ categoryPath = categoryPath + " > " + category.name;
28528
+ }
28529
+ else {
28530
+ categoryPath = category.name;
28531
+ }
28532
+ Analytics.viewCategory(categoryPath);
28533
+ }
28211
28534
  }
28212
28535
  catch (err) {
28213
28536
  console.error(err);
@@ -28544,6 +28867,10 @@ var Page$b = function (_a) {
28544
28867
  var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
28545
28868
  var router$1 = router.useRouter();
28546
28869
  var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
28870
+ var store = IkasStorefrontConfig.store;
28871
+ React.useEffect(function () {
28872
+ Analytics.viewCart(store.cartStore.cart);
28873
+ }, []);
28547
28874
  return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28548
28875
  };
28549
28876
  var getStaticProps$a = function (context) { return __awaiter(void 0, void 0, void 0, function () {
@@ -28695,6 +29022,7 @@ exports.AnalyticsBody = AnalyticsBody;
28695
29022
  exports.AnalyticsHead = AnalyticsHead;
28696
29023
  exports.CartPage = cart;
28697
29024
  exports.CheckoutPage = _id_$1;
29025
+ exports.ContactForm = ContactForm;
28698
29026
  exports.CustomPage = _slug_;
28699
29027
  exports.EditorPage = editor$1;
28700
29028
  exports.EmailRule = EmailRule;
@@ -28719,6 +29047,8 @@ exports.IkasCheckout = IkasCheckout;
28719
29047
  exports.IkasCheckoutAPI = IkasCheckoutAPI;
28720
29048
  exports.IkasCheckoutPage = IkasCheckoutPage;
28721
29049
  exports.IkasCityAPI = IkasCityAPI;
29050
+ exports.IkasContactForm = IkasContactForm;
29051
+ exports.IkasContactFormAPI = IkasContactFormAPI;
28722
29052
  exports.IkasCountryAPI = IkasCountryAPI;
28723
29053
  exports.IkasCustomer = IkasCustomer;
28724
29054
  exports.IkasCustomerAPI = IkasCustomerAPI;
@@ -0,0 +1,7 @@
1
+ export declare class IkasContactForm {
2
+ email: string;
3
+ firstName: string;
4
+ lastName: string;
5
+ message: string;
6
+ constructor(data: Partial<IkasContactForm>);
7
+ }
@@ -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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.85",
3
+ "version": "0.0.87",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",