@sentecacommerce-theme/lib 0.12.99 → 0.12.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/cjs/basket/api/mutations/index.js +14 -0
  2. package/dist/cjs/basket/api/mutations/useChangeGiftVariant.js +116 -0
  3. package/dist/cjs/basket/hooks/index.js +12 -0
  4. package/dist/cjs/basket/hooks/useChangeGiftVariant.js +16 -0
  5. package/dist/cjs/hooks/useAggregateResult/index.js +5 -1
  6. package/dist/cjs/hooks/useClearAllFilters/index.js +2 -0
  7. package/dist/cjs/hooks/useProduct/index.js +25 -25
  8. package/dist/cjs/listing/hooks/useListingFilters.js +7 -1
  9. package/dist/cjs/listing/hooks/useSlideFilter.js +3 -1
  10. package/dist/cjs/user/api/queries/useGetMyLoyaltyCardQuery.js +49 -3
  11. package/dist/cjs/utils/getSelectedFilters.js +3 -1
  12. package/dist/esm/basket/api/mutations/index.js +1 -0
  13. package/dist/esm/basket/api/mutations/useChangeGiftVariant.js +106 -0
  14. package/dist/esm/basket/hooks/index.js +1 -0
  15. package/dist/esm/basket/hooks/useChangeGiftVariant.js +3 -0
  16. package/dist/esm/hooks/useAggregateResult/index.js +5 -1
  17. package/dist/esm/hooks/useClearAllFilters/index.js +2 -0
  18. package/dist/esm/hooks/useProduct/index.js +13 -13
  19. package/dist/esm/listing/hooks/useListingFilters.js +7 -1
  20. package/dist/esm/listing/hooks/useSlideFilter.js +3 -1
  21. package/dist/esm/user/api/queries/useGetMyLoyaltyCardQuery.js +44 -3
  22. package/dist/esm/utils/getSelectedFilters.js +3 -1
  23. package/dist/types/basket/api/mutations/index.d.ts +1 -0
  24. package/dist/types/basket/api/mutations/useChangeGiftVariant.d.ts +2 -0
  25. package/dist/types/basket/hooks/index.d.ts +1 -0
  26. package/dist/types/basket/hooks/useChangeGiftVariant.d.ts +2 -0
  27. package/dist/types/hooks/basket-hooks/useBasketLineItem/index.d.ts +1 -2
  28. package/dist/types/hooks/useProduct/index.d.ts +2 -1
  29. package/package.json +4 -4
@@ -1,9 +1,11 @@
1
1
  Object.defineProperty(exports, "__esModule", {
2
2
  value: true
3
3
  });
4
+ var _exportNames = {};
4
5
  var _useReplaceBasketMutation = _interopRequireWildcard(require("./useReplaceBasketMutation"));
5
6
  Object.keys(_useReplaceBasketMutation).forEach(function(key) {
6
7
  if (key === "default" || key === "__esModule") return;
8
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
7
9
  if (key in exports && exports[key] === _useReplaceBasketMutation[key]) return;
8
10
  Object.defineProperty(exports, key, {
9
11
  enumerable: true,
@@ -12,6 +14,18 @@ Object.keys(_useReplaceBasketMutation).forEach(function(key) {
12
14
  }
13
15
  });
14
16
  });
17
+ var _useChangeGiftVariant = _interopRequireWildcard(require("./useChangeGiftVariant"));
18
+ Object.keys(_useChangeGiftVariant).forEach(function(key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
21
+ if (key in exports && exports[key] === _useChangeGiftVariant[key]) return;
22
+ Object.defineProperty(exports, key, {
23
+ enumerable: true,
24
+ get: function() {
25
+ return _useChangeGiftVariant[key];
26
+ }
27
+ });
28
+ });
15
29
  function _interopRequireWildcard(obj) {
16
30
  if (obj && obj.__esModule) {
17
31
  return obj;
@@ -0,0 +1,116 @@
1
+ Object.defineProperty(exports, "__esModule", {
2
+ value: true
3
+ });
4
+ exports.useChangeGiftVariantMutation = void 0;
5
+ var _regeneratorRuntime = _interopRequireDefault(require("regenerator-runtime"));
6
+ var _react = _interopRequireDefault(require("react"));
7
+ var _reactQuery = require("react-query");
8
+ var _sdk = require("@sentecacommerce/sdk");
9
+ var _index = require("../../index");
10
+ function _arrayLikeToArray(arr, len) {
11
+ if (len == null || len > arr.length) len = arr.length;
12
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
13
+ return arr2;
14
+ }
15
+ function _arrayWithHoles(arr) {
16
+ if (Array.isArray(arr)) return arr;
17
+ }
18
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
19
+ try {
20
+ var info = gen[key](arg);
21
+ var value = info.value;
22
+ } catch (error) {
23
+ reject(error);
24
+ return;
25
+ }
26
+ if (info.done) {
27
+ resolve(value);
28
+ } else {
29
+ Promise.resolve(value).then(_next, _throw);
30
+ }
31
+ }
32
+ function _asyncToGenerator(fn) {
33
+ return function() {
34
+ var self = this, args = arguments;
35
+ return new Promise(function(resolve, reject) {
36
+ var gen = fn.apply(self, args);
37
+ function _next(value) {
38
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
39
+ }
40
+ function _throw(err) {
41
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
42
+ }
43
+ _next(undefined);
44
+ });
45
+ };
46
+ }
47
+ function _interopRequireDefault(obj) {
48
+ return obj && obj.__esModule ? obj : {
49
+ default: obj
50
+ };
51
+ }
52
+ function _iterableToArrayLimit(arr, i) {
53
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
54
+ if (_i == null) return;
55
+ var _arr = [];
56
+ var _n = true;
57
+ var _d = false;
58
+ var _s, _e;
59
+ try {
60
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
61
+ _arr.push(_s.value);
62
+ if (i && _arr.length === i) break;
63
+ }
64
+ } catch (err) {
65
+ _d = true;
66
+ _e = err;
67
+ } finally{
68
+ try {
69
+ if (!_n && _i["return"] != null) _i["return"]();
70
+ } finally{
71
+ if (_d) throw _e;
72
+ }
73
+ }
74
+ return _arr;
75
+ }
76
+ function _nonIterableRest() {
77
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
78
+ }
79
+ function _slicedToArray(arr, i) {
80
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
81
+ }
82
+ function _unsupportedIterableToArray(o, minLen) {
83
+ if (!o) return;
84
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
85
+ var n = Object.prototype.toString.call(o).slice(8, -1);
86
+ if (n === "Object" && o.constructor) n = o.constructor.name;
87
+ if (n === "Map" || n === "Set") return Array.from(n);
88
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
89
+ }
90
+ var useChangeGiftVariantMutation = function() {
91
+ var ref = _slicedToArray((0, _index).useReplaceBasket(), 1), replaceBasket = ref[0];
92
+ return (0, _reactQuery).useMutation(function() {
93
+ var _ref = _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee(props) {
94
+ return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
95
+ while(1)switch(_ctx.prev = _ctx.next){
96
+ case 0:
97
+ _ctx.next = 2;
98
+ return (0, _sdk).MyCartChangeSelectableGiftLineItemVariant(props);
99
+ case 2:
100
+ return _ctx.abrupt("return", _ctx.sent);
101
+ case 3:
102
+ case "end":
103
+ return _ctx.stop();
104
+ }
105
+ }, _callee);
106
+ }));
107
+ return function(props) {
108
+ return _ref.apply(this, arguments);
109
+ };
110
+ }(), {
111
+ onSuccess: function(data) {
112
+ return replaceBasket(data);
113
+ }
114
+ });
115
+ };
116
+ exports.useChangeGiftVariantMutation = useChangeGiftVariantMutation;
@@ -26,6 +26,18 @@ Object.keys(_useBasketCrossSaleItems).forEach(function(key) {
26
26
  }
27
27
  });
