@ikas/storefront 0.0.146 → 0.0.148

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.
@@ -14,6 +14,8 @@ export declare class Analytics {
14
14
  static addToWishlist(id: string): void;
15
15
  static search(searchKeyword: string): void;
16
16
  static completeRegistration(): void;
17
+ static customerLogin(email: string): void;
18
+ static customerVisit(email: string): void;
17
19
  static viewCart(cart: IkasCart | null | undefined): void;
18
20
  static viewCategory(categoryPath: string, category: IkasCategory): void;
19
21
  static contactForm(): void;
@@ -24,6 +24,12 @@ export declare class GoogleTagManager {
24
24
  index: number;
25
25
  quantity: number;
26
26
  }[];
27
+ extraParams: {
28
+ parent_id: string;
29
+ currency: string;
30
+ url: string;
31
+ item_image: string;
32
+ };
27
33
  };
28
34
  } | undefined;
29
35
  static addToCart(item: IkasProductDetail | IkasOrderLineItem, quantity: number): {
@@ -184,4 +190,12 @@ export declare class GoogleTagManager {
184
190
  }[];
185
191
  };
186
192
  } | undefined;
193
+ static customerLogin(email: string): {
194
+ event: string;
195
+ email: string;
196
+ } | undefined;
197
+ static customerVisit(email: string): {
198
+ event: string;
199
+ email: string;
200
+ } | undefined;
187
201
  }
package/build/index.es.js CHANGED
@@ -16983,11 +16983,18 @@ var GoogleTagManager = /** @class */ (function () {
16983
16983
  }
16984
16984
  };
16985
16985
  GoogleTagManager.productView = function (productDetail) {
16986
+ var _a;
16986
16987
  try {
16987
16988
  var event_2 = {
16988
16989
  event: "view_item",
16989
16990
  ecommerce: {
16990
16991
  items: [productToGTMItem(productDetail)],
16992
+ extraParams: {
16993
+ parent_id: productDetail.product.id,
16994
+ currency: productDetail.selectedVariant.price.currency,
16995
+ url: "https://" + window.location.hostname + productDetail.href,
16996
+ item_image: ((_a = productDetail.selectedVariant.mainImage) === null || _a === void 0 ? void 0 : _a.src) || "",
16997
+ },
16991
16998
  },
16992
16999
  };
16993
17000
  //@ts-ignore
@@ -17182,6 +17189,34 @@ var GoogleTagManager = /** @class */ (function () {
17182
17189
  console.error(err);
17183
17190
  }
17184
17191
  };
17192
+ GoogleTagManager.customerLogin = function (email) {
17193
+ try {
17194
+ var event_11 = {
17195
+ event: "customer_login",
17196
+ email: email,
17197
+ };
17198
+ //@ts-ignore
17199
+ !isServer$2 && window.dataLayer && window.dataLayer.push(event_11);
17200
+ return event_11;
17201
+ }
17202
+ catch (err) {
17203
+ console.error(err);
17204
+ }
17205
+ };
17206
+ GoogleTagManager.customerVisit = function (email) {
17207
+ try {
17208
+ var event_12 = {
17209
+ event: "customer_visit",
17210
+ email: email,
17211
+ };
17212
+ //@ts-ignore
17213
+ !isServer$2 && window.dataLayer && window.dataLayer.push(event_12);
17214
+ return event_12;
17215
+ }
17216
+ catch (err) {
17217
+ console.error(err);
17218
+ }
17219
+ };
17185
17220
  return GoogleTagManager;
17186
17221
  }());
