@rebuy/rebuy-hydrogen 3.0.0-beta.16 → 3.0.0-beta.17
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/README.md +21 -17
- package/dist/components/ProductCard/ProductCard.d.ts +1 -1
- package/dist/components/ProductCard/ProductCard.d.ts.map +1 -1
- package/dist/components/ProductCard/types.d.ts +1 -0
- package/dist/components/ProductCard/types.d.ts.map +1 -1
- package/dist/components/ProductCarousel/ProductCarousel.d.ts +2 -16
- package/dist/components/ProductCarousel/ProductCarousel.d.ts.map +1 -1
- package/dist/components/ProductCarousel/types.d.ts +18 -0
- package/dist/components/ProductCarousel/types.d.ts.map +1 -0
- package/dist/components/RebuyLink/RebuyLink.d.ts +3 -0
- package/dist/components/RebuyLink/RebuyLink.d.ts.map +1 -0
- package/dist/components/RebuyLink/index.d.ts +2 -0
- package/dist/components/RebuyLink/index.d.ts.map +1 -0
- package/dist/components/RebuyLink/types.d.ts +10 -0
- package/dist/components/RebuyLink/types.d.ts.map +1 -0
- package/dist/index.css +53 -39
- package/dist/index.css.map +3 -3
- package/dist/index.js +629 -488
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +531 -390
- package/dist/index.mjs.map +4 -4
- package/dist/smart-cart/components/CartItem/CartItem.d.ts.map +1 -1
- package/dist/smart-cart/components/LoginButton/LoginButton.d.ts.map +1 -1
- package/dist/smart-cart/components/SmartCartContainer/SmartCartContainer.d.ts.map +1 -1
- package/dist/types/shopify.d.ts +1 -2
- package/dist/types/shopify.d.ts.map +1 -1
- package/dist/utils/convertToRebuyProduct.d.ts.map +1 -1
- package/dist/widgetContainer/RebuyWidgetContainer.d.ts.map +1 -1
- package/dist/widgets/RebuyDynamicBundleProducts/BundleImages.d.ts.map +1 -1
- package/dist/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.d.ts.map +1 -1
- package/dist/widgets/RebuyProductAddOns/RebuyProductAddOnCard.d.ts.map +1 -1
- package/dist/widgets/RebuyProductAddOns/RebuyProductAddOns.d.ts.map +1 -1
- package/dist/widgets/RebuyWidget/RebuyWidget.d.ts.map +1 -1
- package/dist/widgets/RebuyWidget/WidgetContent.d.ts +1 -1
- package/dist/widgets/RebuyWidget/WidgetContent.d.ts.map +1 -1
- package/dist/widgets/RebuyWidget/types.d.ts +2 -0
- package/dist/widgets/RebuyWidget/types.d.ts.map +1 -1
- package/package.json +9 -4
package/dist/index.js
CHANGED
@@ -1271,7 +1271,7 @@ var useTieredProgressBarStore = (0, import_zustand.create)((set, get) => ({
|
|
1271
1271
|
if (idsToFetch.length > 0) {
|
1272
1272
|
const productGids = idsToFetch.map((id) => `gid://shopify/Product/${id}`);
|
1273
1273
|
const graphqlQuery = `query getProductsByIds($ids: [ID!]!) { nodes(ids: $ids) { ... on Product { id title handle tags images(first: 1) { edges { node { url altText } } } variants(first: 30) { edges { node { id title sku availableForSale price { amount currencyCode } compareAtPrice { amount currencyCode } selectedOptions { name value } image { url altText } } } } } } }`;
|
1274
|
-
const response = await fetch(`https://${_shopifyDomain}/api/
|
1274
|
+
const response = await fetch(`https://${_shopifyDomain}/api/2025-01/graphql.json`, {
|
1275
1275
|
body: JSON.stringify({ query: graphqlQuery, variables: { ids: productGids } }),
|
1276
1276
|
headers: {
|
1277
1277
|
"Content-Type": "application/json",
|
@@ -3574,7 +3574,7 @@ var RebuyHydrogenReactContextProvider = ({
|
|
3574
3574
|
publicStoreDomain,
|
3575
3575
|
publicStorefrontId,
|
3576
3576
|
publicStorefrontToken,
|
3577
|
-
storefrontApiVersion = "
|
3577
|
+
storefrontApiVersion = "2025-01"
|
3578
3578
|
}) => {
|
3579
3579
|
const adaptedCallbacks = (0, import_react5.useMemo)(
|
3580
3580
|
() => ({
|
@@ -3865,7 +3865,14 @@ AnnouncementBar.displayName = "AnnouncementBar";
|
|
3865
3865
|
// src/smart-cart/components/CartItem/CartItem.tsx
|
3866
3866
|
var import_clsx = __toESM(require("clsx"), 1);
|
3867
3867
|
var import_react8 = require("react");
|
3868
|
+
var import_react_router4 = require("react-router");
|
3869
|
+
|
3870
|
+
// src/components/RebuyLink/RebuyLink.tsx
|
3868
3871
|
var import_react_router3 = require("react-router");
|
3872
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
3873
|
+
var RebuyLink = ({ ariaLabel, children, className, handle, onClick, role = "link" }) => {
|
3874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_router3.Link, { "aria-label": ariaLabel, className, onClick, rel: "nofollow", role, to: handle, children });
|
3875
|
+
};
|
3869
3876
|
|
3870
3877
|
// src/smart-cart/hooks/useCartItemFeatures.ts
|
3871
3878
|
var import_react7 = require("react");
|
@@ -4285,17 +4292,18 @@ var result2 = { "rebuy-cart-item": "CartItem_rebuy-cart-item", "rebuy-cart-item_
|
|
4285
4292
|
var CartItem_default = result2;
|
4286
4293
|
|
4287
4294
|
// src/smart-cart/components/CartItem/CartItem.tsx
|
4288
|
-
var
|
4289
|
-
var Spinner = ({ className }) => /* @__PURE__ */ (0,
|
4295
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
4296
|
+
var Spinner = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: (0, import_clsx.default)(CartItem_default["rebuy-cart-item__spinner"], className) });
|
4290
4297
|
var CartItem = ({ line }) => {
|
4291
4298
|
const { config, isCartBusy, isHydrogenReact, removeItem, updateItem } = useSmartCart();
|
4292
|
-
const itemFetcher = (0,
|
4299
|
+
const itemFetcher = (0, import_react_router4.useFetcher)();
|
4293
4300
|
const [isIncreasing, setIsIncreasing] = (0, import_react8.useState)(false);
|
4294
4301
|
const [isDecreasing, setIsDecreasing] = (0, import_react8.useState)(false);
|
4295
4302
|
const [isRemoving, setIsRemoving] = (0, import_react8.useState)(false);
|
4296
4303
|
const [isAdjustingBMSM, setIsAdjustingBMSM] = (0, import_react8.useState)(false);
|
4297
4304
|
const [isSwitchingSubscription, setIsSwitchingSubscription] = (0, import_react8.useState)(false);
|
4298
4305
|
const [switchingDirection, setSwitchingDirection] = (0, import_react8.useState)(null);
|
4306
|
+
const { toggleCart } = useSmartCart();
|
4299
4307
|
const {
|
4300
4308
|
actions: itemActionsLogic,
|
4301
4309
|
bmsm,
|
@@ -4515,7 +4523,7 @@ var CartItem = ({ line }) => {
|
|
4515
4523
|
}
|
4516
4524
|
}, [isHydrogenReact, isCartBusy, itemFetcher.state, itemFetcher.data]);
|
4517
4525
|
const selectValue = line.sellingPlanAllocation?.sellingPlan.id ?? "onetime";
|
4518
|
-
return /* @__PURE__ */ (0,
|
4526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
4519
4527
|
"li",
|
4520
4528
|
{
|
4521
4529
|
"aria-label": meta.ariaLabel,
|
@@ -4523,21 +4531,34 @@ var CartItem = ({ line }) => {
|
|
4523
4531
|
"data-line-id": line.id,
|
4524
4532
|
"data-variant-id": line.merchandise.id,
|
4525
4533
|
children: [
|
4526
|
-
/* @__PURE__ */ (0,
|
4527
|
-
|
4528
|
-
|
4529
|
-
|
4534
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: CartItem_default["rebuy-cart-item__media"], children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
4535
|
+
RebuyLink,
|
4536
|
+
{
|
4537
|
+
ariaLabel: meta.linkLabel,
|
4538
|
+
handle: meta.itemUrl,
|
4539
|
+
onClick: () => {
|
4540
|
+
toggleCart();
|
4541
|
+
},
|
4542
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("img", { alt: meta.imageAltText, height: 120, loading: "lazy", src: meta.imageUrl, width: 120 })
|
4543
|
+
}
|
4544
|
+
) }),
|
4545
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: CartItem_default["rebuy-cart-item__info"], children: [
|
4546
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
4547
|
+
RebuyLink,
|
4530
4548
|
{
|
4531
|
-
|
4549
|
+
ariaLabel: meta.linkLabel,
|
4532
4550
|
className: CartItem_default["rebuy-cart-item__product-title"],
|
4533
|
-
|
4551
|
+
handle: meta.itemUrl,
|
4552
|
+
onClick: () => {
|
4553
|
+
toggleCart();
|
4554
|
+
},
|
4534
4555
|
role: "heading",
|
4535
4556
|
children: meta.productTitle
|
4536
4557
|
}
|
4537
4558
|
),
|
4538
|
-
meta.variantTitle && /* @__PURE__ */ (0,
|
4539
|
-
properties.hasVisibleProperties && /* @__PURE__ */ (0,
|
4540
|
-
properties.deliveryFrequency && /* @__PURE__ */ (0,
|
4559
|
+
meta.variantTitle && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: CartItem_default["rebuy-cart-item__variant-title"], children: meta.variantTitle }),
|
4560
|
+
properties.hasVisibleProperties && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: CartItem_default["rebuy-cart-item__properties-list"], children: [
|
4561
|
+
properties.deliveryFrequency && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
4541
4562
|
"div",
|
4542
4563
|
{
|
4543
4564
|
className: (0, import_clsx.default)(
|
@@ -4547,7 +4568,7 @@ var CartItem = ({ line }) => {
|
|
4547
4568
|
children: properties.deliveryFrequency
|
4548
4569
|
}
|
4549
4570
|
),
|
4550
|
-
properties.visibleProperties.map((prop, index) => /* @__PURE__ */ (0,
|
4571
|
+
properties.visibleProperties.map((prop, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
4551
4572
|
"div",
|
4552
4573
|
{
|
4553
4574
|
className: (0, import_clsx.default)(
|
@@ -4555,16 +4576,16 @@ var CartItem = ({ line }) => {
|
|
4555
4576
|
getItemPropertyKeyClass(prop),
|
4556
4577
|
getItemPropertyValueClass(prop)
|
4557
4578
|
),
|
4558
|
-
children: prop.key !== "_Discount" ? /* @__PURE__ */ (0,
|
4559
|
-
/* @__PURE__ */ (0,
|
4560
|
-
/* @__PURE__ */ (0,
|
4561
|
-
/* @__PURE__ */ (0,
|
4562
|
-
] }) : /* @__PURE__ */ (0,
|
4579
|
+
children: prop.key !== "_Discount" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
4580
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: CartItem_default["rebuy-cart-item__property-key"], children: prop.key }),
|
4581
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: CartItem_default["rebuy-cart-item__property-separator"], children: ": " }),
|
4582
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: CartItem_default["rebuy-cart-item__property-value"], children: prop.value })
|
4583
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: CartItem_default["rebuy-cart-item__property-value"], children: prop.value })
|
4563
4584
|
},
|
4564
4585
|
`${line.id}-prop-${index}`
|
4565
4586
|
))
|
4566
4587
|
] }),
|
4567
|
-
/* @__PURE__ */ (0,
|
4588
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
4568
4589
|
"button",
|
4569
4590
|
{
|
4570
4591
|
"aria-label": `Remove ${meta.productTitle}`,
|
@@ -4572,11 +4593,11 @@ var CartItem = ({ line }) => {
|
|
4572
4593
|
disabled: isLoadingCombined,
|
4573
4594
|
onClick: handleRemoveItem,
|
4574
4595
|
type: "button",
|
4575
|
-
children: isRemoving ? /* @__PURE__ */ (0,
|
4596
|
+
children: isRemoving ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Spinner, {}) : "\u2715"
|
4576
4597
|
}
|
4577
4598
|
),
|
4578
|
-
!shouldHideQuantitySelector && /* @__PURE__ */ (0,
|
4579
|
-
/* @__PURE__ */ (0,
|
4599
|
+
!shouldHideQuantitySelector && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: CartItem_default["rebuy-cart-item__quantity-selector-area"], children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: CartItem_default["rebuy-cart-item__quantity-selector"], children: [
|
4600
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
4580
4601
|
"button",
|
4581
4602
|
{
|
4582
4603
|
"aria-label": `Decrease quantity of ${meta.productTitle}`,
|
@@ -4584,17 +4605,17 @@ var CartItem = ({ line }) => {
|
|
4584
4605
|
disabled: isLoadingCombined,
|
4585
4606
|
onClick: handleDecreaseQuantity,
|
4586
4607
|
type: "button",
|
4587
|
-
children: isDecreasing ? /* @__PURE__ */ (0,
|
4608
|
+
children: isDecreasing ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Spinner, {}) : "-"
|
4588
4609
|
}
|
4589
4610
|
),
|
4590
|
-
/* @__PURE__ */ (0,
|
4591
|
-
/* @__PURE__ */ (0,
|
4611
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { "aria-live": "polite", className: CartItem_default["rebuy-cart-item__quantity-selector-label"], children: [
|
4612
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(ScreenReaderText, { children: [
|
4592
4613
|
"Quantity of ",
|
4593
4614
|
meta.productTitle
|
4594
4615
|
] }),
|
4595
4616
|
line.quantity
|
4596
4617
|
] }),
|
4597
|
-
/* @__PURE__ */ (0,
|
4618
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
4598
4619
|
"button",
|
4599
4620
|
{
|
4600
4621
|
"aria-label": `Increase quantity of ${meta.productTitle}`,
|
@@ -4602,12 +4623,12 @@ var CartItem = ({ line }) => {
|
|
4602
4623
|
disabled: isLoadingCombined,
|
4603
4624
|
onClick: handleIncreaseQuantity,
|
4604
4625
|
type: "button",
|
4605
|
-
children: isIncreasing ? /* @__PURE__ */ (0,
|
4626
|
+
children: isIncreasing ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Spinner, {}) : "+"
|
4606
4627
|
}
|
4607
4628
|
)
|
4608
4629
|
] }) }),
|
4609
|
-
/* @__PURE__ */ (0,
|
4610
|
-
/* @__PURE__ */ (0,
|
4630
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: CartItem_default["rebuy-cart-item__price-details"], children: pricing.hasDiscount && pricing.compareAtDisplayPrice ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
4631
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
4611
4632
|
"span",
|
4612
4633
|
{
|
4613
4634
|
"aria-label": "Sale price",
|
@@ -4616,12 +4637,12 @@ var CartItem = ({ line }) => {
|
|
4616
4637
|
CartItem_default["rebuy-cart-item__money--sale"]
|
4617
4638
|
),
|
4618
4639
|
children: [
|
4619
|
-
/* @__PURE__ */ (0,
|
4640
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScreenReaderText, { children: "Sale price" }),
|
4620
4641
|
pricing.displayPrice
|
4621
4642
|
]
|
4622
4643
|
}
|
4623
4644
|
),
|
4624
|
-
/* @__PURE__ */ (0,
|
4645
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
4625
4646
|
"span",
|
4626
4647
|
{
|
4627
4648
|
"aria-label": "Original price",
|
@@ -4630,17 +4651,17 @@ var CartItem = ({ line }) => {
|
|
4630
4651
|
CartItem_default["rebuy-cart-item__money--compare-at"]
|
4631
4652
|
),
|
4632
4653
|
children: [
|
4633
|
-
/* @__PURE__ */ (0,
|
4654
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScreenReaderText, { children: "Original price" }),
|
4634
4655
|
pricing.compareAtDisplayPrice
|
4635
4656
|
]
|
4636
4657
|
}
|
4637
4658
|
)
|
4638
|
-
] }) : /* @__PURE__ */ (0,
|
4639
|
-
/* @__PURE__ */ (0,
|
4659
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { "aria-label": "Price", className: CartItem_default["rebuy-cart-item__money"], children: [
|
4660
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScreenReaderText, { children: "Price" }),
|
4640
4661
|
pricing.displayPrice
|
4641
4662
|
] }) }),
|
4642
|
-
bundle.isBundleParent && bundle.showToggle && /* @__PURE__ */ (0,
|
4643
|
-
bundle.itemCount > 0 && /* @__PURE__ */ (0,
|
4663
|
+
bundle.isBundleParent && bundle.showToggle && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: CartItem_default["rebuy-cart-item__bundle-section"], children: [
|
4664
|
+
bundle.itemCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
4644
4665
|
"button",
|
4645
4666
|
{
|
4646
4667
|
"aria-controls": `bundle-details-${line.id}`,
|
@@ -4656,11 +4677,11 @@ var CartItem = ({ line }) => {
|
|
4656
4677
|
bundle.itemCount,
|
4657
4678
|
" item",
|
4658
4679
|
bundle.itemCount !== 1 ? "s" : "",
|
4659
|
-
/* @__PURE__ */ (0,
|
4680
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", className: CartItem_default["rebuy-cart-item__bundle-chev-icon"], children: isBundleExpanded ? "\u25B2" : "\u25BC" })
|
4660
4681
|
]
|
4661
4682
|
}
|
4662
4683
|
),
|
4663
|
-
bundle.itemCount > 0 && isBundleExpanded && /* @__PURE__ */ (0,
|
4684
|
+
bundle.itemCount > 0 && isBundleExpanded && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
4664
4685
|
"ul",
|
4665
4686
|
{
|
4666
4687
|
className: CartItem_default["rebuy-cart-item__bundle-children-list"],
|
@@ -4674,12 +4695,12 @@ var CartItem = ({ line }) => {
|
|
4674
4695
|
optionData,
|
4675
4696
|
index
|
4676
4697
|
);
|
4677
|
-
return /* @__PURE__ */ (0,
|
4698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
4678
4699
|
"li",
|
4679
4700
|
{
|
4680
4701
|
className: CartItem_default["rebuy-cart-item__bundle-child-item"],
|
4681
4702
|
children: [
|
4682
|
-
/* @__PURE__ */ (0,
|
4703
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: CartItem_default["rebuy-cart-item__bundle-child-media-wrapper"], children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: CartItem_default["rebuy-cart-item__bundle-child-image-wrapper"], children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
4683
4704
|
"img",
|
4684
4705
|
{
|
4685
4706
|
alt: childTitle,
|
@@ -4688,7 +4709,7 @@ var CartItem = ({ line }) => {
|
|
4688
4709
|
src: sizeImage(childImage, "40x40")
|
4689
4710
|
}
|
4690
4711
|
) }) }),
|
4691
|
-
/* @__PURE__ */ (0,
|
4712
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: CartItem_default["rebuy-cart-item__bundle-child-details"], children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h5", { className: CartItem_default["rebuy-cart-item__bundle-child-title"], children: childTitle }) })
|
4692
4713
|
]
|
4693
4714
|
},
|
4694
4715
|
`${line.id}-bundle-child-${index}`
|
@@ -4699,18 +4720,18 @@ var CartItem = ({ line }) => {
|
|
4699
4720
|
] })
|
4700
4721
|
] }),
|
4701
4722
|
" ",
|
4702
|
-
bmsm.isEnabledAndApplicable && /* @__PURE__ */ (0,
|
4723
|
+
bmsm.isEnabledAndApplicable && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: CartItem_default["rebuy-cart-item__bmsm-section"], children: bmsm.isButtonMode ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: CartItem_default["rebuy-cart-item__bmsm-button-wrapper"], children: bmsm.nextApplicableTiers.map((tier) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
4703
4724
|
"button",
|
4704
4725
|
{
|
4705
4726
|
"aria-label": `${bmsm.getButtonText(tier)} for ${meta.productTitle}`,
|
4706
4727
|
className: CartItem_default["rebuy-cart-item__bmsm-button"],
|
4707
4728
|
disabled: isLoadingCombined,
|
4708
4729
|
onClick: () => handleAdjustBMSMQuantity(tier.quantity ?? 0),
|
4709
|
-
children: /* @__PURE__ */ (0,
|
4730
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: bmsm.getButtonText(tier) })
|
4710
4731
|
},
|
4711
4732
|
`bmsm-${line.id}-${tier.quantity}`
|
4712
|
-
)) }) : /* @__PURE__ */ (0,
|
4713
|
-
sts.isEnabledAndApplicable && /* @__PURE__ */ (0,
|
4733
|
+
)) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: CartItem_default["rebuy-cart-item__bmsm-dynamic-message"], children: bmsm.dynamicText }) }),
|
4734
|
+
sts.isEnabledAndApplicable && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: CartItem_default["rebuy-cart-item__sts-section"], children: !sts.isCurrentlySubscription && sts.availableFrequencies.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
4714
4735
|
"button",
|
4715
4736
|
{
|
4716
4737
|
"aria-label": `Switch ${meta.productTitle} to a Subscription`,
|
@@ -4718,9 +4739,9 @@ var CartItem = ({ line }) => {
|
|
4718
4739
|
disabled: isLoadingCombined,
|
4719
4740
|
onClick: handleUpgradeToSubscriptionClick,
|
4720
4741
|
type: "button",
|
4721
|
-
children: isSwitchingSubscription && switchingDirection === "upgrading" ? /* @__PURE__ */ (0,
|
4742
|
+
children: isSwitchingSubscription && switchingDirection === "upgrading" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Spinner, {}) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: sts.getUpgradeButtonLabel() })
|
4722
4743
|
}
|
4723
|
-
) : sts.isCurrentlySubscription || sts.canDowngrade ? /* @__PURE__ */ (0,
|
4744
|
+
) : sts.isCurrentlySubscription || sts.canDowngrade ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: isSwitchingSubscription ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: CartItem_default["rebuy-cart-item__sts-loading-replacement"], children: sts.getLoadingLabel(switchingDirection) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
4724
4745
|
"select",
|
4725
4746
|
{
|
4726
4747
|
"aria-label": `Subscription delivery frequency for ${meta.productTitle}`,
|
@@ -4729,8 +4750,8 @@ var CartItem = ({ line }) => {
|
|
4729
4750
|
onChange: handleSwitchSubscriptionChange,
|
4730
4751
|
value: selectValue,
|
4731
4752
|
children: [
|
4732
|
-
sts.canDowngrade && /* @__PURE__ */ (0,
|
4733
|
-
sts.availableFrequencies.length > 0 && /* @__PURE__ */ (0,
|
4753
|
+
sts.canDowngrade && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("optgroup", { label: sts.getOneTimeGroupLabel(), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "onetime", children: sts.getOneTimeLabel() }) }),
|
4754
|
+
sts.availableFrequencies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("optgroup", { label: sts.getGroupLabel(), children: sts.availableFrequencies.map((freq) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: freq.id, children: sts.getOptionLabel(freq.id) }, freq.id)) })
|
4734
4755
|
]
|
4735
4756
|
}
|
4736
4757
|
) }) : null })
|
@@ -4744,11 +4765,11 @@ var result3 = { "rebuy-empty-cart-message": "EmptyCart_rebuy-empty-cart-message"
|
|
4744
4765
|
var EmptyCart_default = result3;
|
4745
4766
|
|
4746
4767
|
// src/smart-cart/components/EmptyCart/EmptyCart.tsx
|
4747
|
-
var
|
4768
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
4748
4769
|
var EmptyCart = () => {
|
4749
4770
|
const { config } = useSmartCart();
|
4750
4771
|
const emptyCartMarkup = config?.empty_cart_markup || "<p>Your cart is empty.</p>";
|
4751
|
-
return /* @__PURE__ */ (0,
|
4772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: EmptyCart_default["rebuy-empty-cart-message"], dangerouslySetInnerHTML: { __html: emptyCartMarkup } });
|
4752
4773
|
};
|
4753
4774
|
|
4754
4775
|
// src/smart-cart/components/CartItemList/CartItemList.module.css
|
@@ -4756,7 +4777,7 @@ var result4 = { "rebuy-cart-item-list__container": "CartItemList_rebuy-cart-item
|
|
4756
4777
|
var CartItemList_default = result4;
|
4757
4778
|
|
4758
4779
|
// src/smart-cart/components/CartItemList/CartItemList.tsx
|
4759
|
-
var
|
4780
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
4760
4781
|
var CartItemList = ({ componentConfig }) => {
|
4761
4782
|
const { cartData, isLoading: isCartLoading, isProgressBarLineItemMode } = useSmartCart();
|
4762
4783
|
const lines = cartData?.lines?.nodes ?? [];
|
@@ -4767,13 +4788,13 @@ var CartItemList = ({ componentConfig }) => {
|
|
4767
4788
|
return true;
|
4768
4789
|
});
|
4769
4790
|
const hasVisibleItems = visibleLines.length > 0;
|
4770
|
-
return /* @__PURE__ */ (0,
|
4791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
4771
4792
|
"div",
|
4772
4793
|
{
|
4773
4794
|
className: CartItemList_default["rebuy-cart-item-list__container"],
|
4774
4795
|
"data-rebuy-component": "cart-items",
|
4775
4796
|
"data-rebuy-component-id": componentConfig.component_id,
|
4776
|
-
children: hasVisibleItems ? /* @__PURE__ */ (0,
|
4797
|
+
children: hasVisibleItems ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: CartItemList_default["rebuy-cart-item-list"], "data-smartcart-items": "", role: "group", tabIndex: 0, children: visibleLines.map((line) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CartItem, { line }, line.id)) }) : !isCartLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EmptyCart, {})
|
4777
4798
|
}
|
4778
4799
|
);
|
4779
4800
|
};
|
@@ -4781,14 +4802,14 @@ var CartItemList = ({ componentConfig }) => {
|
|
4781
4802
|
// src/smart-cart/components/CartNoteInput/CartNoteInput.tsx
|
4782
4803
|
var import_clsx2 = __toESM(require("clsx"), 1);
|
4783
4804
|
var import_react9 = __toESM(require("react"), 1);
|
4784
|
-
var
|
4805
|
+
var import_react_router5 = require("react-router");
|
4785
4806
|
|
4786
4807
|
// src/smart-cart/components/CartNoteInput/CartNoteInput.module.css
|
4787
4808
|
var result5 = { "rebuy-cart-note-input": "CartNoteInput_rebuy-cart-note-input", "rebuy-cart-note-input__toggle-control": "CartNoteInput_rebuy-cart-note-input__toggle-control", "rebuy-cart-note-input__toggle-checkbox": "CartNoteInput_rebuy-cart-note-input__toggle-checkbox", "rebuy-cart-note-input__toggle-label": "CartNoteInput_rebuy-cart-note-input__toggle-label", "rebuy-cart-note-input__textarea-wrapper": "CartNoteInput_rebuy-cart-note-input__textarea-wrapper", "rebuy-cart-note-input__textarea": "CartNoteInput_rebuy-cart-note-input__textarea", "rebuy-cart-note-input__save-button": "CartNoteInput_rebuy-cart-note-input__save-button", "rebuy-cart-note-input__save-button--visible": "CartNoteInput_rebuy-cart-note-input__save-button--visible", "rebuy-cart-note-input__save-button--saving": "CartNoteInput_rebuy-cart-note-input__save-button--saving", "rebuy-cart-note-input__save-button--saved": "CartNoteInput_rebuy-cart-note-input__save-button--saved", "rebuy-cart-note-input__save-button--error": "CartNoteInput_rebuy-cart-note-input__save-button--error", "rebuy-cart-note-input__meta-info": "CartNoteInput_rebuy-cart-note-input__meta-info", "rebuy-cart-note-input__meta-info--hidden": "CartNoteInput_rebuy-cart-note-input__meta-info--hidden", "rebuy-cart-note-input__remaining-chars-indicator": "CartNoteInput_rebuy-cart-note-input__remaining-chars-indicator", "rebuy-cart-note-input__help-text": "CartNoteInput_rebuy-cart-note-input__help-text", "rebuy-cart-note-input__content-area": "CartNoteInput_rebuy-cart-note-input__content-area" };
|
4788
4809
|
var CartNoteInput_default = result5;
|
4789
4810
|
|
4790
4811
|
// src/smart-cart/components/CartNoteInput/CartNoteInput.tsx
|
4791
|
-
var
|
4812
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
4792
4813
|
var CartNoteInput = import_react9.default.memo(({ componentConfig }) => {
|
4793
4814
|
const {
|
4794
4815
|
cartData,
|
@@ -4797,7 +4818,7 @@ var CartNoteInput = import_react9.default.memo(({ componentConfig }) => {
|
|
4797
4818
|
isLoading: isGlobalCartLoading,
|
4798
4819
|
updateCartNote: hrUpdateCartNote
|
4799
4820
|
} = useSmartCart();
|
4800
|
-
const noteFetcher = (0,
|
4821
|
+
const noteFetcher = (0, import_react_router5.useFetcher)();
|
4801
4822
|
const textareaRef = (0, import_react9.useRef)(null);
|
4802
4823
|
const isTextareaFocusedRef = (0, import_react9.useRef)(false);
|
4803
4824
|
const settings = componentConfig.settings || {};
|
@@ -4949,15 +4970,15 @@ var CartNoteInput = import_react9.default.memo(({ componentConfig }) => {
|
|
4949
4970
|
const helpTextId = `rebuy-cart-note-help-${componentConfig.component_id}`;
|
4950
4971
|
const remainingCharsId = `rebuy-cart-note-remaining-${componentConfig.component_id}`;
|
4951
4972
|
const describedByIds = [remainingChars !== null && currentNoteValue ? remainingCharsId : null, helpTextId].filter(Boolean).join(" ");
|
4952
|
-
return /* @__PURE__ */ (0,
|
4973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
4953
4974
|
"div",
|
4954
4975
|
{
|
4955
4976
|
className: CartNoteInput_default["rebuy-cart-note-input"],
|
4956
4977
|
"data-rebuy-component": "notes",
|
4957
4978
|
"data-rebuy-component-id": componentConfig.component_id ?? "notes",
|
4958
4979
|
children: [
|
4959
|
-
/* @__PURE__ */ (0,
|
4960
|
-
/* @__PURE__ */ (0,
|
4980
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: CartNoteInput_default["rebuy-cart-note-input__toggle-control"], children: [
|
4981
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4961
4982
|
"input",
|
4962
4983
|
{
|
4963
4984
|
checked: isTextareaVisible,
|
@@ -4967,7 +4988,7 @@ var CartNoteInput = import_react9.default.memo(({ componentConfig }) => {
|
|
4967
4988
|
type: "checkbox"
|
4968
4989
|
}
|
4969
4990
|
),
|
4970
|
-
/* @__PURE__ */ (0,
|
4991
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4971
4992
|
"span",
|
4972
4993
|
{
|
4973
4994
|
className: CartNoteInput_default["rebuy-cart-note-input__toggle-label"],
|
@@ -4975,9 +4996,9 @@ var CartNoteInput = import_react9.default.memo(({ componentConfig }) => {
|
|
4975
4996
|
}
|
4976
4997
|
)
|
4977
4998
|
] }),
|
4978
|
-
isTextareaVisible && /* @__PURE__ */ (0,
|
4979
|
-
/* @__PURE__ */ (0,
|
4980
|
-
/* @__PURE__ */ (0,
|
4999
|
+
isTextareaVisible && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: CartNoteInput_default["rebuy-cart-note-input__content-area"], children: [
|
5000
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: CartNoteInput_default["rebuy-cart-note-input__textarea-wrapper"], children: [
|
5001
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4981
5002
|
"textarea",
|
4982
5003
|
{
|
4983
5004
|
"aria-describedby": describedByIds || void 0,
|
@@ -4995,7 +5016,7 @@ var CartNoteInput = import_react9.default.memo(({ componentConfig }) => {
|
|
4995
5016
|
value: currentNoteValue
|
4996
5017
|
}
|
4997
5018
|
),
|
4998
|
-
/* @__PURE__ */ (0,
|
5019
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4999
5020
|
"button",
|
5000
5021
|
{
|
5001
5022
|
"aria-label": saveMessage?.text || (isNoteChanged ? "Save note changes" : "Note is up to date"),
|
@@ -5007,7 +5028,7 @@ var CartNoteInput = import_react9.default.memo(({ componentConfig }) => {
|
|
5007
5028
|
}
|
5008
5029
|
)
|
5009
5030
|
] }),
|
5010
|
-
/* @__PURE__ */ (0,
|
5031
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
5011
5032
|
"div",
|
5012
5033
|
{
|
5013
5034
|
className: (0, import_clsx2.default)(
|
@@ -5015,7 +5036,7 @@ var CartNoteInput = import_react9.default.memo(({ componentConfig }) => {
|
|
5015
5036
|
!isNoteChanged && !saveMessage && CartNoteInput_default["rebuy-cart-note-input__meta-info--hidden"]
|
5016
5037
|
),
|
5017
5038
|
children: [
|
5018
|
-
limitChars && currentNoteValue.length > 0 && remainingChars !== null && /* @__PURE__ */ (0,
|
5039
|
+
limitChars && currentNoteValue.length > 0 && remainingChars !== null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
5019
5040
|
"small",
|
5020
5041
|
{
|
5021
5042
|
"aria-live": "polite",
|
@@ -5024,7 +5045,7 @@ var CartNoteInput = import_react9.default.memo(({ componentConfig }) => {
|
|
5024
5045
|
children: `You have ${remainingChars} characters remaining.`
|
5025
5046
|
}
|
5026
5047
|
),
|
5027
|
-
/* @__PURE__ */ (0,
|
5048
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { className: CartNoteInput_default["rebuy-cart-note-input__help-text"], id: helpTextId, children: "Press Enter to save, Shift+Enter for new line." })
|
5028
5049
|
]
|
5029
5050
|
}
|
5030
5051
|
)
|
@@ -5044,7 +5065,7 @@ var result6 = { "rebuy-cart-subtotal": "CartSubtotal_rebuy-cart-subtotal", "rebu
|
|
5044
5065
|
var CartSubtotal_default = result6;
|
5045
5066
|
|
5046
5067
|
// src/smart-cart/components/CartSubtotal/CartSubtotal.tsx
|
5047
|
-
var
|
5068
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
5048
5069
|
var getDiscountAllocationTitle = (alloc) => {
|
5049
5070
|
switch (alloc.__typename) {
|
5050
5071
|
case "CartCodeDiscountAllocation":
|
@@ -5152,37 +5173,37 @@ var CartSubtotalComponent = ({ componentConfig }) => {
|
|
5152
5173
|
const primaryPrice = formattedFinalTotal;
|
5153
5174
|
const compareAtPrice = hasOrderDiscount ? formattedPreDiscountSubtotal : null;
|
5154
5175
|
const summaryId = `rebuy-discount-summary-details-${componentConfig.component_id}`;
|
5155
|
-
return /* @__PURE__ */ (0,
|
5176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
5156
5177
|
"div",
|
5157
5178
|
{
|
5158
5179
|
className: rootClasses,
|
5159
5180
|
"data-rebuy-component": "cart-subtotal",
|
5160
5181
|
"data-rebuy-component-id": componentConfig.component_id,
|
5161
5182
|
children: [
|
5162
|
-
/* @__PURE__ */ (0,
|
5163
|
-
/* @__PURE__ */ (0,
|
5164
|
-
/* @__PURE__ */ (0,
|
5165
|
-
/* @__PURE__ */ (0,
|
5166
|
-
compareAtPrice ? /* @__PURE__ */ (0,
|
5167
|
-
/* @__PURE__ */ (0,
|
5168
|
-
/* @__PURE__ */ (0,
|
5169
|
-
/* @__PURE__ */ (0,
|
5183
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: CartSubtotal_default["rebuy-cart-subtotal__row"], children: [
|
5184
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: CartSubtotal_default["rebuy-cart-subtotal__label"], children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: subtotalLabel }) }),
|
5185
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: CartSubtotal_default["rebuy-cart-subtotal__amount-wrapper"], children: [
|
5186
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ScreenReaderText, { children: "Cart subtotal" }),
|
5187
|
+
compareAtPrice ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
5188
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: CartSubtotal_default["rebuy-cart-subtotal__price--final"], children: [
|
5189
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ScreenReaderText, { children: "Final price" }),
|
5190
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: primaryPrice })
|
5170
5191
|
] }),
|
5171
|
-
/* @__PURE__ */ (0,
|
5172
|
-
/* @__PURE__ */ (0,
|
5173
|
-
/* @__PURE__ */ (0,
|
5192
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: CartSubtotal_default["rebuy-cart-subtotal__price--compare-at"], children: [
|
5193
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ScreenReaderText, { children: "Original price" }),
|
5194
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: compareAtPrice })
|
5174
5195
|
] })
|
5175
|
-
] }) : /* @__PURE__ */ (0,
|
5196
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: primaryPrice })
|
5176
5197
|
] })
|
5177
5198
|
] }),
|
5178
|
-
shouldShowDiscountSummary && /* @__PURE__ */ (0,
|
5199
|
+
shouldShowDiscountSummary && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
5179
5200
|
"div",
|
5180
5201
|
{
|
5181
5202
|
className: (0, import_clsx3.default)(CartSubtotal_default["rebuy-cart-subtotal__discount-summary"], {
|
5182
5203
|
[CartSubtotal_default["rebuy-cart-subtotal__discount-summary--expanded"]]: isDiscountSummaryExpanded
|
5183
5204
|
}),
|
5184
5205
|
children: [
|
5185
|
-
/* @__PURE__ */ (0,
|
5206
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
5186
5207
|
"button",
|
5187
5208
|
{
|
5188
5209
|
"aria-controls": summaryId,
|
@@ -5190,24 +5211,24 @@ var CartSubtotalComponent = ({ componentConfig }) => {
|
|
5190
5211
|
className: CartSubtotal_default["rebuy-cart-subtotal__discount-summary-header"],
|
5191
5212
|
onClick: toggleDiscountSummary,
|
5192
5213
|
children: [
|
5193
|
-
/* @__PURE__ */ (0,
|
5194
|
-
/* @__PURE__ */ (0,
|
5195
|
-
/* @__PURE__ */ (0,
|
5214
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: discountSummaryCountLabel }),
|
5215
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { "aria-hidden": "true", className: CartSubtotal_default["rebuy-cart-subtotal__discount-summary-icon"], children: [
|
5216
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", { children: "\u25BC" }),
|
5196
5217
|
" "
|
5197
5218
|
] })
|
5198
5219
|
]
|
5199
5220
|
}
|
5200
5221
|
),
|
5201
|
-
/* @__PURE__ */ (0,
|
5222
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
5202
5223
|
"div",
|
5203
5224
|
{
|
5204
5225
|
"aria-hidden": !isDiscountSummaryExpanded,
|
5205
5226
|
className: CartSubtotal_default["rebuy-cart-subtotal__discount-summary-details"],
|
5206
5227
|
id: summaryId,
|
5207
5228
|
role: "region",
|
5208
|
-
children: groupedCartLevelDiscounts.map((discount, index) => /* @__PURE__ */ (0,
|
5209
|
-
/* @__PURE__ */ (0,
|
5210
|
-
/* @__PURE__ */ (0,
|
5229
|
+
children: groupedCartLevelDiscounts.map((discount, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: CartSubtotal_default["rebuy-cart-subtotal__discount-summary-item"], children: [
|
5230
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: discount.title }),
|
5231
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: discount.amount })
|
5211
5232
|
] }, index))
|
5212
5233
|
}
|
5213
5234
|
)
|
@@ -5230,7 +5251,7 @@ var result7 = { "rebuy-cart-title-bar": "CartTitleBar_rebuy-cart-title-bar" };
|
|
5230
5251
|
var CartTitleBar_default = result7;
|
5231
5252
|
|
5232
5253
|
// src/smart-cart/components/CartTitleBar/CartTitleBar.tsx
|
5233
|
-
var
|
5254
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
5234
5255
|
var CartTitleBar = import_react11.default.memo(() => {
|
5235
5256
|
const { getComponentConfigByType } = useSmartCart();
|
5236
5257
|
const componentConfig = getComponentConfigByType("title_bar");
|
@@ -5244,16 +5265,16 @@ var CartTitleBar = import_react11.default.memo(() => {
|
|
5244
5265
|
const DynamicHeadingTag = headingTag;
|
5245
5266
|
if (title === "" && !screenReaderOnly) return null;
|
5246
5267
|
if (screenReaderOnly) {
|
5247
|
-
return /* @__PURE__ */ (0,
|
5268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
5248
5269
|
DynamicHeadingTag,
|
5249
5270
|
{
|
5250
5271
|
"data-rebuy-component-id": componentConfig?.component_id ?? "title_bar",
|
5251
5272
|
id: "rebuy-cart-title",
|
5252
|
-
children: /* @__PURE__ */ (0,
|
5273
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ScreenReaderText, { children: sanitizedTitle })
|
5253
5274
|
}
|
5254
5275
|
);
|
5255
5276
|
}
|
5256
|
-
return /* @__PURE__ */ (0,
|
5277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
5257
5278
|
DynamicHeadingTag,
|
5258
5279
|
{
|
5259
5280
|
className: CartTitleBar_default["rebuy-cart-title-bar"],
|
@@ -5268,14 +5289,14 @@ CartTitleBar.displayName = "CartTitleBar";
|
|
5268
5289
|
|
5269
5290
|
// src/smart-cart/components/CheckoutArea/CheckoutArea.tsx
|
5270
5291
|
var import_react12 = __toESM(require("react"), 1);
|
5271
|
-
var
|
5292
|
+
var import_react_router6 = require("react-router");
|
5272
5293
|
|
5273
5294
|
// src/smart-cart/components/CheckoutArea/CheckoutArea.module.css
|
5274
5295
|
var result8 = { "rebuy-checkout-area": "CheckoutArea_rebuy-checkout-area", "rebuy-checkout-area__terms": "CheckoutArea_rebuy-checkout-area__terms", "rebuy-checkout-area__terms-checkbox": "CheckoutArea_rebuy-checkout-area__terms-checkbox", "rebuy-checkout-area__terms-label": "CheckoutArea_rebuy-checkout-area__terms-label", "rebuy-checkout-area__installments-message": "CheckoutArea_rebuy-checkout-area__installments-message", "rebuy-checkout-area__checkout-button": "CheckoutArea_rebuy-checkout-area__checkout-button", "rebuy-checkout-area__view-cart-button": "CheckoutArea_rebuy-checkout-area__view-cart-button", "rebuy-checkout-area__continue-shopping-button": "CheckoutArea_rebuy-checkout-area__continue-shopping-button", "rebuy-checkout-area__shop-pay-button": "CheckoutArea_rebuy-checkout-area__shop-pay-button" };
|
5275
5296
|
var CheckoutArea_default = result8;
|
5276
5297
|
|
5277
5298
|
// src/smart-cart/components/CheckoutArea/CheckoutArea.tsx
|
5278
|
-
var
|
5299
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
5279
5300
|
var CheckoutArea = import_react12.default.memo(({ componentConfig }) => {
|
5280
5301
|
const {
|
5281
5302
|
cartData,
|
@@ -5286,7 +5307,7 @@ var CheckoutArea = import_react12.default.memo(({ componentConfig }) => {
|
|
5286
5307
|
isLoading: isGlobalCartLoading,
|
5287
5308
|
updateCartAttributes: hrUpdateCartAttributes
|
5288
5309
|
} = useSmartCart();
|
5289
|
-
const termsFetcher = (0,
|
5310
|
+
const termsFetcher = (0, import_react_router6.useFetcher)();
|
5290
5311
|
const settings = componentConfig.settings;
|
5291
5312
|
const [termsAccepted, setTermsAccepted] = (0, import_react12.useState)(false);
|
5292
5313
|
const [processingSource, setProcessingSource] = (0, import_react12.useState)(null);
|
@@ -5483,15 +5504,15 @@ var CheckoutArea = import_react12.default.memo(({ componentConfig }) => {
|
|
5483
5504
|
[]
|
5484
5505
|
);
|
5485
5506
|
if (!settings) return null;
|
5486
|
-
return /* @__PURE__ */ (0,
|
5507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
5487
5508
|
"div",
|
5488
5509
|
{
|
5489
5510
|
className: CheckoutArea_default["rebuy-checkout-area"],
|
5490
5511
|
"data-rebuy-component": "checkout-area",
|
5491
5512
|
"data-rebuy-component-id": componentConfig.component_id,
|
5492
5513
|
children: [
|
5493
|
-
hasTermsEnabled && /* @__PURE__ */ (0,
|
5494
|
-
/* @__PURE__ */ (0,
|
5514
|
+
hasTermsEnabled && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: CheckoutArea_default["rebuy-checkout-area__terms"], children: [
|
5515
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
5495
5516
|
"input",
|
5496
5517
|
{
|
5497
5518
|
checked: termsAccepted,
|
@@ -5503,7 +5524,7 @@ var CheckoutArea = import_react12.default.memo(({ componentConfig }) => {
|
|
5503
5524
|
type: "checkbox"
|
5504
5525
|
}
|
5505
5526
|
),
|
5506
|
-
/* @__PURE__ */ (0,
|
5527
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
5507
5528
|
"label",
|
5508
5529
|
{
|
5509
5530
|
className: CheckoutArea_default["rebuy-checkout-area__terms-label"],
|
@@ -5512,34 +5533,34 @@ var CheckoutArea = import_react12.default.memo(({ componentConfig }) => {
|
|
5512
5533
|
}
|
5513
5534
|
)
|
5514
5535
|
] }),
|
5515
|
-
hasCheckoutButton && /* @__PURE__ */ (0,
|
5536
|
+
hasCheckoutButton && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
5516
5537
|
"button",
|
5517
5538
|
{
|
5518
5539
|
className: CheckoutArea_default["rebuy-checkout-area__checkout-button"],
|
5519
5540
|
disabled: isCheckoutDisabled,
|
5520
5541
|
onClick: handleCheckoutClick,
|
5521
5542
|
type: "button",
|
5522
|
-
children: /* @__PURE__ */ (0,
|
5543
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { dangerouslySetInnerHTML: { __html: checkoutLabel } })
|
5523
5544
|
}
|
5524
5545
|
),
|
5525
|
-
hasViewCartButton && /* @__PURE__ */ (0,
|
5546
|
+
hasViewCartButton && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
5526
5547
|
"button",
|
5527
5548
|
{
|
5528
5549
|
className: CheckoutArea_default["rebuy-checkout-area__view-cart-button"],
|
5529
5550
|
disabled: isAnyCriticalActionProcessing && processingSource !== "terms",
|
5530
5551
|
onClick: handleViewCartClick,
|
5531
5552
|
type: "button",
|
5532
|
-
children: /* @__PURE__ */ (0,
|
5553
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { dangerouslySetInnerHTML: { __html: viewCartLabel } })
|
5533
5554
|
}
|
5534
5555
|
),
|
5535
|
-
hasContinueShoppingButton && /* @__PURE__ */ (0,
|
5556
|
+
hasContinueShoppingButton && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
5536
5557
|
"button",
|
5537
5558
|
{
|
5538
5559
|
className: CheckoutArea_default["rebuy-checkout-area__continue-shopping-button"],
|
5539
5560
|
disabled: isAnyCriticalActionProcessing && processingSource !== "terms",
|
5540
5561
|
onClick: handleContinueShoppingClick,
|
5541
5562
|
type: "button",
|
5542
|
-
children: /* @__PURE__ */ (0,
|
5563
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
5543
5564
|
"span",
|
5544
5565
|
{
|
5545
5566
|
dangerouslySetInnerHTML: {
|
@@ -5549,7 +5570,7 @@ var CheckoutArea = import_react12.default.memo(({ componentConfig }) => {
|
|
5549
5570
|
)
|
5550
5571
|
}
|
5551
5572
|
),
|
5552
|
-
hasShopPayButton && /* @__PURE__ */ (0,
|
5573
|
+
hasShopPayButton && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
5553
5574
|
"button",
|
5554
5575
|
{
|
5555
5576
|
"aria-label": "Checkout with Shop Pay",
|
@@ -5559,7 +5580,7 @@ var CheckoutArea = import_react12.default.memo(({ componentConfig }) => {
|
|
5559
5580
|
onClick: handleShopPayClick
|
5560
5581
|
}
|
5561
5582
|
),
|
5562
|
-
hasInstallments && installmentsMessage && hasItems && /* @__PURE__ */ (0,
|
5583
|
+
hasInstallments && installmentsMessage && hasItems && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
5563
5584
|
"div",
|
5564
5585
|
{
|
5565
5586
|
className: CheckoutArea_default["rebuy-checkout-area__installments-message"],
|
@@ -5568,7 +5589,7 @@ var CheckoutArea = import_react12.default.memo(({ componentConfig }) => {
|
|
5568
5589
|
}
|
5569
5590
|
}
|
5570
5591
|
),
|
5571
|
-
hasPrePurchase && hasItems && /* @__PURE__ */ (0,
|
5592
|
+
hasPrePurchase && hasItems && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { "data-rebuy-id": settings.pre_purchase.widget_id })
|
5572
5593
|
]
|
5573
5594
|
}
|
5574
5595
|
);
|
@@ -5582,9 +5603,9 @@ var import_hydrogen6 = require("@shopify/hydrogen");
|
|
5582
5603
|
var import_react20 = require("react");
|
5583
5604
|
|
5584
5605
|
// src/assets/Close.tsx
|
5585
|
-
var
|
5606
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
5586
5607
|
var Close = () => {
|
5587
|
-
return /* @__PURE__ */ (0,
|
5608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { height: "1em", viewBox: "0 0 352 512", width: "1em", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.19 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.19 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z" }) });
|
5588
5609
|
};
|
5589
5610
|
|
5590
5611
|
// src/hooks/useBreakpoint.ts
|
@@ -6093,7 +6114,6 @@ var defaultProductCardSettings = {
|
|
6093
6114
|
// src/components/ProductCard/ProductCard.tsx
|
6094
6115
|
var import_hydrogen5 = require("@shopify/hydrogen");
|
6095
6116
|
var import_react17 = require("react");
|
6096
|
-
var import_react_router6 = require("react-router");
|
6097
6117
|
|
6098
6118
|
// src/components/AddToCartBtn/HydrogenAddToCartBtn.tsx
|
6099
6119
|
var import_hydrogen3 = require("@shopify/hydrogen");
|
@@ -6103,7 +6123,7 @@ var result9 = { "rebuy-cart-button": "AddToCartBtn_rebuy-cart-button", "rebuy-ca
|
|
6103
6123
|
var AddToCartBtn_default = result9;
|
6104
6124
|
|
6105
6125
|
// src/components/AddToCartBtn/HydrogenAddToCartBtn.tsx
|
6106
|
-
var
|
6126
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
6107
6127
|
var HydrogenAddToCartBtn = ({
|
6108
6128
|
addToCartBtnText,
|
6109
6129
|
addToCartCallback,
|
@@ -6125,7 +6145,7 @@ var HydrogenAddToCartBtn = ({
|
|
6125
6145
|
addToCartCallback();
|
6126
6146
|
}
|
6127
6147
|
};
|
6128
|
-
return /* @__PURE__ */ (0,
|
6148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: AddToCartBtn_default["rebuy-cart-button__container"], children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
6129
6149
|
import_hydrogen3.CartForm,
|
6130
6150
|
{
|
6131
6151
|
action: import_hydrogen3.CartForm.ACTIONS.LinesAdd,
|
@@ -6133,7 +6153,7 @@ var HydrogenAddToCartBtn = ({
|
|
6133
6153
|
lines: linesToAdd
|
6134
6154
|
},
|
6135
6155
|
route: "/cart",
|
6136
|
-
children: (fetcher) => /* @__PURE__ */ (0,
|
6156
|
+
children: (fetcher) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
6137
6157
|
"button",
|
6138
6158
|
{
|
6139
6159
|
className: AddToCartBtn_default["rebuy-cart-button"],
|
@@ -6142,9 +6162,9 @@ var HydrogenAddToCartBtn = ({
|
|
6142
6162
|
type: "submit",
|
6143
6163
|
children: [
|
6144
6164
|
addToCartBtnText,
|
6145
|
-
moneyData && /* @__PURE__ */ (0,
|
6146
|
-
/* @__PURE__ */ (0,
|
6147
|
-
/* @__PURE__ */ (0,
|
6165
|
+
moneyData && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
6166
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: " | " }),
|
6167
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_hydrogen3.Money, { data: moneyData, withoutTrailingZeros: true })
|
6148
6168
|
] })
|
6149
6169
|
]
|
6150
6170
|
}
|
@@ -6155,7 +6175,7 @@ var HydrogenAddToCartBtn = ({
|
|
6155
6175
|
|
6156
6176
|
// src/components/AddToCartBtn/HydrogenReactAddToCartBtn.tsx
|
6157
6177
|
var import_hydrogen_react2 = require("@shopify/hydrogen-react");
|
6158
|
-
var
|
6178
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
6159
6179
|
var HydrogenReactAddToCartBtn = ({
|
6160
6180
|
addToCartBtnText,
|
6161
6181
|
addToCartCallback,
|
@@ -6178,17 +6198,17 @@ var HydrogenReactAddToCartBtn = ({
|
|
6178
6198
|
addToCartCallback();
|
6179
6199
|
}
|
6180
6200
|
};
|
6181
|
-
return /* @__PURE__ */ (0,
|
6201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("button", { className: AddToCartBtn_default["rebuy-cart-button"], disabled, onClick: handleAddToCart, type: "button", children: [
|
6182
6202
|
addToCartBtnText,
|
6183
|
-
moneyData && /* @__PURE__ */ (0,
|
6184
|
-
/* @__PURE__ */ (0,
|
6185
|
-
/* @__PURE__ */ (0,
|
6203
|
+
moneyData && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
6204
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: " | " }),
|
6205
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_hydrogen_react2.Money, { data: moneyData, withoutTrailingZeros: true })
|
6186
6206
|
] })
|
6187
6207
|
] });
|
6188
6208
|
};
|
6189
6209
|
|
6190
6210
|
// src/components/AddToCartBtn/AddToCartBtn.tsx
|
6191
|
-
var
|
6211
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
6192
6212
|
var AddToCartBtn = ({
|
6193
6213
|
addToCartBtnText,
|
6194
6214
|
addToCartCallback,
|
@@ -6210,7 +6230,7 @@ var AddToCartBtn = ({
|
|
6210
6230
|
selectedVariant: variant
|
6211
6231
|
}));
|
6212
6232
|
if (isHydrogenReact) {
|
6213
|
-
return /* @__PURE__ */ (0,
|
6233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
6214
6234
|
HydrogenReactAddToCartBtn,
|
6215
6235
|
{
|
6216
6236
|
addToCartBtnText,
|
@@ -6223,7 +6243,7 @@ var AddToCartBtn = ({
|
|
6223
6243
|
}
|
6224
6244
|
);
|
6225
6245
|
}
|
6226
|
-
return /* @__PURE__ */ (0,
|
6246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
6227
6247
|
HydrogenAddToCartBtn,
|
6228
6248
|
{
|
6229
6249
|
addToCartBtnText,
|
@@ -6246,14 +6266,14 @@ var result10 = { "rebuy-product-price": "ProductPrice_rebuy-product-price", "reb
|
|
6246
6266
|
var ProductPrice_default = result10;
|
6247
6267
|
|
6248
6268
|
// src/components/ProductPrice/ProductPrice.tsx
|
6249
|
-
var
|
6269
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
6250
6270
|
var RebuyProductPrice = ({ selectedVariant, settingsDiscount }) => {
|
6251
6271
|
if (!selectedVariant) return null;
|
6252
6272
|
const { compareAtPriceV2: compareAtPrice, priceV2: price } = selectedVariant;
|
6253
6273
|
const isDiscounted = (price2, compareAtPrice2) => Number(compareAtPrice2?.amount) > Number(price2?.amount);
|
6254
6274
|
const currentPriceIsOnSale = compareAtPrice && isDiscounted(price, compareAtPrice);
|
6255
6275
|
const CompareAtPrice = ({ data: compareAtPriceData }) => {
|
6256
|
-
return compareAtPriceData && /* @__PURE__ */ (0,
|
6276
|
+
return compareAtPriceData && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
6257
6277
|
import_hydrogen4.Money,
|
6258
6278
|
{
|
6259
6279
|
as: "span",
|
@@ -6263,8 +6283,8 @@ var RebuyProductPrice = ({ selectedVariant, settingsDiscount }) => {
|
|
6263
6283
|
}
|
6264
6284
|
);
|
6265
6285
|
};
|
6266
|
-
return price && /* @__PURE__ */ (0,
|
6267
|
-
/* @__PURE__ */ (0,
|
6286
|
+
return price && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: ProductPrice_default["rebuy-product-price"], children: [
|
6287
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
6268
6288
|
import_hydrogen4.Money,
|
6269
6289
|
{
|
6270
6290
|
as: "span",
|
@@ -6276,7 +6296,7 @@ var RebuyProductPrice = ({ selectedVariant, settingsDiscount }) => {
|
|
6276
6296
|
withoutTrailingZeros: true
|
6277
6297
|
}
|
6278
6298
|
),
|
6279
|
-
currentPriceIsOnSale && /* @__PURE__ */ (0,
|
6299
|
+
currentPriceIsOnSale && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CompareAtPrice, { data: compareAtPrice })
|
6280
6300
|
] });
|
6281
6301
|
};
|
6282
6302
|
|
@@ -6288,7 +6308,7 @@ var result11 = { "rebuy-quantity__container": "QuantityInput_rebuy-quantity__con
|
|
6288
6308
|
var QuantityInput_default = result11;
|
6289
6309
|
|
6290
6310
|
// src/components/QuantityInput/QuantityInput.tsx
|
6291
|
-
var
|
6311
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
6292
6312
|
var QuantityInput = ({
|
6293
6313
|
defaultQuantity = 1,
|
6294
6314
|
handleSelectedQuantity,
|
@@ -6304,7 +6324,7 @@ var QuantityInput = ({
|
|
6304
6324
|
}
|
6305
6325
|
};
|
6306
6326
|
const quantityOptions = Array.from({ length: maxValue - minValue + 1 }, (_, i) => minValue + i);
|
6307
|
-
return /* @__PURE__ */ (0,
|
6327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: QuantityInput_default["rebuy-quantity__container"], children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
6308
6328
|
"select",
|
6309
6329
|
{
|
6310
6330
|
"aria-label": "Product quantity",
|
@@ -6312,46 +6332,18 @@ var QuantityInput = ({
|
|
6312
6332
|
name: "quantity",
|
6313
6333
|
onChange: handleChange,
|
6314
6334
|
value: quantity,
|
6315
|
-
children: quantityOptions.map((value) => /* @__PURE__ */ (0,
|
6335
|
+
children: quantityOptions.map((value) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value, children: value }, `quantity-${value}`))
|
6316
6336
|
}
|
6317
6337
|
) });
|
6318
6338
|
};
|
6319
6339
|
|
6320
|
-
// src/components/Title/Title.tsx
|
6321
|
-
var import_clsx5 = __toESM(require("clsx"), 1);
|
6322
|
-
|
6323
|
-
// src/components/Title/Title.module.css
|
6324
|
-
var result12 = { "rebuy-title": "Title_rebuy-title" };
|
6325
|
-
var Title_default = result12;
|
6326
|
-
|
6327
|
-
// src/components/Title/Title.tsx
|
6328
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
6329
|
-
var Title = ({ className, level, style, text }) => {
|
6330
|
-
const combinedClassName = (0, import_clsx5.default)(Title_default["rebuy-title"], className);
|
6331
|
-
switch (level) {
|
6332
|
-
case "h1":
|
6333
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h1", { className: combinedClassName, style, children: text });
|
6334
|
-
default:
|
6335
|
-
case "h2":
|
6336
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { className: combinedClassName, style, children: text });
|
6337
|
-
case "h3":
|
6338
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h3", { className: combinedClassName, style, children: text });
|
6339
|
-
case "h4":
|
6340
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h4", { className: combinedClassName, style, children: text });
|
6341
|
-
case "h5":
|
6342
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h5", { className: combinedClassName, style, children: text });
|
6343
|
-
case "h6":
|
6344
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h6", { className: combinedClassName, style, children: text });
|
6345
|
-
}
|
6346
|
-
};
|
6347
|
-
|
6348
6340
|
// src/components/VariantSelect/VariantSelect.tsx
|
6349
|
-
var
|
6341
|
+
var import_clsx5 = __toESM(require("clsx"), 1);
|
6350
6342
|
var import_react16 = require("react");
|
6351
6343
|
|
6352
6344
|
// src/components/VariantSelect/VariantSelect.module.css
|
6353
|
-
var
|
6354
|
-
var VariantSelect_default =
|
6345
|
+
var result12 = { "rebuy-variant__container": "VariantSelect_rebuy-variant__container", "rebuy-variant__select": "VariantSelect_rebuy-variant__select", "rebuy-variant__select-option": "VariantSelect_rebuy-variant__select-option", "rebuy-variant__buttons": "VariantSelect_rebuy-variant__buttons", "rebuy-variant__button": "VariantSelect_rebuy-variant__button", "rebuy-variant__button--selected": "VariantSelect_rebuy-variant__button--selected" };
|
6346
|
+
var VariantSelect_default = result12;
|
6355
6347
|
|
6356
6348
|
// src/components/VariantSelect/VariantSelect.tsx
|
6357
6349
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
@@ -6390,7 +6382,7 @@ var VariantSelect = ({ handleSelectedVariant, product, selectedId, style = "sele
|
|
6390
6382
|
"button",
|
6391
6383
|
{
|
6392
6384
|
"aria-pressed": id === selectedVariantId,
|
6393
|
-
className: (0,
|
6385
|
+
className: (0, import_clsx5.default)(
|
6394
6386
|
VariantSelect_default["rebuy-variant__button"],
|
6395
6387
|
id === selectedVariantId && VariantSelect_default["rebuy-variant__button--selected"]
|
6396
6388
|
),
|
@@ -6402,15 +6394,44 @@ var VariantSelect = ({ handleSelectedVariant, product, selectedId, style = "sele
|
|
6402
6394
|
)) }) });
|
6403
6395
|
};
|
6404
6396
|
|
6397
|
+
// src/components/Title/Title.tsx
|
6398
|
+
var import_clsx6 = __toESM(require("clsx"), 1);
|
6399
|
+
|
6400
|
+
// src/components/Title/Title.module.css
|
6401
|
+
var result13 = { "rebuy-title": "Title_rebuy-title" };
|
6402
|
+
var Title_default = result13;
|
6403
|
+
|
6404
|
+
// src/components/Title/Title.tsx
|
6405
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
6406
|
+
var Title = ({ className, level, style, text }) => {
|
6407
|
+
const combinedClassName = (0, import_clsx6.default)(Title_default["rebuy-title"], className);
|
6408
|
+
switch (level) {
|
6409
|
+
case "h1":
|
6410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h1", { className: combinedClassName, style, children: text });
|
6411
|
+
default:
|
6412
|
+
case "h2":
|
6413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: combinedClassName, style, children: text });
|
6414
|
+
case "h3":
|
6415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { className: combinedClassName, style, children: text });
|
6416
|
+
case "h4":
|
6417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h4", { className: combinedClassName, style, children: text });
|
6418
|
+
case "h5":
|
6419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h5", { className: combinedClassName, style, children: text });
|
6420
|
+
case "h6":
|
6421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h6", { className: combinedClassName, style, children: text });
|
6422
|
+
}
|
6423
|
+
};
|
6424
|
+
|
6405
6425
|
// src/components/ProductCard/ProductCard.module.css
|
6406
6426
|
var result14 = { "rebuy-product-card__container": "ProductCard_rebuy-product-card__container", "rebuy-product-card": "ProductCard_rebuy-product-card", "rebuy-product-card__content": "ProductCard_rebuy-product-card__content", "rebuy-product-card__header": "ProductCard_rebuy-product-card__header", "rebuy-product-card__info": "ProductCard_rebuy-product-card__info", "rebuy-product-card__actions": "ProductCard_rebuy-product-card__actions", "rebuy-product-card__media-link": "ProductCard_rebuy-product-card__media-link", "rebuy-product-card__image": "ProductCard_rebuy-product-card__image", "rebuy-product-card__title": "ProductCard_rebuy-product-card__title", "rebuy-product-card__title-link": "ProductCard_rebuy-product-card__title-link", "rebuy-product-card__actions-variant-select": "ProductCard_rebuy-product-card__actions-variant-select", "rebuy-product-card__variant-select": "ProductCard_rebuy-product-card__variant-select", "rebuy-product-card__actions-quantity": "ProductCard_rebuy-product-card__actions-quantity", "rebuy-product-card__actions-button": "ProductCard_rebuy-product-card__actions-button", "rebuy-product-card__vendor": "ProductCard_rebuy-product-card__vendor", "rebuy-product-card__variant-title": "ProductCard_rebuy-product-card__variant-title", "rebuy-product-card__review": "ProductCard_rebuy-product-card__review", "rebuy-product-card__star-rating": "ProductCard_rebuy-product-card__star-rating", "rebuy-product-card__star-rating-value": "ProductCard_rebuy-product-card__star-rating-value", "rebuy-product-card__star-rating-background": "ProductCard_rebuy-product-card__star-rating-background", "rebuy-product-card__star-rating-foreground": "ProductCard_rebuy-product-card__star-rating-foreground", "rebuy-product-card__review-count": "ProductCard_rebuy-product-card__review-count", "rebuy-product-card__review-count-parenthesis": "ProductCard_rebuy-product-card__review-count-parenthesis", "rebuy-product-card__review-count-number": "ProductCard_rebuy-product-card__review-count-number", "rebuy-product-card__review-count-label": "ProductCard_rebuy-product-card__review-count-label", "rebuy-product-card__description": "ProductCard_rebuy-product-card__description" };
|
6407
6427
|
var ProductCard_default = result14;
|
6408
6428
|
|
6409
6429
|
// src/components/ProductCard/ProductCard.tsx
|
6410
|
-
var
|
6430
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
6411
6431
|
var ProductCard = ({
|
6412
6432
|
addToCartBtnText,
|
6413
6433
|
addToCartCallback,
|
6434
|
+
isCrossSell,
|
6414
6435
|
isHydrogenReact,
|
6415
6436
|
isInPopup,
|
6416
6437
|
onPopupDismiss,
|
@@ -6422,6 +6443,7 @@ var ProductCard = ({
|
|
6422
6443
|
const [selectedVariant, setSelectedVariant] = (0, import_react17.useState)(product.variants.nodes[0]);
|
6423
6444
|
const [selectedQuantity, setSelectedQuantity] = (0, import_react17.useState)(settings?.quantityInput?.default_quantity || 1);
|
6424
6445
|
const [interactionStatus, setInteractionStatus] = (0, import_react17.useState)("ready");
|
6446
|
+
const { toggleCart } = useSmartCart();
|
6425
6447
|
const displayImage = selectedVariant.image || product.featuredImage;
|
6426
6448
|
const handleSelectedVariant = (0, import_react17.useCallback)((product2, variant_id) => {
|
6427
6449
|
const updatedVariant = product2.variants.nodes.find((variant) => variant.id === variant_id);
|
@@ -6433,6 +6455,9 @@ var ProductCard = ({
|
|
6433
6455
|
setSelectedQuantity(quantity);
|
6434
6456
|
}, []);
|
6435
6457
|
const handleLinkClick = (0, import_react17.useCallback)(() => {
|
6458
|
+
if (isCrossSell) {
|
6459
|
+
toggleCart();
|
6460
|
+
}
|
6436
6461
|
if (isInPopup && onPopupDismiss) {
|
6437
6462
|
onPopupDismiss();
|
6438
6463
|
}
|
@@ -6489,40 +6514,92 @@ var ProductCard = ({
|
|
6489
6514
|
const productReviewsRating = product.reviews?.star_rating;
|
6490
6515
|
const showProductDescription = settings?.productOptions?.show_product_description === "show" && product.description !== "" && product.description !== null;
|
6491
6516
|
const showQuantityInput = settings?.quantityInput?.enabled && settings?.quantityInput?.max_value !== null && settings?.quantityInput?.min_value !== null;
|
6492
|
-
return /* @__PURE__ */ (0,
|
6493
|
-
/* @__PURE__ */ (0,
|
6494
|
-
/* @__PURE__ */ (0,
|
6495
|
-
|
6496
|
-
|
6497
|
-
|
6498
|
-
|
6499
|
-
|
6500
|
-
|
6501
|
-
|
6502
|
-
|
6503
|
-
|
6517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: ProductCard_default["rebuy-product-card__container"], children: [
|
6518
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: ProductCard_default["rebuy-product-card"], "data-layout": cardLayout, children: [
|
6519
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
|
6520
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6521
|
+
RebuyLink,
|
6522
|
+
{
|
6523
|
+
ariaLabel: `View ${product.title}`,
|
6524
|
+
className: ProductCard_default["rebuy-product-card__media-link"],
|
6525
|
+
handle: `/products/${product.handle}`,
|
6526
|
+
onClick: handleLinkClick,
|
6527
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6528
|
+
import_hydrogen5.Image,
|
6529
|
+
{
|
6530
|
+
alt: displayImage?.altText ?? `Picture of ${product.title}`,
|
6531
|
+
className: ProductCard_default["rebuy-product-card__image"],
|
6532
|
+
data: displayImage,
|
6533
|
+
sizes: "(max-width: 320px) 280px, (max-width: 768px) 720px, 1440px"
|
6534
|
+
}
|
6535
|
+
)
|
6536
|
+
}
|
6537
|
+
),
|
6538
|
+
settings?.layoutStyle === "grid" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: ProductCard_default["rebuy-product-card__content"], children: [
|
6539
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: ProductCard_default["rebuy-product-card__header"], children: [
|
6540
|
+
product.vendor && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: ProductCard_default["rebuy-product-card__vendor"], children: product.vendor }),
|
6541
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6542
|
+
RebuyLink,
|
6543
|
+
{
|
6544
|
+
ariaLabel: `View ${product.title}`,
|
6545
|
+
className: ProductCard_default["rebuy-product-card__title-link"],
|
6546
|
+
handle: `/products/${product.handle}`,
|
6547
|
+
onClick: handleLinkClick,
|
6548
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6549
|
+
Title,
|
6550
|
+
{
|
6551
|
+
className: ProductCard_default["rebuy-product-card__title"],
|
6552
|
+
level: productCardTitleLevel,
|
6553
|
+
text: product.title
|
6554
|
+
}
|
6555
|
+
)
|
6556
|
+
}
|
6557
|
+
),
|
6558
|
+
showVariantTitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: ProductCard_default["rebuy-product-card__variant-title"], children: selectedVariant.title })
|
6559
|
+
] }),
|
6560
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6561
|
+
RebuyProductPrice,
|
6504
6562
|
{
|
6505
|
-
|
6506
|
-
|
6507
|
-
data: displayImage,
|
6508
|
-
sizes: "(max-width: 320px) 280px, (max-width: 768px) 720px, 1440px"
|
6563
|
+
selectedVariant,
|
6564
|
+
settingsDiscount: settings?.settingsDiscount
|
6509
6565
|
}
|
6510
|
-
)
|
6511
|
-
|
6512
|
-
|
6513
|
-
|
6514
|
-
|
6515
|
-
|
6516
|
-
|
6517
|
-
|
6518
|
-
|
6566
|
+
),
|
6567
|
+
showReviews && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "aria-label": "product star rating", className: ProductCard_default["rebuy-product-card__review"], children: [
|
6568
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: ProductCard_default["rebuy-product-card__star-rating"], children: [
|
6569
|
+
productReviewsRating && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: ProductCard_default["rebuy-product-card__star-rating-value"], children: [
|
6570
|
+
productReviewsRating,
|
6571
|
+
" stars out of 5 stars"
|
6572
|
+
] }),
|
6573
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: ProductCard_default["rebuy-product-card__star-rating-background"] }),
|
6574
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6575
|
+
"span",
|
6576
|
+
{
|
6577
|
+
className: ProductCard_default["rebuy-product-card__star-rating-foreground"],
|
6578
|
+
style: productReviewsRating ? { width: productReviewsRating / 5 * 100 + "%" } : {}
|
6579
|
+
}
|
6580
|
+
)
|
6581
|
+
] }),
|
6582
|
+
product.reviews?.review_count && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: ProductCard_default["rebuy-product-card__review-count"], children: [
|
6583
|
+
"(",
|
6584
|
+
product.reviews.review_count,
|
6585
|
+
")"
|
6586
|
+
] })
|
6587
|
+
] }),
|
6588
|
+
showProductDescription && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: ProductCard_default["rebuy-product-card__description"], children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: product.description }) })
|
6589
|
+
] })
|
6590
|
+
] }),
|
6591
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: ProductCard_default["rebuy-product-card__info"], children: [
|
6592
|
+
settings?.layoutStyle !== "grid" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: ProductCard_default["rebuy-product-card__content"], children: [
|
6593
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: ProductCard_default["rebuy-product-card__header"], children: [
|
6594
|
+
product.vendor && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: ProductCard_default["rebuy-product-card__vendor"], children: product.vendor }),
|
6595
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6596
|
+
RebuyLink,
|
6519
6597
|
{
|
6520
|
-
|
6598
|
+
ariaLabel: `View ${product.title}`,
|
6521
6599
|
className: ProductCard_default["rebuy-product-card__title-link"],
|
6600
|
+
handle: `/products/${product.handle}`,
|
6522
6601
|
onClick: handleLinkClick,
|
6523
|
-
|
6524
|
-
to: `/products/${product.handle}`,
|
6525
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
6602
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6526
6603
|
Title,
|
6527
6604
|
{
|
6528
6605
|
className: ProductCard_default["rebuy-product-card__title"],
|
@@ -6532,23 +6609,23 @@ var ProductCard = ({
|
|
6532
6609
|
)
|
6533
6610
|
}
|
6534
6611
|
),
|
6535
|
-
showVariantTitle && /* @__PURE__ */ (0,
|
6612
|
+
showVariantTitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: ProductCard_default["rebuy-product-card__variant-title"], children: selectedVariant.title })
|
6536
6613
|
] }),
|
6537
|
-
/* @__PURE__ */ (0,
|
6614
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6538
6615
|
RebuyProductPrice,
|
6539
6616
|
{
|
6540
6617
|
selectedVariant,
|
6541
6618
|
settingsDiscount: settings?.settingsDiscount
|
6542
6619
|
}
|
6543
6620
|
),
|
6544
|
-
showReviews && /* @__PURE__ */ (0,
|
6545
|
-
/* @__PURE__ */ (0,
|
6546
|
-
productReviewsRating && /* @__PURE__ */ (0,
|
6621
|
+
showReviews && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "aria-label": "product star rating", className: ProductCard_default["rebuy-product-card__review"], children: [
|
6622
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: ProductCard_default["rebuy-product-card__star-rating"], children: [
|
6623
|
+
productReviewsRating && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: ProductCard_default["rebuy-product-card__star-rating-value"], children: [
|
6547
6624
|
productReviewsRating,
|
6548
6625
|
" stars out of 5 stars"
|
6549
6626
|
] }),
|
6550
|
-
/* @__PURE__ */ (0,
|
6551
|
-
/* @__PURE__ */ (0,
|
6627
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: ProductCard_default["rebuy-product-card__star-rating-background"] }),
|
6628
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6552
6629
|
"span",
|
6553
6630
|
{
|
6554
6631
|
className: ProductCard_default["rebuy-product-card__star-rating-foreground"],
|
@@ -6556,21 +6633,21 @@ var ProductCard = ({
|
|
6556
6633
|
}
|
6557
6634
|
)
|
6558
6635
|
] }),
|
6559
|
-
product.reviews?.review_count && /* @__PURE__ */ (0,
|
6636
|
+
product.reviews?.review_count && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: ProductCard_default["rebuy-product-card__review-count"], children: [
|
6560
6637
|
"(",
|
6561
6638
|
product.reviews.review_count,
|
6562
6639
|
")"
|
6563
6640
|
] })
|
6564
6641
|
] }),
|
6565
|
-
showProductDescription && /* @__PURE__ */ (0,
|
6642
|
+
showProductDescription && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: ProductCard_default["rebuy-product-card__description"], children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: product.description }) })
|
6566
6643
|
] }),
|
6567
|
-
/* @__PURE__ */ (0,
|
6568
|
-
showVariantSelect && cardLayout !== "line" && /* @__PURE__ */ (0,
|
6644
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: ProductCard_default["rebuy-product-card__actions"], children: [
|
6645
|
+
showVariantSelect && cardLayout !== "line" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6569
6646
|
"div",
|
6570
6647
|
{
|
6571
6648
|
className: ProductCard_default["rebuy-product-card__actions-variant-select"],
|
6572
6649
|
"data-layout": cardLayout,
|
6573
|
-
children: /* @__PURE__ */ (0,
|
6650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6574
6651
|
VariantSelect,
|
6575
6652
|
{
|
6576
6653
|
handleSelectedVariant,
|
@@ -6581,7 +6658,7 @@ var ProductCard = ({
|
|
6581
6658
|
)
|
6582
6659
|
}
|
6583
6660
|
),
|
6584
|
-
showQuantityInput && /* @__PURE__ */ (0,
|
6661
|
+
showQuantityInput && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: ProductCard_default["rebuy-product-card__actions-quantity"], children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6585
6662
|
QuantityInput,
|
6586
6663
|
{
|
6587
6664
|
defaultQuantity: settings?.quantityInput?.default_quantity,
|
@@ -6590,7 +6667,7 @@ var ProductCard = ({
|
|
6590
6667
|
minValue: settings?.quantityInput?.min_value
|
6591
6668
|
}
|
6592
6669
|
) }),
|
6593
|
-
/* @__PURE__ */ (0,
|
6670
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: ProductCard_default["rebuy-product-card__actions-button"], children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6594
6671
|
AddToCartBtn,
|
6595
6672
|
{
|
6596
6673
|
addToCartBtnText: atcButtonLabel,
|
@@ -6605,7 +6682,7 @@ var ProductCard = ({
|
|
6605
6682
|
] })
|
6606
6683
|
] })
|
6607
6684
|
] }),
|
6608
|
-
showVariantSelect && cardLayout === "line" && /* @__PURE__ */ (0,
|
6685
|
+
showVariantSelect && cardLayout === "line" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: ProductCard_default["rebuy-product-card__variant-select"], "data-layout": cardLayout, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
6609
6686
|
VariantSelect,
|
6610
6687
|
{
|
6611
6688
|
handleSelectedVariant,
|
@@ -6625,12 +6702,15 @@ var result15 = { "rebuy-carousel": "ProductCarousel_rebuy-carousel", "rebuy-caro
|
|
6625
6702
|
var ProductCarousel_default = result15;
|
6626
6703
|
|
6627
6704
|
// src/components/ProductCarousel/ProductCarousel.tsx
|
6628
|
-
var
|
6705
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
6629
6706
|
var ProductCarousel = ({
|
6630
6707
|
addToCartBtnText,
|
6631
6708
|
addToCartCallback,
|
6632
6709
|
columns,
|
6710
|
+
isCrossSell,
|
6633
6711
|
isHydrogenReact,
|
6712
|
+
isInPopup,
|
6713
|
+
onPopupDismiss,
|
6634
6714
|
productCardTitleLevel,
|
6635
6715
|
products,
|
6636
6716
|
settings,
|
@@ -6671,18 +6751,21 @@ var ProductCarousel = ({
|
|
6671
6751
|
for (let i = 0; i < repeatedProducts.length; i += columns) {
|
6672
6752
|
slides.push(repeatedProducts.slice(i, i + columns));
|
6673
6753
|
}
|
6674
|
-
return /* @__PURE__ */ (0,
|
6675
|
-
/* @__PURE__ */ (0,
|
6754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: ProductCarousel_default["rebuy-carousel"], children: [
|
6755
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
6676
6756
|
"div",
|
6677
6757
|
{
|
6678
6758
|
className: ProductCarousel_default["rebuy-carousel__container"],
|
6679
6759
|
style: { transform: `translateX(-${currentSlide * 100}%)` },
|
6680
|
-
children: slides.map((slideProducts, index) => /* @__PURE__ */ (0,
|
6760
|
+
children: slides.map((slideProducts, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: ProductCarousel_default["rebuy-carousel__slide"], children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: ProductCarousel_default["rebuy-carousel__grid"], "data-columns": columns, children: slideProducts.map((product, productIndex) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
6681
6761
|
ProductCard,
|
6682
6762
|
{
|
6683
6763
|
addToCartBtnText,
|
6684
6764
|
addToCartCallback,
|
6765
|
+
isCrossSell,
|
6685
6766
|
isHydrogenReact,
|
6767
|
+
isInPopup,
|
6768
|
+
onPopupDismiss,
|
6686
6769
|
product,
|
6687
6770
|
productCardTitleLevel,
|
6688
6771
|
settings,
|
@@ -6692,11 +6775,11 @@ var ProductCarousel = ({
|
|
6692
6775
|
)) }) }, index))
|
6693
6776
|
}
|
6694
6777
|
),
|
6695
|
-
totalSlides > 1 && /* @__PURE__ */ (0,
|
6696
|
-
/* @__PURE__ */ (0,
|
6697
|
-
/* @__PURE__ */ (0,
|
6778
|
+
totalSlides > 1 && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: ProductCarousel_default["rebuy-carousel__controls"], children: [
|
6779
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { className: ProductCarousel_default["rebuy-carousel__prev"], onClick: prevSlide, type: "button", children: "\u2190" }),
|
6780
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { className: ProductCarousel_default["rebuy-carousel__next"], onClick: nextSlide, type: "button", children: "\u2192" })
|
6698
6781
|
] }),
|
6699
|
-
showPagination && totalSlides > 1 && /* @__PURE__ */ (0,
|
6782
|
+
showPagination && totalSlides > 1 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: ProductCarousel_default["rebuy-carousel__pagination"], children: Array.from({ length: totalSlides }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
6700
6783
|
"button",
|
6701
6784
|
{
|
6702
6785
|
className: ProductCarousel_default["rebuy-carousel__dot"],
|
@@ -6718,7 +6801,7 @@ var result16 = { "rebuy-timer__container": "Timer_rebuy-timer__container", "rebu
|
|
6718
6801
|
var Timer_default = result16;
|
6719
6802
|
|
6720
6803
|
// src/components/Timer/Timer.tsx
|
6721
|
-
var
|
6804
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
6722
6805
|
var Timer = ({ action, durationMinutes, durationSeconds, isPopup = false, onDismiss, title }) => {
|
6723
6806
|
const initialTotalSeconds = (durationMinutes || 0) * 60 + (durationSeconds || 0);
|
6724
6807
|
const [totalSeconds, setTotalSeconds] = (0, import_react19.useState)(initialTotalSeconds);
|
@@ -6761,16 +6844,16 @@ var Timer = ({ action, durationMinutes, durationSeconds, isPopup = false, onDism
|
|
6761
6844
|
return () => clearInterval(interval);
|
6762
6845
|
}, [timerActive, handleTimerEnd]);
|
6763
6846
|
const isUrgent = totalSeconds < 10;
|
6764
|
-
return /* @__PURE__ */ (0,
|
6765
|
-
/* @__PURE__ */ (0,
|
6766
|
-
/* @__PURE__ */ (0,
|
6847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: Timer_default["rebuy-timer__container"], children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("p", { className: Timer_default["rebuy-timer__text"], children: [
|
6848
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: Timer_default["rebuy-timer__title"], children: title }),
|
6849
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
6767
6850
|
"span",
|
6768
6851
|
{
|
6769
6852
|
className: (0, import_clsx7.default)(Timer_default["rebuy-timer__display"], isUrgent && Timer_default["rebuy-timer__display--urgent"]),
|
6770
6853
|
children: [
|
6771
|
-
/* @__PURE__ */ (0,
|
6772
|
-
/* @__PURE__ */ (0,
|
6773
|
-
/* @__PURE__ */ (0,
|
6854
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: Timer_default["rebuy-timer__minutes"], children: formattedMinutes }),
|
6855
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: Timer_default["rebuy-timer__separator"], children: ":" }),
|
6856
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: Timer_default["rebuy-timer__seconds"], children: formattedSeconds })
|
6774
6857
|
]
|
6775
6858
|
}
|
6776
6859
|
)
|
@@ -6820,12 +6903,13 @@ var result17 = { "rebuy-widget__container": "RebuyWidget_rebuy-widget__container
|
|
6820
6903
|
var RebuyWidget_default = result17;
|
6821
6904
|
|
6822
6905
|
// src/widgets/RebuyWidget/WidgetContent.tsx
|
6823
|
-
var
|
6906
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
6824
6907
|
var WidgetContent = ({
|
6825
6908
|
addToCartCallback,
|
6826
6909
|
customTitle,
|
6827
6910
|
customTitleLevel,
|
6828
6911
|
customTitleStyle,
|
6912
|
+
isCrossSell,
|
6829
6913
|
isHydrogenReact,
|
6830
6914
|
isInPopup,
|
6831
6915
|
onDismiss,
|
@@ -6876,13 +6960,16 @@ var WidgetContent = ({
|
|
6876
6960
|
return null;
|
6877
6961
|
}
|
6878
6962
|
if (isCarousel) {
|
6879
|
-
return /* @__PURE__ */ (0,
|
6963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
6880
6964
|
ProductCarousel,
|
6881
6965
|
{
|
6882
6966
|
addToCartBtnText: settings?.language.add_to_cart,
|
6883
6967
|
addToCartCallback,
|
6884
6968
|
columns,
|
6969
|
+
isCrossSell,
|
6885
6970
|
isHydrogenReact,
|
6971
|
+
isInPopup,
|
6972
|
+
onPopupDismiss: onDismiss,
|
6886
6973
|
productCardTitleLevel,
|
6887
6974
|
products,
|
6888
6975
|
settings: productCardSettings,
|
@@ -6891,11 +6978,12 @@ var WidgetContent = ({
|
|
6891
6978
|
}
|
6892
6979
|
);
|
6893
6980
|
}
|
6894
|
-
return /* @__PURE__ */ (0,
|
6981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: RebuyWidget_default["rebuy-widget__product-grid"], "data-columns": columns, role: "list", tabIndex: 0, children: products.map((product) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
6895
6982
|
ProductCard,
|
6896
6983
|
{
|
6897
6984
|
addToCartBtnText: settings?.language.add_to_cart,
|
6898
6985
|
addToCartCallback,
|
6986
|
+
isCrossSell,
|
6899
6987
|
isHydrogenReact,
|
6900
6988
|
isInPopup,
|
6901
6989
|
onPopupDismiss: onDismiss,
|
@@ -6906,8 +6994,8 @@ var WidgetContent = ({
|
|
6906
6994
|
}
|
6907
6995
|
) }, product.id)) });
|
6908
6996
|
};
|
6909
|
-
return /* @__PURE__ */ (0,
|
6910
|
-
hasTimer && /* @__PURE__ */ (0,
|
6997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: RebuyWidget_default["rebuy-widget__inner-content"], children: [
|
6998
|
+
hasTimer && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
6911
6999
|
Timer,
|
6912
7000
|
{
|
6913
7001
|
action: settings?.timer.action,
|
@@ -6918,7 +7006,7 @@ var WidgetContent = ({
|
|
6918
7006
|
title: settings?.language.timer_title
|
6919
7007
|
}
|
6920
7008
|
),
|
6921
|
-
hasSuperTitle && /* @__PURE__ */ (0,
|
7009
|
+
hasSuperTitle && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
6922
7010
|
Title,
|
6923
7011
|
{
|
6924
7012
|
level: getTitleLevel(customTitleLevel),
|
@@ -6926,7 +7014,7 @@ var WidgetContent = ({
|
|
6926
7014
|
text: settings.language.super_title
|
6927
7015
|
}
|
6928
7016
|
),
|
6929
|
-
hasPrimaryTitle && /* @__PURE__ */ (0,
|
7017
|
+
hasPrimaryTitle && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
6930
7018
|
Title,
|
6931
7019
|
{
|
6932
7020
|
level: getTitleLevel(customTitleLevel, hasSuperTitle ? true : false),
|
@@ -6934,19 +7022,20 @@ var WidgetContent = ({
|
|
6934
7022
|
text: primaryTitle
|
6935
7023
|
}
|
6936
7024
|
),
|
6937
|
-
hasDescription && /* @__PURE__ */ (0,
|
7025
|
+
hasDescription && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: RebuyWidget_default["rebuy-widget__description"], children: settings.language.description }),
|
6938
7026
|
renderProducts()
|
6939
7027
|
] });
|
6940
7028
|
};
|
6941
7029
|
|
6942
7030
|
// src/widgets/RebuyWidget/RebuyWidget.tsx
|
6943
|
-
var
|
7031
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
6944
7032
|
var RebuyWidget = (props) => {
|
6945
7033
|
const {
|
6946
7034
|
addToCartCallback,
|
6947
7035
|
customTitle,
|
6948
7036
|
customTitleLevel = "h2",
|
6949
7037
|
customTitleStyle,
|
7038
|
+
isCrossSell,
|
6950
7039
|
isHydrogenReact,
|
6951
7040
|
popupTriggerId,
|
6952
7041
|
product,
|
@@ -7169,17 +7258,17 @@ var RebuyWidget = (props) => {
|
|
7169
7258
|
if (settings && !loadingSettings && shouldHideWidget) {
|
7170
7259
|
return null;
|
7171
7260
|
}
|
7172
|
-
return /* @__PURE__ */ (0,
|
7173
|
-
/* @__PURE__ */ (0,
|
7261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: (settings || products?.length > 0) && !loadingSettings && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: RebuyWidget_default["rebuy-widget__container"], id: `rebuy-widget-${widgetId}`, children: settings?.display_type === "popup" && (settings.popup_trigger !== "add_to_cart" || settings.popup_trigger === "add_to_cart" && popupTriggerId) ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: showPopup && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: RebuyWidget_default["rebuy-widget__popup-overlay"], children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: RebuyWidget_default["rebuy-widget__popup-content"], ref: popupRef, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: RebuyWidget_default["rebuy-widget__content"], children: [
|
7262
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
7174
7263
|
"button",
|
7175
7264
|
{
|
7176
7265
|
"aria-label": "close modal",
|
7177
7266
|
className: RebuyWidget_default["rebuy-widget__modal-close"],
|
7178
7267
|
onClick: closePopup,
|
7179
|
-
children: /* @__PURE__ */ (0,
|
7268
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Close, {})
|
7180
7269
|
}
|
7181
7270
|
),
|
7182
|
-
/* @__PURE__ */ (0,
|
7271
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
7183
7272
|
WidgetContent,
|
7184
7273
|
{
|
7185
7274
|
addToCartCallback: () => {
|
@@ -7198,13 +7287,14 @@ var RebuyWidget = (props) => {
|
|
7198
7287
|
settings
|
7199
7288
|
}
|
7200
7289
|
)
|
7201
|
-
] }) }) }) }) : /* @__PURE__ */ (0,
|
7290
|
+
] }) }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: RebuyWidget_default["rebuy-widget__content"], children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
7202
7291
|
WidgetContent,
|
7203
7292
|
{
|
7204
7293
|
addToCartCallback,
|
7205
7294
|
customTitle,
|
7206
7295
|
customTitleLevel,
|
7207
7296
|
customTitleStyle,
|
7297
|
+
isCrossSell,
|
7208
7298
|
isHydrogenReact,
|
7209
7299
|
isInPopup: settings?.display_type === "popup",
|
7210
7300
|
products,
|
@@ -7214,14 +7304,14 @@ var RebuyWidget = (props) => {
|
|
7214
7304
|
};
|
7215
7305
|
|
7216
7306
|
// src/smart-cart/components/CrossSell/CrossSell.tsx
|
7217
|
-
var
|
7307
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
7218
7308
|
var CrossSell = ({ componentConfig }) => {
|
7219
7309
|
const widgetId = componentConfig.settings.widget_id;
|
7220
7310
|
if (!widgetId) {
|
7221
7311
|
console.warn("[CrossSell] Widget ID is missing from component configuration");
|
7222
7312
|
return null;
|
7223
7313
|
}
|
7224
|
-
return /* @__PURE__ */ (0,
|
7314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { "data-rebuy-component": "cross-sell-widget", "data-rebuy-component-id": widgetId, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RebuyWidget, { isCrossSell: true, widgetId }) });
|
7225
7315
|
};
|
7226
7316
|
|
7227
7317
|
// src/smart-cart/components/CustomCode/CustomCodeBlock.tsx
|
@@ -7298,7 +7388,7 @@ var executeScriptsInContainer = (container, debugKey, debugContext) => {
|
|
7298
7388
|
};
|
7299
7389
|
|
7300
7390
|
// src/smart-cart/components/CustomCode/CustomCodeBlock.tsx
|
7301
|
-
var
|
7391
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
7302
7392
|
var CustomCodeBlock = import_react21.default.memo(({ componentConfig }) => {
|
7303
7393
|
const containerRef = (0, import_react21.useRef)(null);
|
7304
7394
|
const executedCodeRef = (0, import_react21.useRef)(null);
|
@@ -7325,7 +7415,7 @@ var CustomCodeBlock = import_react21.default.memo(({ componentConfig }) => {
|
|
7325
7415
|
if (!htmlCode) {
|
7326
7416
|
return null;
|
7327
7417
|
}
|
7328
|
-
return /* @__PURE__ */ (0,
|
7418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
7329
7419
|
"div",
|
7330
7420
|
{
|
7331
7421
|
dangerouslySetInnerHTML: { __html: htmlCode },
|
@@ -7427,7 +7517,7 @@ var result18 = { "rebuy-discount-code-input": "DiscountCodeInput_rebuy-discount-
|
|
7427
7517
|
var DiscountCodeInput_default = result18;
|
7428
7518
|
|
7429
7519
|
// src/smart-cart/components/DiscountCodeInput/DiscountCodeInput.tsx
|
7430
|
-
var
|
7520
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
7431
7521
|
var DiscountCodeInputComponent = ({ componentConfig }) => {
|
7432
7522
|
const {
|
7433
7523
|
applyDiscountCodes: hrApplyDiscountCodes,
|
@@ -7596,22 +7686,22 @@ var DiscountCodeInputComponent = ({ componentConfig }) => {
|
|
7596
7686
|
cartData
|
7597
7687
|
]);
|
7598
7688
|
if (!hasItems) return null;
|
7599
|
-
return /* @__PURE__ */ (0,
|
7689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
7600
7690
|
"div",
|
7601
7691
|
{
|
7602
7692
|
className: DiscountCodeInput_default["rebuy-discount-code-input"],
|
7603
7693
|
"data-rebuy-component": "discount-input",
|
7604
7694
|
"data-rebuy-component-id": componentConfig.component_id,
|
7605
7695
|
children: [
|
7606
|
-
/* @__PURE__ */ (0,
|
7607
|
-
/* @__PURE__ */ (0,
|
7696
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("form", { className: DiscountCodeInput_default["rebuy-discount-code-input__form"], onSubmit: handleApply, children: [
|
7697
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
7608
7698
|
"div",
|
7609
7699
|
{
|
7610
7700
|
className: (0, import_clsx8.default)(DiscountCodeInput_default["rebuy-discount-code-input__input-wrapper"], {
|
7611
7701
|
[DiscountCodeInput_default["rebuy-discount-code-input__input-wrapper--show-label"]]: !!inputValue || isInputFocused
|
7612
7702
|
}),
|
7613
7703
|
children: [
|
7614
|
-
/* @__PURE__ */ (0,
|
7704
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
7615
7705
|
"input",
|
7616
7706
|
{
|
7617
7707
|
"aria-label": lang.inputLabel,
|
@@ -7632,7 +7722,7 @@ var DiscountCodeInputComponent = ({ componentConfig }) => {
|
|
7632
7722
|
value: inputValue
|
7633
7723
|
}
|
7634
7724
|
),
|
7635
|
-
/* @__PURE__ */ (0,
|
7725
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
7636
7726
|
"label",
|
7637
7727
|
{
|
7638
7728
|
className: DiscountCodeInput_default["rebuy-discount-code-input__input-label"],
|
@@ -7643,7 +7733,7 @@ var DiscountCodeInputComponent = ({ componentConfig }) => {
|
|
7643
7733
|
]
|
7644
7734
|
}
|
7645
7735
|
),
|
7646
|
-
/* @__PURE__ */ (0,
|
7736
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
7647
7737
|
"button",
|
7648
7738
|
{
|
7649
7739
|
className: DiscountCodeInput_default["rebuy-discount-code-input__apply-button"],
|
@@ -7653,11 +7743,11 @@ var DiscountCodeInputComponent = ({ componentConfig }) => {
|
|
7653
7743
|
}
|
7654
7744
|
)
|
7655
7745
|
] }),
|
7656
|
-
discountManagerError && /* @__PURE__ */ (0,
|
7657
|
-
shouldShowTags && /* @__PURE__ */ (0,
|
7658
|
-
/* @__PURE__ */ (0,
|
7659
|
-
/* @__PURE__ */ (0,
|
7660
|
-
/* @__PURE__ */ (0,
|
7746
|
+
discountManagerError && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: DiscountCodeInput_default["rebuy-discount-code-input__error-message"], children: discountManagerError }),
|
7747
|
+
shouldShowTags && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: DiscountCodeInput_default["rebuy-discount-code-input__tags-list"], children: appliedCodes.map((code) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: DiscountCodeInput_default["rebuy-discount-code-input__tag"], children: [
|
7748
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: DiscountCodeInput_default["rebuy-discount-code-input__tag-icon"], children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { fill: "currentColor", height: "14", viewBox: "0 0 24 24", width: "14", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: "M21.41 11.58l-9-9C12.05 2.22 11.55 2 11 2H4c-1.1 0-2 .9-2 2v7c0 .55.22 1.05.59 1.42l9 9c.36.36.86.58 1.41.58.55 0 1.05-.22 1.41-.59l7-7c.37-.36.59-.86.59-1.41 0-.55-.23-1.06-.59-1.42zM5.5 7C4.67 7 4 6.33 4 5.5S4.67 4 5.5 4 7 4.67 7 5.5 6.33 7 5.5 7z" }) }) }),
|
7749
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: DiscountCodeInput_default["rebuy-discount-code-input__tag-text"], children: code }),
|
7750
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
7661
7751
|
"button",
|
7662
7752
|
{
|
7663
7753
|
"aria-label": `Remove discount code ${code}`,
|
@@ -7684,7 +7774,7 @@ var result19 = { "rebuy-login-button": "LoginButton_rebuy-login-button" };
|
|
7684
7774
|
var LoginButton_default = result19;
|
7685
7775
|
|
7686
7776
|
// src/smart-cart/components/LoginButton/LoginButton.tsx
|
7687
|
-
var
|
7777
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
7688
7778
|
var LoginButton = import_react24.default.memo(() => {
|
7689
7779
|
const { cartData, getComponentConfigByType } = useSmartCart();
|
7690
7780
|
const componentConfig = getComponentConfigByType("login");
|
@@ -7698,13 +7788,14 @@ var LoginButton = import_react24.default.memo(() => {
|
|
7698
7788
|
}
|
7699
7789
|
const loginLabel = componentConfig?.settings?.language?.title ?? "Login";
|
7700
7790
|
const loginUrl = componentConfig?.settings?.url ?? "/account/login";
|
7701
|
-
return /* @__PURE__ */ (0,
|
7702
|
-
|
7791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
7792
|
+
RebuyLink,
|
7703
7793
|
{
|
7794
|
+
ariaLabel: loginLabel,
|
7704
7795
|
className: LoginButton_default["rebuy-login-button"],
|
7705
7796
|
"data-rebuy-component": "login",
|
7706
7797
|
"data-rebuy-component-id": componentConfig.component_id ?? "login",
|
7707
|
-
|
7798
|
+
handle: loginUrl,
|
7708
7799
|
children: loginLabel
|
7709
7800
|
}
|
7710
7801
|
);
|
@@ -7921,7 +8012,7 @@ var useSmartCartApps = () => {
|
|
7921
8012
|
};
|
7922
8013
|
|
7923
8014
|
// src/smart-cart/components/SmartCartApp/SmartCartApp.tsx
|
7924
|
-
var
|
8015
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
7925
8016
|
var SmartCartApp = import_react26.default.memo(({ componentConfig }) => {
|
7926
8017
|
const containerRef = (0, import_react26.useRef)(null);
|
7927
8018
|
const executedScriptRef = (0, import_react26.useRef)(null);
|
@@ -7953,7 +8044,7 @@ var SmartCartApp = import_react26.default.memo(({ componentConfig }) => {
|
|
7953
8044
|
}
|
7954
8045
|
}, [scriptContent, appId, componentId]);
|
7955
8046
|
if (appsLoading) {
|
7956
|
-
return /* @__PURE__ */ (0,
|
8047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { "data-rebuy-component-id": componentId, children: [
|
7957
8048
|
"Loading App (",
|
7958
8049
|
appId ?? "N/A",
|
7959
8050
|
")..."
|
@@ -7961,7 +8052,7 @@ var SmartCartApp = import_react26.default.memo(({ componentConfig }) => {
|
|
7961
8052
|
}
|
7962
8053
|
if (appsHookError) {
|
7963
8054
|
console.error(`[SmartCartApp - ${componentId}] Hook error prevented app rendering: ${appsHookError}`);
|
7964
|
-
return /* @__PURE__ */ (0,
|
8055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { "data-rebuy-component-id": componentId, children: "Error loading app data." });
|
7965
8056
|
}
|
7966
8057
|
if (appId === null) {
|
7967
8058
|
console.warn(`[SmartCartApp - ${componentId}] Missing App ID (settings.app_id) in configuration.`);
|
@@ -7974,7 +8065,7 @@ var SmartCartApp = import_react26.default.memo(({ componentConfig }) => {
|
|
7974
8065
|
);
|
7975
8066
|
return null;
|
7976
8067
|
}
|
7977
|
-
return /* @__PURE__ */ (0,
|
8068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
7978
8069
|
"div",
|
7979
8070
|
{
|
7980
8071
|
dangerouslySetInnerHTML: { __html: scriptContent },
|
@@ -8001,7 +8092,7 @@ var result20 = { "rebuy-tiered-progress-bar": "TieredProgressBar_rebuy-tiered-pr
|
|
8001
8092
|
var TieredProgressBar_default = result20;
|
8002
8093
|
|
8003
8094
|
// src/smart-cart/components/TieredProgressBar/TPBGiftItem.tsx
|
8004
|
-
var
|
8095
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
8005
8096
|
var TieredProgressBarGiftItem = ({
|
8006
8097
|
isGloballySyncing,
|
8007
8098
|
onAddOrReAdd,
|
@@ -8027,14 +8118,14 @@ var TieredProgressBarGiftItem = ({
|
|
8027
8118
|
const imageAlt = image?.altText ?? title;
|
8028
8119
|
const isDisabled = isGloballySyncing || !!error;
|
8029
8120
|
const itemLevelError = error;
|
8030
|
-
return /* @__PURE__ */ (0,
|
8121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
8031
8122
|
"div",
|
8032
8123
|
{
|
8033
8124
|
className: (0, import_clsx9.default)(TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item"], {
|
8034
8125
|
[TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item--syncing"]]: isGloballySyncing
|
8035
8126
|
}),
|
8036
8127
|
children: [
|
8037
|
-
/* @__PURE__ */ (0,
|
8128
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-image-wrapper"], children: imageSrc ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
8038
8129
|
"img",
|
8039
8130
|
{
|
8040
8131
|
alt: imageAlt,
|
@@ -8042,24 +8133,24 @@ var TieredProgressBarGiftItem = ({
|
|
8042
8133
|
loading: "lazy",
|
8043
8134
|
src: imageSrc
|
8044
8135
|
}
|
8045
|
-
) : /* @__PURE__ */ (0,
|
8136
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
8046
8137
|
"div",
|
8047
8138
|
{
|
8048
8139
|
"aria-label": "Gift product image placeholder",
|
8049
8140
|
className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-image"]
|
8050
8141
|
}
|
8051
8142
|
) }),
|
8052
|
-
/* @__PURE__ */ (0,
|
8053
|
-
/* @__PURE__ */ (0,
|
8054
|
-
displayStatus === "added" /* ADDED */ && displayVariantTitle && /* @__PURE__ */ (0,
|
8055
|
-
/* @__PURE__ */ (0,
|
8056
|
-
isGloballySyncing && /* @__PURE__ */ (0,
|
8057
|
-
itemLevelError && !isGloballySyncing && /* @__PURE__ */ (0,
|
8143
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-details"], children: [
|
8144
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h4", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-title"], id: `tpb-gift-${tierId}-title`, children: title }),
|
8145
|
+
displayStatus === "added" /* ADDED */ && displayVariantTitle && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-variant-title"], children: displayVariantTitle }),
|
8146
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-actions-wrapper"], children: [
|
8147
|
+
isGloballySyncing && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { className: (0, import_clsx9.default)(TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-button"]), disabled: true, children: "Updating..." }),
|
8148
|
+
itemLevelError && !isGloballySyncing && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__error-message"], children: [
|
8058
8149
|
"Error: ",
|
8059
8150
|
itemLevelError
|
8060
8151
|
] }),
|
8061
|
-
!isGloballySyncing && !itemLevelError && /* @__PURE__ */ (0,
|
8062
|
-
displayStatus === "added" /* ADDED */ && /* @__PURE__ */ (0,
|
8152
|
+
!isGloballySyncing && !itemLevelError && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
8153
|
+
displayStatus === "added" /* ADDED */ && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
8063
8154
|
"button",
|
8064
8155
|
{
|
8065
8156
|
"aria-label": `Remove ${title} gift`,
|
@@ -8072,7 +8163,7 @@ var TieredProgressBarGiftItem = ({
|
|
8072
8163
|
children: "Remove"
|
8073
8164
|
}
|
8074
8165
|
),
|
8075
|
-
displayStatus === "needs_selection" /* NEEDS_SELECTION */ && /* @__PURE__ */ (0,
|
8166
|
+
displayStatus === "needs_selection" /* NEEDS_SELECTION */ && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
8076
8167
|
"select",
|
8077
8168
|
{
|
8078
8169
|
"aria-label": `Select option for ${title}`,
|
@@ -8081,10 +8172,10 @@ var TieredProgressBarGiftItem = ({
|
|
8081
8172
|
onChange: handleVariantChange,
|
8082
8173
|
value: "",
|
8083
8174
|
children: [
|
8084
|
-
/* @__PURE__ */ (0,
|
8175
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { disabled: true, value: "", children: "Select Option" }),
|
8085
8176
|
availableChoices.map((variant) => {
|
8086
8177
|
const variantLabel = getFreeVariantTitle(variant) || variant.title;
|
8087
|
-
return /* @__PURE__ */ (0,
|
8178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("option", { value: variant.id, children: [
|
8088
8179
|
variantLabel,
|
8089
8180
|
" (",
|
8090
8181
|
formatMoney(variant.price.amount),
|
@@ -8094,7 +8185,7 @@ var TieredProgressBarGiftItem = ({
|
|
8094
8185
|
]
|
8095
8186
|
}
|
8096
8187
|
),
|
8097
|
-
canReAdd && displayStatus === "declined" /* DECLINED */ && /* @__PURE__ */ (0,
|
8188
|
+
canReAdd && displayStatus === "declined" /* DECLINED */ && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
8098
8189
|
"button",
|
8099
8190
|
{
|
8100
8191
|
"aria-label": `Re-add ${title} gift`,
|
@@ -8107,7 +8198,7 @@ var TieredProgressBarGiftItem = ({
|
|
8107
8198
|
children: "Re-Add Gift"
|
8108
8199
|
}
|
8109
8200
|
),
|
8110
|
-
displayStatus === "unavailable" /* UNAVAILABLE */ && !canReAdd && /* @__PURE__ */ (0,
|
8201
|
+
displayStatus === "unavailable" /* UNAVAILABLE */ && !canReAdd && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-status-text"], children: "Unavailable" })
|
8111
8202
|
] })
|
8112
8203
|
] })
|
8113
8204
|
] })
|
@@ -8193,7 +8284,7 @@ var codeBlock = {
|
|
8193
8284
|
};
|
8194
8285
|
|
8195
8286
|
// src/smart-cart/components/TieredProgressBar/TieredProgressBar.tsx
|
8196
|
-
var
|
8287
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
8197
8288
|
var TieredProgressBar = import_react27.default.memo(() => {
|
8198
8289
|
const { hydrogenReactCartActions, isCartBusy, isHydrogenReact } = useSmartCart();
|
8199
8290
|
const tpbUserActionFetcher = (0, import_react_router8.useFetcher)();
|
@@ -8372,9 +8463,9 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8372
8463
|
const progressBarId = `tpb-main-${activeBarConfig.id}`;
|
8373
8464
|
const feedbackId = `tpb-feedback-text-${activeBarConfig.id}`;
|
8374
8465
|
const giftAreaTitleId = `tpb-giftarea-title-${activeBarConfig.id}`;
|
8375
|
-
return /* @__PURE__ */ (0,
|
8376
|
-
/* @__PURE__ */ (0,
|
8377
|
-
/* @__PURE__ */ (0,
|
8466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar"], "data-rebuy-component": "tiered-progress-bar", children: [
|
8467
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__main-progress-area"], id: progressBarId, children: [
|
8468
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__tier-markers-list"], children: activeBarConfig.tiers.map((tier) => {
|
8378
8469
|
const isReached = checkTierReachedCallback(tier);
|
8379
8470
|
const tierLabel = getTierLabel(tier, fetchedProductMap);
|
8380
8471
|
const iconRenderData = getTierIconComponent(tier, isReached, fetchedProductMap);
|
@@ -8389,7 +8480,7 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8389
8480
|
if (import_react27.default.isValidElement(iconRenderData)) iconElement = iconRenderData;
|
8390
8481
|
else if (iconRenderData.type === "image") {
|
8391
8482
|
const imageObject = iconRenderData;
|
8392
|
-
iconElement = /* @__PURE__ */ (0,
|
8483
|
+
iconElement = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
8393
8484
|
"img",
|
8394
8485
|
{
|
8395
8486
|
alt: imageObject.alt,
|
@@ -8398,7 +8489,7 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8398
8489
|
}
|
8399
8490
|
);
|
8400
8491
|
} else iconElement = null;
|
8401
|
-
return /* @__PURE__ */ (0,
|
8492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
8402
8493
|
"div",
|
8403
8494
|
{
|
8404
8495
|
className: (0, import_clsx10.default)(TieredProgressBar_default["rebuy-tiered-progress-bar__tier-step"], {
|
@@ -8406,7 +8497,7 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8406
8497
|
}),
|
8407
8498
|
title: `${tierLabel} (${isReached ? "Reached" : "Pending"} at ${formatMoney(getTierMinimum(tier))})`,
|
8408
8499
|
children: [
|
8409
|
-
/* @__PURE__ */ (0,
|
8500
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
8410
8501
|
"div",
|
8411
8502
|
{
|
8412
8503
|
className: TieredProgressBar_default["rebuy-tiered-progress-bar__tier-icon-wrapper"],
|
@@ -8414,13 +8505,13 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8414
8505
|
children: iconElement
|
8415
8506
|
}
|
8416
8507
|
),
|
8417
|
-
/* @__PURE__ */ (0,
|
8508
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__tier-label"], children: tierLabel })
|
8418
8509
|
]
|
8419
8510
|
},
|
8420
8511
|
tier.id
|
8421
8512
|
);
|
8422
8513
|
}) }),
|
8423
|
-
/* @__PURE__ */ (0,
|
8514
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__track"], children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
8424
8515
|
"div",
|
8425
8516
|
{
|
8426
8517
|
"aria-label": "Reward progress",
|
@@ -8434,25 +8525,25 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8434
8525
|
}
|
8435
8526
|
) })
|
8436
8527
|
] }),
|
8437
|
-
/* @__PURE__ */ (0,
|
8528
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { "aria-live": "polite", className: TieredProgressBar_default["rebuy-tiered-progress-bar__feedback-message"], id: feedbackId, children: [
|
8438
8529
|
(isContextLoading || productFetchStatus === "loading") && !feedbackText ? "Loading rewards..." : feedbackText,
|
8439
|
-
productFetchError && /* @__PURE__ */ (0,
|
8530
|
+
productFetchError && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__error-message"], children: [
|
8440
8531
|
"Could not load reward info.",
|
8441
8532
|
rebuyDebugLog.isKeyActive("smart-cart-tpb" /* SC_TPB */) && ` Details: ${productFetchError}`
|
8442
8533
|
] }),
|
8443
|
-
cartSyncError && /* @__PURE__ */ (0,
|
8534
|
+
cartSyncError && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__error-message"], children: [
|
8444
8535
|
"Could not update rewards.",
|
8445
8536
|
rebuyDebugLog.isKeyActive("smart-cart-tpb" /* SC_TPB */) && ` Details: ${cartSyncError}`
|
8446
8537
|
] }),
|
8447
|
-
userActionError && /* @__PURE__ */ (0,
|
8538
|
+
userActionError && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__error-message"], children: [
|
8448
8539
|
"Error: ",
|
8449
8540
|
userActionError.message
|
8450
8541
|
] })
|
8451
8542
|
] }),
|
8452
|
-
renderGiftArea && /* @__PURE__ */ (0,
|
8453
|
-
renderGiftAreaTitle && /* @__PURE__ */ (0,
|
8543
|
+
renderGiftArea && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-area"], children: [
|
8544
|
+
renderGiftAreaTitle && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h3", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-area-title"], id: giftAreaTitleId, children: giftAreaTitle }),
|
8454
8545
|
shouldDisableGiftActions && // If actions are disabled (likely loading something)
|
8455
|
-
productsToRenderInGiftArea.length === 0 && !productFetchError && !cartSyncError && !userActionError && /* @__PURE__ */ (0,
|
8546
|
+
productsToRenderInGiftArea.length === 0 && !productFetchError && !cartSyncError && !userActionError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
8456
8547
|
"div",
|
8457
8548
|
{
|
8458
8549
|
style: {
|
@@ -8462,12 +8553,12 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8462
8553
|
children: "Loading gifts..."
|
8463
8554
|
}
|
8464
8555
|
),
|
8465
|
-
productsToRenderInGiftArea.length > 0 && /* @__PURE__ */ (0,
|
8556
|
+
productsToRenderInGiftArea.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
8466
8557
|
"div",
|
8467
8558
|
{
|
8468
8559
|
"aria-labelledby": renderGiftAreaTitle ? giftAreaTitleId : void 0,
|
8469
8560
|
className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-items-list"],
|
8470
|
-
children: productsToRenderInGiftArea.map((productState) => /* @__PURE__ */ (0,
|
8561
|
+
children: productsToRenderInGiftArea.map((productState) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
8471
8562
|
TieredProgressBarGiftItem,
|
8472
8563
|
{
|
8473
8564
|
isGloballySyncing: shouldDisableGiftActions,
|
@@ -8481,7 +8572,7 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8481
8572
|
}
|
8482
8573
|
)
|
8483
8574
|
] }),
|
8484
|
-
rebuyDebugLog.isKeyActive("smart-cart-tpb" /* SC_TPB */) && /* @__PURE__ */ (0,
|
8575
|
+
rebuyDebugLog.isKeyActive("smart-cart-tpb" /* SC_TPB */) && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
8485
8576
|
"button",
|
8486
8577
|
{
|
8487
8578
|
onClick: () => setShowDebugPanel(!showDebugPanel),
|
@@ -8493,7 +8584,7 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8493
8584
|
children: showDebugPanel ? "Hide Debug Panel" : "Show Debug Panel"
|
8494
8585
|
}
|
8495
8586
|
),
|
8496
|
-
rebuyDebugLog.isKeyActive("smart-cart-tpb" /* SC_TPB */) && showDebugPanel && /* @__PURE__ */ (0,
|
8587
|
+
rebuyDebugLog.isKeyActive("smart-cart-tpb" /* SC_TPB */) && showDebugPanel && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
8497
8588
|
"div",
|
8498
8589
|
{
|
8499
8590
|
style: {
|
@@ -8504,38 +8595,38 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8504
8595
|
width: "100%"
|
8505
8596
|
},
|
8506
8597
|
children: [
|
8507
|
-
/* @__PURE__ */ (0,
|
8508
|
-
/* @__PURE__ */ (0,
|
8509
|
-
/* @__PURE__ */ (0,
|
8598
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { style: infoText, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "Progress Bar Debug Info" }) }),
|
8599
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { style: codeBlock, children: [
|
8600
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
8510
8601
|
"Subtotal: ",
|
8511
8602
|
formatMoney(currentSubtotal)
|
8512
8603
|
] }),
|
8513
|
-
/* @__PURE__ */ (0,
|
8604
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
8514
8605
|
"Visual Progress: ",
|
8515
8606
|
visualPercentageComplete.toFixed(0),
|
8516
8607
|
"%"
|
8517
8608
|
] }),
|
8518
|
-
/* @__PURE__ */ (0,
|
8609
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
8519
8610
|
"Actual Progress: ",
|
8520
8611
|
realPercentageComplete.toFixed(0),
|
8521
8612
|
"%"
|
8522
8613
|
] }),
|
8523
|
-
amountToNextTier > 0 && /* @__PURE__ */ (0,
|
8614
|
+
amountToNextTier > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
8524
8615
|
"To Next Tier: ",
|
8525
8616
|
formatMoney(amountToNextTier)
|
8526
8617
|
] }),
|
8527
|
-
currentTier && /* @__PURE__ */ (0,
|
8618
|
+
currentTier && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
8528
8619
|
"Current Tier: ",
|
8529
8620
|
getTierLabel(currentTier)
|
8530
8621
|
] }),
|
8531
|
-
cartSyncError && /* @__PURE__ */ (0,
|
8622
|
+
cartSyncError && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { style: { color: "#f66" }, children: [
|
8532
8623
|
"Error: ",
|
8533
8624
|
cartSyncError
|
8534
8625
|
] })
|
8535
8626
|
] }),
|
8536
|
-
giftsForDisplay.length > 0 && /* @__PURE__ */ (0,
|
8537
|
-
/* @__PURE__ */ (0,
|
8538
|
-
/* @__PURE__ */ (0,
|
8627
|
+
giftsForDisplay.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { style: { marginTop: "8px" }, children: [
|
8628
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { style: infoText, children: "Gift Status:" }),
|
8629
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { style: codeBlock, children: giftsForDisplay.map((gift, idx) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { style: { marginBottom: "4px" }, children: [
|
8539
8630
|
"Tier ",
|
8540
8631
|
gift.tierId,
|
8541
8632
|
": ",
|
@@ -8551,7 +8642,7 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8551
8642
|
TieredProgressBar.displayName = "TieredProgressBar";
|
8552
8643
|
|
8553
8644
|
// src/smart-cart/components/componentRegistry.tsx
|
8554
|
-
var
|
8645
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
8555
8646
|
var componentRegistry = {
|
8556
8647
|
// Use 'any' for props initially, refine later
|
8557
8648
|
announcement_bar: AnnouncementBar,
|
@@ -8570,7 +8661,7 @@ var componentRegistry = {
|
|
8570
8661
|
};
|
8571
8662
|
|
8572
8663
|
// src/smart-cart/components/_Layouts/AnchorSlot.tsx
|
8573
|
-
var
|
8664
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
8574
8665
|
var AnchorSlot = ({ anchor, components, excludeTypes, includeTypes }) => {
|
8575
8666
|
const componentsForSlot = (0, import_react28.useMemo)(() => {
|
8576
8667
|
return components.filter((comp) => {
|
@@ -8588,13 +8679,13 @@ var AnchorSlot = ({ anchor, components, excludeTypes, includeTypes }) => {
|
|
8588
8679
|
});
|
8589
8680
|
return null;
|
8590
8681
|
}
|
8591
|
-
return /* @__PURE__ */ (0,
|
8682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: componentsForSlot.map((componentConfig) => {
|
8592
8683
|
const Component = componentRegistry[componentConfig.type];
|
8593
8684
|
if (!Component) {
|
8594
8685
|
console.warn(`[SmartCartReact] No component registered for type: "${componentConfig.type}"`);
|
8595
8686
|
return null;
|
8596
8687
|
}
|
8597
|
-
return /* @__PURE__ */ (0,
|
8688
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Component, { componentConfig }, componentConfig.component_id);
|
8598
8689
|
}) });
|
8599
8690
|
};
|
8600
8691
|
|
@@ -8626,15 +8717,15 @@ var result21 = { "rebuy-smart-cart-layout__anchor-goal-box": "LayoutStyles_rebuy
|
|
8626
8717
|
var LayoutStyles_default = result21;
|
8627
8718
|
|
8628
8719
|
// src/smart-cart/components/_Layouts/DoubleColumnLayout.tsx
|
8629
|
-
var
|
8720
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
8630
8721
|
var DoubleColumnLayout = ({ components, itemCount, layout }) => {
|
8631
8722
|
const scrollAreaRef = (0, import_react30.useRef)(null);
|
8632
8723
|
const isScrolled = useIsScrolled(scrollAreaRef);
|
8633
8724
|
const layoutClass = layout === "double-right" ? LayoutStyles_default["rebuy-smart-cart-layout__flyout-inner--double-right"] : LayoutStyles_default["rebuy-smart-cart-layout__flyout-inner--double"];
|
8634
|
-
return /* @__PURE__ */ (0,
|
8635
|
-
/* @__PURE__ */ (0,
|
8636
|
-
/* @__PURE__ */ (0,
|
8637
|
-
/* @__PURE__ */ (0,
|
8725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: (0, import_clsx11.default)(LayoutStyles_default["rebuy-smart-cart-layout__flyout-inner"], layoutClass), children: [
|
8726
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: LayoutStyles_default["rebuy-smart-cart-layout__column--primary"], children: [
|
8727
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: LayoutStyles_default["rebuy-smart-cart-layout__anchor-goal-box"], "data-rebuy-cart-anchor": "goalBox", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AnchorSlot, { anchor: "goalBox", components }) }),
|
8728
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
8638
8729
|
"div",
|
8639
8730
|
{
|
8640
8731
|
className: (0, import_clsx11.default)(
|
@@ -8643,26 +8734,26 @@ var DoubleColumnLayout = ({ components, itemCount, layout }) => {
|
|
8643
8734
|
),
|
8644
8735
|
"data-rebuy-cart-scroll-area": true,
|
8645
8736
|
ref: scrollAreaRef,
|
8646
|
-
children: /* @__PURE__ */ (0,
|
8737
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: LayoutStyles_default["rebuy-smart-cart-layout__anchor-body"], "data-rebuy-cart-anchor": "body", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AnchorSlot, { anchor: "body", components }) })
|
8647
8738
|
}
|
8648
8739
|
),
|
8649
|
-
/* @__PURE__ */ (0,
|
8740
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
8650
8741
|
"div",
|
8651
8742
|
{
|
8652
8743
|
className: (0, import_clsx11.default)(LayoutStyles_default["rebuy-smart-cart-layout__anchor-footer"], {
|
8653
8744
|
[LayoutStyles_default["rebuy-smart-cart-layout__anchor-footer--hidden"]]: itemCount === 0
|
8654
8745
|
}),
|
8655
8746
|
"data-rebuy-cart-anchor": "footer",
|
8656
|
-
children: /* @__PURE__ */ (0,
|
8747
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AnchorSlot, { anchor: "footer", components })
|
8657
8748
|
}
|
8658
8749
|
)
|
8659
8750
|
] }),
|
8660
|
-
/* @__PURE__ */ (0,
|
8751
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: LayoutStyles_default["rebuy-smart-cart-layout__column--secondary"], children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
8661
8752
|
"div",
|
8662
8753
|
{
|
8663
8754
|
className: LayoutStyles_default["rebuy-smart-cart-layout__anchor-cross-sells"],
|
8664
8755
|
"data-rebuy-cart-anchor": "crossSells",
|
8665
|
-
children: /* @__PURE__ */ (0,
|
8756
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AnchorSlot, { anchor: "crossSells", components })
|
8666
8757
|
}
|
8667
8758
|
) })
|
8668
8759
|
] });
|
@@ -8671,13 +8762,13 @@ var DoubleColumnLayout = ({ components, itemCount, layout }) => {
|
|
8671
8762
|
// src/smart-cart/components/_Layouts/SingleColumnLayout.tsx
|
8672
8763
|
var import_clsx12 = __toESM(require("clsx"), 1);
|
8673
8764
|
var import_react31 = require("react");
|
8674
|
-
var
|
8765
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
8675
8766
|
var SingleColumnLayout = ({ components, itemCount }) => {
|
8676
8767
|
const scrollAreaRef = (0, import_react31.useRef)(null);
|
8677
8768
|
const isScrolled = useIsScrolled(scrollAreaRef);
|
8678
|
-
return /* @__PURE__ */ (0,
|
8679
|
-
/* @__PURE__ */ (0,
|
8680
|
-
/* @__PURE__ */ (0,
|
8769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
8770
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: LayoutStyles_default["rebuy-smart-cart-layout__anchor-goal-box"], "data-rebuy-cart-anchor": "goalBox", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AnchorSlot, { anchor: "goalBox", components }) }),
|
8771
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
8681
8772
|
"div",
|
8682
8773
|
{
|
8683
8774
|
className: (0, import_clsx12.default)(
|
@@ -8686,17 +8777,17 @@ var SingleColumnLayout = ({ components, itemCount }) => {
|
|
8686
8777
|
),
|
8687
8778
|
"data-rebuy-cart-scroll-area": true,
|
8688
8779
|
ref: scrollAreaRef,
|
8689
|
-
children: /* @__PURE__ */ (0,
|
8780
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: LayoutStyles_default["rebuy-smart-cart-layout__anchor-body"], "data-rebuy-cart-anchor": "body", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AnchorSlot, { anchor: "body", components }) })
|
8690
8781
|
}
|
8691
8782
|
),
|
8692
|
-
/* @__PURE__ */ (0,
|
8783
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
8693
8784
|
"div",
|
8694
8785
|
{
|
8695
8786
|
className: (0, import_clsx12.default)(LayoutStyles_default["rebuy-smart-cart-layout__anchor-footer"], {
|
8696
8787
|
[LayoutStyles_default["rebuy-smart-cart-layout__anchor-footer--hidden"]]: itemCount === 0
|
8697
8788
|
}),
|
8698
8789
|
"data-rebuy-cart-anchor": "footer",
|
8699
|
-
children: /* @__PURE__ */ (0,
|
8790
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AnchorSlot, { anchor: "footer", components })
|
8700
8791
|
}
|
8701
8792
|
)
|
8702
8793
|
] });
|
@@ -8707,7 +8798,7 @@ var result22 = { "rebuy-smart-cart": "SmartCartContainer_rebuy-smart-cart", "reb
|
|
8707
8798
|
var SmartCartContainer_default = result22;
|
8708
8799
|
|
8709
8800
|
// src/smart-cart/components/SmartCartContainer/SmartCartContainer.tsx
|
8710
|
-
var
|
8801
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
8711
8802
|
var SmartCartContainer = ({ containerId }) => {
|
8712
8803
|
const { config, getItemCount, hideCart, isVisible } = useSmartCart();
|
8713
8804
|
const containerRef = (0, import_react32.useRef)(null);
|
@@ -8728,6 +8819,16 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8728
8819
|
}
|
8729
8820
|
}
|
8730
8821
|
}, [isVisible]);
|
8822
|
+
(0, import_react32.useEffect)(() => {
|
8823
|
+
if (isVisible) {
|
8824
|
+
document.body.classList.add("rebuy-smart-cart-open");
|
8825
|
+
} else {
|
8826
|
+
document.body.classList.remove("rebuy-smart-cart-open");
|
8827
|
+
}
|
8828
|
+
return () => {
|
8829
|
+
document.body.classList.remove("rebuy-smart-cart-open");
|
8830
|
+
};
|
8831
|
+
}, [isVisible]);
|
8731
8832
|
const backgroundClassName = (0, import_clsx13.default)(SmartCartContainer_default["rebuy-smart-cart__overlay-background"], {
|
8732
8833
|
[SmartCartContainer_default["rebuy-smart-cart__overlay-background--visible"]]: isVisible
|
8733
8834
|
});
|
@@ -8740,21 +8841,21 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8740
8841
|
}
|
8741
8842
|
);
|
8742
8843
|
const renderLayoutContent = () => {
|
8743
|
-
if (!config) return /* @__PURE__ */ (0,
|
8844
|
+
if (!config) return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { style: { padding: "20px", textAlign: "center" }, children: "Loading configuration..." });
|
8744
8845
|
switch (config.layout) {
|
8745
8846
|
case "double":
|
8746
8847
|
case "double-right":
|
8747
|
-
return /* @__PURE__ */ (0,
|
8848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DoubleColumnLayout, { components, itemCount: getItemCount(), layout: config.layout });
|
8748
8849
|
default:
|
8749
|
-
return /* @__PURE__ */ (0,
|
8850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SingleColumnLayout, { components, itemCount: getItemCount() });
|
8750
8851
|
}
|
8751
8852
|
};
|
8752
8853
|
const defaultTitleId = "rebuy-smart-cart-default-title";
|
8753
8854
|
const titleBarComponent = components.find((c) => c.type === "title_bar");
|
8754
8855
|
const ariaLabelledBy = titleBarComponent ? `rebuy-title-${titleBarComponent.component_id}` : defaultTitleId;
|
8755
|
-
return /* @__PURE__ */ (0,
|
8756
|
-
/* @__PURE__ */ (0,
|
8757
|
-
/* @__PURE__ */ (0,
|
8856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react32.default.Fragment, { children: [
|
8857
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: backgroundClassName, onClick: handleClose }),
|
8858
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
8758
8859
|
"div",
|
8759
8860
|
{
|
8760
8861
|
"aria-labelledby": ariaLabelledBy,
|
@@ -8766,15 +8867,15 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8766
8867
|
role: "dialog",
|
8767
8868
|
tabIndex: -1,
|
8768
8869
|
children: [
|
8769
|
-
/* @__PURE__ */ (0,
|
8770
|
-
/* @__PURE__ */ (0,
|
8771
|
-
/* @__PURE__ */ (0,
|
8772
|
-
/* @__PURE__ */ (0,
|
8870
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("header", { className: SmartCartContainer_default["rebuy-smart-cart__header"], "data-rebuy-cart-anchor": "header", children: [
|
8871
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: SmartCartContainer_default["rebuy-smart-cart__header-top-bar"], "data-rebuy-cart-header-top-bar": "", children: [
|
8872
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: SmartCartContainer_default["rebuy-smart-cart__header-content"], "data-rebuy-cart-header-top-inner": "", children: [
|
8873
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AnchorSlot, { anchor: "header", components, includeTypes: ["title_bar", "login"] }),
|
8773
8874
|
!components.some(
|
8774
8875
|
(c) => c.type === "title_bar" && !c.settings?.screen_reader_only
|
8775
|
-
) && /* @__PURE__ */ (0,
|
8876
|
+
) && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h2", { id: defaultTitleId, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ScreenReaderText, { children: "Your Cart" }) })
|
8776
8877
|
] }),
|
8777
|
-
/* @__PURE__ */ (0,
|
8878
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
8778
8879
|
"button",
|
8779
8880
|
{
|
8780
8881
|
"aria-label": "Close Cart",
|
@@ -8784,15 +8885,15 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8784
8885
|
type: "button",
|
8785
8886
|
children: [
|
8786
8887
|
"\u2715",
|
8787
|
-
/* @__PURE__ */ (0,
|
8888
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ScreenReaderText, { children: "Close Cart" })
|
8788
8889
|
]
|
8789
8890
|
}
|
8790
8891
|
)
|
8791
8892
|
] }),
|
8792
|
-
/* @__PURE__ */ (0,
|
8893
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AnchorSlot, { anchor: "header", components, excludeTypes: ["title_bar", "login"] })
|
8793
8894
|
] }),
|
8794
8895
|
renderLayoutContent(),
|
8795
|
-
/* @__PURE__ */ (0,
|
8896
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { "aria-live": "polite", className: "rebuy-sr-only", id: "rebuy-cart-live-region" })
|
8796
8897
|
]
|
8797
8898
|
}
|
8798
8899
|
)
|
@@ -8800,9 +8901,9 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8800
8901
|
};
|
8801
8902
|
|
8802
8903
|
// src/smart-cart/RebuySmartCart.tsx
|
8803
|
-
var
|
8904
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
8804
8905
|
var RebuySmartCart = () => {
|
8805
|
-
return /* @__PURE__ */ (0,
|
8906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SmartCartContainer, {});
|
8806
8907
|
};
|
8807
8908
|
|
8808
8909
|
// src/widgetContainer/RebuyWidgetContainer.tsx
|
@@ -8904,6 +9005,7 @@ var RebuyWidgetContainerBase = ({ children, ...props }) => {
|
|
8904
9005
|
...props,
|
8905
9006
|
apiKey,
|
8906
9007
|
cacheKey: rebuyConfig?.shop?.cache_key,
|
9008
|
+
isHydrogenReact: rebuyContext?.contextParameters?.isHydrogenReact,
|
8907
9009
|
key: product?.id,
|
8908
9010
|
metadata,
|
8909
9011
|
products
|
@@ -8920,7 +9022,7 @@ var result23 = { "container": "RebuyCompleteTheLook_container", "productGrid": "
|
|
8920
9022
|
var RebuyCompleteTheLook_default = result23;
|
8921
9023
|
|
8922
9024
|
// src/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.tsx
|
8923
|
-
var
|
9025
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
8924
9026
|
var RebuyCompleteTheLook = (props) => {
|
8925
9027
|
const {
|
8926
9028
|
addToCartBtnText = "Add to cart",
|
@@ -8934,9 +9036,9 @@ var RebuyCompleteTheLook = (props) => {
|
|
8934
9036
|
rebuyDebugLog.log("widget-complete-the-look" /* WIDGET_COMPLETE_THE_LOOK */, "RebuyCompleteTheLook: No products found");
|
8935
9037
|
return null;
|
8936
9038
|
}
|
8937
|
-
return /* @__PURE__ */ (0,
|
8938
|
-
/* @__PURE__ */ (0,
|
8939
|
-
/* @__PURE__ */ (0,
|
9039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("section", { className: RebuyCompleteTheLook_default.container, children: [
|
9040
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
|
9041
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("ul", { className: RebuyCompleteTheLook_default.productGrid, children: products.map((product) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("li", { className: RebuyCompleteTheLook_default.productItem, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
8940
9042
|
ProductCard,
|
8941
9043
|
{
|
8942
9044
|
addToCartBtnText,
|
@@ -8954,11 +9056,34 @@ var import_react35 = require("react");
|
|
8954
9056
|
|
8955
9057
|
// src/utils/convertToRebuyProduct.tsx
|
8956
9058
|
var convertToRebuyProduct = (isHydrogenReact, product) => {
|
8957
|
-
const mainProductVariants = isHydrogenReact ? product?.variants?.nodes?.map((variant) => {
|
8958
|
-
|
8959
|
-
|
8960
|
-
|
8961
|
-
|
9059
|
+
const mainProductVariants = isHydrogenReact ? product?.variants?.nodes?.map((variant) => ({
|
9060
|
+
availableForSale: variant.availableForSale,
|
9061
|
+
compareAtPriceV2: {
|
9062
|
+
amount: variant.compareAtPrice?.amount || "",
|
9063
|
+
currencyCode: variant.compareAtPrice?.currencyCode || "USD"
|
9064
|
+
},
|
9065
|
+
id: variant.id,
|
9066
|
+
image: variant.image ? {
|
9067
|
+
altText: variant.image.altText || null,
|
9068
|
+
height: variant.image.height || 100,
|
9069
|
+
id: variant.image.id || "",
|
9070
|
+
url: variant.image.url || "",
|
9071
|
+
width: variant.image.width || 100
|
9072
|
+
} : void 0,
|
9073
|
+
priceV2: {
|
9074
|
+
amount: variant.price.amount,
|
9075
|
+
currencyCode: variant.price.currencyCode
|
9076
|
+
},
|
9077
|
+
product: {
|
9078
|
+
handle: product.handle,
|
9079
|
+
id: product.id,
|
9080
|
+
title: product.title,
|
9081
|
+
vendor: product.vendor
|
9082
|
+
},
|
9083
|
+
selectedOptions: variant.selectedOptions,
|
9084
|
+
sku: variant.sku || "",
|
9085
|
+
title: variant.title
|
9086
|
+
})) || [] : product?.adjacentVariants.map((variant) => {
|
8962
9087
|
return {
|
8963
9088
|
availableForSale: variant.availableForSale,
|
8964
9089
|
compareAtPriceV2: {
|
@@ -9022,26 +9147,28 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
|
|
9022
9147
|
selected: true,
|
9023
9148
|
selectedOptions: product?.selectedVariant?.selectedOptions?.reduce((acc, option) => {
|
9024
9149
|
return { ...acc, [option.name]: option.value };
|
9150
|
+
}, {}) || product?.variants?.nodes[0]?.selectedOptions?.reduce((acc, option) => {
|
9151
|
+
return { ...acc, [option.name]: option.value };
|
9025
9152
|
}, {}) || {},
|
9026
9153
|
selectedSellingPlan: {},
|
9027
9154
|
selectedSellingPlanAllocation: {},
|
9028
9155
|
selectedVariant: {
|
9029
|
-
availableForSale: product?.selectedVariant?.availableForSale || false,
|
9156
|
+
availableForSale: product?.selectedVariant?.availableForSale || product?.variants?.nodes[0]?.availableForSale || false,
|
9030
9157
|
compareAtPriceV2: {
|
9031
|
-
amount: product?.selectedVariant?.compareAtPrice?.amount || "",
|
9032
|
-
currencyCode: product?.selectedVariant?.compareAtPrice?.currencyCode || "USD"
|
9158
|
+
amount: product?.selectedVariant?.compareAtPrice?.amount || product?.variants?.nodes[0]?.compareAtPrice?.amount || "",
|
9159
|
+
currencyCode: product?.selectedVariant?.compareAtPrice?.currencyCode || product?.variants?.nodes[0]?.compareAtPrice?.currencyCode || "USD"
|
9033
9160
|
},
|
9034
9161
|
id: product?.selectedVariant?.id || "",
|
9035
9162
|
image: {
|
9036
|
-
altText: product?.selectedVariant?.image?.altText || "",
|
9037
|
-
height: product?.selectedVariant?.image?.height || 100,
|
9038
|
-
id: product?.selectedVariant?.image?.id || "",
|
9039
|
-
url: product?.selectedVariant?.image?.url || "",
|
9040
|
-
width: product?.selectedVariant?.image?.width || 100
|
9163
|
+
altText: product?.selectedVariant?.image?.altText || product?.variants?.nodes[0]?.image?.altText || "",
|
9164
|
+
height: product?.selectedVariant?.image?.height || product?.variants?.nodes[0]?.image?.height || 100,
|
9165
|
+
id: product?.selectedVariant?.image?.id || product?.variants?.nodes[0]?.image?.id || "",
|
9166
|
+
url: product?.selectedVariant?.image?.url || product?.variants?.nodes[0]?.image?.url || "",
|
9167
|
+
width: product?.selectedVariant?.image?.width || product?.variants?.nodes[0]?.image?.width || 100
|
9041
9168
|
},
|
9042
9169
|
priceV2: {
|
9043
|
-
amount: product?.selectedVariant?.price.amount || "",
|
9044
|
-
currencyCode: product?.selectedVariant?.price.currencyCode || "USD"
|
9170
|
+
amount: product?.selectedVariant?.price.amount || product?.variants?.nodes[0]?.price.amount || "",
|
9171
|
+
currencyCode: product?.selectedVariant?.price.currencyCode || product?.variants?.nodes[0]?.price.currencyCode || "USD"
|
9045
9172
|
},
|
9046
9173
|
product: {
|
9047
9174
|
handle: product?.handle || "",
|
@@ -9049,9 +9176,9 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
|
|
9049
9176
|
title: product?.title || "",
|
9050
9177
|
vendor: product?.vendor || ""
|
9051
9178
|
},
|
9052
|
-
selectedOptions: product?.selectedVariant?.selectedOptions || [],
|
9053
|
-
sku: product?.selectedVariant?.sku || "",
|
9054
|
-
title: product?.selectedVariant?.title || ""
|
9179
|
+
selectedOptions: product?.selectedVariant?.selectedOptions || product?.variants?.nodes[0]?.selectedOptions || [],
|
9180
|
+
sku: product?.selectedVariant?.sku || product?.variants?.nodes[0]?.sku || "",
|
9181
|
+
title: product?.selectedVariant?.title || product?.variants?.nodes[0]?.title || ""
|
9055
9182
|
},
|
9056
9183
|
sellingPlanGroups: [],
|
9057
9184
|
seo: {
|
@@ -9178,19 +9305,18 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
|
|
9178
9305
|
// src/widgets/RebuyDynamicBundleProducts/BundleImages.tsx
|
9179
9306
|
var import_hydrogen8 = require("@shopify/hydrogen");
|
9180
9307
|
var import_react34 = require("react");
|
9181
|
-
var import_react_router9 = require("react-router");
|
9182
9308
|
|
9183
9309
|
// src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.module.css
|
9184
9310
|
var result24 = { "container": "RebuyDynamicBundleProducts_container", "addCartBtnContainer": "RebuyDynamicBundleProducts_addCartBtnContainer", "bundleContainer": "RebuyDynamicBundleProducts_bundleContainer", "select": "RebuyDynamicBundleProducts_select", "bundleItemRowContainer": "RebuyDynamicBundleProducts_bundleItemRowContainer", "unselected": "RebuyDynamicBundleProducts_unselected", "bundleItemRow": "RebuyDynamicBundleProducts_bundleItemRow", "bundleItemInput": "RebuyDynamicBundleProducts_bundleItemInput", "bundleItemLabel": "RebuyDynamicBundleProducts_bundleItemLabel", "bundleImages": "RebuyDynamicBundleProducts_bundleImages", "bundleImage": "RebuyDynamicBundleProducts_bundleImage", "bundleImageDelimiter": "RebuyDynamicBundleProducts_bundleImageDelimiter", "compareAtPrice": "RebuyDynamicBundleProducts_compareAtPrice" };
|
9185
9311
|
var RebuyDynamicBundleProducts_default = result24;
|
9186
9312
|
|
9187
9313
|
// src/widgets/RebuyDynamicBundleProducts/BundleImages.tsx
|
9188
|
-
var
|
9314
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
9189
9315
|
var BundleImages = ({ products }) => {
|
9190
9316
|
const selected = products.filter((product) => product.selected);
|
9191
|
-
return /* @__PURE__ */ (0,
|
9317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("ul", { className: RebuyDynamicBundleProducts_default.bundleImages, children: products.map((product, index) => {
|
9192
9318
|
const image = product.selectedVariant?.image;
|
9193
|
-
const productImage = image ? /* @__PURE__ */ (0,
|
9319
|
+
const productImage = image ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
9194
9320
|
import_hydrogen8.Image,
|
9195
9321
|
{
|
9196
9322
|
alt: image.altText || `Picture of ${product.title}`,
|
@@ -9205,24 +9331,79 @@ var BundleImages = ({ products }) => {
|
|
9205
9331
|
product.title
|
9206
9332
|
);
|
9207
9333
|
const showDelimiter = selected[0]?.id !== product.id;
|
9208
|
-
return /* @__PURE__ */ (0,
|
9209
|
-
showDelimiter && /* @__PURE__ */ (0,
|
9210
|
-
/* @__PURE__ */ (0,
|
9334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react34.Fragment, { children: product.selected && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
9335
|
+
showDelimiter && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { className: RebuyDynamicBundleProducts_default.bundleImageDelimiter, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "+" }) }),
|
9336
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { className: "flex items-center", children: product.default ? (
|
9211
9337
|
// Already on product page
|
9212
9338
|
productImage
|
9213
9339
|
) : (
|
9214
9340
|
// Link to product
|
9215
|
-
/* @__PURE__ */ (0,
|
9341
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
9342
|
+
RebuyLink,
|
9343
|
+
{
|
9344
|
+
ariaLabel: `View ${product.title}`,
|
9345
|
+
handle: `/products/${product.handle}`,
|
9346
|
+
children: productImage
|
9347
|
+
}
|
9348
|
+
)
|
9216
9349
|
) })
|
9217
9350
|
] }) }, product.id + "-BundleImages-" + index);
|
9218
9351
|
}) });
|
9219
9352
|
};
|
9220
9353
|
|
9354
|
+
// src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx
|
9355
|
+
var import_hydrogen9 = require("@shopify/hydrogen");
|
9356
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
9357
|
+
var BundlePrice = ({ products }) => {
|
9358
|
+
const isDisabled = products.filter((product) => product.selected).length < 1;
|
9359
|
+
const totalBundlePrice = () => {
|
9360
|
+
let total = 0;
|
9361
|
+
let currencyCode = "USD";
|
9362
|
+
for (const product of products) {
|
9363
|
+
if (product.selected && product.selectedVariant) {
|
9364
|
+
const { priceV2: price2 } = product.selectedVariant;
|
9365
|
+
total += Number(price2?.amount);
|
9366
|
+
currencyCode = price2?.currencyCode || "USD";
|
9367
|
+
}
|
9368
|
+
}
|
9369
|
+
return {
|
9370
|
+
amount: String(total),
|
9371
|
+
currencyCode
|
9372
|
+
};
|
9373
|
+
};
|
9374
|
+
const totalBundleCompareAtPrice = () => {
|
9375
|
+
let compareAtTotal = 0;
|
9376
|
+
let currencyCode = "USD";
|
9377
|
+
for (const product of products) {
|
9378
|
+
if (product.selected && product.selectedVariant) {
|
9379
|
+
const { compareAtPriceV2: compareAtPrice2, priceV2: price2 } = product.selectedVariant;
|
9380
|
+
currencyCode = price2?.currencyCode || "USD";
|
9381
|
+
compareAtTotal += Number((compareAtPrice2 || price2)?.amount);
|
9382
|
+
}
|
9383
|
+
}
|
9384
|
+
return {
|
9385
|
+
amount: String(compareAtTotal),
|
9386
|
+
currencyCode
|
9387
|
+
};
|
9388
|
+
};
|
9389
|
+
const isDiscounted = (price2, compareAtPrice2) => Number(compareAtPrice2?.amount) > Number(price2?.amount);
|
9390
|
+
const price = totalBundlePrice();
|
9391
|
+
const compareAtPrice = totalBundleCompareAtPrice();
|
9392
|
+
const CompareAtPrice = ({ data: compareAtPrice2 }) => {
|
9393
|
+
return compareAtPrice2 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_hydrogen9.Money, { as: "span", className: RebuyDynamicBundleProducts_default.compareAtPrice, data: compareAtPrice2, withoutTrailingZeros: true });
|
9394
|
+
};
|
9395
|
+
return products.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex items-center flex-col", children: !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("p", { className: "flex items-center gap-2 mb-2", children: [
|
9396
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { children: "Total Price:" }),
|
9397
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_hydrogen9.Money, { as: "span", data: price, withoutTrailingZeros: true }),
|
9398
|
+
isDiscounted(price, compareAtPrice) && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CompareAtPrice, { data: compareAtPrice })
|
9399
|
+
] }) });
|
9400
|
+
};
|
9401
|
+
|
9221
9402
|
// src/widgets/RebuyDynamicBundleProducts/BundleSelection.tsx
|
9222
9403
|
var import_clsx14 = __toESM(require("clsx"), 1);
|
9223
9404
|
|
9224
9405
|
// src/widgets/RebuyDynamicBundleProducts/Select.tsx
|
9225
|
-
var
|
9406
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
9226
9407
|
var Select = ({ onSelectVariant, product }) => {
|
9227
9408
|
const getOptionsLabel = (product2) => {
|
9228
9409
|
const options = product2.variants.nodes[0].selectedOptions;
|
@@ -9231,30 +9412,30 @@ var Select = ({ onSelectVariant, product }) => {
|
|
9231
9412
|
const useValues = optionsFromKeys.every((key) => ["name", "value"].includes(key));
|
9232
9413
|
return (useValues ? optionsFromValues : optionsFromKeys).join(" / ");
|
9233
9414
|
};
|
9234
|
-
return product && /* @__PURE__ */ (0,
|
9415
|
+
return product && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
9235
9416
|
"select",
|
9236
9417
|
{
|
9237
9418
|
"aria-label": "select variant",
|
9238
9419
|
className: RebuyDynamicBundleProducts_default.select,
|
9239
9420
|
onChange: (e) => onSelectVariant(product, e.target.value),
|
9240
9421
|
value: product.selectedVariant.id,
|
9241
|
-
children: /* @__PURE__ */ (0,
|
9422
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("optgroup", { label: getOptionsLabel(product), children: product.variants.nodes.map(({ id, title }) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("option", { value: id, children: title }, id + "-BundleVariant")) })
|
9242
9423
|
}
|
9243
9424
|
);
|
9244
9425
|
};
|
9245
9426
|
|
9246
9427
|
// src/widgets/RebuyDynamicBundleProducts/BundleSelection.tsx
|
9247
|
-
var
|
9428
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
9248
9429
|
var BundleSelection = ({ onSelectVariant, onToggleBundleItem, products }) => {
|
9249
|
-
return /* @__PURE__ */ (0,
|
9430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("ul", { children: products.map((product, index) => {
|
9250
9431
|
const { availableForSale } = product.selectedVariant;
|
9251
9432
|
const isOutOfStock = !availableForSale;
|
9252
|
-
return /* @__PURE__ */ (0,
|
9433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
9253
9434
|
"li",
|
9254
9435
|
{
|
9255
9436
|
className: (0, import_clsx14.default)(RebuyDynamicBundleProducts_default.bundleItemRowContainer, !product.selected && RebuyDynamicBundleProducts_default.unselected),
|
9256
|
-
children: /* @__PURE__ */ (0,
|
9257
|
-
/* @__PURE__ */ (0,
|
9437
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: RebuyDynamicBundleProducts_default.bundleItemRow, children: [
|
9438
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
9258
9439
|
"input",
|
9259
9440
|
{
|
9260
9441
|
checked: product.selected && availableForSale,
|
@@ -9266,14 +9447,14 @@ var BundleSelection = ({ onSelectVariant, onToggleBundleItem, products }) => {
|
|
9266
9447
|
value: product.id
|
9267
9448
|
}
|
9268
9449
|
),
|
9269
|
-
/* @__PURE__ */ (0,
|
9270
|
-
/* @__PURE__ */ (0,
|
9271
|
-
isOutOfStock && /* @__PURE__ */ (0,
|
9272
|
-
product.default && /* @__PURE__ */ (0,
|
9450
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: RebuyDynamicBundleProducts_default.bundleItemInput, children: [
|
9451
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: RebuyDynamicBundleProducts_default.bundleItemLabel, htmlFor: `${product.id}-toggle`, children: [
|
9452
|
+
isOutOfStock && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("b", { children: "SOLD OUT" }),
|
9453
|
+
product.default && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("b", { children: "This item:" }),
|
9273
9454
|
product.title,
|
9274
|
-
/* @__PURE__ */ (0,
|
9455
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RebuyProductPrice, { selectedVariant: product.selectedVariant })
|
9275
9456
|
] }),
|
9276
|
-
product.variants.nodes.length > 1 && /* @__PURE__ */ (0,
|
9457
|
+
product.variants.nodes.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Select, { onSelectVariant, product })
|
9277
9458
|
] })
|
9278
9459
|
] })
|
9279
9460
|
},
|
@@ -9282,56 +9463,8 @@ var BundleSelection = ({ onSelectVariant, onToggleBundleItem, products }) => {
|
|
9282
9463
|
}) });
|
9283
9464
|
};
|
9284
9465
|
|
9285
|
-
// src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx
|
9286
|
-
var import_hydrogen9 = require("@shopify/hydrogen");
|
9287
|
-
var import_jsx_runtime46 = require("react/jsx-runtime");
|
9288
|
-
var BundlePrice = ({ products }) => {
|
9289
|
-
const isDisabled = products.filter((product) => product.selected).length < 1;
|
9290
|
-
const totalBundlePrice = () => {
|
9291
|
-
let total = 0;
|
9292
|
-
let currencyCode = "USD";
|
9293
|
-
for (const product of products) {
|
9294
|
-
if (product.selected && product.selectedVariant) {
|
9295
|
-
const { priceV2: price2 } = product.selectedVariant;
|
9296
|
-
total += Number(price2?.amount);
|
9297
|
-
currencyCode = price2?.currencyCode || "USD";
|
9298
|
-
}
|
9299
|
-
}
|
9300
|
-
return {
|
9301
|
-
amount: String(total),
|
9302
|
-
currencyCode
|
9303
|
-
};
|
9304
|
-
};
|
9305
|
-
const totalBundleCompareAtPrice = () => {
|
9306
|
-
let compareAtTotal = 0;
|
9307
|
-
let currencyCode = "USD";
|
9308
|
-
for (const product of products) {
|
9309
|
-
if (product.selected && product.selectedVariant) {
|
9310
|
-
const { compareAtPriceV2: compareAtPrice2, priceV2: price2 } = product.selectedVariant;
|
9311
|
-
currencyCode = price2?.currencyCode || "USD";
|
9312
|
-
compareAtTotal += Number((compareAtPrice2 || price2)?.amount);
|
9313
|
-
}
|
9314
|
-
}
|
9315
|
-
return {
|
9316
|
-
amount: String(compareAtTotal),
|
9317
|
-
currencyCode
|
9318
|
-
};
|
9319
|
-
};
|
9320
|
-
const isDiscounted = (price2, compareAtPrice2) => Number(compareAtPrice2?.amount) > Number(price2?.amount);
|
9321
|
-
const price = totalBundlePrice();
|
9322
|
-
const compareAtPrice = totalBundleCompareAtPrice();
|
9323
|
-
const CompareAtPrice = ({ data: compareAtPrice2 }) => {
|
9324
|
-
return compareAtPrice2 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_hydrogen9.Money, { as: "span", className: RebuyDynamicBundleProducts_default.compareAtPrice, data: compareAtPrice2, withoutTrailingZeros: true });
|
9325
|
-
};
|
9326
|
-
return products.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "flex items-center flex-col", children: !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("p", { className: "flex items-center gap-2 mb-2", children: [
|
9327
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "Total Price:" }),
|
9328
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_hydrogen9.Money, { as: "span", data: price, withoutTrailingZeros: true }),
|
9329
|
-
isDiscounted(price, compareAtPrice) && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CompareAtPrice, { data: compareAtPrice })
|
9330
|
-
] }) });
|
9331
|
-
};
|
9332
|
-
|
9333
9466
|
// src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.tsx
|
9334
|
-
var
|
9467
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
9335
9468
|
var RebuyDynamicBundleProducts = (props) => {
|
9336
9469
|
const {
|
9337
9470
|
addToCartBtnText = "Add to cart",
|
@@ -9377,12 +9510,12 @@ var RebuyDynamicBundleProducts = (props) => {
|
|
9377
9510
|
rebuyDebugLog.log("widget-dynamic-bundle-products" /* WIDGET_DYNAMIC_BUNDLE_PRODUCTS */, "RebuyDynamicBundleProducts: No products found");
|
9378
9511
|
return null;
|
9379
9512
|
}
|
9380
|
-
return /* @__PURE__ */ (0,
|
9381
|
-
/* @__PURE__ */ (0,
|
9382
|
-
/* @__PURE__ */ (0,
|
9383
|
-
/* @__PURE__ */ (0,
|
9384
|
-
/* @__PURE__ */ (0,
|
9385
|
-
/* @__PURE__ */ (0,
|
9513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("section", { className: RebuyDynamicBundleProducts_default.container, children: [
|
9514
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
|
9515
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: RebuyDynamicBundleProducts_default.bundleContainer, children: [
|
9516
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(BundleImages, { products: bundleProducts }),
|
9517
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(BundlePrice, { products: bundleProducts }),
|
9518
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: RebuyDynamicBundleProducts_default.addCartBtnContainer, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
9386
9519
|
AddToCartBtn,
|
9387
9520
|
{
|
9388
9521
|
addToCartBtnText,
|
@@ -9394,7 +9527,7 @@ var RebuyDynamicBundleProducts = (props) => {
|
|
9394
9527
|
})
|
9395
9528
|
}
|
9396
9529
|
) }),
|
9397
|
-
/* @__PURE__ */ (0,
|
9530
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
9398
9531
|
BundleSelection,
|
9399
9532
|
{
|
9400
9533
|
onSelectVariant,
|
@@ -9412,14 +9545,13 @@ var import_react36 = require("react");
|
|
9412
9545
|
|
9413
9546
|
// src/widgets/RebuyProductAddOns/RebuyProductAddOnCard.tsx
|
9414
9547
|
var import_hydrogen10 = require("@shopify/hydrogen");
|
9415
|
-
var import_react_router10 = require("react-router");
|
9416
9548
|
|
9417
9549
|
// src/widgets/RebuyProductAddOns/RebuyProductAddOns.module.css
|
9418
9550
|
var result25 = { "container": "RebuyProductAddOns_container", "productAddOnsList": "RebuyProductAddOns_productAddOnsList", "addOnCard": "RebuyProductAddOns_addOnCard", "addOnCardContent": "RebuyProductAddOns_addOnCardContent", "addOnCardInput": "RebuyProductAddOns_addOnCardInput", "addOnCardContentImage": "RebuyProductAddOns_addOnCardContentImage", "addOnCardOutOfStock": "RebuyProductAddOns_addOnCardOutOfStock", "addOnCardTextContent": "RebuyProductAddOns_addOnCardTextContent", "addOnCardLearnMore": "RebuyProductAddOns_addOnCardLearnMore", "addCartBtnContainer": "RebuyProductAddOns_addCartBtnContainer", "productAddOnsFooter": "RebuyProductAddOns_productAddOnsFooter", "moneyContainer": "RebuyProductAddOns_moneyContainer" };
|
9419
9551
|
var RebuyProductAddOns_default = result25;
|
9420
9552
|
|
9421
9553
|
// src/widgets/RebuyProductAddOns/RebuyProductAddOnCard.tsx
|
9422
|
-
var
|
9554
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
9423
9555
|
var RebuyProductAddOnCard = ({
|
9424
9556
|
handleChange,
|
9425
9557
|
learnMoreText,
|
@@ -9428,8 +9560,8 @@ var RebuyProductAddOnCard = ({
|
|
9428
9560
|
titleLevel
|
9429
9561
|
}) => {
|
9430
9562
|
const { availableForSale, image } = product.selectedVariant || {};
|
9431
|
-
return /* @__PURE__ */ (0,
|
9432
|
-
/* @__PURE__ */ (0,
|
9563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("label", { className: RebuyProductAddOns_default.addOnCard, htmlFor: product.id, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: RebuyProductAddOns_default.addOnCardContent, children: [
|
9564
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
9433
9565
|
"input",
|
9434
9566
|
{
|
9435
9567
|
checked: Boolean(product.selected),
|
@@ -9442,7 +9574,7 @@ var RebuyProductAddOnCard = ({
|
|
9442
9574
|
value: ""
|
9443
9575
|
}
|
9444
9576
|
),
|
9445
|
-
/* @__PURE__ */ (0,
|
9577
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: RebuyProductAddOns_default.addOnCardContentImage, children: image && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
9446
9578
|
import_hydrogen10.Image,
|
9447
9579
|
{
|
9448
9580
|
alt: image.altText || `Picture of ${product.title}`,
|
@@ -9451,17 +9583,25 @@ var RebuyProductAddOnCard = ({
|
|
9451
9583
|
width: 300
|
9452
9584
|
}
|
9453
9585
|
) }),
|
9454
|
-
/* @__PURE__ */ (0,
|
9455
|
-
!availableForSale && /* @__PURE__ */ (0,
|
9456
|
-
/* @__PURE__ */ (0,
|
9457
|
-
/* @__PURE__ */ (0,
|
9458
|
-
/* @__PURE__ */ (0,
|
9586
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: RebuyProductAddOns_default.addOnCardTextContent, children: [
|
9587
|
+
!availableForSale && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: RebuyProductAddOns_default.addOnCardOutOfStock, children: outOfStockText }),
|
9588
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Title, { level: titleLevel, text: product.title }),
|
9589
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(RebuyProductPrice, { selectedVariant: product.selectedVariant }),
|
9590
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
9591
|
+
RebuyLink,
|
9592
|
+
{
|
9593
|
+
ariaLabel: `View ${product.title}`,
|
9594
|
+
className: RebuyProductAddOns_default.addOnCardLearnMore,
|
9595
|
+
handle: `/products/${product.handle}`,
|
9596
|
+
children: learnMoreText
|
9597
|
+
}
|
9598
|
+
)
|
9459
9599
|
] })
|
9460
9600
|
] }) });
|
9461
9601
|
};
|
9462
9602
|
|
9463
9603
|
// src/widgets/RebuyProductAddOns/RebuyProductAddOns.tsx
|
9464
|
-
var
|
9604
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
9465
9605
|
var RebuyProductAddOns = (props) => {
|
9466
9606
|
const {
|
9467
9607
|
addToCartCallback,
|
@@ -9481,6 +9621,7 @@ var RebuyProductAddOns = (props) => {
|
|
9481
9621
|
const [addedItems, setAddedItems] = (0, import_react36.useState)(products);
|
9482
9622
|
const [subtotalWithProduct, setSubtotalWithProduct] = (0, import_react36.useState)();
|
9483
9623
|
const [subtotalWithOutProduct, setSubtotalWithOutProduct] = (0, import_react36.useState)();
|
9624
|
+
const convertedProduct = convertToRebuyProduct(isHydrogenReact || false, product);
|
9484
9625
|
(0, import_react36.useEffect)(() => {
|
9485
9626
|
let initialTotal = 0;
|
9486
9627
|
let currencyCode = "USD";
|
@@ -9499,14 +9640,14 @@ var RebuyProductAddOns = (props) => {
|
|
9499
9640
|
setSubtotalWithOutProduct({
|
9500
9641
|
amount: String(
|
9501
9642
|
initialTotal - Number(
|
9502
|
-
isHydrogenReact ?
|
9643
|
+
isHydrogenReact ? convertedProduct?.selectedVariant?.priceV2?.amount : product?.selectedOrFirstAvailableVariant?.price.amount
|
9503
9644
|
)
|
9504
9645
|
),
|
9505
9646
|
currencyCode
|
9506
9647
|
});
|
9507
9648
|
setAddedItems(products);
|
9508
9649
|
if (includeMainProduct) {
|
9509
|
-
setAddedItems([
|
9650
|
+
setAddedItems([convertedProduct, ...products]);
|
9510
9651
|
} else {
|
9511
9652
|
setAddedItems(products);
|
9512
9653
|
}
|
@@ -9546,7 +9687,7 @@ var RebuyProductAddOns = (props) => {
|
|
9546
9687
|
setSubtotalWithOutProduct({
|
9547
9688
|
amount: String(
|
9548
9689
|
total - Number(
|
9549
|
-
isHydrogenReact ?
|
9690
|
+
isHydrogenReact ? convertedProduct?.selectedVariant?.priceV2?.amount : product?.selectedOrFirstAvailableVariant?.price.amount
|
9550
9691
|
)
|
9551
9692
|
),
|
9552
9693
|
currencyCode
|
@@ -9556,9 +9697,9 @@ var RebuyProductAddOns = (props) => {
|
|
9556
9697
|
rebuyDebugLog.log("widget-product-add-ons" /* WIDGET_PRODUCT_ADD_ONS */, "RebuyProductAddOns: No products found");
|
9557
9698
|
return null;
|
9558
9699
|
}
|
9559
|
-
return /* @__PURE__ */ (0,
|
9560
|
-
/* @__PURE__ */ (0,
|
9561
|
-
/* @__PURE__ */ (0,
|
9700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: RebuyProductAddOns_default.container, children: [
|
9701
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
|
9702
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("ul", { className: RebuyProductAddOns_default.productAddOnsList, children: products.map((product2) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
9562
9703
|
RebuyProductAddOnCard,
|
9563
9704
|
{
|
9564
9705
|
handleChange,
|
@@ -9568,16 +9709,16 @@ var RebuyProductAddOns = (props) => {
|
|
9568
9709
|
titleLevel: getTitleLevel(customTitleLevel, true)
|
9569
9710
|
}
|
9570
9711
|
) }, product2.id)) }),
|
9571
|
-
/* @__PURE__ */ (0,
|
9572
|
-
/* @__PURE__ */ (0,
|
9712
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: RebuyProductAddOns_default.productAddOnsFooter, children: [
|
9713
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: RebuyProductAddOns_default.moneyContainer, children: [
|
9573
9714
|
subtotalText,
|
9574
|
-
subtotalWithOutProduct && /* @__PURE__ */ (0,
|
9715
|
+
subtotalWithOutProduct && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_hydrogen_react3.Money, { data: subtotalWithOutProduct, withoutTrailingZeros: true })
|
9575
9716
|
] }),
|
9576
|
-
includeMainProduct && /* @__PURE__ */ (0,
|
9717
|
+
includeMainProduct && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: RebuyProductAddOns_default.moneyContainer, children: [
|
9577
9718
|
withProductText,
|
9578
|
-
subtotalWithProduct && /* @__PURE__ */ (0,
|
9719
|
+
subtotalWithProduct && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_hydrogen_react3.Money, { data: subtotalWithProduct, withoutTrailingZeros: true })
|
9579
9720
|
] }),
|
9580
|
-
/* @__PURE__ */ (0,
|
9721
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: RebuyProductAddOns_default.addCartBtnContainer, children: includeMainProduct ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
9581
9722
|
AddToCartBtn,
|
9582
9723
|
{
|
9583
9724
|
addToCartBtnText,
|
@@ -9587,7 +9728,7 @@ var RebuyProductAddOns = (props) => {
|
|
9587
9728
|
moneyData: subtotalWithProduct,
|
9588
9729
|
selectedVariants: addedItems.map((item) => item.selectedVariant)
|
9589
9730
|
}
|
9590
|
-
) : /* @__PURE__ */ (0,
|
9731
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
9591
9732
|
AddToCartBtn,
|
9592
9733
|
{
|
9593
9734
|
addToCartBtnText,
|
@@ -9607,7 +9748,7 @@ var result26 = { "container": "RebuyProductRecommendations_container", "productG
|
|
9607
9748
|
var RebuyProductRecommendations_default = result26;
|
9608
9749
|
|
9609
9750
|
// src/widgets/RebuyProductRecommendations/RebuyProductRecommendations.tsx
|
9610
|
-
var
|
9751
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
9611
9752
|
var RebuyProductRecommendations = (props) => {
|
9612
9753
|
const {
|
9613
9754
|
addToCartBtnText = "Add to cart",
|
@@ -9621,9 +9762,9 @@ var RebuyProductRecommendations = (props) => {
|
|
9621
9762
|
rebuyDebugLog.log("widget-product-recommendations" /* WIDGET_PRODUCT_RECOMMENDATIONS */, "RebuyProductRecommendations: No products found");
|
9622
9763
|
return null;
|
9623
9764
|
}
|
9624
|
-
return /* @__PURE__ */ (0,
|
9625
|
-
/* @__PURE__ */ (0,
|
9626
|
-
/* @__PURE__ */ (0,
|
9765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("section", { className: RebuyProductRecommendations_default.container, children: [
|
9766
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
|
9767
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ul", { className: RebuyProductRecommendations_default.productGrid, children: products.map((product) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
9627
9768
|
ProductCard,
|
9628
9769
|
{
|
9629
9770
|
addToCartBtnText,
|
@@ -9716,7 +9857,7 @@ var result27 = { "rebuy-recently-viewed-products-container": "RebuyRecentlyViewe
|
|
9716
9857
|
var RebuyRecentlyViewedProducts_default = result27;
|
9717
9858
|
|
9718
9859
|
// src/widgets/RebuyRecentlyViewedProducts/RebuyRecentlyViewedProducts.tsx
|
9719
|
-
var
|
9860
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
9720
9861
|
var RebuyRecentlyViewedProducts = (props) => {
|
9721
9862
|
const {
|
9722
9863
|
addToCartBtnText = "Add to cart",
|
@@ -9805,9 +9946,9 @@ var RebuyRecentlyViewedProducts = (props) => {
|
|
9805
9946
|
rebuyDebugLog.log("widget-recently-viewed-products" /* WIDGET_RECENTLY_VIEWED_PRODUCTS */, "RebuyRecentlyViewedProducts: No products found");
|
9806
9947
|
return null;
|
9807
9948
|
}
|
9808
|
-
return /* @__PURE__ */ (0,
|
9809
|
-
/* @__PURE__ */ (0,
|
9810
|
-
/* @__PURE__ */ (0,
|
9949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: RebuyRecentlyViewedProducts_default["rebuy-recently-viewed-products-container"], children: [
|
9950
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
|
9951
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("ul", { className: RebuyRecentlyViewedProducts_default["product-grid"], children: products?.map((product) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
9811
9952
|
ProductCard,
|
9812
9953
|
{
|
9813
9954
|
addToCartBtnText,
|