28
28
  });
29
+ var _useChangeGiftVariant = _interopRequireWildcard(require("./useChangeGiftVariant"));
30
+ Object.keys(_useChangeGiftVariant).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] === _useChangeGiftVariant[key]) return;
34
+ Object.defineProperty(exports, key, {
35
+ enumerable: true,
36
+ get: function() {
37
+ return _useChangeGiftVariant[key];
38
+ }
39
+ });
40
+ });
29
41
  function _interopRequireWildcard(obj) {
30
42
  if (obj && obj.__esModule) {
31
43
  return obj;
@@ -0,0 +1,16 @@
1
+ Object.defineProperty(exports, "__esModule", {
2
+ value: true
3
+ });
4
+ Object.defineProperty(exports, "useChangeGiftVariant", {
5
+ enumerable: true,
6
+ get: function() {
7
+ return _mutations.useChangeGiftVariantMutation;
8
+ }
9
+ });
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _mutations = require("../api/mutations");
12
+ function _interopRequireDefault(obj) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
@@ -91,7 +91,9 @@ var useAggregateResult = function(type, aggregates, slug, predicate, query) {
91
91
  aggType: a.filterDefinition,
92
92
  aggKey: filterKey,
93
93
  aggOperator: operatorMap[a.aggregationType]
94
- }, selected, router));
94
+ }, selected, router), undefined, {
95
+ shallow: true
96
+ });
95
97
  }
96
98
  },
97
99
  ]);
@@ -108,6 +110,8 @@ var useAggregateResult = function(type, aggregates, slug, predicate, query) {
108
110
  query: _objectSpread({}, router.query, {
109
111
  filter: filterByType(router.query.filter, a.filterDefinition)
110
112
  })
113
+ }, undefined, {
114
+ shallow: true
111
115
  });
112
116
  },
113
117
  type: a.aggregationType
@@ -39,6 +39,8 @@ var useClearAllFilters = function() {
39
39
  router.push({
40
40
  pathname: router.pathname,
41
41
  query: query
42
+ }, undefined, {
43
+ shallow: true
42
44
  });
43
45
  };
44
46
  };
@@ -104,40 +104,40 @@ function _unsupportedIterableToArray(o, minLen) {
104
104
  var ProductStateContext = /*#__PURE__*/ _react.default.createContext(undefined);
105
105
  var CountDispatchContext = /*#__PURE__*/ _react.default.createContext(undefined);
106
106
  function ProductProvider(param) {
107
- var product = param.product, children = param.children, defaultVariantId = param.defaultVariantId;
108
- var ref36 = _slicedToArray(_react.default.useState(false), 2), mounted = ref36[0], setMounted = ref36[1];
107
+ var product = param.product, children = param.children, defaultVariantId = param.defaultVariantId, _includeBrandInName = param.includeBrandInName, includeBrandInName = _includeBrandInName === void 0 ? false : _includeBrandInName;
108
+ var ref42 = _slicedToArray(_react.default.useState(false), 2), mounted = ref42[0], setMounted = ref42[1];
109
109
  var ref1 = _slicedToArray(_react.default.useState(getCombinationsAndAttributeRules), 2), ref2 = ref1[0], combinations = ref2.combinations, attributeRules = ref2.attributeRules, setCombinationsAndAttributeRules = ref1[1];
110
110
  var ref3 = _slicedToArray(_react.default.useState(getVariantsWithInventory), 2), variants = ref3[0], setVariants = ref3[1];
111
111
  var ref4 = _slicedToArray(_react.default.useState(getDefaultVariant), 2), selectedVariant = ref4[0], setSelectedVariant = ref4[1];
112
112
  var metaData = _react.default.useMemo(function() {
113
- var ref, 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;
113
+ var ref, 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, ref38, ref39, ref40, ref41;
114
114
  var rootCategory = product === null || product === void 0 ? void 0 : (ref = product.categories) === null || ref === void 0 ? void 0 : ref[0];
115
115
  var rootCategoryId = rootCategory === null || rootCategory === void 0 ? void 0 : rootCategory.resourceId;
116
116
  var metaObj = {
117
117
  _id: product === null || product === void 0 ? void 0 : product._id,
118
- name: (0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.name) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.name),
118
+ name: includeBrandInName && (product === null || product === void 0 ? void 0 : (ref5 = product.brands) === null || ref5 === void 0 ? void 0 : (ref6 = ref5[0]) === null || ref6 === void 0 ? void 0 : (ref7 = ref6.resource) === null || ref7 === void 0 ? void 0 : ref7.name) ? "".concat((0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref8 = product.brands) === null || ref8 === void 0 ? void 0 : (ref9 = ref8[0]) === null || ref9 === void 0 ? void 0 : (ref10 = ref9.resource) === null || ref10 === void 0 ? void 0 : ref10.name), " ").concat((0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.name) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.name)) : (0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.name) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.name),
119
119
  slug: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.slug),
120
120
  description: (0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.description) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.description),
121
121
  shortDescription: (0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.metaDescription) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.metaDescription),