17187
17222
  function productToGTMItem(productDetail, quantity) {
@@ -17338,6 +17373,22 @@ var Analytics = /** @class */ (function () {
17338
17373
  console.error(err);
17339
17374
  }
17340
17375
  };
17376
+ Analytics.customerLogin = function (email) {
17377
+ try {
17378
+ GoogleTagManager.customerLogin(email);
17379
+ }
17380
+ catch (err) {
17381
+ console.error(err);
17382
+ }
17383
+ };
17384
+ Analytics.customerVisit = function (email) {
17385
+ try {
17386
+ GoogleTagManager.customerVisit(email);
17387
+ }
17388
+ catch (err) {
17389
+ console.error(err);
17390
+ }
17391
+ };
17341
17392
  Analytics.viewCart = function (cart) {
17342
17393
  try {
17343
17394
  if (cart) {
@@ -17418,6 +17469,8 @@ var IkasCustomerStore = /** @class */ (function () {
17418
17469
  if (!response) return [3 /*break*/, 4];
17419
17470
  this.setToken(response.token, response.tokenExpiry);
17420
17471
  this.setCustomer(response.customer);
17472
+ if (this.customer)
17473
+ Analytics.customerLogin(this.customer.email);
17421
17474
  cart = (_a = this.baseStore) === null || _a === void 0 ? void 0 : _a.cartStore.cart;
17422
17475
  if (!cart) return [3 /*break*/, 3];
17423
17476
  return [4 /*yield*/, this.baseStore.cartStore.changeItemQuantity(cart.items[0], cart.items[0].quantity)];
@@ -17660,6 +17713,8 @@ var IkasCustomerStore = /** @class */ (function () {
17660
17713
  case 2:
17661
17714
  _a.sent();
17662
17715
  this._initialized = true;
17716
+ if (this.customer)
17717
+ Analytics.customerVisit(this.customer.email);
17663
17718
  return [2 /*return*/];
17664
17719
  }
17665
17720
  });
package/build/index.js CHANGED
@@ -16989,11 +16989,18 @@ var GoogleTagManager = /** @class */ (function () {
16989
16989
  }
16990
16990
  };
16991
16991
  GoogleTagManager.productView = function (productDetail) {
16992
+ var _a;
16992
16993
  try {
16993
16994
  var event_2 = {
16994
16995
  event: "view_item",
16995
16996
  ecommerce: {
16996
16997
  items: [productToGTMItem(productDetail)],
16998
+ extraParams: {
16999
+ parent_id: productDetail.product.id,
17000
+ currency: productDetail.selectedVariant.price.currency,
17001
+ url: "https://" + window.location.hostname + productDetail.href,
17002
+ item_image: ((_a = productDetail.selectedVariant.mainImage) === null || _a === void 0 ? void 0 : _a.src) || "",
17003
+ },
16997
17004
  },
16998
17005
  };
16999
17006
  //@ts-ignore
@@ -17188,6 +17195,34 @@ var GoogleTagManager = /** @class */ (function () {
17188
17195
  console.error(err);
17189
17196
  }
17190
17197
  };
17198
+ GoogleTagManager.customerLogin = function (email) {
17199
+ try {
17200
+ var event_11 = {
17201
+ event: "customer_login",
17202
+ email: email,
17203
+ };
17204
+ //@ts-ignore
17205
+ !isServer$2 && window.dataLayer && window.dataLayer.push(event_11);
17206
+ return event_11;
17207
+ }
17208
+ catch (err) {
17209
+ console.error(err);
17210
+ }
17211
+ };
17212
+ GoogleTagManager.customerVisit = function (email) {
17213
+ try {
17214
+ var event_12 = {
17215
+ event: "customer_visit",
17216
+ email: email,
17217
+ };
17218
+ //@ts-ignore
17219
+ !isServer$2 && window.dataLayer && window.dataLayer.push(event_12);
17220
+ return event_12;
17221
+ }
17222
+ catch (err) {
17223
+ console.error(err);
17224
+ }
17225
+ };
17191
17226
  return GoogleTagManager;
17192
17227
  }());
17193
17228
  function productToGTMItem(productDetail, quantity) {
@@ -17344,6 +17379,22 @@ var Analytics = /** @class */ (function () {
17344
17379
  console.error(err);
17345
17380
  }
17346
17381
  };
17382
+ Analytics.customerLogin = function (email) {
17383
+ try {
17384
+ GoogleTagManager.customerLogin(email);
17385
+ }
17386
+ catch (err) {
17387
+ console.error(err);
17388
+ }
17389
+ };
17390
+ Analytics.customerVisit = function (email) {
17391
+ try {
17392
+ GoogleTagManager.customerVisit(email);
17393
+ }
17394
+ catch (err) {
17395
+ console.error(err);
17396
+ }
17397
+ };
17347
17398
  Analytics.viewCart = function (cart) {
17348
17399
  try {
17349
17400
  if (cart) {
@@ -17424,6 +17475,8 @@ var IkasCustomerStore = /** @class */ (function () {
17424
17475
  if (!response) return [3 /*break*/, 4];
17425
17476
  this.setToken(response.token, response.tokenExpiry);
17426
17477
  this.setCustomer(response.customer);
17478
+ if (this.customer)
17479
+ Analytics.customerLogin(this.customer.email);
17427
17480
  cart = (_a = this.baseStore) === null || _a === void 0 ? void 0 : _a.cartStore.cart;
17428
17481
  if (!cart) return [3 /*break*/, 3];
17429
17482
  return [4 /*yield*/, this.baseStore.cartStore.changeItemQuantity(cart.items[0], cart.items[0].quantity)];
@@ -17666,6 +17719,8 @@ var IkasCustomerStore = /** @class */ (function () {
17666
17719
  case 2:
17667
17720
  _a.sent();
17668
17721
  this._initialized = true;
17722
+ if (this.customer)
17723
+ Analytics.customerVisit(this.customer.email);
17669
17724
  return [2 /*return*/];
17670
17725
  }
17671
17726
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.146",
3
+ "version": "0.0.148",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",