@sentecacommerce-theme/lib 0.12.88 → 0.12.92

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 (45) 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/usePixelProductClick.js +3 -7
  4. package/dist/cjs/analytics/Pixel/hooks/usePixelProductsImpression.js +39 -30
  5. package/dist/cjs/analytics/Pixel/hooks/usePixelViewBasket.js +24 -0
  6. package/dist/cjs/analytics/Pixel/hooks/usePixelViewCategory.js +29 -0
  7. package/dist/cjs/analytics/Pixel/mainScript.js +197 -14
  8. package/dist/cjs/analytics/Pixel/minifiedPixel.js +1 -1
  9. package/dist/cjs/analytics/Pixel/usePixel.js +3 -0
  10. package/dist/cjs/analytics/Pixel/utils.js +17 -0
  11. package/dist/cjs/hooks/ui-hooks/useAccordion/index.js +0 -1
  12. package/dist/cjs/listing/api/queries/useListingQuery.js +4 -2
  13. package/dist/cjs/listing/components/BasicListingSEO.js +19 -5
  14. package/dist/cjs/listing/ssr/prefetchListing.js +2 -1
  15. package/dist/cjs/seo/components/BasicSEO/index.js +2 -17
  16. package/dist/cjs/ui/components/GridStyles.js +36 -0
  17. package/dist/cjs/ui/components/index.js +12 -0
  18. package/dist/esm/analytics/Pixel/hooks/index.js +3 -0
  19. package/dist/esm/analytics/Pixel/hooks/usePixelFinishOrder.js +22 -0
  20. package/dist/esm/analytics/Pixel/hooks/usePixelProductClick.js +4 -8
  21. package/dist/esm/analytics/Pixel/hooks/usePixelProductsImpression.js +39 -30
  22. package/dist/esm/analytics/Pixel/hooks/usePixelViewBasket.js +19 -0
  23. package/dist/esm/analytics/Pixel/hooks/usePixelViewCategory.js +24 -0
  24. package/dist/esm/analytics/Pixel/mainScript.js +199 -14
  25. package/dist/esm/analytics/Pixel/minifiedPixel.js +1 -1
  26. package/dist/esm/analytics/Pixel/usePixel.js +3 -0
  27. package/dist/esm/analytics/Pixel/utils.js +12 -0
  28. package/dist/esm/hooks/ui-hooks/useAccordion/index.js +0 -1
  29. package/dist/esm/listing/api/queries/useListingQuery.js +4 -2
  30. package/dist/esm/listing/components/BasicListingSEO.js +19 -5
  31. package/dist/esm/listing/ssr/prefetchListing.js +2 -1
  32. package/dist/esm/seo/components/BasicSEO/index.js +2 -17
  33. package/dist/esm/ui/components/GridStyles.js +26 -0
  34. package/dist/esm/ui/components/index.js +1 -0
  35. package/dist/types/analytics/Pixel/hooks/index.d.ts +3 -0
  36. package/dist/types/analytics/Pixel/hooks/usePixelFinishOrder.d.ts +4 -0
  37. package/dist/types/analytics/Pixel/hooks/usePixelViewBasket.d.ts +4 -0
  38. package/dist/types/analytics/Pixel/hooks/usePixelViewCategory.d.ts +7 -0
  39. package/dist/types/analytics/Pixel/types.d.ts +9 -0
  40. package/dist/types/analytics/Pixel/utils.d.ts +3 -0
  41. package/dist/types/listing/api/queries/useListingQuery.d.ts +2 -1
  42. package/dist/types/listing/types.d.ts +3 -2
  43. package/dist/types/ui/components/GridStyles.d.ts +10 -0
  44. package/dist/types/ui/components/index.d.ts +1 -0
  45. package/package.json +4 -4
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", {
3
3
  });
4
4
  exports.BasicListingSEO = void 0;
5
5
  var _react = _interopRequireDefault(require("react"));
6
+ var _head = _interopRequireDefault(require("next/head"));
7
+ var _router = require("next/router");
6
8
  var _useConfig = require("../../hooks/useConfig");
7
9
  var _seo = require("../../seo");
8
10
  var _hooks = require("../hooks");
@@ -13,11 +15,14 @@ function _interopRequireDefault(obj) {
13
15
  }
