@rebuy/rebuy-hydrogen 3.0.0-beta.3 → 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 (42) 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 +3 -1
package/dist/index.js CHANGED
@@ -54,12 +54,7 @@ var Utilities = __toESM(require("@rebuy/rebuy/utilities"), 1);
54
54
 
55
55
  // src/utils/getEncodedAttributes.ts
56
56
  var getEncodedAttributes = (attributes) => encodeURIComponent(
57
- JSON.stringify(
58
- attributes.reduce(
59
- (merged, { key, value }) => ({ ...merged, [key]: value }),
60
- {}
61
- )
62
- )
57
+ JSON.stringify(attributes.reduce((merged, { key, value }) => ({ ...merged, [key]: value }), {}))
63
58
  );
64
59
 
65
60
  // src/utils/createContextParameters.ts
@@ -100,18 +95,11 @@ var createContextParameters = ({
100
95
  }
101
96
  if (cartId) {
102
97
  cartContext.token = Utilities.getIdFromGraphUrl(cartId, "Cart");
103
- contextParameters.cart_token = Utilities.getIdFromGraphUrl(
104
- cartId,
105
- "Cart"
106
- );
98
+ contextParameters.cart_token = Utilities.getIdFromGraphUrl(cartId, "Cart");
107
99
  }
108
100
  if (cartSubtotal) {
109
- cartContext.subtotal = Utilities.amountToCents(
110
- parseFloat(cartSubtotal)
111
- );
112
- contextParameters.cart_subtotal = Utilities.amountToCents(
113
- parseFloat(cartSubtotal)
114
- );
101
+ cartContext.subtotal = Utilities.amountToCents(parseFloat(cartSubtotal));
102
+ contextParameters.cart_subtotal = Utilities.amountToCents(parseFloat(cartSubtotal));
115
103
  }
116
104
  if (cartLinesLength) {
117
105
  const totalLines = cartLinesLength;
@@ -134,16 +122,10 @@ var createContextParameters = ({
134
122
  variant_id: ""
135
123
  };
136
124
  if (cartItem?.merchandise?.product?.id) {
137
- item.product_id = Utilities.getIdFromGraphUrl(
138
- cartItem.merchandise.product.id,
139
- "Product"
140
- );
125
+ item.product_id = Utilities.getIdFromGraphUrl(cartItem.merchandise.product.id, "Product");
141
126
  }
142
127
  if (cartItem?.merchandise?.id) {
143
- item.variant_id = Utilities.getIdFromGraphUrl(
144
- cartItem.merchandise.id,
145
- "ProductVariant"
146
- );
128
+ item.variant_id = Utilities.getIdFromGraphUrl(cartItem.merchandise.id, "ProductVariant");
147
129
  }
148
130
  if (cartItem?.attributes?.length) {
149
131
  const validAttributes = cartItem.attributes.filter(
@@ -175,14 +157,12 @@ var getRebuyConfig = async (rebuyKey, storeDomain) => {
175
157
  parameters: { shop: storeDomain },
176
158
  url: `/api/v1/user/config`
177
159
  };
178
- const { data: rebuy, ...response } = await new import_rebuy.RebuyClient(
179
- rebuyKey
180
- ).getShieldedAsset(request.url, request.parameters);
160
+ const { data: rebuy, ...response } = await new import_rebuy.RebuyClient(rebuyKey, null, storeDomain).getShieldedAsset(
161
+ request.url,
162
+ request.parameters
163
+ );
181
164
  if (!rebuy?.shop) {
182
- throw new Error(
183
- "Rebuy configuration is not properly set up - missing shop",
184
- { cause: response }
185
- );
165
+ throw new Error("Rebuy configuration is not properly set up - missing shop", { cause: response });
186
166
  }
187
167
  return rebuy;
188
168
  } catch (error) {
@@ -207,6 +187,15 @@ var RebuyHydrogenContext = ({
207
187
  const primaryDomain = process.env.PRIMARY_DOMAIN;
208
188
  const rebuyKey = process.env.PUBLIC_REBUY_API_KEY;
209
189
  const storeDomain = process.env.PUBLIC_STORE_DOMAIN;
190
+ if (!primaryDomain) {
191
+ throw new Error("Missing required environment variable: PRIMARY_DOMAIN");
192
+ }
193
+ if (!rebuyKey) {
194
+ throw new Error("Missing required environment variable: PUBLIC_REBUY_API_KEY");
195
+ }
196
+ if (!storeDomain) {
197
+ throw new Error("Missing required environment variable: PUBLIC_STORE_DOMAIN");
198
+ }
210
199
  const [rebuyConfig, setRebuyConfig] = (0, import_react3.useState)(null);
211
200
  const location = (0, import_react2.useLocation)();
212
201
  const queryObject = Utilities2.queryStringToObject(location.search);
@@ -234,17 +223,7 @@ var RebuyHydrogenContext = ({
234
223
  queryObject,
235
224
  windowUrl
236
225
  }),
237
- [
238
- rebuyConfig,
239
- windowUrl,
240
- queryObject,
241
- cartAttributes,
242
- cartCost,
243
- cartId,
244
- cartLines,
245
- cartQuantity,
246
- cartNote
247
- ]
226
+ [rebuyConfig, windowUrl, queryObject, cartAttributes, cartCost, cartId, cartLines, cartQuantity, cartNote]
248
227
  );
249
228
  const contextParametersJSON = JSON.stringify(contextParameters);
250
229
  const contextValue = (0, import_react3.useMemo)(
@@ -253,10 +232,7 @@ var RebuyHydrogenContext = ({
253
232
  );
254
233
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RebuyContext.Provider, { value: contextValue, children });
255
234
  };
256
- var RebuyHydrogenContextProvider = ({
257
- cart,
258
- children
259
- }) => {
235
+ var RebuyHydrogenContextProvider = ({ cart, children }) => {
260
236
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.Await, { resolve: cart, children: (resolvedCart) => {
261
237
  const cart2 = resolvedCart;
262
238
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -747,6 +723,15 @@ var RebuyHydrogenReactContext = ({ children }) => {
747
723
  const primaryDomain = process.env.PRIMARY_DOMAIN;
748
724
  const rebuyKey = process.env.PUBLIC_REBUY_API_KEY;
749
725
  const storeDomain = process.env.PUBLIC_STORE_DOMAIN;
726
+ if (!primaryDomain) {
727
+ throw new Error("Missing required environment variable: PRIMARY_DOMAIN");
728
+ }
729
+ if (!rebuyKey) {
730
+ throw new Error("Missing required environment variable: PUBLIC_REBUY_API_KEY");
731
+ }
732
+ if (!storeDomain) {
733
+ throw new Error("Missing required environment variable: PUBLIC_STORE_DOMAIN");
734
+ }
750
735
  const [rebuyConfig, setRebuyConfig] = (0, import_react5.useState)(null);
751
736
  const location = (0, import_react4.useLocation)();
752
737
  const queryObject = Utilities3.queryStringToObject(location.search);
@@ -876,21 +861,8 @@ var import_rebuy2 = require("@rebuy/rebuy");
876
861
  var Utilities4 = __toESM(require("@rebuy/rebuy/utilities"), 1);
877
862
  var import_hydrogen = require("@shopify/hydrogen");
878
863
  var import_react6 = __toESM(require("react"), 1);
879
- var RebuyWidgetContainerBase = ({
880
- children,
881
- ...props
882
- }) => {
883
- const {
884
- collection,
885
- collectionId,
886
- dataSource,
887
- limit,
888
- options,
889
- product,
890
- productId,
891
- variant,
892
- variantId
893
- } = props;
864
+ var RebuyWidgetContainerBase = ({ children, ...props }) => {
865
+ const { collection, collectionId, dataSource, limit, options, product, productId, variant, variantId } = props;
894
866
  const contextParameters = (0, import_react6.useContext)(RebuyContext);
895
867
  const [Rebuy, setRebuy] = (0, import_react6.useState)(null);
896
868
  const [initialized, setInitialized] = (0, import_react6.useState)(false);
@@ -928,48 +900,27 @@ var RebuyWidgetContainerBase = ({
928
900
  // Keeping this object generic to allow for custom endpoints
929
901
  };
930
902
  if (shopifyProductId) {
931
- request2.params.shopify_product_ids = Utilities4.getIdFromGraphUrl(
932
- shopifyProductId,
933
- "Product"
934
- );
903
+ request2.params.shopify_product_ids = Utilities4.getIdFromGraphUrl(shopifyProductId, "Product");
935
904
  }
936
905
  if (shopifyProductId) {
937
- request2.params.shopify_product_ids = Utilities4.getIdFromGraphUrl(
938
- shopifyProductId,
939
- "Product"
940
- );
906
+ request2.params.shopify_product_ids = Utilities4.getIdFromGraphUrl(shopifyProductId, "Product");
941
907
  }
942
908
  if (shopifyVariantId) {
943
- request2.params.shopify_variant_ids = Utilities4.getIdFromGraphUrl(
944
- shopifyVariantId,
945
- "ProductVariant"
946
- );
909
+ request2.params.shopify_variant_ids = Utilities4.getIdFromGraphUrl(shopifyVariantId, "ProductVariant");
947
910
  }
948
911
  if (shopifyCollectionId) {
949
- request2.params.shopify_collection_ids = Utilities4.getIdFromGraphUrl(
950
- shopifyCollectionId,
951
- "Collection"
952
- );
912
+ request2.params.shopify_collection_ids = Utilities4.getIdFromGraphUrl(shopifyCollectionId, "Collection");
953
913
  }
954
914
  if (limit) {
955
915
  request2.params.limit = limit;
956
916
  }
957
917
  return request2;
958
- }, [
959
- dataSource,
960
- shopifyProductId,
961
- shopifyVariantId,
962
- shopifyCollectionId,
963
- limit
964
- ]);
918
+ }, [dataSource, shopifyProductId, shopifyVariantId, shopifyCollectionId, limit]);
965
919
  (0, import_react6.useEffect)(() => {
966
920
  let isMounted = true;
967
921
  if (!Rebuy || !initialized) return;
968
922
  const fetchData = async () => {
969
- const { data, metadata: metadata2 } = await Rebuy.getStorefrontData(
970
- request.endpoint,
971
- request.params
972
- );
923
+ const { data, metadata: metadata2 } = await Rebuy.getStorefrontData(request.endpoint, request.params);
973
924
  if (isMounted) {
974
925
  setProducts(
975
926
  Array.isArray(data) ? data.map((product2) => ({
@@ -1002,24 +953,11 @@ var RebuyWidgetContainerBase = ({
1002
953
  };
1003
954
  var RebuyWidgetContainer = RebuyWidgetContainerBase;
1004
955
 
1005
- // src/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.module.css
1006
- var RebuyCompleteTheLook_default = {
1007
- container: "RebuyCompleteTheLook_container",
1008
- productGrid: "RebuyCompleteTheLook_productGrid",
1009
- productItem: "RebuyCompleteTheLook_productItem"
1010
- };
1011
-
1012
956
  // src/components/ProductCard/ProductCard.tsx
1013
957
  var import_react7 = require("@remix-run/react");
1014
958
  var import_hydrogen4 = require("@shopify/hydrogen");
1015
959
  var import_react8 = require("react");
1016
960
 
1017
- // src/components/ProductCard/ProductCard.module.css
1018
- var ProductCard_default = {
1019
- container: "ProductCard_container",
1020
- productInfo: "ProductCard_productInfo"
1021
- };
1022
-
1023
961
  // src/components/AddToCartBtn/HydrogenAddToCartBtn.tsx
1024
962
  var import_hydrogen2 = require("@shopify/hydrogen");
1025
963
 
@@ -1080,22 +1018,13 @@ var HydrogenReactAddToCartBtn = ({
1080
1018
  linesAdd(linesToAdd);
1081
1019
  addToCartCallback?.();
1082
1020
  };
1083
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1084
- "button",
1085
- {
1086
- className: AddToCartBtn_default.button,
1087
- disabled,
1088
- onClick: handleAddToCart,
1089
- type: "button",
1090
- children: [
1091
- addToCartBtnText,
1092
- moneyData && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1093
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: " | " }),
1094
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_hydrogen_react2.Money, { data: moneyData, withoutTrailingZeros: true })
1095
- ] })
1096
- ]
1097
- }
1098
- );
1021
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { className: AddToCartBtn_default.button, disabled, onClick: handleAddToCart, type: "button", children: [
1022
+ addToCartBtnText,
1023
+ moneyData && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1024
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: " | " }),
1025
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_hydrogen_react2.Money, { data: moneyData, withoutTrailingZeros: true })
1026
+ ] })
1027
+ ] });
1099
1028
  };
1100
1029
 
1101
1030
  // src/components/AddToCartBtn/AddToCartBtn.tsx
@@ -1152,24 +1081,12 @@ var ProductPrice_default = {
1152
1081
 
1153
1082
  // src/components/ProductPrice/ProductPrice.tsx
1154
1083
  var import_jsx_runtime6 = require("react/jsx-runtime");
1155
- var RebuyProductPrice = ({
1156
- selectedVariant
1157
- }) => {
1084
+ var RebuyProductPrice = ({ selectedVariant }) => {
1158
1085
  if (!selectedVariant) return null;
1159
1086
  const { compareAtPriceV2: compareAtPrice, priceV2: price } = selectedVariant;
1160
1087
  const isDiscounted = (price2, compareAtPrice2) => Number(compareAtPrice2?.amount) > Number(price2?.amount);
1161
- const CompareAtPrice = ({
1162
- data: compareAtPrice2
1163
- }) => {
1164
- return compareAtPrice2 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1165
- import_hydrogen3.Money,
1166
- {
1167
- as: "span",
1168
- className: ProductPrice_default.compareAtPrice,
1169
- data: compareAtPrice2,
1170
- withoutTrailingZeros: true
1171
- }
1172
- );
1088
+ const CompareAtPrice = ({ data: compareAtPrice2 }) => {
1089
+ return compareAtPrice2 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_hydrogen3.Money, { as: "span", className: ProductPrice_default.compareAtPrice, data: compareAtPrice2, withoutTrailingZeros: true });
1173
1090
  };
1174
1091
  return price && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ProductPrice_default.priceContainer, children: [
1175
1092
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_hydrogen3.Money, { data: price, withoutTrailingZeros: true }),
@@ -1204,17 +1121,12 @@ var VariantSelect_default = {
1204
1121
 
1205
1122
  // src/components/VariantSelect/VariantSelect.tsx
1206
1123
  var import_jsx_runtime8 = require("react/jsx-runtime");
1207
- var VariantSelect = ({
1208
- handleSelectedVariant,
1209
- product
1210
- }) => {
1124
+ var VariantSelect = ({ handleSelectedVariant, product }) => {
1211
1125
  const getOptionsLabel = (product2) => {
1212
1126
  const options = product2.variants.nodes[0].selectedOptions;
1213
1127
  const optionsFromKeys = options ? Object.keys(options[0]) : [];
1214
1128
  const optionsFromValues = options ? options.map((option) => option.name) : [];
1215
- const useValues = optionsFromKeys.every(
1216
- (key) => ["name", "value"].includes(key)
1217
- );
1129
+ const useValues = optionsFromKeys.every((key) => ["name", "value"].includes(key));
1218
1130
  return (useValues ? optionsFromValues : optionsFromKeys).join(" / ");
1219
1131
  };
1220
1132
  return product?.variants.nodes.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
@@ -1228,6 +1140,12 @@ var VariantSelect = ({
1228
1140
  ) });
1229
1141
  };
1230
1142
 
1143
+ // src/components/ProductCard/ProductCard.module.css
1144
+ var ProductCard_default = {
1145
+ container: "ProductCard_container",
1146
+ productInfo: "ProductCard_productInfo"
1147
+ };
1148
+
1231
1149
  // src/components/ProductCard/ProductCard.tsx
1232
1150
  var import_jsx_runtime9 = require("react/jsx-runtime");
1233
1151
  var ProductCard = ({
@@ -1237,14 +1155,10 @@ var ProductCard = ({
1237
1155
  product,
1238
1156
  productCardTitleLevel
1239
1157
  }) => {
1240
- const [selectedVariant, setSelectedVariant] = (0, import_react8.useState)(
1241
- product.variants.nodes[0]
1242
- );
1158
+ const [selectedVariant, setSelectedVariant] = (0, import_react8.useState)(product.variants.nodes[0]);
1243
1159
  const { image } = selectedVariant;
1244
1160
  const handleSelectedVariant = (product2, variant_id) => {
1245
- const updatedVariant = product2.variants.nodes.find(
1246
- (variant) => variant.id === variant_id
1247
- );
1161
+ const updatedVariant = product2.variants.nodes.find((variant) => variant.id === variant_id);
1248
1162
  if (updatedVariant) {
1249
1163
  setSelectedVariant(updatedVariant);
1250
1164
  }
@@ -1260,21 +1174,9 @@ var ProductCard = ({
1260
1174
  }
1261
1175
  ) }),
1262
1176
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: ProductCard_default.productInfo, children: [
1263
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react7.Link, { to: `/products/${product.handle}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1264
- Title,
1265
- {
1266
- level: productCardTitleLevel,
1267
- text: product.title
1268
- }
1269
- ) }),
1177
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react7.Link, { to: `/products/${product.handle}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Title, { level: productCardTitleLevel, text: product.title }) }),
1270
1178
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RebuyProductPrice, { selectedVariant }),
1271
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1272
- VariantSelect,
1273
- {
1274
- handleSelectedVariant,
1275
- product
1276
- }
1277
- )
1179
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(VariantSelect, { handleSelectedVariant, product })
1278
1180
  ] })
1279
1181
  ] }),
1280
1182
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
@@ -1327,6 +1229,13 @@ var getTitleLevel = (level, decreaseLevel = false) => {
1327
1229
  }
1328
1230
  };
