@sentecacommerce-theme/lib 0.13.8 → 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/api/myCartApi/index.js +10 -8
- package/dist/cjs/hooks/basket-hooks/useBasket/index.js +5 -3
- package/dist/cjs/hooks/useLineItem/LineItemContext.js +3 -2
- package/dist/cjs/hooks/useProduct/index.js +10 -4
- package/dist/cjs/hooks/useProductVariants/index.js +17 -1
- package/dist/cjs/listing/hooks/useListingFilters.js +10 -3
- package/dist/cjs/seo/utils/handleRobots.js +6 -5
- 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/api/myCartApi/index.js +10 -8
- package/dist/esm/hooks/basket-hooks/useBasket/index.js +5 -3
- package/dist/esm/hooks/useLineItem/LineItemContext.js +3 -2
- package/dist/esm/hooks/useProduct/index.js +10 -4
- package/dist/esm/hooks/useProductVariants/index.js +17 -1
- package/dist/esm/listing/hooks/useListingFilters.js +10 -3
- package/dist/esm/seo/utils/handleRobots.js +6 -5
- package/dist/types/analytics/Pixel/types.d.ts +2 -1
- package/dist/types/api/myCartApi/index.d.ts +2 -0
- package/dist/types/hooks/basket-hooks/useBasket/index.d.ts +2 -1
- package/dist/types/hooks/useLineItem/LineItemContext.d.ts +2 -1
- package/dist/types/hooks/useProduct/index.d.ts +2 -1
- package/dist/types/hooks/useProductVariants/index.d.ts +2 -0
- 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
|
});
|
@@ -346,24 +346,25 @@ var MyCartApiFactory = function() {
|
|
346
346
|
var queryCache = (0, _reactQuery).useQueryCache();
|
347
347
|
return (0, _reactQuery).useMutation(function() {
|
348
348
|
var _ref = _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee(values) {
|
349
|
-
var cart, compactCart, lineItemId, lineItems;
|
349
|
+
var cart, compactCart, ref, lineItemId, lineItems;
|
350
350
|
return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
|
351
351
|
while(1)switch(_ctx.prev = _ctx.next){
|
352
352
|
case 0:
|
353
353
|
cart = queryCache.getQueryData(myCartCacheKeys.useGet);
|
354
354
|
compactCart = queryCache.getQueryData(myCartCacheKeys.useGetCompact);
|
355
|
-
|
355
|
+
;
|
356
|
+
lineItemId = (ref = values === null || values === void 0 ? void 0 : values.lineItemId) !== null && ref !== void 0 ? ref : (0, _utils1).getLineItemId({
|
356
357
|
collapseKey: values === null || values === void 0 ? void 0 : values.collapseKey,
|
357
358
|
productId: values === null || values === void 0 ? void 0 : values.productId,
|
358
359
|
variantId: values === null || values === void 0 ? void 0 : values.variantId,
|
359
360
|
type: LineItemType.Regular
|
360
361
|
});
|
361
362
|
if (!(!cart || !compactCart)) {
|
362
|
-
_ctx.next =
|
363
|
+
_ctx.next = 6;
|
363
364
|
break;
|
364
365
|
}
|
365
366
|
return _ctx.abrupt("return", myCartApi1.deleteLineItem(lineItemId));
|
366
|
-
case
|
367
|
+
case 6:
|
367
368
|
lineItems = cart.lineItems.filter(function(product) {
|
368
369
|
return product._id !== lineItemId;
|
369
370
|
});
|
@@ -374,7 +375,7 @@ var MyCartApiFactory = function() {
|
|
374
375
|
lineItemsCount: ((compactCart === null || compactCart === void 0 ? void 0 : compactCart.lineItemsCount) || 1) - 1
|
375
376
|
}));
|
376
377
|
return _ctx.abrupt("return", myCartApi1.deleteLineItem(lineItemId));
|
377
|
-
case
|
378
|
+
case 10:
|
378
379
|
case "end":
|
379
380
|
return _ctx.stop();
|
380
381
|
}
|
@@ -440,18 +441,19 @@ var MyCartApiFactory = function() {
|
|
440
441
|
var queryCache = (0, _reactQuery).useQueryCache();
|
441
442
|
return (0, _reactQuery).useMutation(function() {
|
442
443
|
var _ref = _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee(values) {
|
443
|
-
var lineItemId;
|
444
|
+
var ref, lineItemId;
|
444
445
|
return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
|
445
446
|
while(1)switch(_ctx.prev = _ctx.next){
|
446
447
|
case 0:
|
447
|
-
|
448
|
+
;
|
449
|
+
lineItemId = (ref = values === null || values === void 0 ? void 0 : values.lineItemId) !== null && ref !== void 0 ? ref : (0, _utils1).getLineItemId({
|
448
450
|
collapseKey: values === null || values === void 0 ? void 0 : values.collapseKey,
|
449
451
|
productId: values === null || values === void 0 ? void 0 : values.productId,
|
450
452
|
variantId: values === null || values === void 0 ? void 0 : values.variantId,
|
451
453
|
type: LineItemType.Regular
|
452
454
|
});
|
453
455
|
return _ctx.abrupt("return", myCartApi1.setLineItemQuantity(lineItemId, values.dto));
|
454
|
-
case
|
456
|
+
case 3:
|
455
457
|
case "end":
|
456
458
|
return _ctx.stop();
|
457
459
|
}
|
@@ -51,7 +51,7 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
51
51
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
52
52
|
}
|
53
53
|
var useBasket = function(param) {
|
54
|
-
var productId = param.productId, variantId = param.variantId, collapseKey = param.collapseKey, offerId = param.offerId, quantity = param.quantity, selectedOptions = param.selectedOptions, onAddCallback = param.onAddCallback, onRemoveCallback = param.onRemoveCallback, onSetQuantityCallback = param.onSetQuantityCallback;
|
54
|
+
var productId = param.productId, variantId = param.variantId, collapseKey = param.collapseKey, offerId = param.offerId, lineItemId = param.lineItemId, quantity = param.quantity, selectedOptions = param.selectedOptions, onAddCallback = param.onAddCallback, onRemoveCallback = param.onRemoveCallback, onSetQuantityCallback = param.onSetQuantityCallback;
|
55
55
|
var ref, ref1, ref2;
|
56
56
|
var ref3 = _slicedToArray(_myCartApi.myCartApi.useRemove(onRemoveCallback), 1), remove = ref3[0];
|
57
57
|
var ref4 = _slicedToArray(_myCartApi.myCartApi.useAdd(onAddCallback), 2), add = ref4[0], ref5 = ref4[1], isAddLoading = ref5.isLoading;
|
@@ -79,7 +79,8 @@ var useBasket = function(param) {
|
|
79
79
|
var removeFromBasket = function() {
|
80
80
|
isExisting && remove({
|
81
81
|
productId: productId,
|
82
|
-
variantId: variantId
|
82
|
+
variantId: variantId,
|
83
|
+
lineItemId: lineItemId
|
83
84
|
});
|
84
85
|
};
|
85
86
|
var setLineItemQuantity = function(qty) {
|
@@ -88,7 +89,8 @@ var useBasket = function(param) {
|
|
88
89
|
quantity: qty
|
89
90
|
},
|
90
91
|
productId: productId,
|
91
|
-
variantId: variantId
|
92
|
+
variantId: variantId,
|
93
|
+
lineItemId: lineItemId
|
92
94
|
});
|
93
95
|
};
|
94
96
|
return {
|
@@ -48,7 +48,7 @@ function LineItemStateProvider(param) {
|
|
48
48
|
product: product,
|
49
49
|
defaultVariantId: product.variantId,
|
50
50
|
isLineItem: true
|
51
|
-
}), variants = ref.variants, selectedVariant = ref.selectedVariant, getVariantById = ref.getVariantById, getVariantByAttribute = ref.getVariantByAttribute, getVariantByCombination = ref.getVariantByCombination, selectVariantById = ref.selectVariantById, selectVariantByAttribute = ref.selectVariantByAttribute, selectVariantByCombination = ref.selectVariantByCombination;
|
51
|
+
}), variants = ref.variants, selectedVariant = ref.selectedVariant, getVariantById = ref.getVariantById, getVariantByAttribute = ref.getVariantByAttribute, getVariantByCombination = ref.getVariantByCombination, selectVariantById = ref.selectVariantById, selectVariantByAttribute = ref.selectVariantByAttribute, selectVariantByCombination = ref.selectVariantByCombination, getAllPossibleSizesForCurrentVariant = ref.getAllPossibleSizesForCurrentVariant;
|
52
52
|
var state = {
|
53
53
|
variants: variants,
|
54
54
|
selectedVariant: _objectSpread({}, selectedVariant, {
|
@@ -62,7 +62,8 @@ function LineItemStateProvider(param) {
|
|
62
62
|
getVariantByCombination: getVariantByCombination,
|
63
63
|
selectVariantById: selectVariantById,
|
64
64
|
selectVariantByAttribute: selectVariantByAttribute,
|
65
|
-
selectVariantByCombination: selectVariantByCombination
|
65
|
+
selectVariantByCombination: selectVariantByCombination,
|
66
|
+
getAllPossibleSizesForCurrentVariant: getAllPossibleSizesForCurrentVariant
|
66
67
|
};
|
67
68
|
return(/*#__PURE__*/ _react.default.createElement(LineItemStateContext.Provider, {
|
68
69
|
value: state
|
@@ -23,7 +23,7 @@ function ProductProvider(param) {
|
|
23
23
|
var ref38 = (0, _useProductVariants).useProductVariants({
|
24
24
|
product: product,
|
25
25
|
defaultVariantId: defaultVariantId
|
26
|
-
}), selectedVariant = ref38.selectedVariant, attributeRules = ref38.attributeRules, variants = ref38.variants, getVariantById = ref38.getVariantById, getVariantByAttribute = ref38.getVariantByAttribute, getVariantByCombination = ref38.getVariantByCombination, getCustomFieldValue = ref38.getCustomFieldValue, getCombinationsForAttributeRule = ref38.getCombinationsForAttributeRule, selectVariantById = ref38.selectVariantById, selectVariantByAttribute = ref38.selectVariantByAttribute, selectVariantByCombination = ref38.selectVariantByCombination, selectVariantOptions = ref38.selectVariantOptions;
|
26
|
+
}), selectedVariant = ref38.selectedVariant, attributeRules = ref38.attributeRules, variants = ref38.variants, getVariantById = ref38.getVariantById, getVariantByAttribute = ref38.getVariantByAttribute, getVariantByCombination = ref38.getVariantByCombination, getCustomFieldValue = ref38.getCustomFieldValue, getCombinationsForAttributeRule = ref38.getCombinationsForAttributeRule, selectVariantById = ref38.selectVariantById, selectVariantByAttribute = ref38.selectVariantByAttribute, getAllPossibleSizesForCurrentVariant = ref38.getAllPossibleSizesForCurrentVariant, selectVariantByCombination = ref38.selectVariantByCombination, selectVariantOptions = ref38.selectVariantOptions;
|
27
27
|
var metaData = _react.default.useMemo(function() {
|
28
28
|
var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12, ref13, ref14, ref15, ref16, ref17, ref18, ref19, ref20, ref21, ref22, ref23, ref24, ref25, ref26, ref27, ref28, ref29, ref30, ref31, ref32, ref33, ref34, ref35, ref36, ref37;
|
29
29
|
var rootCategory = product === null || product === void 0 ? void 0 : (ref = product.categories) === null || ref === void 0 ? void 0 : ref[0];
|
@@ -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 = {
|
@@ -99,6 +104,7 @@ function ProductProvider(param) {
|
|
99
104
|
selectVariantById: selectVariantById,
|
100
105
|
selectVariantByAttribute: selectVariantByAttribute,
|
101
106
|
selectVariantByCombination: selectVariantByCombination,
|
107
|
+
getAllPossibleSizesForCurrentVariant: getAllPossibleSizesForCurrentVariant,
|
102
108
|
getCombinationsForAttributeRule: getCombinationsForAttributeRule,
|
103
109
|
selectVariantOptions: selectVariantOptions,
|
104
110
|
getCustomFieldValue: getCustomFieldValue,
|
@@ -222,6 +222,21 @@ var useProductVariants = function(param) {
|
|
222
222
|
function selectVariantById(id) {
|
223
223
|
setSelectedVariant(variants[id]);
|
224
224
|
}
|
225
|
+
function getAllPossibleSizesForCurrentVariant(key) {
|
226
|
+
var split = key.split(':');
|
227
|
+
if (split[0] === 'collapseKey') {
|
228
|
+
var currentProduct = Object.keys(variants).filter(function(el) {
|
229
|
+
return variants[el].collapseKey === split[1];
|
230
|
+
}) || '';
|
231
|
+
return currentProduct.reduce(function(res, cur) {
|
232
|
+
res.push(variants[cur].attributes.find(function(a) {
|
233
|
+
return a.name === 'size';
|
234
|
+
}));
|
235
|
+
return res;
|
236
|
+
}, []);
|
237
|
+
}
|
238
|
+
return [];
|
239
|
+
}
|
225
240
|
function selectVariantByCombination(key, value) {
|
226
241
|
// Take collapseKey for SD
|
227
242
|
var split = value.split(':');
|
@@ -328,7 +343,8 @@ var useProductVariants = function(param) {
|
|
328
343
|
selectVariantByAttribute: selectVariantByAttribute,
|
329
344
|
selectVariantByCombination: selectVariantByCombination,
|
330
345
|
selectVariantOptions: selectVariantOptions,
|
331
|
-
selectVariantById: selectVariantById
|
346
|
+
selectVariantById: selectVariantById,
|
347
|
+
getAllPossibleSizesForCurrentVariant: getAllPossibleSizesForCurrentVariant
|
332
348
|
};
|
333
349
|
};
|
334
350
|
exports.useProductVariants = useProductVariants;
|
@@ -272,10 +272,17 @@ var generateQueryString = function(query, pair, remove) {
|
|
272
272
|
}
|
273
273
|
});
|
274
274
|
if (remove) {
|
275
|
-
var applied = activeFilters[pair.aggType].split(';')[2].split(',');
|
276
|
-
|
277
|
-
return
|
275
|
+
var applied = pair.aggType !== 'price' ? activeFilters[pair.aggType].split(';')[2].split(',') : activeFilters[pair.aggType].split(';')[2].split(',')// split into chunks of 2
|
276
|
+
.map(function(_, i, list) {
|
277
|
+
return list.slice(i * 2, i * 2 + 2);
|
278
|
+
})// filter out inner array (array of chunks) if no chunks
|
279
|
+
.filter(function(el) {
|
280
|
+
return el.length;
|
278
281
|
});
|
282
|
+
var remaining = applied.filter(function(x) {
|
283
|
+
// array if pair.aggType === 'price', otherwise string
|
284
|
+
return pair.aggKey !== (Array.isArray(x) ? x.join(',') : x);
|
285
|
+
}).flat();
|
279
286
|
if (remaining.length === 0) {
|
280
287
|
activeFilters[pair.aggType] = "";
|
281
288
|
} else {
|
@@ -42,7 +42,7 @@ function handleRobots(res, domain) {
|
|
42
42
|
}
|
43
43
|
function _handleRobots() {
|
44
44
|
_handleRobots = _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee(res, domain) {
|
45
|
-
var disallowed, txt, _args = arguments;
|
45
|
+
var disallowed, siteMapUrl, txt, _args = arguments;
|
46
46
|
return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
|
47
47
|
while(1)switch(_ctx.prev = _ctx.next){
|
48
48
|
case 0:
|
@@ -53,18 +53,19 @@ function _handleRobots() {
|
|
53
53
|
'/profile',
|
54
54
|
'/favorites'
|
55
55
|
];
|
56
|
+
siteMapUrl = "https://".concat(domain, "sitemap.xml");
|
56
57
|
if (!(process.env.NO_INDEX === 'true')) {
|
57
|
-
_ctx.next =
|
58
|
+
_ctx.next = 5;
|
58
59
|
break;
|
59
60
|
}
|
60
61
|
res.status(200).send('User-agent: *\nDisallow: /');
|
61
62
|
return _ctx.abrupt("return");
|
62
|
-
case
|
63
|
+
case 5:
|
63
64
|
txt = disallowed.reduce(function(value, str) {
|
64
65
|
return value + "Disallow: ".concat(str, "\n");
|
65
|
-
}, "Sitemap: ".concat(
|
66
|
+
}, "Sitemap: ".concat(siteMapUrl, "\nUser-agent: *\n"));
|
66
67
|
res.status(200).send(txt);
|
67
|
-
case
|
68
|
+
case 7:
|
68
69
|
case "end":
|
69
70
|
return _ctx.stop();
|
70
71
|
}
|
@@ -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
|
});
|
@@ -333,24 +333,25 @@ export var MyCartApiFactory = function() {
|
|
333
333
|
var queryCache = useQueryCache();
|
334
334
|
return useMutation(function() {
|
335
335
|
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(values) {
|
336
|
-
var cart, compactCart, lineItemId, lineItems;
|
336
|
+
var cart, compactCart, ref, lineItemId, lineItems;
|
337
337
|
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
338
338
|
while(1)switch(_ctx.prev = _ctx.next){
|
339
339
|
case 0:
|
340
340
|
cart = queryCache.getQueryData(myCartCacheKeys.useGet);
|
341
341
|
compactCart = queryCache.getQueryData(myCartCacheKeys.useGetCompact);
|
342
|
-
|
342
|
+
;
|
343
|
+
lineItemId = (ref = values === null || values === void 0 ? void 0 : values.lineItemId) !== null && ref !== void 0 ? ref : getLineItemId({
|
343
344
|
collapseKey: values === null || values === void 0 ? void 0 : values.collapseKey,
|
344
345
|
productId: values === null || values === void 0 ? void 0 : values.productId,
|
345
346
|
variantId: values === null || values === void 0 ? void 0 : values.variantId,
|
346
347
|
type: LineItemType.Regular
|
347
348
|
});
|
348
349
|
if (!(!cart || !compactCart)) {
|
349
|
-
_ctx.next =
|
350
|
+
_ctx.next = 6;
|
350
351
|
break;
|
351
352
|
}
|
352
353
|
return _ctx.abrupt("return", myCartApi1.deleteLineItem(lineItemId));
|
353
|
-
case
|
354
|
+
case 6:
|
354
355
|
lineItems = cart.lineItems.filter(function(product) {
|
355
356
|
return product._id !== lineItemId;
|
356
357
|
});
|
@@ -361,7 +362,7 @@ export var MyCartApiFactory = function() {
|
|
361
362
|
lineItemsCount: ((compactCart === null || compactCart === void 0 ? void 0 : compactCart.lineItemsCount) || 1) - 1
|
362
363
|
}));
|
363
364
|
return _ctx.abrupt("return", myCartApi1.deleteLineItem(lineItemId));
|
364
|
-
case
|
365
|
+
case 10:
|
365
366
|
case "end":
|
366
367
|
return _ctx.stop();
|
367
368
|
}
|
@@ -427,18 +428,19 @@ export var MyCartApiFactory = function() {
|
|
427
428
|
var queryCache = useQueryCache();
|
428
429
|
return useMutation(function() {
|
429
430
|
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(values) {
|
430
|
-
var lineItemId;
|
431
|
+
var ref, lineItemId;
|
431
432
|
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
432
433
|
while(1)switch(_ctx.prev = _ctx.next){
|
433
434
|
case 0:
|
434
|
-
|
435
|
+
;
|
436
|
+
lineItemId = (ref = values === null || values === void 0 ? void 0 : values.lineItemId) !== null && ref !== void 0 ? ref : getLineItemId({
|
435
437
|
collapseKey: values === null || values === void 0 ? void 0 : values.collapseKey,
|
436
438
|
productId: values === null || values === void 0 ? void 0 : values.productId,
|
437
439
|
variantId: values === null || values === void 0 ? void 0 : values.variantId,
|
438
440
|
type: LineItemType.Regular
|
439
441
|
});
|
440
442
|
return _ctx.abrupt("return", myCartApi1.setLineItemQuantity(lineItemId, values.dto));
|
441
|
-
case
|
443
|
+
case 3:
|
442
444
|
case "end":
|
443
445
|
return _ctx.stop();
|
444
446
|
}
|
@@ -47,7 +47,7 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
47
47
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
48
48
|
}
|
49
49
|
export var useBasket = function(param) {
|
50
|
-
var productId = param.productId, variantId = param.variantId, collapseKey = param.collapseKey, offerId = param.offerId, quantity = param.quantity, selectedOptions = param.selectedOptions, onAddCallback = param.onAddCallback, onRemoveCallback = param.onRemoveCallback, onSetQuantityCallback = param.onSetQuantityCallback;
|
50
|
+
var productId = param.productId, variantId = param.variantId, collapseKey = param.collapseKey, offerId = param.offerId, lineItemId = param.lineItemId, quantity = param.quantity, selectedOptions = param.selectedOptions, onAddCallback = param.onAddCallback, onRemoveCallback = param.onRemoveCallback, onSetQuantityCallback = param.onSetQuantityCallback;
|
51
51
|
var ref, ref1, ref2;
|
52
52
|
var ref3 = _slicedToArray(myCartApi.useRemove(onRemoveCallback), 1), remove = ref3[0];
|
53
53
|
var ref4 = _slicedToArray(myCartApi.useAdd(onAddCallback), 2), add = ref4[0], ref5 = ref4[1], isAddLoading = ref5.isLoading;
|
@@ -75,7 +75,8 @@ export var useBasket = function(param) {
|
|
75
75
|
var removeFromBasket = function() {
|
76
76
|
isExisting && remove({
|
77
77
|
productId: productId,
|
78
|
-
variantId: variantId
|
78
|
+
variantId: variantId,
|
79
|
+
lineItemId: lineItemId
|
79
80
|
});
|
80
81
|
};
|
81
82
|
var setLineItemQuantity = function(qty) {
|
@@ -84,7 +85,8 @@ export var useBasket = function(param) {
|
|
84
85
|
quantity: qty
|
85
86
|
},
|
86
87
|
productId: productId,
|
87
|
-
variantId: variantId
|
88
|
+
variantId: variantId,
|
89
|
+
lineItemId: lineItemId
|
88
90
|
});
|
89
91
|
};
|
90
92
|
return {
|
@@ -37,7 +37,7 @@ export function LineItemStateProvider(param) {
|
|
37
37
|
product: product,
|
38
38
|
defaultVariantId: product.variantId,
|
39
39
|
isLineItem: true
|
40
|
-
}), variants = ref.variants, selectedVariant = ref.selectedVariant, getVariantById = ref.getVariantById, getVariantByAttribute = ref.getVariantByAttribute, getVariantByCombination = ref.getVariantByCombination, selectVariantById = ref.selectVariantById, selectVariantByAttribute = ref.selectVariantByAttribute, selectVariantByCombination = ref.selectVariantByCombination;
|
40
|
+
}), variants = ref.variants, selectedVariant = ref.selectedVariant, getVariantById = ref.getVariantById, getVariantByAttribute = ref.getVariantByAttribute, getVariantByCombination = ref.getVariantByCombination, selectVariantById = ref.selectVariantById, selectVariantByAttribute = ref.selectVariantByAttribute, selectVariantByCombination = ref.selectVariantByCombination, getAllPossibleSizesForCurrentVariant = ref.getAllPossibleSizesForCurrentVariant;
|
41
41
|
var state = {
|
42
42
|
variants: variants,
|
43
43
|
selectedVariant: _objectSpread({}, selectedVariant, {
|
@@ -51,7 +51,8 @@ export function LineItemStateProvider(param) {
|
|
51
51
|
getVariantByCombination: getVariantByCombination,
|
52
52
|
selectVariantById: selectVariantById,
|
53
53
|
selectVariantByAttribute: selectVariantByAttribute,
|
54
|
-
selectVariantByCombination: selectVariantByCombination
|
54
|
+
selectVariantByCombination: selectVariantByCombination,
|
55
|
+
getAllPossibleSizesForCurrentVariant: getAllPossibleSizesForCurrentVariant
|
55
56
|
};
|
56
57
|
return(/*#__PURE__*/ React.createElement(LineItemStateContext.Provider, {
|
57
58
|
value: state
|
@@ -11,7 +11,7 @@ export function ProductProvider(param) {
|
|
11
11
|
var ref38 = useProductVariants({
|
12
12
|
product: product,
|
13
13
|
defaultVariantId: defaultVariantId
|
14
|
-
}), selectedVariant = ref38.selectedVariant, attributeRules = ref38.attributeRules, variants = ref38.variants, getVariantById = ref38.getVariantById, getVariantByAttribute = ref38.getVariantByAttribute, getVariantByCombination = ref38.getVariantByCombination, getCustomFieldValue = ref38.getCustomFieldValue, getCombinationsForAttributeRule = ref38.getCombinationsForAttributeRule, selectVariantById = ref38.selectVariantById, selectVariantByAttribute = ref38.selectVariantByAttribute, selectVariantByCombination = ref38.selectVariantByCombination, selectVariantOptions = ref38.selectVariantOptions;
|
14
|
+
}), selectedVariant = ref38.selectedVariant, attributeRules = ref38.attributeRules, variants = ref38.variants, getVariantById = ref38.getVariantById, getVariantByAttribute = ref38.getVariantByAttribute, getVariantByCombination = ref38.getVariantByCombination, getCustomFieldValue = ref38.getCustomFieldValue, getCombinationsForAttributeRule = ref38.getCombinationsForAttributeRule, selectVariantById = ref38.selectVariantById, selectVariantByAttribute = ref38.selectVariantByAttribute, getAllPossibleSizesForCurrentVariant = ref38.getAllPossibleSizesForCurrentVariant, selectVariantByCombination = ref38.selectVariantByCombination, selectVariantOptions = ref38.selectVariantOptions;
|
15
15
|
var metaData = React.useMemo(function() {
|
16
16
|
var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12, ref13, ref14, ref15, ref16, ref17, ref18, ref19, ref20, ref21, ref22, ref23, ref24, ref25, ref26, ref27, ref28, ref29, ref30, ref31, ref32, ref33, ref34, ref35, ref36, ref37;
|
17
17
|
var rootCategory = product === null || product === void 0 ? void 0 : (ref = product.categories) === null || ref === void 0 ? void 0 : ref[0];
|
@@ -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 = {
|
@@ -87,6 +92,7 @@ export function ProductProvider(param) {
|
|
87
92
|
selectVariantById: selectVariantById,
|
88
93
|
selectVariantByAttribute: selectVariantByAttribute,
|
89
94
|
selectVariantByCombination: selectVariantByCombination,
|
95
|
+
getAllPossibleSizesForCurrentVariant: getAllPossibleSizesForCurrentVariant,
|
90
96
|
getCombinationsForAttributeRule: getCombinationsForAttributeRule,
|
91
97
|
selectVariantOptions: selectVariantOptions,
|
92
98
|
getCustomFieldValue: getCustomFieldValue,
|
@@ -160,6 +160,21 @@ export var useProductVariants = function(param) {
|
|
160
160
|
var selectVariantById = function selectVariantById(id) {
|
161
161
|
setSelectedVariant(variants[id]);
|
162
162
|
};
|
163
|
+
var getAllPossibleSizesForCurrentVariant = function getAllPossibleSizesForCurrentVariant(key) {
|
164
|
+
var split = key.split(':');
|
165
|
+
if (split[0] === 'collapseKey') {
|
166
|
+
var currentProduct = Object.keys(variants).filter(function(el) {
|
167
|
+
return variants[el].collapseKey === split[1];
|
168
|
+
}) || '';
|
169
|
+
return currentProduct.reduce(function(res, cur) {
|
170
|
+
res.push(variants[cur].attributes.find(function(a) {
|
171
|
+
return a.name === 'size';
|
172
|
+
}));
|
173
|
+
return res;
|
174
|
+
}, []);
|
175
|
+
}
|
176
|
+
return [];
|
177
|
+
};
|
163
178
|
var selectVariantByCombination = function selectVariantByCombination(key, value) {
|
164
179
|
// Take collapseKey for SD
|
165
180
|
var split = value.split(':');
|
@@ -288,6 +303,7 @@ export var useProductVariants = function(param) {
|
|
288
303
|
selectVariantByAttribute: selectVariantByAttribute,
|
289
304
|
selectVariantByCombination: selectVariantByCombination,
|
290
305
|
selectVariantOptions: selectVariantOptions,
|
291
|
-
selectVariantById: selectVariantById
|
306
|
+
selectVariantById: selectVariantById,
|
307
|
+
getAllPossibleSizesForCurrentVariant: getAllPossibleSizesForCurrentVariant
|
292
308
|
};
|
293
309
|
};
|
@@ -260,10 +260,17 @@ var generateQueryString = function(query, pair, remove) {
|
|
260
260
|
}
|
261
261
|
});
|
262
262
|
if (remove) {
|
263
|
-
var applied = activeFilters[pair.aggType].split(';')[2].split(',');
|
264
|
-
|
265
|
-
return
|
263
|
+
var applied = pair.aggType !== 'price' ? activeFilters[pair.aggType].split(';')[2].split(',') : activeFilters[pair.aggType].split(';')[2].split(',')// split into chunks of 2
|
264
|
+
.map(function(_, i, list) {
|
265
|
+
return list.slice(i * 2, i * 2 + 2);
|
266
|
+
})// filter out inner array (array of chunks) if no chunks
|
267
|
+
.filter(function(el) {
|
268
|
+
return el.length;
|
266
269
|
});
|
270
|
+
var remaining = applied.filter(function(x) {
|
271
|
+
// array if pair.aggType === 'price', otherwise string
|
272
|
+
return pair.aggKey !== (Array.isArray(x) ? x.join(',') : x);
|
273
|
+
}).flat();
|
267
274
|
if (remaining.length === 0) {
|
268
275
|
activeFilters[pair.aggType] = "";
|
269
276
|
} else {
|
@@ -33,7 +33,7 @@ export function handleRobots(res, domain) {
|
|
33
33
|
}
|
34
34
|
function _handleRobots() {
|
35
35
|
_handleRobots = _asyncToGenerator(regeneratorRuntime.mark(function _callee(res, domain) {
|
36
|
-
var disallowed, txt, _args = arguments;
|
36
|
+
var disallowed, siteMapUrl, txt, _args = arguments;
|
37
37
|
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
38
38
|
while(1)switch(_ctx.prev = _ctx.next){
|
39
39
|
case 0:
|
@@ -44,18 +44,19 @@ function _handleRobots() {
|
|
44
44
|
'/profile',
|
45
45
|
'/favorites'
|
46
46
|
];
|
47
|
+
siteMapUrl = "https://".concat(domain, "sitemap.xml");
|
47
48
|
if (!(process.env.NO_INDEX === 'true')) {
|
48
|
-
_ctx.next =
|
49
|
+
_ctx.next = 5;
|
49
50
|
break;
|
50
51
|
}
|
51
52
|
res.status(200).send('User-agent: *\nDisallow: /');
|
52
53
|
return _ctx.abrupt("return");
|
53
|
-
case
|
54
|
+
case 5:
|
54
55
|
txt = disallowed.reduce(function(value, str) {
|
55
56
|
return value + "Disallow: ".concat(str, "\n");
|
56
|
-
}, "Sitemap: ".concat(
|
57
|
+
}, "Sitemap: ".concat(siteMapUrl, "\nUser-agent: *\n"));
|
57
58
|
res.status(200).send(txt);
|
58
|
-
case
|
59
|
+
case 7:
|
59
60
|
case "end":
|
60
61
|
return _ctx.stop();
|
61
62
|
}
|
@@ -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
|
}
|
@@ -35,6 +35,7 @@ declare type myCartApiType = {
|
|
35
35
|
}) => MutationResultPair<OrderDTO, unknown, LineItemDraftDTO, unknown>;
|
36
36
|
readonly useAddCustom: (onSuccess?: () => void) => MutationResultPair<OrderDTO, unknown, CustomLineItemDraftDTO, unknown>;
|
37
37
|
readonly useRemove: (onSuccess?: () => void) => MutationResultPair<OrderDTO, unknown, {
|
38
|
+
lineItemId?: string;
|
38
39
|
productId: string;
|
39
40
|
variantId?: string;
|
40
41
|
collapseKey?: string;
|
@@ -47,6 +48,7 @@ declare type myCartApiType = {
|
|
47
48
|
readonly useSetQuantity: (onSuccess?: () => void) => MutationResultPair<OrderDTO, unknown, {
|
48
49
|
productId: string;
|
49
50
|
variantId?: string;
|
51
|
+
lineItemId?: string;
|
50
52
|
dto: QuantityUpdateDTO;
|
51
53
|
collapseKey?: string;
|
52
54
|
}, unknown>;
|
@@ -7,11 +7,12 @@ declare type UseBasketProps = {
|
|
7
7
|
variantId: string;
|
8
8
|
collapseKey?: string;
|
9
9
|
quantity?: number;
|
10
|
+
lineItemId?: string;
|
10
11
|
onAddCallback?: () => void;
|
11
12
|
onRemoveCallback?: () => void;
|
12
13
|
onSetQuantityCallback?: () => void;
|
13
14
|
};
|
14
|
-
export declare const useBasket: ({ productId, variantId, collapseKey, offerId, quantity, selectedOptions, onAddCallback, onRemoveCallback, onSetQuantityCallback, }: UseBasketProps) => {
|
15
|
+
export declare const useBasket: ({ productId, variantId, collapseKey, offerId, lineItemId, quantity, selectedOptions, onAddCallback, onRemoveCallback, onSetQuantityCallback, }: UseBasketProps) => {
|
15
16
|
addToBasket: (qty: number) => void;
|
16
17
|
removeFromBasket: () => void;
|
17
18
|
setLineItemQuantity: (qty: number) => void;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { VariantMap, VariantType } from '../useProductVariants';
|
2
|
-
import { SearchResultDTO } from '@sentecacommerce/sdk';
|
2
|
+
import { ProductAttributeDraftDTO, SearchResultDTO } from '@sentecacommerce/sdk';
|
3
3
|
import { LineItemType } from '../../';
|
4
4
|
declare type LineItemStateContextType = {
|
5
5
|
variants?: VariantMap;
|
@@ -9,6 +9,7 @@ declare type CountFunctionsContextType = {
|
|
9
9
|
selectVariantById: (id: string) => void;
|
10
10
|
selectVariantByAttribute: (key: string) => void;
|
11
11
|
selectVariantByCombination: (key: string, value: string) => void;
|
12
|
+
getAllPossibleSizesForCurrentVariant: (key: string) => ProductAttributeDraftDTO[];
|
12
13
|
getVariantById: (id: string) => VariantType;
|
13
14
|
getVariantByAttribute: (key: string) => VariantType;
|
14
15
|
getVariantByCombination: (key: string, value: string) => VariantType;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import type { ProductDTO, ReviewRatingStatisticsDTO } from '@sentecacommerce/sdk';
|
2
|
+
import type { ProductAttributeDraftDTO, ProductDTO, ReviewRatingStatisticsDTO } from '@sentecacommerce/sdk';
|
3
3
|
import { getProductBySlugConfig } from '../../api/productsApi';
|
4
4
|
import { AssetsMap } from '../../utils/assetsToMap';
|
5
5
|
import { VariantMap, VariantType, ContentType, AttributeRulesMap } from '../useProductVariants';
|
@@ -75,6 +75,7 @@ export declare type VideoType = {
|
|
75
75
|
declare type CountFunctionsContextType = {
|
76
76
|
selectVariantById: (id: string) => void;
|
77
77
|
selectVariantByAttribute: (key: string) => void;
|
78
|
+
getAllPossibleSizesForCurrentVariant: (key: string) => ProductAttributeDraftDTO[];
|
78
79
|
selectVariantByCombination: (key: string, value: string) => void;
|
79
80
|
selectVariantOptions: (optionId: string, elementId: string) => void;
|
80
81
|
getVariantById: (id: string) => VariantType;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import type { ProductAttributeDraftDTO } from '@sentecacommerce/sdk';
|
2
3
|
import { VariantType, BooleanKVP, VariantMap, AttributeRulesMap, CombinationsMap } from './types';
|
3
4
|
export * from './types';
|
4
5
|
export declare const useProductVariants: ({ product, defaultVariantId, isLineItem, }: {
|
@@ -31,4 +32,5 @@ export declare const useProductVariants: ({ product, defaultVariantId, isLineIte
|
|
31
32
|
selectVariantByCombination: (key: string, value: string) => void;
|
32
33
|
selectVariantOptions: (definitionKey: string, optionKey: string) => void;
|
33
34
|
selectVariantById: (id: string) => void;
|
35
|
+
getAllPossibleSizesForCurrentVariant: (key: string) => ProductAttributeDraftDTO[];
|
34
36
|
};
|
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",
|