122
122
  brand: {
123
- _id: product === null || product === void 0 ? void 0 : (ref5 = product.brands) === null || ref5 === void 0 ? void 0 : (ref6 = ref5[0]) === null || ref6 === void 0 ? void 0 : ref6.resourceId,
124
- name: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref7 = product.brands) === null || ref7 === void 0 ? void 0 : (ref8 = ref7[0]) === null || ref8 === void 0 ? void 0 : (ref9 = ref8.resource) === null || ref9 === void 0 ? void 0 : ref9.name),
125
- slug: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref10 = product.brands) === null || ref10 === void 0 ? void 0 : (ref11 = ref10[0]) === null || ref11 === void 0 ? void 0 : (ref12 = ref11.resource) === null || ref12 === void 0 ? void 0 : ref12.slug),
126
- logo: product === null || product === void 0 ? void 0 : (ref13 = product.brands) === null || ref13 === void 0 ? void 0 : (ref14 = ref13[0]) === null || ref14 === void 0 ? void 0 : (ref15 = ref14.resource) === null || ref15 === void 0 ? void 0 : (ref16 = ref15.assets) === null || ref16 === void 0 ? void 0 : (ref17 = ref16[0]) === null || ref17 === void 0 ? void 0 : (ref18 = ref17.sources) === null || ref18 === void 0 ? void 0 : (ref19 = ref18[0]) === null || ref19 === void 0 ? void 0 : ref19.url
123
+ _id: product === null || product === void 0 ? void 0 : (ref11 = product.brands) === null || ref11 === void 0 ? void 0 : (ref12 = ref11[0]) === null || ref12 === void 0 ? void 0 : ref12.resourceId,
124
+ name: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref13 = product.brands) === null || ref13 === void 0 ? void 0 : (ref14 = ref13[0]) === null || ref14 === void 0 ? void 0 : (ref15 = ref14.resource) === null || ref15 === void 0 ? void 0 : ref15.name),
125
+ slug: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref16 = product.brands) === null || ref16 === void 0 ? void 0 : (ref17 = ref16[0]) === null || ref17 === void 0 ? void 0 : (ref18 = ref17.resource) === null || ref18 === void 0 ? void 0 : ref18.slug),
126
+ logo: product === null || product === void 0 ? void 0 : (ref19 = product.brands) === null || ref19 === void 0 ? void 0 : (ref20 = ref19[0]) === null || ref20 === void 0 ? void 0 : (ref21 = ref20.resource) === null || ref21 === void 0 ? void 0 : (ref22 = ref21.assets) === null || ref22 === void 0 ? void 0 : (ref23 = ref22[0]) === null || ref23 === void 0 ? void 0 : (ref24 = ref23.sources) === null || ref24 === void 0 ? void 0 : (ref25 = ref24[0]) === null || ref25 === void 0 ? void 0 : ref25.url
127
127
  },
128
128
  category: {
129
- _id: product === null || product === void 0 ? void 0 : (ref21 = product.categories) === null || ref21 === void 0 ? void 0 : (ref22 = ref21[(product === null || product === void 0 ? void 0 : (ref20 = product.categories) === null || ref20 === void 0 ? void 0 : ref20.length) - 1]) === null || ref22 === void 0 ? void 0 : ref22.resourceId,
130
- name: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref24 = product.categories) === null || ref24 === void 0 ? void 0 : (ref25 = ref24[(product === null || product === void 0 ? void 0 : (ref23 = product.categories) === null || ref23 === void 0 ? void 0 : ref23.length) - 1]) === null || ref25 === void 0 ? void 0 : (ref26 = ref25.resource) === null || ref26 === void 0 ? void 0 : ref26.name),
131
- slug: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref28 = product.categories) === null || ref28 === void 0 ? void 0 : (ref29 = ref28[(product === null || product === void 0 ? void 0 : (ref27 = product.categories) === null || ref27 === void 0 ? void 0 : ref27.length) - 1]) === null || ref29 === void 0 ? void 0 : (ref30 = ref29.resource) === null || ref30 === void 0 ? void 0 : ref30.slug)
129
+ _id: product === null || product === void 0 ? void 0 : (ref27 = product.categories) === null || ref27 === void 0 ? void 0 : (ref28 = ref27[(product === null || product === void 0 ? void 0 : (ref26 = product.categories) === null || ref26 === void 0 ? void 0 : ref26.length) - 1]) === null || ref28 === void 0 ? void 0 : ref28.resourceId,
130
+ name: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref30 = product.categories) === null || ref30 === void 0 ? void 0 : (ref31 = ref30[(product === null || product === void 0 ? void 0 : (ref29 = product.categories) === null || ref29 === void 0 ? void 0 : ref29.length) - 1]) === null || ref31 === void 0 ? void 0 : (ref32 = ref31.resource) === null || ref32 === void 0 ? void 0 : ref32.name),
131
+ slug: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref34 = product.categories) === null || ref34 === void 0 ? void 0 : (ref35 = ref34[(product === null || product === void 0 ? void 0 : (ref33 = product.categories) === null || ref33 === void 0 ? void 0 : ref33.length) - 1]) === null || ref35 === void 0 ? void 0 : (ref36 = ref35.resource) === null || ref36 === void 0 ? void 0 : ref36.slug)
132
132
  },
133
133
  rootCategory: {
134
134
  _id: rootCategoryId,
135
- name: (0, _).getTranslatableField(rootCategory === null || rootCategory === void 0 ? void 0 : (ref31 = rootCategory.resource) === null || ref31 === void 0 ? void 0 : ref31.name),
136
- slug: (0, _).getTranslatableField(rootCategory === null || rootCategory === void 0 ? void 0 : (ref32 = rootCategory.resource) === null || ref32 === void 0 ? void 0 : ref32.slug)
135
+ name: (0, _).getTranslatableField(rootCategory === null || rootCategory === void 0 ? void 0 : (ref37 = rootCategory.resource) === null || ref37 === void 0 ? void 0 : ref37.name),
136
+ slug: (0, _).getTranslatableField(rootCategory === null || rootCategory === void 0 ? void 0 : (ref38 = rootCategory.resource) === null || ref38 === void 0 ? void 0 : ref38.slug)
137
137
  },
138
138
  categories: (0, _utils).formatCategories(product === null || product === void 0 ? void 0 : product.categories, rootCategoryId),
139
139
  reviewRatingStatistics: product === null || product === void 0 ? void 0 : product.reviewRatingStatistics,
140
- content: Boolean(selectedVariant === null || selectedVariant === void 0 ? void 0 : (ref33 = selectedVariant.content) === null || ref33 === void 0 ? void 0 : ref33.map(_utils.createProductContent).length) ? selectedVariant === null || selectedVariant === void 0 ? void 0 : (ref34 = selectedVariant.content) === null || ref34 === void 0 ? void 0 : ref34.map(_utils.createProductContent) : product === null || product === void 0 ? void 0 : (ref35 = product.content) === null || ref35 === void 0 ? void 0 : ref35.map(_utils.createProductContent),
140
+ content: Boolean(selectedVariant === null || selectedVariant === void 0 ? void 0 : (ref39 = selectedVariant.content) === null || ref39 === void 0 ? void 0 : ref39.map(_utils.createProductContent).length) ? selectedVariant === null || selectedVariant === void 0 ? void 0 : (ref40 = selectedVariant.content) === null || ref40 === void 0 ? void 0 : ref40.map(_utils.createProductContent) : product === null || product === void 0 ? void 0 : (ref41 = product.content) === null || ref41 === void 0 ? void 0 : ref41.map(_utils.createProductContent),
141
141
  assets: (0, _assetsToMap).assetsFieldsToMap(product === null || product === void 0 ? void 0 : product.assets)