1329
1231
 
1232
+ // src/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.module.css
1233
+ var RebuyCompleteTheLook_default = {
1234
+ container: "RebuyCompleteTheLook_container",
1235
+ productGrid: "RebuyCompleteTheLook_productGrid",
1236
+ productItem: "RebuyCompleteTheLook_productItem"
1237
+ };
1238
+
1330
1239
  // src/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.tsx
1331
1240
  var import_jsx_runtime10 = require("react/jsx-runtime");
1332
1241
  var RebuyCompleteTheLook = (props) => {
@@ -1343,14 +1252,7 @@ var RebuyCompleteTheLook = (props) => {
1343
1252
  return null;
1344
1253
  }
1345
1254
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { className: RebuyCompleteTheLook_default.container, children: [
1346
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1347
- Title,
1348
- {
1349
- level: getTitleLevel(customTitleLevel),
1350
- style: customTitleStyle,
1351
- text: customTitle
1352
- }
1353
- ),
1255
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
1354
1256
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: RebuyCompleteTheLook_default.productGrid, children: products.map((product) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: RebuyCompleteTheLook_default.productItem, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1355
1257
  ProductCard,
1356
1258
  {
@@ -1358,10 +1260,7 @@ var RebuyCompleteTheLook = (props) => {
1358
1260
  addToCartCallback,
1359
1261
  isHydrogenReact: props.isHydrogenReact,
1360
1262
  product,
1361
- productCardTitleLevel: getTitleLevel(
1362
- customTitleLevel,
1363
- true
1364
- )
1263
+ productCardTitleLevel: getTitleLevel(customTitleLevel, true)
1365
1264
  }
1366
1265
  ) }, product.id)) })
