@sentecacommerce-theme/lib 0.12.87 → 0.12.91

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.
Files changed (42) hide show
  1. package/dist/cjs/analytics/Pixel/hooks/index.js +36 -0
  2. package/dist/cjs/analytics/Pixel/hooks/usePixelFinishOrder.js +27 -0
  3. package/dist/cjs/analytics/Pixel/hooks/usePixelViewBasket.js +24 -0
  4. package/dist/cjs/analytics/Pixel/hooks/usePixelViewCategory.js +22 -0
  5. package/dist/cjs/analytics/Pixel/mainScript.js +197 -14
  6. package/dist/cjs/analytics/Pixel/minifiedPixel.js +1 -1
  7. package/dist/cjs/analytics/Pixel/usePixel.js +3 -0
  8. package/dist/cjs/analytics/Pixel/utils.js +17 -0
  9. package/dist/cjs/hooks/ui-hooks/useAccordion/index.js +0 -1
  10. package/dist/cjs/listing/api/queries/useListingQuery.js +4 -2
  11. package/dist/cjs/listing/components/BasicListingSEO.js +19 -5
  12. package/dist/cjs/listing/ssr/prefetchListing.js +2 -1
  13. package/dist/cjs/seo/components/BasicSEO/index.js +2 -17
  14. package/dist/cjs/ui/components/GridStyles.js +36 -0
  15. package/dist/cjs/ui/components/index.js +12 -0
  16. package/dist/esm/analytics/Pixel/hooks/index.js +3 -0
  17. package/dist/esm/analytics/Pixel/hooks/usePixelFinishOrder.js +22 -0
  18. package/dist/esm/analytics/Pixel/hooks/usePixelViewBasket.js +19 -0
  19. package/dist/esm/analytics/Pixel/hooks/usePixelViewCategory.js +17 -0
  20. package/dist/esm/analytics/Pixel/mainScript.js +199 -14
  21. package/dist/esm/analytics/Pixel/minifiedPixel.js +1 -1
  22. package/dist/esm/analytics/Pixel/usePixel.js +3 -0
  23. package/dist/esm/analytics/Pixel/utils.js +12 -0
  24. package/dist/esm/hooks/ui-hooks/useAccordion/index.js +0 -1
  25. package/dist/esm/listing/api/queries/useListingQuery.js +4 -2
  26. package/dist/esm/listing/components/BasicListingSEO.js +19 -5
  27. package/dist/esm/listing/ssr/prefetchListing.js +2 -1
  28. package/dist/esm/seo/components/BasicSEO/index.js +2 -17
  29. package/dist/esm/ui/components/GridStyles.js +26 -0
  30. package/dist/esm/ui/components/index.js +1 -0
  31. package/dist/types/analytics/Pixel/hooks/index.d.ts +3 -0
  32. package/dist/types/analytics/Pixel/hooks/usePixelFinishOrder.d.ts +4 -0
  33. package/dist/types/analytics/Pixel/hooks/usePixelViewBasket.d.ts +4 -0
  34. package/dist/types/analytics/Pixel/hooks/usePixelViewCategory.d.ts +3 -0
  35. package/dist/types/analytics/Pixel/types.d.ts +9 -0
  36. package/dist/types/analytics/Pixel/utils.d.ts +3 -0
  37. package/dist/types/listing/api/queries/useListingQuery.d.ts +2 -1
  38. package/dist/types/listing/components/BasicListingSEO.d.ts +1 -0
  39. package/dist/types/listing/types.d.ts +3 -2
  40. package/dist/types/ui/components/GridStyles.d.ts +10 -0
  41. package/dist/types/ui/components/index.d.ts +1 -0
  42. package/package.json +4 -4
@@ -26,6 +26,18 @@ Object.keys(_lazyImage).forEach(function(key) {
26
26
  }
27
27
  });
28
28
  });