142
142
  };
143
143
  return metaObj;
@@ -190,20 +190,20 @@ function ProductProvider(param) {
190
190
  variants
191
191
  ]);
192
192
  function getVariantsWithInventory() {
193
- var ref40;
194
- var variantsWithInventory = product === null || product === void 0 ? void 0 : (ref40 = product.variants) === null || ref40 === void 0 ? void 0 : ref40.reduce(function(map, _, index, arr) {
195
- var ref41, ref37, ref38, ref39;
193
+ var ref46;
194
+ var variantsWithInventory = product === null || product === void 0 ? void 0 : (ref46 = product.variants) === null || ref46 === void 0 ? void 0 : ref46.reduce(function(map, _, index, arr) {
195
+ var ref47, ref43, ref44, ref45;
196
196
  var currentVariant = arr[index];
197
197
  var mappedAttributes = (0, _utils).createMappedAttributes(currentVariant);
198
198
  var mappedOptions = (0, _utils).createMappedOptions(currentVariant === null || currentVariant === void 0 ? void 0 : currentVariant.availableOptions) || [];
199
- var isAvailable = currentVariant === null || currentVariant === void 0 ? void 0 : (ref41 = currentVariant.inventorySnapshot) === null || ref41 === void 0 ? void 0 : ref41.canOrder;
199
+ var isAvailable = currentVariant === null || currentVariant === void 0 ? void 0 : (ref47 = currentVariant.inventorySnapshot) === null || ref47 === void 0 ? void 0 : ref47.canOrder;
200
200
  var updatedVariant = _objectSpread({}, currentVariant, {
201
201
  inventory: {
202
- hasAvailableQuantity: (ref37 = currentVariant.inventorySnapshot) === null || ref37 === void 0 ? void 0 : ref37.canOrder,
203
- availableQuantity: (ref38 = currentVariant.inventorySnapshot) === null || ref38 === void 0 ? void 0 : ref38.availableQuantity
202
+ hasAvailableQuantity: (ref43 = currentVariant.inventorySnapshot) === null || ref43 === void 0 ? void 0 : ref43.canOrder,
203
+ availableQuantity: (ref44 = currentVariant.inventorySnapshot) === null || ref44 === void 0 ? void 0 : ref44.availableQuantity
204
204
  },
205
205
  isAvailable: isAvailable ? true : false,
206
- quantity: isAvailable ? currentVariant === null || currentVariant === void 0 ? void 0 : (ref39 = currentVariant.inventorySnapshot) === null || ref39 === void 0 ? void 0 : ref39.availableQuantity : 0,
206
+ quantity: isAvailable ? currentVariant === null || currentVariant === void 0 ? void 0 : (ref45 = currentVariant.inventorySnapshot) === null || ref45 === void 0 ? void 0 : ref45.availableQuantity : 0,
207
207
  attributes: mappedAttributes,
208
208
  options: mappedOptions,
209
209
  selectedOptions: [],
@@ -317,7 +317,7 @@ function ProductProvider(param) {
317
317
  return variants === null || variants === void 0 ? void 0 : variants[id];
318
318
  }
319
319
  function getVariantByCombination(key, value) {
320
- var ref42;
320
+ var ref48;
321
321
  var split = value === null || value === void 0 ? void 0 : value.split(':');
322
322
  if ((split === null || split === void 0 ? void 0 : split[0]) === 'collapseKey') {
323
323
  var id = Object.keys(variants).find(function(el) {
@@ -328,15 +328,15 @@ function ProductProvider(param) {
328
328
  });
329
329
  return variants[id];
330
330
  }
331
- var id3 = (ref42 = combinations[key]) === null || ref42 === void 0 ? void 0 : ref42.params[value];
331
+ var id3 = (ref48 = combinations[key]) === null || ref48 === void 0 ? void 0 : ref48.params[value];
332
332
  return variants === null || variants === void 0 ? void 0 : variants[id3];
333
333
  }
334
334
  function getCustomFieldValue(field) {
335
335
  return customFields === null || customFields === void 0 ? void 0 : customFields[field];
336
336
  }
337
337
  function getCombinationsForAttributeRule(key, id) {
338
- var ref, ref43;
339
- var result = attributeRules === null || attributeRules === void 0 ? void 0 : (ref = attributeRules[key]) === null || ref === void 0 ? void 0 : (ref43 = ref.values) === null || ref43 === void 0 ? void 0 : ref43[id];
338
+ var ref, ref49;
339
+ var result = attributeRules === null || attributeRules === void 0 ? void 0 : (ref = attributeRules[key]) === null || ref === void 0 ? void 0 : (ref49 = ref.values) === null || ref49 === void 0 ? void 0 : ref49[id];
340
340
  return result;
341
341
  }
342
342
  var collapsedImages = (0, _utils).createCollapseKeyImagesMap(product);
@@ -136,6 +136,8 @@ function ListingFiltersProvider(param) {
136
136
  query: _objectSpread({}, router.query, {
137
137
  filter: filterByType(router.query.filter, filter)
138
138
  })
139
+ }, undefined, {
140
+ shallow: true
139
141
  });
140
142
  },
141
143
  type: type
@@ -155,6 +157,8 @@ function ListingFiltersProvider(param) {
155
157
  router.push({
156
158
  pathname: router.pathname,
157
159
  query: query
160
+ }, undefined, {
161
+ shallow: true
158
162
  });
159
163
  };
160
164
  var selectedFilters = _react.default.useMemo(function() {
@@ -197,7 +201,9 @@ function generateFilters(param) {
197
201
  aggType: filter,
198
202
  aggKey: filterKey,
199
203
  aggOperator: filtersOperatorsMap[type]
200
- }, Boolean(selected), router));
204
+ }, Boolean(selected), router), undefined, {
205
+ shallow: true
206
+ });
201
207
  }
202
208
  };
203
209
  });
@@ -110,7 +110,9 @@ var useSlideFilter = function(filterName, min, max) {
110
110
  aggType: filterName,
111
111
  aggKey: "".concat(formattedFrom, ",").concat(formattedTo),
112
112
  aggOperator: _useListingFilters.filtersOperatorsMap.stats
113
- }, false, router, true));
113
+ }, false, router, true), undefined, {
114
+ shallow: true
115
+ });
114
116
  }, 500);
