@sentecacommerce-theme/lib 0.12.100 → 0.12.101

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.
@@ -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);
@@ -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;
@@ -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.100",
4
+ "version": "0.12.101",
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": "154b2ef905a065ffd2705510e779c4101004a42d",
34
+ "gitHead": "b48bfd0a30f37d4720d671c959e84d4943fb4f6d",
35
35
  "peerDependencies": {
36
36
  "react-query": "^2.26.2"
37
37
  },
38
38
  "dependencies": {
39
- "@sentecacommerce-theme/base": "^0.12.100",
40
- "@sentecacommerce-theme/cms": "^0.12.100",
39
+ "@sentecacommerce-theme/base": "^0.12.101",
40
+ "@sentecacommerce-theme/cms": "^0.12.101",
41
41
  "@sentecacommerce/sdk": "2.0.161",
42
42
  "body-scroll-lock": "^3.1.5",
43
43
  "copy-to-clipboard": "^3.3.1",