@lime-bundles/react 2.1.1 → 2.3.0

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.
package/dist/index.cjs CHANGED
@@ -20,53 +20,56 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
- BUNDLES_FOR_PRODUCT_QUERY: () => import_core10.BUNDLES_FOR_PRODUCT_QUERY,
24
- BUNDLE_METAOBJECT_QUERY: () => import_core10.BUNDLE_METAOBJECT_QUERY,
25
- BundleParseError: () => import_core9.BundleParseError,
23
+ BUNDLES_FOR_PRODUCT_QUERY: () => import_core11.BUNDLES_FOR_PRODUCT_QUERY,
24
+ BUNDLE_METAOBJECT_QUERY: () => import_core11.BUNDLE_METAOBJECT_QUERY,
25
+ BundleParseError: () => import_core10.BundleParseError,
26
26
  FixedBundle: () => FixedBundle,
27
27
  MixMatchBundle: () => MixMatchBundle,
28
- SHOP_CUSTOM_CSS_QUERY: () => import_core10.SHOP_CUSTOM_CSS_QUERY,
29
- StorefrontApiError: () => import_core9.StorefrontApiError,
28
+ SHOP_CUSTOM_CSS_QUERY: () => import_core11.SHOP_CUSTOM_CSS_QUERY,
29
+ StorefrontApiError: () => import_core10.StorefrontApiError,
30
30
  VolumeBundle: () => VolumeBundle,
31
- WIDGET_CONFIG_DEFAULTS: () => import_core10.WIDGET_CONFIG_DEFAULTS,
32
- applyABVariantB: () => import_core10.applyABVariantB,
33
- applyWidgetConfigVars: () => import_core10.applyWidgetConfigVars,
34
- calculateDiscount: () => import_core10.calculateDiscount,
35
- calculateTierSavings: () => import_core10.calculateTierSavings,
36
- computeBundleSaleCents: () => import_core10.computeBundleSaleCents,
37
- computeFixedPricing: () => import_core10.computeFixedPricing,
38
- createStorefrontClient: () => import_core10.createStorefrontClient,
31
+ WIDGET_CONFIG_DEFAULTS: () => import_core11.WIDGET_CONFIG_DEFAULTS,
32
+ applyABVariantB: () => import_core11.applyABVariantB,
33
+ applyWidgetConfigVars: () => import_core11.applyWidgetConfigVars,
34
+ calculateDiscount: () => import_core11.calculateDiscount,
35
+ calculateTierSavings: () => import_core11.calculateTierSavings,
36
+ computeBundleSaleCents: () => import_core11.computeBundleSaleCents,
37
+ computeFixedPricing: () => import_core11.computeFixedPricing,
38
+ createStorefrontClient: () => import_core11.createStorefrontClient,
39
39
  fetchBundleData: () => fetchBundleData,
40
- fetchBundlesForProduct: () => import_core10.fetchBundlesForProduct,
40
+ fetchBundlesForProduct: () => import_core11.fetchBundlesForProduct,
41
41
  fetchShopCustomCss: () => fetchShopCustomCss,
