@sentecacommerce-theme/lib 0.13.11 → 0.13.14
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/cjs/listing/hooks/useListingCategories.js +5 -1
- package/dist/cjs/listing/utils/buildCategoryQuery.js +20 -11
- package/dist/cjs/seo/components/ProductSEO/index.js +17 -1
- 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/esm/listing/hooks/useListingCategories.js +5 -1
- package/dist/esm/listing/utils/buildCategoryQuery.js +20 -11
- package/dist/esm/seo/components/ProductSEO/index.js +8 -2
- package/dist/types/analytics/Pixel/types.d.ts +2 -1
- package/dist/types/seo/components/ProductSEO/index.d.ts +0 -11
- 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 = {
|
@@ -34,8 +34,8 @@ function _objectSpread(target) {
|
|
34
34
|
}
|
35
35
|
var buildCategoryQuery = function(param) {
|
36
36
|
var aggregates = param.aggregates, predicate = param.predicate, postFilter = param.postFilter, pageType = param.pageType, config = param.config, router = param.router, slug = param.slug;
|
37
|
-
var
|
38
|
-
var type = (aggregates === null || aggregates === void 0 ? void 0 : (
|
37
|
+
var ref3, ref1;
|
38
|
+
var type = (aggregates === null || aggregates === void 0 ? void 0 : (ref3 = aggregates[0]) === null || ref3 === void 0 ? void 0 : ref3.aggregationType) || '';
|
39
39
|
var term = (aggregates === null || aggregates === void 0 ? void 0 : (ref1 = aggregates[0]) === null || ref1 === void 0 ? void 0 : ref1.aggregationDefinition) || '';
|
40
40
|
var aggValue = getAggValue({
|
41
41
|
id: predicate === null || predicate === void 0 ? void 0 : predicate._id,
|
@@ -45,15 +45,6 @@ var buildCategoryQuery = function(param) {
|
|
45
45
|
var filter = '';
|
46
46
|
switch(pageType){
|
47
47
|
case _index.ListingTypesEnum.Brand:
|
48
|
-
filter += "brand;eq;\"".concat(predicate === null || predicate === void 0 ? void 0 : predicate._id, "\"").concat(applyBrandsPostFilter({
|
49
|
-
postFilter: postFilter
|
50
|
-
}));
|
51
|
-
if (router.query.cat) filter += '&' + (0, _extendFilter).extendFilter({
|
52
|
-
slug: slug,
|
53
|
-
filterExtension: config === null || config === void 0 ? void 0 : config.filterExtension
|
54
|
-
});
|
55
|
-
break;
|
56
|
-
case _index.ListingTypesEnum.Category:
|
57
48
|
if (router.query.cat) {
|
58
49
|
filter += (0, _extendFilter).extendFilter({
|
59
50
|
slug: slug,
|
@@ -63,6 +54,24 @@ var buildCategoryQuery = function(param) {
|
|
63
54
|
var ref;
|
64
55
|
filter += (ref = config === null || config === void 0 ? void 0 : config.filterExtension) !== null && ref !== void 0 ? ref : '';
|
65
56
|
}
|
57
|
+
if (postFilter) {
|
58
|
+
if (filter) filter += '&';
|
59
|
+
// Note: We can't filter the category tree by a category
|
60
|
+
filter += postFilter.split('&').filter(function(f) {
|
61
|
+
return !f.includes('category');
|
62
|
+
}).join('&');
|
63
|
+
}
|
64
|
+
break;
|
65
|
+
case _index.ListingTypesEnum.Category:
|
66
|
+
if (router.query.cat) {
|
67
|
+
filter += (0, _extendFilter).extendFilter({
|
68
|
+
slug: slug,
|
69
|
+
filterExtension: config === null || config === void 0 ? void 0 : config.filterExtension
|
70
|
+
});
|
71
|
+
} else {
|
72
|
+
var ref2;
|
73
|
+
filter += (ref2 = config === null || config === void 0 ? void 0 : config.filterExtension) !== null && ref2 !== void 0 ? ref2 : '';
|
74
|
+
}
|
66
75
|
if (postFilter) {
|
67
76
|
if (filter) filter += '&';
|
68
77
|
filter += postFilter;
|
@@ -16,12 +16,28 @@ function _interopRequireDefault(obj) {
|
|
16
16
|
default: obj
|
17
17
|
};
|
18
18
|
}
|
19
|
+
/**
|
20
|
+
* Template Options:
|
21
|
+
* :title: -> is going to be replace with the title
|
22
|
+
* :name: -> is going to be replace with the name
|
23
|
+
* :description: -> is going to be replace with the description
|
24
|
+
* :category: -> is going to be replace with the category
|
25
|
+
* :price: -> is going to be replace with the price
|
26
|
+
* :quantity: -> is going to be replace with the quantity
|
27
|
+
* :brand: -> is going to be replace with the brand
|
28
|
+
*
|
29
|
+
*/ var truncateToCharLength = function(text, maxLenChars) {
|
30
|
+
var separator = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ' ';
|
31
|
+
var cut = text.indexOf(separator, maxLenChars);
|
32
|
+
if (cut === -1) return text;
|
33
|
+
return text.substring(0, cut);
|
34
|
+
};
|
19
35
|
function ProductSEO() {
|
20
36
|
var ref16 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _favorTitleTemplateOverMeta = ref16.favorTitleTemplateOverMeta, favorTitleTemplateOverMeta = _favorTitleTemplateOverMeta === void 0 ? false : _favorTitleTemplateOverMeta, _favorDescriptionTemplateOverMeta = ref16.favorDescriptionTemplateOverMeta, favorDescriptionTemplateOverMeta = _favorDescriptionTemplateOverMeta === void 0 ? false : _favorDescriptionTemplateOverMeta, _titleTemplate = ref16.titleTemplate, titleTemplate = _titleTemplate === void 0 ? ':title:' : _titleTemplate, _descriptionTemplate = ref16.descriptionTemplate, descriptionTemplate = _descriptionTemplate === void 0 ? ':description:' : _descriptionTemplate;
|
21
37
|
var ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12, ref13, ref14;
|
22
38
|
var ref15 = (0, _useProduct).useProductState(), selectedVariant = ref15.selectedVariant, metaData = ref15.metaData, seoData = ref15.seoData;
|
23
39
|
var domain = (0, _useConfig).useConfigState().domain;
|
24
|
-
var description = (0, _utils).escape(seoData.description || metaData.shortDescription || metaData.description || '');
|
40
|
+
var description = (0, _utils).escape(seoData.description || metaData.shortDescription || truncateToCharLength(metaData === null || metaData === void 0 ? void 0 : metaData.description, 200) || '');
|
25
41
|
var title = seoData.title || metaData.name || '';
|
26
42
|
var price = (0, _usePrice).usePrice({
|
27
43
|
price: selectedVariant === null || selectedVariant === void 0 ? void 0 : (ref1 = selectedVariant.offer) === null || ref1 === void 0 ? void 0 : ref1.originalPrice
|
@@ -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 = {
|
@@ -30,8 +30,8 @@ function _objectSpread(target) {
|
|
30
30
|
}
|
31
31
|
export var buildCategoryQuery = function(param) {
|
32
32
|
var aggregates = param.aggregates, predicate = param.predicate, postFilter = param.postFilter, pageType = param.pageType, config = param.config, router = param.router, slug = param.slug;
|
33
|
-
var
|
34
|
-
var type = (aggregates === null || aggregates === void 0 ? void 0 : (
|
33
|
+
var ref3, ref1;
|
34
|
+
var type = (aggregates === null || aggregates === void 0 ? void 0 : (ref3 = aggregates[0]) === null || ref3 === void 0 ? void 0 : ref3.aggregationType) || '';
|
35
35
|
var term = (aggregates === null || aggregates === void 0 ? void 0 : (ref1 = aggregates[0]) === null || ref1 === void 0 ? void 0 : ref1.aggregationDefinition) || '';
|
36
36
|
var aggValue = getAggValue({
|
37
37
|
id: predicate === null || predicate === void 0 ? void 0 : predicate._id,
|
@@ -41,15 +41,6 @@ export var buildCategoryQuery = function(param) {
|
|
41
41
|
var filter = '';
|
42
42
|
switch(pageType){
|
43
43
|
case ListingTypesEnum.Brand:
|
44
|
-
filter += "brand;eq;\"".concat(predicate === null || predicate === void 0 ? void 0 : predicate._id, "\"").concat(applyBrandsPostFilter({
|
45
|
-
postFilter: postFilter
|
46
|
-
}));
|
47
|
-
if (router.query.cat) filter += '&' + extendFilter({
|
48
|
-
slug: slug,
|
49
|
-
filterExtension: config === null || config === void 0 ? void 0 : config.filterExtension
|
50
|
-
});
|
51
|
-
break;
|
52
|
-
case ListingTypesEnum.Category:
|
53
44
|
if (router.query.cat) {
|
54
45
|
filter += extendFilter({
|
55
46
|
slug: slug,
|
@@ -59,6 +50,24 @@ export var buildCategoryQuery = function(param) {
|
|
59
50
|
var ref;
|
60
51
|
filter += (ref = config === null || config === void 0 ? void 0 : config.filterExtension) !== null && ref !== void 0 ? ref : '';
|
61
52
|
}
|
53
|
+
if (postFilter) {
|
54
|
+
if (filter) filter += '&';
|
55
|
+
// Note: We can't filter the category tree by a category
|
56
|
+
filter += postFilter.split('&').filter(function(f) {
|
57
|
+
return !f.includes('category');
|
58
|
+
}).join('&');
|
59
|
+
}
|
60
|
+
break;
|
61
|
+
case ListingTypesEnum.Category:
|
62
|
+
if (router.query.cat) {
|
63
|
+
filter += extendFilter({
|
64
|
+
slug: slug,
|
65
|
+
filterExtension: config === null || config === void 0 ? void 0 : config.filterExtension
|
66
|
+
});
|
67
|
+
} else {
|
68
|
+
var ref2;
|
69
|
+
filter += (ref2 = config === null || config === void 0 ? void 0 : config.filterExtension) !== null && ref2 !== void 0 ? ref2 : '';
|
70
|
+
}
|
62
71
|
if (postFilter) {
|
63
72
|
if (filter) filter += '&';
|
64
73
|
filter += postFilter;
|
@@ -16,12 +16,18 @@ import { useConfigState } from '../../../hooks/useConfig';
|
|
16
16
|
* :quantity: -> is going to be replace with the quantity
|
17
17
|
* :brand: -> is going to be replace with the brand
|
18
18
|
*
|
19
|
-
*/
|
19
|
+
*/ var truncateToCharLength = function(text, maxLenChars) {
|
20
|
+
var separator = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ' ';
|
21
|
+
var cut = text.indexOf(separator, maxLenChars);
|
22
|
+
if (cut === -1) return text;
|
23
|
+
return text.substring(0, cut);
|
24
|
+
};
|
25
|
+
export function ProductSEO() {
|
20
26
|
var ref16 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _favorTitleTemplateOverMeta = ref16.favorTitleTemplateOverMeta, favorTitleTemplateOverMeta = _favorTitleTemplateOverMeta === void 0 ? false : _favorTitleTemplateOverMeta, _favorDescriptionTemplateOverMeta = ref16.favorDescriptionTemplateOverMeta, favorDescriptionTemplateOverMeta = _favorDescriptionTemplateOverMeta === void 0 ? false : _favorDescriptionTemplateOverMeta, _titleTemplate = ref16.titleTemplate, titleTemplate = _titleTemplate === void 0 ? ':title:' : _titleTemplate, _descriptionTemplate = ref16.descriptionTemplate, descriptionTemplate = _descriptionTemplate === void 0 ? ':description:' : _descriptionTemplate;
|
21
27
|
var ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12, ref13, ref14;
|
22
28
|
var ref15 = useProductState(), selectedVariant = ref15.selectedVariant, metaData = ref15.metaData, seoData = ref15.seoData;
|
23
29
|
var domain = useConfigState().domain;
|
24
|
-
var description = escape(seoData.description || metaData.shortDescription || metaData.description || '');
|
30
|
+
var description = escape(seoData.description || metaData.shortDescription || truncateToCharLength(metaData === null || metaData === void 0 ? void 0 : metaData.description, 200) || '');
|
25
31
|
var title = seoData.title || metaData.name || '';
|
26
32
|
var price = usePrice({
|
27
33
|
price: selectedVariant === null || selectedVariant === void 0 ? void 0 : (ref1 = selectedVariant.offer) === null || ref1 === void 0 ? void 0 : ref1.originalPrice
|
@@ -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
|
}
|
@@ -1,14 +1,3 @@
|
|
1
|
-
/**
|
2
|
-
* Template Options:
|
3
|
-
* :title: -> is going to be replace with the title
|
4
|
-
* :name: -> is going to be replace with the name
|
5
|
-
* :description: -> is going to be replace with the description
|
6
|
-
* :category: -> is going to be replace with the category
|
7
|
-
* :price: -> is going to be replace with the price
|
8
|
-
* :quantity: -> is going to be replace with the quantity
|
9
|
-
* :brand: -> is going to be replace with the brand
|
10
|
-
*
|
11
|
-
*/
|
12
1
|
export declare function ProductSEO({ favorTitleTemplateOverMeta, favorDescriptionTemplateOverMeta, titleTemplate, descriptionTemplate, }?: {
|
13
2
|
favorTitleTemplateOverMeta?: boolean;
|
14
3
|
favorDescriptionTemplateOverMeta?: boolean;
|
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.14",
|
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": "f19a5ed8fb202ed5a9ccf126b7fe5f5551dab401",
|
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.14",
|
40
|
+
"@sentecacommerce-theme/cms": "^0.13.14",
|
41
41
|
"@sentecacommerce/sdk": "2.0.175",
|
42
42
|
"body-scroll-lock": "^3.1.5",
|
43
43
|
"copy-to-clipboard": "^3.3.1",
|