@rebuy/rebuy-hydrogen 3.0.0-beta.2 → 3.0.0-beta.4

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 (95) hide show
  1. package/dist/components/AddToCartBtn/AddToCartBtn.d.ts.map +1 -1
  2. package/dist/components/AddToCartBtn/HydrogenAddToCartBtn.d.ts.map +1 -1
  3. package/dist/components/AddToCartBtn/HydrogenReactAddToCartBtn.d.ts.map +1 -1
  4. package/dist/components/ProductCard/ProductCard.d.ts.map +1 -1
  5. package/dist/components/ProductPrice/ProductPrice.d.ts +1 -1
  6. package/dist/components/ProductPrice/ProductPrice.d.ts.map +1 -1
  7. package/dist/components/VariantSelect/VariantSelect.d.ts +1 -1
  8. package/dist/components/VariantSelect/VariantSelect.d.ts.map +1 -1
  9. package/dist/hooks/titleLevel.d.ts.map +1 -1
  10. package/dist/index.css +88 -88
  11. package/dist/index.css.map +4 -4
  12. package/dist/index.js +187 -401
  13. package/dist/index.js.map +4 -4
  14. package/dist/index.mjs +187 -410
  15. package/dist/index.mjs.map +4 -4
  16. package/dist/providers/RebuyHydrogenContextProvider.d.ts +1 -1
  17. package/dist/providers/RebuyHydrogenContextProvider.d.ts.map +1 -1
  18. package/dist/providers/RebuyHydrogenReactContextProvider.d.ts.map +1 -1
  19. package/dist/providers/types.d.ts +1 -1
  20. package/dist/providers/types.d.ts.map +1 -1
  21. package/dist/types/rebuyCustom.d.ts.map +1 -1
  22. package/dist/types/shopify.d.ts.map +1 -1
  23. package/dist/types/widgets.d.ts +1 -1
  24. package/dist/types/widgets.d.ts.map +1 -1
  25. package/dist/utils/convertToRebuyProduct.d.ts.map +1 -1
  26. package/dist/utils/createContextParameters.d.ts.map +1 -1
  27. package/dist/utils/getEncodedAttributes.d.ts.map +1 -1
  28. package/dist/utils/getRebuyConfig.d.ts.map +1 -1
  29. package/dist/widgetContainer/RebuyWidgetContainer.d.ts +1 -1
  30. package/dist/widgetContainer/RebuyWidgetContainer.d.ts.map +1 -1
  31. package/dist/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.d.ts.map +1 -1
  32. package/dist/widgets/RebuyDynamicBundleProducts/BundleImages.d.ts.map +1 -1
  33. package/dist/widgets/RebuyDynamicBundleProducts/BundlePrice.d.ts.map +1 -1
  34. package/dist/widgets/RebuyDynamicBundleProducts/BundleSelection.d.ts +1 -1
  35. package/dist/widgets/RebuyDynamicBundleProducts/BundleSelection.d.ts.map +1 -1
  36. package/dist/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.d.ts.map +1 -1
  37. package/dist/widgets/RebuyDynamicBundleProducts/Select.d.ts.map +1 -1
  38. package/dist/widgets/RebuyProductAddOns/RebuyProductAddOnCard.d.ts.map +1 -1
  39. package/dist/widgets/RebuyProductAddOns/RebuyProductAddOns.d.ts.map +1 -1
  40. package/dist/widgets/RebuyProductAddOns/types.d.ts.map +1 -1
  41. package/dist/widgets/RebuyProductRecommendations/RebuyProductRecommendations.d.ts.map +1 -1
  42. package/package.json +66 -35
  43. package/src/components/AddToCartBtn/AddToCartBtn.tsx +0 -45
  44. package/src/components/AddToCartBtn/HydrogenAddToCartBtn.tsx +0 -43
  45. package/src/components/AddToCartBtn/HydrogenReactAddToCartBtn.tsx +0 -35
  46. package/src/components/AddToCartBtn/index.ts +0 -1
  47. package/src/components/AddToCartBtn/types.ts +0 -27
  48. package/src/components/ProductCard/ProductCard.tsx +0 -70
  49. package/src/components/ProductCard/index.ts +0 -1
  50. package/src/components/ProductCard/types.ts +0 -10
  51. package/src/components/ProductPrice/ProductPrice.tsx +0 -49
  52. package/src/components/ProductPrice/index.ts +0 -1
  53. package/src/components/Title/Title.tsx +0 -19
  54. package/src/components/Title/index.ts +0 -1
  55. package/src/components/Title/types.ts +0 -7
  56. package/src/components/VariantSelect/VariantSelect.tsx +0 -45
  57. package/src/components/VariantSelect/index.ts +0 -1
  58. package/src/components/VariantSelect/types.ts +0 -6
  59. package/src/context/RebuyContext.tsx +0 -9
  60. package/src/hooks/titleLevel.tsx +0 -42
  61. package/src/index.ts +0 -7
  62. package/src/providers/RebuyHydrogenContextProvider.tsx +0 -112
  63. package/src/providers/RebuyHydrogenReactContextProvider.tsx +0 -192
  64. package/src/providers/types.ts +0 -58
  65. package/src/queries/cart.queries.ts +0 -467
  66. package/src/types/common.ts +0 -8
  67. package/src/types/css.d.ts +0 -11
  68. package/src/types/env.d.ts +0 -12
  69. package/src/types/rebuy.d.ts +0 -31
  70. package/src/types/rebuyCustom.ts +0 -263
  71. package/src/types/rebuySmartCart.ts +0 -188
  72. package/src/types/shopify.ts +0 -142
  73. package/src/types/widgets.ts +0 -29
  74. package/src/utils/convertToRebuyProduct.tsx +0 -319
  75. package/src/utils/createContextParameters.ts +0 -142
  76. package/src/utils/getEncodedAttributes.ts +0 -11
  77. package/src/utils/getRebuyConfig.ts +0 -31
  78. package/src/widgetContainer/RebuyWidgetContainer.tsx +0 -183
  79. package/src/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.tsx +0 -50
  80. package/src/widgets/RebuyCompleteTheLook/index.ts +0 -1
  81. package/src/widgets/RebuyCompleteTheLook/types.ts +0 -5
  82. package/src/widgets/RebuyDynamicBundleProducts/BundleImages.tsx +0 -62
  83. package/src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx +0 -93
  84. package/src/widgets/RebuyDynamicBundleProducts/BundleSelection.tsx +0 -65
  85. package/src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.tsx +0 -118
  86. package/src/widgets/RebuyDynamicBundleProducts/Select.tsx +0 -41
  87. package/src/widgets/RebuyDynamicBundleProducts/index.ts +0 -1
  88. package/src/widgets/RebuyDynamicBundleProducts/types.ts +0 -23
  89. package/src/widgets/RebuyProductAddOns/RebuyProductAddOnCard.tsx +0 -66
  90. package/src/widgets/RebuyProductAddOns/RebuyProductAddOns.tsx +0 -218
  91. package/src/widgets/RebuyProductAddOns/index.ts +0 -1
  92. package/src/widgets/RebuyProductAddOns/types.ts +0 -24
  93. package/src/widgets/RebuyProductRecommendations/RebuyProductRecommendations.tsx +0 -50
  94. package/src/widgets/RebuyProductRecommendations/index.ts +0 -1
  95. package/src/widgets/RebuyProductRecommendations/types.ts +0 -5
