@ikas/storefront 0.0.168-alpha.21 → 0.0.168-alpha.22

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.
@@ -31,5 +31,6 @@ export declare class Analytics {
31
31
  static viewCart(cart: IkasCart | null | undefined): void;
32
32
  static viewCategory(categoryPath: string, category: IkasCategory): void;
33
33
  static viewSearchResults(searchKeyword: string, productDetails: IkasProductDetail[]): void;
34
+ static viewListing(productDetails: IkasProductDetail[]): void;
34
35
  static contactForm(form: IkasContactForm): void;
35
36
  }
@@ -22,6 +22,7 @@ export declare enum IkasEventType {
22
22
  VIEW_CART = "VIEW_CART",
23
23
  VIEW_CATEGORY = "VIEW_CATEGORY",
24
24
  VIEW_SEARCH_RESULTS = "VIEW_SEARCH_RESULTS",
25
+ VIEW_LISTING = "VIEW_LISTING",
25
26
  CONTACT_FORM = "CONTACT_FORM"
26
27
  }
27
28
  export declare type IkasEventSubscriber = {
package/build/index.es.js CHANGED
@@ -24822,6 +24822,7 @@ var IkasEventType;
24822
24822
  IkasEventType["VIEW_CART"] = "VIEW_CART";
24823
24823
  IkasEventType["VIEW_CATEGORY"] = "VIEW_CATEGORY";
24824
24824
  IkasEventType["VIEW_SEARCH_RESULTS"] = "VIEW_SEARCH_RESULTS";
24825
+ IkasEventType["VIEW_LISTING"] = "VIEW_LISTING";
24825
24826
  IkasEventType["CONTACT_FORM"] = "CONTACT_FORM";
24826
24827
  })(IkasEventType || (IkasEventType = {}));
24827
24828
 
@@ -25225,6 +25226,24 @@ var Analytics = /** @class */ (function () {
25225
25226
  console.error(err);
25226
25227
  }
25227
25228
  };
25229
+ Analytics.viewListing = function (productDetails) {
25230
+ try {
25231
+ if (Analytics.subscribers.length) {
25232
+ var cloneProductDetails_2 = cloneDeep_1(productDetails).map(function (p) { return new IkasProductDetail(p.product, p.selectedVariantValues); });
25233
+ tryForEach(Analytics.subscribers, function (s) {
25234
+ s.callback({
25235
+ type: IkasEventType.VIEW_LISTING,
25236
+ data: {
25237
+ productDetails: cloneProductDetails_2,
25238
+ },
25239
+ });
25240
+ });
25241
+ }
25242
+ }
25243
+ catch (err) {
25244
+ console.error(err);
25245
+ }
25246
+ };
25228
25247
  Analytics.contactForm = function (form) {
25229
25248
  try {
25230
25249
  FacebookPixel.contactForm();
@@ -38074,7 +38093,7 @@ var IkasProductList = /** @class */ (function () {
38074
38093
  this._minPage = this.page;
38075
38094
  if (!isInfiteScrollReturn)
38076
38095
  this._infiniteScrollPage = null;
38077
- this.handleViewSearchResults();
38096
+ this.handleListingEvent();
38078
38097
  return [2 /*return*/, true];
38079
38098
  case 12:
38080
38099
  err_1 = _a.sent();
@@ -38811,10 +38830,13 @@ var IkasProductList = /** @class */ (function () {
38811
38830
  }, 1000);
38812
38831
  });
38813
38832
  };
38814
- IkasProductList.prototype.handleViewSearchResults = function () {
38833
+ IkasProductList.prototype.handleListingEvent = function () {
38815
38834
  if (this.searchKeyword && this.data.length) {
38816
38835
  Analytics.viewSearchResults(this._searchKeyword, this.data);
38817
38836
  }
38837
+ else if (this.data.length && this._type === IkasProductListType.ALL) {
38838
+ Analytics.viewListing(this.data);
38839
+ }
38818
38840
  };
38819
38841
  return IkasProductList;
38820
38842
  }());
package/build/index.js CHANGED
@@ -24829,6 +24829,7 @@ var IkasEventType;
24829
24829
  IkasEventType["VIEW_CART"] = "VIEW_CART";
24830
24830
  IkasEventType["VIEW_CATEGORY"] = "VIEW_CATEGORY";
24831
24831
  IkasEventType["VIEW_SEARCH_RESULTS"] = "VIEW_SEARCH_RESULTS";
24832
+ IkasEventType["VIEW_LISTING"] = "VIEW_LISTING";
24832
24833
  IkasEventType["CONTACT_FORM"] = "CONTACT_FORM";
24833
24834
  })(IkasEventType || (IkasEventType = {}));
24834
24835
 
@@ -25232,6 +25233,24 @@ var Analytics = /** @class */ (function () {
25232
25233
  console.error(err);
25233
25234
  }
25234
25235
  };
25236
+ Analytics.viewListing = function (productDetails) {
25237
+ try {
25238
+ if (Analytics.subscribers.length) {
25239
+ var cloneProductDetails_2 = cloneDeep_1(productDetails).map(function (p) { return new IkasProductDetail(p.product, p.selectedVariantValues); });
25240
+ tryForEach(Analytics.subscribers, function (s) {
25241
+ s.callback({
25242
+ type: IkasEventType.VIEW_LISTING,
25243
+ data: {
25244
+ productDetails: cloneProductDetails_2,
25245
+ },
25246
+ });
25247
+ });
25248
+ }
25249
+ }
25250
+ catch (err) {
25251
+ console.error(err);
25252
+ }
25253
+ };
25235
25254
  Analytics.contactForm = function (form) {
25236
25255
  try {
25237
25256
  FacebookPixel.contactForm();
@@ -38056,7 +38075,7 @@ var IkasProductList = /** @class */ (function () {
38056
38075
  this._minPage = this.page;
38057
38076
  if (!isInfiteScrollReturn)
38058
38077
  this._infiniteScrollPage = null;
38059
- this.handleViewSearchResults();
38078
+ this.handleListingEvent();
38060
38079
  return [2 /*return*/, true];
38061
38080
  case 12:
38062
38081
  err_1 = _a.sent();
@@ -38793,10 +38812,13 @@ var IkasProductList = /** @class */ (function () {
38793
38812
  }, 1000);
38794
38813
  });
38795
38814
  };
38796
- IkasProductList.prototype.handleViewSearchResults = function () {
38815
+ IkasProductList.prototype.handleListingEvent = function () {
38797
38816
  if (this.searchKeyword && this.data.length) {
38798
38817
  Analytics.viewSearchResults(this._searchKeyword, this.data);
38799
38818
  }
38819
+ else if (this.data.length && this._type === exports.IkasProductListType.ALL) {
38820
+ Analytics.viewListing(this.data);
38821
+ }
38800
38822
  };
38801
38823
  return IkasProductList;
38802
38824
  }());
@@ -89,7 +89,7 @@ export declare class IkasProductList {
89
89
  private getQueryParams;
90
90
  private isBrowser;
91
91
  private waitForCustomerStoreInit;
92
- private handleViewSearchResults;
92
+ private handleListingEvent;
93
93
  private searchDebouncer;
94
94
  private searchAnalyticsDebouncer;
95
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.168-alpha.21",
3
+ "version": "0.0.168-alpha.22",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",