@sledge-app/react-instant-search 2.0.41 → 2.0.43

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.
@@ -683,6 +683,14 @@ const convertToQueryParams = (obj) => {
683
683
  });
684
684
  return queryParams;
685
685
  };
686
+ const translate = (props) => {
687
+ var _a;
688
+ const { locale, translationObject, objectKey, callbackValue } = props;
689
+ if (!locale)
690
+ return callbackValue;
691
+ const translation = (_a = translationObject == null ? void 0 : translationObject[locale]) == null ? void 0 : _a[objectKey];
692
+ return translation || callbackValue;
693
+ };
686
694
  const root = "";
687
695
  const Loading = "";
688
696
  const ConfirmationPopup = "";
@@ -4455,6 +4463,7 @@ const ProductCard = React__default.memo((props) => {
4455
4463
  additionalCardProps,
4456
4464
  keyword
4457
4465
  } = props;
4466
+ const { locale } = React__default.useContext(SledgeContext) || {};
4458
4467
  const {
4459
4468
  show_vendor = true,
4460
4469
  show_sku = true,
@@ -4466,7 +4475,34 @@ const ProductCard = React__default.memo((props) => {
4466
4475
  display_price_style = {},
4467
4476
  display_button_add_to_cart_style = {}
4468
4477
  } = setting || {};
4469
- const { product, variants } = item || {};
4478
+ let { product, variants } = item || {};
4479
+ const translateDefaultProps = {
4480
+ locale: isComponentJsVersion ? selectedLocaleJs() : locale,
4481
+ translationObject: product == null ? void 0 : product.translations
4482
+ };
4483
+ product = {
4484
+ ...product,
4485
+ title: translate({
4486
+ ...translateDefaultProps,
4487
+ objectKey: "title",
4488
+ callbackValue: product == null ? void 0 : product.title
4489
+ }),
4490
+ vendor: translate({
4491
+ ...translateDefaultProps,
4492
+ objectKey: "vendor",
4493
+ callbackValue: product == null ? void 0 : product.vendor
4494
+ }),
4495
+ handle: translate({
4496
+ ...translateDefaultProps,
4497
+ objectKey: "handle",
4498
+ callbackValue: product == null ? void 0 : product.handle
4499
+ }),
4500
+ product_type: translate({
4501
+ ...translateDefaultProps,
4502
+ objectKey: "product_type",
4503
+ callbackValue: product == null ? void 0 : product.product_type
4504
+ })
4505
+ };
4470
4506
  const { id, title, image, url, vendor = "", currency, handle, images } = product || {};
4471
4507
  const {
4472
4508
  id: variant_id = "",