@rebuy/rebuy-hydrogen 3.0.0-beta.16 → 3.0.0-beta.18
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 +72 -20
- 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/context/RebuyWidgetContext.d.ts +7 -0
- package/dist/context/RebuyWidgetContext.d.ts.map +1 -0
- package/dist/index.css +53 -39
- package/dist/index.css.map +3 -3
- package/dist/index.js +737 -567
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +604 -434
- 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/types/widgets.d.ts +4 -2
- package/dist/types/widgets.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/RebuyCompleteTheLook/RebuyCompleteTheLook.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/RebuyProductRecommendations/RebuyProductRecommendations.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,20 +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,
|
6950
|
-
|
7038
|
+
isCrossSell,
|
6951
7039
|
popupTriggerId,
|
6952
7040
|
product,
|
6953
7041
|
productId,
|
@@ -7169,17 +7257,17 @@ var RebuyWidget = (props) => {
|
|
7169
7257
|
if (settings && !loadingSettings && shouldHideWidget) {
|
7170
7258
|
return null;
|
7171
7259
|
}
|
7172
|
-
return /* @__PURE__ */ (0,
|
7173
|
-
/* @__PURE__ */ (0,
|
7260
|
+
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: [
|
7261
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
7174
7262
|
"button",
|
7175
7263
|
{
|
7176
7264
|
"aria-label": "close modal",
|
7177
7265
|
className: RebuyWidget_default["rebuy-widget__modal-close"],
|
7178
7266
|
onClick: closePopup,
|
7179
|
-
children: /* @__PURE__ */ (0,
|
7267
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Close, {})
|
7180
7268
|
}
|
7181
7269
|
),
|
7182
|
-
/* @__PURE__ */ (0,
|
7270
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
7183
7271
|
WidgetContent,
|
7184
7272
|
{
|
7185
7273
|
addToCartCallback: () => {
|
@@ -7191,21 +7279,22 @@ var RebuyWidget = (props) => {
|
|
7191
7279
|
customTitle,
|
7192
7280
|
customTitleLevel,
|
7193
7281
|
customTitleStyle,
|
7194
|
-
isHydrogenReact,
|
7282
|
+
isHydrogenReact: rebuyGeneralContext?.contextParameters?.isHydrogenReact,
|
7195
7283
|
isInPopup: true,
|
7196
7284
|
onDismiss: closePopup,
|
7197
7285
|
products,
|
7198
7286
|
settings
|
7199
7287
|
}
|
7200
7288
|
)
|
7201
|
-
] }) }) }) }) : /* @__PURE__ */ (0,
|
7289
|
+
] }) }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: RebuyWidget_default["rebuy-widget__content"], children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
7202
7290
|
WidgetContent,
|
7203
7291
|
{
|
7204
7292
|
addToCartCallback,
|
7205
7293
|
customTitle,
|
7206
7294
|
customTitleLevel,
|
7207
7295
|
customTitleStyle,
|
7208
|
-
|
7296
|
+
isCrossSell,
|
7297
|
+
isHydrogenReact: rebuyGeneralContext?.contextParameters?.isHydrogenReact,
|
7209
7298
|
isInPopup: settings?.display_type === "popup",
|
7210
7299
|
products,
|
7211
7300
|
settings
|
@@ -7214,14 +7303,14 @@ var RebuyWidget = (props) => {
|
|
7214
7303
|
};
|
7215
7304
|
|
7216
7305
|
// src/smart-cart/components/CrossSell/CrossSell.tsx
|
7217
|
-
var
|
7306
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
7218
7307
|
var CrossSell = ({ componentConfig }) => {
|
7219
7308
|
const widgetId = componentConfig.settings.widget_id;
|
7220
7309
|
if (!widgetId) {
|
7221
7310
|
console.warn("[CrossSell] Widget ID is missing from component configuration");
|
7222
7311
|
return null;
|
7223
7312
|
}
|
7224
|
-
return /* @__PURE__ */ (0,
|
7313
|
+
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
7314
|
};
|
7226
7315
|
|
7227
7316
|
// src/smart-cart/components/CustomCode/CustomCodeBlock.tsx
|
@@ -7298,7 +7387,7 @@ var executeScriptsInContainer = (container, debugKey, debugContext) => {
|
|
7298
7387
|
};
|
7299
7388
|
|
7300
7389
|
// src/smart-cart/components/CustomCode/CustomCodeBlock.tsx
|
7301
|
-
var
|
7390
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
7302
7391
|
var CustomCodeBlock = import_react21.default.memo(({ componentConfig }) => {
|
7303
7392
|
const containerRef = (0, import_react21.useRef)(null);
|
7304
7393
|
const executedCodeRef = (0, import_react21.useRef)(null);
|
@@ -7325,7 +7414,7 @@ var CustomCodeBlock = import_react21.default.memo(({ componentConfig }) => {
|
|
7325
7414
|
if (!htmlCode) {
|
7326
7415
|
return null;
|
7327
7416
|
}
|
7328
|
-
return /* @__PURE__ */ (0,
|
7417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
7329
7418
|
"div",
|
7330
7419
|
{
|
7331
7420
|
dangerouslySetInnerHTML: { __html: htmlCode },
|
@@ -7427,7 +7516,7 @@ var result18 = { "rebuy-discount-code-input": "DiscountCodeInput_rebuy-discount-
|
|
7427
7516
|
var DiscountCodeInput_default = result18;
|
7428
7517
|
|
7429
7518
|
// src/smart-cart/components/DiscountCodeInput/DiscountCodeInput.tsx
|
7430
|
-
var
|
7519
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
7431
7520
|
var DiscountCodeInputComponent = ({ componentConfig }) => {
|
7432
7521
|
const {
|
7433
7522
|
applyDiscountCodes: hrApplyDiscountCodes,
|
@@ -7596,22 +7685,22 @@ var DiscountCodeInputComponent = ({ componentConfig }) => {
|
|
7596
7685
|
cartData
|
7597
7686
|
]);
|
7598
7687
|
if (!hasItems) return null;
|
7599
|
-
return /* @__PURE__ */ (0,
|
7688
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
7600
7689
|
"div",
|
7601
7690
|
{
|
7602
7691
|
className: DiscountCodeInput_default["rebuy-discount-code-input"],
|
7603
7692
|
"data-rebuy-component": "discount-input",
|
7604
7693
|
"data-rebuy-component-id": componentConfig.component_id,
|
7605
7694
|
children: [
|
7606
|
-
/* @__PURE__ */ (0,
|
7607
|
-
/* @__PURE__ */ (0,
|
7695
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("form", { className: DiscountCodeInput_default["rebuy-discount-code-input__form"], onSubmit: handleApply, children: [
|
7696
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
7608
7697
|
"div",
|
7609
7698
|
{
|
7610
7699
|
className: (0, import_clsx8.default)(DiscountCodeInput_default["rebuy-discount-code-input__input-wrapper"], {
|
7611
7700
|
[DiscountCodeInput_default["rebuy-discount-code-input__input-wrapper--show-label"]]: !!inputValue || isInputFocused
|
7612
7701
|
}),
|
7613
7702
|
children: [
|
7614
|
-
/* @__PURE__ */ (0,
|
7703
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
7615
7704
|
"input",
|
7616
7705
|
{
|
7617
7706
|
"aria-label": lang.inputLabel,
|
@@ -7632,7 +7721,7 @@ var DiscountCodeInputComponent = ({ componentConfig }) => {
|
|
7632
7721
|
value: inputValue
|
7633
7722
|
}
|
7634
7723
|
),
|
7635
|
-
/* @__PURE__ */ (0,
|
7724
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
7636
7725
|
"label",
|
7637
7726
|
{
|
7638
7727
|
className: DiscountCodeInput_default["rebuy-discount-code-input__input-label"],
|
@@ -7643,7 +7732,7 @@ var DiscountCodeInputComponent = ({ componentConfig }) => {
|
|
7643
7732
|
]
|
7644
7733
|
}
|
7645
7734
|
),
|
7646
|
-
/* @__PURE__ */ (0,
|
7735
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
7647
7736
|
"button",
|
7648
7737
|
{
|
7649
7738
|
className: DiscountCodeInput_default["rebuy-discount-code-input__apply-button"],
|
@@ -7653,11 +7742,11 @@ var DiscountCodeInputComponent = ({ componentConfig }) => {
|
|
7653
7742
|
}
|
7654
7743
|
)
|
7655
7744
|
] }),
|
7656
|
-
discountManagerError && /* @__PURE__ */ (0,
|
7657
|
-
shouldShowTags && /* @__PURE__ */ (0,
|
7658
|
-
/* @__PURE__ */ (0,
|
7659
|
-
/* @__PURE__ */ (0,
|
7660
|
-
/* @__PURE__ */ (0,
|
7745
|
+
discountManagerError && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: DiscountCodeInput_default["rebuy-discount-code-input__error-message"], children: discountManagerError }),
|
7746
|
+
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: [
|
7747
|
+
/* @__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" }) }) }),
|
7748
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: DiscountCodeInput_default["rebuy-discount-code-input__tag-text"], children: code }),
|
7749
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
7661
7750
|
"button",
|
7662
7751
|
{
|
7663
7752
|
"aria-label": `Remove discount code ${code}`,
|
@@ -7684,7 +7773,7 @@ var result19 = { "rebuy-login-button": "LoginButton_rebuy-login-button" };
|
|
7684
7773
|
var LoginButton_default = result19;
|
7685
7774
|
|
7686
7775
|
// src/smart-cart/components/LoginButton/LoginButton.tsx
|
7687
|
-
var
|
7776
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
7688
7777
|
var LoginButton = import_react24.default.memo(() => {
|
7689
7778
|
const { cartData, getComponentConfigByType } = useSmartCart();
|
7690
7779
|
const componentConfig = getComponentConfigByType("login");
|
@@ -7698,13 +7787,14 @@ var LoginButton = import_react24.default.memo(() => {
|
|
7698
7787
|
}
|
7699
7788
|
const loginLabel = componentConfig?.settings?.language?.title ?? "Login";
|
7700
7789
|
const loginUrl = componentConfig?.settings?.url ?? "/account/login";
|
7701
|
-
return /* @__PURE__ */ (0,
|
7702
|
-
|
7790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
7791
|
+
RebuyLink,
|
7703
7792
|
{
|
7793
|
+
ariaLabel: loginLabel,
|
7704
7794
|
className: LoginButton_default["rebuy-login-button"],
|
7705
7795
|
"data-rebuy-component": "login",
|
7706
7796
|
"data-rebuy-component-id": componentConfig.component_id ?? "login",
|
7707
|
-
|
7797
|
+
handle: loginUrl,
|
7708
7798
|
children: loginLabel
|
7709
7799
|
}
|
7710
7800
|
);
|
@@ -7921,7 +8011,7 @@ var useSmartCartApps = () => {
|
|
7921
8011
|
};
|
7922
8012
|
|
7923
8013
|
// src/smart-cart/components/SmartCartApp/SmartCartApp.tsx
|
7924
|
-
var
|
8014
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
7925
8015
|
var SmartCartApp = import_react26.default.memo(({ componentConfig }) => {
|
7926
8016
|
const containerRef = (0, import_react26.useRef)(null);
|
7927
8017
|
const executedScriptRef = (0, import_react26.useRef)(null);
|
@@ -7953,7 +8043,7 @@ var SmartCartApp = import_react26.default.memo(({ componentConfig }) => {
|
|
7953
8043
|
}
|
7954
8044
|
}, [scriptContent, appId, componentId]);
|
7955
8045
|
if (appsLoading) {
|
7956
|
-
return /* @__PURE__ */ (0,
|
8046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { "data-rebuy-component-id": componentId, children: [
|
7957
8047
|
"Loading App (",
|
7958
8048
|
appId ?? "N/A",
|
7959
8049
|
")..."
|
@@ -7961,7 +8051,7 @@ var SmartCartApp = import_react26.default.memo(({ componentConfig }) => {
|
|
7961
8051
|
}
|
7962
8052
|
if (appsHookError) {
|
7963
8053
|
console.error(`[SmartCartApp - ${componentId}] Hook error prevented app rendering: ${appsHookError}`);
|
7964
|
-
return /* @__PURE__ */ (0,
|
8054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { "data-rebuy-component-id": componentId, children: "Error loading app data." });
|
7965
8055
|
}
|
7966
8056
|
if (appId === null) {
|
7967
8057
|
console.warn(`[SmartCartApp - ${componentId}] Missing App ID (settings.app_id) in configuration.`);
|
@@ -7974,7 +8064,7 @@ var SmartCartApp = import_react26.default.memo(({ componentConfig }) => {
|
|
7974
8064
|
);
|
7975
8065
|
return null;
|
7976
8066
|
}
|
7977
|
-
return /* @__PURE__ */ (0,
|
8067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
7978
8068
|
"div",
|
7979
8069
|
{
|
7980
8070
|
dangerouslySetInnerHTML: { __html: scriptContent },
|
@@ -8001,7 +8091,7 @@ var result20 = { "rebuy-tiered-progress-bar": "TieredProgressBar_rebuy-tiered-pr
|
|
8001
8091
|
var TieredProgressBar_default = result20;
|
8002
8092
|
|
8003
8093
|
// src/smart-cart/components/TieredProgressBar/TPBGiftItem.tsx
|
8004
|
-
var
|
8094
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
8005
8095
|
var TieredProgressBarGiftItem = ({
|
8006
8096
|
isGloballySyncing,
|
8007
8097
|
onAddOrReAdd,
|
@@ -8027,14 +8117,14 @@ var TieredProgressBarGiftItem = ({
|
|
8027
8117
|
const imageAlt = image?.altText ?? title;
|
8028
8118
|
const isDisabled = isGloballySyncing || !!error;
|
8029
8119
|
const itemLevelError = error;
|
8030
|
-
return /* @__PURE__ */ (0,
|
8120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
8031
8121
|
"div",
|
8032
8122
|
{
|
8033
8123
|
className: (0, import_clsx9.default)(TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item"], {
|
8034
8124
|
[TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item--syncing"]]: isGloballySyncing
|
8035
8125
|
}),
|
8036
8126
|
children: [
|
8037
|
-
/* @__PURE__ */ (0,
|
8127
|
+
/* @__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
8128
|
"img",
|
8039
8129
|
{
|
8040
8130
|
alt: imageAlt,
|
@@ -8042,24 +8132,24 @@ var TieredProgressBarGiftItem = ({
|
|
8042
8132
|
loading: "lazy",
|
8043
8133
|
src: imageSrc
|
8044
8134
|
}
|
8045
|
-
) : /* @__PURE__ */ (0,
|
8135
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
8046
8136
|
"div",
|
8047
8137
|
{
|
8048
8138
|
"aria-label": "Gift product image placeholder",
|
8049
8139
|
className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-image"]
|
8050
8140
|
}
|
8051
8141
|
) }),
|
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,
|
8142
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-details"], children: [
|
8143
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h4", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-title"], id: `tpb-gift-${tierId}-title`, children: title }),
|
8144
|
+
displayStatus === "added" /* ADDED */ && displayVariantTitle && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-variant-title"], children: displayVariantTitle }),
|
8145
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-actions-wrapper"], children: [
|
8146
|
+
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..." }),
|
8147
|
+
itemLevelError && !isGloballySyncing && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__error-message"], children: [
|
8058
8148
|
"Error: ",
|
8059
8149
|
itemLevelError
|
8060
8150
|
] }),
|
8061
|
-
!isGloballySyncing && !itemLevelError && /* @__PURE__ */ (0,
|
8062
|
-
displayStatus === "added" /* ADDED */ && /* @__PURE__ */ (0,
|
8151
|
+
!isGloballySyncing && !itemLevelError && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
8152
|
+
displayStatus === "added" /* ADDED */ && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
8063
8153
|
"button",
|
8064
8154
|
{
|
8065
8155
|
"aria-label": `Remove ${title} gift`,
|
@@ -8072,7 +8162,7 @@ var TieredProgressBarGiftItem = ({
|
|
8072
8162
|
children: "Remove"
|
8073
8163
|
}
|
8074
8164
|
),
|
8075
|
-
displayStatus === "needs_selection" /* NEEDS_SELECTION */ && /* @__PURE__ */ (0,
|
8165
|
+
displayStatus === "needs_selection" /* NEEDS_SELECTION */ && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
8076
8166
|
"select",
|
8077
8167
|
{
|
8078
8168
|
"aria-label": `Select option for ${title}`,
|
@@ -8081,10 +8171,10 @@ var TieredProgressBarGiftItem = ({
|
|
8081
8171
|
onChange: handleVariantChange,
|
8082
8172
|
value: "",
|
8083
8173
|
children: [
|
8084
|
-
/* @__PURE__ */ (0,
|
8174
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { disabled: true, value: "", children: "Select Option" }),
|
8085
8175
|
availableChoices.map((variant) => {
|
8086
8176
|
const variantLabel = getFreeVariantTitle(variant) || variant.title;
|
8087
|
-
return /* @__PURE__ */ (0,
|
8177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("option", { value: variant.id, children: [
|
8088
8178
|
variantLabel,
|
8089
8179
|
" (",
|
8090
8180
|
formatMoney(variant.price.amount),
|
@@ -8094,7 +8184,7 @@ var TieredProgressBarGiftItem = ({
|
|
8094
8184
|
]
|
8095
8185
|
}
|
8096
8186
|
),
|
8097
|
-
canReAdd && displayStatus === "declined" /* DECLINED */ && /* @__PURE__ */ (0,
|
8187
|
+
canReAdd && displayStatus === "declined" /* DECLINED */ && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
8098
8188
|
"button",
|
8099
8189
|
{
|
8100
8190
|
"aria-label": `Re-add ${title} gift`,
|
@@ -8107,7 +8197,7 @@ var TieredProgressBarGiftItem = ({
|
|
8107
8197
|
children: "Re-Add Gift"
|
8108
8198
|
}
|
8109
8199
|
),
|
8110
|
-
displayStatus === "unavailable" /* UNAVAILABLE */ && !canReAdd && /* @__PURE__ */ (0,
|
8200
|
+
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
8201
|
] })
|
8112
8202
|
] })
|
8113
8203
|
] })
|
@@ -8193,7 +8283,7 @@ var codeBlock = {
|
|
8193
8283
|
};
|
8194
8284
|
|
8195
8285
|
// src/smart-cart/components/TieredProgressBar/TieredProgressBar.tsx
|
8196
|
-
var
|
8286
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
8197
8287
|
var TieredProgressBar = import_react27.default.memo(() => {
|
8198
8288
|
const { hydrogenReactCartActions, isCartBusy, isHydrogenReact } = useSmartCart();
|
8199
8289
|
const tpbUserActionFetcher = (0, import_react_router8.useFetcher)();
|
@@ -8372,9 +8462,9 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8372
8462
|
const progressBarId = `tpb-main-${activeBarConfig.id}`;
|
8373
8463
|
const feedbackId = `tpb-feedback-text-${activeBarConfig.id}`;
|
8374
8464
|
const giftAreaTitleId = `tpb-giftarea-title-${activeBarConfig.id}`;
|
8375
|
-
return /* @__PURE__ */ (0,
|
8376
|
-
/* @__PURE__ */ (0,
|
8377
|
-
/* @__PURE__ */ (0,
|
8465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar"], "data-rebuy-component": "tiered-progress-bar", children: [
|
8466
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__main-progress-area"], id: progressBarId, children: [
|
8467
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__tier-markers-list"], children: activeBarConfig.tiers.map((tier) => {
|
8378
8468
|
const isReached = checkTierReachedCallback(tier);
|
8379
8469
|
const tierLabel = getTierLabel(tier, fetchedProductMap);
|
8380
8470
|
const iconRenderData = getTierIconComponent(tier, isReached, fetchedProductMap);
|
@@ -8389,7 +8479,7 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8389
8479
|
if (import_react27.default.isValidElement(iconRenderData)) iconElement = iconRenderData;
|
8390
8480
|
else if (iconRenderData.type === "image") {
|
8391
8481
|
const imageObject = iconRenderData;
|
8392
|
-
iconElement = /* @__PURE__ */ (0,
|
8482
|
+
iconElement = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
8393
8483
|
"img",
|
8394
8484
|
{
|
8395
8485
|
alt: imageObject.alt,
|
@@ -8398,7 +8488,7 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8398
8488
|
}
|
8399
8489
|
);
|
8400
8490
|
} else iconElement = null;
|
8401
|
-
return /* @__PURE__ */ (0,
|
8491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
8402
8492
|
"div",
|
8403
8493
|
{
|
8404
8494
|
className: (0, import_clsx10.default)(TieredProgressBar_default["rebuy-tiered-progress-bar__tier-step"], {
|
@@ -8406,7 +8496,7 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8406
8496
|
}),
|
8407
8497
|
title: `${tierLabel} (${isReached ? "Reached" : "Pending"} at ${formatMoney(getTierMinimum(tier))})`,
|
8408
8498
|
children: [
|
8409
|
-
/* @__PURE__ */ (0,
|
8499
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
8410
8500
|
"div",
|
8411
8501
|
{
|
8412
8502
|
className: TieredProgressBar_default["rebuy-tiered-progress-bar__tier-icon-wrapper"],
|
@@ -8414,13 +8504,13 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8414
8504
|
children: iconElement
|
8415
8505
|
}
|
8416
8506
|
),
|
8417
|
-
/* @__PURE__ */ (0,
|
8507
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__tier-label"], children: tierLabel })
|
8418
8508
|
]
|
8419
8509
|
},
|
8420
8510
|
tier.id
|
8421
8511
|
);
|
8422
8512
|
}) }),
|
8423
|
-
/* @__PURE__ */ (0,
|
8513
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__track"], children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
8424
8514
|
"div",
|
8425
8515
|
{
|
8426
8516
|
"aria-label": "Reward progress",
|
@@ -8434,25 +8524,25 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8434
8524
|
}
|
8435
8525
|
) })
|
8436
8526
|
] }),
|
8437
|
-
/* @__PURE__ */ (0,
|
8527
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { "aria-live": "polite", className: TieredProgressBar_default["rebuy-tiered-progress-bar__feedback-message"], id: feedbackId, children: [
|
8438
8528
|
(isContextLoading || productFetchStatus === "loading") && !feedbackText ? "Loading rewards..." : feedbackText,
|
8439
|
-
productFetchError && /* @__PURE__ */ (0,
|
8529
|
+
productFetchError && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__error-message"], children: [
|
8440
8530
|
"Could not load reward info.",
|
8441
8531
|
rebuyDebugLog.isKeyActive("smart-cart-tpb" /* SC_TPB */) && ` Details: ${productFetchError}`
|
8442
8532
|
] }),
|
8443
|
-
cartSyncError && /* @__PURE__ */ (0,
|
8533
|
+
cartSyncError && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__error-message"], children: [
|
8444
8534
|
"Could not update rewards.",
|
8445
8535
|
rebuyDebugLog.isKeyActive("smart-cart-tpb" /* SC_TPB */) && ` Details: ${cartSyncError}`
|
8446
8536
|
] }),
|
8447
|
-
userActionError && /* @__PURE__ */ (0,
|
8537
|
+
userActionError && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__error-message"], children: [
|
8448
8538
|
"Error: ",
|
8449
8539
|
userActionError.message
|
8450
8540
|
] })
|
8451
8541
|
] }),
|
8452
|
-
renderGiftArea && /* @__PURE__ */ (0,
|
8453
|
-
renderGiftAreaTitle && /* @__PURE__ */ (0,
|
8542
|
+
renderGiftArea && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-area"], children: [
|
8543
|
+
renderGiftAreaTitle && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h3", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-area-title"], id: giftAreaTitleId, children: giftAreaTitle }),
|
8454
8544
|
shouldDisableGiftActions && // If actions are disabled (likely loading something)
|
8455
|
-
productsToRenderInGiftArea.length === 0 && !productFetchError && !cartSyncError && !userActionError && /* @__PURE__ */ (0,
|
8545
|
+
productsToRenderInGiftArea.length === 0 && !productFetchError && !cartSyncError && !userActionError && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
8456
8546
|
"div",
|
8457
8547
|
{
|
8458
8548
|
style: {
|
@@ -8462,12 +8552,12 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8462
8552
|
children: "Loading gifts..."
|
8463
8553
|
}
|
8464
8554
|
),
|
8465
|
-
productsToRenderInGiftArea.length > 0 && /* @__PURE__ */ (0,
|
8555
|
+
productsToRenderInGiftArea.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
8466
8556
|
"div",
|
8467
8557
|
{
|
8468
8558
|
"aria-labelledby": renderGiftAreaTitle ? giftAreaTitleId : void 0,
|
8469
8559
|
className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-items-list"],
|
8470
|
-
children: productsToRenderInGiftArea.map((productState) => /* @__PURE__ */ (0,
|
8560
|
+
children: productsToRenderInGiftArea.map((productState) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
8471
8561
|
TieredProgressBarGiftItem,
|
8472
8562
|
{
|
8473
8563
|
isGloballySyncing: shouldDisableGiftActions,
|
@@ -8481,7 +8571,7 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8481
8571
|
}
|
8482
8572
|
)
|
8483
8573
|
] }),
|
8484
|
-
rebuyDebugLog.isKeyActive("smart-cart-tpb" /* SC_TPB */) && /* @__PURE__ */ (0,
|
8574
|
+
rebuyDebugLog.isKeyActive("smart-cart-tpb" /* SC_TPB */) && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
8485
8575
|
"button",
|
8486
8576
|
{
|
8487
8577
|
onClick: () => setShowDebugPanel(!showDebugPanel),
|
@@ -8493,7 +8583,7 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8493
8583
|
children: showDebugPanel ? "Hide Debug Panel" : "Show Debug Panel"
|
8494
8584
|
}
|
8495
8585
|
),
|
8496
|
-
rebuyDebugLog.isKeyActive("smart-cart-tpb" /* SC_TPB */) && showDebugPanel && /* @__PURE__ */ (0,
|
8586
|
+
rebuyDebugLog.isKeyActive("smart-cart-tpb" /* SC_TPB */) && showDebugPanel && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
8497
8587
|
"div",
|
8498
8588
|
{
|
8499
8589
|
style: {
|
@@ -8504,38 +8594,38 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8504
8594
|
width: "100%"
|
8505
8595
|
},
|
8506
8596
|
children: [
|
8507
|
-
/* @__PURE__ */ (0,
|
8508
|
-
/* @__PURE__ */ (0,
|
8509
|
-
/* @__PURE__ */ (0,
|
8597
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { style: infoText, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: "Progress Bar Debug Info" }) }),
|
8598
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { style: codeBlock, children: [
|
8599
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
8510
8600
|
"Subtotal: ",
|
8511
8601
|
formatMoney(currentSubtotal)
|
8512
8602
|
] }),
|
8513
|
-
/* @__PURE__ */ (0,
|
8603
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
8514
8604
|
"Visual Progress: ",
|
8515
8605
|
visualPercentageComplete.toFixed(0),
|
8516
8606
|
"%"
|
8517
8607
|
] }),
|
8518
|
-
/* @__PURE__ */ (0,
|
8608
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
8519
8609
|
"Actual Progress: ",
|
8520
8610
|
realPercentageComplete.toFixed(0),
|
8521
8611
|
"%"
|
8522
8612
|
] }),
|
8523
|
-
amountToNextTier > 0 && /* @__PURE__ */ (0,
|
8613
|
+
amountToNextTier > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
8524
8614
|
"To Next Tier: ",
|
8525
8615
|
formatMoney(amountToNextTier)
|
8526
8616
|
] }),
|
8527
|
-
currentTier && /* @__PURE__ */ (0,
|
8617
|
+
currentTier && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
8528
8618
|
"Current Tier: ",
|
8529
8619
|
getTierLabel(currentTier)
|
8530
8620
|
] }),
|
8531
|
-
cartSyncError && /* @__PURE__ */ (0,
|
8621
|
+
cartSyncError && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { style: { color: "#f66" }, children: [
|
8532
8622
|
"Error: ",
|
8533
8623
|
cartSyncError
|
8534
8624
|
] })
|
8535
8625
|
] }),
|
8536
|
-
giftsForDisplay.length > 0 && /* @__PURE__ */ (0,
|
8537
|
-
/* @__PURE__ */ (0,
|
8538
|
-
/* @__PURE__ */ (0,
|
8626
|
+
giftsForDisplay.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { style: { marginTop: "8px" }, children: [
|
8627
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { style: infoText, children: "Gift Status:" }),
|
8628
|
+
/* @__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
8629
|
"Tier ",
|
8540
8630
|
gift.tierId,
|
8541
8631
|
": ",
|
@@ -8551,7 +8641,7 @@ var TieredProgressBar = import_react27.default.memo(() => {
|
|
8551
8641
|
TieredProgressBar.displayName = "TieredProgressBar";
|
8552
8642
|
|
8553
8643
|
// src/smart-cart/components/componentRegistry.tsx
|
8554
|
-
var
|
8644
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
8555
8645
|
var componentRegistry = {
|
8556
8646
|
// Use 'any' for props initially, refine later
|
8557
8647
|
announcement_bar: AnnouncementBar,
|
@@ -8570,7 +8660,7 @@ var componentRegistry = {
|
|
8570
8660
|
};
|
8571
8661
|
|
8572
8662
|
// src/smart-cart/components/_Layouts/AnchorSlot.tsx
|
8573
|
-
var
|
8663
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
8574
8664
|
var AnchorSlot = ({ anchor, components, excludeTypes, includeTypes }) => {
|
8575
8665
|
const componentsForSlot = (0, import_react28.useMemo)(() => {
|
8576
8666
|
return components.filter((comp) => {
|
@@ -8588,13 +8678,13 @@ var AnchorSlot = ({ anchor, components, excludeTypes, includeTypes }) => {
|
|
8588
8678
|
});
|
8589
8679
|
return null;
|
8590
8680
|
}
|
8591
|
-
return /* @__PURE__ */ (0,
|
8681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: componentsForSlot.map((componentConfig) => {
|
8592
8682
|
const Component = componentRegistry[componentConfig.type];
|
8593
8683
|
if (!Component) {
|
8594
8684
|
console.warn(`[SmartCartReact] No component registered for type: "${componentConfig.type}"`);
|
8595
8685
|
return null;
|
8596
8686
|
}
|
8597
|
-
return /* @__PURE__ */ (0,
|
8687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Component, { componentConfig }, componentConfig.component_id);
|
8598
8688
|
}) });
|
8599
8689
|
};
|
8600
8690
|
|
@@ -8626,15 +8716,15 @@ var result21 = { "rebuy-smart-cart-layout__anchor-goal-box": "LayoutStyles_rebuy
|
|
8626
8716
|
var LayoutStyles_default = result21;
|
8627
8717
|
|
8628
8718
|
// src/smart-cart/components/_Layouts/DoubleColumnLayout.tsx
|
8629
|
-
var
|
8719
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
8630
8720
|
var DoubleColumnLayout = ({ components, itemCount, layout }) => {
|
8631
8721
|
const scrollAreaRef = (0, import_react30.useRef)(null);
|
8632
8722
|
const isScrolled = useIsScrolled(scrollAreaRef);
|
8633
8723
|
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,
|
8724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: (0, import_clsx11.default)(LayoutStyles_default["rebuy-smart-cart-layout__flyout-inner"], layoutClass), children: [
|
8725
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: LayoutStyles_default["rebuy-smart-cart-layout__column--primary"], children: [
|
8726
|
+
/* @__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 }) }),
|
8727
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
8638
8728
|
"div",
|
8639
8729
|
{
|
8640
8730
|
className: (0, import_clsx11.default)(
|
@@ -8643,26 +8733,26 @@ var DoubleColumnLayout = ({ components, itemCount, layout }) => {
|
|
8643
8733
|
),
|
8644
8734
|
"data-rebuy-cart-scroll-area": true,
|
8645
8735
|
ref: scrollAreaRef,
|
8646
|
-
children: /* @__PURE__ */ (0,
|
8736
|
+
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
8737
|
}
|
8648
8738
|
),
|
8649
|
-
/* @__PURE__ */ (0,
|
8739
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
8650
8740
|
"div",
|
8651
8741
|
{
|
8652
8742
|
className: (0, import_clsx11.default)(LayoutStyles_default["rebuy-smart-cart-layout__anchor-footer"], {
|
8653
8743
|
[LayoutStyles_default["rebuy-smart-cart-layout__anchor-footer--hidden"]]: itemCount === 0
|
8654
8744
|
}),
|
8655
8745
|
"data-rebuy-cart-anchor": "footer",
|
8656
|
-
children: /* @__PURE__ */ (0,
|
8746
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AnchorSlot, { anchor: "footer", components })
|
8657
8747
|
}
|
8658
8748
|
)
|
8659
8749
|
] }),
|
8660
|
-
/* @__PURE__ */ (0,
|
8750
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: LayoutStyles_default["rebuy-smart-cart-layout__column--secondary"], children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
8661
8751
|
"div",
|
8662
8752
|
{
|
8663
8753
|
className: LayoutStyles_default["rebuy-smart-cart-layout__anchor-cross-sells"],
|
8664
8754
|
"data-rebuy-cart-anchor": "crossSells",
|
8665
|
-
children: /* @__PURE__ */ (0,
|
8755
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AnchorSlot, { anchor: "crossSells", components })
|
8666
8756
|
}
|
8667
8757
|
) })
|
8668
8758
|
] });
|
@@ -8671,13 +8761,13 @@ var DoubleColumnLayout = ({ components, itemCount, layout }) => {
|
|
8671
8761
|
// src/smart-cart/components/_Layouts/SingleColumnLayout.tsx
|
8672
8762
|
var import_clsx12 = __toESM(require("clsx"), 1);
|
8673
8763
|
var import_react31 = require("react");
|
8674
|
-
var
|
8764
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
8675
8765
|
var SingleColumnLayout = ({ components, itemCount }) => {
|
8676
8766
|
const scrollAreaRef = (0, import_react31.useRef)(null);
|
8677
8767
|
const isScrolled = useIsScrolled(scrollAreaRef);
|
8678
|
-
return /* @__PURE__ */ (0,
|
8679
|
-
/* @__PURE__ */ (0,
|
8680
|
-
/* @__PURE__ */ (0,
|
8768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
8769
|
+
/* @__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 }) }),
|
8770
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
8681
8771
|
"div",
|
8682
8772
|
{
|
8683
8773
|
className: (0, import_clsx12.default)(
|
@@ -8686,17 +8776,17 @@ var SingleColumnLayout = ({ components, itemCount }) => {
|
|
8686
8776
|
),
|
8687
8777
|
"data-rebuy-cart-scroll-area": true,
|
8688
8778
|
ref: scrollAreaRef,
|
8689
|
-
children: /* @__PURE__ */ (0,
|
8779
|
+
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
8780
|
}
|
8691
8781
|
),
|
8692
|
-
/* @__PURE__ */ (0,
|
8782
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
8693
8783
|
"div",
|
8694
8784
|
{
|
8695
8785
|
className: (0, import_clsx12.default)(LayoutStyles_default["rebuy-smart-cart-layout__anchor-footer"], {
|
8696
8786
|
[LayoutStyles_default["rebuy-smart-cart-layout__anchor-footer--hidden"]]: itemCount === 0
|
8697
8787
|
}),
|
8698
8788
|
"data-rebuy-cart-anchor": "footer",
|
8699
|
-
children: /* @__PURE__ */ (0,
|
8789
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AnchorSlot, { anchor: "footer", components })
|
8700
8790
|
}
|
8701
8791
|
)
|
8702
8792
|
] });
|
@@ -8707,7 +8797,7 @@ var result22 = { "rebuy-smart-cart": "SmartCartContainer_rebuy-smart-cart", "reb
|
|
8707
8797
|
var SmartCartContainer_default = result22;
|
8708
8798
|
|
8709
8799
|
// src/smart-cart/components/SmartCartContainer/SmartCartContainer.tsx
|
8710
|
-
var
|
8800
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
8711
8801
|
var SmartCartContainer = ({ containerId }) => {
|
8712
8802
|
const { config, getItemCount, hideCart, isVisible } = useSmartCart();
|
8713
8803
|
const containerRef = (0, import_react32.useRef)(null);
|
@@ -8728,6 +8818,16 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8728
8818
|
}
|
8729
8819
|
}
|
8730
8820
|
}, [isVisible]);
|
8821
|
+
(0, import_react32.useEffect)(() => {
|
8822
|
+
if (isVisible) {
|
8823
|
+
document.body.classList.add("rebuy-smart-cart-open");
|
8824
|
+
} else {
|
8825
|
+
document.body.classList.remove("rebuy-smart-cart-open");
|
8826
|
+
}
|
8827
|
+
return () => {
|
8828
|
+
document.body.classList.remove("rebuy-smart-cart-open");
|
8829
|
+
};
|
8830
|
+
}, [isVisible]);
|
8731
8831
|
const backgroundClassName = (0, import_clsx13.default)(SmartCartContainer_default["rebuy-smart-cart__overlay-background"], {
|
8732
8832
|
[SmartCartContainer_default["rebuy-smart-cart__overlay-background--visible"]]: isVisible
|
8733
8833
|
});
|
@@ -8740,21 +8840,21 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8740
8840
|
}
|
8741
8841
|
);
|
8742
8842
|
const renderLayoutContent = () => {
|
8743
|
-
if (!config) return /* @__PURE__ */ (0,
|
8843
|
+
if (!config) return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { style: { padding: "20px", textAlign: "center" }, children: "Loading configuration..." });
|
8744
8844
|
switch (config.layout) {
|
8745
8845
|
case "double":
|
8746
8846
|
case "double-right":
|
8747
|
-
return /* @__PURE__ */ (0,
|
8847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DoubleColumnLayout, { components, itemCount: getItemCount(), layout: config.layout });
|
8748
8848
|
default:
|
8749
|
-
return /* @__PURE__ */ (0,
|
8849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SingleColumnLayout, { components, itemCount: getItemCount() });
|
8750
8850
|
}
|
8751
8851
|
};
|
8752
8852
|
const defaultTitleId = "rebuy-smart-cart-default-title";
|
8753
8853
|
const titleBarComponent = components.find((c) => c.type === "title_bar");
|
8754
8854
|
const ariaLabelledBy = titleBarComponent ? `rebuy-title-${titleBarComponent.component_id}` : defaultTitleId;
|
8755
|
-
return /* @__PURE__ */ (0,
|
8756
|
-
/* @__PURE__ */ (0,
|
8757
|
-
/* @__PURE__ */ (0,
|
8855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react32.default.Fragment, { children: [
|
8856
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: backgroundClassName, onClick: handleClose }),
|
8857
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
8758
8858
|
"div",
|
8759
8859
|
{
|
8760
8860
|
"aria-labelledby": ariaLabelledBy,
|
@@ -8766,15 +8866,15 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8766
8866
|
role: "dialog",
|
8767
8867
|
tabIndex: -1,
|
8768
8868
|
children: [
|
8769
|
-
/* @__PURE__ */ (0,
|
8770
|
-
/* @__PURE__ */ (0,
|
8771
|
-
/* @__PURE__ */ (0,
|
8772
|
-
/* @__PURE__ */ (0,
|
8869
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("header", { className: SmartCartContainer_default["rebuy-smart-cart__header"], "data-rebuy-cart-anchor": "header", children: [
|
8870
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: SmartCartContainer_default["rebuy-smart-cart__header-top-bar"], "data-rebuy-cart-header-top-bar": "", children: [
|
8871
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: SmartCartContainer_default["rebuy-smart-cart__header-content"], "data-rebuy-cart-header-top-inner": "", children: [
|
8872
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AnchorSlot, { anchor: "header", components, includeTypes: ["title_bar", "login"] }),
|
8773
8873
|
!components.some(
|
8774
8874
|
(c) => c.type === "title_bar" && !c.settings?.screen_reader_only
|
8775
|
-
) && /* @__PURE__ */ (0,
|
8875
|
+
) && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h2", { id: defaultTitleId, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ScreenReaderText, { children: "Your Cart" }) })
|
8776
8876
|
] }),
|
8777
|
-
/* @__PURE__ */ (0,
|
8877
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
8778
8878
|
"button",
|
8779
8879
|
{
|
8780
8880
|
"aria-label": "Close Cart",
|
@@ -8784,15 +8884,15 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8784
8884
|
type: "button",
|
8785
8885
|
children: [
|
8786
8886
|
"\u2715",
|
8787
|
-
/* @__PURE__ */ (0,
|
8887
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ScreenReaderText, { children: "Close Cart" })
|
8788
8888
|
]
|
8789
8889
|
}
|
8790
8890
|
)
|
8791
8891
|
] }),
|
8792
|
-
/* @__PURE__ */ (0,
|
8892
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AnchorSlot, { anchor: "header", components, excludeTypes: ["title_bar", "login"] })
|
8793
8893
|
] }),
|
8794
8894
|
renderLayoutContent(),
|
8795
|
-
/* @__PURE__ */ (0,
|
8895
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { "aria-live": "polite", className: "rebuy-sr-only", id: "rebuy-cart-live-region" })
|
8796
8896
|
]
|
8797
8897
|
}
|
8798
8898
|
)
|
@@ -8800,28 +8900,50 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8800
8900
|
};
|
8801
8901
|
|
8802
8902
|
// src/smart-cart/RebuySmartCart.tsx
|
8803
|
-
var
|
8903
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
8804
8904
|
var RebuySmartCart = () => {
|
8805
|
-
return /* @__PURE__ */ (0,
|
8905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SmartCartContainer, {});
|
8806
8906
|
};
|
8807
8907
|
|
8808
8908
|
// src/widgetContainer/RebuyWidgetContainer.tsx
|
8809
8909
|
var import_rebuy3 = require("@rebuy/rebuy");
|
8810
8910
|
var Utilities5 = __toESM(require("@rebuy/rebuy/utilities"), 1);
|
8811
8911
|
var import_hydrogen7 = require("@shopify/hydrogen");
|
8812
|
-
var
|
8912
|
+
var import_react34 = require("react");
|
8913
|
+
|
8914
|
+
// src/context/RebuyWidgetContext.tsx
|
8915
|
+
var import_react33 = require("react");
|
8916
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
8917
|
+
var RebuyWidgetContext = (0, import_react33.createContext)({
|
8918
|
+
dataSource: "",
|
8919
|
+
isHydrogenReact: false,
|
8920
|
+
key: "",
|
8921
|
+
limit: 0,
|
8922
|
+
metadata: {},
|
8923
|
+
options: {},
|
8924
|
+
products: [],
|
8925
|
+
variant: void 0,
|
8926
|
+
variantId: void 0
|
8927
|
+
});
|
8928
|
+
var useRebuyWidget = () => (0, import_react33.useContext)(RebuyWidgetContext);
|
8929
|
+
var RebuyWidgetProvider = ({ children, value }) => {
|
8930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(RebuyWidgetContext.Provider, { value, children });
|
8931
|
+
};
|
8932
|
+
|
8933
|
+
// src/widgetContainer/RebuyWidgetContainer.tsx
|
8934
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
8813
8935
|
var RebuyWidgetContainerBase = ({ children, ...props }) => {
|
8814
8936
|
const { collection, collectionId, dataSource, limit, options, product, productId, variant, variantId } = props;
|
8815
8937
|
const { apiKey, loadingStatus: configLoadingStatus, rebuyConfig } = useRebuyConfig();
|
8816
|
-
const rebuyContext = (0,
|
8817
|
-
const [rebuyApiClient, setRebuyApiClient] = (0,
|
8818
|
-
const [initialized, setInitialized] = (0,
|
8938
|
+
const rebuyContext = (0, import_react34.useContext)(RebuyContext);
|
8939
|
+
const [rebuyApiClient, setRebuyApiClient] = (0, import_react34.useState)(null);
|
8940
|
+
const [initialized, setInitialized] = (0, import_react34.useState)(false);
|
8819
8941
|
const shopifyProductId = product?.id ?? productId ?? null;
|
8820
8942
|
const shopifyVariantId = variant?.id ?? variantId ?? null;
|
8821
8943
|
const shopifyCollectionId = collection?.id ?? collectionId ?? null;
|
8822
|
-
const [products, setProducts] = (0,
|
8823
|
-
const [metadata, setMetadata] = (0,
|
8824
|
-
(0,
|
8944
|
+
const [products, setProducts] = (0, import_react34.useState)([]);
|
8945
|
+
const [metadata, setMetadata] = (0, import_react34.useState)();
|
8946
|
+
(0, import_react34.useEffect)(() => {
|
8825
8947
|
if (!rebuyApiClient && apiKey && configLoadingStatus === "success") {
|
8826
8948
|
const client = new import_rebuy3.RebuyClient(apiKey);
|
8827
8949
|
const currentEndpoint = dataSource || "/api/v1/products/recommended";
|
@@ -8836,14 +8958,14 @@ var RebuyWidgetContainerBase = ({ children, ...props }) => {
|
|
8836
8958
|
setInitialized(true);
|
8837
8959
|
}
|
8838
8960
|
}, [apiKey, rebuyApiClient, configLoadingStatus, options, rebuyContext, dataSource]);
|
8839
|
-
(0,
|
8961
|
+
(0, import_react34.useEffect)(() => {
|
8840
8962
|
if (rebuyApiClient && rebuyContext?.contextParameters) {
|
8841
8963
|
const currentEndpoint = dataSource || "/api/v1/products/recommended";
|
8842
8964
|
const filteredParams = filterContextForWidgetEndpoints(rebuyContext.contextParameters, currentEndpoint);
|
8843
8965
|
rebuyApiClient.setContextParameters(filteredParams);
|
8844
8966
|
}
|
8845
8967
|
}, [rebuyApiClient, rebuyContext, dataSource]);
|
8846
|
-
const request = (0,
|
8968
|
+
const request = (0, import_react34.useMemo)(() => {
|
8847
8969
|
const req = {
|
8848
8970
|
endpoint: dataSource || "/api/v1/products/recommended",
|
8849
8971
|
params: {}
|
@@ -8863,7 +8985,7 @@ var RebuyWidgetContainerBase = ({ children, ...props }) => {
|
|
8863
8985
|
}
|
8864
8986
|
return req;
|
8865
8987
|
}, [dataSource, shopifyProductId, shopifyVariantId, shopifyCollectionId, limit]);
|
8866
|
-
(0,
|
8988
|
+
(0, import_react34.useEffect)(() => {
|
8867
8989
|
let isMounted = true;
|
8868
8990
|
if (!rebuyApiClient || !initialized || configLoadingStatus !== "success") return;
|
8869
8991
|
const fetchData = async () => {
|
@@ -8896,22 +9018,30 @@ var RebuyWidgetContainerBase = ({ children, ...props }) => {
|
|
8896
9018
|
isMounted = false;
|
8897
9019
|
};
|
8898
9020
|
}, [rebuyApiClient, initialized, request, configLoadingStatus]);
|
8899
|
-
const childrenWithProps = (currentProps) => import_react33.default.Children.map(
|
8900
|
-
children,
|
8901
|
-
(child) => import_react33.default.isValidElement(child) ? import_react33.default.cloneElement(child, currentProps) : child
|
8902
|
-
);
|
8903
|
-
const childProps = {
|
8904
|
-
...props,
|
8905
|
-
apiKey,
|
8906
|
-
cacheKey: rebuyConfig?.shop?.cache_key,
|
8907
|
-
key: product?.id,
|
8908
|
-
metadata,
|
8909
|
-
products
|
8910
|
-
};
|
8911
9021
|
if (configLoadingStatus !== "success" || !rebuyApiClient) {
|
8912
9022
|
return null;
|
8913
9023
|
}
|
8914
|
-
return
|
9024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
9025
|
+
RebuyWidgetProvider,
|
9026
|
+
{
|
9027
|
+
value: {
|
9028
|
+
apiKey: apiKey ?? void 0,
|
9029
|
+
cacheKey: rebuyConfig?.shop?.cache_key,
|
9030
|
+
dataSource: dataSource || "/api/v1/products/recommended",
|
9031
|
+
isHydrogenReact: rebuyContext?.contextParameters?.isHydrogenReact || false,
|
9032
|
+
key: product?.id || "",
|
9033
|
+
limit: limit || 0,
|
9034
|
+
metadata: metadata || {},
|
9035
|
+
options: options || {},
|
9036
|
+
product,
|
9037
|
+
productId,
|
9038
|
+
products,
|
9039
|
+
variant,
|
9040
|
+
variantId
|
9041
|
+
},
|
9042
|
+
children
|
9043
|
+
}
|
9044
|
+
);
|
8915
9045
|
};
|
8916
9046
|
var RebuyWidgetContainer = RebuyWidgetContainerBase;
|
8917
9047
|
|
@@ -8920,45 +9050,69 @@ var result23 = { "container": "RebuyCompleteTheLook_container", "productGrid": "
|
|
8920
9050
|
var RebuyCompleteTheLook_default = result23;
|
8921
9051
|
|
8922
9052
|
// src/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.tsx
|
8923
|
-
var
|
9053
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
8924
9054
|
var RebuyCompleteTheLook = (props) => {
|
8925
9055
|
const {
|
8926
9056
|
addToCartBtnText = "Add to cart",
|
8927
9057
|
addToCartCallback,
|
8928
|
-
customTitle = `These pair with
|
9058
|
+
customTitle = `These pair with {product_title}`,
|
8929
9059
|
customTitleLevel = "h2",
|
8930
|
-
customTitleStyle
|
8931
|
-
products = []
|
9060
|
+
customTitleStyle
|
8932
9061
|
} = props;
|
9062
|
+
const { isHydrogenReact, product, products } = useRebuyWidget();
|
9063
|
+
const productTitle = customTitle.replace("{product_title}", product?.title ?? "");
|
8933
9064
|
if (products.length === 0) {
|
8934
9065
|
rebuyDebugLog.log("widget-complete-the-look" /* WIDGET_COMPLETE_THE_LOOK */, "RebuyCompleteTheLook: No products found");
|
8935
9066
|
return null;
|
8936
9067
|
}
|
8937
|
-
return /* @__PURE__ */ (0,
|
8938
|
-
/* @__PURE__ */ (0,
|
8939
|
-
/* @__PURE__ */ (0,
|
9068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("section", { className: RebuyCompleteTheLook_default.container, children: [
|
9069
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: productTitle }),
|
9070
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("ul", { className: RebuyCompleteTheLook_default.productGrid, children: products.map((product2) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("li", { className: RebuyCompleteTheLook_default.productItem, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
8940
9071
|
ProductCard,
|
8941
9072
|
{
|
8942
9073
|
addToCartBtnText,
|
8943
9074
|
addToCartCallback,
|
8944
|
-
isHydrogenReact
|
8945
|
-
product,
|
9075
|
+
isHydrogenReact,
|
9076
|
+
product: product2,
|
8946
9077
|
productCardTitleLevel: getTitleLevel(customTitleLevel, true)
|
8947
9078
|
}
|
8948
|
-
) },
|
9079
|
+
) }, product2.id)) })
|
8949
9080
|
] });
|
8950
9081
|
};
|
8951
9082
|
|
8952
9083
|
// src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.tsx
|
8953
|
-
var
|
9084
|
+
var import_react36 = require("react");
|
8954
9085
|
|
8955
9086
|
// src/utils/convertToRebuyProduct.tsx
|
8956
9087
|
var convertToRebuyProduct = (isHydrogenReact, product) => {
|
8957
|
-
const mainProductVariants = isHydrogenReact ? product?.variants?.nodes?.map((variant) => {
|
8958
|
-
|
8959
|
-
|
8960
|
-
|
8961
|
-
|
9088
|
+
const mainProductVariants = isHydrogenReact ? product?.variants?.nodes?.map((variant) => ({
|
9089
|
+
availableForSale: variant.availableForSale,
|
9090
|
+
compareAtPriceV2: {
|
9091
|
+
amount: variant.compareAtPrice?.amount || "",
|
9092
|
+
currencyCode: variant.compareAtPrice?.currencyCode || "USD"
|
9093
|
+
},
|
9094
|
+
id: variant.id,
|
9095
|
+
image: variant.image ? {
|
9096
|
+
altText: variant.image.altText || null,
|
9097
|
+
height: variant.image.height || 100,
|
9098
|
+
id: variant.image.id || "",
|
9099
|
+
url: variant.image.url || "",
|
9100
|
+
width: variant.image.width || 100
|
9101
|
+
} : void 0,
|
9102
|
+
priceV2: {
|
9103
|
+
amount: variant.price.amount,
|
9104
|
+
currencyCode: variant.price.currencyCode
|
9105
|
+
},
|
9106
|
+
product: {
|
9107
|
+
handle: product.handle,
|
9108
|
+
id: product.id,
|
9109
|
+
title: product.title,
|
9110
|
+
vendor: product.vendor
|
9111
|
+
},
|
9112
|
+
selectedOptions: variant.selectedOptions,
|
9113
|
+
sku: variant.sku || "",
|
9114
|
+
title: variant.title
|
9115
|
+
})) || [] : product?.adjacentVariants.map((variant) => {
|
8962
9116
|
return {
|
8963
9117
|
availableForSale: variant.availableForSale,
|
8964
9118
|
compareAtPriceV2: {
|
@@ -9022,26 +9176,28 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
|
|
9022
9176
|
selected: true,
|
9023
9177
|
selectedOptions: product?.selectedVariant?.selectedOptions?.reduce((acc, option) => {
|
9024
9178
|
return { ...acc, [option.name]: option.value };
|
9179
|
+
}, {}) || product?.variants?.nodes[0]?.selectedOptions?.reduce((acc, option) => {
|
9180
|
+
return { ...acc, [option.name]: option.value };
|
9025
9181
|
}, {}) || {},
|
9026
9182
|
selectedSellingPlan: {},
|
9027
9183
|
selectedSellingPlanAllocation: {},
|
9028
9184
|
selectedVariant: {
|
9029
|
-
availableForSale: product?.selectedVariant?.availableForSale || false,
|
9185
|
+
availableForSale: product?.selectedVariant?.availableForSale || product?.variants?.nodes[0]?.availableForSale || false,
|
9030
9186
|
compareAtPriceV2: {
|
9031
|
-
amount: product?.selectedVariant?.compareAtPrice?.amount || "",
|
9032
|
-
currencyCode: product?.selectedVariant?.compareAtPrice?.currencyCode || "USD"
|
9187
|
+
amount: product?.selectedVariant?.compareAtPrice?.amount || product?.variants?.nodes[0]?.compareAtPrice?.amount || "",
|
9188
|
+
currencyCode: product?.selectedVariant?.compareAtPrice?.currencyCode || product?.variants?.nodes[0]?.compareAtPrice?.currencyCode || "USD"
|
9033
9189
|
},
|
9034
9190
|
id: product?.selectedVariant?.id || "",
|
9035
9191
|
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
|
9192
|
+
altText: product?.selectedVariant?.image?.altText || product?.variants?.nodes[0]?.image?.altText || "",
|
9193
|
+
height: product?.selectedVariant?.image?.height || product?.variants?.nodes[0]?.image?.height || 100,
|
9194
|
+
id: product?.selectedVariant?.image?.id || product?.variants?.nodes[0]?.image?.id || "",
|
9195
|
+
url: product?.selectedVariant?.image?.url || product?.variants?.nodes[0]?.image?.url || "",
|
9196
|
+
width: product?.selectedVariant?.image?.width || product?.variants?.nodes[0]?.image?.width || 100
|
9041
9197
|
},
|
9042
9198
|
priceV2: {
|
9043
|
-
amount: product?.selectedVariant?.price.amount || "",
|
9044
|
-
currencyCode: product?.selectedVariant?.price.currencyCode || "USD"
|
9199
|
+
amount: product?.selectedVariant?.price.amount || product?.variants?.nodes[0]?.price.amount || "",
|
9200
|
+
currencyCode: product?.selectedVariant?.price.currencyCode || product?.variants?.nodes[0]?.price.currencyCode || "USD"
|
9045
9201
|
},
|
9046
9202
|
product: {
|
9047
9203
|
handle: product?.handle || "",
|
@@ -9049,9 +9205,9 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
|
|
9049
9205
|
title: product?.title || "",
|
9050
9206
|
vendor: product?.vendor || ""
|
9051
9207
|
},
|
9052
|
-
selectedOptions: product?.selectedVariant?.selectedOptions || [],
|
9053
|
-
sku: product?.selectedVariant?.sku || "",
|
9054
|
-
title: product?.selectedVariant?.title || ""
|
9208
|
+
selectedOptions: product?.selectedVariant?.selectedOptions || product?.variants?.nodes[0]?.selectedOptions || [],
|
9209
|
+
sku: product?.selectedVariant?.sku || product?.variants?.nodes[0]?.sku || "",
|
9210
|
+
title: product?.selectedVariant?.title || product?.variants?.nodes[0]?.title || ""
|
9055
9211
|
},
|
9056
9212
|
sellingPlanGroups: [],
|
9057
9213
|
seo: {
|
@@ -9177,20 +9333,19 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
|
|
9177
9333
|
|
9178
9334
|
// src/widgets/RebuyDynamicBundleProducts/BundleImages.tsx
|
9179
9335
|
var import_hydrogen8 = require("@shopify/hydrogen");
|
9180
|
-
var
|
9181
|
-
var import_react_router9 = require("react-router");
|
9336
|
+
var import_react35 = require("react");
|
9182
9337
|
|
9183
9338
|
// src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.module.css
|
9184
9339
|
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
9340
|
var RebuyDynamicBundleProducts_default = result24;
|
9186
9341
|
|
9187
9342
|
// src/widgets/RebuyDynamicBundleProducts/BundleImages.tsx
|
9188
|
-
var
|
9343
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
9189
9344
|
var BundleImages = ({ products }) => {
|
9190
9345
|
const selected = products.filter((product) => product.selected);
|
9191
|
-
return /* @__PURE__ */ (0,
|
9346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("ul", { className: RebuyDynamicBundleProducts_default.bundleImages, children: products.map((product, index) => {
|
9192
9347
|
const image = product.selectedVariant?.image;
|
9193
|
-
const productImage = image ? /* @__PURE__ */ (0,
|
9348
|
+
const productImage = image ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
9194
9349
|
import_hydrogen8.Image,
|
9195
9350
|
{
|
9196
9351
|
alt: image.altText || `Picture of ${product.title}`,
|
@@ -9205,24 +9360,79 @@ var BundleImages = ({ products }) => {
|
|
9205
9360
|
product.title
|
9206
9361
|
);
|
9207
9362
|
const showDelimiter = selected[0]?.id !== product.id;
|
9208
|
-
return /* @__PURE__ */ (0,
|
9209
|
-
showDelimiter && /* @__PURE__ */ (0,
|
9210
|
-
/* @__PURE__ */ (0,
|
9363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react35.Fragment, { children: product.selected && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
9364
|
+
showDelimiter && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("li", { className: RebuyDynamicBundleProducts_default.bundleImageDelimiter, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "+" }) }),
|
9365
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("li", { className: "flex items-center", children: product.default ? (
|
9211
9366
|
// Already on product page
|
9212
9367
|
productImage
|
9213
9368
|
) : (
|
9214
9369
|
// Link to product
|
9215
|
-
/* @__PURE__ */ (0,
|
9370
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
9371
|
+
RebuyLink,
|
9372
|
+
{
|
9373
|
+
ariaLabel: `View ${product.title}`,
|
9374
|
+
handle: `/products/${product.handle}`,
|
9375
|
+
children: productImage
|
9376
|
+
}
|
9377
|
+
)
|
9216
9378
|
) })
|
9217
9379
|
] }) }, product.id + "-BundleImages-" + index);
|
9218
9380
|
}) });
|
9219
9381
|
};
|
9220
9382
|
|
9383
|
+
// src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx
|
9384
|
+
var import_hydrogen9 = require("@shopify/hydrogen");
|
9385
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
9386
|
+
var BundlePrice = ({ products }) => {
|
9387
|
+
const isDisabled = products.filter((product) => product.selected).length < 1;
|
9388
|
+
const totalBundlePrice = () => {
|
9389
|
+
let total = 0;
|
9390
|
+
let currencyCode = "USD";
|
9391
|
+
for (const product of products) {
|
9392
|
+
if (product.selected && product.selectedVariant) {
|
9393
|
+
const { priceV2: price2 } = product.selectedVariant;
|
9394
|
+
total += Number(price2?.amount);
|
9395
|
+
currencyCode = price2?.currencyCode || "USD";
|
9396
|
+
}
|
9397
|
+
}
|
9398
|
+
return {
|
9399
|
+
amount: String(total),
|
9400
|
+
currencyCode
|
9401
|
+
};
|
9402
|
+
};
|
9403
|
+
const totalBundleCompareAtPrice = () => {
|
9404
|
+
let compareAtTotal = 0;
|
9405
|
+
let currencyCode = "USD";
|
9406
|
+
for (const product of products) {
|
9407
|
+
if (product.selected && product.selectedVariant) {
|
9408
|
+
const { compareAtPriceV2: compareAtPrice2, priceV2: price2 } = product.selectedVariant;
|
9409
|
+
currencyCode = price2?.currencyCode || "USD";
|
9410
|
+
compareAtTotal += Number((compareAtPrice2 || price2)?.amount);
|
9411
|
+
}
|
9412
|
+
}
|
9413
|
+
return {
|
9414
|
+
amount: String(compareAtTotal),
|
9415
|
+
currencyCode
|
9416
|
+
};
|
9417
|
+
};
|
9418
|
+
const isDiscounted = (price2, compareAtPrice2) => Number(compareAtPrice2?.amount) > Number(price2?.amount);
|
9419
|
+
const price = totalBundlePrice();
|
9420
|
+
const compareAtPrice = totalBundleCompareAtPrice();
|
9421
|
+
const CompareAtPrice = ({ data: compareAtPrice2 }) => {
|
9422
|
+
return compareAtPrice2 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_hydrogen9.Money, { as: "span", className: RebuyDynamicBundleProducts_default.compareAtPrice, data: compareAtPrice2, withoutTrailingZeros: true });
|
9423
|
+
};
|
9424
|
+
return products.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "flex items-center flex-col", children: !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("p", { className: "flex items-center gap-2 mb-2", children: [
|
9425
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Total Price:" }),
|
9426
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_hydrogen9.Money, { as: "span", data: price, withoutTrailingZeros: true }),
|
9427
|
+
isDiscounted(price, compareAtPrice) && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CompareAtPrice, { data: compareAtPrice })
|
9428
|
+
] }) });
|
9429
|
+
};
|
9430
|
+
|
9221
9431
|
// src/widgets/RebuyDynamicBundleProducts/BundleSelection.tsx
|
9222
9432
|
var import_clsx14 = __toESM(require("clsx"), 1);
|
9223
9433
|
|
9224
9434
|
// src/widgets/RebuyDynamicBundleProducts/Select.tsx
|
9225
|
-
var
|
9435
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
9226
9436
|
var Select = ({ onSelectVariant, product }) => {
|
9227
9437
|
const getOptionsLabel = (product2) => {
|
9228
9438
|
const options = product2.variants.nodes[0].selectedOptions;
|
@@ -9231,30 +9441,30 @@ var Select = ({ onSelectVariant, product }) => {
|
|
9231
9441
|
const useValues = optionsFromKeys.every((key) => ["name", "value"].includes(key));
|
9232
9442
|
return (useValues ? optionsFromValues : optionsFromKeys).join(" / ");
|
9233
9443
|
};
|
9234
|
-
return product && /* @__PURE__ */ (0,
|
9444
|
+
return product && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
9235
9445
|
"select",
|
9236
9446
|
{
|
9237
9447
|
"aria-label": "select variant",
|
9238
9448
|
className: RebuyDynamicBundleProducts_default.select,
|
9239
9449
|
onChange: (e) => onSelectVariant(product, e.target.value),
|
9240
9450
|
value: product.selectedVariant.id,
|
9241
|
-
children: /* @__PURE__ */ (0,
|
9451
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("optgroup", { label: getOptionsLabel(product), children: product.variants.nodes.map(({ id, title }) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("option", { value: id, children: title }, id + "-BundleVariant")) })
|
9242
9452
|
}
|
9243
9453
|
);
|
9244
9454
|
};
|
9245
9455
|
|
9246
9456
|
// src/widgets/RebuyDynamicBundleProducts/BundleSelection.tsx
|
9247
|
-
var
|
9457
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
9248
9458
|
var BundleSelection = ({ onSelectVariant, onToggleBundleItem, products }) => {
|
9249
|
-
return /* @__PURE__ */ (0,
|
9459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("ul", { children: products.map((product, index) => {
|
9250
9460
|
const { availableForSale } = product.selectedVariant;
|
9251
9461
|
const isOutOfStock = !availableForSale;
|
9252
|
-
return /* @__PURE__ */ (0,
|
9462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
9253
9463
|
"li",
|
9254
9464
|
{
|
9255
9465
|
className: (0, import_clsx14.default)(RebuyDynamicBundleProducts_default.bundleItemRowContainer, !product.selected && RebuyDynamicBundleProducts_default.unselected),
|
9256
|
-
children: /* @__PURE__ */ (0,
|
9257
|
-
/* @__PURE__ */ (0,
|
9466
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: RebuyDynamicBundleProducts_default.bundleItemRow, children: [
|
9467
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
9258
9468
|
"input",
|
9259
9469
|
{
|
9260
9470
|
checked: product.selected && availableForSale,
|
@@ -9266,14 +9476,14 @@ var BundleSelection = ({ onSelectVariant, onToggleBundleItem, products }) => {
|
|
9266
9476
|
value: product.id
|
9267
9477
|
}
|
9268
9478
|
),
|
9269
|
-
/* @__PURE__ */ (0,
|
9270
|
-
/* @__PURE__ */ (0,
|
9271
|
-
isOutOfStock && /* @__PURE__ */ (0,
|
9272
|
-
product.default && /* @__PURE__ */ (0,
|
9479
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: RebuyDynamicBundleProducts_default.bundleItemInput, children: [
|
9480
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: RebuyDynamicBundleProducts_default.bundleItemLabel, htmlFor: `${product.id}-toggle`, children: [
|
9481
|
+
isOutOfStock && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("b", { children: "SOLD OUT" }),
|
9482
|
+
product.default && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("b", { children: "This item:" }),
|
9273
9483
|
product.title,
|
9274
|
-
/* @__PURE__ */ (0,
|
9484
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(RebuyProductPrice, { selectedVariant: product.selectedVariant })
|
9275
9485
|
] }),
|
9276
|
-
product.variants.nodes.length > 1 && /* @__PURE__ */ (0,
|
9486
|
+
product.variants.nodes.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Select, { onSelectVariant, product })
|
9277
9487
|
] })
|
9278
9488
|
] })
|
9279
9489
|
},
|
@@ -9282,69 +9492,20 @@ var BundleSelection = ({ onSelectVariant, onToggleBundleItem, products }) => {
|
|
9282
9492
|
}) });
|
9283
9493
|
};
|
9284
9494
|
|
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
9495
|
// src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.tsx
|
9334
|
-
var
|
9496
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
9335
9497
|
var RebuyDynamicBundleProducts = (props) => {
|
9336
9498
|
const {
|
9337
9499
|
addToCartBtnText = "Add to cart",
|
9338
9500
|
addToCartCallback,
|
9339
|
-
customTitle = `These pair with
|
9501
|
+
customTitle = `These pair with {product_title}`,
|
9340
9502
|
customTitleLevel = "h2",
|
9341
|
-
customTitleStyle
|
9342
|
-
isHydrogenReact,
|
9343
|
-
product,
|
9344
|
-
products = []
|
9503
|
+
customTitleStyle
|
9345
9504
|
} = props;
|
9346
|
-
const
|
9347
|
-
|
9505
|
+
const { isHydrogenReact, product, products } = useRebuyWidget();
|
9506
|
+
const productTitle = customTitle.replace("{product_title}", product?.title ?? "");
|
9507
|
+
const [bundleProducts, setBundleProducts] = (0, import_react36.useState)([]);
|
9508
|
+
(0, import_react36.useEffect)(() => {
|
9348
9509
|
const mainProduct = convertToRebuyProduct(isHydrogenReact || false, product);
|
9349
9510
|
const formattedProducts = products.map((product2) => {
|
9350
9511
|
return {
|
@@ -9355,14 +9516,14 @@ var RebuyDynamicBundleProducts = (props) => {
|
|
9355
9516
|
});
|
9356
9517
|
setBundleProducts([mainProduct, ...formattedProducts]);
|
9357
9518
|
}, [product, products, isHydrogenReact]);
|
9358
|
-
const onToggleBundleItem = (0,
|
9519
|
+
const onToggleBundleItem = (0, import_react36.useCallback)(
|
9359
9520
|
(product2) => {
|
9360
9521
|
product2.selected = !product2.selected;
|
9361
9522
|
setBundleProducts([...bundleProducts]);
|
9362
9523
|
},
|
9363
9524
|
[bundleProducts]
|
9364
9525
|
);
|
9365
|
-
const onSelectVariant = (0,
|
9526
|
+
const onSelectVariant = (0, import_react36.useCallback)(
|
9366
9527
|
(product2, variant_id) => {
|
9367
9528
|
const variant = product2.variants.nodes.find(({ id }) => id === variant_id);
|
9368
9529
|
if (variant) {
|
@@ -9377,12 +9538,12 @@ var RebuyDynamicBundleProducts = (props) => {
|
|
9377
9538
|
rebuyDebugLog.log("widget-dynamic-bundle-products" /* WIDGET_DYNAMIC_BUNDLE_PRODUCTS */, "RebuyDynamicBundleProducts: No products found");
|
9378
9539
|
return null;
|
9379
9540
|
}
|
9380
|
-
return /* @__PURE__ */ (0,
|
9381
|
-
/* @__PURE__ */ (0,
|
9382
|
-
/* @__PURE__ */ (0,
|
9383
|
-
/* @__PURE__ */ (0,
|
9384
|
-
/* @__PURE__ */ (0,
|
9385
|
-
/* @__PURE__ */ (0,
|
9541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("section", { className: RebuyDynamicBundleProducts_default.container, children: [
|
9542
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: productTitle }),
|
9543
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: RebuyDynamicBundleProducts_default.bundleContainer, children: [
|
9544
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(BundleImages, { products: bundleProducts }),
|
9545
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(BundlePrice, { products: bundleProducts }),
|
9546
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: RebuyDynamicBundleProducts_default.addCartBtnContainer, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
9386
9547
|
AddToCartBtn,
|
9387
9548
|
{
|
9388
9549
|
addToCartBtnText,
|
@@ -9394,7 +9555,7 @@ var RebuyDynamicBundleProducts = (props) => {
|
|
9394
9555
|
})
|
9395
9556
|
}
|
9396
9557
|
) }),
|
9397
|
-
/* @__PURE__ */ (0,
|
9558
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
9398
9559
|
BundleSelection,
|
9399
9560
|
{
|
9400
9561
|
onSelectVariant,
|
@@ -9408,18 +9569,17 @@ var RebuyDynamicBundleProducts = (props) => {
|
|
9408
9569
|
|
9409
9570
|
// src/widgets/RebuyProductAddOns/RebuyProductAddOns.tsx
|
9410
9571
|
var import_hydrogen_react3 = require("@shopify/hydrogen-react");
|
9411
|
-
var
|
9572
|
+
var import_react37 = require("react");
|
9412
9573
|
|
9413
9574
|
// src/widgets/RebuyProductAddOns/RebuyProductAddOnCard.tsx
|
9414
9575
|
var import_hydrogen10 = require("@shopify/hydrogen");
|
9415
|
-
var import_react_router10 = require("react-router");
|
9416
9576
|
|
9417
9577
|
// src/widgets/RebuyProductAddOns/RebuyProductAddOns.module.css
|
9418
9578
|
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
9579
|
var RebuyProductAddOns_default = result25;
|
9420
9580
|
|
9421
9581
|
// src/widgets/RebuyProductAddOns/RebuyProductAddOnCard.tsx
|
9422
|
-
var
|
9582
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
9423
9583
|
var RebuyProductAddOnCard = ({
|
9424
9584
|
handleChange,
|
9425
9585
|
learnMoreText,
|
@@ -9428,8 +9588,8 @@ var RebuyProductAddOnCard = ({
|
|
9428
9588
|
titleLevel
|
9429
9589
|
}) => {
|
9430
9590
|
const { availableForSale, image } = product.selectedVariant || {};
|
9431
|
-
return /* @__PURE__ */ (0,
|
9432
|
-
/* @__PURE__ */ (0,
|
9591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("label", { className: RebuyProductAddOns_default.addOnCard, htmlFor: product.id, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: RebuyProductAddOns_default.addOnCardContent, children: [
|
9592
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
9433
9593
|
"input",
|
9434
9594
|
{
|
9435
9595
|
checked: Boolean(product.selected),
|
@@ -9442,7 +9602,7 @@ var RebuyProductAddOnCard = ({
|
|
9442
9602
|
value: ""
|
9443
9603
|
}
|
9444
9604
|
),
|
9445
|
-
/* @__PURE__ */ (0,
|
9605
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: RebuyProductAddOns_default.addOnCardContentImage, children: image && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
9446
9606
|
import_hydrogen10.Image,
|
9447
9607
|
{
|
9448
9608
|
alt: image.altText || `Picture of ${product.title}`,
|
@@ -9451,37 +9611,46 @@ var RebuyProductAddOnCard = ({
|
|
9451
9611
|
width: 300
|
9452
9612
|
}
|
9453
9613
|
) }),
|
9454
|
-
/* @__PURE__ */ (0,
|
9455
|
-
!availableForSale && /* @__PURE__ */ (0,
|
9456
|
-
/* @__PURE__ */ (0,
|
9457
|
-
/* @__PURE__ */ (0,
|
9458
|
-
/* @__PURE__ */ (0,
|
9614
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: RebuyProductAddOns_default.addOnCardTextContent, children: [
|
9615
|
+
!availableForSale && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: RebuyProductAddOns_default.addOnCardOutOfStock, children: outOfStockText }),
|
9616
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Title, { level: titleLevel, text: product.title }),
|
9617
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(RebuyProductPrice, { selectedVariant: product.selectedVariant }),
|
9618
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
9619
|
+
RebuyLink,
|
9620
|
+
{
|
9621
|
+
ariaLabel: `View ${product.title}`,
|
9622
|
+
className: RebuyProductAddOns_default.addOnCardLearnMore,
|
9623
|
+
handle: `/products/${product.handle}`,
|
9624
|
+
children: learnMoreText
|
9625
|
+
}
|
9626
|
+
)
|
9459
9627
|
] })
|
9460
9628
|
] }) });
|
9461
9629
|
};
|
9462
9630
|
|
9463
9631
|
// src/widgets/RebuyProductAddOns/RebuyProductAddOns.tsx
|
9464
|
-
var
|
9632
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
9465
9633
|
var RebuyProductAddOns = (props) => {
|
9466
9634
|
const {
|
9635
|
+
addToCartBtnText = "Add to cart",
|
9467
9636
|
addToCartCallback,
|
9468
|
-
customTitle = `These pair with
|
9637
|
+
customTitle = `These pair with {product_title}`,
|
9469
9638
|
customTitleLevel = "h2",
|
9470
9639
|
customTitleStyle,
|
9471
9640
|
includeMainProduct = false,
|
9472
|
-
isHydrogenReact,
|
9473
9641
|
learnMoreText = "Learn more",
|
9474
9642
|
outOfStockText = "Out of stock",
|
9475
|
-
product,
|
9476
|
-
products = [],
|
9477
|
-
addToCartBtnText = "Add to cart",
|
9478
9643
|
subtotalText = "Add-ons Subtotal: ",
|
9479
|
-
withProductText = `With
|
9644
|
+
withProductText = `With {product_title}: `
|
9480
9645
|
} = props;
|
9481
|
-
const
|
9482
|
-
const
|
9483
|
-
const
|
9484
|
-
(0,
|
9646
|
+
const { isHydrogenReact, product, products } = useRebuyWidget();
|
9647
|
+
const productTitleClean = customTitle.replace("{product_title}", product?.title ?? "");
|
9648
|
+
const withProductTextClean = withProductText.replace("{product_title}", product?.title ?? "");
|
9649
|
+
const [addedItems, setAddedItems] = (0, import_react37.useState)(products);
|
9650
|
+
const [subtotalWithProduct, setSubtotalWithProduct] = (0, import_react37.useState)();
|
9651
|
+
const [subtotalWithOutProduct, setSubtotalWithOutProduct] = (0, import_react37.useState)();
|
9652
|
+
const convertedProduct = convertToRebuyProduct(isHydrogenReact || false, product);
|
9653
|
+
(0, import_react37.useEffect)(() => {
|
9485
9654
|
let initialTotal = 0;
|
9486
9655
|
let currencyCode = "USD";
|
9487
9656
|
products.map((product2) => {
|
@@ -9499,19 +9668,19 @@ var RebuyProductAddOns = (props) => {
|
|
9499
9668
|
setSubtotalWithOutProduct({
|
9500
9669
|
amount: String(
|
9501
9670
|
initialTotal - Number(
|
9502
|
-
isHydrogenReact ?
|
9671
|
+
isHydrogenReact ? convertedProduct?.selectedVariant?.priceV2?.amount : product?.selectedOrFirstAvailableVariant?.price.amount
|
9503
9672
|
)
|
9504
9673
|
),
|
9505
9674
|
currencyCode
|
9506
9675
|
});
|
9507
9676
|
setAddedItems(products);
|
9508
9677
|
if (includeMainProduct) {
|
9509
|
-
setAddedItems([
|
9678
|
+
setAddedItems([convertedProduct, ...products]);
|
9510
9679
|
} else {
|
9511
9680
|
setAddedItems(products);
|
9512
9681
|
}
|
9513
9682
|
}, [products, product, isHydrogenReact, includeMainProduct]);
|
9514
|
-
const handleChange = (0,
|
9683
|
+
const handleChange = (0, import_react37.useCallback)(
|
9515
9684
|
(event, product2) => {
|
9516
9685
|
const newProducts = [...products];
|
9517
9686
|
const productIndex = newProducts.findIndex((p) => p.id === product2.id);
|
@@ -9530,7 +9699,7 @@ var RebuyProductAddOns = (props) => {
|
|
9530
9699
|
},
|
9531
9700
|
[products]
|
9532
9701
|
);
|
9533
|
-
(0,
|
9702
|
+
(0, import_react37.useEffect)(() => {
|
9534
9703
|
let total = 0;
|
9535
9704
|
let currencyCode = "USD";
|
9536
9705
|
addedItems.forEach((item) => {
|
@@ -9546,7 +9715,7 @@ var RebuyProductAddOns = (props) => {
|
|
9546
9715
|
setSubtotalWithOutProduct({
|
9547
9716
|
amount: String(
|
9548
9717
|
total - Number(
|
9549
|
-
isHydrogenReact ?
|
9718
|
+
isHydrogenReact ? convertedProduct?.selectedVariant?.priceV2?.amount : product?.selectedOrFirstAvailableVariant?.price.amount
|
9550
9719
|
)
|
9551
9720
|
),
|
9552
9721
|
currencyCode
|
@@ -9556,9 +9725,9 @@ var RebuyProductAddOns = (props) => {
|
|
9556
9725
|
rebuyDebugLog.log("widget-product-add-ons" /* WIDGET_PRODUCT_ADD_ONS */, "RebuyProductAddOns: No products found");
|
9557
9726
|
return null;
|
9558
9727
|
}
|
9559
|
-
return /* @__PURE__ */ (0,
|
9560
|
-
/* @__PURE__ */ (0,
|
9561
|
-
/* @__PURE__ */ (0,
|
9728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: RebuyProductAddOns_default.container, children: [
|
9729
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: productTitleClean }),
|
9730
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("ul", { className: RebuyProductAddOns_default.productAddOnsList, children: products.map((product2) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
9562
9731
|
RebuyProductAddOnCard,
|
9563
9732
|
{
|
9564
9733
|
handleChange,
|
@@ -9568,16 +9737,16 @@ var RebuyProductAddOns = (props) => {
|
|
9568
9737
|
titleLevel: getTitleLevel(customTitleLevel, true)
|
9569
9738
|
}
|
9570
9739
|
) }, product2.id)) }),
|
9571
|
-
/* @__PURE__ */ (0,
|
9572
|
-
/* @__PURE__ */ (0,
|
9740
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: RebuyProductAddOns_default.productAddOnsFooter, children: [
|
9741
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: RebuyProductAddOns_default.moneyContainer, children: [
|
9573
9742
|
subtotalText,
|
9574
|
-
subtotalWithOutProduct && /* @__PURE__ */ (0,
|
9743
|
+
subtotalWithOutProduct && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_hydrogen_react3.Money, { data: subtotalWithOutProduct, withoutTrailingZeros: true })
|
9575
9744
|
] }),
|
9576
|
-
includeMainProduct && /* @__PURE__ */ (0,
|
9577
|
-
|
9578
|
-
subtotalWithProduct && /* @__PURE__ */ (0,
|
9745
|
+
includeMainProduct && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: RebuyProductAddOns_default.moneyContainer, children: [
|
9746
|
+
withProductTextClean,
|
9747
|
+
subtotalWithProduct && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_hydrogen_react3.Money, { data: subtotalWithProduct, withoutTrailingZeros: true })
|
9579
9748
|
] }),
|
9580
|
-
/* @__PURE__ */ (0,
|
9749
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: RebuyProductAddOns_default.addCartBtnContainer, children: includeMainProduct ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
9581
9750
|
AddToCartBtn,
|
9582
9751
|
{
|
9583
9752
|
addToCartBtnText,
|
@@ -9587,7 +9756,7 @@ var RebuyProductAddOns = (props) => {
|
|
9587
9756
|
moneyData: subtotalWithProduct,
|
9588
9757
|
selectedVariants: addedItems.map((item) => item.selectedVariant)
|
9589
9758
|
}
|
9590
|
-
) : /* @__PURE__ */ (0,
|
9759
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
9591
9760
|
AddToCartBtn,
|
9592
9761
|
{
|
9593
9762
|
addToCartBtnText,
|
@@ -9607,39 +9776,40 @@ var result26 = { "container": "RebuyProductRecommendations_container", "productG
|
|
9607
9776
|
var RebuyProductRecommendations_default = result26;
|
9608
9777
|
|
9609
9778
|
// src/widgets/RebuyProductRecommendations/RebuyProductRecommendations.tsx
|
9610
|
-
var
|
9779
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
9611
9780
|
var RebuyProductRecommendations = (props) => {
|
9612
9781
|
const {
|
9613
9782
|
addToCartBtnText = "Add to cart",
|
9614
9783
|
addToCartCallback,
|
9615
|
-
customTitle = `These pair with
|
9784
|
+
customTitle = `These pair with {product_title}`,
|
9616
9785
|
customTitleLevel = "h2",
|
9617
|
-
customTitleStyle
|
9618
|
-
products = []
|
9786
|
+
customTitleStyle
|
9619
9787
|
} = props;
|
9788
|
+
const { isHydrogenReact, product, products } = useRebuyWidget();
|
9789
|
+
const productTitle = customTitle.replace("{product_title}", product?.title ?? "");
|
9620
9790
|
if (products.length === 0) {
|
9621
9791
|
rebuyDebugLog.log("widget-product-recommendations" /* WIDGET_PRODUCT_RECOMMENDATIONS */, "RebuyProductRecommendations: No products found");
|
9622
9792
|
return null;
|
9623
9793
|
}
|
9624
|
-
return /* @__PURE__ */ (0,
|
9625
|
-
/* @__PURE__ */ (0,
|
9626
|
-
/* @__PURE__ */ (0,
|
9794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("section", { className: RebuyProductRecommendations_default.container, children: [
|
9795
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: productTitle }),
|
9796
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("ul", { className: RebuyProductRecommendations_default.productGrid, children: products.map((product2) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
9627
9797
|
ProductCard,
|
9628
9798
|
{
|
9629
9799
|
addToCartBtnText,
|
9630
9800
|
addToCartCallback,
|
9631
|
-
isHydrogenReact
|
9632
|
-
product,
|
9801
|
+
isHydrogenReact,
|
9802
|
+
product: product2,
|
9633
9803
|
productCardTitleLevel: getTitleLevel(customTitleLevel, true)
|
9634
9804
|
}
|
9635
|
-
) },
|
9805
|
+
) }, product2.id)) })
|
9636
9806
|
] });
|
9637
9807
|
};
|
9638
9808
|
|
9639
9809
|
// src/widgets/RebuyProductViewed/RebuyProductViewed.tsx
|
9640
9810
|
var import_rebuy4 = require("@rebuy/rebuy");
|
9641
9811
|
var Utilities6 = __toESM(require("@rebuy/rebuy/utilities"), 1);
|
9642
|
-
var
|
9812
|
+
var import_react38 = require("react");
|
9643
9813
|
|
9644
9814
|
// src/zustandStores/productViewed.ts
|
9645
9815
|
var import_zustand2 = require("zustand");
|
@@ -9654,12 +9824,12 @@ var useProductViewedStore = (0, import_zustand2.create)((set) => ({
|
|
9654
9824
|
var RebuyProductViewed = ({ ...props }) => {
|
9655
9825
|
const { apiKey: apiKeyFromContext } = useRebuyConfig();
|
9656
9826
|
const { customerId, product, productHandle, productId } = props;
|
9657
|
-
const [event, setEvent] = (0,
|
9658
|
-
const [Rebuy, setRebuy] = (0,
|
9827
|
+
const [event, setEvent] = (0, import_react38.useState)(null);
|
9828
|
+
const [Rebuy, setRebuy] = (0, import_react38.useState)(null);
|
9659
9829
|
const shopifyProductId = product?.id ?? productId ?? null;
|
9660
|
-
const [initialized, setInitialized] = (0,
|
9830
|
+
const [initialized, setInitialized] = (0, import_react38.useState)(false);
|
9661
9831
|
const { setCustomerId, setUuid } = useProductViewedStore();
|
9662
|
-
const request = (0,
|
9832
|
+
const request = (0, import_react38.useMemo)(() => {
|
9663
9833
|
const request2 = {
|
9664
9834
|
parameters: {}
|
9665
9835
|
};
|
@@ -9673,7 +9843,7 @@ var RebuyProductViewed = ({ ...props }) => {
|
|
9673
9843
|
}
|
9674
9844
|
return request2;
|
9675
9845
|
}, [productHandle, shopifyProductId]);
|
9676
|
-
(0,
|
9846
|
+
(0, import_react38.useEffect)(() => {
|
9677
9847
|
const recordView = async () => {
|
9678
9848
|
if (!Rebuy) {
|
9679
9849
|
return;
|
@@ -9709,14 +9879,14 @@ var RebuyProductViewed = ({ ...props }) => {
|
|
9709
9879
|
// src/widgets/RebuyRecentlyViewedProducts/RebuyRecentlyViewedProducts.tsx
|
9710
9880
|
var import_rebuy5 = require("@rebuy/rebuy");
|
9711
9881
|
var import_hydrogen11 = require("@shopify/hydrogen");
|
9712
|
-
var
|
9882
|
+
var import_react39 = require("react");
|
9713
9883
|
|
9714
9884
|
// src/widgets/RebuyRecentlyViewedProducts/RebuyRecentlyViewedProducts.module.css
|
9715
9885
|
var result27 = { "rebuy-recently-viewed-products-container": "RebuyRecentlyViewedProducts_rebuy-recently-viewed-products-container", "product-grid": "RebuyRecentlyViewedProducts_product-grid" };
|
9716
9886
|
var RebuyRecentlyViewedProducts_default = result27;
|
9717
9887
|
|
9718
9888
|
// src/widgets/RebuyRecentlyViewedProducts/RebuyRecentlyViewedProducts.tsx
|
9719
|
-
var
|
9889
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
9720
9890
|
var RebuyRecentlyViewedProducts = (props) => {
|
9721
9891
|
const {
|
9722
9892
|
addToCartBtnText = "Add to cart",
|
@@ -9730,14 +9900,14 @@ var RebuyRecentlyViewedProducts = (props) => {
|
|
9730
9900
|
} = props;
|
9731
9901
|
const { customerId, uuid } = useProductViewedStore();
|
9732
9902
|
const { apiKey, loadingStatus: configLoadingStatus, rebuyConfig } = useRebuyConfig();
|
9733
|
-
const rebuyContext = (0,
|
9734
|
-
const [rebuyApiClient, setRebuyApiClient] = (0,
|
9735
|
-
const [initialized, setInitialized] = (0,
|
9736
|
-
const [products, setProducts] = (0,
|
9737
|
-
const [metadata, setMetadata] = (0,
|
9903
|
+
const rebuyContext = (0, import_react39.useContext)(RebuyContext);
|
9904
|
+
const [rebuyApiClient, setRebuyApiClient] = (0, import_react39.useState)(null);
|
9905
|
+
const [initialized, setInitialized] = (0, import_react39.useState)(false);
|
9906
|
+
const [products, setProducts] = (0, import_react39.useState)([]);
|
9907
|
+
const [metadata, setMetadata] = (0, import_react39.useState)();
|
9738
9908
|
const rebuyConfigKey = rebuyConfig?.shop?.cache_key;
|
9739
9909
|
const endpoint = customerId && customerId !== "" ? `/api/v1/products/viewed?key=${rebuyConfigKey}&customer_id=${customerId}` : `/api/v1/products/viewed?key=${rebuyConfigKey}&uuid=${uuid}`;
|
9740
|
-
(0,
|
9910
|
+
(0, import_react39.useEffect)(() => {
|
9741
9911
|
if (!rebuyApiClient && apiKey && configLoadingStatus === "success") {
|
9742
9912
|
const client = new import_rebuy5.RebuyClient(apiKey);
|
9743
9913
|
if (rebuyContext?.contextParameters) {
|
@@ -9751,13 +9921,13 @@ var RebuyRecentlyViewedProducts = (props) => {
|
|
9751
9921
|
setInitialized(true);
|
9752
9922
|
}
|
9753
9923
|
}, [apiKey, rebuyApiClient, configLoadingStatus, options, rebuyContext, uuid, endpoint]);
|
9754
|
-
(0,
|
9924
|
+
(0, import_react39.useEffect)(() => {
|
9755
9925
|
if (rebuyApiClient && rebuyContext?.contextParameters) {
|
9756
9926
|
const filteredParams = filterContextForWidgetEndpoints(rebuyContext.contextParameters, endpoint);
|
9757
9927
|
rebuyApiClient.setContextParameters(filteredParams);
|
9758
9928
|
}
|
9759
9929
|
}, [rebuyApiClient, rebuyContext, uuid, endpoint]);
|
9760
|
-
const request = (0,
|
9930
|
+
const request = (0, import_react39.useMemo)(() => {
|
9761
9931
|
const req = {
|
9762
9932
|
endpoint,
|
9763
9933
|
params: {}
|
@@ -9768,7 +9938,7 @@ var RebuyRecentlyViewedProducts = (props) => {
|
|
9768
9938
|
}
|
9769
9939
|
return req;
|
9770
9940
|
}, [limit, uuid, endpoint]);
|
9771
|
-
(0,
|
9941
|
+
(0, import_react39.useEffect)(() => {
|
9772
9942
|
let isMounted = true;
|
9773
9943
|
if (!rebuyApiClient || !initialized || configLoadingStatus !== "success") return;
|
9774
9944
|
const fetchData = async () => {
|
@@ -9805,9 +9975,9 @@ var RebuyRecentlyViewedProducts = (props) => {
|
|
9805
9975
|
rebuyDebugLog.log("widget-recently-viewed-products" /* WIDGET_RECENTLY_VIEWED_PRODUCTS */, "RebuyRecentlyViewedProducts: No products found");
|
9806
9976
|
return null;
|
9807
9977
|
}
|
9808
|
-
return /* @__PURE__ */ (0,
|
9809
|
-
/* @__PURE__ */ (0,
|
9810
|
-
/* @__PURE__ */ (0,
|
9978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: RebuyRecentlyViewedProducts_default["rebuy-recently-viewed-products-container"], children: [
|
9979
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
|
9980
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { className: RebuyRecentlyViewedProducts_default["product-grid"], children: products?.map((product) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
9811
9981
|
ProductCard,
|
9812
9982
|
{
|
9813
9983
|
addToCartBtnText,
|