42
- formatCents: () => import_core10.formatCents,
43
- formatCountdown: () => import_core10.formatCountdown,
44
- formatMoney: () => import_core10.formatMoney,
45
- getABTestAssignment: () => import_core10.getABTestAssignment,
46
- getActiveTier: () => import_core10.getActiveTier,
47
- hasConsent: () => import_core10.hasConsent,
48
- injectCustomCss: () => import_core10.injectCustomCss,
49
- mergeWidgetConfig: () => import_core10.mergeWidgetConfig,
50
- observeImpression: () => import_core10.observeImpression,
51
- parseCents: () => import_core10.parseCents,
52
- parseMetaobjectBundle: () => import_core10.parseMetaobjectBundle,
53
- parseMetaobjectBundleStrict: () => import_core10.parseMetaobjectBundleStrict,
54
- percentageDiscountUnit: () => import_core10.percentageDiscountUnit,
55
- reportAddToCart: () => import_core10.reportAddToCart,
56
- reportImpression: () => import_core10.reportImpression,
57
- sanitizeCustomCss: () => import_core10.sanitizeCustomCss,
58
- setConsent: () => import_core10.setConsent,
59
- transformImageUrl: () => import_core10.transformImageUrl,
42
+ formatCents: () => import_core11.formatCents,
43
+ formatCountdown: () => import_core11.formatCountdown,
44
+ formatMoney: () => import_core11.formatMoney,
45
+ formatUnitPrice: () => import_core11.formatUnitPrice,
46
+ getABTestAssignment: () => import_core11.getABTestAssignment,
47
+ getActiveTier: () => import_core11.getActiveTier,
48
+ hasConsent: () => import_core11.hasConsent,
49
+ injectCustomCss: () => import_core11.injectCustomCss,
50
+ mergeWidgetConfig: () => import_core11.mergeWidgetConfig,
51
+ observeImpression: () => import_core11.observeImpression,
52
+ parseCents: () => import_core11.parseCents,
53
+ parseMetaobjectBundle: () => import_core11.parseMetaobjectBundle,
54
+ parseMetaobjectBundleStrict: () => import_core11.parseMetaobjectBundleStrict,
55
+ percentageDiscountUnit: () => import_core11.percentageDiscountUnit,
56
+ reportAddToCart: () => import_core11.reportAddToCart,
57
+ reportImpression: () => import_core11.reportImpression,
58
+ sanitizeCustomCss: () => import_core11.sanitizeCustomCss,
59
+ setConsent: () => import_core11.setConsent,
60
+ thumbnailRatioVars: () => import_core11.thumbnailRatioVars,
61
+ transformImageUrl: () => import_core11.transformImageUrl,
60
62
  useAnalytics: () => useAnalytics,
61
63
  useBundleData: () => useBundleData,
62
64
  useBundlesForProduct: () => useBundlesForProduct,
63
- validateQuantity: () => import_core10.validateQuantity
65
+ useWidgetConfigVars: () => useWidgetConfigVars,
66
+ validateQuantity: () => import_core11.validateQuantity
64
67
  });
65
68
  module.exports = __toCommonJS(index_exports);
66
69
 
67
70
  // src/components/FixedBundle.tsx
68
- var import_react3 = require("react");
69
- var import_core5 = require("@lime-bundles/core");
71
+ var import_react4 = require("react");
72
+ var import_core6 = require("@lime-bundles/core");
70
73
 
71
74
  // src/hooks/useBundleData.ts
72
75
  var import_react = require("react");
@@ -238,6 +241,25 @@ function useAnalytics(options) {
238
241
  return { elementRef, trackAddToCart };
239
242
  }
240
243
 
244
+ // src/hooks/useWidgetConfigVars.ts
245
+ var import_react3 = require("react");
246
+ var import_core5 = require("@lime-bundles/core");
247
+ function useWidgetConfigVars(config) {
248
+ const elementRef = (0, import_react3.useRef)(null);
249
+ (0, import_react3.useEffect)(() => {
250
+ if (elementRef.current && config) {
251
+ (0, import_core5.applyWidgetConfigVars)(elementRef.current, config);
252
+ }
253
+ }, [config]);
254
+ return (0, import_react3.useCallback)(
255
+ (el) => {
256
+ elementRef.current = el;
257
+ if (el && config) (0, import_core5.applyWidgetConfigVars)(el, config);
258
+ },
259
+ [config]
260
+ );
261
+ }
262
+
241
263
  // src/components/FixedBundle.tsx
242
264
  var import_jsx_runtime = require("react/jsx-runtime");
243
265
  function FixedBundle(props) {
@@ -263,10 +285,11 @@ function FixedBundle(props) {
263
285
  bundleType: "fixed",
264
286
  enabled: analyticsEnabled !== false
265
287
  });
266
- const [addingToCart, setAddingToCart] = (0, import_react3.useState)(false);
267
- const [cartError, setCartError] = (0, import_react3.useState)(null);
288
+ const [addingToCart, setAddingToCart] = (0, import_react4.useState)(false);
289
+ const [cartError, setCartError] = (0, import_react4.useState)(null);
268
290
  const bundle = result.status === "success" && result.bundle.bundleType === "fixed" ? result.bundle : null;