1367
1266
  ] });
@@ -1370,84 +1269,6 @@ var RebuyCompleteTheLook = (props) => {
1370
1269
  // src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.tsx
1371
1270
  var import_react11 = require("react");
1372
1271
 
1373
- // src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx
1374
- var import_hydrogen5 = require("@shopify/hydrogen");
1375
-
1376
- // src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.module.css
1377
- var RebuyDynamicBundleProducts_default = {
1378
- container: "RebuyDynamicBundleProducts_container",
1379
- addCartBtnContainer: "RebuyDynamicBundleProducts_addCartBtnContainer",
1380
- bundleContainer: "RebuyDynamicBundleProducts_bundleContainer",
1381
- select: "RebuyDynamicBundleProducts_select",
1382
- bundleItemRowContainer: "RebuyDynamicBundleProducts_bundleItemRowContainer",
1383
- unselected: "RebuyDynamicBundleProducts_unselected",
1384
- bundleItemRow: "RebuyDynamicBundleProducts_bundleItemRow",
1385
- bundleItemInput: "RebuyDynamicBundleProducts_bundleItemInput",
1386
- bundleItemLabel: "RebuyDynamicBundleProducts_bundleItemLabel",
1387
- bundleImages: "RebuyDynamicBundleProducts_bundleImages",
1388
- bundleImage: "RebuyDynamicBundleProducts_bundleImage",
1389
- fadeIn: "RebuyDynamicBundleProducts_fadeIn",
1390
- bundleImageDelimiter: "RebuyDynamicBundleProducts_bundleImageDelimiter",
1391
- compareAtPrice: "RebuyDynamicBundleProducts_compareAtPrice"
1392
- };
1393
-
1394
- // src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx
1395
- var import_jsx_runtime11 = require("react/jsx-runtime");
1396
- var BundlePrice = ({ products }) => {
1397
- const isDisabled = products.filter((product) => product.selected).length < 1;
1398
- const totalBundlePrice = () => {
1399
- let total = 0;
1400
- let currencyCode = "USD";
1401
- for (const product of products) {
1402
- if (product.selected && product.selectedVariant) {
1403
- const { priceV2: price2 } = product.selectedVariant;
1404
- total += Number(price2?.amount);
1405
- currencyCode = price2?.currencyCode || "USD";
1406
- }
1407
- }
1408
- return {
1409
- amount: String(total),
1410
- currencyCode
1411
- };
1412
- };
1413
- const totalBundleCompareAtPrice = () => {
1414
- let compareAtTotal = 0;
1415
- let currencyCode = "USD";
1416
- for (const product of products) {
1417
- if (product.selected && product.selectedVariant) {
1418
- const { compareAtPriceV2: compareAtPrice2, priceV2: price2 } = product.selectedVariant;
1419
- currencyCode = price2?.currencyCode || "USD";
1420
- compareAtTotal += Number((compareAtPrice2 || price2)?.amount);
1421
- }
1422
- }
1423
- return {
1424
- amount: String(compareAtTotal),
1425
- currencyCode
1426
- };
1427
- };
1428
- const isDiscounted = (price2, compareAtPrice2) => Number(compareAtPrice2?.amount) > Number(price2?.amount);
1429
- const price = totalBundlePrice();
1430
- const compareAtPrice = totalBundleCompareAtPrice();
1431
- const CompareAtPrice = ({
1432
- data: compareAtPrice2
1433
- }) => {
1434
- return compareAtPrice2 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1435
- import_hydrogen5.Money,
1436
- {
1437
- as: "span",
1438
- className: RebuyDynamicBundleProducts_default.compareAtPrice,
1439
- data: compareAtPrice2,
1440
- withoutTrailingZeros: true
1441
- }
1442
- );
1443
- };
1444
- return products.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex items-center flex-col", children: !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "flex items-center gap-2 mb-2", children: [
1445
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: "Total Price:" }),
1446
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_hydrogen5.Money, { as: "span", data: price, withoutTrailingZeros: true }),
1447
- isDiscounted(price, compareAtPrice) && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CompareAtPrice, { data: compareAtPrice })
1448
- ] }) });
1449
- };
1450
-
1451
1272
  // src/utils/convertToRebuyProduct.tsx