115
117
  setState({
116
118
  from: formattedFrom,
@@ -2,12 +2,58 @@ Object.defineProperty(exports, "__esModule", {
2
2
  value: true
3
3
  });
4
4
  exports.useGetMyLoyaltyCardQuery = void 0;
5
+ var _regeneratorRuntime = _interopRequireDefault(require("regenerator-runtime"));
5
6
  var _sdk = require("@sentecacommerce/sdk");
6
7
  var _reactQuery = require("react-query");
8
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
9
+ try {
10
+ var info = gen[key](arg);
11
+ var value = info.value;
12
+ } catch (error) {
13
+ reject(error);
14
+ return;
15
+ }
16
+ if (info.done) {
17
+ resolve(value);
18
+ } else {
19
+ Promise.resolve(value).then(_next, _throw);
20
+ }
21
+ }
22
+ function _asyncToGenerator(fn) {
23
+ return function() {
24
+ var self = this, args = arguments;
25
+ return new Promise(function(resolve, reject) {
26
+ var gen = fn.apply(self, args);
27
+ function _next(value) {
28
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
29
+ }
30
+ function _throw(err) {
31
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
32
+ }
33
+ _next(undefined);
34
+ });
35
+ };
36
+ }
37
+ function _interopRequireDefault(obj) {
38
+ return obj && obj.__esModule ? obj : {
39
+ default: obj
40
+ };
41
+ }
7
42
  var useGetMyLoyaltyCardQuery = function(callback) {
8
- return (0, _reactQuery).useQuery('get-loyalty-card-key', function() {
9
- return (0, _sdk).MyWalletGetByType('loyalty-program');
10
- }, {
43
+ return (0, _reactQuery).useQuery('get-loyalty-card-key', _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
44
+ return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
45
+ while(1)switch(_ctx.prev = _ctx.next){
46
+ case 0:
47
+ return _ctx.abrupt("return", (0, _sdk).MyWalletGetByType('loyalty-program'));
48
+ case 1:
49
+ case "end":
50
+ return _ctx.stop();
51
+ }
52
+ }, _callee);
53
+ })), {
54
+ refetchOnMount: false,
55
+ refetchOnWindowFocus: false,
56
+ retry: false,
11
57
  onSuccess: function() {
12
58
  var ref;
13
59
  return callback === null || callback === void 0 ? void 0 : (ref = callback.onSuccess) === null || ref === void 0 ? void 0 : ref.call(callback);
@@ -99,7 +99,9 @@ var getSelectedFilters = function(router, slug, data, config) {
99
99
  aggType: key,
100
100
  aggKey: "".concat(valueFrom, ",").concat(valueTo),
101
101
  aggOperator: _listing.filtersOperatorsMap.stats
102
- }, true, router));
102
+ }, true, router), undefined, {
103
+ shallow: true
104
+ });
103
105
  },
104
106
  selected: true,
105
107
  data: _objectSpread({}, data.raw, {
@@ -1 +1,2 @@
1
1
  export * from './useReplaceBasketMutation';
2
+ export * from './useChangeGiftVariant';
@@ -0,0 +1,106 @@
1
+ import regeneratorRuntime from "regenerator-runtime";
2
+ import React from 'react';
3
+ import { useMutation } from 'react-query';
4
+ import { MyCartChangeSelectableGiftLineItemVariant } from '@sentecacommerce/sdk';
5
+ import { useReplaceBasket } from '../../index';
6
+ function _arrayLikeToArray(arr, len) {
7
+ if (len == null || len > arr.length) len = arr.length;
8
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
9
+ return arr2;
10
+ }
11
+ function _arrayWithHoles(arr) {
12
+ if (Array.isArray(arr)) return arr;
13
+ }
14
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
15
+ try {
16
+ var info = gen[key](arg);
17
+ var value = info.value;
18
+ } catch (error) {
19
+ reject(error);
20
+ return;
21
+ }
22
+ if (info.done) {
23
+ resolve(value);
24
+ } else {
25
+ Promise.resolve(value).then(_next, _throw);
26
+ }
27
+ }
28
+ function _asyncToGenerator(fn) {
29
+ return function() {
30
+ var self = this, args = arguments;
31
+ return new Promise(function(resolve, reject) {
32
+ var gen = fn.apply(self, args);
33
+ function _next(value) {
34
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
35
+ }
36
+ function _throw(err) {
37
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
38
+ }
39
+ _next(undefined);
40
+ });
41
+ };
42
+ }
43
+ function _iterableToArrayLimit(arr, i) {
44
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
45
+ if (_i == null) return;
46
+ var _arr = [];
47
+ var _n = true;
48
+ var _d = false;
49
+ var _s, _e;
50
+ try {
51
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
52
+ _arr.push(_s.value);
53
+ if (i && _arr.length === i) break;
54
+ }
55
+ } catch (err) {
56
+ _d = true;
57
+ _e = err;
58
+ } finally{
59
+ try {
60
+ if (!_n && _i["return"] != null) _i["return"]();
61
+ } finally{
62
+ if (_d) throw _e;
63
+ }
64
+ }
65
+ return _arr;
66
+ }
67
+ function _nonIterableRest() {
68
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
69
+ }
70
+ function _slicedToArray(arr, i) {
71
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
72
+ }
73
+ function _unsupportedIterableToArray(o, minLen) {
74
+ if (!o) return;
75
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
76
+ var n = Object.prototype.toString.call(o).slice(8, -1);
77
+ if (n === "Object" && o.constructor) n = o.constructor.name;
78
+ if (n === "Map" || n === "Set") return Array.from(n);
79
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
80
+ }
81
+ export var useChangeGiftVariantMutation = function() {
82
+ var ref = _slicedToArray(useReplaceBasket(), 1), replaceBasket = ref[0];
83
+ return useMutation(function() {
84
+ var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(props) {
85
+ return regeneratorRuntime.wrap(function _callee$(_ctx) {
86
+ while(1)switch(_ctx.prev = _ctx.next){
87
+ case 0:
88
+ _ctx.next = 2;
89
+ return MyCartChangeSelectableGiftLineItemVariant(props);
90
+ case 2:
91
+ return _ctx.abrupt("return", _ctx.sent);
92
+ case 3:
93
+ case "end":
94
+ return _ctx.stop();
95
+ }
96
+ }, _callee);
97
+ }));
98
+ return function(props) {
99
+ return _ref.apply(this, arguments);
100
+ };
101
+ }(), {
102
+ onSuccess: function(data) {
103
+ return replaceBasket(data);
104
+ }
105
+ });
106
+ };
@@ -1,2 +1,3 @@
1
1
  export * from './useReplaceBasket';
2
2
  export * from './useBasketCrossSaleItems';