269
- (0, import_react3.useEffect)(() => {
291
+ const setConfigVarsRef = useWidgetConfigVars(bundle?.widgetConfig);
292
+ (0, import_react4.useEffect)(() => {
270
293
  if (result.status === "error") {
271
294
  onError?.(result.error);
272
295
  return;
@@ -279,14 +302,14 @@ function FixedBundle(props) {
279
302
  );
280
303
  }
281
304
  }, [result, onError]);
282
- const handleAddToCart = (0, import_react3.useCallback)(async () => {
305
+ const handleAddToCart = (0, import_react4.useCallback)(async () => {
283
306
  if (!bundle) return;
284
307
  const bundleLines = bundle.products.filter((p) => p.variants.nodes.some((v) => v.availableForSale)).map((p) => {
285
308
  const variant = p.variants.nodes.find((v) => v.availableForSale);
286
309
  return {
287
310
  productId: p.id,
288
311
  variant,
289
- quantity: (0, import_core5.resolveBundleQty)(bundle, p.id, variant.id)
312
+ quantity: (0, import_core6.resolveBundleQty)(bundle, p.id, variant.id)
290
313
  };
291
314
  }).filter((line) => line.quantity > 0);
292
315
  if (bundleLines.length === 0) return;
@@ -304,7 +327,7 @@ function FixedBundle(props) {
304
327
  await onAddToCart(lines);
305
328
  const totalPrice = bundleLines.reduce((sum, line) => {
306
329
  const price = parseFloat(line.variant.price.amount);
307
- const discounted = (0, import_core5.calculateDiscount)(
330
+ const discounted = (0, import_core6.calculateDiscount)(
308
331
  price,
309
332
  bundle.discountConfig.discountType,
310
333
  bundle.discountConfig.discountValue
@@ -339,28 +362,44 @@ function FixedBundle(props) {
339
362
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
340
363
  "div",
341
364
  {
342
- ref: elementRef,
365
+ ref: (el) => {
366
+ elementRef(el);
367
+ setConfigVarsRef(el);
368
+ },
343
369
  className: `lb-bundle lb-bundle--fixed ${className ?? ""}`,
344
370
  role: "region",
345
371
  "aria-label": bundle.title,
346
372
  children: [
347
373
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "lb-bundle__title", children: bundle.title }),
348
374
  bundle.discountLabel && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "lb-bundle__discount-badge", children: bundle.discountLabel }),
349
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "lb-bundle__products", children: bundle.products.map((product) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "lb-bundle__product", part: "product", children: [
350
- product.featuredImage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
351
- "img",
352
- {
353
- src: product.featuredImage.url,
354
- alt: product.featuredImage.altText ?? product.title,
355
- className: "lb-bundle__product-image",
356
- loading: "lazy"
357
- }
358
- ),
359
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "lb-bundle__product-info", children: [
360
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "lb-bundle__product-title", children: product.title }),
361
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "lb-bundle__product-price", children: (0, import_core5.formatMoney)(product.priceRange.minVariantPrice.amount, currency) })
362
- ] })
363
- ] }, product.id)) }),
375
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "lb-bundle__products", children: bundle.products.map((product) => {
376
+ const variant = product.variants.nodes.find((v) => v.availableForSale) ?? product.variants.nodes[0];
377
+ const priceText = variant ? (0, import_core6.formatMoney)(variant.price.amount, currency) : (0, import_core6.formatMoney)(
378
+ product.priceRange.minVariantPrice.amount,
379
+ currency
380
+ );
381
+ const unitPriceText = variant ? (0, import_core6.formatUnitPrice)(
382
+ variant.unitPrice,
383
+ variant.unitPriceMeasurement,
384
+ currency
385
+ ) : null;
386
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "lb-bundle__product", part: "product", children: [
387
+ product.featuredImage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
388
+ "img",
389
+ {
390
+ src: product.featuredImage.url,
391
+ alt: product.featuredImage.altText ?? product.title,
392
+ className: "lb-bundle__product-image",
393
+ loading: "lazy"
394
+ }
395
+ ),
396
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "lb-bundle__product-info", children: [
397
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "lb-bundle__product-title", children: product.title }),
398
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "lb-bundle__product-price", children: priceText }),
399
+ unitPriceText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "lb-bundle__product-unit-price", children: unitPriceText })
400
+ ] })
401
+ ] }, product.id);
402
+ }) }),
364
403
  cartError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "lb-bundle__error", role: "alert", children: cartError }),
365
404
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
366
405
  "button",
@@ -378,8 +417,8 @@ function FixedBundle(props) {
378
417
  }
379
418
 