29
+ var _gridStyles = _interopRequireWildcard(require("./GridStyles"));
30
+ Object.keys(_gridStyles).forEach(function(key) {
31
+ if (key === "default" || key === "__esModule") return;
32
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
33
+ if (key in exports && exports[key] === _gridStyles[key]) return;
34
+ Object.defineProperty(exports, key, {
35
+ enumerable: true,
36
+ get: function() {
37
+ return _gridStyles[key];
38
+ }
39
+ });
40
+ });
29
41
  function _interopRequireWildcard(obj) {
30
42
  if (obj && obj.__esModule) {
31
43
  return obj;
@@ -1,4 +1,7 @@
1
1
  export * from './usePixelProductDetails';
2
2
  export * from './usePixelProductsImpression';
3
3
  export * from './usePixelProductClick';
4
+ export * from './usePixelViewBasket';
5
+ export * from './usePixelViewCategory';
6
+ export * from './usePixelFinishOrder';
4
7
  export * from './useDistrictMeta';
@@ -0,0 +1,22 @@
1
+ import { mapProducts } from '../utils';
2
+ var _typeof = function(obj) {
3
+ "@swc/helpers - typeof";
4
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
5
+ };
6
+ export var usePixelFinishOrder = function() {
7
+ var sendFinishOrderEvent = function(order) {
8
+ var payload = {
9
+ orderId: order.orderRefNumber,
10
+ productsData: mapProducts(order.lineItems)
11
+ };
12
+ if ((typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined) {
13
+ var pixel = window.pixel;
14
+ if (payload) {
15
+ pixel.finishOrder(payload);
16
+ }
17
+ }
18
+ };
19
+ return {
20
+ sendFinishOrderEvent: sendFinishOrderEvent
21
+ };
22
+ };
@@ -0,0 +1,19 @@
1
+ import { mapProducts } from '../utils';
2
+ var _typeof = function(obj) {
3
+ "@swc/helpers - typeof";
4
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
5
+ };
6
+ export var usePixelViewBasket = function() {
7
+ var sendViewBasketEvent = function(data) {
8
+ var payload = mapProducts(data);
9
+ if ((typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined) {
10
+ var pixel = window.pixel;
11
+ if (payload) {
12
+ pixel.viewBasket(payload);
13
+ }
14
+ }
15
+ };
16
+ return {
17
+ sendViewBasketEvent: sendViewBasketEvent
18
+ };
19
+ };
@@ -0,0 +1,17 @@
1
+ var _typeof = function(obj) {
2
+ "@swc/helpers - typeof";
3
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
4
+ };
5
+ export var usePixelViewCategory = function() {
6
+ var sendViewCategoryEvent = function(categoryBreadcrumb) {
7
+ if ((typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined) {
8
+ var pixel = window.pixel;
9
+ if (categoryBreadcrumb) {
10
+ pixel.viewCategory(categoryBreadcrumb);
11
+ }
12
+ }
13
+ };
14
+ return {
15
+ sendViewCategoryEvent: sendViewCategoryEvent
16
+ };
17
+ };
@@ -56,6 +56,8 @@ function _objectSpread(target) {
56
56
  }
57
57
  return target;
58
58
  }
59
+ // eslint-disable-next-line @typescript-eslint/no-extra-semi
60
+ ;
59
61
  (function(global) {
60
62
  var log = function log(message) {
61
63
  if (debug) {
@@ -83,16 +85,6 @@ function _objectSpread(target) {
83
85
  }
84
86
  });
85
87
  };
86
- var ensureStringValuesMayExist = function ensureStringValuesMayExist() {
87
- var params = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, keys = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
88
- keys.forEach(function(k) {
89
- if (params[k]) {
90
- if (typeof params[k] !== 'string') {
91
- err("".concat(k, " is empty or contains invalid string value"));
92
- }
93
- }
94
- });
95
- };
96
88
  var ensureStringValuesExist = function ensureStringValuesExist() {
97
89
  var params = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, keys = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
98
90
  keys.forEach(function(k) {
@@ -137,6 +129,54 @@ function _objectSpread(target) {
137
129
  log("adding new event to queue ".concat(JSON.stringify(enrichedPayload)));
138
130
  Q.push(enrichedPayload);
139
131
  };
132
+ var dispatchCriteoEvents = function dispatchCriteoEvents(events) {
133
+ if (criteoPartnerId) {
134
+ window.criteo_q = window.criteo_q || [];
135
+ window.criteo_q.push(events);
136
+ }
137
+ };
138
+ var sendRtbRequest = function sendRtbRequest(tag) {
139
+ if (rtbHouseHash) {
140
+ try {
141
+ var rtbTags = [
142
+ "pr_".concat(rtbHouseHash, "_").concat(tag)
143
+ ];
144
+ rtbTags.push("pr_".concat(rtbHouseHash, "_lid_").concat(getLid()));
145
+ var ifr = document.createElement('iframe'), sr = encodeURIComponent(document.referrer ? document.referrer : ''), su = encodeURIComponent(document.location.href ? document.location.href : ''), tmstmp = encodeURIComponent('' + Date.now());
146
+ var ifrSrc = 'https://creativecdn.com/tags?type=iframe';
147
+ for(var i = 0; i < rtbTags.length; i++){
148
+ ifrSrc += '&id=' + encodeURIComponent(rtbTags[i]);
149
+ }
150
+ ifrSrc += "&su=".concat(su, "&sr=").concat(sr, "&ts=").concat(tmstmp);
151
+ ifr.setAttribute('src', ifrSrc);
152
+ ifr.setAttribute('width', '1');
153
+ ifr.setAttribute('height', '1');
154
+ ifr.setAttribute('scrolling', 'no');
155
+ ifr.setAttribute('frameBorder', '0');
156
+ ifr.setAttribute('style', 'display:none');
157
+ ifr.setAttribute('referrerpolicy', 'no-referrer-when-downgrade');
158
+ if (document.body) {
159
+ document.body.appendChild(ifr);
160
+ } else {
161
+ window.addEventListener('DOMContentLoaded', function() {
162
+ document.body.appendChild(ifr);
163
+ });
164
+ }
165
+ } catch (e) {
166
+ log(e);
167
+ }
168
+ }
169
+ };
170
+ var getLid = function getLid() {
171
+ var key = '__rtbhouse.lid', lid = window.localStorage.getItem(key);
172
+ if (!lid) {
173
+ lid = '';
174
+ var pool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
175
+ for(var i = 0; i < 20; i++)lid += pool.charAt(Math.floor(Math.random() * pool.length));
176
+ window.localStorage.setItem(key, lid);
177
+ }
178
+ return lid;
179
+ };
140
180
  var buildProductPayload = function buildProductPayload(productData) {
141
181
  var payload = {};
142
182
  ensureStringValuesExist(productData, [
@@ -167,21 +207,26 @@ function _objectSpread(target) {
167
207
  payload.merchantKey = clickData.merchantKey;
168
208
  return payload;
169
209
  };
210
+ var isTouchDevice = function isTouchDevice() {
211
+ return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
212
+ };
170
213
  //check the config
171
214
  if (typeof global.pixel_cfg !== 'object') {
172
215
  err('Pixel is missing config');
173
- } else if (!global.pixel_cfg.initialUserId || !global.pixel_cfg.appName) {
174
- err('Missing required pixel config fields. Please check if appName and initialUserId are present.');
216
+ } else if (!global.pixel_cfg.hubUrl || !global.pixel_cfg.initialUserId || !global.pixel_cfg.appName) {
217
+ err('Missing required pixel config fields. Please check if appName, hubUrl and initialUserId are present.');
175
218
  }
176
219
  /**
220
+ * hubUrl = the url of the integration hub
177
221
  * source = name of the client interface eg: app, website
178
222
  * debug = either or not to print logs
179
223
  * initialUserId = the initial id of the user/visitor
180
- */ var _pixel_cfg = global.pixel_cfg, appName = _pixel_cfg.appName, _source = _pixel_cfg.source, source = _source === void 0 ? 'web-client' : _source, _debug = _pixel_cfg.debug, debug = _debug === void 0 ? false : _debug, initialUserId = _pixel_cfg.initialUserId;
224
+ */ var _pixel_cfg = global.pixel_cfg, hubUrl = _pixel_cfg.hubUrl, appName = _pixel_cfg.appName, _source = _pixel_cfg.source, source = _source === void 0 ? 'web-client' : _source, _debug = _pixel_cfg.debug, debug = _debug === void 0 ? false : _debug, _criteoPartnerId = _pixel_cfg.criteoPartnerId, criteoPartnerId = _criteoPartnerId === void 0 ? false : _criteoPartnerId, _rtbHouseHash = _pixel_cfg.rtbHouseHash, rtbHouseHash = _rtbHouseHash === void 0 ? false : _rtbHouseHash, initialUserId = _pixel_cfg.initialUserId;
181
225
  var Q = [] //events queue
182
226
  ;
183
227
  var userId = initialUserId //is modified upon setUserId
184
228
  ;
229
+ var userEmail = '';
185
230
  var title = undefined;
186
231
  var allowTracking = false //should explicity state positive intention
187
232
  ;
@@ -196,8 +241,9 @@ function _objectSpread(target) {
196
241
  log("sending.. payload=".concat(JSON.stringify(payload)));
197
242
  _ctx.prev = 1;
198
243
  _ctx.next = 4;
199
- return fetch("/hub/analytics/collect", {
244
+ return fetch("".concat(hubUrl, "/analytics/collect"), {
200
245
  method: 'POST',
246
+ mode: 'cors',
201
247
  cache: 'no-cache',
202
248
  headers: {
203
249
  'Content-Type': 'application/json'
@@ -261,6 +307,113 @@ function _objectSpread(target) {
261
307
  ]);
262
308
  })), 500);
263
309
  }
310
+ var criteoAPI = {
311
+ loadCriteo: function loadCriteo() {
312
+ if (criteoPartnerId) {
313
+ log('Loading criteo');
314
+ var criteo = document.createElement('script');
315
+ criteo.setAttribute('src', "//dynamic.criteo.com/js/ld/ld.js?a=".concat(criteoPartnerId));
316
+ document.head.appendChild(criteo);
317
+ dispatchCriteoEvents([
318
+ {
319
+ event: 'setAccount',
320
+ account: criteoPartnerId
321
+ },
322
+ {
323
+ event: 'setEmail',
324
+ email: userEmail
325
+ },
326
+ {
327
+ event: 'setSiteType',
328
+ type: isTouchDevice() ? 'm' : 'd'
329
+ },
330
+ ]);
331
+ }
332
+ log('criteo partner id not set');
333
+ },
334
+ criteoViewHome: function criteoViewHome() {
335
+ console.log('criteoViewHome');
336
+ dispatchCriteoEvents({
337
+ event: 'viewHome'
338
+ });
339
+ },
340
+ //productData: [{ id: sku, price, quantity}]
341
+ criteoViewBasket: function criteoViewBasket(productsData) {
342
+ dispatchCriteoEvents({
343
+ event: 'viewBasket',
344
+ item: productsData
345
+ });
346
+ },
347
+ //productData: { sku }
348
+ criteoViewItem: function criteoViewItem(productData) {
349
+ dispatchCriteoEvents({
350
+ event: 'viewItem',
351
+ item: productData.sku
352
+ });
353
+ },
354
+ //products: [{ sku }]
355
+ criteoViewList: function criteoViewList(products) {
356
+ var items = products.map(function(product) {
357
+ return product.sku;
358
+ });
359
+ dispatchCriteoEvents({
360
+ event: 'viewList',
361
+ item: items
362
+ });
363
+ },
364
+ //orderId: Order ref number
365
+ //productData: [{ id: sku, price, quantity}]
366
+ criteoFinishOrder: function criteoFinishOrder(orderId, productsData) {
367
+ dispatchCriteoEvents({
368
+ event: 'trackTransaction',
369
+ id: orderId,
370
+ item: productsData
371
+ });
372
+ },
373
+ criteoChangeEmail: function criteoChangeEmail(email) {
374
+ dispatchCriteoEvents({
375
+ event: 'setEmail',
376
+ email: email
377
+ });
378
+ }
379
+ };
380
+ var rtbAPI = {
381
+ rtbViewHome: function rtbViewHome() {
382
+ sendRtbRequest("home");
383
+ },
384
+ //productData: [{ id: sku}]
385
+ rtbViewBasket: function rtbViewBasket(productsData) {
386
+ sendRtbRequest("basketstatus_".concat(productsData.map(function(product) {
387
+ return product.sku;
388
+ }).join(',')));
389
+ },
390
+ //productData: { sku }
391
+ rtbViewItem: function rtbViewItem(productData) {
392
+ sendRtbRequest("offer_".concat(productData.sku));
393
+ },
394
+ //products: [{ sku }]
395
+ rtbViewList: function rtbViewList(products) {
396
+ var items = products.map(function(product) {
397
+ return product.sku;
398
+ });
399
+ sendRtbRequest("listing_".concat(items[0], ",").concat(items[1], ",").concat(items[2], ",").concat(items[3], ",").concat(items[4]));
400
+ },
401
+ //categoryBreadcrumb: string
402
+ rtbViewCategory: function rtbViewCategory(categoryBreadcrumb) {
403
+ sendRtbRequest("category2_".concat(categoryBreadcrumb));
404
+ },
405
+ rtbStartOrder: function rtbStartOrder() {
406
+ sendRtbRequest("startorder");
407
+ },
408
+ //orderId: Order ref number
409
+ //productData: [{ id: sku, price, quantity}]
410
+ rtbFinishOrder: function rtbFinishOrder(orderId, productsData, orderPrice) {
411
+ var productIds = productsData.map(function(product) {
412
+ return product.sku;
413
+ }).join(',');
414
+ sendRtbRequest("orderstatus2_".concat(orderPrice, "_").concat(orderId, "_").concat(productIds));
415
+ }
416
+ };
264
417
  var API = {
265
418
  //internal only
266
419
  __system__: {
@@ -274,9 +427,33 @@ function _objectSpread(target) {
274
427
  addEventToQueue('land', eventPayload);
275
428
  }
276
429
  },
430
+ viewHome: function viewHome() {
431
+ console.log('viewHome');
432
+ criteoAPI.criteoViewHome();
433
+ rtbAPI.rtbViewHome();
434
+ },
435
+ //productsData: [{ id: sku, price, quantity}]
436
+ viewBasket: function viewBasket(productDetails) {
437
+ criteoAPI.criteoViewBasket(productDetails);
438
+ rtbAPI.rtbViewBasket(productDetails);
439
+ },
440
+ //categoryBreadcrumb
441
+ viewCategory: function viewCategory(categoryBreadcrumb) {
442
+ rtbAPI.rtbViewCategory(categoryBreadcrumb);
443
+ },
444
+ //orderId: Order ref number
445
+ //productsData: [{ id: sku, price, quantity}]
446
+ //orderPrice: total price of order
447
+ finishOrder: function finishOrder(orderId, productsData, orderPrice) {
448
+ criteoAPI.criteoFinishOrder(orderId, productsData);
449
+ rtbAPI.rtbFinishOrder(orderId, productsData, orderPrice);
450
+ },
277
451
  //used when user logs in or other occasion on which the id in cookie changes
278
452
  changeUser: function changeUser(newUserId) {
453
+ var newUserEmail = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
279
454
  userId = newUserId;
455
+ userEmail = newUserEmail;
456
+ criteoAPI.criteoChangeEmail(userEmail);
280
457
  },
281
458
  //Should be set on each app start/refresh. Marks if IP & other user data can be tracked
282
459
  agreeTracking: function agreeTracking() {
@@ -313,6 +490,8 @@ function _objectSpread(target) {
313
490
  var eventPayload = productLists.map(function(list) {
314
491
  var name = list.listName;
315
492
  var merchantKey = priceData.merchantKey;
493
+ criteoAPI.criteoViewList(list.products);
494
+ rtbAPI.rtbViewList(list.products);
316
495
  var products = list.products.map(function(product) {
317
496
  return buildProductPayload(product);
318
497
  });
@@ -329,6 +508,8 @@ function _objectSpread(target) {
329
508
  ensureStringValuesExist(priceData, [
330
509
  'merchantKey'
331
510
  ]);
511
+ criteoAPI.criteoViewItem(productData);
512
+ rtbAPI.rtbViewItem(productData);
332
513
  var product = buildProductPayload(productData);
333
514
  addEventToQueue('productDetails', _objectSpread({
334
515
  product: product
@@ -357,6 +538,9 @@ function _objectSpread(target) {
357
538
  }, priceData));
358
539
  },
359
540
  checkoutStep: function checkoutStep(orderId, stepNumber) {
541
+ if (stepNumber === 1) {
542
+ rtbAPI.rtbStartOrder(orderId);
543
+ }
360
544
  ensureIsStringValue('orderId', orderId);
361
545
  addEventToQueue('checkoutStep', {
362
546
  orderId: orderId,
@@ -372,6 +556,7 @@ function _objectSpread(target) {
372
556
  });
373
557
  }
374
558
  };
559
+ criteoAPI.loadCriteo();
375
560
  API.__system__.land();
376
561
  global.pixel = API;
377
562
  loop();
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable no-template-curly-in-string */ export var PixelScript = function() {
2
- return '!function(i){function o(e){t&&console.info(e)}function c(e){throw new Error(e)}function a(t={},e=[]){e.forEach(e=>{"string"!=typeof t[e]&&c(`${e} is empty or contains invalid string value`)})}function r(e="",t={}){"string"!=typeof t&&c(`${e} is empty or contains invalid string value`)}"object"!=typeof i.pixel_cfg?c("Pixel is missing config"):i.pixel_cfg.initialUserId&&i.pixel_cfg.appName||c("Missing required pixel config fields. Please check if appName and initialUserId are present.");const{appName:n,source:s="web-client",debug:t=!1,initialUserId:u}=i.pixel_cfg,l=[];let d=u,p=void 0,m=!1;function f(e,t={}){(t={name:e,data:t}).meta={userId:d,appName:n,allowTracking:m,source:s,userAgent:i.navigator.userAgent,location:i.location.href,language:i.navigator.language,charset:i.document.characterSet,title:p=p??i.document.title,referrer:i.document.referrer,screenResolution:`${i.screen.width}x${i.screen.height}`,viewportSize:`${i.innerWidth}x${i.innerHeight}`};o(`adding new event to queue ${JSON.stringify(t)}`),l.push(t)}function h(e){let t={};var n,i;return a(e,["id","sku"]),[n={},i]=[e,["quantity"]],i.forEach(e=>{n[e]&&Number.isNaN(Number(n[e]))&&c(`${e} is empty or contains invalid numeric value`)}),t.id=e.id,t.sku=e.sku,t.quantity&&(t.quantity=e.quantity),t}function g(e){let t={};var n,i;return a(e,["listName","merchantKey"]),[n={},i]=[e,["position"]],i.forEach(e=>{Number.isNaN(Number(n[e]))&&c(`${e} is empty or contains invalid numeric value`)}),t.listName=e.listName,t.position=e.position,t.merchantKey=e.merchantKey,t}var e={__system__:{land:function(){f("land",{originalQuery:i.location.search})}},changeUser:function(e){d=e},agreeTracking:function(){m=!0},changeRoute:function(e={}){let t={};a(e,["path","title","location"]),p=e.title,t.path=e.path,t.title=e.title,t.location=e.location,f("changeRoute",t)},productClick:function(e={},t={}){f("productClick",{product:h(e),click:g(t)})},productsImpression:function(e=[],t={}){a(t,["merchantKey"]),f("productsImpression",e.map(function(e){return{name:e.listName,merchantKey:t.merchantKey,products:e.products.map(h)}}))},productDetails:function(e={},t={}){a(t,["merchantKey"]),f("productDetails",{product:h(e),...t})},addLineItem:function(e={},t={}){a(t,["currencyCode","merchantKey"]),f("addLineItem",{product:h(e),...t})},removeLineItem:function(e={},t={}){a(t,["currencyCode","merchantKey"]),f("removeLineItem",{product:h(e),...t})},checkoutStep:function(e,t){r("orderId",e),f("checkoutStep",{orderId:e,stepNumber:t})},checkoutStepOption:function(e,t,n){r("orderId",e),f("checkoutStepOption",{orderId:e,stepNumber:t,optionName:n})}};e.__system__.land(),i.pixel=e,function t(){let n=i.setTimeout(async function(){if(o("loop"),u&&l.length){var e=l.shift();try{await async function(e){o(`sending.. payload=${JSON.stringify(e)}`);try{await fetch("/hub/analytics/collect",{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(e){console.error(`Failed to send event.. ${e.message}`)}}(e)}catch(e){o(`Failed to send event.. ${e.message}`)}}i.clearInterval(n),t()},500)}()}(window);';
2
+ return '!function(n){function a(e){t&&console.info(e)}function o(e){throw new Error(e)}function r(t={},e=[]){e.forEach(e=>{"string"!=typeof t[e]&&o(`${e} is empty or contains invalid string value`)})}function c(e="",t={}){"string"!=typeof t&&o(`${e} is empty or contains invalid string value`)}"object"!=typeof n.pixel_cfg?o("Pixel is missing config"):n.pixel_cfg.hubUrl&&n.pixel_cfg.initialUserId&&n.pixel_cfg.appName||o("Missing required pixel config fields. Please check if appName, hubUrl and initialUserId are present.");const{hubUrl:s,appName:i,source:u="web-client",debug:t=!1,criteoPartnerId:d=!1,rtbHouseHash:l=!1,initialUserId:m}=n.pixel_cfg,p=[];let f=m,h="",g=void 0,w=!1;function y(e,t={}){(t={name:e,data:t}).meta={userId:f,appName:i,allowTracking:w,source:u,userAgent:n.navigator.userAgent,location:n.location.href,language:n.navigator.language,charset:n.document.characterSet,title:g=g??n.document.title,referrer:n.document.referrer,screenResolution:`${n.screen.width}x${n.screen.height}`,viewportSize:`${n.innerWidth}x${n.innerHeight}`};a(`adding new event to queue ${JSON.stringify(t)}`),p.push(t)}function v(e){d&&(window.criteo_q=window.criteo_q||[],window.criteo_q.push(e))}function b(e){if(l)try{const i=[`pr_${l}_${e}`];i.push(`pr_${l}_lid_${function(){let e="__rtbhouse.lid",t=window.localStorage.getItem(e);if(!t){t="";var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let e=0;e<20;e++)t+=i.charAt(Math.floor(Math.random()*i.length));window.localStorage.setItem(e,t)}return t}()}`);const n=document.createElement("iframe"),o=encodeURIComponent(document.referrer||""),r=encodeURIComponent(document.location.href||""),c=encodeURIComponent(""+Date.now());let t="https://creativecdn.com/tags?type=iframe";for(let e=0;e<i.length;e++)t+="&id="+encodeURIComponent(i[e]);t+=`&su=${r}&sr=${o}&ts=${c}`,n.setAttribute("src",t),n.setAttribute("width","1"),n.setAttribute("height","1"),n.setAttribute("scrolling","no"),n.setAttribute("frameBorder","0"),n.setAttribute("style","display:none"),n.setAttribute("referrerpolicy","no-referrer-when-downgrade"),document.body?document.body.appendChild(n):window.addEventListener("DOMContentLoaded",function(){document.body.appendChild(n)})}catch(e){a(e)}}const $={loadCriteo:function(){if(d){a("Loading criteo");let e=document.createElement("script");e.setAttribute("src",`//dynamic.criteo.com/js/ld/ld.js?a=${d}`),document.head.appendChild(e),v([{event:"setAccount",account:d},{event:"setEmail",email:h},{event:"setSiteType",type:"ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints?"m":"d"}])}a("criteo partner id not set")},criteoViewHome:function(){console.log("criteoViewHome"),v({event:"viewHome"})},criteoViewBasket:function(e){v({event:"viewBasket",item:e})},criteoViewItem:function(e){v({event:"viewItem",item:e.sku})},criteoViewList:function(e){v({event:"viewList",item:e.map(e=>e.sku)})},criteoFinishOrder:function(e,t){v({event:"trackTransaction",id:e,item:t})},criteoChangeEmail:function(e){v({event:"setEmail",email:e})}},_={rtbViewHome:function(){b("home")},rtbViewBasket:function(e){b(`basketstatus_${e.map(e=>e.sku).join(",")}`)},rtbViewItem:function(e){b(`offer_${e.sku}`)},rtbViewList:function(e){e=e.map(e=>e.sku);b(`listing_${e[0]},${e[1]},${e[2]},${e[3]},${e[4]}`)},rtbViewCategory:function(e){b(`category2_${e}`)},rtbStartOrder:function(){b("startorder")},rtbFinishOrder:function(e,t,i){b(`orderstatus2_${i}_${e}_${t.map(e=>e.sku).join(",")}`)}};function k(e){let t={};var i,n;return r(e,["id","sku"]),[i={},n]=[e,["quantity"]],n.forEach(e=>{i[e]&&Number.isNaN(Number(i[e]))&&o(`${e} is empty or contains invalid numeric value`)}),t.id=e.id,t.sku=e.sku,t.quantity&&(t.quantity=e.quantity),t}function I(e){let t={};var i,n;return r(e,["listName","merchantKey"]),[i={},n]=[e,["position"]],n.forEach(e=>{Number.isNaN(Number(i[e]))&&o(`${e} is empty or contains invalid numeric value`)}),t.listName=e.listName,t.position=e.position,t.merchantKey=e.merchantKey,t}var e={__system__:{land:function(){y("land",{originalQuery:n.location.search})}},viewHome:function(){console.log("viewHome"),$.criteoViewHome(),_.rtbViewHome()},viewBasket:function(e){$.criteoViewBasket(e),_.rtbViewBasket(e)},viewCategory(e){_.rtbViewCategory(e)},finishOrder:function(e,t,i){$.criteoFinishOrder(e,t),_.rtbFinishOrder(e,t,i)},changeUser:function(e,t=""){f=e,h=t,$.criteoChangeEmail(h)},agreeTracking:function(){w=!0},changeRoute:function(e={}){let t={};r(e,["path","title","location"]),g=e.title,t.path=e.path,t.title=e.title,t.location=e.location,y("changeRoute",t)},productClick:function(e={},t={}){y("productClick",{product:k(e),click:I(t)})},productsImpression:function(e=[],n={}){r(n,["merchantKey"]),y("productsImpression",e.map(function(e){var t=e.listName,i=n.merchantKey;return $.criteoViewList(e.products),_.rtbViewList(e.products),{name:t,merchantKey:i,products:e.products.map(k)}}))},productDetails:function(e={},t={}){r(t,["merchantKey"]),$.criteoViewItem(e),_.rtbViewItem(e),y("productDetails",{product:k(e),...t})},addLineItem:function(e={},t={}){r(t,["currencyCode","merchantKey"]),y("addLineItem",{product:k(e),...t})},removeLineItem:function(e={},t={}){r(t,["currencyCode","merchantKey"]),y("removeLineItem",{product:k(e),...t})},checkoutStep:function(e,t){1===t&&_.rtbStartOrder(e),c("orderId",e),y("checkoutStep",{orderId:e,stepNumber:t})},checkoutStepOption:function(e,t,i){c("orderId",e),y("checkoutStepOption",{orderId:e,stepNumber:t,optionName:i})}};$.loadCriteo(),e.__system__.land(),n.pixel=e,function t(){let i=n.setTimeout(async function(){if(a("loop"),m&&p.length){var e=p.shift();try{await async function(e){a(`sending.. payload=${JSON.stringify(e)}`);try{await fetch(`${s}/analytics/collect`,{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(e){console.error(`Failed to send event.. ${e.message}`)}}(e)}catch(e){a(`Failed to send event.. ${e.message}`)}}n.clearInterval(i),t()},500)}()}(window);';
3
3
  };
@@ -17,6 +17,9 @@ export var pixelChangeRoute = function() {
17
17
  }, 20);
18
18
  return;
19
19
  }
20
+ if (Router.router.asPath === '/') {
21
+ pixel === null || pixel === void 0 ? void 0 : pixel.viewHome();
22
+ }
20
23
  return pixel === null || pixel === void 0 ? void 0 : pixel.changeRoute({
21
24
  path: Router.router.asPath,
22
25
  title: title || 'Error',
@@ -0,0 +1,12 @@
1
+ export var mapProducts = function(data) {
2
+ var mapped = data === null || data === void 0 ? void 0 : data.reduce(function(res, cur) {
3
+ var ref, ref1;
4
+ res.push({
5
+ id: cur.variant.sku,
6
+ price: (Number((ref = cur.totalPrice) === null || ref === void 0 ? void 0 : ref.centAmount) / Math.pow(10, Number((ref1 = cur.totalPrice) === null || ref1 === void 0 ? void 0 : ref1.fractionDigits))).toFixed(2),
7
+ quantity: cur.quantity + ''
8
+ });
9
+ return res;
10
+ }, []);
11
+ return mapped;
12
+ };
@@ -105,7 +105,6 @@ export var useAccordion = function(param) {
105
105
  };
106
106
  }, [
107
107
  state.width,
108
- state.height,
109
108
  collapse,
110
109
  expand
111
110
  ]);
@@ -167,11 +167,11 @@ export function processListingQuery(_) {
167
167
  }
168
168
  function _processListingQuery() {
169
169
  _processListingQuery = _asyncToGenerator(regeneratorRuntime.mark(function _callee(param) {
170
- var predicate, router, limit, sort, postFilter, offset, config, slug, query, type, filter, _sort;
170
+ var predicate, router, limit, sort, postFilter, offset, config, slug, _includeVariants, includeVariants, query, type, filter, _sort;
171
171
  return regeneratorRuntime.wrap(function _callee$(_ctx) {
172
172
  while(1)switch(_ctx.prev = _ctx.next){
173
173
  case 0:
174
- predicate = param.predicate, router = param.router, limit = param.limit, sort = param.sort, postFilter = param.postFilter, offset = param.offset, config = param.config, slug = param.slug;
174
+ predicate = param.predicate, router = param.router, limit = param.limit, sort = param.sort, postFilter = param.postFilter, offset = param.offset, config = param.config, slug = param.slug, _includeVariants = param.includeVariants, includeVariants = _includeVariants === void 0 ? false : _includeVariants;
175
175
  query = router.query;
176
176
  type = getListingPageType(router, slug, config);
177
177
  filter = generateFilter(type, query, slug, predicate);
@@ -189,6 +189,8 @@ function _processListingQuery() {
189
189
  postFilter: postFilter
190
190
  }, (config === null || config === void 0 ? void 0 : config.collapseMode) && type !== ListingTypesEnum.Collection && {
191
191
  collapseMode: config === null || config === void 0 ? void 0 : config.collapseMode
192
+ }, {
193
+ includeVariants: includeVariants
192
194
  })));
193
195
  case 6:
194
196
  case "end":
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
+ import Head from 'next/head';
3
+ import { useRouter } from 'next/router';
2
4
  import { useConfigState } from '../../hooks/useConfig';
3
5
  import { BasicSEO, OpenGraph } from '../../seo';
4
6
  import { useListingMeta, useListingPagination } from '../hooks';
@@ -9,11 +11,14 @@ import { useListingMeta, useListingPagination } from '../hooks';
9
11
  * :name: -> is going to be replace with the name
10
12
  */ export var BasicListingSEO = function(param) {
11
13
  var _favorTitleTemplateOverMeta = param.favorTitleTemplateOverMeta, favorTitleTemplateOverMeta = _favorTitleTemplateOverMeta === void 0 ? false : _favorTitleTemplateOverMeta, _favorDescriptionTemplateOverMeta = param.favorDescriptionTemplateOverMeta, favorDescriptionTemplateOverMeta = _favorDescriptionTemplateOverMeta === void 0 ? false : _favorDescriptionTemplateOverMeta, _titleTemplate = param.titleTemplate, titleTemplate = _titleTemplate === void 0 ? ':title:' : _titleTemplate, _descriptionTemplate = param.descriptionTemplate, descriptionTemplate = _descriptionTemplate === void 0 ? ':description:' : _descriptionTemplate, _pageTemplate = param.pageTemplate, pageTemplate = _pageTemplate === void 0 ? ':page' : _pageTemplate;
12
- var ref7, ref1, ref2, ref3, ref4, ref5;
13
- var ref6 = useListingMeta(), displayName = ref6.displayName, metaTitle = ref6.metaTitle, metaKeywords = ref6.metaKeywords, metaDescription = ref6.metaDescription, getAssetByKey = ref6.getAssetByKey;
14
- var image = (ref7 = getAssetByKey('image')) === null || ref7 === void 0 ? void 0 : (ref1 = ref7.sources) === null || ref1 === void 0 ? void 0 : (ref2 = ref1[0]) === null || ref2 === void 0 ? void 0 : ref2.url;
14
+ var ref9, ref1, ref2, ref3, ref4, ref5, ref6;
15
+ var ref7 = useListingMeta(), displayName = ref7.displayName, metaTitle = ref7.metaTitle, metaKeywords = ref7.metaKeywords, metaDescription = ref7.metaDescription, getAssetByKey = ref7.getAssetByKey;
16
+ var ref8 = useConfigState(), imagesConfig = ref8.imagesConfig, domain = ref8.domain;
17
+ var image = (ref9 = getAssetByKey('image')) === null || ref9 === void 0 ? void 0 : (ref1 = ref9.sources) === null || ref1 === void 0 ? void 0 : (ref2 = ref1[0]) === null || ref2 === void 0 ? void 0 : ref2.url;
15
18
  var topBanner = (ref3 = getAssetByKey('top-banner')) === null || ref3 === void 0 ? void 0 : (ref4 = ref3.sources) === null || ref4 === void 0 ? void 0 : (ref5 = ref4[0]) === null || ref5 === void 0 ? void 0 : ref5.url;
16
- var imagesConfig = useConfigState().imagesConfig;
19
+ var router = useRouter();
20
+ var url = "https://".concat(domain).concat(router === null || router === void 0 ? void 0 : (ref6 = router.asPath) === null || ref6 === void 0 ? void 0 : ref6.split('?')[0]);
21
+ var isSearchPage = router.asPath.includes('/search?q=');
17
22
  var pagination = useListingPagination().pagination;
18
23
  var createTemplate = function(template) {
19
24
  var ref;
@@ -22,7 +27,16 @@ import { useListingMeta, useListingPagination } from '../hooks';
22
27
  };
23
28
  var formattedTitle = favorTitleTemplateOverMeta ? createTemplate(titleTemplate) : metaTitle || createTemplate(titleTemplate);
24
29
  var formattedDescription = favorDescriptionTemplateOverMeta ? createTemplate(descriptionTemplate) : metaDescription || createTemplate(descriptionTemplate);
25
- return(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(BasicSEO, {
30
+ return(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Head, null, isSearchPage && /*#__PURE__*/ React.createElement("meta", {
31
+ name: "robots",
32
+ content: "noindex"
33
+ }), (pagination === null || pagination === void 0 ? void 0 : pagination.hasPrevious) && /*#__PURE__*/ React.createElement("link", {
34
+ rel: "prev",
35
+ href: "".concat(url, "?page=").concat(pagination.previousQuery.page)
36
+ }), (pagination === null || pagination === void 0 ? void 0 : pagination.hasNext) && /*#__PURE__*/ React.createElement("link", {
37
+ rel: "next",
38
+ href: "".concat(url, "?page=").concat(pagination.nextQuery.page)
39
+ })), /*#__PURE__*/ React.createElement(BasicSEO, {
26
40
  title: formattedTitle,
27
41
  keywords: metaKeywords,
28
42
  description: formattedDescription
@@ -69,7 +69,8 @@ function _prefetchListing() {
69
69
  postFilter: postFilter,
70
70
  offset: offset,
71
71
  config: config,
72
- slug: aliasedSlug
72
+ slug: aliasedSlug,
73
+ includeVariants: Boolean(config.includeVariants)
73
74
  });
74
75
  case 12:
75
76
  data = _ctx.sent;
@@ -1,26 +1,11 @@
1
1
  import React from 'react';
2
2
  import Head from 'next/head';
3
- import { useRouter } from 'next/router';
4
- import { useConfigState } from '../../../index';
5
- import { useListingPagination } from '../../../listing';
6
3
  export function BasicSEO(props) {
7
- var ref;
8
4
  var title = props.title, description = props.description, keywords = props.keywords, noIndex = props.noIndex;
9
- var domain = useConfigState().domain;
10
- var pagination = useListingPagination().pagination;
11
- var router = useRouter();
12
- var url = "https://".concat(domain).concat(router === null || router === void 0 ? void 0 : (ref = router.asPath) === null || ref === void 0 ? void 0 : ref.split('?')[0]);
13
- var isSearchPage = router.asPath.includes('/search?q=');
14
- return(/*#__PURE__*/ React.createElement(Head, null, (Boolean(noIndex) || isSearchPage) && /*#__PURE__*/ React.createElement("meta", {
5
+ return(/*#__PURE__*/ React.createElement(Head, null, Boolean(noIndex) && /*#__PURE__*/ React.createElement("meta", {
15
6
  name: "robots",
16
7
  content: "noindex"
17
- }), Boolean(title) && /*#__PURE__*/ React.createElement("title", null, title), (pagination === null || pagination === void 0 ? void 0 : pagination.hasPrevious) && /*#__PURE__*/ React.createElement("link", {
18
- rel: "prev",
19
- href: "".concat(url, "?page=").concat(pagination.previousQuery.page)
20
- }), (pagination === null || pagination === void 0 ? void 0 : pagination.hasNext) && /*#__PURE__*/ React.createElement("link", {
21
- rel: "next",
22
- href: "".concat(url, "?page=").concat(pagination.nextQuery.page)
23
- }), Boolean(description) && /*#__PURE__*/ React.createElement("meta", {
8
+ }), Boolean(title) && /*#__PURE__*/ React.createElement("title", null, title), Boolean(description) && /*#__PURE__*/ React.createElement("meta", {
24
9
  name: "description",
25
10
  content: description
26
11
  }), Boolean(keywords) && /*#__PURE__*/ React.createElement("meta", {
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ export var GridStyles = function(param) {
3
+ var spaceX = param.spaceX, breakpoints = param.breakpoints, _remSize = param.remSize, remSize = _remSize === void 0 ? 10 : _remSize;
4
+ var getSize = function getSize(width) {
5
+ return "min-width: calc(".concat(width, "% - ").concat(spaceX / remSize, "rem);") + "max-width: calc(".concat(width, "% - ").concat(spaceX / remSize, "rem);") + "margin: 0 ".concat(spaceX / 2 / remSize, "rem;");
6
+ };
7
+ var keys = Object.keys(breakpoints || {
8
+ xs: {
9
+ min: null
10
+ }
11
+ });
12
+ var transforms = {
13
+ xs: 'default'
14
+ };
15
+ var queries = keys.reduce(function(str, key, index) {
16
+ var min = ((breakpoints === null || breakpoints === void 0 ? void 0 : breakpoints[key]) || {}).min;
17
+ var k = transforms[key] || key;
18
+ if (index && !min) return str;
19
+ return str += "\n @media(min-width: ".concat(min || '1px', ") {\n .size-").concat(k, "-full-bleed {\n width: 100%;\n }\n\n .size-").concat(k, "-full-bleed .Section--inner {\n width: 100vw;\n position: relative;\n left: 50%;\n right: 50%;\n margin-left: -50vw;\n margin-right: -50vw;\n }\n\n .size-").concat(k, "-100 {\n ").concat(getSize(100), "\n }\n\n .size-").concat(k, "-90 {\n ").concat(getSize(90), "\n }\n\n .size-").concat(k, "-80 {\n ").concat(getSize(80), "\n }\n\n .size-").concat(k, "-75 {\n ").concat(getSize(75), "\n }\n\n .size-").concat(k, "-70 {\n ").concat(getSize(70), "\n }\n \n .size-").concat(k, "-66 {\n ").concat(getSize(66.666666), "\n }\n\n .size-").concat(k, "-60 {\n ").concat(getSize(60), "\n }\n\n .size-").concat(k, "-50 {\n ").concat(getSize(50), "\n }\n\n .size-").concat(k, "-40 {\n ").concat(getSize(40), "\n }\n\n .size-").concat(k, "-33 {\n ").concat(getSize(33.333333), "\n }\n\n .size-").concat(k, "-30 {\n ").concat(getSize(30), "\n }\n\n .size-").concat(k, "-25 {\n ").concat(getSize(25), "\n }\n\n .size-").concat(k, "-20 {\n ").concat(getSize(20), "\n }\n\n .size-").concat(k, "-10 {\n ").concat(getSize(10), "\n }\n }\n");
20
+ }, '');
21
+ return(/*#__PURE__*/ React.createElement("style", {
22
+ dangerouslySetInnerHTML: {
23
+ __html: "\n .Page--row {\n display: flex;\n display: -webkit-flex;\n flex-wrap: wrap;\n -webkit-flex-wrap: wrap;\n margin: 0 -".concat(spaceX / remSize / 2, "rem;\n }\n\n .Page__section {\n padding-bottom: 8rem;\n }\n\n .Page--col {\n display: block;\n width: 100%;\n }\n \n .size-default-inherit {\n width: 100%;\n }\n ").concat(queries, "\n ")
24
+ }
25
+ }));
26
+ };
@@ -1,2 +1,3 @@
1
1
  export * from './RangeSliderInput';
2
2
  export * from './LazyImage';
3
+ export * from './GridStyles';
@@ -1,4 +1,7 @@
1
1
  export * from './usePixelProductDetails';
2
2
  export * from './usePixelProductsImpression';
3
3
  export * from './usePixelProductClick';
4
+ export * from './usePixelViewBasket';
5
+ export * from './usePixelViewCategory';
6
+ export * from './usePixelFinishOrder';
4
7
  export * from './useDistrictMeta';
@@ -0,0 +1,4 @@
1
+ import type { OrderDTO } from '@sentecacommerce/sdk';
2
+ export declare const usePixelFinishOrder: () => {
3
+ sendFinishOrderEvent: (order: OrderDTO) => void;
4
+ };
@@ -0,0 +1,4 @@
1
+ import { LineItemDTO } from '@sentecacommerce/sdk';
2
+ export declare const usePixelViewBasket: () => {
3
+ sendViewBasketEvent: (data: LineItemDTO[]) => void;
4
+ };
@@ -0,0 +1,3 @@
1
+ export declare const usePixelViewCategory: () => {
2
+ sendViewCategoryEvent: (categoryBreadcrumb: string) => void;
3
+ };
@@ -7,3 +7,12 @@ export interface ProductsImpressionType {
7
7
  name: string;
8
8
  products?: ProductType[] | SearchResultDTO[];
9
9
  }
10
+ export interface Products {
11
+ id: string;
12
+ price: string;
13
+ quantity: string;
14
+ }
15
+ export interface OrderType {
16
+ orderId: string;
17
+ productsData: Products[];
18
+ }