14
16
  var BasicListingSEO = function(param) {
15
17
  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;
16
- var ref7, ref1, ref2, ref3, ref4, ref5;
17
- var ref6 = (0, _hooks).useListingMeta(), displayName = ref6.displayName, metaTitle = ref6.metaTitle, metaKeywords = ref6.metaKeywords, metaDescription = ref6.metaDescription, getAssetByKey = ref6.getAssetByKey;
18
- 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;
18
+ var ref9, ref1, ref2, ref3, ref4, ref5, ref6;
19
+ var ref7 = (0, _hooks).useListingMeta(), displayName = ref7.displayName, metaTitle = ref7.metaTitle, metaKeywords = ref7.metaKeywords, metaDescription = ref7.metaDescription, getAssetByKey = ref7.getAssetByKey;
20
+ var ref8 = (0, _useConfig).useConfigState(), imagesConfig = ref8.imagesConfig, domain = ref8.domain;
21
+ 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;
19
22
  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;
20
- var imagesConfig = (0, _useConfig).useConfigState().imagesConfig;
23
+ var router = (0, _router).useRouter();
24
+ 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]);
25
+ var isSearchPage = router.asPath.includes('/search?q=');
21
26
  var pagination = (0, _hooks).useListingPagination().pagination;
22
27
  var createTemplate = function(template) {
23
28
  var ref;
@@ -26,7 +31,16 @@ var BasicListingSEO = function(param) {
26
31
  };
27
32
  var formattedTitle = favorTitleTemplateOverMeta ? createTemplate(titleTemplate) : metaTitle || createTemplate(titleTemplate);
28
33
  var formattedDescription = favorDescriptionTemplateOverMeta ? createTemplate(descriptionTemplate) : metaDescription || createTemplate(descriptionTemplate);
29
- return(/*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement(_seo.BasicSEO, {
34
+ return(/*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement(_head.default, null, isSearchPage && /*#__PURE__*/ _react.default.createElement("meta", {
35
+ name: "robots",
36
+ content: "noindex"
37
+ }), (pagination === null || pagination === void 0 ? void 0 : pagination.hasPrevious) && /*#__PURE__*/ _react.default.createElement("link", {
38
+ rel: "prev",
39
+ href: "".concat(url, "?page=").concat(pagination.previousQuery.page)
40
+ }), (pagination === null || pagination === void 0 ? void 0 : pagination.hasNext) && /*#__PURE__*/ _react.default.createElement("link", {
41
+ rel: "next",
42
+ href: "".concat(url, "?page=").concat(pagination.nextQuery.page)
43
+ })), /*#__PURE__*/ _react.default.createElement(_seo.BasicSEO, {
30
44
  title: formattedTitle,
31
45
  keywords: metaKeywords,
32
46
  description: formattedDescription
@@ -77,7 +77,8 @@ function _prefetchListing() {
77
77
  postFilter: postFilter,
78
78
  offset: offset,
79
79
  config: config,
80
- slug: aliasedSlug
80
+ slug: aliasedSlug,
81
+ includeVariants: Boolean(config.includeVariants)
81
82
  });
82
83
  case 12:
83
84
  data = _ctx.sent;
@@ -4,32 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  exports.BasicSEO = BasicSEO;
5
5
  var _react = _interopRequireDefault(require("react"));
6
6
  var _head = _interopRequireDefault(require("next/head"));
7
- var _router = require("next/router");
8
- var _index = require("../../../index");
9
- var _listing = require("../../../listing");
10
7
  function _interopRequireDefault(obj) {
11
8
  return obj && obj.__esModule ? obj : {
12
9
  default: obj
13
10
  };
14
11
  }
15
12
  function BasicSEO(props) {
16
- var ref;
17
13
  var title = props.title, description = props.description, keywords = props.keywords, noIndex = props.noIndex;
18
- var domain = (0, _index).useConfigState().domain;
19
- var pagination = (0, _listing).useListingPagination().pagination;
20
- var router = (0, _router).useRouter();
21
- 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]);
22
- var isSearchPage = router.asPath.includes('/search?q=');
23
- return(/*#__PURE__*/ _react.default.createElement(_head.default, null, (Boolean(noIndex) || isSearchPage) && /*#__PURE__*/ _react.default.createElement("meta", {
14
+ return(/*#__PURE__*/ _react.default.createElement(_head.default, null, Boolean(noIndex) && /*#__PURE__*/ _react.default.createElement("meta", {
24
15
  name: "robots",
25
16
  content: "noindex"
26
- }), Boolean(title) && /*#__PURE__*/ _react.default.createElement("title", null, title), (pagination === null || pagination === void 0 ? void 0 : pagination.hasPrevious) && /*#__PURE__*/ _react.default.createElement("link", {
27
- rel: "prev",
28
- href: "".concat(url, "?page=").concat(pagination.previousQuery.page)
29
- }), (pagination === null || pagination === void 0 ? void 0 : pagination.hasNext) && /*#__PURE__*/ _react.default.createElement("link", {
30
- rel: "next",
31
- href: "".concat(url, "?page=").concat(pagination.nextQuery.page)
32
- }), Boolean(description) && /*#__PURE__*/ _react.default.createElement("meta", {
17
+ }), Boolean(title) && /*#__PURE__*/ _react.default.createElement("title", null, title), Boolean(description) && /*#__PURE__*/ _react.default.createElement("meta", {
33
18
  name: "description",
34
19
  content: description
35
20
  }), Boolean(keywords) && /*#__PURE__*/ _react.default.createElement("meta", {
@@ -0,0 +1,36 @@
1
+ Object.defineProperty(exports, "__esModule", {
2
+ value: true
3
+ });
4
+ exports.GridStyles = void 0;
5
+ var _react = _interopRequireDefault(require("react"));
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule ? obj : {
8
+ default: obj
9
+ };
10
+ }
11
+ var GridStyles = function(param) {
12
+ var spaceX = param.spaceX, breakpoints = param.breakpoints, _remSize = param.remSize, remSize = _remSize === void 0 ? 10 : _remSize;
13
+ function getSize(width) {
14
+ 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;");
15
+ }
16
+ var keys = Object.keys(breakpoints || {
17
+ xs: {
18
+ min: null
19
+ }
20
+ });
21
+ var transforms = {
22
+ xs: 'default'
23
+ };
24
+ var queries = keys.reduce(function(str, key, index) {
25
+ var min = ((breakpoints === null || breakpoints === void 0 ? void 0 : breakpoints[key]) || {}).min;
26
+ var k = transforms[key] || key;
27
+ if (index && !min) return str;
28
+ 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");
29
+ }, '');
30
+ return(/*#__PURE__*/ _react.default.createElement("style", {
31
+ dangerouslySetInnerHTML: {
32
+ __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 ")
33
+ }
34
+ }));
35
+ };
36
+ exports.GridStyles = GridStyles;
@@ -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 === null || pixel === void 0 ? void 0 : pixel.finishOrder(payload);
16
+ }
17
+ }
18
+ };
19
+ return {
20
+ sendFinishOrderEvent: sendFinishOrderEvent
21
+ };
22
+ };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { useConfigState } from '../../../index';
2
+ import { useConfigState, canUseDOM } from '../../../index';
3
3
  function _defineProperty(obj, key, value) {
4
4
  if (key in obj) {
5
5
  Object.defineProperty(obj, key, {
@@ -28,18 +28,14 @@ function _objectSpread(target) {
28
28
  }
29
29
  return target;
30
30
  }
31
- var _typeof = function(obj) {
32
- "@swc/helpers - typeof";
33
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
34
- };
35
31
  export var usePixelProductClick = function() {
36
32
  var defaultMerchant = useConfigState().defaultMerchant;
37
33
  var sendClickEvent = function(param) {
38
34
  var product = param.product, info = param.info;
39
- if ((typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined) {
35
+ if (canUseDOM() && defaultMerchant) {
40
36
  var pixel = window.pixel;
41
- pixel.productClick(product, _objectSpread({}, info, {
42
- merchantKey: defaultMerchant || ''
37
+ pixel === null || pixel === void 0 ? void 0 : pixel.productClick(product, _objectSpread({}, info, {
38
+ merchantKey: defaultMerchant
43
39
  }));
44
40
  }
45
41
  };
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { useRouter } from 'next/router';
3
3
  import { useConfigState, useBoolean } from '../../../index';
4
4
  import { createMappedProducts } from '../../Releva';
5
+ import { canUseDOM } from '../../../utils';
5
6
  function _arrayLikeToArray(arr, len) {
6
7
  if (len == null || len > arr.length) len = arr.length;
7
8
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -40,10 +41,6 @@ function _nonIterableRest() {
40
41
  function _slicedToArray(arr, i) {
41
42
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
42
43
  }
43
- var _typeof = function(obj) {
44
- "@swc/helpers - typeof";
45
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
46
- };
47
44
  function _unsupportedIterableToArray(o, minLen) {
48
45
  if (!o) return;
49
46
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -54,7 +51,7 @@ function _unsupportedIterableToArray(o, minLen) {
54
51
  }
55
52
  export var usePixelProductsImpression = function(param) {
56
53
  var productsData = param.productsData, isCarousel = param.isCarousel;
57
- var ref3 = _slicedToArray(useBoolean(false), 2), sentAlready = ref3[0], setSentAlready = ref3[1];
54
+ var ref4 = _slicedToArray(useBoolean(false), 2), sentAlready = ref4[0], setSentAlready = ref4[1];
58
55
  var defaultMerchant = useConfigState().defaultMerchant;
59
56
  var router = useRouter();
60
57
  var products = [];
@@ -62,34 +59,46 @@ export var usePixelProductsImpression = function(param) {
62
59
  products = createMappedProducts(productsData.products);
63
60
  }
64
61
  React.useEffect(function() {
62
+ setSentAlready.off();
63
+ }, [
64
+ router.asPath,
65
+ productsData.products.length,
66
+ setSentAlready
67
+ ]);
68
+ React.useEffect(function() {
69
+ var ref, ref1, ref2;
65
70
  if (sentAlready || !products.length) return;
66
- router.events.on('routeChangeComplete', function() {
67
- var ref, ref1;
68
- if ((typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined && !((ref = productsData.products) === null || ref === void 0 ? void 0 : (ref1 = ref[0]) === null || ref1 === void 0 ? void 0 : ref1.isPlaceholder) && (productsData === null || productsData === void 0 ? void 0 : productsData.length) > 0) {
69
- var ref2;
70
- var pixel = window.pixel;
71
- var title = window === null || window === void 0 ? void 0 : (ref2 = window.document) === null || ref2 === void 0 ? void 0 : ref2.title;
72
- var sendImpressions = function() {
73
- if (!title || title === 'за') {
74
- setTimeout(function() {
75
- return sendImpressions();
76
- }, 20);
77
- return;
71
+ if (canUseDOM() && !((ref = productsData.products) === null || ref === void 0 ? void 0 : (ref1 = ref[0]) === null || ref1 === void 0 ? void 0 : ref1.isPlaceholder) && (productsData === null || productsData === void 0 ? void 0 : (ref2 = productsData.products) === null || ref2 === void 0 ? void 0 : ref2.length) > 0) {
72
+ var ref3;
73
+ var pixel = window.pixel;
74
+ var title = window === null || window === void 0 ? void 0 : (ref3 = window.document) === null || ref3 === void 0 ? void 0 : ref3.title;
75
+ var sendImpressions = function() {
76
+ if (!title || title === 'за') {
77
+ setTimeout(function() {
78
+ return sendImpressions();
79
+ }, 20);
80
+ return;
81
+ }
82
+ pixel === null || pixel === void 0 ? void 0 : pixel.productsImpression(!isCarousel ? [
83
+ {
84
+ listName: title,
85
+ products: products
78
86
  }
79
- pixel === null || pixel === void 0 ? void 0 : pixel.productsImpression(!isCarousel ? [
80
- {
81
- listName: title,
82
- products: products
83
- }
84
- ] : productsData, {
85
- merchantKey: defaultMerchant || ''
86
- });
87
- };
88
- sendImpressions();
87
+ ] : productsData, {
88
+ merchantKey: defaultMerchant || ''
89
+ });
89
90
  setSentAlready.on();
90
- }
91
- });
91
+ };
92
+ sendImpressions();
93
+ }
92
94
  }, [
93
- router.route
95
+ router.route,
96
+ defaultMerchant,
97
+ sentAlready,
98
+ products,
99
+ router.events,
100
+ productsData,
101
+ setSentAlready,
102
+ isCarousel,
94
103
  ]);
95
104
  };
@@ -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 === null || pixel === void 0 ? void 0 : pixel.viewBasket(payload);
13
+ }
14
+ }
15
+ };
16
+ return {
17
+ sendViewBasketEvent: sendViewBasketEvent
18
+ };
19
+ };
@@ -0,0 +1,24 @@
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(breadcrumbData) {
7
+ var breadcrumbString = breadcrumbData.reduce(function(res, curr, index) {
8
+ res += curr.name;
9
+ if (index !== breadcrumbData.length - 1) {
10
+ res += '/';
11
+ }
12
+ return res;
13
+ }, '');
14
+ if ((typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined) {
15
+ var pixel = window.pixel;
16
+ if (breadcrumbString) {
17
+ pixel === null || pixel === void 0 ? void 0 : pixel.viewCategory(breadcrumbString);
18
+ }
19
+ }
20
+ };
21
+ return {
22
+ sendViewCategoryEvent: sendViewCategoryEvent
23
+ };
24
+ };