380
419
  // src/components/MixMatchBundle.tsx
381
- var import_react4 = require("react");
382
- var import_core6 = require("@lime-bundles/core");
420
+ var import_react5 = require("react");
421
+ var import_core7 = require("@lime-bundles/core");
383
422
  var import_jsx_runtime2 = require("react/jsx-runtime");
384
423
  function MixMatchBundle(props) {
385
424
  const {
@@ -404,13 +443,14 @@ function MixMatchBundle(props) {
404
443
  bundleType: "mix_match",
405
444
  enabled: analyticsEnabled !== false
406
445
  });
407
- const [selections, setSelections] = (0, import_react4.useState)(
446
+ const [selections, setSelections] = (0, import_react5.useState)(
408
447
  /* @__PURE__ */ new Map()
409
448
  );
410
- const [addingToCart, setAddingToCart] = (0, import_react4.useState)(false);
411
- const [cartError, setCartError] = (0, import_react4.useState)(null);
449
+ const [addingToCart, setAddingToCart] = (0, import_react5.useState)(false);
450
+ const [cartError, setCartError] = (0, import_react5.useState)(null);
412
451
  const bundle = result.status === "success" && result.bundle.bundleType === "mix_match" ? result.bundle : null;
413
- (0, import_react4.useEffect)(() => {
452
+ const setConfigVarsRef = useWidgetConfigVars(bundle?.widgetConfig);
453
+ (0, import_react5.useEffect)(() => {
414
454
  if (result.status === "error") {
415
455
  onError?.(result.error);
416
456
  return;
@@ -427,8 +467,8 @@ function MixMatchBundle(props) {
427
467
  (sum, s) => sum + s.quantity,
428
468
  0
429
469
  );
430
- const validation = bundle ? (0, import_core6.validateQuantity)(totalQuantity, bundle.minQuantity, bundle.maxQuantity) : { valid: false, totalQuantity: 0, message: null };
431
- const toggleProduct = (0, import_react4.useCallback)(
470
+ const validation = bundle ? (0, import_core7.validateQuantity)(totalQuantity, bundle.minQuantity, bundle.maxQuantity) : { valid: false, totalQuantity: 0, message: null };
471
+ const toggleProduct = (0, import_react5.useCallback)(
432
472
  (productId, variant) => {
433
473
  setSelections((prev) => {
434
474
  const next = new Map(prev);
@@ -436,7 +476,7 @@ function MixMatchBundle(props) {
436
476
  if (next.has(key)) {
437
477
  next.delete(key);
438
478
  } else {
439
- const configuredQty = bundle ? (0, import_core6.resolveBundleQty)(bundle, productId, variant.id) : 1;
479
+ const configuredQty = bundle ? (0, import_core7.resolveBundleQty)(bundle, productId, variant.id) : 1;
440
480
  next.set(key, {
441
481
  productId,
442
482
  variantId: variant.id,
@@ -448,7 +488,7 @@ function MixMatchBundle(props) {
448
488
  },
449
489
  [bundle]
450
490
  );
451
- const updateQuantity = (0, import_react4.useCallback)(
491
+ const updateQuantity = (0, import_react5.useCallback)(
452
492
  (productId, variantId, quantity) => {
453
493
  setSelections((prev) => {
454
494
  const next = new Map(prev);
@@ -463,7 +503,7 @@ function MixMatchBundle(props) {
463
503
  },
464
504
  []
465
505
  );
466
- const handleAddToCart = (0, import_react4.useCallback)(async () => {
506
+ const handleAddToCart = (0, import_react5.useCallback)(async () => {
467
507
  if (!bundle || !validation.valid) return;
468
508
  const lines = Array.from(selections.values()).map((s) => ({
469
509
  merchandiseId: s.variantId,
@@ -519,7 +559,10 @@ function MixMatchBundle(props) {
519
559
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
520
560
  "div",
521
561
  {
522
- ref: elementRef,
562
+ ref: (el) => {
563
+ elementRef(el);
564
+ setConfigVarsRef(el);
565
+ },
523
566
  className: `lb-bundle lb-bundle--mix-match ${className ?? ""}`,
524
567
  role: "region",
525
568
  "aria-label": bundle.title,
@@ -548,7 +591,15 @@ function MixMatchBundle(props) {
548
591
  ),
549
592
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "lb-bundle__product-info", children: [
550
593
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "lb-bundle__product-title", children: product.title }),
551
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "lb-bundle__product-price", children: (0, import_core6.formatMoney)(defaultVariant.price.amount, currency) })
594
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "lb-bundle__product-price", children: (0, import_core7.formatMoney)(defaultVariant.price.amount, currency) }),
595
+ (() => {
596
+ const unitPriceText = (0, import_core7.formatUnitPrice)(
597
+ defaultVariant.unitPrice,
598
+ defaultVariant.unitPriceMeasurement,
599
+ currency
600
+ );
601
+ return unitPriceText ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "lb-bundle__product-unit-price", children: unitPriceText }) : null;
602
+ })()
552
603
  ] }),
553
604
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "lb-bundle__product-actions", children: selected ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "lb-bundle__quantity-control", children: [
554
605
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
@@ -608,8 +659,8 @@ function MixMatchBundle(props) {
608
659
  }
609
660
 
610
661
  // src/components/VolumeBundle.tsx
611
- var import_react5 = require("react");
612
- var import_core7 = require("@lime-bundles/core");
662
+ var import_react6 = require("react");
663
+ var import_core8 = require("@lime-bundles/core");
613
664
  var import_jsx_runtime3 = require("react/jsx-runtime");
614
665
  function VolumeBundle(props) {
615
666
  const {
@@ -634,11 +685,12 @@ function VolumeBundle(props) {
634
685
  bundleType: "volume",
635
686
  enabled: analyticsEnabled !== false
636
687
  });
637
- const [quantity, setQuantity] = (0, import_react5.useState)(1);
638
- const [addingToCart, setAddingToCart] = (0, import_react5.useState)(false);
639
- const [cartError, setCartError] = (0, import_react5.useState)(null);
688
+ const [quantity, setQuantity] = (0, import_react6.useState)(1);
689
+ const [addingToCart, setAddingToCart] = (0, import_react6.useState)(false);
690
+ const [cartError, setCartError] = (0, import_react6.useState)(null);
640
691
  const bundle = result.status === "success" && result.bundle.bundleType === "volume" ? result.bundle : null;
641
- (0, import_react5.useEffect)(() => {
692
+ const setConfigVarsRef = useWidgetConfigVars(bundle?.widgetConfig);
693
+ (0, import_react6.useEffect)(() => {
642
694
  if (result.status === "error") {
643
695
  onError?.(result.error);
644
696
  return;
@@ -654,14 +706,14 @@ function VolumeBundle(props) {
654
706
  const product = bundle?.products[0];
655
707
  const basePrice = product ? parseFloat(product.priceRange.minVariantPrice.amount) : 0;
656
708
  const currency = product?.priceRange.minVariantPrice.currencyCode ?? "USD";
657
- const tierSavings = bundle ? (0, import_core7.calculateTierSavings)(
709
+ const tierSavings = bundle ? (0, import_core8.calculateTierSavings)(
658
710
  bundle.volumeTiers,
659
711
  basePrice,
660
712
  quantity,
661
713
  bundle.discountConfig.discountType
662
714
  ) : [];
663
- const activeTier = bundle ? (0, import_core7.getActiveTier)(bundle.volumeTiers, quantity) : null;
664
- const handleAddToCart = (0, import_react5.useCallback)(async () => {
715
+ const activeTier = bundle ? (0, import_core8.getActiveTier)(bundle.volumeTiers, quantity) : null;
716
+ const handleAddToCart = (0, import_react6.useCallback)(async () => {
665
717
  if (!bundle || !product) return;
666
718
  const variant = product.variants.nodes.find((v) => v.availableForSale);
667
719
  if (!variant) return;
@@ -714,7 +766,10 @@ function VolumeBundle(props) {
714
766
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
715
767
  "div",
716
768
  {
717
- ref: elementRef,
769
+ ref: (el) => {
770
+ elementRef(el);
771
+ setConfigVarsRef(el);
772
+ },
718
773
  className: `lb-bundle lb-bundle--volume ${className ?? ""}`,
719
774
  role: "region",
720
775
  "aria-label": bundle.title,
@@ -733,9 +788,18 @@ function VolumeBundle(props) {
733
788
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "lb-bundle__product-info", children: [
734
789
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "lb-bundle__product-title", children: product.title }),
735
790
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: "lb-bundle__product-price", children: [
736
- (0, import_core7.formatMoney)(basePrice, currency),
791
+ (0, import_core8.formatMoney)(basePrice, currency),
737
792
  " each"
738
- ] })
793
+ ] }),
794
+ (() => {
795
+ const variant = product.variants.nodes.find((v) => v.availableForSale) ?? product.variants.nodes[0];
796
+ const unitPriceText = variant ? (0, import_core8.formatUnitPrice)(
797
+ variant.unitPrice,
798
+ variant.unitPriceMeasurement,
799
+ currency
800
+ ) : null;
801
+ return unitPriceText ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "lb-bundle__product-unit-price", children: unitPriceText }) : null;
802
+ })()
739
803
  ] })
740
804
  ] }),
741
805
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -755,7 +819,7 @@ function VolumeBundle(props) {
755
819
  "+ items"
756
820
  ] }),
757
821
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "lb-bundle__tier-price", role: "cell", children: [
758
- (0, import_core7.formatMoney)(ts.unitPrice, currency),
822
+ (0, import_core8.formatMoney)(ts.unitPrice, currency),
759
823
  " each"
760
824
  ] }),
761
825
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "lb-bundle__tier-savings", role: "cell", children: [
@@ -821,21 +885,21 @@ function VolumeBundle(props) {
821
885
  }
822
886
 
823
887
  // src/hooks/useBundlesForProduct.ts
824
- var import_react6 = require("react");
825
- var import_core8 = require("@lime-bundles/core");
888
+ var import_react7 = require("react");
889
+ var import_core9 = require("@lime-bundles/core");
826
890
  var INITIAL_STATE2 = {
827
891
  status: "loading",
828
892
  bundles: null,
829
893
  error: null
830
894
  };
831
895
  function useBundlesForProduct(options) {
832
- const [state, setState] = (0, import_react6.useState)(
896
+ const [state, setState] = (0, import_react7.useState)(
833
897
  INITIAL_STATE2
834
898
  );
835
- (0, import_react6.useEffect)(() => {
899
+ (0, import_react7.useEffect)(() => {
836
900
  const controller = new AbortController();
837
901
  setState(INITIAL_STATE2);
838
- (0, import_core8.fetchBundlesForProduct)({
902
+ (0, import_core9.fetchBundlesForProduct)({
839
903
  shopDomain: options.shopDomain,
840
904
  storefrontAccessToken: options.storefrontAccessToken,
841
905
  productHandle: options.productHandle,
@@ -858,7 +922,7 @@ function useBundlesForProduct(options) {
858
922
  signal: controller.signal
859
923
  }).then((css) => {
860
924
  if (controller.signal.aborted) return;
861
- (0, import_core8.injectCustomCss)(options.shopDomain, css);
925
+ (0, import_core9.injectCustomCss)(options.shopDomain, css);
862
926
  }).catch(() => {
863
927
  });
864
928
  return () => {
@@ -874,8 +938,8 @@ function useBundlesForProduct(options) {
874
938
  }
875
939
 
876
940
  // src/index.ts
877
- var import_core9 = require("@lime-bundles/core");
878
941
  var import_core10 = require("@lime-bundles/core");
942
+ var import_core11 = require("@lime-bundles/core");
879
943
  // Annotate the CommonJS export names for ESM import in node:
880
944
  0 && (module.exports = {
881
945
  BUNDLES_FOR_PRODUCT_QUERY,
@@ -900,6 +964,7 @@ var import_core10 = require("@lime-bundles/core");
900
964
  formatCents,
901
965
  formatCountdown,
902
966
  formatMoney,
967
+ formatUnitPrice,
903
968
  getABTestAssignment,
904
969
  getActiveTier,
905
970
  hasConsent,
@@ -914,10 +979,12 @@ var import_core10 = require("@lime-bundles/core");
914
979
  reportImpression,
915
980
  sanitizeCustomCss,
916
981
  setConsent,
982
+ thumbnailRatioVars,
917
983
  transformImageUrl,
918
984
  useAnalytics,
919
985
  useBundleData,
920
986
  useBundlesForProduct,
987
+ useWidgetConfigVars,
921
988
  validateQuantity
922
989
  });
923
990
  //# sourceMappingURL=index.cjs.map