1452
1273
  var convertToRebuyProduct = (isHydrogenReact, product) => {
1453
1274
  const mainProductVariants = isHydrogenReact ? product?.variants?.nodes?.map((variant) => {
@@ -1507,9 +1328,7 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
1507
1328
  },
1508
1329
  handle: product?.handle || "",
1509
1330
  id: product?.id || "",
1510
- images: [
1511
- { altText: "", height: 100, id: "", url: "", width: 100 }
1512
- ],
1331
+ images: [{ altText: "", height: 100, id: "", url: "", width: 100 }],
1513
1332
  media: [],
1514
1333
  metafields: [],
1515
1334
  options: [],
@@ -1518,12 +1337,9 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
1518
1337
  minVariantPrice: { amount: "0", currencyCode: "USD" }
1519
1338
  },
1520
1339
  selected: true,
1521
- selectedOptions: product?.selectedVariant?.selectedOptions?.reduce(
1522
- (acc, option) => {
1523
- return { ...acc, [option.name]: option.value };
1524
- },
1525
- {}
1526
- ) || {},
1340
+ selectedOptions: product?.selectedVariant?.selectedOptions?.reduce((acc, option) => {
1341
+ return { ...acc, [option.name]: option.value };
1342
+ }, {}) || {},
1527
1343
  selectedSellingPlan: {},
1528
1344
  selectedSellingPlanAllocation: {},
1529
1345
  selectedVariant: {
@@ -1600,12 +1416,9 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
1600
1416
  minVariantPrice: { amount: "0", currencyCode: "USD" }
1601
1417
  },
1602
1418
  selected: true,
1603
- selectedOptions: product?.selectedOrFirstAvailableVariant?.selectedOptions?.reduce(
1604
- (acc, option) => {
1605
- return { ...acc, [option.name]: option.value };
1606
- },
1607
- {}
1608
- ) || {},
1419
+ selectedOptions: product?.selectedOrFirstAvailableVariant?.selectedOptions?.reduce((acc, option) => {
1420
+ return { ...acc, [option.name]: option.value };
1421
+ }, {}) || {},
1609
1422
  selectedSellingPlan: {},
1610
1423
  selectedSellingPlanAllocation: {},
1611
1424
  selectedVariant: {
@@ -1681,15 +1494,35 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
1681
1494
 
1682
1495
  // src/widgets/RebuyDynamicBundleProducts/BundleImages.tsx
1683
1496
  var import_react9 = require("@remix-run/react");
1684
- var import_hydrogen6 = require("@shopify/hydrogen");
1497
+ var import_hydrogen5 = require("@shopify/hydrogen");
1685
1498
  var import_react10 = require("react");
1686
- var import_jsx_runtime12 = require("react/jsx-runtime");
1499
+
1500
+ // src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.module.css
1501
+ var RebuyDynamicBundleProducts_default = {
1502
+ container: "RebuyDynamicBundleProducts_container",
1503
+ addCartBtnContainer: "RebuyDynamicBundleProducts_addCartBtnContainer",
1504
+ bundleContainer: "RebuyDynamicBundleProducts_bundleContainer",
1505
+ select: "RebuyDynamicBundleProducts_select",
1506
+ bundleItemRowContainer: "RebuyDynamicBundleProducts_bundleItemRowContainer",
1507
+ unselected: "RebuyDynamicBundleProducts_unselected",
1508
+ bundleItemRow: "RebuyDynamicBundleProducts_bundleItemRow",
1509
+ bundleItemInput: "RebuyDynamicBundleProducts_bundleItemInput",
1510
+ bundleItemLabel: "RebuyDynamicBundleProducts_bundleItemLabel",
1511
+ bundleImages: "RebuyDynamicBundleProducts_bundleImages",
1512
+ bundleImage: "RebuyDynamicBundleProducts_bundleImage",
1513
+ "fade-in": "RebuyDynamicBundleProducts_fade-in",
1514
+ bundleImageDelimiter: "RebuyDynamicBundleProducts_bundleImageDelimiter",
1515
+ compareAtPrice: "RebuyDynamicBundleProducts_compareAtPrice"
1516
+ };
1517
+
1518
+ // src/widgets/RebuyDynamicBundleProducts/BundleImages.tsx
1519
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1687
1520
  var BundleImages = ({ products }) => {
1688
1521
  const selected = products.filter((product) => product.selected);
1689
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: RebuyDynamicBundleProducts_default.bundleImages, children: products.map((product, index) => {
1522
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { className: RebuyDynamicBundleProducts_default.bundleImages, children: products.map((product, index) => {
1690
1523
  const image = product.selectedVariant?.image;
1691
- const productImage = image ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1692
- import_hydrogen6.Image,
1524
+ const productImage = image ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1525
+ import_hydrogen5.Image,
1693
1526
  {
1694
1527
  alt: image.altText || `Picture of ${product.title}`,
1695
1528
  className: RebuyDynamicBundleProducts_default.bundleImage,
@@ -1703,66 +1536,53 @@ var BundleImages = ({ products }) => {
1703
1536
  product.title
1704
1537
  );
1705
1538
  const showDelimiter = selected[0]?.id !== product.id;
1706
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react10.Fragment, { children: product.selected && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1707
- showDelimiter && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("li", { className: RebuyDynamicBundleProducts_default.bundleImageDelimiter, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "+" }) }),
1708
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("li", { className: "flex items-center", children: product.default ? (
1539
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react10.Fragment, { children: product.selected && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1540
+ showDelimiter && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { className: RebuyDynamicBundleProducts_default.bundleImageDelimiter, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: "+" }) }),
1541
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { className: "flex items-center", children: product.default ? (
1709
1542
  // Already on product page
1710
1543
  productImage
1711
1544
  ) : (
1712
1545
  // Link to product
1713
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1714
- import_react9.Link,
1715
- {
1716
- title: product.title,
1717
- to: `/products/${product.handle}`,
1718
- children: productImage
1719
- }
1720
- )
1546
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react9.Link, { title: product.title, to: `/products/${product.handle}`, children: productImage })
1721
1547
  ) })
1722
1548
  ] }) }, product.id + "-BundleImages-" + index);
1723
1549
  }) });
