@sentecacommerce-theme/lib 0.13.7 → 0.13.11

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.
@@ -26,6 +26,18 @@ Object.keys(_useConfirmSubscription).forEach(function(key) {
26
26
  }
27
27
  });
28
28
  });
29
+ var _useCheckForCookies = _interopRequireWildcard(require("./useCheckForCookies"));
30
+ Object.keys(_useCheckForCookies).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] === _useCheckForCookies[key]) return;
34
+ Object.defineProperty(exports, key, {
35
+ enumerable: true,
36
+ get: function() {
37
+ return _useCheckForCookies[key];
38
+ }
39
+ });
40
+ });
29
41
  function _interopRequireWildcard(obj) {
30
42
  if (obj && obj.__esModule) {
31
43
  return obj;
@@ -0,0 +1,10 @@
1
+ Object.defineProperty(exports, "__esModule", {
2
+ value: true
3
+ });
4
+ exports.useCheckForCookies = void 0;
5
+ var _index = require("./index");
6
+ var useCheckForCookies = function() {
7
+ var cookiesConsent = (0, _index).useCookies().cookiesConsent;
8
+ return cookiesConsent;
9
+ };
10
+ exports.useCheckForCookies = useCheckForCookies;
@@ -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
- lineItemId = (0, _utils1).getLineItemId({
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 = 5;
363
+ _ctx.next = 6;
363
364
  break;
364
365
  }
365
366
  return _ctx.abrupt("return", myCartApi1.deleteLineItem(lineItemId));
366
- case 5:
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 9:
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
- lineItemId = (0, _utils1).getLineItemId({
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 2:
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];
@@ -99,6 +99,7 @@ function ProductProvider(param) {
99
99
  selectVariantById: selectVariantById,
100
100
  selectVariantByAttribute: selectVariantByAttribute,
101
101
  selectVariantByCombination: selectVariantByCombination,
102
+ getAllPossibleSizesForCurrentVariant: getAllPossibleSizesForCurrentVariant,
102
103
  getCombinationsForAttributeRule: getCombinationsForAttributeRule,
103
104
  selectVariantOptions: selectVariantOptions,
104
105
  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
- var remaining = applied.filter(function(x) {
277
- return !pair.aggKey.includes(x);
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 = 4;
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 4:
63
+ case 5:
63
64
  txt = disallowed.reduce(function(value, str) {
64
65
  return value + "Disallow: ".concat(str, "\n");
65
- }, "Sitemap: ".concat(domain, "/sitemap.xml\nUser-agent: *\n"));
66
+ }, "Sitemap: ".concat(siteMapUrl, "\nUser-agent: *\n"));
66
67
  res.status(200).send(txt);
67
- case 6:
68
+ case 7:
68
69
  case "end":
69
70
  return _ctx.stop();
70
71
  }
@@ -1,2 +1,3 @@
1
1
  export * from './useCookies';
2
2
  export * from './useConfirmSubscription';
3
+ export * from './useCheckForCookies';
@@ -0,0 +1,5 @@
1
+ import { useCookies } from './index';
2
+ export var useCheckForCookies = function() {
3
+ var cookiesConsent = useCookies().cookiesConsent;
4
+ return cookiesConsent;
5
+ };
@@ -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
- lineItemId = getLineItemId({
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 = 5;
350
+ _ctx.next = 6;
350
351
  break;
351
352
  }
352
353
  return _ctx.abrupt("return", myCartApi1.deleteLineItem(lineItemId));
353
- case 5:
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 9:
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
- lineItemId = getLineItemId({
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 2:
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];
@@ -87,6 +87,7 @@ export function ProductProvider(param) {
87
87
  selectVariantById: selectVariantById,
88
88
  selectVariantByAttribute: selectVariantByAttribute,
89
89
  selectVariantByCombination: selectVariantByCombination,
90
+ getAllPossibleSizesForCurrentVariant: getAllPossibleSizesForCurrentVariant,
90
91
  getCombinationsForAttributeRule: getCombinationsForAttributeRule,
91
92
  selectVariantOptions: selectVariantOptions,
92
93
  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
- var remaining = applied.filter(function(x) {
265
- return !pair.aggKey.includes(x);
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 = 4;
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 4:
54
+ case 5:
54
55
  txt = disallowed.reduce(function(value, str) {
55
56
  return value + "Disallow: ".concat(str, "\n");
56
- }, "Sitemap: ".concat(domain, "/sitemap.xml\nUser-agent: *\n"));
57
+ }, "Sitemap: ".concat(siteMapUrl, "\nUser-agent: *\n"));
57
58
  res.status(200).send(txt);
58
- case 6:
59
+ case 7:
59
60
  case "end":
60
61
  return _ctx.stop();
61
62
  }
@@ -1,2 +1,3 @@
1
1
  export * from './useCookies';
2
2
  export * from './useConfirmSubscription';
3
+ export * from './useCheckForCookies';
@@ -0,0 +1 @@
1
+ export declare const useCheckForCookies: () => boolean;
@@ -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.7",
4
+ "version": "0.13.11",
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": "55154532d5d6a26b0b930afc2378f10dc0589e34",
34
+ "gitHead": "c8695f92d2d816afc545654585bb1f18a573c85d",
35
35
  "peerDependencies": {
36
36
  "react-query": "^2.26.2"
37
37
  },
38
38
  "dependencies": {
39
- "@sentecacommerce-theme/base": "^0.13.7",
40
- "@sentecacommerce-theme/cms": "^0.13.7",
39
+ "@sentecacommerce-theme/base": "^0.13.11",
40
+ "@sentecacommerce-theme/cms": "^0.13.11",
41
41
  "@sentecacommerce/sdk": "2.0.175",
42
42
  "body-scroll-lock": "^3.1.5",
43
43
  "copy-to-clipboard": "^3.3.1",