package/dist/index.mjs CHANGED
@@ -12,12 +12,7 @@ import * as Utilities from "@rebuy/rebuy/utilities";
12
12
 
13
13
  // src/utils/getEncodedAttributes.ts
14
14
  var getEncodedAttributes = (attributes) => encodeURIComponent(
15
- JSON.stringify(
16
- attributes.reduce(
17
- (merged, { key, value }) => ({ ...merged, [key]: value }),
18
- {}
19
- )
20
- )
15
+ JSON.stringify(attributes.reduce((merged, { key, value }) => ({ ...merged, [key]: value }), {}))
21
16
  );
22
17
 
23
18
  // src/utils/createContextParameters.ts
@@ -58,18 +53,11 @@ var createContextParameters = ({
58
53
  }
59
54
  if (cartId) {
60
55
  cartContext.token = Utilities.getIdFromGraphUrl(cartId, "Cart");
61
- contextParameters.cart_token = Utilities.getIdFromGraphUrl(
62
- cartId,
63
- "Cart"
64
- );
56
+ contextParameters.cart_token = Utilities.getIdFromGraphUrl(cartId, "Cart");
65
57
  }
66
58
  if (cartSubtotal) {
67
- cartContext.subtotal = Utilities.amountToCents(
68
- parseFloat(cartSubtotal)
69
- );
70
- contextParameters.cart_subtotal = Utilities.amountToCents(
71
- parseFloat(cartSubtotal)
72
- );
59
+ cartContext.subtotal = Utilities.amountToCents(parseFloat(cartSubtotal));
60
+ contextParameters.cart_subtotal = Utilities.amountToCents(parseFloat(cartSubtotal));
73
61
  }
74
62
  if (cartLinesLength) {
75
63
  const totalLines = cartLinesLength;
@@ -92,16 +80,10 @@ var createContextParameters = ({
92
80
  variant_id: ""
93
81
  };
94
82
  if (cartItem?.merchandise?.product?.id) {
95
- item.product_id = Utilities.getIdFromGraphUrl(
96
- cartItem.merchandise.product.id,
97
- "Product"
98
- );
83
+ item.product_id = Utilities.getIdFromGraphUrl(cartItem.merchandise.product.id, "Product");
99
84
  }
100
85
  if (cartItem?.merchandise?.id) {
101
- item.variant_id = Utilities.getIdFromGraphUrl(
102
- cartItem.merchandise.id,
103
- "ProductVariant"
104
- );
86
+ item.variant_id = Utilities.getIdFromGraphUrl(cartItem.merchandise.id, "ProductVariant");
105
87
  }
106
88
  if (cartItem?.attributes?.length) {
107
89
  const validAttributes = cartItem.attributes.filter(
@@ -133,14 +115,12 @@ var getRebuyConfig = async (rebuyKey, storeDomain) => {
133
115
  parameters: { shop: storeDomain },
134
116
  url: `/api/v1/user/config`
135
117
  };
136
- const { data: rebuy, ...response } = await new RebuyClient(
137
- rebuyKey
138
- ).getShieldedAsset(request.url, request.parameters);
118
+ const { data: rebuy, ...response } = await new RebuyClient(rebuyKey, null, storeDomain).getShieldedAsset(
119
+ request.url,
120
+ request.parameters
121
+ );
139
122
  if (!rebuy?.shop) {
140
- throw new Error(
141
- "Rebuy configuration is not properly set up - missing shop",
142
- { cause: response }
143
- );
123
+ throw new Error("Rebuy configuration is not properly set up - missing shop", { cause: response });
144
124
  }
145
125
  return rebuy;
146
126
  } catch (error) {
@@ -165,6 +145,15 @@ var RebuyHydrogenContext = ({
165
145
  const primaryDomain = import.meta.env.PRIMARY_DOMAIN;
166
146
  const rebuyKey = import.meta.env.PUBLIC_REBUY_API_KEY;
167
147
  const storeDomain = import.meta.env.PUBLIC_STORE_DOMAIN;
148
+ if (!primaryDomain) {
149
+ throw new Error("Missing required environment variable: PRIMARY_DOMAIN");
150
+ }
151
+ if (!rebuyKey) {
152
+ throw new Error("Missing required environment variable: PUBLIC_REBUY_API_KEY");
153
+ }
154
+ if (!storeDomain) {
155
+ throw new Error("Missing required environment variable: PUBLIC_STORE_DOMAIN");
156
+ }
168
157
  const [rebuyConfig, setRebuyConfig] = useState(null);
169
158
  const location = useLocation();
170
159
  const queryObject = Utilities2.queryStringToObject(location.search);
@@ -192,17 +181,7 @@ var RebuyHydrogenContext = ({
192
181
  queryObject,
193
182
  windowUrl
194
183
  }),
195
- [
196
- rebuyConfig,
197
- windowUrl,
198
- queryObject,
199
- cartAttributes,
200
- cartCost,
201
- cartId,
202
- cartLines,
203
- cartQuantity,
204
- cartNote
205
- ]
184
+ [rebuyConfig, windowUrl, queryObject, cartAttributes, cartCost, cartId, cartLines, cartQuantity, cartNote]
206
185
  );
207
186
  const contextParametersJSON = JSON.stringify(contextParameters);
208
187
  const contextValue = useMemo(
@@ -211,10 +190,7 @@ var RebuyHydrogenContext = ({
211
190
  );
212
191
  return /* @__PURE__ */ jsx(RebuyContext.Provider, { value: contextValue, children });
213
192
  };
214
- var RebuyHydrogenContextProvider = ({
215
- cart,
216
- children
217
- }) => {
193
+ var RebuyHydrogenContextProvider = ({ cart, children }) => {
218
194
  return /* @__PURE__ */ jsx(Await, { resolve: cart, children: (resolvedCart) => {
219
195
  const cart2 = resolvedCart;
220
196
  return /* @__PURE__ */ jsx(
@@ -235,11 +211,7 @@ var RebuyHydrogenContextProvider = ({
235
211
  // src/providers/RebuyHydrogenReactContextProvider.tsx
236
212
  import * as Utilities3 from "@rebuy/rebuy/utilities";
237
213
  import { useLocation as useLocation2 } from "@remix-run/react";
238
- import {
239
- CartProvider,
240
- ShopifyProvider,
241
- useCart
242
- } from "@shopify/hydrogen-react";
214
+ import { CartProvider, ShopifyProvider, useCart } from "@shopify/hydrogen-react";
243
215
  import { useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
244
216
 
245
217
  // src/queries/cart.queries.ts
@@ -709,6 +681,15 @@ var RebuyHydrogenReactContext = ({ children }) => {
709
681
  const primaryDomain = import.meta.env.PRIMARY_DOMAIN;
710
682
  const rebuyKey = import.meta.env.PUBLIC_REBUY_API_KEY;
711
683
  const storeDomain = import.meta.env.PUBLIC_STORE_DOMAIN;
684
+ if (!primaryDomain) {
685
+ throw new Error("Missing required environment variable: PRIMARY_DOMAIN");
686
+ }
687
+ if (!rebuyKey) {
688
+ throw new Error("Missing required environment variable: PUBLIC_REBUY_API_KEY");
689
+ }
690
+ if (!storeDomain) {
691
+ throw new Error("Missing required environment variable: PUBLIC_STORE_DOMAIN");
692
+ }
712
693
  const [rebuyConfig, setRebuyConfig] = useState2(null);
713
694
  const location = useLocation2();
714
695
  const queryObject = Utilities3.queryStringToObject(location.search);
@@ -837,27 +818,9 @@ var RebuyHydrogenReactContextProvider = ({
837
818
  import { RebuyClient as RebuyClient2 } from "@rebuy/rebuy";
838
819
  import * as Utilities4 from "@rebuy/rebuy/utilities";
839
820
  import { flattenConnection } from "@shopify/hydrogen";
840
- import React, {
841
- useContext,
842
- useEffect as useEffect3,
843
- useMemo as useMemo3,
844
- useState as useState3
845
- } from "react";
846
- var RebuyWidgetContainerBase = ({
847
- children,
848
- ...props
849
- }) => {
850
- const {
851
- collection,
852
- collectionId,
853
- dataSource,
854
- limit,
855
- options,
856
- product,
857
- productId,
858
- variant,
859
- variantId
860
- } = props;
821
+ import React, { useContext, useEffect as useEffect3, useMemo as useMemo3, useState as useState3 } from "react";
822
+ var RebuyWidgetContainerBase = ({ children, ...props }) => {
823
+ const { collection, collectionId, dataSource, limit, options, product, productId, variant, variantId } = props;
861
824
  const contextParameters = useContext(RebuyContext);
862
825
  const [Rebuy, setRebuy] = useState3(null);
863
826
  const [initialized, setInitialized] = useState3(false);
@@ -895,48 +858,27 @@ var RebuyWidgetContainerBase = ({
895
858
  // Keeping this object generic to allow for custom endpoints
896
859
  };
897
860
  if (shopifyProductId) {
898
- request2.params.shopify_product_ids = Utilities4.getIdFromGraphUrl(
899
- shopifyProductId,
900
- "Product"
901
- );
861
+ request2.params.shopify_product_ids = Utilities4.getIdFromGraphUrl(shopifyProductId, "Product");
902
862
  }
903
863
  if (shopifyProductId) {
904
- request2.params.shopify_product_ids = Utilities4.getIdFromGraphUrl(
905
- shopifyProductId,
906
- "Product"
907
- );
864
+ request2.params.shopify_product_ids = Utilities4.getIdFromGraphUrl(shopifyProductId, "Product");
908
865
  }
909
866
  if (shopifyVariantId) {
910
- request2.params.shopify_variant_ids = Utilities4.getIdFromGraphUrl(
911
- shopifyVariantId,
912
- "ProductVariant"
913
- );
867
+ request2.params.shopify_variant_ids = Utilities4.getIdFromGraphUrl(shopifyVariantId, "ProductVariant");
914
868
  }
915
869
  if (shopifyCollectionId) {
916
- request2.params.shopify_collection_ids = Utilities4.getIdFromGraphUrl(
917
- shopifyCollectionId,
918
- "Collection"
919
- );
870
+ request2.params.shopify_collection_ids = Utilities4.getIdFromGraphUrl(shopifyCollectionId, "Collection");
920
871
  }
921
872
  if (limit) {
922
873
  request2.params.limit = limit;
923
874
  }
924
875
  return request2;
925
- }, [
926
- dataSource,
927
- shopifyProductId,
928
- shopifyVariantId,
929
- shopifyCollectionId,
930
- limit
931
- ]);
876
+ }, [dataSource, shopifyProductId, shopifyVariantId, shopifyCollectionId, limit]);
932
877
  useEffect3(() => {
933
878
  let isMounted = true;
934
879
  if (!Rebuy || !initialized) return;
935
880
  const fetchData = async () => {
936
- const { data, metadata: metadata2 } = await Rebuy.getStorefrontData(
937
- request.endpoint,
938
- request.params
939
- );
881
+ const { data, metadata: metadata2 } = await Rebuy.getStorefrontData(request.endpoint, request.params);
940
882
  if (isMounted) {
941
883
  setProducts(
942
884
  Array.isArray(data) ? data.map((product2) => ({
@@ -969,24 +911,11 @@ var RebuyWidgetContainerBase = ({
969
911
  };
970
912
  var RebuyWidgetContainer = RebuyWidgetContainerBase;
971
913
 
972
- // src/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.module.css
973
- var RebuyCompleteTheLook_default = {
974
- container: "RebuyCompleteTheLook_container",
975
- productGrid: "RebuyCompleteTheLook_productGrid",
976
- productItem: "RebuyCompleteTheLook_productItem"
977
- };
978
-
979
914
  // src/components/ProductCard/ProductCard.tsx
980
915
  import { Link } from "@remix-run/react";
981
916
  import { Image } from "@shopify/hydrogen";
982
917
  import { useState as useState4 } from "react";
983
918
 
984
- // src/components/ProductCard/ProductCard.module.css
985
- var ProductCard_default = {
986
- container: "ProductCard_container",
987
- productInfo: "ProductCard_productInfo"
988
- };
989
-
990
919
  // src/components/AddToCartBtn/HydrogenAddToCartBtn.tsx
991
920
  import { CartForm, Money } from "@shopify/hydrogen";
992
921
 
@@ -1047,22 +976,13 @@ var HydrogenReactAddToCartBtn = ({
1047
976
  linesAdd(linesToAdd);
1048
977
  addToCartCallback?.();
1049
978
  };
1050
- return /* @__PURE__ */ jsxs2(
1051
- "button",
1052
- {
1053
- className: AddToCartBtn_default.button,
1054
- disabled,
1055
- onClick: handleAddToCart,
1056
- type: "button",
1057
- children: [
1058
- addToCartBtnText,
1059
- moneyData && /* @__PURE__ */ jsxs2(Fragment2, { children: [
1060
- /* @__PURE__ */ jsx4("span", { children: " | " }),
1061
- /* @__PURE__ */ jsx4(Money2, { data: moneyData, withoutTrailingZeros: true })
1062
- ] })
1063
- ]
1064
- }
1065
- );
979
+ return /* @__PURE__ */ jsxs2("button", { className: AddToCartBtn_default.button, disabled, onClick: handleAddToCart, type: "button", children: [
980
+ addToCartBtnText,
981
+ moneyData && /* @__PURE__ */ jsxs2(Fragment2, { children: [
982
+ /* @__PURE__ */ jsx4("span", { children: " | " }),
983
+ /* @__PURE__ */ jsx4(Money2, { data: moneyData, withoutTrailingZeros: true })
984
+ ] })
985
+ ] });
1066
986
  };
1067
987
 
1068
988
  // src/components/AddToCartBtn/AddToCartBtn.tsx
@@ -1119,24 +1039,12 @@ var ProductPrice_default = {
1119
1039
 
1120
1040
  // src/components/ProductPrice/ProductPrice.tsx
1121
1041
  import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
1122
- var RebuyProductPrice = ({
1123
- selectedVariant
1124
- }) => {
1042
+ var RebuyProductPrice = ({ selectedVariant }) => {
1125
1043
  if (!selectedVariant) return null;
1126
1044
  const { compareAtPriceV2: compareAtPrice, priceV2: price } = selectedVariant;
1127
1045
  const isDiscounted = (price2, compareAtPrice2) => Number(compareAtPrice2?.amount) > Number(price2?.amount);
1128
- const CompareAtPrice = ({
1129
- data: compareAtPrice2
1130
- }) => {
1131
- return compareAtPrice2 && /* @__PURE__ */ jsx6(
1132
- Money3,
1133
- {
1134
- as: "span",
1135
- className: ProductPrice_default.compareAtPrice,
1136
- data: compareAtPrice2,
1137
- withoutTrailingZeros: true
1138
- }
1139
- );
1046
+ const CompareAtPrice = ({ data: compareAtPrice2 }) => {
1047
+ return compareAtPrice2 && /* @__PURE__ */ jsx6(Money3, { as: "span", className: ProductPrice_default.compareAtPrice, data: compareAtPrice2, withoutTrailingZeros: true });
1140
1048
  };
1141
1049
  return price && /* @__PURE__ */ jsxs3("div", { className: ProductPrice_default.priceContainer, children: [
1142
1050
  /* @__PURE__ */ jsx6(Money3, { data: price, withoutTrailingZeros: true }),
@@ -1171,17 +1079,12 @@ var VariantSelect_default = {
1171
1079
 
1172
1080
  // src/components/VariantSelect/VariantSelect.tsx
1173
1081
  import { jsx as jsx8 } from "react/jsx-runtime";
1174
- var VariantSelect = ({
1175
- handleSelectedVariant,
1176
- product
1177
- }) => {
1082
+ var VariantSelect = ({ handleSelectedVariant, product }) => {
1178
1083
  const getOptionsLabel = (product2) => {
1179
1084
  const options = product2.variants.nodes[0].selectedOptions;
1180
1085
  const optionsFromKeys = options ? Object.keys(options[0]) : [];
1181
1086
  const optionsFromValues = options ? options.map((option) => option.name) : [];
1182
- const useValues = optionsFromKeys.every(
1183
- (key) => ["name", "value"].includes(key)
1184
- );
1087
+ const useValues = optionsFromKeys.every((key) => ["name", "value"].includes(key));
1185
1088
  return (useValues ? optionsFromValues : optionsFromKeys).join(" / ");
1186
1089
  };
1187
1090
  return product?.variants.nodes.length > 1 && /* @__PURE__ */ jsx8("div", { children: /* @__PURE__ */ jsx8(
@@ -1195,6 +1098,12 @@ var VariantSelect = ({
1195
1098
  ) });
1196
1099
  };
1197
1100
 
1101
+ // src/components/ProductCard/ProductCard.module.css
1102
+ var ProductCard_default = {
1103
+ container: "ProductCard_container",
1104
+ productInfo: "ProductCard_productInfo"
1105
+ };
1106
+
1198
1107
  // src/components/ProductCard/ProductCard.tsx
1199
1108
  import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1200
1109
  var ProductCard = ({
@@ -1204,14 +1113,10 @@ var ProductCard = ({
1204
1113
  product,
1205
1114
  productCardTitleLevel
1206
1115
  }) => {
1207
- const [selectedVariant, setSelectedVariant] = useState4(
1208
- product.variants.nodes[0]
1209
- );
1116
+ const [selectedVariant, setSelectedVariant] = useState4(product.variants.nodes[0]);
1210
1117
  const { image } = selectedVariant;
1211
1118
  const handleSelectedVariant = (product2, variant_id) => {
1212
- const updatedVariant = product2.variants.nodes.find(
1213
- (variant) => variant.id === variant_id
1214
- );
1119
+ const updatedVariant = product2.variants.nodes.find((variant) => variant.id === variant_id);
1215
1120
  if (updatedVariant) {
1216
1121
  setSelectedVariant(updatedVariant);
1217
1122
  }
@@ -1227,21 +1132,9 @@ var ProductCard = ({
1227
1132
  }
1228
1133
  ) }),
1229
1134
  /* @__PURE__ */ jsxs4("div", { className: ProductCard_default.productInfo, children: [
1230
- /* @__PURE__ */ jsx9(Link, { to: `/products/${product.handle}`, children: /* @__PURE__ */ jsx9(
1231
- Title,
1232
- {
1233
- level: productCardTitleLevel,
1234
- text: product.title
1235
- }
1236
- ) }),
1135
+ /* @__PURE__ */ jsx9(Link, { to: `/products/${product.handle}`, children: /* @__PURE__ */ jsx9(Title, { level: productCardTitleLevel, text: product.title }) }),
1237
1136
  /* @__PURE__ */ jsx9(RebuyProductPrice, { selectedVariant }),
1238
- /* @__PURE__ */ jsx9(
1239
- VariantSelect,
1240
- {
1241
- handleSelectedVariant,
1242
- product
1243
- }
1244
- )
1137
+ /* @__PURE__ */ jsx9(VariantSelect, { handleSelectedVariant, product })
1245
1138
  ] })
1246
1139
  ] }),
1247
1140
  /* @__PURE__ */ jsx9(
@@ -1294,6 +1187,13 @@ var getTitleLevel = (level, decreaseLevel = false) => {
1294
1187
  }
1295
1188
  };
1296
1189
 
1190
+ // src/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.module.css
1191
+ var RebuyCompleteTheLook_default = {
1192
+ container: "RebuyCompleteTheLook_container",
1193
+ productGrid: "RebuyCompleteTheLook_productGrid",
1194
+ productItem: "RebuyCompleteTheLook_productItem"
1195
+ };
1196
+
1297
1197
  // src/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.tsx
1298
1198
  import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
1299
1199
  var RebuyCompleteTheLook = (props) => {
@@ -1310,14 +1210,7 @@ var RebuyCompleteTheLook = (props) => {
1310
1210
  return null;
1311
1211
  }
1312
1212
  return /* @__PURE__ */ jsxs5("section", { className: RebuyCompleteTheLook_default.container, children: [
1313
- /* @__PURE__ */ jsx10(
1314
- Title,
1315
- {
1316
- level: getTitleLevel(customTitleLevel),
1317
- style: customTitleStyle,
1318
- text: customTitle
1319
- }
1320
- ),
1213
+ /* @__PURE__ */ jsx10(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
1321
1214
  /* @__PURE__ */ jsx10("ul", { className: RebuyCompleteTheLook_default.productGrid, children: products.map((product) => /* @__PURE__ */ jsx10("li", { className: RebuyCompleteTheLook_default.productItem, children: /* @__PURE__ */ jsx10(
1322
1215
  ProductCard,
1323
1216
  {
@@ -1325,10 +1218,7 @@ var RebuyCompleteTheLook = (props) => {
1325
1218
  addToCartCallback,
1326
1219
  isHydrogenReact: props.isHydrogenReact,
1327
1220
  product,
1328
- productCardTitleLevel: getTitleLevel(
1329
- customTitleLevel,
1330
- true
1331
- )
1221
+ productCardTitleLevel: getTitleLevel(customTitleLevel, true)
1332
1222
  }
1333
1223
  ) }, product.id)) })
1334
1224
  ] });
@@ -1337,84 +1227,6 @@ var RebuyCompleteTheLook = (props) => {
1337
1227
  // src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.tsx
1338
1228
  import { useCallback, useEffect as useEffect4, useState as useState5 } from "react";
1339
1229
 
1340
- // src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx
1341
- import { Money as Money4 } from "@shopify/hydrogen";
1342
-
1343
- // src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.module.css
1344
- var RebuyDynamicBundleProducts_default = {
1345
- container: "RebuyDynamicBundleProducts_container",
1346
- addCartBtnContainer: "RebuyDynamicBundleProducts_addCartBtnContainer",
1347
- bundleContainer: "RebuyDynamicBundleProducts_bundleContainer",
1348
- select: "RebuyDynamicBundleProducts_select",
1349
- bundleItemRowContainer: "RebuyDynamicBundleProducts_bundleItemRowContainer",
1350
- unselected: "RebuyDynamicBundleProducts_unselected",
1351
- bundleItemRow: "RebuyDynamicBundleProducts_bundleItemRow",
1352
- bundleItemInput: "RebuyDynamicBundleProducts_bundleItemInput",
1353
- bundleItemLabel: "RebuyDynamicBundleProducts_bundleItemLabel",
1354
- bundleImages: "RebuyDynamicBundleProducts_bundleImages",
1355
- bundleImage: "RebuyDynamicBundleProducts_bundleImage",
1356
- fadeIn: "RebuyDynamicBundleProducts_fadeIn",
1357
- bundleImageDelimiter: "RebuyDynamicBundleProducts_bundleImageDelimiter",
1358
- compareAtPrice: "RebuyDynamicBundleProducts_compareAtPrice"
1359
- };
1360
-
1361
- // src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx
1362
- import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
1363
- var BundlePrice = ({ products }) => {
1364
- const isDisabled = products.filter((product) => product.selected).length < 1;
1365
- const totalBundlePrice = () => {
1366
- let total = 0;
1367
- let currencyCode = "USD";
1368
- for (const product of products) {
1369
- if (product.selected && product.selectedVariant) {
1370
- const { priceV2: price2 } = product.selectedVariant;
1371
- total += Number(price2?.amount);
1372
- currencyCode = price2?.currencyCode || "USD";
1373
- }
1374
- }
1375
- return {
1376
- amount: String(total),
1377
- currencyCode
1378
- };
1379
- };
1380
- const totalBundleCompareAtPrice = () => {
1381
- let compareAtTotal = 0;
1382
- let currencyCode = "USD";
1383
- for (const product of products) {
1384
- if (product.selected && product.selectedVariant) {
1385
- const { compareAtPriceV2: compareAtPrice2, priceV2: price2 } = product.selectedVariant;
1386
- currencyCode = price2?.currencyCode || "USD";
1387
- compareAtTotal += Number((compareAtPrice2 || price2)?.amount);
1388
- }
1389
- }
1390
- return {
1391
- amount: String(compareAtTotal),
1392
- currencyCode
1393
- };
1394
- };
1395
- const isDiscounted = (price2, compareAtPrice2) => Number(compareAtPrice2?.amount) > Number(price2?.amount);
1396
- const price = totalBundlePrice();
1397
- const compareAtPrice = totalBundleCompareAtPrice();
1398
- const CompareAtPrice = ({
1399
- data: compareAtPrice2
1400
- }) => {
1401
- return compareAtPrice2 && /* @__PURE__ */ jsx11(
1402
- Money4,
1403
- {
1404
- as: "span",
1405
- className: RebuyDynamicBundleProducts_default.compareAtPrice,
1406
- data: compareAtPrice2,
1407
- withoutTrailingZeros: true
1408
- }
1409
- );
1410
- };
1411
- return products.length > 0 && /* @__PURE__ */ jsx11("div", { className: "flex items-center flex-col", children: !isDisabled && /* @__PURE__ */ jsxs6("p", { className: "flex items-center gap-2 mb-2", children: [
1412
- /* @__PURE__ */ jsx11("span", { children: "Total Price:" }),
1413
- /* @__PURE__ */ jsx11(Money4, { as: "span", data: price, withoutTrailingZeros: true }),
1414
- isDiscounted(price, compareAtPrice) && /* @__PURE__ */ jsx11(CompareAtPrice, { data: compareAtPrice })
1415
- ] }) });
1416
- };
1417
-
1418
1230
  // src/utils/convertToRebuyProduct.tsx
1419
1231
  var convertToRebuyProduct = (isHydrogenReact, product) => {
1420
1232
  const mainProductVariants = isHydrogenReact ? product?.variants?.nodes?.map((variant) => {
@@ -1474,9 +1286,7 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
1474
1286
  },
1475
1287
  handle: product?.handle || "",
1476
1288
  id: product?.id || "",
1477
- images: [
1478
- { altText: "", height: 100, id: "", url: "", width: 100 }
1479
- ],
1289
+ images: [{ altText: "", height: 100, id: "", url: "", width: 100 }],
1480
1290
  media: [],
1481
1291
  metafields: [],
1482
1292
  options: [],
@@ -1485,12 +1295,9 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
1485
1295
  minVariantPrice: { amount: "0", currencyCode: "USD" }
1486
1296
  },
1487
1297
  selected: true,
1488
- selectedOptions: product?.selectedVariant?.selectedOptions?.reduce(
1489
- (acc, option) => {
1490
- return { ...acc, [option.name]: option.value };
1491
- },
1492
- {}
1493
- ) || {},
1298
+ selectedOptions: product?.selectedVariant?.selectedOptions?.reduce((acc, option) => {
1299
+ return { ...acc, [option.name]: option.value };
1300
+ }, {}) || {},
1494
1301
  selectedSellingPlan: {},
1495
1302
  selectedSellingPlanAllocation: {},
1496
1303
  selectedVariant: {
@@ -1567,12 +1374,9 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
1567
1374
  minVariantPrice: { amount: "0", currencyCode: "USD" }
1568
1375
  },
1569
1376
  selected: true,
1570
- selectedOptions: product?.selectedOrFirstAvailableVariant?.selectedOptions?.reduce(
1571
- (acc, option) => {
1572
- return { ...acc, [option.name]: option.value };
1573
- },
1574
- {}
1575
- ) || {},
1377
+ selectedOptions: product?.selectedOrFirstAvailableVariant?.selectedOptions?.reduce((acc, option) => {
1378
+ return { ...acc, [option.name]: option.value };
1379
+ }, {}) || {},
1576
1380
  selectedSellingPlan: {},
1577
1381
  selectedSellingPlanAllocation: {},
1578
1382
  selectedVariant: {
@@ -1650,12 +1454,32 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
1650
1454
  import { Link as Link2 } from "@remix-run/react";
1651
1455
  import { Image as Image2 } from "@shopify/hydrogen";
1652
1456
  import { Fragment as Fragment3 } from "react";
1653
- import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
1457
+
1458
+ // src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.module.css
1459
+ var RebuyDynamicBundleProducts_default = {
1460
+ container: "RebuyDynamicBundleProducts_container",
1461
+ addCartBtnContainer: "RebuyDynamicBundleProducts_addCartBtnContainer",
1462
+ bundleContainer: "RebuyDynamicBundleProducts_bundleContainer",
1463
+ select: "RebuyDynamicBundleProducts_select",
1464
+ bundleItemRowContainer: "RebuyDynamicBundleProducts_bundleItemRowContainer",
1465
+ unselected: "RebuyDynamicBundleProducts_unselected",
1466
+ bundleItemRow: "RebuyDynamicBundleProducts_bundleItemRow",
1467
+ bundleItemInput: "RebuyDynamicBundleProducts_bundleItemInput",
1468
+ bundleItemLabel: "RebuyDynamicBundleProducts_bundleItemLabel",
1469
+ bundleImages: "RebuyDynamicBundleProducts_bundleImages",
1470
+ bundleImage: "RebuyDynamicBundleProducts_bundleImage",
1471
+ "fade-in": "RebuyDynamicBundleProducts_fade-in",
1472
+ bundleImageDelimiter: "RebuyDynamicBundleProducts_bundleImageDelimiter",
1473
+ compareAtPrice: "RebuyDynamicBundleProducts_compareAtPrice"
1474
+ };
1475
+
1476
+ // src/widgets/RebuyDynamicBundleProducts/BundleImages.tsx
1477
+ import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
1654
1478
  var BundleImages = ({ products }) => {
1655
1479
  const selected = products.filter((product) => product.selected);
1656
- return /* @__PURE__ */ jsx12("ul", { className: RebuyDynamicBundleProducts_default.bundleImages, children: products.map((product, index) => {
1480
+ return /* @__PURE__ */ jsx11("ul", { className: RebuyDynamicBundleProducts_default.bundleImages, children: products.map((product, index) => {
1657
1481
  const image = product.selectedVariant?.image;
1658
- const productImage = image ? /* @__PURE__ */ jsx12(
1482
+ const productImage = image ? /* @__PURE__ */ jsx11(
1659
1483
  Image2,
1660
1484
  {
1661
1485
  alt: image.altText || `Picture of ${product.title}`,
@@ -1670,66 +1494,53 @@ var BundleImages = ({ products }) => {
1670
1494
  product.title
1671
1495
  );
1672
1496
  const showDelimiter = selected[0]?.id !== product.id;
1673
- return /* @__PURE__ */ jsx12(Fragment3, { children: product.selected && /* @__PURE__ */ jsxs7(Fragment4, { children: [
1674
- showDelimiter && /* @__PURE__ */ jsx12("li", { className: RebuyDynamicBundleProducts_default.bundleImageDelimiter, children: /* @__PURE__ */ jsx12("span", { children: "+" }) }),
1675
- /* @__PURE__ */ jsx12("li", { className: "flex items-center", children: product.default ? (
1497
+ return /* @__PURE__ */ jsx11(Fragment3, { children: product.selected && /* @__PURE__ */ jsxs6(Fragment4, { children: [
1498
+ showDelimiter && /* @__PURE__ */ jsx11("li", { className: RebuyDynamicBundleProducts_default.bundleImageDelimiter, children: /* @__PURE__ */ jsx11("span", { children: "+" }) }),
1499
+ /* @__PURE__ */ jsx11("li", { className: "flex items-center", children: product.default ? (
1676
1500
  // Already on product page
1677
1501
  productImage
1678
1502
  ) : (
1679
1503
  // Link to product
1680
- /* @__PURE__ */ jsx12(
1681
- Link2,
1682
- {
1683
- title: product.title,
1684
- to: `/products/${product.handle}`,
1685
- children: productImage
1686
- }
1687
- )
1504
+ /* @__PURE__ */ jsx11(Link2, { title: product.title, to: `/products/${product.handle}`, children: productImage })
1688
1505
  ) })
1689
1506
  ] }) }, product.id + "-BundleImages-" + index);
1690
1507
  }) });
1691
1508
  };
1692
1509
 
1693
1510
  // src/widgets/RebuyDynamicBundleProducts/Select.tsx
1694
- import { jsx as jsx13 } from "react/jsx-runtime";
1511
+ import { jsx as jsx12 } from "react/jsx-runtime";
1695
1512
  var Select = ({ onSelectVariant, product }) => {
1696
1513
  const getOptionsLabel = (product2) => {
1697
1514
  const options = product2.variants.nodes[0].selectedOptions;
1698
1515
  const optionsFromKeys = options ? Object.keys(options[0]) : [];
1699
1516
  const optionsFromValues = options ? options.map((option) => option.name) : [];
1700
- const useValues = optionsFromKeys.every(
1701
- (key) => ["name", "value"].includes(key)
1702
- );
1517
+ const useValues = optionsFromKeys.every((key) => ["name", "value"].includes(key));
1703
1518
  return (useValues ? optionsFromValues : optionsFromKeys).join(" / ");
1704
1519
  };
1705
- return product && /* @__PURE__ */ jsx13(
1520
+ return product && /* @__PURE__ */ jsx12(
1706
1521
  "select",
1707
1522
  {
1708
1523
  "aria-label": "select variant",
1709
1524
  className: RebuyDynamicBundleProducts_default.select,
1710
1525
  onChange: (e) => onSelectVariant(product, e.target.value),
1711
1526
  value: product.selectedVariant.id,
1712
- children: /* @__PURE__ */ jsx13("optgroup", { label: getOptionsLabel(product), children: product.variants.nodes.map(({ id, title }) => /* @__PURE__ */ jsx13("option", { value: id, children: title }, id + "-BundleVariant")) })
1527
+ children: /* @__PURE__ */ jsx12("optgroup", { label: getOptionsLabel(product), children: product.variants.nodes.map(({ id, title }) => /* @__PURE__ */ jsx12("option", { value: id, children: title }, id + "-BundleVariant")) })
1713
1528
  }
1714
1529
  );
1715
1530
  };
1716
1531
 
1717
1532
  // src/widgets/RebuyDynamicBundleProducts/BundleSelection.tsx
1718
- import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
1719
- var BundleSelection = ({
1720
- onSelectVariant,
1721
- onToggleBundleItem,
1722
- products
1723
- }) => {
1724
- return /* @__PURE__ */ jsx14("ul", { children: products.map((product, index) => {
1533
+ import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
1534
+ var BundleSelection = ({ onSelectVariant, onToggleBundleItem, products }) => {
1535
+ return /* @__PURE__ */ jsx13("ul", { children: products.map((product, index) => {
1725
1536
  const { availableForSale } = product.selectedVariant;
1726
1537
  const isOutOfStock = !availableForSale;
1727
- return /* @__PURE__ */ jsx14(
1538
+ return /* @__PURE__ */ jsx13(
1728
1539
  "li",
1729
1540
  {
1730
1541
  className: `${RebuyDynamicBundleProducts_default.bundleItemRowContainer} ${!product.selected && RebuyDynamicBundleProducts_default.unselected}`,
1731
- children: /* @__PURE__ */ jsxs8("div", { className: RebuyDynamicBundleProducts_default.bundleItemRow, children: [
1732
- /* @__PURE__ */ jsx14(
1542
+ children: /* @__PURE__ */ jsxs7("div", { className: RebuyDynamicBundleProducts_default.bundleItemRow, children: [
1543
+ /* @__PURE__ */ jsx13(
1733
1544
  "input",
1734
1545
  {
1735
1546
  checked: product.selected && availableForSale,
@@ -1741,32 +1552,14 @@ var BundleSelection = ({
1741
1552
  value: product.id
1742
1553
  }
1743
1554
  ),
1744
- /* @__PURE__ */ jsxs8("div", { className: RebuyDynamicBundleProducts_default.bundleItemInput, children: [
1745
- /* @__PURE__ */ jsxs8(
1746
- "label",
1747
- {
1748
- className: RebuyDynamicBundleProducts_default.bundleItemLabel,
1749
- htmlFor: `${product.id}-toggle`,
1750
- children: [
1751
- isOutOfStock && /* @__PURE__ */ jsx14("b", { children: "SOLD OUT" }),
1752
- product.default && /* @__PURE__ */ jsx14("b", { children: "This item:" }),
1753
- product.title,
1754
- /* @__PURE__ */ jsx14(
1755
- RebuyProductPrice,
1756
- {
1757
- selectedVariant: product.selectedVariant
1758
- }
1759
- )
1760
- ]
1761
- }
1762
- ),
1763
- product.variants.nodes.length > 1 && /* @__PURE__ */ jsx14(
1764
- Select,
1765
- {
1766
- onSelectVariant,
1767
- product
1768
- }
1769
- )
1555
+ /* @__PURE__ */ jsxs7("div", { className: RebuyDynamicBundleProducts_default.bundleItemInput, children: [
1556
+ /* @__PURE__ */ jsxs7("label", { className: RebuyDynamicBundleProducts_default.bundleItemLabel, htmlFor: `${product.id}-toggle`, children: [
1557
+ isOutOfStock && /* @__PURE__ */ jsx13("b", { children: "SOLD OUT" }),
1558
+ product.default && /* @__PURE__ */ jsx13("b", { children: "This item:" }),
1559
+ product.title,
1560
+ /* @__PURE__ */ jsx13(RebuyProductPrice, { selectedVariant: product.selectedVariant })
1561
+ ] }),
1562
+ product.variants.nodes.length > 1 && /* @__PURE__ */ jsx13(Select, { onSelectVariant, product })
1770
1563
  ] })
1771
1564
  ] })
1772
1565
  },
@@ -1775,6 +1568,54 @@ var BundleSelection = ({
1775
1568
  }) });
1776
1569
  };
1777
1570
 
1571
+ // src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx
1572
+ import { Money as Money4 } from "@shopify/hydrogen";
1573
+ import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
1574
+ var BundlePrice = ({ products }) => {
1575
+ const isDisabled = products.filter((product) => product.selected).length < 1;
1576
+ const totalBundlePrice = () => {
1577
+ let total = 0;
1578
+ let currencyCode = "USD";
1579
+ for (const product of products) {
1580
+ if (product.selected && product.selectedVariant) {
1581
+ const { priceV2: price2 } = product.selectedVariant;
1582
+ total += Number(price2?.amount);
1583
+ currencyCode = price2?.currencyCode || "USD";
1584
+ }
1585
+ }
1586
+ return {
1587
+ amount: String(total),
1588
+ currencyCode
1589
+ };
1590
+ };
1591
+ const totalBundleCompareAtPrice = () => {
1592
+ let compareAtTotal = 0;
1593
+ let currencyCode = "USD";
1594
+ for (const product of products) {
1595
+ if (product.selected && product.selectedVariant) {
1596
+ const { compareAtPriceV2: compareAtPrice2, priceV2: price2 } = product.selectedVariant;
1597
+ currencyCode = price2?.currencyCode || "USD";
1598
+ compareAtTotal += Number((compareAtPrice2 || price2)?.amount);
1599
+ }
1600
+ }
1601
+ return {
1602
+ amount: String(compareAtTotal),
1603
+ currencyCode
1604
+ };
1605
+ };
1606
+ const isDiscounted = (price2, compareAtPrice2) => Number(compareAtPrice2?.amount) > Number(price2?.amount);
1607
+ const price = totalBundlePrice();
1608
+ const compareAtPrice = totalBundleCompareAtPrice();
1609
+ const CompareAtPrice = ({ data: compareAtPrice2 }) => {
1610
+ return compareAtPrice2 && /* @__PURE__ */ jsx14(Money4, { as: "span", className: RebuyDynamicBundleProducts_default.compareAtPrice, data: compareAtPrice2, withoutTrailingZeros: true });
1611
+ };
1612
+ return products.length > 0 && /* @__PURE__ */ jsx14("div", { className: "flex items-center flex-col", children: !isDisabled && /* @__PURE__ */ jsxs8("p", { className: "flex items-center gap-2 mb-2", children: [
1613
+ /* @__PURE__ */ jsx14("span", { children: "Total Price:" }),
1614
+ /* @__PURE__ */ jsx14(Money4, { as: "span", data: price, withoutTrailingZeros: true }),
1615
+ isDiscounted(price, compareAtPrice) && /* @__PURE__ */ jsx14(CompareAtPrice, { data: compareAtPrice })
1616
+ ] }) });
1617
+ };
1618
+
1778
1619
  // src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.tsx
1779
1620
  import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
1780
1621
  var RebuyDynamicBundleProducts = (props) => {
@@ -1790,10 +1631,7 @@ var RebuyDynamicBundleProducts = (props) => {
1790
1631
  } = props;
1791
1632
  const [bundleProducts, setBundleProducts] = useState5([]);
1792
1633
  useEffect4(() => {
1793
- const mainProduct = convertToRebuyProduct(
1794
- isHydrogenReact || false,
1795
- product
1796
- );
1634
+ const mainProduct = convertToRebuyProduct(isHydrogenReact || false, product);
1797
1635
  const formattedProducts = products.map((product2) => {
1798
1636
  return {
1799
1637
  ...product2,
@@ -1812,9 +1650,7 @@ var RebuyDynamicBundleProducts = (props) => {
1812
1650
  );
1813
1651
  const onSelectVariant = useCallback(
1814
1652
  (product2, variant_id) => {
1815
- const variant = product2.variants.nodes.find(
1816
- ({ id }) => id === variant_id
1817
- );
1653
+ const variant = product2.variants.nodes.find(({ id }) => id === variant_id);
1818
1654
  if (variant) {
1819
1655
  product2.selectedVariant = variant;
1820
1656
  product2.selected = variant.availableForSale || false;
@@ -1828,14 +1664,7 @@ var RebuyDynamicBundleProducts = (props) => {
1828
1664
  return null;
1829
1665
  }
1830
1666
  return /* @__PURE__ */ jsxs9("section", { className: RebuyDynamicBundleProducts_default.container, children: [
1831
- /* @__PURE__ */ jsx15(
1832
- Title,
1833
- {
1834
- level: getTitleLevel(customTitleLevel),
1835
- style: customTitleStyle,
1836
- text: customTitle
1837
- }
1838
- ),
1667
+ /* @__PURE__ */ jsx15(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
1839
1668
  /* @__PURE__ */ jsxs9("div", { className: RebuyDynamicBundleProducts_default.bundleContainer, children: [
1840
1669
  /* @__PURE__ */ jsx15(BundleImages, { products: bundleProducts }),
1841
1670
  /* @__PURE__ */ jsx15(BundlePrice, { products: bundleProducts }),
@@ -1922,20 +1751,8 @@ var RebuyProductAddOnCard = ({
1922
1751
  /* @__PURE__ */ jsxs10("div", { className: RebuyProductAddOns_default.addOnCardTextContent, children: [
1923
1752
  !availableForSale && /* @__PURE__ */ jsx16("p", { className: RebuyProductAddOns_default.addOnCardOutOfStock, children: outOfStockText }),
1924
1753
  /* @__PURE__ */ jsx16(Title, { level: titleLevel, text: product.title }),
1925
- /* @__PURE__ */ jsx16(
1926
- RebuyProductPrice,
1927
- {
1928
- selectedVariant: product.selectedVariant
1929
- }
1930
- ),
1931
- /* @__PURE__ */ jsx16(
1932
- Link3,
1933
- {
1934
- className: RebuyProductAddOns_default.addOnCardLearnMore,
1935
- to: `/products/${product.handle}`,
1936
- children: learnMoreText
1937
- }
1938
- )
1754
+ /* @__PURE__ */ jsx16(RebuyProductPrice, { selectedVariant: product.selectedVariant }),
1755
+ /* @__PURE__ */ jsx16(Link3, { className: RebuyProductAddOns_default.addOnCardLearnMore, to: `/products/${product.handle}`, children: learnMoreText })
1939
1756
  ] })
1940
1757
  ] }) });
1941
1758
  };
@@ -1986,10 +1803,7 @@ var RebuyProductAddOns = (props) => {
1986
1803
  });
1987
1804
  setAddedItems(products);
1988
1805
  if (includeMainProduct) {
1989
- setAddedItems([
1990
- convertToRebuyProduct(isHydrogenReact || false, product),
1991
- ...products
1992
- ]);
1806
+ setAddedItems([convertToRebuyProduct(isHydrogenReact || false, product), ...products]);
1993
1807
  } else {
1994
1808
  setAddedItems(products);
1995
1809
  }
@@ -1997,9 +1811,7 @@ var RebuyProductAddOns = (props) => {
1997
1811
  const handleChange = useCallback2(
1998
1812
  (event, product2) => {
1999
1813
  const newProducts = [...products];
2000
- const productIndex = newProducts.findIndex(
2001
- (p) => p.id === product2.id
2002
- );
1814
+ const productIndex = newProducts.findIndex((p) => p.id === product2.id);
2003
1815
  if (productIndex !== -1) {
2004
1816
  newProducts[productIndex] = {
2005
1817
  ...newProducts[productIndex],
@@ -2009,9 +1821,7 @@ var RebuyProductAddOns = (props) => {
2009
1821
  if (event.target.checked) {
2010
1822
  setAddedItems((prev) => [...prev, product2]);
2011
1823
  } else {
2012
- setAddedItems(
2013
- (prev) => prev.filter((item) => item.id !== product2.id)
2014
- );
1824
+ setAddedItems((prev) => prev.filter((item) => item.id !== product2.id));
2015
1825
  }
2016
1826
  }
2017
1827
  },
@@ -2044,14 +1854,7 @@ var RebuyProductAddOns = (props) => {
2044
1854
  return null;
2045
1855
  }
2046
1856
  return /* @__PURE__ */ jsxs11("div", { className: RebuyProductAddOns_default.container, children: [
2047
- /* @__PURE__ */ jsx17(
2048
- Title,
2049
- {
2050
- level: getTitleLevel(customTitleLevel),
2051
- style: customTitleStyle,
2052
- text: customTitle
2053
- }
2054
- ),
1857
+ /* @__PURE__ */ jsx17(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
2055
1858
  /* @__PURE__ */ jsx17("ul", { className: RebuyProductAddOns_default.productAddOnsList, children: products.map((product2) => /* @__PURE__ */ jsx17("li", { children: /* @__PURE__ */ jsx17(
2056
1859
  RebuyProductAddOnCard,
2057
1860
  {
@@ -2065,23 +1868,11 @@ var RebuyProductAddOns = (props) => {
2065
1868
  /* @__PURE__ */ jsxs11("div", { className: RebuyProductAddOns_default.productAddOnsFooter, children: [
2066
1869
  /* @__PURE__ */ jsxs11("div", { className: RebuyProductAddOns_default.moneyContainer, children: [
2067
1870
  subtotalText,
2068
- subtotalWithOutProduct && /* @__PURE__ */ jsx17(
2069
- Money5,
2070
- {
2071
- data: subtotalWithOutProduct,
2072
- withoutTrailingZeros: true
2073
- }
2074
- )
1871
+ subtotalWithOutProduct && /* @__PURE__ */ jsx17(Money5, { data: subtotalWithOutProduct, withoutTrailingZeros: true })
2075
1872
  ] }),
2076
1873
  includeMainProduct && /* @__PURE__ */ jsxs11("div", { className: RebuyProductAddOns_default.moneyContainer, children: [
2077
1874
  withProductText,
2078
- subtotalWithProduct && /* @__PURE__ */ jsx17(
2079
- Money5,
2080
- {
2081
- data: subtotalWithProduct,
2082
- withoutTrailingZeros: true
2083
- }
2084
- )
1875
+ subtotalWithProduct && /* @__PURE__ */ jsx17(Money5, { data: subtotalWithProduct, withoutTrailingZeros: true })
2085
1876
  ] }),
2086
1877
  /* @__PURE__ */ jsx17("div", { className: RebuyProductAddOns_default.addCartBtnContainer, children: includeMainProduct ? /* @__PURE__ */ jsx17(
2087
1878
  AddToCartBtn,
@@ -2091,9 +1882,7 @@ var RebuyProductAddOns = (props) => {
2091
1882
  disabled: addedItems.length === 0,
2092
1883
  isHydrogenReact,
2093
1884
  moneyData: subtotalWithProduct,
2094
- selectedVariants: addedItems.map(
2095
- (item) => item.selectedVariant
2096
- )
1885
+ selectedVariants: addedItems.map((item) => item.selectedVariant)
2097
1886
  }
2098
1887
  ) : /* @__PURE__ */ jsx17(
2099
1888
  AddToCartBtn,
@@ -2103,9 +1892,7 @@ var RebuyProductAddOns = (props) => {
2103
1892
  disabled: addedItems.length === 0,
2104
1893
  isHydrogenReact,
2105
1894
  moneyData: subtotalWithOutProduct,
2106
- selectedVariants: addedItems.map(
2107
- (item) => item.selectedVariant
2108
- )
1895
+ selectedVariants: addedItems.map((item) => item.selectedVariant)
2109
1896
  }
2110
1897
  ) })
2111
1898
  ] })
@@ -2134,14 +1921,7 @@ var RebuyProductRecommendations = (props) => {
2134
1921
  return null;
2135
1922
  }
2136
1923
  return /* @__PURE__ */ jsxs12("section", { className: RebuyProductRecommendations_default.container, children: [
2137
- /* @__PURE__ */ jsx18(
2138
- Title,
2139
- {
2140
- level: getTitleLevel(customTitleLevel),
2141
- style: customTitleStyle,
2142
- text: customTitle
2143
- }
2144
- ),
1924
+ /* @__PURE__ */ jsx18(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
2145
1925
  /* @__PURE__ */ jsx18("ul", { className: RebuyProductRecommendations_default.productGrid, children: products.map((product) => /* @__PURE__ */ jsx18("li", { className: RebuyProductRecommendations_default.productItem, children: /* @__PURE__ */ jsx18(
2146
1926
  ProductCard,
2147
1927
  {
@@ -2149,10 +1929,7 @@ var RebuyProductRecommendations = (props) => {
2149
1929
  addToCartCallback,
2150
1930
  isHydrogenReact: props.isHydrogenReact,
2151
1931
  product,
2152
- productCardTitleLevel: getTitleLevel(
2153
- customTitleLevel,
2154
- true
2155
- )
1932
+ productCardTitleLevel: getTitleLevel(customTitleLevel, true)
2156
1933
  }
2157
1934
  ) }, product.id)) })
2158
1935
  ] });