1724
1550
  };
1725
1551
 
1726
1552
  // src/widgets/RebuyDynamicBundleProducts/Select.tsx
1727
- var import_jsx_runtime13 = require("react/jsx-runtime");
1553
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1728
1554
  var Select = ({ onSelectVariant, product }) => {
1729
1555
  const getOptionsLabel = (product2) => {
1730
1556
  const options = product2.variants.nodes[0].selectedOptions;
1731
1557
  const optionsFromKeys = options ? Object.keys(options[0]) : [];
1732
1558
  const optionsFromValues = options ? options.map((option) => option.name) : [];
1733
- const useValues = optionsFromKeys.every(
1734
- (key) => ["name", "value"].includes(key)
1735
- );
1559
+ const useValues = optionsFromKeys.every((key) => ["name", "value"].includes(key));
1736
1560
  return (useValues ? optionsFromValues : optionsFromKeys).join(" / ");
1737
1561
  };
1738
- return product && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1562
+ return product && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1739
1563
  "select",
1740
1564
  {
1741
1565
  "aria-label": "select variant",
1742
1566
  className: RebuyDynamicBundleProducts_default.select,
1743
1567
  onChange: (e) => onSelectVariant(product, e.target.value),
1744
1568
  value: product.selectedVariant.id,
1745
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("optgroup", { label: getOptionsLabel(product), children: product.variants.nodes.map(({ id, title }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: id, children: title }, id + "-BundleVariant")) })
1569
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("optgroup", { label: getOptionsLabel(product), children: product.variants.nodes.map(({ id, title }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: id, children: title }, id + "-BundleVariant")) })
1746
1570
  }
