@sentecacommerce-theme/lib 0.13.11 → 0.13.12
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.
- package/dist/cjs/analytics/Pixel/hooks/usePixelFinishOrder.js +6 -7
- package/dist/cjs/analytics/Pixel/hooks/usePixelViewBasket.js +2 -5
- package/dist/cjs/analytics/Pixel/hooks/usePixelViewCategory.js +2 -5
- package/dist/cjs/analytics/Pixel/usePixel.js +1 -5
- package/dist/cjs/analytics/Pixel/utils.js +1 -1
- package/dist/cjs/hooks/useProduct/index.js +8 -3
- package/dist/esm/analytics/Pixel/hooks/usePixelFinishOrder.js +6 -7
- package/dist/esm/analytics/Pixel/hooks/usePixelViewBasket.js +2 -5
- package/dist/esm/analytics/Pixel/hooks/usePixelViewCategory.js +2 -5
- package/dist/esm/analytics/Pixel/usePixel.js +1 -5
- package/dist/esm/analytics/Pixel/utils.js +1 -1
- package/dist/esm/hooks/useProduct/index.js +8 -3
- package/dist/types/analytics/Pixel/types.d.ts +2 -1
- package/package.json +4 -4
@@ -3,20 +3,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
});
|
4
4
|
exports.usePixelFinishOrder = void 0;
|
5
5
|
var _utils = require("../utils");
|
6
|
-
var
|
7
|
-
"@swc/helpers - typeof";
|
8
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
9
|
-
};
|
6
|
+
var _index = require("../../../index");
|
10
7
|
var usePixelFinishOrder = function() {
|
11
8
|
var sendFinishOrderEvent = function(order) {
|
9
|
+
var ref, ref1;
|
12
10
|
var payload = {
|
13
11
|
orderId: order.orderRefNumber,
|
14
|
-
productsData: (0, _utils).mapProducts(order.lineItems)
|
12
|
+
productsData: (0, _utils).mapProducts(order.lineItems),
|
13
|
+
orderPrice: (Number((ref = order.grandTotalPrice) === null || ref === void 0 ? void 0 : ref.centAmount) / Math.pow(10, Number((ref1 = order.grandTotalPrice) === null || ref1 === void 0 ? void 0 : ref1.fractionDigits))).toFixed(2)
|
15
14
|
};
|
16
|
-
if ((
|
15
|
+
if ((0, _index).canUseDOM()) {
|
17
16
|
var pixel = window.pixel;
|
18
17
|
if (payload) {
|
19
|
-
pixel === null || pixel === void 0 ? void 0 : pixel.finishOrder(payload);
|
18
|
+
pixel === null || pixel === void 0 ? void 0 : pixel.finishOrder(payload.orderId, payload.productsData, payload.orderPrice);
|
20
19
|
}
|
21
20
|
}
|
22
21
|
};
|
@@ -3,14 +3,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
});
|
4
4
|
exports.usePixelViewBasket = void 0;
|
5
5
|
var _utils = require("../utils");
|
6
|
-
var
|
7
|
-
"@swc/helpers - typeof";
|
8
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
9
|
-
};
|
6
|
+
var _index = require("../../../index");
|
10
7
|
var usePixelViewBasket = function() {
|
11
8
|
var sendViewBasketEvent = function(data) {
|
12
9
|
var payload = (0, _utils).mapProducts(data);
|
13
|
-
if ((
|
10
|
+
if ((0, _index).canUseDOM()) {
|
14
11
|
var pixel = window.pixel;
|
15
12
|
if (payload) {
|
16
13
|
pixel === null || pixel === void 0 ? void 0 : pixel.viewBasket(payload);
|
@@ -2,10 +2,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
2
2
|
value: true
|
3
3
|
});
|
4
4
|
exports.usePixelViewCategory = void 0;
|
5
|
-
var
|
6
|
-
"@swc/helpers - typeof";
|
7
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
8
|
-
};
|
5
|
+
var _index = require("../../../index");
|
9
6
|
var usePixelViewCategory = function() {
|
10
7
|
var sendViewCategoryEvent = function(breadcrumbData) {
|
11
8
|
var breadcrumbString = breadcrumbData.reduce(function(res, curr, index) {
|
@@ -15,7 +12,7 @@ var usePixelViewCategory = function() {
|
|
15
12
|
}
|
16
13
|
return res;
|
17
14
|
}, '');
|
18
|
-
if ((
|
15
|
+
if ((0, _index).canUseDOM()) {
|
19
16
|
var pixel = window.pixel;
|
20
17
|
if (breadcrumbString) {
|
21
18
|
pixel === null || pixel === void 0 ? void 0 : pixel.viewCategory(breadcrumbString);
|
@@ -12,12 +12,8 @@ function _interopRequireDefault(obj) {
|
|
12
12
|
default: obj
|
13
13
|
};
|
14
14
|
}
|
15
|
-
var _typeof = function(obj) {
|
16
|
-
"@swc/helpers - typeof";
|
17
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
18
|
-
};
|
19
15
|
var pixelChangeRoute = function() {
|
20
|
-
if ((
|
16
|
+
if ((0, _utils1).canUseDOM()) {
|
21
17
|
var pixel = window.pixel;
|
22
18
|
var title = window.document.title;
|
23
19
|
if (!title || title === 'за') {
|
@@ -6,7 +6,7 @@ var mapProducts = function(data) {
|
|
6
6
|
var mapped = data === null || data === void 0 ? void 0 : data.reduce(function(res, cur) {
|
7
7
|
var ref, ref1;
|
8
8
|
res.push({
|
9
|
-
|
9
|
+
sku: cur.variant.sku,
|
10
10
|
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),
|
11
11
|
quantity: cur.quantity + ''
|
12
12
|
});
|
@@ -65,12 +65,15 @@ function ProductProvider(param) {
|
|
65
65
|
product === null || product === void 0 ? void 0 : product.name,
|
66
66
|
product === null || product === void 0 ? void 0 : product.slug,
|
67
67
|
product === null || product === void 0 ? void 0 : product.assets,
|
68
|
-
selectedVariant,
|
68
|
+
selectedVariant,
|
69
|
+
product === null || product === void 0 ? void 0 : product.categories,
|
70
|
+
includeBrandInName,
|
71
|
+
product === null || product === void 0 ? void 0 : product.reviewRatingStatistics,
|
69
72
|
]);
|
70
73
|
var seoData = _react.default.useMemo(function() {
|
71
74
|
var ref, ref39, ref40;
|
72
75
|
var title = (0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.metaTitle) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.metaTitle);
|
73
|
-
var brandName = product === null || product === void 0 ? void 0 : (ref = product.brands) === null || ref === void 0 ? void 0 : (ref39 = ref[0]) === null || ref39 === void 0 ? void 0 : (ref40 = ref39.resource) === null || ref40 === void 0 ? void 0 : ref40.name;
|
76
|
+
var brandName = (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref = product.brands) === null || ref === void 0 ? void 0 : (ref39 = ref[0]) === null || ref39 === void 0 ? void 0 : (ref40 = ref39.resource) === null || ref40 === void 0 ? void 0 : ref40.name);
|
74
77
|
var seoObj = {
|
75
78
|
title: includeBrandInName && brandName ? "".concat(brandName, " ").concat(title) : title,
|
76
79
|
description: (0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.metaDescription) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.metaDescription),
|
@@ -81,7 +84,9 @@ function ProductProvider(param) {
|
|
81
84
|
product === null || product === void 0 ? void 0 : product.metaDescription,
|
82
85
|
product === null || product === void 0 ? void 0 : product.metaKeywords,
|
83
86
|
product === null || product === void 0 ? void 0 : product.metaTitle,
|
84
|
-
selectedVariant,
|
87
|
+
selectedVariant,
|
88
|
+
product === null || product === void 0 ? void 0 : product.brands,
|
89
|
+
includeBrandInName,
|
85
90
|
]);
|
86
91
|
var collapsedImages = (0, _utils).createCollapseKeyImagesMap(product);
|
87
92
|
var state = {
|
@@ -1,18 +1,17 @@
|
|
1
1
|
import { mapProducts } from '../utils';
|
2
|
-
|
3
|
-
"@swc/helpers - typeof";
|
4
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
5
|
-
};
|
2
|
+
import { canUseDOM } from '../../../index';
|
6
3
|
export var usePixelFinishOrder = function() {
|
7
4
|
var sendFinishOrderEvent = function(order) {
|
5
|
+
var ref, ref1;
|
8
6
|
var payload = {
|
9
7
|
orderId: order.orderRefNumber,
|
10
|
-
productsData: mapProducts(order.lineItems)
|
8
|
+
productsData: mapProducts(order.lineItems),
|
9
|
+
orderPrice: (Number((ref = order.grandTotalPrice) === null || ref === void 0 ? void 0 : ref.centAmount) / Math.pow(10, Number((ref1 = order.grandTotalPrice) === null || ref1 === void 0 ? void 0 : ref1.fractionDigits))).toFixed(2)
|
11
10
|
};
|
12
|
-
if ((
|
11
|
+
if (canUseDOM()) {
|
13
12
|
var pixel = window.pixel;
|
14
13
|
if (payload) {
|
15
|
-
pixel === null || pixel === void 0 ? void 0 : pixel.finishOrder(payload);
|
14
|
+
pixel === null || pixel === void 0 ? void 0 : pixel.finishOrder(payload.orderId, payload.productsData, payload.orderPrice);
|
16
15
|
}
|
17
16
|
}
|
18
17
|
};
|
@@ -1,12 +1,9 @@
|
|
1
1
|
import { mapProducts } from '../utils';
|
2
|
-
|
3
|
-
"@swc/helpers - typeof";
|
4
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
5
|
-
};
|
2
|
+
import { canUseDOM } from '../../../index';
|
6
3
|
export var usePixelViewBasket = function() {
|
7
4
|
var sendViewBasketEvent = function(data) {
|
8
5
|
var payload = mapProducts(data);
|
9
|
-
if ((
|
6
|
+
if (canUseDOM()) {
|
10
7
|
var pixel = window.pixel;
|
11
8
|
if (payload) {
|
12
9
|
pixel === null || pixel === void 0 ? void 0 : pixel.viewBasket(payload);
|
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
"@swc/helpers - typeof";
|
3
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
4
|
-
};
|
1
|
+
import { canUseDOM } from '../../../index';
|
5
2
|
export var usePixelViewCategory = function() {
|
6
3
|
var sendViewCategoryEvent = function(breadcrumbData) {
|
7
4
|
var breadcrumbString = breadcrumbData.reduce(function(res, curr, index) {
|
@@ -11,7 +8,7 @@ export var usePixelViewCategory = function() {
|
|
11
8
|
}
|
12
9
|
return res;
|
13
10
|
}, '');
|
14
|
-
if ((
|
11
|
+
if (canUseDOM()) {
|
15
12
|
var pixel = window.pixel;
|
16
13
|
if (breadcrumbString) {
|
17
14
|
pixel === null || pixel === void 0 ? void 0 : pixel.viewCategory(breadcrumbString);
|
@@ -3,12 +3,8 @@ import Router from 'next/router';
|
|
3
3
|
import { useConfigState } from '../../index';
|
4
4
|
import { getBasketId } from '../Releva/utils';
|
5
5
|
import { canUseDOM } from '../../utils';
|
6
|
-
var _typeof = function(obj) {
|
7
|
-
"@swc/helpers - typeof";
|
8
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
9
|
-
};
|
10
6
|
export var pixelChangeRoute = function() {
|
11
|
-
if ((
|
7
|
+
if (canUseDOM()) {
|
12
8
|
var pixel = window.pixel;
|
13
9
|
var title = window.document.title;
|
14
10
|
if (!title || title === 'за') {
|
@@ -2,7 +2,7 @@ export var mapProducts = function(data) {
|
|
2
2
|
var mapped = data === null || data === void 0 ? void 0 : data.reduce(function(res, cur) {
|
3
3
|
var ref, ref1;
|
4
4
|
res.push({
|
5
|
-
|
5
|
+
sku: cur.variant.sku,
|
6
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
7
|
quantity: cur.quantity + ''
|
8
8
|
});
|
@@ -53,12 +53,15 @@ export function ProductProvider(param) {
|
|
53
53
|
product === null || product === void 0 ? void 0 : product.name,
|
54
54
|
product === null || product === void 0 ? void 0 : product.slug,
|
55
55
|
product === null || product === void 0 ? void 0 : product.assets,
|
56
|
-
selectedVariant,
|
56
|
+
selectedVariant,
|
57
|
+
product === null || product === void 0 ? void 0 : product.categories,
|
58
|
+
includeBrandInName,
|
59
|
+
product === null || product === void 0 ? void 0 : product.reviewRatingStatistics,
|
57
60
|
]);
|
58
61
|
var seoData = React.useMemo(function() {
|
59
62
|
var ref, ref39, ref40;
|
60
63
|
var title = getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.metaTitle) || getTranslatableField(product === null || product === void 0 ? void 0 : product.metaTitle);
|
61
|
-
var brandName = product === null || product === void 0 ? void 0 : (ref = product.brands) === null || ref === void 0 ? void 0 : (ref39 = ref[0]) === null || ref39 === void 0 ? void 0 : (ref40 = ref39.resource) === null || ref40 === void 0 ? void 0 : ref40.name;
|
64
|
+
var brandName = getTranslatableField(product === null || product === void 0 ? void 0 : (ref = product.brands) === null || ref === void 0 ? void 0 : (ref39 = ref[0]) === null || ref39 === void 0 ? void 0 : (ref40 = ref39.resource) === null || ref40 === void 0 ? void 0 : ref40.name);
|
62
65
|
var seoObj = {
|
63
66
|
title: includeBrandInName && brandName ? "".concat(brandName, " ").concat(title) : title,
|
64
67
|
description: getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.metaDescription) || getTranslatableField(product === null || product === void 0 ? void 0 : product.metaDescription),
|
@@ -69,7 +72,9 @@ export function ProductProvider(param) {
|
|
69
72
|
product === null || product === void 0 ? void 0 : product.metaDescription,
|
70
73
|
product === null || product === void 0 ? void 0 : product.metaKeywords,
|
71
74
|
product === null || product === void 0 ? void 0 : product.metaTitle,
|
72
|
-
selectedVariant,
|
75
|
+
selectedVariant,
|
76
|
+
product === null || product === void 0 ? void 0 : product.brands,
|
77
|
+
includeBrandInName,
|
73
78
|
]);
|
74
79
|
var collapsedImages = createCollapseKeyImagesMap(product);
|
75
80
|
var state = {
|
@@ -8,11 +8,12 @@ export interface ProductsImpressionType {
|
|
8
8
|
products?: ProductType[] | SearchResultDTO[];
|
9
9
|
}
|
10
10
|
export interface Products {
|
11
|
-
|
11
|
+
sku: string;
|
12
12
|
price: string;
|
13
13
|
quantity: string;
|
14
14
|
}
|
15
15
|
export interface OrderType {
|
16
16
|
orderId: string;
|
17
17
|
productsData: Products[];
|
18
|
+
orderPrice: string;
|
18
19
|
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sentecacommerce-theme/lib",
|
3
3
|
"sideEffects": false,
|
4
|
-
"version": "0.13.
|
4
|
+
"version": "0.13.12",
|
5
5
|
"main": "dist/cjs/index.js",
|
6
6
|
"module": "dist/esm/index.js",
|
7
7
|
"types": "dist/types/index.d.ts",
|
@@ -31,13 +31,13 @@
|
|
31
31
|
"watch:cjs": "swc src --out-dir dist/cjs -w",
|
32
32
|
"watch:esm": "swc src --out-dir dist/esm --no-swcrc -w"
|
33
33
|
},
|
34
|
-
"gitHead": "
|
34
|
+
"gitHead": "1b0787f223a54c08f263c5207a6760fb5c9dc81c",
|
35
35
|
"peerDependencies": {
|
36
36
|
"react-query": "^2.26.2"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
|
-
"@sentecacommerce-theme/base": "^0.13.
|
40
|
-
"@sentecacommerce-theme/cms": "^0.13.
|
39
|
+
"@sentecacommerce-theme/base": "^0.13.12",
|
40
|
+
"@sentecacommerce-theme/cms": "^0.13.12",
|
41
41
|
"@sentecacommerce/sdk": "2.0.175",
|
42
42
|
"body-scroll-lock": "^3.1.5",
|
43
43
|
"copy-to-clipboard": "^3.3.1",
|