3
+ export * from './useChangeGiftVariant';
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { useChangeGiftVariantMutation } from '../api/mutations';
3
+ export { useChangeGiftVariantMutation as useChangeGiftVariant };
@@ -87,7 +87,9 @@ export var useAggregateResult = function(type, aggregates, slug, predicate, quer
87
87
  aggType: a.filterDefinition,
88
88
  aggKey: filterKey,
89
89
  aggOperator: operatorMap[a.aggregationType]
90
- }, selected, router));
90
+ }, selected, router), undefined, {
91
+ shallow: true
92
+ });
91
93
  }
92
94
  },
93
95
  ]);
@@ -104,6 +106,8 @@ export var useAggregateResult = function(type, aggregates, slug, predicate, quer
104
106
  query: _objectSpread({}, router.query, {
105
107
  filter: filterByType(router.query.filter, a.filterDefinition)
106
108
  })
109
+ }, undefined, {
110
+ shallow: true
107
111
  });
108
112
  },
109
113
  type: a.aggregationType
@@ -35,6 +35,8 @@ export var useClearAllFilters = function() {
35
35
  router.push({
36
36
  pathname: router.pathname,
37
37
  query: query
38
+ }, undefined, {
39
+ shallow: true
38
40
  });
39
41
  };
40
42
  };