1747
1571
  );
1748
1572
  };
1749
1573
 
1750
1574
  // src/widgets/RebuyDynamicBundleProducts/BundleSelection.tsx
1751
- var import_jsx_runtime14 = require("react/jsx-runtime");
1752
- var BundleSelection = ({
1753
- onSelectVariant,
1754
- onToggleBundleItem,
1755
- products
1756
- }) => {
1757
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { children: products.map((product, index) => {
1575
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1576
+ var BundleSelection = ({ onSelectVariant, onToggleBundleItem, products }) => {
1577
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { children: products.map((product, index) => {
1758
1578
  const { availableForSale } = product.selectedVariant;
1759
1579
  const isOutOfStock = !availableForSale;
1760
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1580
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1761
1581
  "li",
1762
1582
  {
1763
1583
  className: `${RebuyDynamicBundleProducts_default.bundleItemRowContainer} ${!product.selected && RebuyDynamicBundleProducts_default.unselected}`,
1764
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: RebuyDynamicBundleProducts_default.bundleItemRow, children: [
1765
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1584
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: RebuyDynamicBundleProducts_default.bundleItemRow, children: [
1585
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1766
1586
  "input",
1767
1587
  {
1768
1588
  checked: product.selected && availableForSale,
@@ -1774,32 +1594,14 @@ var BundleSelection = ({
1774
1594
  value: product.id
1775
1595
  }
1776
1596
  ),
1777
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: RebuyDynamicBundleProducts_default.bundleItemInput, children: [
1778
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1779
- "label",
1780
- {
1781
- className: RebuyDynamicBundleProducts_default.bundleItemLabel,
1782
- htmlFor: `${product.id}-toggle`,
1783
- children: [
1784
- isOutOfStock && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: "SOLD OUT" }),
1785
- product.default && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: "This item:" }),
1786
- product.title,
1787
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1788
- RebuyProductPrice,
1789
- {
1790
- selectedVariant: product.selectedVariant
1791
- }
1792
- )
1793
- ]
1794
- }
1795
- ),
1796
- product.variants.nodes.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1797
- Select,
1798
- {
1799
- onSelectVariant,
1800
- product
1801
- }
1802
- )
1597
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: RebuyDynamicBundleProducts_default.bundleItemInput, children: [
1598
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: RebuyDynamicBundleProducts_default.bundleItemLabel, htmlFor: `${product.id}-toggle`, children: [
1599
+ isOutOfStock && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: "SOLD OUT" }),
1600
+ product.default && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: "This item:" }),
1601
+ product.title,
1602
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RebuyProductPrice, { selectedVariant: product.selectedVariant })
1603
+ ] }),
1604
+ product.variants.nodes.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Select, { onSelectVariant, product })
1803
1605
  ] })
1804
1606
  ] })
1805
1607
  },
@@ -1808,6 +1610,54 @@ var BundleSelection = ({
1808
1610
  }) });
1809
1611
  };
1810
1612
 
1613
+ // src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx
1614
+ var import_hydrogen6 = require("@shopify/hydrogen");
1615
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1616
+ var BundlePrice = ({ products }) => {
1617
+ const isDisabled = products.filter((product) => product.selected).length < 1;
1618
+ const totalBundlePrice = () => {
1619
+ let total = 0;
1620
+ let currencyCode = "USD";
1621
+ for (const product of products) {
1622
+ if (product.selected && product.selectedVariant) {
1623
+ const { priceV2: price2 } = product.selectedVariant;
1624
+ total += Number(price2?.amount);
1625
+ currencyCode = price2?.currencyCode || "USD";
1626
+ }
1627
+ }
1628
+ return {
1629
+ amount: String(total),
1630
+ currencyCode
1631
+ };
1632
+ };
1633
+ const totalBundleCompareAtPrice = () => {
1634
+ let compareAtTotal = 0;
1635
+ let currencyCode = "USD";
1636
+ for (const product of products) {
1637
+ if (product.selected && product.selectedVariant) {
1638
+ const { compareAtPriceV2: compareAtPrice2, priceV2: price2 } = product.selectedVariant;
1639
+ currencyCode = price2?.currencyCode || "USD";
1640
+ compareAtTotal += Number((compareAtPrice2 || price2)?.amount);
1641
+ }
1642
+ }
1643
+ return {
1644
+ amount: String(compareAtTotal),
1645
+ currencyCode
1646
+ };
1647
+ };
1648
+ const isDiscounted = (price2, compareAtPrice2) => Number(compareAtPrice2?.amount) > Number(price2?.amount);
1649
+ const price = totalBundlePrice();
1650
+ const compareAtPrice = totalBundleCompareAtPrice();
1651
+ const CompareAtPrice = ({ data: compareAtPrice2 }) => {
1652
+ return compareAtPrice2 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_hydrogen6.Money, { as: "span", className: RebuyDynamicBundleProducts_default.compareAtPrice, data: compareAtPrice2, withoutTrailingZeros: true });
1653
+ };
1654
+ return products.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex items-center flex-col", children: !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "flex items-center gap-2 mb-2", children: [
1655
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "Total Price:" }),
1656
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_hydrogen6.Money, { as: "span", data: price, withoutTrailingZeros: true }),
1657
+ isDiscounted(price, compareAtPrice) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CompareAtPrice, { data: compareAtPrice })
1658
+ ] }) });
1659
+ };
1660
+
1811
1661
  // src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.tsx
1812
1662
  var import_jsx_runtime15 = require("react/jsx-runtime");
1813
1663
  var RebuyDynamicBundleProducts = (props) => {
@@ -1823,10 +1673,7 @@ var RebuyDynamicBundleProducts = (props) => {
1823
1673
  } = props;
1824
1674
  const [bundleProducts, setBundleProducts] = (0, import_react11.useState)([]);
1825
1675
  (0, import_react11.useEffect)(() => {
1826
- const mainProduct = convertToRebuyProduct(
1827
- isHydrogenReact || false,
1828
- product
1829
- );
1676
+ const mainProduct = convertToRebuyProduct(isHydrogenReact || false, product);
1830
1677
  const formattedProducts = products.map((product2) => {
1831
1678
  return {
1832
1679
  ...product2,
@@ -1845,9 +1692,7 @@ var RebuyDynamicBundleProducts = (props) => {
1845
1692
  );
1846
1693
  const onSelectVariant = (0, import_react11.useCallback)(
1847
1694
  (product2, variant_id) => {
1848
- const variant = product2.variants.nodes.find(
1849
- ({ id }) => id === variant_id
1850
- );
1695
+ const variant = product2.variants.nodes.find(({ id }) => id === variant_id);
1851
1696
  if (variant) {
1852
1697
  product2.selectedVariant = variant;
1853
1698
  product2.selected = variant.availableForSale || false;
@@ -1861,14 +1706,7 @@ var RebuyDynamicBundleProducts = (props) => {
1861
1706
  return null;
1862
1707
  }
1863
1708
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("section", { className: RebuyDynamicBundleProducts_default.container, children: [
1864
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1865
- Title,
1866
- {
1867
- level: getTitleLevel(customTitleLevel),
1868
- style: customTitleStyle,
1869
- text: customTitle
1870
- }
1871
- ),
1709
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
1872
1710
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: RebuyDynamicBundleProducts_default.bundleContainer, children: [
1873
1711
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(BundleImages, { products: bundleProducts }),
1874
1712
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(BundlePrice, { products: bundleProducts }),
@@ -1955,20 +1793,8 @@ var RebuyProductAddOnCard = ({
1955
1793
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: RebuyProductAddOns_default.addOnCardTextContent, children: [
1956
1794
  !availableForSale && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: RebuyProductAddOns_default.addOnCardOutOfStock, children: outOfStockText }),
1957
1795
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Title, { level: titleLevel, text: product.title }),
1958
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1959
- RebuyProductPrice,
1960
- {
1961
- selectedVariant: product.selectedVariant
1962
- }
1963
- ),
1964
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1965
- import_react12.Link,
1966
- {
1967
- className: RebuyProductAddOns_default.addOnCardLearnMore,
1968
- to: `/products/${product.handle}`,
1969
- children: learnMoreText
1970
- }
1971
- )
1796
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RebuyProductPrice, { selectedVariant: product.selectedVariant }),
1797
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react12.Link, { className: RebuyProductAddOns_default.addOnCardLearnMore, to: `/products/${product.handle}`, children: learnMoreText })
1972
1798
  ] })
1973
1799
  ] }) });
1974
1800
  };