@@ -92,7 +92,7 @@ function _unsupportedIterableToArray(o, minLen) {
92
92
  var ProductStateContext = /*#__PURE__*/ React.createContext(undefined);
93
93
  var CountDispatchContext = /*#__PURE__*/ React.createContext(undefined);
94
94
  export function ProductProvider(param) {
95
- var product = param.product, children = param.children, defaultVariantId = param.defaultVariantId;
95
+ var product = param.product, children = param.children, defaultVariantId = param.defaultVariantId, _includeBrandInName = param.includeBrandInName, includeBrandInName = _includeBrandInName === void 0 ? false : _includeBrandInName;
96
96
  var getVariantsWithInventory = function getVariantsWithInventory() {
97
97
  var ref9;
98
98
  var variantsWithInventory = product === null || product === void 0 ? void 0 : (ref9 = product.variants) === null || ref9 === void 0 ? void 0 : ref9.reduce(function(map, _, index, arr) {
@@ -248,34 +248,34 @@ export function ProductProvider(param) {
248
248
  var ref3 = _slicedToArray(React.useState(getVariantsWithInventory), 2), variants = ref3[0], setVariants = ref3[1];
249
249
  var ref4 = _slicedToArray(React.useState(getDefaultVariant), 2), selectedVariant = ref4[0], setSelectedVariant = ref4[1];
250
250
  var metaData = React.useMemo(function() {
251
- var ref, 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, ref38, ref39, ref40, ref41, ref42, ref43;
251
+ var ref, 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, ref38, ref39, ref40, ref41, ref42, ref43, ref44, ref45, ref46, ref47, ref48, ref49;
252
252
  var rootCategory = product === null || product === void 0 ? void 0 : (ref = product.categories) === null || ref === void 0 ? void 0 : ref[0];
253
253
  var rootCategoryId = rootCategory === null || rootCategory === void 0 ? void 0 : rootCategory.resourceId;
254
254
  var metaObj = {
255
255
  _id: product === null || product === void 0 ? void 0 : product._id,
256
- name: getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.name) || getTranslatableField(product === null || product === void 0 ? void 0 : product.name),
256
+ name: includeBrandInName && (product === null || product === void 0 ? void 0 : (ref13 = product.brands) === null || ref13 === void 0 ? void 0 : (ref14 = ref13[0]) === null || ref14 === void 0 ? void 0 : (ref15 = ref14.resource) === null || ref15 === void 0 ? void 0 : ref15.name) ? "".concat(getTranslatableField(product === null || product === void 0 ? void 0 : (ref16 = product.brands) === null || ref16 === void 0 ? void 0 : (ref17 = ref16[0]) === null || ref17 === void 0 ? void 0 : (ref18 = ref17.resource) === null || ref18 === void 0 ? void 0 : ref18.name), " ").concat(getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.name) || getTranslatableField(product === null || product === void 0 ? void 0 : product.name)) : getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.name) || getTranslatableField(product === null || product === void 0 ? void 0 : product.name),
257
257
  slug: getTranslatableField(product === null || product === void 0 ? void 0 : product.slug),
258
258
  description: getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.description) || getTranslatableField(product === null || product === void 0 ? void 0 : product.description),
259
259
  shortDescription: getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.metaDescription) || getTranslatableField(product === null || product === void 0 ? void 0 : product.metaDescription),
260
260
  brand: {
261
- _id: product === null || product === void 0 ? void 0 : (ref13 = product.brands) === null || ref13 === void 0 ? void 0 : (ref14 = ref13[0]) === null || ref14 === void 0 ? void 0 : ref14.resourceId,
262
- name: getTranslatableField(product === null || product === void 0 ? void 0 : (ref15 = product.brands) === null || ref15 === void 0 ? void 0 : (ref16 = ref15[0]) === null || ref16 === void 0 ? void 0 : (ref17 = ref16.resource) === null || ref17 === void 0 ? void 0 : ref17.name),
263
- slug: getTranslatableField(product === null || product === void 0 ? void 0 : (ref18 = product.brands) === null || ref18 === void 0 ? void 0 : (ref19 = ref18[0]) === null || ref19 === void 0 ? void 0 : (ref20 = ref19.resource) === null || ref20 === void 0 ? void 0 : ref20.slug),
264
- logo: product === null || product === void 0 ? void 0 : (ref21 = product.brands) === null || ref21 === void 0 ? void 0 : (ref22 = ref21[0]) === null || ref22 === void 0 ? void 0 : (ref23 = ref22.resource) === null || ref23 === void 0 ? void 0 : (ref24 = ref23.assets) === null || ref24 === void 0 ? void 0 : (ref25 = ref24[0]) === null || ref25 === void 0 ? void 0 : (ref26 = ref25.sources) === null || ref26 === void 0 ? void 0 : (ref27 = ref26[0]) === null || ref27 === void 0 ? void 0 : ref27.url
261
+ _id: product === null || product === void 0 ? void 0 : (ref19 = product.brands) === null || ref19 === void 0 ? void 0 : (ref20 = ref19[0]) === null || ref20 === void 0 ? void 0 : ref20.resourceId,
262
+ name: getTranslatableField(product === null || product === void 0 ? void 0 : (ref21 = product.brands) === null || ref21 === void 0 ? void 0 : (ref22 = ref21[0]) === null || ref22 === void 0 ? void 0 : (ref23 = ref22.resource) === null || ref23 === void 0 ? void 0 : ref23.name),
263
+ slug: getTranslatableField(product === null || product === void 0 ? void 0 : (ref24 = product.brands) === null || ref24 === void 0 ? void 0 : (ref25 = ref24[0]) === null || ref25 === void 0 ? void 0 : (ref26 = ref25.resource) === null || ref26 === void 0 ? void 0 : ref26.slug),
264
+ logo: product === null || product === void 0 ? void 0 : (ref27 = product.brands) === null || ref27 === void 0 ? void 0 : (ref28 = ref27[0]) === null || ref28 === void 0 ? void 0 : (ref29 = ref28.resource) === null || ref29 === void 0 ? void 0 : (ref30 = ref29.assets) === null || ref30 === void 0 ? void 0 : (ref31 = ref30[0]) === null || ref31 === void 0 ? void 0 : (ref32 = ref31.sources) === null || ref32 === void 0 ? void 0 : (ref33 = ref32[0]) === null || ref33 === void 0 ? void 0 : ref33.url
265
265
  },
266
266
  category: {
267
- _id: product === null || product === void 0 ? void 0 : (ref29 = product.categories) === null || ref29 === void 0 ? void 0 : (ref30 = ref29[(product === null || product === void 0 ? void 0 : (ref28 = product.categories) === null || ref28 === void 0 ? void 0 : ref28.length) - 1]) === null || ref30 === void 0 ? void 0 : ref30.resourceId,
268
- name: getTranslatableField(product === null || product === void 0 ? void 0 : (ref32 = product.categories) === null || ref32 === void 0 ? void 0 : (ref33 = ref32[(product === null || product === void 0 ? void 0 : (ref31 = product.categories) === null || ref31 === void 0 ? void 0 : ref31.length) - 1]) === null || ref33 === void 0 ? void 0 : (ref34 = ref33.resource) === null || ref34 === void 0 ? void 0 : ref34.name),
269
- slug: getTranslatableField(product === null || product === void 0 ? void 0 : (ref36 = product.categories) === null || ref36 === void 0 ? void 0 : (ref37 = ref36[(product === null || product === void 0 ? void 0 : (ref35 = product.categories) === null || ref35 === void 0 ? void 0 : ref35.length) - 1]) === null || ref37 === void 0 ? void 0 : (ref38 = ref37.resource) === null || ref38 === void 0 ? void 0 : ref38.slug)
267
+ _id: product === null || product === void 0 ? void 0 : (ref35 = product.categories) === null || ref35 === void 0 ? void 0 : (ref36 = ref35[(product === null || product === void 0 ? void 0 : (ref34 = product.categories) === null || ref34 === void 0 ? void 0 : ref34.length) - 1]) === null || ref36 === void 0 ? void 0 : ref36.resourceId,
268
+ name: getTranslatableField(product === null || product === void 0 ? void 0 : (ref38 = product.categories) === null || ref38 === void 0 ? void 0 : (ref39 = ref38[(product === null || product === void 0 ? void 0 : (ref37 = product.categories) === null || ref37 === void 0 ? void 0 : ref37.length) - 1]) === null || ref39 === void 0 ? void 0 : (ref40 = ref39.resource) === null || ref40 === void 0 ? void 0 : ref40.name),
269
+ slug: getTranslatableField(product === null || product === void 0 ? void 0 : (ref42 = product.categories) === null || ref42 === void 0 ? void 0 : (ref43 = ref42[(product === null || product === void 0 ? void 0 : (ref41 = product.categories) === null || ref41 === void 0 ? void 0 : ref41.length) - 1]) === null || ref43 === void 0 ? void 0 : (ref44 = ref43.resource) === null || ref44 === void 0 ? void 0 : ref44.slug)
270
270
  },
271
271
  rootCategory: {
272
272
  _id: rootCategoryId,
273
- name: getTranslatableField(rootCategory === null || rootCategory === void 0 ? void 0 : (ref39 = rootCategory.resource) === null || ref39 === void 0 ? void 0 : ref39.name),
274
- slug: getTranslatableField(rootCategory === null || rootCategory === void 0 ? void 0 : (ref40 = rootCategory.resource) === null || ref40 === void 0 ? void 0 : ref40.slug)
273
+ name: getTranslatableField(rootCategory === null || rootCategory === void 0 ? void 0 : (ref45 = rootCategory.resource) === null || ref45 === void 0 ? void 0 : ref45.name),
274
+ slug: getTranslatableField(rootCategory === null || rootCategory === void 0 ? void 0 : (ref46 = rootCategory.resource) === null || ref46 === void 0 ? void 0 : ref46.slug)
275
275
  },
276
276
  categories: formatCategories(product === null || product === void 0 ? void 0 : product.categories, rootCategoryId),
277
277
  reviewRatingStatistics: product === null || product === void 0 ? void 0 : product.reviewRatingStatistics,
278
- content: Boolean(selectedVariant === null || selectedVariant === void 0 ? void 0 : (ref41 = selectedVariant.content) === null || ref41 === void 0 ? void 0 : ref41.map(createProductContent).length) ? selectedVariant === null || selectedVariant === void 0 ? void 0 : (ref42 = selectedVariant.content) === null || ref42 === void 0 ? void 0 : ref42.map(createProductContent) : product === null || product === void 0 ? void 0 : (ref43 = product.content) === null || ref43 === void 0 ? void 0 : ref43.map(createProductContent),
278
+ content: Boolean(selectedVariant === null || selectedVariant === void 0 ? void 0 : (ref47 = selectedVariant.content) === null || ref47 === void 0 ? void 0 : ref47.map(createProductContent).length) ? selectedVariant === null || selectedVariant === void 0 ? void 0 : (ref48 = selectedVariant.content) === null || ref48 === void 0 ? void 0 : ref48.map(createProductContent) : product === null || product === void 0 ? void 0 : (ref49 = product.content) === null || ref49 === void 0 ? void 0 : ref49.map(createProductContent),
279
279
  assets: assetsFieldsToMap(product === null || product === void 0 ? void 0 : product.assets)
280
280
  };
281
281
  return metaObj;
@@ -125,6 +125,8 @@ export function ListingFiltersProvider(param) {
125
125
  query: _objectSpread({}, router.query, {
126
126
  filter: filterByType(router.query.filter, filter)
127
127
  })
128
+ }, undefined, {
129
+ shallow: true
128
130
  });
129
131
  },
130
132
  type: type
@@ -144,6 +146,8 @@ export function ListingFiltersProvider(param) {
144
146
  router.push({
145
147
  pathname: router.pathname,
146
148
  query: query
149
+ }, undefined, {
150
+ shallow: true
147
151
  });
148
152
  };
149
153
  var selectedFilters = React.useMemo(function() {
@@ -186,7 +190,9 @@ function generateFilters(param) {
186
190
  aggType: filter,
187
191
  aggKey: filterKey,
188
192
  aggOperator: filtersOperatorsMap[type]
189
- }, Boolean(selected), router));
193
+ }, Boolean(selected), router), undefined, {
194
+ shallow: true
195
+ });
190
196
  }