@@ -2019,10 +1845,7 @@ var RebuyProductAddOns = (props) => {
2019
1845
  });
2020
1846
  setAddedItems(products);
2021
1847
  if (includeMainProduct) {
2022
- setAddedItems([
2023
- convertToRebuyProduct(isHydrogenReact || false, product),
2024
- ...products
2025
- ]);
1848
+ setAddedItems([convertToRebuyProduct(isHydrogenReact || false, product), ...products]);
2026
1849
  } else {
2027
1850
  setAddedItems(products);
2028
1851
  }
@@ -2030,9 +1853,7 @@ var RebuyProductAddOns = (props) => {
2030
1853
  const handleChange = (0, import_react13.useCallback)(
2031
1854
  (event, product2) => {
2032
1855
  const newProducts = [...products];
2033
- const productIndex = newProducts.findIndex(
2034
- (p) => p.id === product2.id
2035
- );
1856
+ const productIndex = newProducts.findIndex((p) => p.id === product2.id);
2036
1857
  if (productIndex !== -1) {
2037
1858
  newProducts[productIndex] = {
2038
1859
  ...newProducts[productIndex],
@@ -2042,9 +1863,7 @@ var RebuyProductAddOns = (props) => {
2042
1863
  if (event.target.checked) {
2043
1864
  setAddedItems((prev) => [...prev, product2]);
2044
1865
  } else {
2045
- setAddedItems(
2046
- (prev) => prev.filter((item) => item.id !== product2.id)
2047
- );
1866
+ setAddedItems((prev) => prev.filter((item) => item.id !== product2.id));
2048
1867
  }
2049
1868
  }
2050
1869
  },
@@ -2077,14 +1896,7 @@ var RebuyProductAddOns = (props) => {
2077
1896
  return null;
2078
1897
  }
2079
1898
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: RebuyProductAddOns_default.container, children: [
2080
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2081
- Title,
2082
- {
2083
- level: getTitleLevel(customTitleLevel),
2084
- style: customTitleStyle,
2085
- text: customTitle
2086
- }
2087
- ),
1899
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
2088
1900
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: RebuyProductAddOns_default.productAddOnsList, children: products.map((product2) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2089
1901
  RebuyProductAddOnCard,
2090
1902
  {
@@ -2098,23 +1910,11 @@ var RebuyProductAddOns = (props) => {
2098
1910
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: RebuyProductAddOns_default.productAddOnsFooter, children: [
2099
1911
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: RebuyProductAddOns_default.moneyContainer, children: [
2100
1912
  subtotalText,
2101
- subtotalWithOutProduct && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2102
- import_hydrogen_react3.Money,
2103
- {
2104
- data: subtotalWithOutProduct,
2105
- withoutTrailingZeros: true
2106
- }
2107
- )
1913
+ subtotalWithOutProduct && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_hydrogen_react3.Money, { data: subtotalWithOutProduct, withoutTrailingZeros: true })
2108
1914
  ] }),
2109
1915
  includeMainProduct && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: RebuyProductAddOns_default.moneyContainer, children: [
2110
1916
  withProductText,
2111
- subtotalWithProduct && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2112
- import_hydrogen_react3.Money,
2113
- {
2114
- data: subtotalWithProduct,
2115
- withoutTrailingZeros: true
2116
- }
2117
- )
1917
+ subtotalWithProduct && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_hydrogen_react3.Money, { data: subtotalWithProduct, withoutTrailingZeros: true })
2118
1918
  ] }),
2119
1919
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: RebuyProductAddOns_default.addCartBtnContainer, children: includeMainProduct ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2120
1920
  AddToCartBtn,
@@ -2124,9 +1924,7 @@ var RebuyProductAddOns = (props) => {
2124
1924
  disabled: addedItems.length === 0,
2125
1925
  isHydrogenReact,
2126
1926
  moneyData: subtotalWithProduct,
2127
- selectedVariants: addedItems.map(
2128
- (item) => item.selectedVariant
2129
- )
1927
+ selectedVariants: addedItems.map((item) => item.selectedVariant)
2130
1928
  }
2131
1929
  ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2132
1930
  AddToCartBtn,
@@ -2136,9 +1934,7 @@ var RebuyProductAddOns = (props) => {
2136
1934
  disabled: addedItems.length === 0,
2137
1935
  isHydrogenReact,
2138
1936
  moneyData: subtotalWithOutProduct,
2139
- selectedVariants: addedItems.map(
2140
- (item) => item.selectedVariant
2141
- )
1937
+ selectedVariants: addedItems.map((item) => item.selectedVariant)
2142
1938
  }
2143
1939
  ) })
2144
1940
  ] })
@@ -2167,14 +1963,7 @@ var RebuyProductRecommendations = (props) => {
2167
1963
  return null;
2168
1964
  }
2169
1965
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("section", { className: RebuyProductRecommendations_default.container, children: [
2170
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2171
- Title,
2172
- {
2173
- level: getTitleLevel(customTitleLevel),
2174
- style: customTitleStyle,
2175
- text: customTitle
2176
- }
2177
- ),
1966
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
2178
1967
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { className: RebuyProductRecommendations_default.productGrid, children: products.map((product) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { className: RebuyProductRecommendations_default.productItem, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2179
1968
  ProductCard,
2180
1969
  {
@@ -2182,10 +1971,7 @@ var RebuyProductRecommendations = (props) => {
2182
1971
  addToCartCallback,
2183
1972
  isHydrogenReact: props.isHydrogenReact,
2184
1973
  product,
2185
- productCardTitleLevel: getTitleLevel(
2186
- customTitleLevel,
2187
- true
2188
- )
1974
+ productCardTitleLevel: getTitleLevel(customTitleLevel, true)
2189
1975
  }
2190
1976
  ) }, product.id)) })
2191
1977
  ] });