191
197
  };
192
198
  });
@@ -106,7 +106,9 @@ export var useSlideFilter = function(filterName, min, max) {
106
106
  aggType: filterName,
107
107
  aggKey: "".concat(formattedFrom, ",").concat(formattedTo),
108
108
  aggOperator: filtersOperatorsMap.stats
109
- }, false, router, true));
109
+ }, false, router, true), undefined, {
110
+ shallow: true
111
+ });
110
112
  }, 500);
111
113
  setState({
112
114
  from: formattedFrom,
@@ -1,9 +1,50 @@
1
+ import regeneratorRuntime from "regenerator-runtime";
1
2
  import { MyWalletGetByType } from '@sentecacommerce/sdk';
2
3
  import { useQuery } from 'react-query';
4
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
5
+ try {
6
+ var info = gen[key](arg);
7
+ var value = info.value;
8
+ } catch (error) {
9
+ reject(error);
10
+ return;
11
+ }
12
+ if (info.done) {
13
+ resolve(value);
14
+ } else {
15
+ Promise.resolve(value).then(_next, _throw);
16
+ }
17
+ }
18
+ function _asyncToGenerator(fn) {
19
+ return function() {
20
+ var self = this, args = arguments;
21
+ return new Promise(function(resolve, reject) {
22
+ var gen = fn.apply(self, args);
23
+ function _next(value) {
24
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
25
+ }
26
+ function _throw(err) {
27
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
28
+ }
29
+ _next(undefined);
30
+ });
31
+ };
32
+ }
3
33
  export var useGetMyLoyaltyCardQuery = function(callback) {
4
- return useQuery('get-loyalty-card-key', function() {
5
- return MyWalletGetByType('loyalty-program');
6
- }, {
34
+ return useQuery('get-loyalty-card-key', _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
35
+ return regeneratorRuntime.wrap(function _callee$(_ctx) {
36
+ while(1)switch(_ctx.prev = _ctx.next){
37
+ case 0:
38
+ return _ctx.abrupt("return", MyWalletGetByType('loyalty-program'));
39
+ case 1:
40
+ case "end":
41
+ return _ctx.stop();
42
+ }
43
+ }, _callee);
44
+ })), {
45
+ refetchOnMount: false,
46
+ refetchOnWindowFocus: false,
47
+ retry: false,
7
48
  onSuccess: function() {
8
49
  var ref;
9
50
  return callback === null || callback === void 0 ? void 0 : (ref = callback.onSuccess) === null || ref === void 0 ? void 0 : ref.call(callback);
@@ -95,7 +95,9 @@ export var getSelectedFilters = function(router, slug, data, config) {
95
95
  aggType: key,
96
96
  aggKey: "".concat(valueFrom, ",").concat(valueTo),
97
97
  aggOperator: filtersOperatorsMap.stats
98
- }, true, router));
98
+ }, true, router), undefined, {
99
+ shallow: true
100
+ });
99
101
  },
100
102
  selected: true,
101
103
  data: _objectSpread({}, data.raw, {
@@ -1 +1,2 @@
1
1
  export * from './useReplaceBasketMutation';
2
+ export * from './useChangeGiftVariant';
@@ -0,0 +1,2 @@
1
+ import { OrderSelectableGiftVariantUpdateDTO, OrderDTO } from '@sentecacommerce/sdk';
2
+ export declare const useChangeGiftVariantMutation: () => import("react-query").MutationResultPair<OrderDTO, unknown, OrderSelectableGiftVariantUpdateDTO, unknown>;
@@ -1,2 +1,3 @@
1
1
  export * from './useReplaceBasket';
2
2
  export * from './useBasketCrossSaleItems';
3
+ export * from './useChangeGiftVariant';
@@ -0,0 +1,2 @@
1
+ import { useChangeGiftVariantMutation } from '../api/mutations';
2
+ export { useChangeGiftVariantMutation as useChangeGiftVariant };
@@ -2,7 +2,7 @@ import { LineItemDTO, LineItemDTOLineItemModeEnum, LineItemDTOStatusEnum, MoneyD
2
2
  import { BaseProductType } from '../../useLineItem';
3
3
  import { SelectedOptionType } from '../../useProduct/utils';
4
4
  import { AssetsMap } from '../../../utils/assetsToMap';
5
- interface BasketLineItemProps extends BaseProductType {
5
+ export interface BasketLineItemProps extends BaseProductType {
6
6
  productId: string;
7
7
  lineItemId: string;
8
8
  quantityInBasket: number;
@@ -36,4 +36,3 @@ export declare const useBasketLineItem: (props: {
36
36
  item: LineItemDTO;
37
37
  expiry?: number;
38
38
  }) => BasketLineItemProps;
39
- export {};
@@ -128,6 +128,7 @@ declare type ProductProviderProps = {
128
128
  expand?: string;
129
129
  project?: string;
130
130
  };
131
+ includeBrandInName?: boolean;
131
132
  };
132
133
  declare type ProductStateContextType = {
133
134
  attributeRules: AttributeRulesMap;
@@ -163,7 +164,7 @@ declare type CountFunctionsContextType = {
163
164
  };
164
165
  getProductVideos: () => VideoType[];
165
166
  };
166
- export declare function ProductProvider({ product, children, defaultVariantId, }: ProductProviderProps): JSX.Element;
167
+ export declare function ProductProvider({ product, children, defaultVariantId, includeBrandInName, }: ProductProviderProps): JSX.Element;
167
168
  export declare function useProductState(): ProductStateContextType;
168
169
  export declare function useProductFunctions(): CountFunctionsContextType;
169
170
  export declare function useProduct(slug: string, config?: getProductBySlugConfig): import("react-query").QueryResult<ProductDTO, unknown>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sentecacommerce-theme/lib",
3
3
  "sideEffects": false,
4
- "version": "0.12.99",
4
+ "version": "0.12.103",
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": "d6b1f3475733f0402697b241e884628656aadf92",
34
+ "gitHead": "e9fda963cf3c34b48d7e8dae9326804fa4dda4ec",
35
35
  "peerDependencies": {
36
36
  "react-query": "^2.26.2"
37
37
  },
38
38
  "dependencies": {
39
- "@sentecacommerce-theme/base": "^0.12.99",
40
- "@sentecacommerce-theme/cms": "^0.12.99",
39
+ "@sentecacommerce-theme/base": "^0.12.103",
40
+ "@sentecacommerce-theme/cms": "^0.12.103",
41
41
  "@sentecacommerce/sdk": "2.0.161",
42
42
  "body-scroll-lock": "^3.1.5",
43
43
  "copy-to-clipboard": "^3.3.1",