@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.mjs
CHANGED
@@ -1221,7 +1221,7 @@ var useTieredProgressBarStore = create((set, get) => ({
|
|
1221
1221
|
if (idsToFetch.length > 0) {
|
1222
1222
|
const productGids = idsToFetch.map((id) => `gid://shopify/Product/${id}`);
|
1223
1223
|
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 } } } } } } }`;
|
1224
|
-
const response = await fetch(`https://${_shopifyDomain}/api/
|
1224
|
+
const response = await fetch(`https://${_shopifyDomain}/api/2025-01/graphql.json`, {
|
1225
1225
|
body: JSON.stringify({ query: graphqlQuery, variables: { ids: productGids } }),
|
1226
1226
|
headers: {
|
1227
1227
|
"Content-Type": "application/json",
|
@@ -3524,7 +3524,7 @@ var RebuyHydrogenReactContextProvider = ({
|
|
3524
3524
|
publicStoreDomain,
|
3525
3525
|
publicStorefrontId,
|
3526
3526
|
publicStorefrontToken,
|
3527
|
-
storefrontApiVersion = "
|
3527
|
+
storefrontApiVersion = "2025-01"
|
3528
3528
|
}) => {
|
3529
3529
|
const adaptedCallbacks = useMemo4(
|
3530
3530
|
() => ({
|
@@ -3817,6 +3817,13 @@ import clsx from "clsx";
|
|
3817
3817
|
import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo7, useState as useState5 } from "react";
|
3818
3818
|
import { useFetcher } from "react-router";
|
3819
3819
|
|
3820
|
+
// src/components/RebuyLink/RebuyLink.tsx
|
3821
|
+
import { Link } from "react-router";
|
3822
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
3823
|
+
var RebuyLink = ({ ariaLabel, children, className, handle, onClick, role = "link" }) => {
|
3824
|
+
return /* @__PURE__ */ jsx9(Link, { "aria-label": ariaLabel, className, onClick, rel: "nofollow", role, to: handle, children });
|
3825
|
+
};
|
3826
|
+
|
3820
3827
|
// src/smart-cart/hooks/useCartItemFeatures.ts
|
3821
3828
|
import { useCallback as useCallback3, useMemo as useMemo6, useState as useState4 } from "react";
|
3822
3829
|
|
@@ -4235,8 +4242,8 @@ var result2 = { "rebuy-cart-item": "CartItem_rebuy-cart-item", "rebuy-cart-item_
|
|
4235
4242
|
var CartItem_default = result2;
|
4236
4243
|
|
4237
4244
|
// src/smart-cart/components/CartItem/CartItem.tsx
|
4238
|
-
import { Fragment as Fragment3, jsx as
|
4239
|
-
var Spinner = ({ className }) => /* @__PURE__ */
|
4245
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
4246
|
+
var Spinner = ({ className }) => /* @__PURE__ */ jsx10("span", { className: clsx(CartItem_default["rebuy-cart-item__spinner"], className) });
|
4240
4247
|
var CartItem = ({ line }) => {
|
4241
4248
|
const { config, isCartBusy, isHydrogenReact, removeItem, updateItem } = useSmartCart();
|
4242
4249
|
const itemFetcher = useFetcher();
|
@@ -4246,6 +4253,7 @@ var CartItem = ({ line }) => {
|
|
4246
4253
|
const [isAdjustingBMSM, setIsAdjustingBMSM] = useState5(false);
|
4247
4254
|
const [isSwitchingSubscription, setIsSwitchingSubscription] = useState5(false);
|
4248
4255
|
const [switchingDirection, setSwitchingDirection] = useState5(null);
|
4256
|
+
const { toggleCart } = useSmartCart();
|
4249
4257
|
const {
|
4250
4258
|
actions: itemActionsLogic,
|
4251
4259
|
bmsm,
|
@@ -4473,21 +4481,34 @@ var CartItem = ({ line }) => {
|
|
4473
4481
|
"data-line-id": line.id,
|
4474
4482
|
"data-variant-id": line.merchandise.id,
|
4475
4483
|
children: [
|
4476
|
-
/* @__PURE__ */
|
4484
|
+
/* @__PURE__ */ jsx10("div", { className: CartItem_default["rebuy-cart-item__media"], children: /* @__PURE__ */ jsx10(
|
4485
|
+
RebuyLink,
|
4486
|
+
{
|
4487
|
+
ariaLabel: meta.linkLabel,
|
4488
|
+
handle: meta.itemUrl,
|
4489
|
+
onClick: () => {
|
4490
|
+
toggleCart();
|
4491
|
+
},
|
4492
|
+
children: /* @__PURE__ */ jsx10("img", { alt: meta.imageAltText, height: 120, loading: "lazy", src: meta.imageUrl, width: 120 })
|
4493
|
+
}
|
4494
|
+
) }),
|
4477
4495
|
/* @__PURE__ */ jsxs5("div", { className: CartItem_default["rebuy-cart-item__info"], children: [
|
4478
|
-
/* @__PURE__ */
|
4479
|
-
|
4496
|
+
/* @__PURE__ */ jsx10(
|
4497
|
+
RebuyLink,
|
4480
4498
|
{
|
4481
|
-
|
4499
|
+
ariaLabel: meta.linkLabel,
|
4482
4500
|
className: CartItem_default["rebuy-cart-item__product-title"],
|
4483
|
-
|
4501
|
+
handle: meta.itemUrl,
|
4502
|
+
onClick: () => {
|
4503
|
+
toggleCart();
|
4504
|
+
},
|
4484
4505
|
role: "heading",
|
4485
4506
|
children: meta.productTitle
|
4486
4507
|
}
|
4487
4508
|
),
|
4488
|
-
meta.variantTitle && /* @__PURE__ */
|
4509
|
+
meta.variantTitle && /* @__PURE__ */ jsx10("div", { className: CartItem_default["rebuy-cart-item__variant-title"], children: meta.variantTitle }),
|
4489
4510
|
properties.hasVisibleProperties && /* @__PURE__ */ jsxs5("div", { className: CartItem_default["rebuy-cart-item__properties-list"], children: [
|
4490
|
-
properties.deliveryFrequency && /* @__PURE__ */
|
4511
|
+
properties.deliveryFrequency && /* @__PURE__ */ jsx10(
|
4491
4512
|
"div",
|
4492
4513
|
{
|
4493
4514
|
className: clsx(
|
@@ -4497,7 +4518,7 @@ var CartItem = ({ line }) => {
|
|
4497
4518
|
children: properties.deliveryFrequency
|
4498
4519
|
}
|
4499
4520
|
),
|
4500
|
-
properties.visibleProperties.map((prop, index) => /* @__PURE__ */
|
4521
|
+
properties.visibleProperties.map((prop, index) => /* @__PURE__ */ jsx10(
|
4501
4522
|
"div",
|
4502
4523
|
{
|
4503
4524
|
className: clsx(
|
@@ -4506,15 +4527,15 @@ var CartItem = ({ line }) => {
|
|
4506
4527
|
getItemPropertyValueClass(prop)
|
4507
4528
|
),
|
4508
4529
|
children: prop.key !== "_Discount" ? /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
4509
|
-
/* @__PURE__ */
|
4510
|
-
/* @__PURE__ */
|
4511
|
-
/* @__PURE__ */
|
4512
|
-
] }) : /* @__PURE__ */
|
4530
|
+
/* @__PURE__ */ jsx10("span", { className: CartItem_default["rebuy-cart-item__property-key"], children: prop.key }),
|
4531
|
+
/* @__PURE__ */ jsx10("span", { className: CartItem_default["rebuy-cart-item__property-separator"], children: ": " }),
|
4532
|
+
/* @__PURE__ */ jsx10("span", { className: CartItem_default["rebuy-cart-item__property-value"], children: prop.value })
|
4533
|
+
] }) : /* @__PURE__ */ jsx10("span", { className: CartItem_default["rebuy-cart-item__property-value"], children: prop.value })
|
4513
4534
|
},
|
4514
4535
|
`${line.id}-prop-${index}`
|
4515
4536
|
))
|
4516
4537
|
] }),
|
4517
|
-
/* @__PURE__ */
|
4538
|
+
/* @__PURE__ */ jsx10(
|
4518
4539
|
"button",
|
4519
4540
|
{
|
4520
4541
|
"aria-label": `Remove ${meta.productTitle}`,
|
@@ -4522,11 +4543,11 @@ var CartItem = ({ line }) => {
|
|
4522
4543
|
disabled: isLoadingCombined,
|
4523
4544
|
onClick: handleRemoveItem,
|
4524
4545
|
type: "button",
|
4525
|
-
children: isRemoving ? /* @__PURE__ */
|
4546
|
+
children: isRemoving ? /* @__PURE__ */ jsx10(Spinner, {}) : "\u2715"
|
4526
4547
|
}
|
4527
4548
|
),
|
4528
|
-
!shouldHideQuantitySelector && /* @__PURE__ */
|
4529
|
-
/* @__PURE__ */
|
4549
|
+
!shouldHideQuantitySelector && /* @__PURE__ */ jsx10("div", { className: CartItem_default["rebuy-cart-item__quantity-selector-area"], children: /* @__PURE__ */ jsxs5("div", { className: CartItem_default["rebuy-cart-item__quantity-selector"], children: [
|
4550
|
+
/* @__PURE__ */ jsx10(
|
4530
4551
|
"button",
|
4531
4552
|
{
|
4532
4553
|
"aria-label": `Decrease quantity of ${meta.productTitle}`,
|
@@ -4534,7 +4555,7 @@ var CartItem = ({ line }) => {
|
|
4534
4555
|
disabled: isLoadingCombined,
|
4535
4556
|
onClick: handleDecreaseQuantity,
|
4536
4557
|
type: "button",
|
4537
|
-
children: isDecreasing ? /* @__PURE__ */
|
4558
|
+
children: isDecreasing ? /* @__PURE__ */ jsx10(Spinner, {}) : "-"
|
4538
4559
|
}
|
4539
4560
|
),
|
4540
4561
|
/* @__PURE__ */ jsxs5("span", { "aria-live": "polite", className: CartItem_default["rebuy-cart-item__quantity-selector-label"], children: [
|
@@ -4544,7 +4565,7 @@ var CartItem = ({ line }) => {
|
|
4544
4565
|
] }),
|
4545
4566
|
line.quantity
|
4546
4567
|
] }),
|
4547
|
-
/* @__PURE__ */
|
4568
|
+
/* @__PURE__ */ jsx10(
|
4548
4569
|
"button",
|
4549
4570
|
{
|
4550
4571
|
"aria-label": `Increase quantity of ${meta.productTitle}`,
|
@@ -4552,11 +4573,11 @@ var CartItem = ({ line }) => {
|
|
4552
4573
|
disabled: isLoadingCombined,
|
4553
4574
|
onClick: handleIncreaseQuantity,
|
4554
4575
|
type: "button",
|
4555
|
-
children: isIncreasing ? /* @__PURE__ */
|
4576
|
+
children: isIncreasing ? /* @__PURE__ */ jsx10(Spinner, {}) : "+"
|
4556
4577
|
}
|
4557
4578
|
)
|
4558
4579
|
] }) }),
|
4559
|
-
/* @__PURE__ */
|
4580
|
+
/* @__PURE__ */ jsx10("div", { className: CartItem_default["rebuy-cart-item__price-details"], children: pricing.hasDiscount && pricing.compareAtDisplayPrice ? /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
4560
4581
|
/* @__PURE__ */ jsxs5(
|
4561
4582
|
"span",
|
4562
4583
|
{
|
@@ -4566,7 +4587,7 @@ var CartItem = ({ line }) => {
|
|
4566
4587
|
CartItem_default["rebuy-cart-item__money--sale"]
|
4567
4588
|
),
|
4568
4589
|
children: [
|
4569
|
-
/* @__PURE__ */
|
4590
|
+
/* @__PURE__ */ jsx10(ScreenReaderText, { children: "Sale price" }),
|
4570
4591
|
pricing.displayPrice
|
4571
4592
|
]
|
4572
4593
|
}
|
@@ -4580,13 +4601,13 @@ var CartItem = ({ line }) => {
|
|
4580
4601
|
CartItem_default["rebuy-cart-item__money--compare-at"]
|
4581
4602
|
),
|
4582
4603
|
children: [
|
4583
|
-
/* @__PURE__ */
|
4604
|
+
/* @__PURE__ */ jsx10(ScreenReaderText, { children: "Original price" }),
|
4584
4605
|
pricing.compareAtDisplayPrice
|
4585
4606
|
]
|
4586
4607
|
}
|
4587
4608
|
)
|
4588
4609
|
] }) : /* @__PURE__ */ jsxs5("span", { "aria-label": "Price", className: CartItem_default["rebuy-cart-item__money"], children: [
|
4589
|
-
/* @__PURE__ */
|
4610
|
+
/* @__PURE__ */ jsx10(ScreenReaderText, { children: "Price" }),
|
4590
4611
|
pricing.displayPrice
|
4591
4612
|
] }) }),
|
4592
4613
|
bundle.isBundleParent && bundle.showToggle && /* @__PURE__ */ jsxs5("div", { className: CartItem_default["rebuy-cart-item__bundle-section"], children: [
|
@@ -4606,11 +4627,11 @@ var CartItem = ({ line }) => {
|
|
4606
4627
|
bundle.itemCount,
|
4607
4628
|
" item",
|
4608
4629
|
bundle.itemCount !== 1 ? "s" : "",
|
4609
|
-
/* @__PURE__ */
|
4630
|
+
/* @__PURE__ */ jsx10("span", { "aria-hidden": "true", className: CartItem_default["rebuy-cart-item__bundle-chev-icon"], children: isBundleExpanded ? "\u25B2" : "\u25BC" })
|
4610
4631
|
]
|
4611
4632
|
}
|
4612
4633
|
),
|
4613
|
-
bundle.itemCount > 0 && isBundleExpanded && /* @__PURE__ */
|
4634
|
+
bundle.itemCount > 0 && isBundleExpanded && /* @__PURE__ */ jsx10(
|
4614
4635
|
"ul",
|
4615
4636
|
{
|
4616
4637
|
className: CartItem_default["rebuy-cart-item__bundle-children-list"],
|
@@ -4629,7 +4650,7 @@ var CartItem = ({ line }) => {
|
|
4629
4650
|
{
|
4630
4651
|
className: CartItem_default["rebuy-cart-item__bundle-child-item"],
|
4631
4652
|
children: [
|
4632
|
-
/* @__PURE__ */
|
4653
|
+
/* @__PURE__ */ jsx10("div", { className: CartItem_default["rebuy-cart-item__bundle-child-media-wrapper"], children: /* @__PURE__ */ jsx10("div", { className: CartItem_default["rebuy-cart-item__bundle-child-image-wrapper"], children: /* @__PURE__ */ jsx10(
|
4633
4654
|
"img",
|
4634
4655
|
{
|
4635
4656
|
alt: childTitle,
|
@@ -4638,7 +4659,7 @@ var CartItem = ({ line }) => {
|
|
4638
4659
|
src: sizeImage(childImage, "40x40")
|
4639
4660
|
}
|
4640
4661
|
) }) }),
|
4641
|
-
/* @__PURE__ */
|
4662
|
+
/* @__PURE__ */ jsx10("div", { className: CartItem_default["rebuy-cart-item__bundle-child-details"], children: /* @__PURE__ */ jsx10("h5", { className: CartItem_default["rebuy-cart-item__bundle-child-title"], children: childTitle }) })
|
4642
4663
|
]
|
4643
4664
|
},
|
4644
4665
|
`${line.id}-bundle-child-${index}`
|
@@ -4649,18 +4670,18 @@ var CartItem = ({ line }) => {
|
|
4649
4670
|
] })
|
4650
4671
|
] }),
|
4651
4672
|
" ",
|
4652
|
-
bmsm.isEnabledAndApplicable && /* @__PURE__ */
|
4673
|
+
bmsm.isEnabledAndApplicable && /* @__PURE__ */ jsx10("div", { className: CartItem_default["rebuy-cart-item__bmsm-section"], children: bmsm.isButtonMode ? /* @__PURE__ */ jsx10("div", { className: CartItem_default["rebuy-cart-item__bmsm-button-wrapper"], children: bmsm.nextApplicableTiers.map((tier) => /* @__PURE__ */ jsx10(
|
4653
4674
|
"button",
|
4654
4675
|
{
|
4655
4676
|
"aria-label": `${bmsm.getButtonText(tier)} for ${meta.productTitle}`,
|
4656
4677
|
className: CartItem_default["rebuy-cart-item__bmsm-button"],
|
4657
4678
|
disabled: isLoadingCombined,
|
4658
4679
|
onClick: () => handleAdjustBMSMQuantity(tier.quantity ?? 0),
|
4659
|
-
children: /* @__PURE__ */
|
4680
|
+
children: /* @__PURE__ */ jsx10("span", { children: bmsm.getButtonText(tier) })
|
4660
4681
|
},
|
4661
4682
|
`bmsm-${line.id}-${tier.quantity}`
|
4662
|
-
)) }) : /* @__PURE__ */
|
4663
|
-
sts.isEnabledAndApplicable && /* @__PURE__ */
|
4683
|
+
)) }) : /* @__PURE__ */ jsx10("span", { className: CartItem_default["rebuy-cart-item__bmsm-dynamic-message"], children: bmsm.dynamicText }) }),
|
4684
|
+
sts.isEnabledAndApplicable && /* @__PURE__ */ jsx10("div", { className: CartItem_default["rebuy-cart-item__sts-section"], children: !sts.isCurrentlySubscription && sts.availableFrequencies.length > 0 ? /* @__PURE__ */ jsx10(
|
4664
4685
|
"button",
|
4665
4686
|
{
|
4666
4687
|
"aria-label": `Switch ${meta.productTitle} to a Subscription`,
|
@@ -4668,9 +4689,9 @@ var CartItem = ({ line }) => {
|
|
4668
4689
|
disabled: isLoadingCombined,
|
4669
4690
|
onClick: handleUpgradeToSubscriptionClick,
|
4670
4691
|
type: "button",
|
4671
|
-
children: isSwitchingSubscription && switchingDirection === "upgrading" ? /* @__PURE__ */
|
4692
|
+
children: isSwitchingSubscription && switchingDirection === "upgrading" ? /* @__PURE__ */ jsx10(Spinner, {}) : /* @__PURE__ */ jsx10("span", { children: sts.getUpgradeButtonLabel() })
|
4672
4693
|
}
|
4673
|
-
) : sts.isCurrentlySubscription || sts.canDowngrade ? /* @__PURE__ */
|
4694
|
+
) : sts.isCurrentlySubscription || sts.canDowngrade ? /* @__PURE__ */ jsx10(Fragment3, { children: isSwitchingSubscription ? /* @__PURE__ */ jsx10("span", { className: CartItem_default["rebuy-cart-item__sts-loading-replacement"], children: sts.getLoadingLabel(switchingDirection) }) : /* @__PURE__ */ jsxs5(
|
4674
4695
|
"select",
|
4675
4696
|
{
|
4676
4697
|
"aria-label": `Subscription delivery frequency for ${meta.productTitle}`,
|
@@ -4679,8 +4700,8 @@ var CartItem = ({ line }) => {
|
|
4679
4700
|
onChange: handleSwitchSubscriptionChange,
|
4680
4701
|
value: selectValue,
|
4681
4702
|
children: [
|
4682
|
-
sts.canDowngrade && /* @__PURE__ */
|
4683
|
-
sts.availableFrequencies.length > 0 && /* @__PURE__ */
|
4703
|
+
sts.canDowngrade && /* @__PURE__ */ jsx10("optgroup", { label: sts.getOneTimeGroupLabel(), children: /* @__PURE__ */ jsx10("option", { value: "onetime", children: sts.getOneTimeLabel() }) }),
|
4704
|
+
sts.availableFrequencies.length > 0 && /* @__PURE__ */ jsx10("optgroup", { label: sts.getGroupLabel(), children: sts.availableFrequencies.map((freq) => /* @__PURE__ */ jsx10("option", { value: freq.id, children: sts.getOptionLabel(freq.id) }, freq.id)) })
|
4684
4705
|
]
|
4685
4706
|
}
|
4686
4707
|
) }) : null })
|
@@ -4694,11 +4715,11 @@ var result3 = { "rebuy-empty-cart-message": "EmptyCart_rebuy-empty-cart-message"
|
|
4694
4715
|
var EmptyCart_default = result3;
|
4695
4716
|
|
4696
4717
|
// src/smart-cart/components/EmptyCart/EmptyCart.tsx
|
4697
|
-
import { jsx as
|
4718
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
4698
4719
|
var EmptyCart = () => {
|
4699
4720
|
const { config } = useSmartCart();
|
4700
4721
|
const emptyCartMarkup = config?.empty_cart_markup || "<p>Your cart is empty.</p>";
|
4701
|
-
return /* @__PURE__ */
|
4722
|
+
return /* @__PURE__ */ jsx11("div", { className: EmptyCart_default["rebuy-empty-cart-message"], dangerouslySetInnerHTML: { __html: emptyCartMarkup } });
|
4702
4723
|
};
|
4703
4724
|
|
4704
4725
|
// src/smart-cart/components/CartItemList/CartItemList.module.css
|
@@ -4706,7 +4727,7 @@ var result4 = { "rebuy-cart-item-list__container": "CartItemList_rebuy-cart-item
|
|
4706
4727
|
var CartItemList_default = result4;
|
4707
4728
|
|
4708
4729
|
// src/smart-cart/components/CartItemList/CartItemList.tsx
|
4709
|
-
import { jsx as
|
4730
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
4710
4731
|
var CartItemList = ({ componentConfig }) => {
|
4711
4732
|
const { cartData, isLoading: isCartLoading, isProgressBarLineItemMode } = useSmartCart();
|
4712
4733
|
const lines = cartData?.lines?.nodes ?? [];
|
@@ -4717,13 +4738,13 @@ var CartItemList = ({ componentConfig }) => {
|
|
4717
4738
|
return true;
|
4718
4739
|
});
|
4719
4740
|
const hasVisibleItems = visibleLines.length > 0;
|
4720
|
-
return /* @__PURE__ */
|
4741
|
+
return /* @__PURE__ */ jsx12(
|
4721
4742
|
"div",
|
4722
4743
|
{
|
4723
4744
|
className: CartItemList_default["rebuy-cart-item-list__container"],
|
4724
4745
|
"data-rebuy-component": "cart-items",
|
4725
4746
|
"data-rebuy-component-id": componentConfig.component_id,
|
4726
|
-
children: hasVisibleItems ? /* @__PURE__ */
|
4747
|
+
children: hasVisibleItems ? /* @__PURE__ */ jsx12("ul", { className: CartItemList_default["rebuy-cart-item-list"], "data-smartcart-items": "", role: "group", tabIndex: 0, children: visibleLines.map((line) => /* @__PURE__ */ jsx12(CartItem, { line }, line.id)) }) : !isCartLoading && /* @__PURE__ */ jsx12(EmptyCart, {})
|
4727
4748
|
}
|
4728
4749
|
);
|
4729
4750
|
};
|
@@ -4738,7 +4759,7 @@ var result5 = { "rebuy-cart-note-input": "CartNoteInput_rebuy-cart-note-input",
|
|
4738
4759
|
var CartNoteInput_default = result5;
|
4739
4760
|
|
4740
4761
|
// src/smart-cart/components/CartNoteInput/CartNoteInput.tsx
|
4741
|
-
import { jsx as
|
4762
|
+
import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
4742
4763
|
var CartNoteInput = React2.memo(({ componentConfig }) => {
|
4743
4764
|
const {
|
4744
4765
|
cartData,
|
@@ -4907,7 +4928,7 @@ var CartNoteInput = React2.memo(({ componentConfig }) => {
|
|
4907
4928
|
"data-rebuy-component-id": componentConfig.component_id ?? "notes",
|
4908
4929
|
children: [
|
4909
4930
|
/* @__PURE__ */ jsxs6("label", { className: CartNoteInput_default["rebuy-cart-note-input__toggle-control"], children: [
|
4910
|
-
/* @__PURE__ */
|
4931
|
+
/* @__PURE__ */ jsx13(
|
4911
4932
|
"input",
|
4912
4933
|
{
|
4913
4934
|
checked: isTextareaVisible,
|
@@ -4917,7 +4938,7 @@ var CartNoteInput = React2.memo(({ componentConfig }) => {
|
|
4917
4938
|
type: "checkbox"
|
4918
4939
|
}
|
4919
4940
|
),
|
4920
|
-
/* @__PURE__ */
|
4941
|
+
/* @__PURE__ */ jsx13(
|
4921
4942
|
"span",
|
4922
4943
|
{
|
4923
4944
|
className: CartNoteInput_default["rebuy-cart-note-input__toggle-label"],
|
@@ -4927,7 +4948,7 @@ var CartNoteInput = React2.memo(({ componentConfig }) => {
|
|
4927
4948
|
] }),
|
4928
4949
|
isTextareaVisible && /* @__PURE__ */ jsxs6("div", { className: CartNoteInput_default["rebuy-cart-note-input__content-area"], children: [
|
4929
4950
|
/* @__PURE__ */ jsxs6("div", { className: CartNoteInput_default["rebuy-cart-note-input__textarea-wrapper"], children: [
|
4930
|
-
/* @__PURE__ */
|
4951
|
+
/* @__PURE__ */ jsx13(
|
4931
4952
|
"textarea",
|
4932
4953
|
{
|
4933
4954
|
"aria-describedby": describedByIds || void 0,
|
@@ -4945,7 +4966,7 @@ var CartNoteInput = React2.memo(({ componentConfig }) => {
|
|
4945
4966
|
value: currentNoteValue
|
4946
4967
|
}
|
4947
4968
|
),
|
4948
|
-
/* @__PURE__ */
|
4969
|
+
/* @__PURE__ */ jsx13(
|
4949
4970
|
"button",
|
4950
4971
|
{
|
4951
4972
|
"aria-label": saveMessage?.text || (isNoteChanged ? "Save note changes" : "Note is up to date"),
|
@@ -4965,7 +4986,7 @@ var CartNoteInput = React2.memo(({ componentConfig }) => {
|
|
4965
4986
|
!isNoteChanged && !saveMessage && CartNoteInput_default["rebuy-cart-note-input__meta-info--hidden"]
|
4966
4987
|
),
|
4967
4988
|
children: [
|
4968
|
-
limitChars && currentNoteValue.length > 0 && remainingChars !== null && /* @__PURE__ */
|
4989
|
+
limitChars && currentNoteValue.length > 0 && remainingChars !== null && /* @__PURE__ */ jsx13(
|
4969
4990
|
"small",
|
4970
4991
|
{
|
4971
4992
|
"aria-live": "polite",
|
@@ -4974,7 +4995,7 @@ var CartNoteInput = React2.memo(({ componentConfig }) => {
|
|
4974
4995
|
children: `You have ${remainingChars} characters remaining.`
|
4975
4996
|
}
|
4976
4997
|
),
|
4977
|
-
/* @__PURE__ */
|
4998
|
+
/* @__PURE__ */ jsx13("small", { className: CartNoteInput_default["rebuy-cart-note-input__help-text"], id: helpTextId, children: "Press Enter to save, Shift+Enter for new line." })
|
4978
4999
|
]
|
4979
5000
|
}
|
4980
5001
|
)
|
@@ -4994,7 +5015,7 @@ var result6 = { "rebuy-cart-subtotal": "CartSubtotal_rebuy-cart-subtotal", "rebu
|
|
4994
5015
|
var CartSubtotal_default = result6;
|
4995
5016
|
|
4996
5017
|
// src/smart-cart/components/CartSubtotal/CartSubtotal.tsx
|
4997
|
-
import { Fragment as Fragment4, jsx as
|
5018
|
+
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
4998
5019
|
var getDiscountAllocationTitle = (alloc) => {
|
4999
5020
|
switch (alloc.__typename) {
|
5000
5021
|
case "CartCodeDiscountAllocation":
|
@@ -5110,19 +5131,19 @@ var CartSubtotalComponent = ({ componentConfig }) => {
|
|
5110
5131
|
"data-rebuy-component-id": componentConfig.component_id,
|
5111
5132
|
children: [
|
5112
5133
|
/* @__PURE__ */ jsxs7("div", { className: CartSubtotal_default["rebuy-cart-subtotal__row"], children: [
|
5113
|
-
/* @__PURE__ */
|
5134
|
+
/* @__PURE__ */ jsx14("div", { className: CartSubtotal_default["rebuy-cart-subtotal__label"], children: /* @__PURE__ */ jsx14("span", { children: subtotalLabel }) }),
|
5114
5135
|
/* @__PURE__ */ jsxs7("div", { className: CartSubtotal_default["rebuy-cart-subtotal__amount-wrapper"], children: [
|
5115
|
-
/* @__PURE__ */
|
5136
|
+
/* @__PURE__ */ jsx14(ScreenReaderText, { children: "Cart subtotal" }),
|
5116
5137
|
compareAtPrice ? /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
5117
5138
|
/* @__PURE__ */ jsxs7("span", { className: CartSubtotal_default["rebuy-cart-subtotal__price--final"], children: [
|
5118
|
-
/* @__PURE__ */
|
5119
|
-
/* @__PURE__ */
|
5139
|
+
/* @__PURE__ */ jsx14(ScreenReaderText, { children: "Final price" }),
|
5140
|
+
/* @__PURE__ */ jsx14("span", { children: primaryPrice })
|
5120
5141
|
] }),
|
5121
5142
|
/* @__PURE__ */ jsxs7("span", { className: CartSubtotal_default["rebuy-cart-subtotal__price--compare-at"], children: [
|
5122
|
-
/* @__PURE__ */
|
5123
|
-
/* @__PURE__ */
|
5143
|
+
/* @__PURE__ */ jsx14(ScreenReaderText, { children: "Original price" }),
|
5144
|
+
/* @__PURE__ */ jsx14("span", { children: compareAtPrice })
|
5124
5145
|
] })
|
5125
|
-
] }) : /* @__PURE__ */
|
5146
|
+
] }) : /* @__PURE__ */ jsx14("span", { children: primaryPrice })
|
5126
5147
|
] })
|
5127
5148
|
] }),
|
5128
5149
|
shouldShowDiscountSummary && /* @__PURE__ */ jsxs7(
|
@@ -5140,15 +5161,15 @@ var CartSubtotalComponent = ({ componentConfig }) => {
|
|
5140
5161
|
className: CartSubtotal_default["rebuy-cart-subtotal__discount-summary-header"],
|
5141
5162
|
onClick: toggleDiscountSummary,
|
5142
5163
|
children: [
|
5143
|
-
/* @__PURE__ */
|
5164
|
+
/* @__PURE__ */ jsx14("span", { children: discountSummaryCountLabel }),
|
5144
5165
|
/* @__PURE__ */ jsxs7("span", { "aria-hidden": "true", className: CartSubtotal_default["rebuy-cart-subtotal__discount-summary-icon"], children: [
|
5145
|
-
/* @__PURE__ */
|
5166
|
+
/* @__PURE__ */ jsx14("i", { children: "\u25BC" }),
|
5146
5167
|
" "
|
5147
5168
|
] })
|
5148
5169
|
]
|
5149
5170
|
}
|
5150
5171
|
),
|
5151
|
-
/* @__PURE__ */
|
5172
|
+
/* @__PURE__ */ jsx14(
|
5152
5173
|
"div",
|
5153
5174
|
{
|
5154
5175
|
"aria-hidden": !isDiscountSummaryExpanded,
|
@@ -5156,8 +5177,8 @@ var CartSubtotalComponent = ({ componentConfig }) => {
|
|
5156
5177
|
id: summaryId,
|
5157
5178
|
role: "region",
|
5158
5179
|
children: groupedCartLevelDiscounts.map((discount, index) => /* @__PURE__ */ jsxs7("div", { className: CartSubtotal_default["rebuy-cart-subtotal__discount-summary-item"], children: [
|
5159
|
-
/* @__PURE__ */
|
5160
|
-
/* @__PURE__ */
|
5180
|
+
/* @__PURE__ */ jsx14("span", { children: discount.title }),
|
5181
|
+
/* @__PURE__ */ jsx14("span", { children: discount.amount })
|
5161
5182
|
] }, index))
|
5162
5183
|
}
|
5163
5184
|
)
|
@@ -5180,7 +5201,7 @@ var result7 = { "rebuy-cart-title-bar": "CartTitleBar_rebuy-cart-title-bar" };
|
|
5180
5201
|
var CartTitleBar_default = result7;
|
5181
5202
|
|
5182
5203
|
// src/smart-cart/components/CartTitleBar/CartTitleBar.tsx
|
5183
|
-
import { jsx as
|
5204
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
5184
5205
|
var CartTitleBar = React4.memo(() => {
|
5185
5206
|
const { getComponentConfigByType } = useSmartCart();
|
5186
5207
|
const componentConfig = getComponentConfigByType("title_bar");
|
@@ -5194,16 +5215,16 @@ var CartTitleBar = React4.memo(() => {
|
|
5194
5215
|
const DynamicHeadingTag = headingTag;
|
5195
5216
|
if (title === "" && !screenReaderOnly) return null;
|
5196
5217
|
if (screenReaderOnly) {
|
5197
|
-
return /* @__PURE__ */
|
5218
|
+
return /* @__PURE__ */ jsx15(
|
5198
5219
|
DynamicHeadingTag,
|
5199
5220
|
{
|
5200
5221
|
"data-rebuy-component-id": componentConfig?.component_id ?? "title_bar",
|
5201
5222
|
id: "rebuy-cart-title",
|
5202
|
-
children: /* @__PURE__ */
|
5223
|
+
children: /* @__PURE__ */ jsx15(ScreenReaderText, { children: sanitizedTitle })
|
5203
5224
|
}
|
5204
5225
|
);
|
5205
5226
|
}
|
5206
|
-
return /* @__PURE__ */
|
5227
|
+
return /* @__PURE__ */ jsx15(
|
5207
5228
|
DynamicHeadingTag,
|
5208
5229
|
{
|
5209
5230
|
className: CartTitleBar_default["rebuy-cart-title-bar"],
|
@@ -5225,7 +5246,7 @@ var result8 = { "rebuy-checkout-area": "CheckoutArea_rebuy-checkout-area", "rebu
|
|
5225
5246
|
var CheckoutArea_default = result8;
|
5226
5247
|
|
5227
5248
|
// src/smart-cart/components/CheckoutArea/CheckoutArea.tsx
|
5228
|
-
import { jsx as
|
5249
|
+
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
5229
5250
|
var CheckoutArea = React5.memo(({ componentConfig }) => {
|
5230
5251
|
const {
|
5231
5252
|
cartData,
|
@@ -5441,7 +5462,7 @@ var CheckoutArea = React5.memo(({ componentConfig }) => {
|
|
5441
5462
|
"data-rebuy-component-id": componentConfig.component_id,
|
5442
5463
|
children: [
|
5443
5464
|
hasTermsEnabled && /* @__PURE__ */ jsxs8("div", { className: CheckoutArea_default["rebuy-checkout-area__terms"], children: [
|
5444
|
-
/* @__PURE__ */
|
5465
|
+
/* @__PURE__ */ jsx16(
|
5445
5466
|
"input",
|
5446
5467
|
{
|
5447
5468
|
checked: termsAccepted,
|
@@ -5453,7 +5474,7 @@ var CheckoutArea = React5.memo(({ componentConfig }) => {
|
|
5453
5474
|
type: "checkbox"
|
5454
5475
|
}
|
5455
5476
|
),
|
5456
|
-
/* @__PURE__ */
|
5477
|
+
/* @__PURE__ */ jsx16(
|
5457
5478
|
"label",
|
5458
5479
|
{
|
5459
5480
|
className: CheckoutArea_default["rebuy-checkout-area__terms-label"],
|
@@ -5462,34 +5483,34 @@ var CheckoutArea = React5.memo(({ componentConfig }) => {
|
|
5462
5483
|
}
|
5463
5484
|
)
|
5464
5485
|
] }),
|
5465
|
-
hasCheckoutButton && /* @__PURE__ */
|
5486
|
+
hasCheckoutButton && /* @__PURE__ */ jsx16(
|
5466
5487
|
"button",
|
5467
5488
|
{
|
5468
5489
|
className: CheckoutArea_default["rebuy-checkout-area__checkout-button"],
|
5469
5490
|
disabled: isCheckoutDisabled,
|
5470
5491
|
onClick: handleCheckoutClick,
|
5471
5492
|
type: "button",
|
5472
|
-
children: /* @__PURE__ */
|
5493
|
+
children: /* @__PURE__ */ jsx16("span", { dangerouslySetInnerHTML: { __html: checkoutLabel } })
|
5473
5494
|
}
|
5474
5495
|
),
|
5475
|
-
hasViewCartButton && /* @__PURE__ */
|
5496
|
+
hasViewCartButton && /* @__PURE__ */ jsx16(
|
5476
5497
|
"button",
|
5477
5498
|
{
|
5478
5499
|
className: CheckoutArea_default["rebuy-checkout-area__view-cart-button"],
|
5479
5500
|
disabled: isAnyCriticalActionProcessing && processingSource !== "terms",
|
5480
5501
|
onClick: handleViewCartClick,
|
5481
5502
|
type: "button",
|
5482
|
-
children: /* @__PURE__ */
|
5503
|
+
children: /* @__PURE__ */ jsx16("span", { dangerouslySetInnerHTML: { __html: viewCartLabel } })
|
5483
5504
|
}
|
5484
5505
|
),
|
5485
|
-
hasContinueShoppingButton && /* @__PURE__ */
|
5506
|
+
hasContinueShoppingButton && /* @__PURE__ */ jsx16(
|
5486
5507
|
"button",
|
5487
5508
|
{
|
5488
5509
|
className: CheckoutArea_default["rebuy-checkout-area__continue-shopping-button"],
|
5489
5510
|
disabled: isAnyCriticalActionProcessing && processingSource !== "terms",
|
5490
5511
|
onClick: handleContinueShoppingClick,
|
5491
5512
|
type: "button",
|
5492
|
-
children: /* @__PURE__ */
|
5513
|
+
children: /* @__PURE__ */ jsx16(
|
5493
5514
|
"span",
|
5494
5515
|
{
|
5495
5516
|
dangerouslySetInnerHTML: {
|
@@ -5499,7 +5520,7 @@ var CheckoutArea = React5.memo(({ componentConfig }) => {
|
|
5499
5520
|
)
|
5500
5521
|
}
|
5501
5522
|
),
|
5502
|
-
hasShopPayButton && /* @__PURE__ */
|
5523
|
+
hasShopPayButton && /* @__PURE__ */ jsx16(
|
5503
5524
|
"button",
|
5504
5525
|
{
|
5505
5526
|
"aria-label": "Checkout with Shop Pay",
|
@@ -5509,7 +5530,7 @@ var CheckoutArea = React5.memo(({ componentConfig }) => {
|
|
5509
5530
|
onClick: handleShopPayClick
|
5510
5531
|
}
|
5511
5532
|
),
|
5512
|
-
hasInstallments && installmentsMessage && hasItems && /* @__PURE__ */
|
5533
|
+
hasInstallments && installmentsMessage && hasItems && /* @__PURE__ */ jsx16(
|
5513
5534
|
"div",
|
5514
5535
|
{
|
5515
5536
|
className: CheckoutArea_default["rebuy-checkout-area__installments-message"],
|
@@ -5518,7 +5539,7 @@ var CheckoutArea = React5.memo(({ componentConfig }) => {
|
|
5518
5539
|
}
|
5519
5540
|
}
|
5520
5541
|
),
|
5521
|
-
hasPrePurchase && hasItems && /* @__PURE__ */
|
5542
|
+
hasPrePurchase && hasItems && /* @__PURE__ */ jsx16("div", { "data-rebuy-id": settings.pre_purchase.widget_id })
|
5522
5543
|
]
|
5523
5544
|
}
|
5524
5545
|
);
|
@@ -5532,9 +5553,9 @@ import { flattenConnection as flattenConnection3 } from "@shopify/hydrogen";
|
|
5532
5553
|
import { useContext as useContext3, useEffect as useEffect13, useMemo as useMemo13, useRef as useRef7, useState as useState15 } from "react";
|
5533
5554
|
|
5534
5555
|
// src/assets/Close.tsx
|
5535
|
-
import { jsx as
|
5556
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
5536
5557
|
var Close = () => {
|
5537
|
-
return /* @__PURE__ */
|
5558
|
+
return /* @__PURE__ */ jsx17("svg", { height: "1em", viewBox: "0 0 352 512", width: "1em", children: /* @__PURE__ */ jsx17("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" }) });
|
5538
5559
|
};
|
5539
5560
|
|
5540
5561
|
// src/hooks/useBreakpoint.ts
|
@@ -6043,7 +6064,6 @@ var defaultProductCardSettings = {
|
|
6043
6064
|
// src/components/ProductCard/ProductCard.tsx
|
6044
6065
|
import { Image } from "@shopify/hydrogen";
|
6045
6066
|
import { useCallback as useCallback9, useMemo as useMemo12, useState as useState12 } from "react";
|
6046
|
-
import { Link } from "react-router";
|
6047
6067
|
|
6048
6068
|
// src/components/AddToCartBtn/HydrogenAddToCartBtn.tsx
|
6049
6069
|
import { CartForm, Money } from "@shopify/hydrogen";
|
@@ -6053,7 +6073,7 @@ var result9 = { "rebuy-cart-button": "AddToCartBtn_rebuy-cart-button", "rebuy-ca
|
|
6053
6073
|
var AddToCartBtn_default = result9;
|
6054
6074
|
|
6055
6075
|
// src/components/AddToCartBtn/HydrogenAddToCartBtn.tsx
|
6056
|
-
import { Fragment as Fragment5, jsx as
|
6076
|
+
import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
6057
6077
|
var HydrogenAddToCartBtn = ({
|
6058
6078
|
addToCartBtnText,
|
6059
6079
|
addToCartCallback,
|
@@ -6075,7 +6095,7 @@ var HydrogenAddToCartBtn = ({
|
|
6075
6095
|
addToCartCallback();
|
6076
6096
|
}
|
6077
6097
|
};
|
6078
|
-
return /* @__PURE__ */
|
6098
|
+
return /* @__PURE__ */ jsx18("div", { className: AddToCartBtn_default["rebuy-cart-button__container"], children: /* @__PURE__ */ jsx18(
|
6079
6099
|
CartForm,
|
6080
6100
|
{
|
6081
6101
|
action: CartForm.ACTIONS.LinesAdd,
|
@@ -6083,7 +6103,7 @@ var HydrogenAddToCartBtn = ({
|
|
6083
6103
|
lines: linesToAdd
|
6084
6104
|
},
|
6085
6105
|
route: "/cart",
|
6086
|
-
children: (fetcher) => /* @__PURE__ */
|
6106
|
+
children: (fetcher) => /* @__PURE__ */ jsx18(Fragment5, { children: /* @__PURE__ */ jsxs9(
|
6087
6107
|
"button",
|
6088
6108
|
{
|
6089
6109
|
className: AddToCartBtn_default["rebuy-cart-button"],
|
@@ -6093,8 +6113,8 @@ var HydrogenAddToCartBtn = ({
|
|
6093
6113
|
children: [
|
6094
6114
|
addToCartBtnText,
|
6095
6115
|
moneyData && /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
6096
|
-
/* @__PURE__ */
|
6097
|
-
/* @__PURE__ */
|
6116
|
+
/* @__PURE__ */ jsx18("span", { children: " | " }),
|
6117
|
+
/* @__PURE__ */ jsx18(Money, { data: moneyData, withoutTrailingZeros: true })
|
6098
6118
|
] })
|
6099
6119
|
]
|
6100
6120
|
}
|
@@ -6105,7 +6125,7 @@ var HydrogenAddToCartBtn = ({
|
|
6105
6125
|
|
6106
6126
|
// src/components/AddToCartBtn/HydrogenReactAddToCartBtn.tsx
|
6107
6127
|
import { Money as Money2, useCart as useCart2 } from "@shopify/hydrogen-react";
|
6108
|
-
import { Fragment as Fragment6, jsx as
|
6128
|
+
import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
6109
6129
|
var HydrogenReactAddToCartBtn = ({
|
6110
6130
|
addToCartBtnText,
|
6111
6131
|
addToCartCallback,
|
@@ -6131,14 +6151,14 @@ var HydrogenReactAddToCartBtn = ({
|
|
6131
6151
|
return /* @__PURE__ */ jsxs10("button", { className: AddToCartBtn_default["rebuy-cart-button"], disabled, onClick: handleAddToCart, type: "button", children: [
|
6132
6152
|
addToCartBtnText,
|
6133
6153
|
moneyData && /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
6134
|
-
/* @__PURE__ */
|
6135
|
-
/* @__PURE__ */
|
6154
|
+
/* @__PURE__ */ jsx19("span", { children: " | " }),
|
6155
|
+
/* @__PURE__ */ jsx19(Money2, { data: moneyData, withoutTrailingZeros: true })
|
6136
6156
|
] })
|
6137
6157
|
] });
|
6138
6158
|
};
|
6139
6159
|
|
6140
6160
|
// src/components/AddToCartBtn/AddToCartBtn.tsx
|
6141
|
-
import { jsx as
|
6161
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
6142
6162
|
var AddToCartBtn = ({
|
6143
6163
|
addToCartBtnText,
|
6144
6164
|
addToCartCallback,
|
@@ -6160,7 +6180,7 @@ var AddToCartBtn = ({
|
|
6160
6180
|
selectedVariant: variant
|
6161
6181
|
}));
|
6162
6182
|
if (isHydrogenReact) {
|
6163
|
-
return /* @__PURE__ */
|
6183
|
+
return /* @__PURE__ */ jsx20(
|
6164
6184
|
HydrogenReactAddToCartBtn,
|
6165
6185
|
{
|
6166
6186
|
addToCartBtnText,
|
@@ -6173,7 +6193,7 @@ var AddToCartBtn = ({
|
|
6173
6193
|
}
|
6174
6194
|
);
|
6175
6195
|
}
|
6176
|
-
return /* @__PURE__ */
|
6196
|
+
return /* @__PURE__ */ jsx20(
|
6177
6197
|
HydrogenAddToCartBtn,
|
6178
6198
|
{
|
6179
6199
|
addToCartBtnText,
|
@@ -6196,14 +6216,14 @@ var result10 = { "rebuy-product-price": "ProductPrice_rebuy-product-price", "reb
|
|
6196
6216
|
var ProductPrice_default = result10;
|
6197
6217
|
|
6198
6218
|
// src/components/ProductPrice/ProductPrice.tsx
|
6199
|
-
import { jsx as
|
6219
|
+
import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
6200
6220
|
var RebuyProductPrice = ({ selectedVariant, settingsDiscount }) => {
|
6201
6221
|
if (!selectedVariant) return null;
|
6202
6222
|
const { compareAtPriceV2: compareAtPrice, priceV2: price } = selectedVariant;
|
6203
6223
|
const isDiscounted = (price2, compareAtPrice2) => Number(compareAtPrice2?.amount) > Number(price2?.amount);
|
6204
6224
|
const currentPriceIsOnSale = compareAtPrice && isDiscounted(price, compareAtPrice);
|
6205
6225
|
const CompareAtPrice = ({ data: compareAtPriceData }) => {
|
6206
|
-
return compareAtPriceData && /* @__PURE__ */
|
6226
|
+
return compareAtPriceData && /* @__PURE__ */ jsx21(
|
6207
6227
|
Money3,
|
6208
6228
|
{
|
6209
6229
|
as: "span",
|
@@ -6214,7 +6234,7 @@ var RebuyProductPrice = ({ selectedVariant, settingsDiscount }) => {
|
|
6214
6234
|
);
|
6215
6235
|
};
|
6216
6236
|
return price && /* @__PURE__ */ jsxs11("div", { className: ProductPrice_default["rebuy-product-price"], children: [
|
6217
|
-
/* @__PURE__ */
|
6237
|
+
/* @__PURE__ */ jsx21(
|
6218
6238
|
Money3,
|
6219
6239
|
{
|
6220
6240
|
as: "span",
|
@@ -6226,7 +6246,7 @@ var RebuyProductPrice = ({ selectedVariant, settingsDiscount }) => {
|
|
6226
6246
|
withoutTrailingZeros: true
|
6227
6247
|
}
|
6228
6248
|
),
|
6229
|
-
currentPriceIsOnSale && /* @__PURE__ */
|
6249
|
+
currentPriceIsOnSale && /* @__PURE__ */ jsx21(CompareAtPrice, { data: compareAtPrice })
|
6230
6250
|
] });
|
6231
6251
|
};
|
6232
6252
|
|
@@ -6238,7 +6258,7 @@ var result11 = { "rebuy-quantity__container": "QuantityInput_rebuy-quantity__con
|
|
6238
6258
|
var QuantityInput_default = result11;
|
6239
6259
|
|
6240
6260
|
// src/components/QuantityInput/QuantityInput.tsx
|
6241
|
-
import { jsx as
|
6261
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
6242
6262
|
var QuantityInput = ({
|
6243
6263
|
defaultQuantity = 1,
|
6244
6264
|
handleSelectedQuantity,
|
@@ -6254,7 +6274,7 @@ var QuantityInput = ({
|
|
6254
6274
|
}
|
6255
6275
|
};
|
6256
6276
|
const quantityOptions = Array.from({ length: maxValue - minValue + 1 }, (_, i) => minValue + i);
|
6257
|
-
return /* @__PURE__ */
|
6277
|
+
return /* @__PURE__ */ jsx22("div", { className: QuantityInput_default["rebuy-quantity__container"], children: /* @__PURE__ */ jsx22(
|
6258
6278
|
"select",
|
6259
6279
|
{
|
6260
6280
|
"aria-label": "Product quantity",
|
@@ -6262,46 +6282,18 @@ var QuantityInput = ({
|
|
6262
6282
|
name: "quantity",
|
6263
6283
|
onChange: handleChange,
|
6264
6284
|
value: quantity,
|
6265
|
-
children: quantityOptions.map((value) => /* @__PURE__ */
|
6285
|
+
children: quantityOptions.map((value) => /* @__PURE__ */ jsx22("option", { value, children: value }, `quantity-${value}`))
|
6266
6286
|
}
|
6267
6287
|
) });
|
6268
6288
|
};
|
6269
6289
|
|
6270
|
-
// src/components/Title/Title.tsx
|
6271
|
-
import clsx5 from "clsx";
|
6272
|
-
|
6273
|
-
// src/components/Title/Title.module.css
|
6274
|
-
var result12 = { "rebuy-title": "Title_rebuy-title" };
|
6275
|
-
var Title_default = result12;
|
6276
|
-
|
6277
|
-
// src/components/Title/Title.tsx
|
6278
|
-
import { jsx as jsx22 } from "react/jsx-runtime";
|
6279
|
-
var Title = ({ className, level, style, text }) => {
|
6280
|
-
const combinedClassName = clsx5(Title_default["rebuy-title"], className);
|
6281
|
-
switch (level) {
|
6282
|
-
case "h1":
|
6283
|
-
return /* @__PURE__ */ jsx22("h1", { className: combinedClassName, style, children: text });
|
6284
|
-
default:
|
6285
|
-
case "h2":
|
6286
|
-
return /* @__PURE__ */ jsx22("h2", { className: combinedClassName, style, children: text });
|
6287
|
-
case "h3":
|
6288
|
-
return /* @__PURE__ */ jsx22("h3", { className: combinedClassName, style, children: text });
|
6289
|
-
case "h4":
|
6290
|
-
return /* @__PURE__ */ jsx22("h4", { className: combinedClassName, style, children: text });
|
6291
|
-
case "h5":
|
6292
|
-
return /* @__PURE__ */ jsx22("h5", { className: combinedClassName, style, children: text });
|
6293
|
-
case "h6":
|
6294
|
-
return /* @__PURE__ */ jsx22("h6", { className: combinedClassName, style, children: text });
|
6295
|
-
}
|
6296
|
-
};
|
6297
|
-
|
6298
6290
|
// src/components/VariantSelect/VariantSelect.tsx
|
6299
|
-
import
|
6291
|
+
import clsx5 from "clsx";
|
6300
6292
|
import { useEffect as useEffect10, useState as useState11 } from "react";
|
6301
6293
|
|
6302
6294
|
// src/components/VariantSelect/VariantSelect.module.css
|
6303
|
-
var
|
6304
|
-
var VariantSelect_default =
|
6295
|
+
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" };
|
6296
|
+
var VariantSelect_default = result12;
|
6305
6297
|
|
6306
6298
|
// src/components/VariantSelect/VariantSelect.tsx
|
6307
6299
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
@@ -6340,7 +6332,7 @@ var VariantSelect = ({ handleSelectedVariant, product, selectedId, style = "sele
|
|
6340
6332
|
"button",
|
6341
6333
|
{
|
6342
6334
|
"aria-pressed": id === selectedVariantId,
|
6343
|
-
className:
|
6335
|
+
className: clsx5(
|
6344
6336
|
VariantSelect_default["rebuy-variant__button"],
|
6345
6337
|
id === selectedVariantId && VariantSelect_default["rebuy-variant__button--selected"]
|
6346
6338
|
),
|
@@ -6352,15 +6344,44 @@ var VariantSelect = ({ handleSelectedVariant, product, selectedId, style = "sele
|
|
6352
6344
|
)) }) });
|
6353
6345
|
};
|
6354
6346
|
|
6347
|
+
// src/components/Title/Title.tsx
|
6348
|
+
import clsx6 from "clsx";
|
6349
|
+
|
6350
|
+
// src/components/Title/Title.module.css
|
6351
|
+
var result13 = { "rebuy-title": "Title_rebuy-title" };
|
6352
|
+
var Title_default = result13;
|
6353
|
+
|
6354
|
+
// src/components/Title/Title.tsx
|
6355
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
6356
|
+
var Title = ({ className, level, style, text }) => {
|
6357
|
+
const combinedClassName = clsx6(Title_default["rebuy-title"], className);
|
6358
|
+
switch (level) {
|
6359
|
+
case "h1":
|
6360
|
+
return /* @__PURE__ */ jsx24("h1", { className: combinedClassName, style, children: text });
|
6361
|
+
default:
|
6362
|
+
case "h2":
|
6363
|
+
return /* @__PURE__ */ jsx24("h2", { className: combinedClassName, style, children: text });
|
6364
|
+
case "h3":
|
6365
|
+
return /* @__PURE__ */ jsx24("h3", { className: combinedClassName, style, children: text });
|
6366
|
+
case "h4":
|
6367
|
+
return /* @__PURE__ */ jsx24("h4", { className: combinedClassName, style, children: text });
|
6368
|
+
case "h5":
|
6369
|
+
return /* @__PURE__ */ jsx24("h5", { className: combinedClassName, style, children: text });
|
6370
|
+
case "h6":
|
6371
|
+
return /* @__PURE__ */ jsx24("h6", { className: combinedClassName, style, children: text });
|
6372
|
+
}
|
6373
|
+
};
|
6374
|
+
|
6355
6375
|
// src/components/ProductCard/ProductCard.module.css
|
6356
6376
|
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" };
|
6357
6377
|
var ProductCard_default = result14;
|
6358
6378
|
|
6359
6379
|
// src/components/ProductCard/ProductCard.tsx
|
6360
|
-
import { jsx as
|
6380
|
+
import { jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
|
6361
6381
|
var ProductCard = ({
|
6362
6382
|
addToCartBtnText,
|
6363
6383
|
addToCartCallback,
|
6384
|
+
isCrossSell,
|
6364
6385
|
isHydrogenReact,
|
6365
6386
|
isInPopup,
|
6366
6387
|
onPopupDismiss,
|
@@ -6372,6 +6393,7 @@ var ProductCard = ({
|
|
6372
6393
|
const [selectedVariant, setSelectedVariant] = useState12(product.variants.nodes[0]);
|
6373
6394
|
const [selectedQuantity, setSelectedQuantity] = useState12(settings?.quantityInput?.default_quantity || 1);
|
6374
6395
|
const [interactionStatus, setInteractionStatus] = useState12("ready");
|
6396
|
+
const { toggleCart } = useSmartCart();
|
6375
6397
|
const displayImage = selectedVariant.image || product.featuredImage;
|
6376
6398
|
const handleSelectedVariant = useCallback9((product2, variant_id) => {
|
6377
6399
|
const updatedVariant = product2.variants.nodes.find((variant) => variant.id === variant_id);
|
@@ -6383,6 +6405,9 @@ var ProductCard = ({
|
|
6383
6405
|
setSelectedQuantity(quantity);
|
6384
6406
|
}, []);
|
6385
6407
|
const handleLinkClick = useCallback9(() => {
|
6408
|
+
if (isCrossSell) {
|
6409
|
+
toggleCart();
|
6410
|
+
}
|
6386
6411
|
if (isInPopup && onPopupDismiss) {
|
6387
6412
|
onPopupDismiss();
|
6388
6413
|
}
|
@@ -6441,38 +6466,90 @@ var ProductCard = ({
|
|
6441
6466
|
const showQuantityInput = settings?.quantityInput?.enabled && settings?.quantityInput?.max_value !== null && settings?.quantityInput?.min_value !== null;
|
6442
6467
|
return /* @__PURE__ */ jsxs12("div", { className: ProductCard_default["rebuy-product-card__container"], children: [
|
6443
6468
|
/* @__PURE__ */ jsxs12("div", { className: ProductCard_default["rebuy-product-card"], "data-layout": cardLayout, children: [
|
6444
|
-
/* @__PURE__ */
|
6445
|
-
|
6446
|
-
|
6447
|
-
|
6448
|
-
|
6449
|
-
|
6450
|
-
|
6451
|
-
|
6452
|
-
|
6453
|
-
|
6469
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
6470
|
+
/* @__PURE__ */ jsx25(
|
6471
|
+
RebuyLink,
|
6472
|
+
{
|
6473
|
+
ariaLabel: `View ${product.title}`,
|
6474
|
+
className: ProductCard_default["rebuy-product-card__media-link"],
|
6475
|
+
handle: `/products/${product.handle}`,
|
6476
|
+
onClick: handleLinkClick,
|
6477
|
+
children: /* @__PURE__ */ jsx25(
|
6478
|
+
Image,
|
6479
|
+
{
|
6480
|
+
alt: displayImage?.altText ?? `Picture of ${product.title}`,
|
6481
|
+
className: ProductCard_default["rebuy-product-card__image"],
|
6482
|
+
data: displayImage,
|
6483
|
+
sizes: "(max-width: 320px) 280px, (max-width: 768px) 720px, 1440px"
|
6484
|
+
}
|
6485
|
+
)
|
6486
|
+
}
|
6487
|
+
),
|
6488
|
+
settings?.layoutStyle === "grid" && /* @__PURE__ */ jsxs12("div", { className: ProductCard_default["rebuy-product-card__content"], children: [
|
6489
|
+
/* @__PURE__ */ jsxs12("div", { className: ProductCard_default["rebuy-product-card__header"], children: [
|
6490
|
+
product.vendor && /* @__PURE__ */ jsx25("p", { className: ProductCard_default["rebuy-product-card__vendor"], children: product.vendor }),
|
6491
|
+
/* @__PURE__ */ jsx25(
|
6492
|
+
RebuyLink,
|
6493
|
+
{
|
6494
|
+
ariaLabel: `View ${product.title}`,
|
6495
|
+
className: ProductCard_default["rebuy-product-card__title-link"],
|
6496
|
+
handle: `/products/${product.handle}`,
|
6497
|
+
onClick: handleLinkClick,
|
6498
|
+
children: /* @__PURE__ */ jsx25(
|
6499
|
+
Title,
|
6500
|
+
{
|
6501
|
+
className: ProductCard_default["rebuy-product-card__title"],
|
6502
|
+
level: productCardTitleLevel,
|
6503
|
+
text: product.title
|
6504
|
+
}
|
6505
|
+
)
|
6506
|
+
}
|
6507
|
+
),
|
6508
|
+
showVariantTitle && /* @__PURE__ */ jsx25("div", { className: ProductCard_default["rebuy-product-card__variant-title"], children: selectedVariant.title })
|
6509
|
+
] }),
|
6510
|
+
/* @__PURE__ */ jsx25(
|
6511
|
+
RebuyProductPrice,
|
6454
6512
|
{
|
6455
|
-
|
6456
|
-
|
6457
|
-
data: displayImage,
|
6458
|
-
sizes: "(max-width: 320px) 280px, (max-width: 768px) 720px, 1440px"
|
6513
|
+
selectedVariant,
|
6514
|
+
settingsDiscount: settings?.settingsDiscount
|
6459
6515
|
}
|
6460
|
-
)
|
6461
|
-
|
6462
|
-
|
6516
|
+
),
|
6517
|
+
showReviews && /* @__PURE__ */ jsxs12("div", { "aria-label": "product star rating", className: ProductCard_default["rebuy-product-card__review"], children: [
|
6518
|
+
/* @__PURE__ */ jsxs12("span", { className: ProductCard_default["rebuy-product-card__star-rating"], children: [
|
6519
|
+
productReviewsRating && /* @__PURE__ */ jsxs12("span", { className: ProductCard_default["rebuy-product-card__star-rating-value"], children: [
|
6520
|
+
productReviewsRating,
|
6521
|
+
" stars out of 5 stars"
|
6522
|
+
] }),
|
6523
|
+
/* @__PURE__ */ jsx25("span", { className: ProductCard_default["rebuy-product-card__star-rating-background"] }),
|
6524
|
+
/* @__PURE__ */ jsx25(
|
6525
|
+
"span",
|
6526
|
+
{
|
6527
|
+
className: ProductCard_default["rebuy-product-card__star-rating-foreground"],
|
6528
|
+
style: productReviewsRating ? { width: productReviewsRating / 5 * 100 + "%" } : {}
|
6529
|
+
}
|
6530
|
+
)
|
6531
|
+
] }),
|
6532
|
+
product.reviews?.review_count && /* @__PURE__ */ jsxs12("span", { className: ProductCard_default["rebuy-product-card__review-count"], children: [
|
6533
|
+
"(",
|
6534
|
+
product.reviews.review_count,
|
6535
|
+
")"
|
6536
|
+
] })
|
6537
|
+
] }),
|
6538
|
+
showProductDescription && /* @__PURE__ */ jsx25("div", { className: ProductCard_default["rebuy-product-card__description"], children: /* @__PURE__ */ jsx25("p", { children: product.description }) })
|
6539
|
+
] })
|
6540
|
+
] }),
|
6463
6541
|
/* @__PURE__ */ jsxs12("div", { className: ProductCard_default["rebuy-product-card__info"], children: [
|
6464
|
-
/* @__PURE__ */ jsxs12("div", { className: ProductCard_default["rebuy-product-card__content"], children: [
|
6542
|
+
settings?.layoutStyle !== "grid" && /* @__PURE__ */ jsxs12("div", { className: ProductCard_default["rebuy-product-card__content"], children: [
|
6465
6543
|
/* @__PURE__ */ jsxs12("div", { className: ProductCard_default["rebuy-product-card__header"], children: [
|
6466
|
-
product.vendor && /* @__PURE__ */
|
6467
|
-
/* @__PURE__ */
|
6468
|
-
|
6544
|
+
product.vendor && /* @__PURE__ */ jsx25("p", { className: ProductCard_default["rebuy-product-card__vendor"], children: product.vendor }),
|
6545
|
+
/* @__PURE__ */ jsx25(
|
6546
|
+
RebuyLink,
|
6469
6547
|
{
|
6470
|
-
|
6548
|
+
ariaLabel: `View ${product.title}`,
|
6471
6549
|
className: ProductCard_default["rebuy-product-card__title-link"],
|
6550
|
+
handle: `/products/${product.handle}`,
|
6472
6551
|
onClick: handleLinkClick,
|
6473
|
-
|
6474
|
-
to: `/products/${product.handle}`,
|
6475
|
-
children: /* @__PURE__ */ jsx24(
|
6552
|
+
children: /* @__PURE__ */ jsx25(
|
6476
6553
|
Title,
|
6477
6554
|
{
|
6478
6555
|
className: ProductCard_default["rebuy-product-card__title"],
|
@@ -6482,9 +6559,9 @@ var ProductCard = ({
|
|
6482
6559
|
)
|
6483
6560
|
}
|
6484
6561
|
),
|
6485
|
-
showVariantTitle && /* @__PURE__ */
|
6562
|
+
showVariantTitle && /* @__PURE__ */ jsx25("div", { className: ProductCard_default["rebuy-product-card__variant-title"], children: selectedVariant.title })
|
6486
6563
|
] }),
|
6487
|
-
/* @__PURE__ */
|
6564
|
+
/* @__PURE__ */ jsx25(
|
6488
6565
|
RebuyProductPrice,
|
6489
6566
|
{
|
6490
6567
|
selectedVariant,
|
@@ -6497,8 +6574,8 @@ var ProductCard = ({
|
|
6497
6574
|
productReviewsRating,
|
6498
6575
|
" stars out of 5 stars"
|
6499
6576
|
] }),
|
6500
|
-
/* @__PURE__ */
|
6501
|
-
/* @__PURE__ */
|
6577
|
+
/* @__PURE__ */ jsx25("span", { className: ProductCard_default["rebuy-product-card__star-rating-background"] }),
|
6578
|
+
/* @__PURE__ */ jsx25(
|
6502
6579
|
"span",
|
6503
6580
|
{
|
6504
6581
|
className: ProductCard_default["rebuy-product-card__star-rating-foreground"],
|
@@ -6512,15 +6589,15 @@ var ProductCard = ({
|
|
6512
6589
|
")"
|
6513
6590
|
] })
|
6514
6591
|
] }),
|
6515
|
-
showProductDescription && /* @__PURE__ */
|
6592
|
+
showProductDescription && /* @__PURE__ */ jsx25("div", { className: ProductCard_default["rebuy-product-card__description"], children: /* @__PURE__ */ jsx25("p", { children: product.description }) })
|
6516
6593
|
] }),
|
6517
6594
|
/* @__PURE__ */ jsxs12("div", { className: ProductCard_default["rebuy-product-card__actions"], children: [
|
6518
|
-
showVariantSelect && cardLayout !== "line" && /* @__PURE__ */
|
6595
|
+
showVariantSelect && cardLayout !== "line" && /* @__PURE__ */ jsx25(
|
6519
6596
|
"div",
|
6520
6597
|
{
|
6521
6598
|
className: ProductCard_default["rebuy-product-card__actions-variant-select"],
|
6522
6599
|
"data-layout": cardLayout,
|
6523
|
-
children: /* @__PURE__ */
|
6600
|
+
children: /* @__PURE__ */ jsx25(
|
6524
6601
|
VariantSelect,
|
6525
6602
|
{
|
6526
6603
|
handleSelectedVariant,
|
@@ -6531,7 +6608,7 @@ var ProductCard = ({
|
|
6531
6608
|
)
|
6532
6609
|
}
|
6533
6610
|
),
|
6534
|
-
showQuantityInput && /* @__PURE__ */
|
6611
|
+
showQuantityInput && /* @__PURE__ */ jsx25("div", { className: ProductCard_default["rebuy-product-card__actions-quantity"], children: /* @__PURE__ */ jsx25(
|
6535
6612
|
QuantityInput,
|
6536
6613
|
{
|
6537
6614
|
defaultQuantity: settings?.quantityInput?.default_quantity,
|
@@ -6540,7 +6617,7 @@ var ProductCard = ({
|
|
6540
6617
|
minValue: settings?.quantityInput?.min_value
|
6541
6618
|
}
|
6542
6619
|
) }),
|
6543
|
-
/* @__PURE__ */
|
6620
|
+
/* @__PURE__ */ jsx25("div", { className: ProductCard_default["rebuy-product-card__actions-button"], children: /* @__PURE__ */ jsx25(
|
6544
6621
|
AddToCartBtn,
|
6545
6622
|
{
|
6546
6623
|
addToCartBtnText: atcButtonLabel,
|
@@ -6555,7 +6632,7 @@ var ProductCard = ({
|
|
6555
6632
|
] })
|
6556
6633
|
] })
|
6557
6634
|
] }),
|
6558
|
-
showVariantSelect && cardLayout === "line" && /* @__PURE__ */
|
6635
|
+
showVariantSelect && cardLayout === "line" && /* @__PURE__ */ jsx25("div", { className: ProductCard_default["rebuy-product-card__variant-select"], "data-layout": cardLayout, children: /* @__PURE__ */ jsx25(
|
6559
6636
|
VariantSelect,
|
6560
6637
|
{
|
6561
6638
|
handleSelectedVariant,
|
@@ -6575,12 +6652,15 @@ var result15 = { "rebuy-carousel": "ProductCarousel_rebuy-carousel", "rebuy-caro
|
|
6575
6652
|
var ProductCarousel_default = result15;
|
6576
6653
|
|
6577
6654
|
// src/components/ProductCarousel/ProductCarousel.tsx
|
6578
|
-
import { jsx as
|
6655
|
+
import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
|
6579
6656
|
var ProductCarousel = ({
|
6580
6657
|
addToCartBtnText,
|
6581
6658
|
addToCartCallback,
|
6582
6659
|
columns,
|
6660
|
+
isCrossSell,
|
6583
6661
|
isHydrogenReact,
|
6662
|
+
isInPopup,
|
6663
|
+
onPopupDismiss,
|
6584
6664
|
productCardTitleLevel,
|
6585
6665
|
products,
|
6586
6666
|
settings,
|
@@ -6622,17 +6702,20 @@ var ProductCarousel = ({
|
|
6622
6702
|
slides.push(repeatedProducts.slice(i, i + columns));
|
6623
6703
|
}
|
6624
6704
|
return /* @__PURE__ */ jsxs13("div", { className: ProductCarousel_default["rebuy-carousel"], children: [
|
6625
|
-
/* @__PURE__ */
|
6705
|
+
/* @__PURE__ */ jsx26(
|
6626
6706
|
"div",
|
6627
6707
|
{
|
6628
6708
|
className: ProductCarousel_default["rebuy-carousel__container"],
|
6629
6709
|
style: { transform: `translateX(-${currentSlide * 100}%)` },
|
6630
|
-
children: slides.map((slideProducts, index) => /* @__PURE__ */
|
6710
|
+
children: slides.map((slideProducts, index) => /* @__PURE__ */ jsx26("div", { className: ProductCarousel_default["rebuy-carousel__slide"], children: /* @__PURE__ */ jsx26("div", { className: ProductCarousel_default["rebuy-carousel__grid"], "data-columns": columns, children: slideProducts.map((product, productIndex) => /* @__PURE__ */ jsx26(
|
6631
6711
|
ProductCard,
|
6632
6712
|
{
|
6633
6713
|
addToCartBtnText,
|
6634
6714
|
addToCartCallback,
|
6715
|
+
isCrossSell,
|
6635
6716
|
isHydrogenReact,
|
6717
|
+
isInPopup,
|
6718
|
+
onPopupDismiss,
|
6636
6719
|
product,
|
6637
6720
|
productCardTitleLevel,
|
6638
6721
|
settings,
|
@@ -6643,10 +6726,10 @@ var ProductCarousel = ({
|
|
6643
6726
|
}
|
6644
6727
|
),
|
6645
6728
|
totalSlides > 1 && /* @__PURE__ */ jsxs13("div", { className: ProductCarousel_default["rebuy-carousel__controls"], children: [
|
6646
|
-
/* @__PURE__ */
|
6647
|
-
/* @__PURE__ */
|
6729
|
+
/* @__PURE__ */ jsx26("button", { className: ProductCarousel_default["rebuy-carousel__prev"], onClick: prevSlide, type: "button", children: "\u2190" }),
|
6730
|
+
/* @__PURE__ */ jsx26("button", { className: ProductCarousel_default["rebuy-carousel__next"], onClick: nextSlide, type: "button", children: "\u2192" })
|
6648
6731
|
] }),
|
6649
|
-
showPagination && totalSlides > 1 && /* @__PURE__ */
|
6732
|
+
showPagination && totalSlides > 1 && /* @__PURE__ */ jsx26("div", { className: ProductCarousel_default["rebuy-carousel__pagination"], children: Array.from({ length: totalSlides }).map((_, index) => /* @__PURE__ */ jsx26(
|
6650
6733
|
"button",
|
6651
6734
|
{
|
6652
6735
|
className: ProductCarousel_default["rebuy-carousel__dot"],
|
@@ -6668,7 +6751,7 @@ var result16 = { "rebuy-timer__container": "Timer_rebuy-timer__container", "rebu
|
|
6668
6751
|
var Timer_default = result16;
|
6669
6752
|
|
6670
6753
|
// src/components/Timer/Timer.tsx
|
6671
|
-
import { jsx as
|
6754
|
+
import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
6672
6755
|
var Timer = ({ action, durationMinutes, durationSeconds, isPopup = false, onDismiss, title }) => {
|
6673
6756
|
const initialTotalSeconds = (durationMinutes || 0) * 60 + (durationSeconds || 0);
|
6674
6757
|
const [totalSeconds, setTotalSeconds] = useState14(initialTotalSeconds);
|
@@ -6711,16 +6794,16 @@ var Timer = ({ action, durationMinutes, durationSeconds, isPopup = false, onDism
|
|
6711
6794
|
return () => clearInterval(interval);
|
6712
6795
|
}, [timerActive, handleTimerEnd]);
|
6713
6796
|
const isUrgent = totalSeconds < 10;
|
6714
|
-
return /* @__PURE__ */
|
6715
|
-
/* @__PURE__ */
|
6797
|
+
return /* @__PURE__ */ jsx27("div", { className: Timer_default["rebuy-timer__container"], children: /* @__PURE__ */ jsxs14("p", { className: Timer_default["rebuy-timer__text"], children: [
|
6798
|
+
/* @__PURE__ */ jsx27("span", { className: Timer_default["rebuy-timer__title"], children: title }),
|
6716
6799
|
/* @__PURE__ */ jsxs14(
|
6717
6800
|
"span",
|
6718
6801
|
{
|
6719
6802
|
className: clsx7(Timer_default["rebuy-timer__display"], isUrgent && Timer_default["rebuy-timer__display--urgent"]),
|
6720
6803
|
children: [
|
6721
|
-
/* @__PURE__ */
|
6722
|
-
/* @__PURE__ */
|
6723
|
-
/* @__PURE__ */
|
6804
|
+
/* @__PURE__ */ jsx27("span", { className: Timer_default["rebuy-timer__minutes"], children: formattedMinutes }),
|
6805
|
+
/* @__PURE__ */ jsx27("span", { className: Timer_default["rebuy-timer__separator"], children: ":" }),
|
6806
|
+
/* @__PURE__ */ jsx27("span", { className: Timer_default["rebuy-timer__seconds"], children: formattedSeconds })
|
6724
6807
|
]
|
6725
6808
|
}
|
6726
6809
|
)
|
@@ -6770,12 +6853,13 @@ var result17 = { "rebuy-widget__container": "RebuyWidget_rebuy-widget__container
|
|
6770
6853
|
var RebuyWidget_default = result17;
|
6771
6854
|
|
6772
6855
|
// src/widgets/RebuyWidget/WidgetContent.tsx
|
6773
|
-
import { jsx as
|
6856
|
+
import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
6774
6857
|
var WidgetContent = ({
|
6775
6858
|
addToCartCallback,
|
6776
6859
|
customTitle,
|
6777
6860
|
customTitleLevel,
|
6778
6861
|
customTitleStyle,
|
6862
|
+
isCrossSell,
|
6779
6863
|
isHydrogenReact,
|
6780
6864
|
isInPopup,
|
6781
6865
|
onDismiss,
|
@@ -6826,13 +6910,16 @@ var WidgetContent = ({
|
|
6826
6910
|
return null;
|
6827
6911
|
}
|
6828
6912
|
if (isCarousel) {
|
6829
|
-
return /* @__PURE__ */
|
6913
|
+
return /* @__PURE__ */ jsx28(
|
6830
6914
|
ProductCarousel,
|
6831
6915
|
{
|
6832
6916
|
addToCartBtnText: settings?.language.add_to_cart,
|
6833
6917
|
addToCartCallback,
|
6834
6918
|
columns,
|
6919
|
+
isCrossSell,
|
6835
6920
|
isHydrogenReact,
|
6921
|
+
isInPopup,
|
6922
|
+
onPopupDismiss: onDismiss,
|
6836
6923
|
productCardTitleLevel,
|
6837
6924
|
products,
|
6838
6925
|
settings: productCardSettings,
|
@@ -6841,11 +6928,12 @@ var WidgetContent = ({
|
|
6841
6928
|
}
|
6842
6929
|
);
|
6843
6930
|
}
|
6844
|
-
return /* @__PURE__ */
|
6931
|
+
return /* @__PURE__ */ jsx28("div", { className: RebuyWidget_default["rebuy-widget__product-grid"], "data-columns": columns, role: "list", tabIndex: 0, children: products.map((product) => /* @__PURE__ */ jsx28("div", { children: /* @__PURE__ */ jsx28(
|
6845
6932
|
ProductCard,
|
6846
6933
|
{
|
6847
6934
|
addToCartBtnText: settings?.language.add_to_cart,
|
6848
6935
|
addToCartCallback,
|
6936
|
+
isCrossSell,
|
6849
6937
|
isHydrogenReact,
|
6850
6938
|
isInPopup,
|
6851
6939
|
onPopupDismiss: onDismiss,
|
@@ -6857,7 +6945,7 @@ var WidgetContent = ({
|
|
6857
6945
|
) }, product.id)) });
|
6858
6946
|
};
|
6859
6947
|
return /* @__PURE__ */ jsxs15("div", { className: RebuyWidget_default["rebuy-widget__inner-content"], children: [
|
6860
|
-
hasTimer && /* @__PURE__ */
|
6948
|
+
hasTimer && /* @__PURE__ */ jsx28(
|
6861
6949
|
Timer,
|
6862
6950
|
{
|
6863
6951
|
action: settings?.timer.action,
|
@@ -6868,7 +6956,7 @@ var WidgetContent = ({
|
|
6868
6956
|
title: settings?.language.timer_title
|
6869
6957
|
}
|
6870
6958
|
),
|
6871
|
-
hasSuperTitle && /* @__PURE__ */
|
6959
|
+
hasSuperTitle && /* @__PURE__ */ jsx28(
|
6872
6960
|
Title,
|
6873
6961
|
{
|
6874
6962
|
level: getTitleLevel(customTitleLevel),
|
@@ -6876,7 +6964,7 @@ var WidgetContent = ({
|
|
6876
6964
|
text: settings.language.super_title
|
6877
6965
|
}
|
6878
6966
|
),
|
6879
|
-
hasPrimaryTitle && /* @__PURE__ */
|
6967
|
+
hasPrimaryTitle && /* @__PURE__ */ jsx28(
|
6880
6968
|
Title,
|
6881
6969
|
{
|
6882
6970
|
level: getTitleLevel(customTitleLevel, hasSuperTitle ? true : false),
|
@@ -6884,20 +6972,20 @@ var WidgetContent = ({
|
|
6884
6972
|
text: primaryTitle
|
6885
6973
|
}
|
6886
6974
|
),
|
6887
|
-
hasDescription && /* @__PURE__ */
|
6975
|
+
hasDescription && /* @__PURE__ */ jsx28("p", { className: RebuyWidget_default["rebuy-widget__description"], children: settings.language.description }),
|
6888
6976
|
renderProducts()
|
6889
6977
|
] });
|
6890
6978
|
};
|
6891
6979
|
|
6892
6980
|
// src/widgets/RebuyWidget/RebuyWidget.tsx
|
6893
|
-
import { Fragment as Fragment7, jsx as
|
6981
|
+
import { Fragment as Fragment7, jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
|
6894
6982
|
var RebuyWidget = (props) => {
|
6895
6983
|
const {
|
6896
6984
|
addToCartCallback,
|
6897
6985
|
customTitle,
|
6898
6986
|
customTitleLevel = "h2",
|
6899
6987
|
customTitleStyle,
|
6900
|
-
|
6988
|
+
isCrossSell,
|
6901
6989
|
popupTriggerId,
|
6902
6990
|
product,
|
6903
6991
|
productId,
|
@@ -7119,17 +7207,17 @@ var RebuyWidget = (props) => {
|
|
7119
7207
|
if (settings && !loadingSettings && shouldHideWidget) {
|
7120
7208
|
return null;
|
7121
7209
|
}
|
7122
|
-
return /* @__PURE__ */
|
7123
|
-
/* @__PURE__ */
|
7210
|
+
return /* @__PURE__ */ jsx29(Fragment7, { children: (settings || products?.length > 0) && !loadingSettings && /* @__PURE__ */ jsx29("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__ */ jsx29("div", { children: showPopup && /* @__PURE__ */ jsx29("div", { className: RebuyWidget_default["rebuy-widget__popup-overlay"], children: /* @__PURE__ */ jsx29("div", { className: RebuyWidget_default["rebuy-widget__popup-content"], ref: popupRef, children: /* @__PURE__ */ jsxs16("div", { className: RebuyWidget_default["rebuy-widget__content"], children: [
|
7211
|
+
/* @__PURE__ */ jsx29(
|
7124
7212
|
"button",
|
7125
7213
|
{
|
7126
7214
|
"aria-label": "close modal",
|
7127
7215
|
className: RebuyWidget_default["rebuy-widget__modal-close"],
|
7128
7216
|
onClick: closePopup,
|
7129
|
-
children: /* @__PURE__ */
|
7217
|
+
children: /* @__PURE__ */ jsx29(Close, {})
|
7130
7218
|
}
|
7131
7219
|
),
|
7132
|
-
/* @__PURE__ */
|
7220
|
+
/* @__PURE__ */ jsx29(
|
7133
7221
|
WidgetContent,
|
7134
7222
|
{
|
7135
7223
|
addToCartCallback: () => {
|
@@ -7141,21 +7229,22 @@ var RebuyWidget = (props) => {
|
|
7141
7229
|
customTitle,
|
7142
7230
|
customTitleLevel,
|
7143
7231
|
customTitleStyle,
|
7144
|
-
isHydrogenReact,
|
7232
|
+
isHydrogenReact: rebuyGeneralContext?.contextParameters?.isHydrogenReact,
|
7145
7233
|
isInPopup: true,
|
7146
7234
|
onDismiss: closePopup,
|
7147
7235
|
products,
|
7148
7236
|
settings
|
7149
7237
|
}
|
7150
7238
|
)
|
7151
|
-
] }) }) }) }) : /* @__PURE__ */
|
7239
|
+
] }) }) }) }) : /* @__PURE__ */ jsx29("div", { className: RebuyWidget_default["rebuy-widget__content"], children: /* @__PURE__ */ jsx29(
|
7152
7240
|
WidgetContent,
|
7153
7241
|
{
|
7154
7242
|
addToCartCallback,
|
7155
7243
|
customTitle,
|
7156
7244
|
customTitleLevel,
|
7157
7245
|
customTitleStyle,
|
7158
|
-
|
7246
|
+
isCrossSell,
|
7247
|
+
isHydrogenReact: rebuyGeneralContext?.contextParameters?.isHydrogenReact,
|
7159
7248
|
isInPopup: settings?.display_type === "popup",
|
7160
7249
|
products,
|
7161
7250
|
settings
|
@@ -7164,14 +7253,14 @@ var RebuyWidget = (props) => {
|
|
7164
7253
|
};
|
7165
7254
|
|
7166
7255
|
// src/smart-cart/components/CrossSell/CrossSell.tsx
|
7167
|
-
import { jsx as
|
7256
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
7168
7257
|
var CrossSell = ({ componentConfig }) => {
|
7169
7258
|
const widgetId = componentConfig.settings.widget_id;
|
7170
7259
|
if (!widgetId) {
|
7171
7260
|
console.warn("[CrossSell] Widget ID is missing from component configuration");
|
7172
7261
|
return null;
|
7173
7262
|
}
|
7174
|
-
return /* @__PURE__ */
|
7263
|
+
return /* @__PURE__ */ jsx30("div", { "data-rebuy-component": "cross-sell-widget", "data-rebuy-component-id": widgetId, children: /* @__PURE__ */ jsx30(RebuyWidget, { isCrossSell: true, widgetId }) });
|
7175
7264
|
};
|
7176
7265
|
|
7177
7266
|
// src/smart-cart/components/CustomCode/CustomCodeBlock.tsx
|
@@ -7248,7 +7337,7 @@ var executeScriptsInContainer = (container, debugKey, debugContext) => {
|
|
7248
7337
|
};
|
7249
7338
|
|
7250
7339
|
// src/smart-cart/components/CustomCode/CustomCodeBlock.tsx
|
7251
|
-
import { jsx as
|
7340
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
7252
7341
|
var CustomCodeBlock = React6.memo(({ componentConfig }) => {
|
7253
7342
|
const containerRef = useRef8(null);
|
7254
7343
|
const executedCodeRef = useRef8(null);
|
@@ -7275,7 +7364,7 @@ var CustomCodeBlock = React6.memo(({ componentConfig }) => {
|
|
7275
7364
|
if (!htmlCode) {
|
7276
7365
|
return null;
|
7277
7366
|
}
|
7278
|
-
return /* @__PURE__ */
|
7367
|
+
return /* @__PURE__ */ jsx31(
|
7279
7368
|
"div",
|
7280
7369
|
{
|
7281
7370
|
dangerouslySetInnerHTML: { __html: htmlCode },
|
@@ -7377,7 +7466,7 @@ var result18 = { "rebuy-discount-code-input": "DiscountCodeInput_rebuy-discount-
|
|
7377
7466
|
var DiscountCodeInput_default = result18;
|
7378
7467
|
|
7379
7468
|
// src/smart-cart/components/DiscountCodeInput/DiscountCodeInput.tsx
|
7380
|
-
import { jsx as
|
7469
|
+
import { jsx as jsx32, jsxs as jsxs17 } from "react/jsx-runtime";
|
7381
7470
|
var DiscountCodeInputComponent = ({ componentConfig }) => {
|
7382
7471
|
const {
|
7383
7472
|
applyDiscountCodes: hrApplyDiscountCodes,
|
@@ -7561,7 +7650,7 @@ var DiscountCodeInputComponent = ({ componentConfig }) => {
|
|
7561
7650
|
[DiscountCodeInput_default["rebuy-discount-code-input__input-wrapper--show-label"]]: !!inputValue || isInputFocused
|
7562
7651
|
}),
|
7563
7652
|
children: [
|
7564
|
-
/* @__PURE__ */
|
7653
|
+
/* @__PURE__ */ jsx32(
|
7565
7654
|
"input",
|
7566
7655
|
{
|
7567
7656
|
"aria-label": lang.inputLabel,
|
@@ -7582,7 +7671,7 @@ var DiscountCodeInputComponent = ({ componentConfig }) => {
|
|
7582
7671
|
value: inputValue
|
7583
7672
|
}
|
7584
7673
|
),
|
7585
|
-
/* @__PURE__ */
|
7674
|
+
/* @__PURE__ */ jsx32(
|
7586
7675
|
"label",
|
7587
7676
|
{
|
7588
7677
|
className: DiscountCodeInput_default["rebuy-discount-code-input__input-label"],
|
@@ -7593,7 +7682,7 @@ var DiscountCodeInputComponent = ({ componentConfig }) => {
|
|
7593
7682
|
]
|
7594
7683
|
}
|
7595
7684
|
),
|
7596
|
-
/* @__PURE__ */
|
7685
|
+
/* @__PURE__ */ jsx32(
|
7597
7686
|
"button",
|
7598
7687
|
{
|
7599
7688
|
className: DiscountCodeInput_default["rebuy-discount-code-input__apply-button"],
|
@@ -7603,11 +7692,11 @@ var DiscountCodeInputComponent = ({ componentConfig }) => {
|
|
7603
7692
|
}
|
7604
7693
|
)
|
7605
7694
|
] }),
|
7606
|
-
discountManagerError && /* @__PURE__ */
|
7607
|
-
shouldShowTags && /* @__PURE__ */
|
7608
|
-
/* @__PURE__ */
|
7609
|
-
/* @__PURE__ */
|
7610
|
-
/* @__PURE__ */
|
7695
|
+
discountManagerError && /* @__PURE__ */ jsx32("div", { className: DiscountCodeInput_default["rebuy-discount-code-input__error-message"], children: discountManagerError }),
|
7696
|
+
shouldShowTags && /* @__PURE__ */ jsx32("div", { className: DiscountCodeInput_default["rebuy-discount-code-input__tags-list"], children: appliedCodes.map((code) => /* @__PURE__ */ jsxs17("div", { className: DiscountCodeInput_default["rebuy-discount-code-input__tag"], children: [
|
7697
|
+
/* @__PURE__ */ jsx32("span", { className: DiscountCodeInput_default["rebuy-discount-code-input__tag-icon"], children: /* @__PURE__ */ jsx32("svg", { fill: "currentColor", height: "14", viewBox: "0 0 24 24", width: "14", children: /* @__PURE__ */ jsx32("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" }) }) }),
|
7698
|
+
/* @__PURE__ */ jsx32("span", { className: DiscountCodeInput_default["rebuy-discount-code-input__tag-text"], children: code }),
|
7699
|
+
/* @__PURE__ */ jsx32(
|
7611
7700
|
"button",
|
7612
7701
|
{
|
7613
7702
|
"aria-label": `Remove discount code ${code}`,
|
@@ -7634,7 +7723,7 @@ var result19 = { "rebuy-login-button": "LoginButton_rebuy-login-button" };
|
|
7634
7723
|
var LoginButton_default = result19;
|
7635
7724
|
|
7636
7725
|
// src/smart-cart/components/LoginButton/LoginButton.tsx
|
7637
|
-
import { jsx as
|
7726
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
7638
7727
|
var LoginButton = React8.memo(() => {
|
7639
7728
|
const { cartData, getComponentConfigByType } = useSmartCart();
|
7640
7729
|
const componentConfig = getComponentConfigByType("login");
|
@@ -7648,13 +7737,14 @@ var LoginButton = React8.memo(() => {
|
|
7648
7737
|
}
|
7649
7738
|
const loginLabel = componentConfig?.settings?.language?.title ?? "Login";
|
7650
7739
|
const loginUrl = componentConfig?.settings?.url ?? "/account/login";
|
7651
|
-
return /* @__PURE__ */
|
7652
|
-
|
7740
|
+
return /* @__PURE__ */ jsx33(
|
7741
|
+
RebuyLink,
|
7653
7742
|
{
|
7743
|
+
ariaLabel: loginLabel,
|
7654
7744
|
className: LoginButton_default["rebuy-login-button"],
|
7655
7745
|
"data-rebuy-component": "login",
|
7656
7746
|
"data-rebuy-component-id": componentConfig.component_id ?? "login",
|
7657
|
-
|
7747
|
+
handle: loginUrl,
|
7658
7748
|
children: loginLabel
|
7659
7749
|
}
|
7660
7750
|
);
|
@@ -7871,7 +7961,7 @@ var useSmartCartApps = () => {
|
|
7871
7961
|
};
|
7872
7962
|
|
7873
7963
|
// src/smart-cart/components/SmartCartApp/SmartCartApp.tsx
|
7874
|
-
import { jsx as
|
7964
|
+
import { jsx as jsx34, jsxs as jsxs18 } from "react/jsx-runtime";
|
7875
7965
|
var SmartCartApp = React9.memo(({ componentConfig }) => {
|
7876
7966
|
const containerRef = useRef10(null);
|
7877
7967
|
const executedScriptRef = useRef10(null);
|
@@ -7911,7 +8001,7 @@ var SmartCartApp = React9.memo(({ componentConfig }) => {
|
|
7911
8001
|
}
|
7912
8002
|
if (appsHookError) {
|
7913
8003
|
console.error(`[SmartCartApp - ${componentId}] Hook error prevented app rendering: ${appsHookError}`);
|
7914
|
-
return /* @__PURE__ */
|
8004
|
+
return /* @__PURE__ */ jsx34("div", { "data-rebuy-component-id": componentId, children: "Error loading app data." });
|
7915
8005
|
}
|
7916
8006
|
if (appId === null) {
|
7917
8007
|
console.warn(`[SmartCartApp - ${componentId}] Missing App ID (settings.app_id) in configuration.`);
|
@@ -7924,7 +8014,7 @@ var SmartCartApp = React9.memo(({ componentConfig }) => {
|
|
7924
8014
|
);
|
7925
8015
|
return null;
|
7926
8016
|
}
|
7927
|
-
return /* @__PURE__ */
|
8017
|
+
return /* @__PURE__ */ jsx34(
|
7928
8018
|
"div",
|
7929
8019
|
{
|
7930
8020
|
dangerouslySetInnerHTML: { __html: scriptContent },
|
@@ -7951,7 +8041,7 @@ var result20 = { "rebuy-tiered-progress-bar": "TieredProgressBar_rebuy-tiered-pr
|
|
7951
8041
|
var TieredProgressBar_default = result20;
|
7952
8042
|
|
7953
8043
|
// src/smart-cart/components/TieredProgressBar/TPBGiftItem.tsx
|
7954
|
-
import { Fragment as Fragment8, jsx as
|
8044
|
+
import { Fragment as Fragment8, jsx as jsx35, jsxs as jsxs19 } from "react/jsx-runtime";
|
7955
8045
|
var TieredProgressBarGiftItem = ({
|
7956
8046
|
isGloballySyncing,
|
7957
8047
|
onAddOrReAdd,
|
@@ -7984,7 +8074,7 @@ var TieredProgressBarGiftItem = ({
|
|
7984
8074
|
[TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item--syncing"]]: isGloballySyncing
|
7985
8075
|
}),
|
7986
8076
|
children: [
|
7987
|
-
/* @__PURE__ */
|
8077
|
+
/* @__PURE__ */ jsx35("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-image-wrapper"], children: imageSrc ? /* @__PURE__ */ jsx35(
|
7988
8078
|
"img",
|
7989
8079
|
{
|
7990
8080
|
alt: imageAlt,
|
@@ -7992,7 +8082,7 @@ var TieredProgressBarGiftItem = ({
|
|
7992
8082
|
loading: "lazy",
|
7993
8083
|
src: imageSrc
|
7994
8084
|
}
|
7995
|
-
) : /* @__PURE__ */
|
8085
|
+
) : /* @__PURE__ */ jsx35(
|
7996
8086
|
"div",
|
7997
8087
|
{
|
7998
8088
|
"aria-label": "Gift product image placeholder",
|
@@ -8000,16 +8090,16 @@ var TieredProgressBarGiftItem = ({
|
|
8000
8090
|
}
|
8001
8091
|
) }),
|
8002
8092
|
/* @__PURE__ */ jsxs19("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-details"], children: [
|
8003
|
-
/* @__PURE__ */
|
8004
|
-
displayStatus === "added" /* ADDED */ && displayVariantTitle && /* @__PURE__ */
|
8093
|
+
/* @__PURE__ */ jsx35("h4", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-title"], id: `tpb-gift-${tierId}-title`, children: title }),
|
8094
|
+
displayStatus === "added" /* ADDED */ && displayVariantTitle && /* @__PURE__ */ jsx35("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-variant-title"], children: displayVariantTitle }),
|
8005
8095
|
/* @__PURE__ */ jsxs19("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-actions-wrapper"], children: [
|
8006
|
-
isGloballySyncing && /* @__PURE__ */
|
8096
|
+
isGloballySyncing && /* @__PURE__ */ jsx35("button", { className: clsx9(TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-button"]), disabled: true, children: "Updating..." }),
|
8007
8097
|
itemLevelError && !isGloballySyncing && /* @__PURE__ */ jsxs19("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__error-message"], children: [
|
8008
8098
|
"Error: ",
|
8009
8099
|
itemLevelError
|
8010
8100
|
] }),
|
8011
8101
|
!isGloballySyncing && !itemLevelError && /* @__PURE__ */ jsxs19(Fragment8, { children: [
|
8012
|
-
displayStatus === "added" /* ADDED */ && /* @__PURE__ */
|
8102
|
+
displayStatus === "added" /* ADDED */ && /* @__PURE__ */ jsx35(
|
8013
8103
|
"button",
|
8014
8104
|
{
|
8015
8105
|
"aria-label": `Remove ${title} gift`,
|
@@ -8031,7 +8121,7 @@ var TieredProgressBarGiftItem = ({
|
|
8031
8121
|
onChange: handleVariantChange,
|
8032
8122
|
value: "",
|
8033
8123
|
children: [
|
8034
|
-
/* @__PURE__ */
|
8124
|
+
/* @__PURE__ */ jsx35("option", { disabled: true, value: "", children: "Select Option" }),
|
8035
8125
|
availableChoices.map((variant) => {
|
8036
8126
|
const variantLabel = getFreeVariantTitle(variant) || variant.title;
|
8037
8127
|
return /* @__PURE__ */ jsxs19("option", { value: variant.id, children: [
|
@@ -8044,7 +8134,7 @@ var TieredProgressBarGiftItem = ({
|
|
8044
8134
|
]
|
8045
8135
|
}
|
8046
8136
|
),
|
8047
|
-
canReAdd && displayStatus === "declined" /* DECLINED */ && /* @__PURE__ */
|
8137
|
+
canReAdd && displayStatus === "declined" /* DECLINED */ && /* @__PURE__ */ jsx35(
|
8048
8138
|
"button",
|
8049
8139
|
{
|
8050
8140
|
"aria-label": `Re-add ${title} gift`,
|
@@ -8057,7 +8147,7 @@ var TieredProgressBarGiftItem = ({
|
|
8057
8147
|
children: "Re-Add Gift"
|
8058
8148
|
}
|
8059
8149
|
),
|
8060
|
-
displayStatus === "unavailable" /* UNAVAILABLE */ && !canReAdd && /* @__PURE__ */
|
8150
|
+
displayStatus === "unavailable" /* UNAVAILABLE */ && !canReAdd && /* @__PURE__ */ jsx35("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-item-status-text"], children: "Unavailable" })
|
8061
8151
|
] })
|
8062
8152
|
] })
|
8063
8153
|
] })
|
@@ -8143,7 +8233,7 @@ var codeBlock = {
|
|
8143
8233
|
};
|
8144
8234
|
|
8145
8235
|
// src/smart-cart/components/TieredProgressBar/TieredProgressBar.tsx
|
8146
|
-
import { jsx as
|
8236
|
+
import { jsx as jsx36, jsxs as jsxs20 } from "react/jsx-runtime";
|
8147
8237
|
var TieredProgressBar = React10.memo(() => {
|
8148
8238
|
const { hydrogenReactCartActions, isCartBusy, isHydrogenReact } = useSmartCart();
|
8149
8239
|
const tpbUserActionFetcher = useFetcher5();
|
@@ -8324,7 +8414,7 @@ var TieredProgressBar = React10.memo(() => {
|
|
8324
8414
|
const giftAreaTitleId = `tpb-giftarea-title-${activeBarConfig.id}`;
|
8325
8415
|
return /* @__PURE__ */ jsxs20("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar"], "data-rebuy-component": "tiered-progress-bar", children: [
|
8326
8416
|
/* @__PURE__ */ jsxs20("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__main-progress-area"], id: progressBarId, children: [
|
8327
|
-
/* @__PURE__ */
|
8417
|
+
/* @__PURE__ */ jsx36("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__tier-markers-list"], children: activeBarConfig.tiers.map((tier) => {
|
8328
8418
|
const isReached = checkTierReachedCallback(tier);
|
8329
8419
|
const tierLabel = getTierLabel(tier, fetchedProductMap);
|
8330
8420
|
const iconRenderData = getTierIconComponent(tier, isReached, fetchedProductMap);
|
@@ -8339,7 +8429,7 @@ var TieredProgressBar = React10.memo(() => {
|
|
8339
8429
|
if (React10.isValidElement(iconRenderData)) iconElement = iconRenderData;
|
8340
8430
|
else if (iconRenderData.type === "image") {
|
8341
8431
|
const imageObject = iconRenderData;
|
8342
|
-
iconElement = /* @__PURE__ */
|
8432
|
+
iconElement = /* @__PURE__ */ jsx36(
|
8343
8433
|
"img",
|
8344
8434
|
{
|
8345
8435
|
alt: imageObject.alt,
|
@@ -8356,7 +8446,7 @@ var TieredProgressBar = React10.memo(() => {
|
|
8356
8446
|
}),
|
8357
8447
|
title: `${tierLabel} (${isReached ? "Reached" : "Pending"} at ${formatMoney(getTierMinimum(tier))})`,
|
8358
8448
|
children: [
|
8359
|
-
/* @__PURE__ */
|
8449
|
+
/* @__PURE__ */ jsx36(
|
8360
8450
|
"div",
|
8361
8451
|
{
|
8362
8452
|
className: TieredProgressBar_default["rebuy-tiered-progress-bar__tier-icon-wrapper"],
|
@@ -8364,13 +8454,13 @@ var TieredProgressBar = React10.memo(() => {
|
|
8364
8454
|
children: iconElement
|
8365
8455
|
}
|
8366
8456
|
),
|
8367
|
-
/* @__PURE__ */
|
8457
|
+
/* @__PURE__ */ jsx36("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__tier-label"], children: tierLabel })
|
8368
8458
|
]
|
8369
8459
|
},
|
8370
8460
|
tier.id
|
8371
8461
|
);
|
8372
8462
|
}) }),
|
8373
|
-
/* @__PURE__ */
|
8463
|
+
/* @__PURE__ */ jsx36("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__track"], children: /* @__PURE__ */ jsx36(
|
8374
8464
|
"div",
|
8375
8465
|
{
|
8376
8466
|
"aria-label": "Reward progress",
|
@@ -8400,9 +8490,9 @@ var TieredProgressBar = React10.memo(() => {
|
|
8400
8490
|
] })
|
8401
8491
|
] }),
|
8402
8492
|
renderGiftArea && /* @__PURE__ */ jsxs20("div", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-area"], children: [
|
8403
|
-
renderGiftAreaTitle && /* @__PURE__ */
|
8493
|
+
renderGiftAreaTitle && /* @__PURE__ */ jsx36("h3", { className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-area-title"], id: giftAreaTitleId, children: giftAreaTitle }),
|
8404
8494
|
shouldDisableGiftActions && // If actions are disabled (likely loading something)
|
8405
|
-
productsToRenderInGiftArea.length === 0 && !productFetchError && !cartSyncError && !userActionError && /* @__PURE__ */
|
8495
|
+
productsToRenderInGiftArea.length === 0 && !productFetchError && !cartSyncError && !userActionError && /* @__PURE__ */ jsx36(
|
8406
8496
|
"div",
|
8407
8497
|
{
|
8408
8498
|
style: {
|
@@ -8412,12 +8502,12 @@ var TieredProgressBar = React10.memo(() => {
|
|
8412
8502
|
children: "Loading gifts..."
|
8413
8503
|
}
|
8414
8504
|
),
|
8415
|
-
productsToRenderInGiftArea.length > 0 && /* @__PURE__ */
|
8505
|
+
productsToRenderInGiftArea.length > 0 && /* @__PURE__ */ jsx36(
|
8416
8506
|
"div",
|
8417
8507
|
{
|
8418
8508
|
"aria-labelledby": renderGiftAreaTitle ? giftAreaTitleId : void 0,
|
8419
8509
|
className: TieredProgressBar_default["rebuy-tiered-progress-bar__gift-items-list"],
|
8420
|
-
children: productsToRenderInGiftArea.map((productState) => /* @__PURE__ */
|
8510
|
+
children: productsToRenderInGiftArea.map((productState) => /* @__PURE__ */ jsx36(
|
8421
8511
|
TieredProgressBarGiftItem,
|
8422
8512
|
{
|
8423
8513
|
isGloballySyncing: shouldDisableGiftActions,
|
@@ -8431,7 +8521,7 @@ var TieredProgressBar = React10.memo(() => {
|
|
8431
8521
|
}
|
8432
8522
|
)
|
8433
8523
|
] }),
|
8434
|
-
rebuyDebugLog.isKeyActive("smart-cart-tpb" /* SC_TPB */) && /* @__PURE__ */
|
8524
|
+
rebuyDebugLog.isKeyActive("smart-cart-tpb" /* SC_TPB */) && /* @__PURE__ */ jsx36(
|
8435
8525
|
"button",
|
8436
8526
|
{
|
8437
8527
|
onClick: () => setShowDebugPanel(!showDebugPanel),
|
@@ -8454,7 +8544,7 @@ var TieredProgressBar = React10.memo(() => {
|
|
8454
8544
|
width: "100%"
|
8455
8545
|
},
|
8456
8546
|
children: [
|
8457
|
-
/* @__PURE__ */
|
8547
|
+
/* @__PURE__ */ jsx36("div", { style: infoText, children: /* @__PURE__ */ jsx36("strong", { children: "Progress Bar Debug Info" }) }),
|
8458
8548
|
/* @__PURE__ */ jsxs20("div", { style: codeBlock, children: [
|
8459
8549
|
/* @__PURE__ */ jsxs20("div", { children: [
|
8460
8550
|
"Subtotal: ",
|
@@ -8484,8 +8574,8 @@ var TieredProgressBar = React10.memo(() => {
|
|
8484
8574
|
] })
|
8485
8575
|
] }),
|
8486
8576
|
giftsForDisplay.length > 0 && /* @__PURE__ */ jsxs20("div", { style: { marginTop: "8px" }, children: [
|
8487
|
-
/* @__PURE__ */
|
8488
|
-
/* @__PURE__ */
|
8577
|
+
/* @__PURE__ */ jsx36("div", { style: infoText, children: "Gift Status:" }),
|
8578
|
+
/* @__PURE__ */ jsx36("div", { style: codeBlock, children: giftsForDisplay.map((gift, idx) => /* @__PURE__ */ jsxs20("div", { style: { marginBottom: "4px" }, children: [
|
8489
8579
|
"Tier ",
|
8490
8580
|
gift.tierId,
|
8491
8581
|
": ",
|
@@ -8501,7 +8591,7 @@ var TieredProgressBar = React10.memo(() => {
|
|
8501
8591
|
TieredProgressBar.displayName = "TieredProgressBar";
|
8502
8592
|
|
8503
8593
|
// src/smart-cart/components/componentRegistry.tsx
|
8504
|
-
import { jsx as
|
8594
|
+
import { jsx as jsx37, jsxs as jsxs21 } from "react/jsx-runtime";
|
8505
8595
|
var componentRegistry = {
|
8506
8596
|
// Use 'any' for props initially, refine later
|
8507
8597
|
announcement_bar: AnnouncementBar,
|
@@ -8520,7 +8610,7 @@ var componentRegistry = {
|
|
8520
8610
|
};
|
8521
8611
|
|
8522
8612
|
// src/smart-cart/components/_Layouts/AnchorSlot.tsx
|
8523
|
-
import { Fragment as Fragment9, jsx as
|
8613
|
+
import { Fragment as Fragment9, jsx as jsx38 } from "react/jsx-runtime";
|
8524
8614
|
var AnchorSlot = ({ anchor, components, excludeTypes, includeTypes }) => {
|
8525
8615
|
const componentsForSlot = useMemo19(() => {
|
8526
8616
|
return components.filter((comp) => {
|
@@ -8538,13 +8628,13 @@ var AnchorSlot = ({ anchor, components, excludeTypes, includeTypes }) => {
|
|
8538
8628
|
});
|
8539
8629
|
return null;
|
8540
8630
|
}
|
8541
|
-
return /* @__PURE__ */
|
8631
|
+
return /* @__PURE__ */ jsx38(Fragment9, { children: componentsForSlot.map((componentConfig) => {
|
8542
8632
|
const Component = componentRegistry[componentConfig.type];
|
8543
8633
|
if (!Component) {
|
8544
8634
|
console.warn(`[SmartCartReact] No component registered for type: "${componentConfig.type}"`);
|
8545
8635
|
return null;
|
8546
8636
|
}
|
8547
|
-
return /* @__PURE__ */
|
8637
|
+
return /* @__PURE__ */ jsx38(Component, { componentConfig }, componentConfig.component_id);
|
8548
8638
|
}) });
|
8549
8639
|
};
|
8550
8640
|
|
@@ -8576,15 +8666,15 @@ var result21 = { "rebuy-smart-cart-layout__anchor-goal-box": "LayoutStyles_rebuy
|
|
8576
8666
|
var LayoutStyles_default = result21;
|
8577
8667
|
|
8578
8668
|
// src/smart-cart/components/_Layouts/DoubleColumnLayout.tsx
|
8579
|
-
import { jsx as
|
8669
|
+
import { jsx as jsx39, jsxs as jsxs22 } from "react/jsx-runtime";
|
8580
8670
|
var DoubleColumnLayout = ({ components, itemCount, layout }) => {
|
8581
8671
|
const scrollAreaRef = useRef11(null);
|
8582
8672
|
const isScrolled = useIsScrolled(scrollAreaRef);
|
8583
8673
|
const layoutClass = layout === "double-right" ? LayoutStyles_default["rebuy-smart-cart-layout__flyout-inner--double-right"] : LayoutStyles_default["rebuy-smart-cart-layout__flyout-inner--double"];
|
8584
8674
|
return /* @__PURE__ */ jsxs22("div", { className: clsx11(LayoutStyles_default["rebuy-smart-cart-layout__flyout-inner"], layoutClass), children: [
|
8585
8675
|
/* @__PURE__ */ jsxs22("div", { className: LayoutStyles_default["rebuy-smart-cart-layout__column--primary"], children: [
|
8586
|
-
/* @__PURE__ */
|
8587
|
-
/* @__PURE__ */
|
8676
|
+
/* @__PURE__ */ jsx39("div", { className: LayoutStyles_default["rebuy-smart-cart-layout__anchor-goal-box"], "data-rebuy-cart-anchor": "goalBox", children: /* @__PURE__ */ jsx39(AnchorSlot, { anchor: "goalBox", components }) }),
|
8677
|
+
/* @__PURE__ */ jsx39(
|
8588
8678
|
"div",
|
8589
8679
|
{
|
8590
8680
|
className: clsx11(
|
@@ -8593,26 +8683,26 @@ var DoubleColumnLayout = ({ components, itemCount, layout }) => {
|
|
8593
8683
|
),
|
8594
8684
|
"data-rebuy-cart-scroll-area": true,
|
8595
8685
|
ref: scrollAreaRef,
|
8596
|
-
children: /* @__PURE__ */
|
8686
|
+
children: /* @__PURE__ */ jsx39("div", { className: LayoutStyles_default["rebuy-smart-cart-layout__anchor-body"], "data-rebuy-cart-anchor": "body", children: /* @__PURE__ */ jsx39(AnchorSlot, { anchor: "body", components }) })
|
8597
8687
|
}
|
8598
8688
|
),
|
8599
|
-
/* @__PURE__ */
|
8689
|
+
/* @__PURE__ */ jsx39(
|
8600
8690
|
"div",
|
8601
8691
|
{
|
8602
8692
|
className: clsx11(LayoutStyles_default["rebuy-smart-cart-layout__anchor-footer"], {
|
8603
8693
|
[LayoutStyles_default["rebuy-smart-cart-layout__anchor-footer--hidden"]]: itemCount === 0
|
8604
8694
|
}),
|
8605
8695
|
"data-rebuy-cart-anchor": "footer",
|
8606
|
-
children: /* @__PURE__ */
|
8696
|
+
children: /* @__PURE__ */ jsx39(AnchorSlot, { anchor: "footer", components })
|
8607
8697
|
}
|
8608
8698
|
)
|
8609
8699
|
] }),
|
8610
|
-
/* @__PURE__ */
|
8700
|
+
/* @__PURE__ */ jsx39("div", { className: LayoutStyles_default["rebuy-smart-cart-layout__column--secondary"], children: /* @__PURE__ */ jsx39(
|
8611
8701
|
"div",
|
8612
8702
|
{
|
8613
8703
|
className: LayoutStyles_default["rebuy-smart-cart-layout__anchor-cross-sells"],
|
8614
8704
|
"data-rebuy-cart-anchor": "crossSells",
|
8615
|
-
children: /* @__PURE__ */
|
8705
|
+
children: /* @__PURE__ */ jsx39(AnchorSlot, { anchor: "crossSells", components })
|
8616
8706
|
}
|
8617
8707
|
) })
|
8618
8708
|
] });
|
@@ -8621,13 +8711,13 @@ var DoubleColumnLayout = ({ components, itemCount, layout }) => {
|
|
8621
8711
|
// src/smart-cart/components/_Layouts/SingleColumnLayout.tsx
|
8622
8712
|
import clsx12 from "clsx";
|
8623
8713
|
import { useRef as useRef12 } from "react";
|
8624
|
-
import { Fragment as Fragment10, jsx as
|
8714
|
+
import { Fragment as Fragment10, jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
|
8625
8715
|
var SingleColumnLayout = ({ components, itemCount }) => {
|
8626
8716
|
const scrollAreaRef = useRef12(null);
|
8627
8717
|
const isScrolled = useIsScrolled(scrollAreaRef);
|
8628
8718
|
return /* @__PURE__ */ jsxs23(Fragment10, { children: [
|
8629
|
-
/* @__PURE__ */
|
8630
|
-
/* @__PURE__ */
|
8719
|
+
/* @__PURE__ */ jsx40("div", { className: LayoutStyles_default["rebuy-smart-cart-layout__anchor-goal-box"], "data-rebuy-cart-anchor": "goalBox", children: /* @__PURE__ */ jsx40(AnchorSlot, { anchor: "goalBox", components }) }),
|
8720
|
+
/* @__PURE__ */ jsx40(
|
8631
8721
|
"div",
|
8632
8722
|
{
|
8633
8723
|
className: clsx12(
|
@@ -8636,17 +8726,17 @@ var SingleColumnLayout = ({ components, itemCount }) => {
|
|
8636
8726
|
),
|
8637
8727
|
"data-rebuy-cart-scroll-area": true,
|
8638
8728
|
ref: scrollAreaRef,
|
8639
|
-
children: /* @__PURE__ */
|
8729
|
+
children: /* @__PURE__ */ jsx40("div", { className: LayoutStyles_default["rebuy-smart-cart-layout__anchor-body"], "data-rebuy-cart-anchor": "body", children: /* @__PURE__ */ jsx40(AnchorSlot, { anchor: "body", components }) })
|
8640
8730
|
}
|
8641
8731
|
),
|
8642
|
-
/* @__PURE__ */
|
8732
|
+
/* @__PURE__ */ jsx40(
|
8643
8733
|
"div",
|
8644
8734
|
{
|
8645
8735
|
className: clsx12(LayoutStyles_default["rebuy-smart-cart-layout__anchor-footer"], {
|
8646
8736
|
[LayoutStyles_default["rebuy-smart-cart-layout__anchor-footer--hidden"]]: itemCount === 0
|
8647
8737
|
}),
|
8648
8738
|
"data-rebuy-cart-anchor": "footer",
|
8649
|
-
children: /* @__PURE__ */
|
8739
|
+
children: /* @__PURE__ */ jsx40(AnchorSlot, { anchor: "footer", components })
|
8650
8740
|
}
|
8651
8741
|
)
|
8652
8742
|
] });
|
@@ -8657,7 +8747,7 @@ var result22 = { "rebuy-smart-cart": "SmartCartContainer_rebuy-smart-cart", "reb
|
|
8657
8747
|
var SmartCartContainer_default = result22;
|
8658
8748
|
|
8659
8749
|
// src/smart-cart/components/SmartCartContainer/SmartCartContainer.tsx
|
8660
|
-
import { jsx as
|
8750
|
+
import { jsx as jsx41, jsxs as jsxs24 } from "react/jsx-runtime";
|
8661
8751
|
var SmartCartContainer = ({ containerId }) => {
|
8662
8752
|
const { config, getItemCount, hideCart, isVisible } = useSmartCart();
|
8663
8753
|
const containerRef = useRef13(null);
|
@@ -8678,6 +8768,16 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8678
8768
|
}
|
8679
8769
|
}
|
8680
8770
|
}, [isVisible]);
|
8771
|
+
useEffect21(() => {
|
8772
|
+
if (isVisible) {
|
8773
|
+
document.body.classList.add("rebuy-smart-cart-open");
|
8774
|
+
} else {
|
8775
|
+
document.body.classList.remove("rebuy-smart-cart-open");
|
8776
|
+
}
|
8777
|
+
return () => {
|
8778
|
+
document.body.classList.remove("rebuy-smart-cart-open");
|
8779
|
+
};
|
8780
|
+
}, [isVisible]);
|
8681
8781
|
const backgroundClassName = clsx13(SmartCartContainer_default["rebuy-smart-cart__overlay-background"], {
|
8682
8782
|
[SmartCartContainer_default["rebuy-smart-cart__overlay-background--visible"]]: isVisible
|
8683
8783
|
});
|
@@ -8690,20 +8790,20 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8690
8790
|
}
|
8691
8791
|
);
|
8692
8792
|
const renderLayoutContent = () => {
|
8693
|
-
if (!config) return /* @__PURE__ */
|
8793
|
+
if (!config) return /* @__PURE__ */ jsx41("div", { style: { padding: "20px", textAlign: "center" }, children: "Loading configuration..." });
|
8694
8794
|
switch (config.layout) {
|
8695
8795
|
case "double":
|
8696
8796
|
case "double-right":
|
8697
|
-
return /* @__PURE__ */
|
8797
|
+
return /* @__PURE__ */ jsx41(DoubleColumnLayout, { components, itemCount: getItemCount(), layout: config.layout });
|
8698
8798
|
default:
|
8699
|
-
return /* @__PURE__ */
|
8799
|
+
return /* @__PURE__ */ jsx41(SingleColumnLayout, { components, itemCount: getItemCount() });
|
8700
8800
|
}
|
8701
8801
|
};
|
8702
8802
|
const defaultTitleId = "rebuy-smart-cart-default-title";
|
8703
8803
|
const titleBarComponent = components.find((c) => c.type === "title_bar");
|
8704
8804
|
const ariaLabelledBy = titleBarComponent ? `rebuy-title-${titleBarComponent.component_id}` : defaultTitleId;
|
8705
8805
|
return /* @__PURE__ */ jsxs24(React11.Fragment, { children: [
|
8706
|
-
/* @__PURE__ */
|
8806
|
+
/* @__PURE__ */ jsx41("div", { className: backgroundClassName, onClick: handleClose }),
|
8707
8807
|
/* @__PURE__ */ jsxs24(
|
8708
8808
|
"div",
|
8709
8809
|
{
|
@@ -8719,10 +8819,10 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8719
8819
|
/* @__PURE__ */ jsxs24("header", { className: SmartCartContainer_default["rebuy-smart-cart__header"], "data-rebuy-cart-anchor": "header", children: [
|
8720
8820
|
/* @__PURE__ */ jsxs24("div", { className: SmartCartContainer_default["rebuy-smart-cart__header-top-bar"], "data-rebuy-cart-header-top-bar": "", children: [
|
8721
8821
|
/* @__PURE__ */ jsxs24("div", { className: SmartCartContainer_default["rebuy-smart-cart__header-content"], "data-rebuy-cart-header-top-inner": "", children: [
|
8722
|
-
/* @__PURE__ */
|
8822
|
+
/* @__PURE__ */ jsx41(AnchorSlot, { anchor: "header", components, includeTypes: ["title_bar", "login"] }),
|
8723
8823
|
!components.some(
|
8724
8824
|
(c) => c.type === "title_bar" && !c.settings?.screen_reader_only
|
8725
|
-
) && /* @__PURE__ */
|
8825
|
+
) && /* @__PURE__ */ jsx41("h2", { id: defaultTitleId, children: /* @__PURE__ */ jsx41(ScreenReaderText, { children: "Your Cart" }) })
|
8726
8826
|
] }),
|
8727
8827
|
/* @__PURE__ */ jsxs24(
|
8728
8828
|
"button",
|
@@ -8734,15 +8834,15 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8734
8834
|
type: "button",
|
8735
8835
|
children: [
|
8736
8836
|
"\u2715",
|
8737
|
-
/* @__PURE__ */
|
8837
|
+
/* @__PURE__ */ jsx41(ScreenReaderText, { children: "Close Cart" })
|
8738
8838
|
]
|
8739
8839
|
}
|
8740
8840
|
)
|
8741
8841
|
] }),
|
8742
|
-
/* @__PURE__ */
|
8842
|
+
/* @__PURE__ */ jsx41(AnchorSlot, { anchor: "header", components, excludeTypes: ["title_bar", "login"] })
|
8743
8843
|
] }),
|
8744
8844
|
renderLayoutContent(),
|
8745
|
-
/* @__PURE__ */
|
8845
|
+
/* @__PURE__ */ jsx41("div", { "aria-live": "polite", className: "rebuy-sr-only", id: "rebuy-cart-live-region" })
|
8746
8846
|
]
|
8747
8847
|
}
|
8748
8848
|
)
|
@@ -8750,20 +8850,42 @@ var SmartCartContainer = ({ containerId }) => {
|
|
8750
8850
|
};
|
8751
8851
|
|
8752
8852
|
// src/smart-cart/RebuySmartCart.tsx
|
8753
|
-
import { jsx as
|
8853
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
8754
8854
|
var RebuySmartCart = () => {
|
8755
|
-
return /* @__PURE__ */
|
8855
|
+
return /* @__PURE__ */ jsx42(SmartCartContainer, {});
|
8756
8856
|
};
|
8757
8857
|
|
8758
8858
|
// src/widgetContainer/RebuyWidgetContainer.tsx
|
8759
8859
|
import { RebuyClient as RebuyClient3 } from "@rebuy/rebuy";
|
8760
8860
|
import * as Utilities5 from "@rebuy/rebuy/utilities";
|
8761
8861
|
import { flattenConnection as flattenConnection4 } from "@shopify/hydrogen";
|
8762
|
-
import
|
8862
|
+
import { useContext as useContext5, useEffect as useEffect22, useMemo as useMemo21, useState as useState21 } from "react";
|
8863
|
+
|
8864
|
+
// src/context/RebuyWidgetContext.tsx
|
8865
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
8866
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
8867
|
+
var RebuyWidgetContext = createContext4({
|
8868
|
+
dataSource: "",
|
8869
|
+
isHydrogenReact: false,
|
8870
|
+
key: "",
|
8871
|
+
limit: 0,
|
8872
|
+
metadata: {},
|
8873
|
+
options: {},
|
8874
|
+
products: [],
|
8875
|
+
variant: void 0,
|
8876
|
+
variantId: void 0
|
8877
|
+
});
|
8878
|
+
var useRebuyWidget = () => useContext4(RebuyWidgetContext);
|
8879
|
+
var RebuyWidgetProvider = ({ children, value }) => {
|
8880
|
+
return /* @__PURE__ */ jsx43(RebuyWidgetContext.Provider, { value, children });
|
8881
|
+
};
|
8882
|
+
|
8883
|
+
// src/widgetContainer/RebuyWidgetContainer.tsx
|
8884
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
8763
8885
|
var RebuyWidgetContainerBase = ({ children, ...props }) => {
|
8764
8886
|
const { collection, collectionId, dataSource, limit, options, product, productId, variant, variantId } = props;
|
8765
8887
|
const { apiKey, loadingStatus: configLoadingStatus, rebuyConfig } = useRebuyConfig();
|
8766
|
-
const rebuyContext =
|
8888
|
+
const rebuyContext = useContext5(RebuyContext);
|
8767
8889
|
const [rebuyApiClient, setRebuyApiClient] = useState21(null);
|
8768
8890
|
const [initialized, setInitialized] = useState21(false);
|
8769
8891
|
const shopifyProductId = product?.id ?? productId ?? null;
|
@@ -8846,22 +8968,30 @@ var RebuyWidgetContainerBase = ({ children, ...props }) => {
|
|
8846
8968
|
isMounted = false;
|
8847
8969
|
};
|
8848
8970
|
}, [rebuyApiClient, initialized, request, configLoadingStatus]);
|
8849
|
-
const childrenWithProps = (currentProps) => React12.Children.map(
|
8850
|
-
children,
|
8851
|
-
(child) => React12.isValidElement(child) ? React12.cloneElement(child, currentProps) : child
|
8852
|
-
);
|
8853
|
-
const childProps = {
|
8854
|
-
...props,
|
8855
|
-
apiKey,
|
8856
|
-
cacheKey: rebuyConfig?.shop?.cache_key,
|
8857
|
-
key: product?.id,
|
8858
|
-
metadata,
|
8859
|
-
products
|
8860
|
-
};
|
8861
8971
|
if (configLoadingStatus !== "success" || !rebuyApiClient) {
|
8862
8972
|
return null;
|
8863
8973
|
}
|
8864
|
-
return
|
8974
|
+
return /* @__PURE__ */ jsx44(
|
8975
|
+
RebuyWidgetProvider,
|
8976
|
+
{
|
8977
|
+
value: {
|
8978
|
+
apiKey: apiKey ?? void 0,
|
8979
|
+
cacheKey: rebuyConfig?.shop?.cache_key,
|
8980
|
+
dataSource: dataSource || "/api/v1/products/recommended",
|
8981
|
+
isHydrogenReact: rebuyContext?.contextParameters?.isHydrogenReact || false,
|
8982
|
+
key: product?.id || "",
|
8983
|
+
limit: limit || 0,
|
8984
|
+
metadata: metadata || {},
|
8985
|
+
options: options || {},
|
8986
|
+
product,
|
8987
|
+
productId,
|
8988
|
+
products,
|
8989
|
+
variant,
|
8990
|
+
variantId
|
8991
|
+
},
|
8992
|
+
children
|
8993
|
+
}
|
8994
|
+
);
|
8865
8995
|
};
|
8866
8996
|
var RebuyWidgetContainer = RebuyWidgetContainerBase;
|
8867
8997
|
|
@@ -8870,32 +9000,33 @@ var result23 = { "container": "RebuyCompleteTheLook_container", "productGrid": "
|
|
8870
9000
|
var RebuyCompleteTheLook_default = result23;
|
8871
9001
|
|
8872
9002
|
// src/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.tsx
|
8873
|
-
import { jsx as
|
9003
|
+
import { jsx as jsx45, jsxs as jsxs25 } from "react/jsx-runtime";
|
8874
9004
|
var RebuyCompleteTheLook = (props) => {
|
8875
9005
|
const {
|
8876
9006
|
addToCartBtnText = "Add to cart",
|
8877
9007
|
addToCartCallback,
|
8878
|
-
customTitle = `These pair with
|
9008
|
+
customTitle = `These pair with {product_title}`,
|
8879
9009
|
customTitleLevel = "h2",
|
8880
|
-
customTitleStyle
|
8881
|
-
products = []
|
9010
|
+
customTitleStyle
|
8882
9011
|
} = props;
|
9012
|
+
const { isHydrogenReact, product, products } = useRebuyWidget();
|
9013
|
+
const productTitle = customTitle.replace("{product_title}", product?.title ?? "");
|
8883
9014
|
if (products.length === 0) {
|
8884
9015
|
rebuyDebugLog.log("widget-complete-the-look" /* WIDGET_COMPLETE_THE_LOOK */, "RebuyCompleteTheLook: No products found");
|
8885
9016
|
return null;
|
8886
9017
|
}
|
8887
9018
|
return /* @__PURE__ */ jsxs25("section", { className: RebuyCompleteTheLook_default.container, children: [
|
8888
|
-
/* @__PURE__ */
|
8889
|
-
/* @__PURE__ */
|
9019
|
+
/* @__PURE__ */ jsx45(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: productTitle }),
|
9020
|
+
/* @__PURE__ */ jsx45("ul", { className: RebuyCompleteTheLook_default.productGrid, children: products.map((product2) => /* @__PURE__ */ jsx45("li", { className: RebuyCompleteTheLook_default.productItem, children: /* @__PURE__ */ jsx45(
|
8890
9021
|
ProductCard,
|
8891
9022
|
{
|
8892
9023
|
addToCartBtnText,
|
8893
9024
|
addToCartCallback,
|
8894
|
-
isHydrogenReact
|
8895
|
-
product,
|
9025
|
+
isHydrogenReact,
|
9026
|
+
product: product2,
|
8896
9027
|
productCardTitleLevel: getTitleLevel(customTitleLevel, true)
|
8897
9028
|
}
|
8898
|
-
) },
|
9029
|
+
) }, product2.id)) })
|
8899
9030
|
] });
|
8900
9031
|
};
|
8901
9032
|
|
@@ -8904,11 +9035,34 @@ import { useCallback as useCallback15, useEffect as useEffect23, useState as use
|
|
8904
9035
|
|
8905
9036
|
// src/utils/convertToRebuyProduct.tsx
|
8906
9037
|
var convertToRebuyProduct = (isHydrogenReact, product) => {
|
8907
|
-
const mainProductVariants = isHydrogenReact ? product?.variants?.nodes?.map((variant) => {
|
8908
|
-
|
8909
|
-
|
8910
|
-
|
8911
|
-
|
9038
|
+
const mainProductVariants = isHydrogenReact ? product?.variants?.nodes?.map((variant) => ({
|
9039
|
+
availableForSale: variant.availableForSale,
|
9040
|
+
compareAtPriceV2: {
|
9041
|
+
amount: variant.compareAtPrice?.amount || "",
|
9042
|
+
currencyCode: variant.compareAtPrice?.currencyCode || "USD"
|
9043
|
+
},
|
9044
|
+
id: variant.id,
|
9045
|
+
image: variant.image ? {
|
9046
|
+
altText: variant.image.altText || null,
|
9047
|
+
height: variant.image.height || 100,
|
9048
|
+
id: variant.image.id || "",
|
9049
|
+
url: variant.image.url || "",
|
9050
|
+
width: variant.image.width || 100
|
9051
|
+
} : void 0,
|
9052
|
+
priceV2: {
|
9053
|
+
amount: variant.price.amount,
|
9054
|
+
currencyCode: variant.price.currencyCode
|
9055
|
+
},
|
9056
|
+
product: {
|
9057
|
+
handle: product.handle,
|
9058
|
+
id: product.id,
|
9059
|
+
title: product.title,
|
9060
|
+
vendor: product.vendor
|
9061
|
+
},
|
9062
|
+
selectedOptions: variant.selectedOptions,
|
9063
|
+
sku: variant.sku || "",
|
9064
|
+
title: variant.title
|
9065
|
+
})) || [] : product?.adjacentVariants.map((variant) => {
|
8912
9066
|
return {
|
8913
9067
|
availableForSale: variant.availableForSale,
|
8914
9068
|
compareAtPriceV2: {
|
@@ -8972,26 +9126,28 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
|
|
8972
9126
|
selected: true,
|
8973
9127
|
selectedOptions: product?.selectedVariant?.selectedOptions?.reduce((acc, option) => {
|
8974
9128
|
return { ...acc, [option.name]: option.value };
|
9129
|
+
}, {}) || product?.variants?.nodes[0]?.selectedOptions?.reduce((acc, option) => {
|
9130
|
+
return { ...acc, [option.name]: option.value };
|
8975
9131
|
}, {}) || {},
|
8976
9132
|
selectedSellingPlan: {},
|
8977
9133
|
selectedSellingPlanAllocation: {},
|
8978
9134
|
selectedVariant: {
|
8979
|
-
availableForSale: product?.selectedVariant?.availableForSale || false,
|
9135
|
+
availableForSale: product?.selectedVariant?.availableForSale || product?.variants?.nodes[0]?.availableForSale || false,
|
8980
9136
|
compareAtPriceV2: {
|
8981
|
-
amount: product?.selectedVariant?.compareAtPrice?.amount || "",
|
8982
|
-
currencyCode: product?.selectedVariant?.compareAtPrice?.currencyCode || "USD"
|
9137
|
+
amount: product?.selectedVariant?.compareAtPrice?.amount || product?.variants?.nodes[0]?.compareAtPrice?.amount || "",
|
9138
|
+
currencyCode: product?.selectedVariant?.compareAtPrice?.currencyCode || product?.variants?.nodes[0]?.compareAtPrice?.currencyCode || "USD"
|
8983
9139
|
},
|
8984
9140
|
id: product?.selectedVariant?.id || "",
|
8985
9141
|
image: {
|
8986
|
-
altText: product?.selectedVariant?.image?.altText || "",
|
8987
|
-
height: product?.selectedVariant?.image?.height || 100,
|
8988
|
-
id: product?.selectedVariant?.image?.id || "",
|
8989
|
-
url: product?.selectedVariant?.image?.url || "",
|
8990
|
-
width: product?.selectedVariant?.image?.width || 100
|
9142
|
+
altText: product?.selectedVariant?.image?.altText || product?.variants?.nodes[0]?.image?.altText || "",
|
9143
|
+
height: product?.selectedVariant?.image?.height || product?.variants?.nodes[0]?.image?.height || 100,
|
9144
|
+
id: product?.selectedVariant?.image?.id || product?.variants?.nodes[0]?.image?.id || "",
|
9145
|
+
url: product?.selectedVariant?.image?.url || product?.variants?.nodes[0]?.image?.url || "",
|
9146
|
+
width: product?.selectedVariant?.image?.width || product?.variants?.nodes[0]?.image?.width || 100
|
8991
9147
|
},
|
8992
9148
|
priceV2: {
|
8993
|
-
amount: product?.selectedVariant?.price.amount || "",
|
8994
|
-
currencyCode: product?.selectedVariant?.price.currencyCode || "USD"
|
9149
|
+
amount: product?.selectedVariant?.price.amount || product?.variants?.nodes[0]?.price.amount || "",
|
9150
|
+
currencyCode: product?.selectedVariant?.price.currencyCode || product?.variants?.nodes[0]?.price.currencyCode || "USD"
|
8995
9151
|
},
|
8996
9152
|
product: {
|
8997
9153
|
handle: product?.handle || "",
|
@@ -8999,9 +9155,9 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
|
|
8999
9155
|
title: product?.title || "",
|
9000
9156
|
vendor: product?.vendor || ""
|
9001
9157
|
},
|
9002
|
-
selectedOptions: product?.selectedVariant?.selectedOptions || [],
|
9003
|
-
sku: product?.selectedVariant?.sku || "",
|
9004
|
-
title: product?.selectedVariant?.title || ""
|
9158
|
+
selectedOptions: product?.selectedVariant?.selectedOptions || product?.variants?.nodes[0]?.selectedOptions || [],
|
9159
|
+
sku: product?.selectedVariant?.sku || product?.variants?.nodes[0]?.sku || "",
|
9160
|
+
title: product?.selectedVariant?.title || product?.variants?.nodes[0]?.title || ""
|
9005
9161
|
},
|
9006
9162
|
sellingPlanGroups: [],
|
9007
9163
|
seo: {
|
@@ -9128,19 +9284,18 @@ var convertToRebuyProduct = (isHydrogenReact, product) => {
|
|
9128
9284
|
// src/widgets/RebuyDynamicBundleProducts/BundleImages.tsx
|
9129
9285
|
import { Image as Image2 } from "@shopify/hydrogen";
|
9130
9286
|
import { Fragment as Fragment11 } from "react";
|
9131
|
-
import { Link as Link2 } from "react-router";
|
9132
9287
|
|
9133
9288
|
// src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.module.css
|
9134
9289
|
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" };
|
9135
9290
|
var RebuyDynamicBundleProducts_default = result24;
|
9136
9291
|
|
9137
9292
|
// src/widgets/RebuyDynamicBundleProducts/BundleImages.tsx
|
9138
|
-
import { Fragment as Fragment12, jsx as
|
9293
|
+
import { Fragment as Fragment12, jsx as jsx46, jsxs as jsxs26 } from "react/jsx-runtime";
|
9139
9294
|
var BundleImages = ({ products }) => {
|
9140
9295
|
const selected = products.filter((product) => product.selected);
|
9141
|
-
return /* @__PURE__ */
|
9296
|
+
return /* @__PURE__ */ jsx46("ul", { className: RebuyDynamicBundleProducts_default.bundleImages, children: products.map((product, index) => {
|
9142
9297
|
const image = product.selectedVariant?.image;
|
9143
|
-
const productImage = image ? /* @__PURE__ */
|
9298
|
+
const productImage = image ? /* @__PURE__ */ jsx46(
|
9144
9299
|
Image2,
|
9145
9300
|
{
|
9146
9301
|
alt: image.altText || `Picture of ${product.title}`,
|
@@ -9155,24 +9310,79 @@ var BundleImages = ({ products }) => {
|
|
9155
9310
|
product.title
|
9156
9311
|
);
|
9157
9312
|
const showDelimiter = selected[0]?.id !== product.id;
|
9158
|
-
return /* @__PURE__ */
|
9159
|
-
showDelimiter && /* @__PURE__ */
|
9160
|
-
/* @__PURE__ */
|
9313
|
+
return /* @__PURE__ */ jsx46(Fragment11, { children: product.selected && /* @__PURE__ */ jsxs26(Fragment12, { children: [
|
9314
|
+
showDelimiter && /* @__PURE__ */ jsx46("li", { className: RebuyDynamicBundleProducts_default.bundleImageDelimiter, children: /* @__PURE__ */ jsx46("span", { children: "+" }) }),
|
9315
|
+
/* @__PURE__ */ jsx46("li", { className: "flex items-center", children: product.default ? (
|
9161
9316
|
// Already on product page
|
9162
9317
|
productImage
|
9163
9318
|
) : (
|
9164
9319
|
// Link to product
|
9165
|
-
/* @__PURE__ */
|
9320
|
+
/* @__PURE__ */ jsx46(
|
9321
|
+
RebuyLink,
|
9322
|
+
{
|
9323
|
+
ariaLabel: `View ${product.title}`,
|
9324
|
+
handle: `/products/${product.handle}`,
|
9325
|
+
children: productImage
|
9326
|
+
}
|
9327
|
+
)
|
9166
9328
|
) })
|
9167
9329
|
] }) }, product.id + "-BundleImages-" + index);
|
9168
9330
|
}) });
|
9169
9331
|
};
|
9170
9332
|
|
9333
|
+
// src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx
|
9334
|
+
import { Money as Money4 } from "@shopify/hydrogen";
|
9335
|
+
import { jsx as jsx47, jsxs as jsxs27 } from "react/jsx-runtime";
|
9336
|
+
var BundlePrice = ({ products }) => {
|
9337
|
+
const isDisabled = products.filter((product) => product.selected).length < 1;
|
9338
|
+
const totalBundlePrice = () => {
|
9339
|
+
let total = 0;
|
9340
|
+
let currencyCode = "USD";
|
9341
|
+
for (const product of products) {
|
9342
|
+
if (product.selected && product.selectedVariant) {
|
9343
|
+
const { priceV2: price2 } = product.selectedVariant;
|
9344
|
+
total += Number(price2?.amount);
|
9345
|
+
currencyCode = price2?.currencyCode || "USD";
|
9346
|
+
}
|
9347
|
+
}
|
9348
|
+
return {
|
9349
|
+
amount: String(total),
|
9350
|
+
currencyCode
|
9351
|
+
};
|
9352
|
+
};
|
9353
|
+
const totalBundleCompareAtPrice = () => {
|
9354
|
+
let compareAtTotal = 0;
|
9355
|
+
let currencyCode = "USD";
|
9356
|
+
for (const product of products) {
|
9357
|
+
if (product.selected && product.selectedVariant) {
|
9358
|
+
const { compareAtPriceV2: compareAtPrice2, priceV2: price2 } = product.selectedVariant;
|
9359
|
+
currencyCode = price2?.currencyCode || "USD";
|
9360
|
+
compareAtTotal += Number((compareAtPrice2 || price2)?.amount);
|
9361
|
+
}
|
9362
|
+
}
|
9363
|
+
return {
|
9364
|
+
amount: String(compareAtTotal),
|
9365
|
+
currencyCode
|
9366
|
+
};
|
9367
|
+
};
|
9368
|
+
const isDiscounted = (price2, compareAtPrice2) => Number(compareAtPrice2?.amount) > Number(price2?.amount);
|
9369
|
+
const price = totalBundlePrice();
|
9370
|
+
const compareAtPrice = totalBundleCompareAtPrice();
|
9371
|
+
const CompareAtPrice = ({ data: compareAtPrice2 }) => {
|
9372
|
+
return compareAtPrice2 && /* @__PURE__ */ jsx47(Money4, { as: "span", className: RebuyDynamicBundleProducts_default.compareAtPrice, data: compareAtPrice2, withoutTrailingZeros: true });
|
9373
|
+
};
|
9374
|
+
return products.length > 0 && /* @__PURE__ */ jsx47("div", { className: "flex items-center flex-col", children: !isDisabled && /* @__PURE__ */ jsxs27("p", { className: "flex items-center gap-2 mb-2", children: [
|
9375
|
+
/* @__PURE__ */ jsx47("span", { children: "Total Price:" }),
|
9376
|
+
/* @__PURE__ */ jsx47(Money4, { as: "span", data: price, withoutTrailingZeros: true }),
|
9377
|
+
isDiscounted(price, compareAtPrice) && /* @__PURE__ */ jsx47(CompareAtPrice, { data: compareAtPrice })
|
9378
|
+
] }) });
|
9379
|
+
};
|
9380
|
+
|
9171
9381
|
// src/widgets/RebuyDynamicBundleProducts/BundleSelection.tsx
|
9172
9382
|
import clsx14 from "clsx";
|
9173
9383
|
|
9174
9384
|
// src/widgets/RebuyDynamicBundleProducts/Select.tsx
|
9175
|
-
import { jsx as
|
9385
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
9176
9386
|
var Select = ({ onSelectVariant, product }) => {
|
9177
9387
|
const getOptionsLabel = (product2) => {
|
9178
9388
|
const options = product2.variants.nodes[0].selectedOptions;
|
@@ -9181,30 +9391,30 @@ var Select = ({ onSelectVariant, product }) => {
|
|
9181
9391
|
const useValues = optionsFromKeys.every((key) => ["name", "value"].includes(key));
|
9182
9392
|
return (useValues ? optionsFromValues : optionsFromKeys).join(" / ");
|
9183
9393
|
};
|
9184
|
-
return product && /* @__PURE__ */
|
9394
|
+
return product && /* @__PURE__ */ jsx48(
|
9185
9395
|
"select",
|
9186
9396
|
{
|
9187
9397
|
"aria-label": "select variant",
|
9188
9398
|
className: RebuyDynamicBundleProducts_default.select,
|
9189
9399
|
onChange: (e) => onSelectVariant(product, e.target.value),
|
9190
9400
|
value: product.selectedVariant.id,
|
9191
|
-
children: /* @__PURE__ */
|
9401
|
+
children: /* @__PURE__ */ jsx48("optgroup", { label: getOptionsLabel(product), children: product.variants.nodes.map(({ id, title }) => /* @__PURE__ */ jsx48("option", { value: id, children: title }, id + "-BundleVariant")) })
|
9192
9402
|
}
|
9193
9403
|
);
|
9194
9404
|
};
|
9195
9405
|
|
9196
9406
|
// src/widgets/RebuyDynamicBundleProducts/BundleSelection.tsx
|
9197
|
-
import { jsx as
|
9407
|
+
import { jsx as jsx49, jsxs as jsxs28 } from "react/jsx-runtime";
|
9198
9408
|
var BundleSelection = ({ onSelectVariant, onToggleBundleItem, products }) => {
|
9199
|
-
return /* @__PURE__ */
|
9409
|
+
return /* @__PURE__ */ jsx49("ul", { children: products.map((product, index) => {
|
9200
9410
|
const { availableForSale } = product.selectedVariant;
|
9201
9411
|
const isOutOfStock = !availableForSale;
|
9202
|
-
return /* @__PURE__ */
|
9412
|
+
return /* @__PURE__ */ jsx49(
|
9203
9413
|
"li",
|
9204
9414
|
{
|
9205
9415
|
className: clsx14(RebuyDynamicBundleProducts_default.bundleItemRowContainer, !product.selected && RebuyDynamicBundleProducts_default.unselected),
|
9206
|
-
children: /* @__PURE__ */
|
9207
|
-
/* @__PURE__ */
|
9416
|
+
children: /* @__PURE__ */ jsxs28("div", { className: RebuyDynamicBundleProducts_default.bundleItemRow, children: [
|
9417
|
+
/* @__PURE__ */ jsx49(
|
9208
9418
|
"input",
|
9209
9419
|
{
|
9210
9420
|
checked: product.selected && availableForSale,
|
@@ -9216,14 +9426,14 @@ var BundleSelection = ({ onSelectVariant, onToggleBundleItem, products }) => {
|
|
9216
9426
|
value: product.id
|
9217
9427
|
}
|
9218
9428
|
),
|
9219
|
-
/* @__PURE__ */
|
9220
|
-
/* @__PURE__ */
|
9221
|
-
isOutOfStock && /* @__PURE__ */
|
9222
|
-
product.default && /* @__PURE__ */
|
9429
|
+
/* @__PURE__ */ jsxs28("div", { className: RebuyDynamicBundleProducts_default.bundleItemInput, children: [
|
9430
|
+
/* @__PURE__ */ jsxs28("label", { className: RebuyDynamicBundleProducts_default.bundleItemLabel, htmlFor: `${product.id}-toggle`, children: [
|
9431
|
+
isOutOfStock && /* @__PURE__ */ jsx49("b", { children: "SOLD OUT" }),
|
9432
|
+
product.default && /* @__PURE__ */ jsx49("b", { children: "This item:" }),
|
9223
9433
|
product.title,
|
9224
|
-
/* @__PURE__ */
|
9434
|
+
/* @__PURE__ */ jsx49(RebuyProductPrice, { selectedVariant: product.selectedVariant })
|
9225
9435
|
] }),
|
9226
|
-
product.variants.nodes.length > 1 && /* @__PURE__ */
|
9436
|
+
product.variants.nodes.length > 1 && /* @__PURE__ */ jsx49(Select, { onSelectVariant, product })
|
9227
9437
|
] })
|
9228
9438
|
] })
|
9229
9439
|
},
|
@@ -9232,67 +9442,18 @@ var BundleSelection = ({ onSelectVariant, onToggleBundleItem, products }) => {
|
|
9232
9442
|
}) });
|
9233
9443
|
};
|
9234
9444
|
|
9235
|
-
// src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx
|
9236
|
-
import { Money as Money4 } from "@shopify/hydrogen";
|
9237
|
-
import { jsx as jsx46, jsxs as jsxs28 } from "react/jsx-runtime";
|
9238
|
-
var BundlePrice = ({ products }) => {
|
9239
|
-
const isDisabled = products.filter((product) => product.selected).length < 1;
|
9240
|
-
const totalBundlePrice = () => {
|
9241
|
-
let total = 0;
|
9242
|
-
let currencyCode = "USD";
|
9243
|
-
for (const product of products) {
|
9244
|
-
if (product.selected && product.selectedVariant) {
|
9245
|
-
const { priceV2: price2 } = product.selectedVariant;
|
9246
|
-
total += Number(price2?.amount);
|
9247
|
-
currencyCode = price2?.currencyCode || "USD";
|
9248
|
-
}
|
9249
|
-
}
|
9250
|
-
return {
|
9251
|
-
amount: String(total),
|
9252
|
-
currencyCode
|
9253
|
-
};
|
9254
|
-
};
|
9255
|
-
const totalBundleCompareAtPrice = () => {
|
9256
|
-
let compareAtTotal = 0;
|
9257
|
-
let currencyCode = "USD";
|
9258
|
-
for (const product of products) {
|
9259
|
-
if (product.selected && product.selectedVariant) {
|
9260
|
-
const { compareAtPriceV2: compareAtPrice2, priceV2: price2 } = product.selectedVariant;
|
9261
|
-
currencyCode = price2?.currencyCode || "USD";
|
9262
|
-
compareAtTotal += Number((compareAtPrice2 || price2)?.amount);
|
9263
|
-
}
|
9264
|
-
}
|
9265
|
-
return {
|
9266
|
-
amount: String(compareAtTotal),
|
9267
|
-
currencyCode
|
9268
|
-
};
|
9269
|
-
};
|
9270
|
-
const isDiscounted = (price2, compareAtPrice2) => Number(compareAtPrice2?.amount) > Number(price2?.amount);
|
9271
|
-
const price = totalBundlePrice();
|
9272
|
-
const compareAtPrice = totalBundleCompareAtPrice();
|
9273
|
-
const CompareAtPrice = ({ data: compareAtPrice2 }) => {
|
9274
|
-
return compareAtPrice2 && /* @__PURE__ */ jsx46(Money4, { as: "span", className: RebuyDynamicBundleProducts_default.compareAtPrice, data: compareAtPrice2, withoutTrailingZeros: true });
|
9275
|
-
};
|
9276
|
-
return products.length > 0 && /* @__PURE__ */ jsx46("div", { className: "flex items-center flex-col", children: !isDisabled && /* @__PURE__ */ jsxs28("p", { className: "flex items-center gap-2 mb-2", children: [
|
9277
|
-
/* @__PURE__ */ jsx46("span", { children: "Total Price:" }),
|
9278
|
-
/* @__PURE__ */ jsx46(Money4, { as: "span", data: price, withoutTrailingZeros: true }),
|
9279
|
-
isDiscounted(price, compareAtPrice) && /* @__PURE__ */ jsx46(CompareAtPrice, { data: compareAtPrice })
|
9280
|
-
] }) });
|
9281
|
-
};
|
9282
|
-
|
9283
9445
|
// src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.tsx
|
9284
|
-
import { jsx as
|
9446
|
+
import { jsx as jsx50, jsxs as jsxs29 } from "react/jsx-runtime";
|
9285
9447
|
var RebuyDynamicBundleProducts = (props) => {
|
9286
9448
|
const {
|
9287
9449
|
addToCartBtnText = "Add to cart",
|
9288
9450
|
addToCartCallback,
|
9289
|
-
customTitle = `These pair with
|
9451
|
+
customTitle = `These pair with {product_title}`,
|
9290
9452
|
customTitleLevel = "h2",
|
9291
|
-
customTitleStyle
|
9292
|
-
isHydrogenReact,
|
9293
|
-
product,
|
9294
|
-
products = []
|
9453
|
+
customTitleStyle
|
9295
9454
|
} = props;
|
9455
|
+
const { isHydrogenReact, product, products } = useRebuyWidget();
|
9456
|
+
const productTitle = customTitle.replace("{product_title}", product?.title ?? "");
|
9296
9457
|
const [bundleProducts, setBundleProducts] = useState22([]);
|
9297
9458
|
useEffect23(() => {
|
9298
9459
|
const mainProduct = convertToRebuyProduct(isHydrogenReact || false, product);
|
@@ -9328,11 +9489,11 @@ var RebuyDynamicBundleProducts = (props) => {
|
|
9328
9489
|
return null;
|
9329
9490
|
}
|
9330
9491
|
return /* @__PURE__ */ jsxs29("section", { className: RebuyDynamicBundleProducts_default.container, children: [
|
9331
|
-
/* @__PURE__ */
|
9492
|
+
/* @__PURE__ */ jsx50(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: productTitle }),
|
9332
9493
|
/* @__PURE__ */ jsxs29("div", { className: RebuyDynamicBundleProducts_default.bundleContainer, children: [
|
9333
|
-
/* @__PURE__ */
|
9334
|
-
/* @__PURE__ */
|
9335
|
-
/* @__PURE__ */
|
9494
|
+
/* @__PURE__ */ jsx50(BundleImages, { products: bundleProducts }),
|
9495
|
+
/* @__PURE__ */ jsx50(BundlePrice, { products: bundleProducts }),
|
9496
|
+
/* @__PURE__ */ jsx50("div", { className: RebuyDynamicBundleProducts_default.addCartBtnContainer, children: /* @__PURE__ */ jsx50(
|
9336
9497
|
AddToCartBtn,
|
9337
9498
|
{
|
9338
9499
|
addToCartBtnText,
|
@@ -9344,7 +9505,7 @@ var RebuyDynamicBundleProducts = (props) => {
|
|
9344
9505
|
})
|
9345
9506
|
}
|
9346
9507
|
) }),
|
9347
|
-
/* @__PURE__ */
|
9508
|
+
/* @__PURE__ */ jsx50(
|
9348
9509
|
BundleSelection,
|
9349
9510
|
{
|
9350
9511
|
onSelectVariant,
|
@@ -9362,14 +9523,13 @@ import { useCallback as useCallback16, useEffect as useEffect24, useState as use
|
|
9362
9523
|
|
9363
9524
|
// src/widgets/RebuyProductAddOns/RebuyProductAddOnCard.tsx
|
9364
9525
|
import { Image as Image3 } from "@shopify/hydrogen";
|
9365
|
-
import { Link as Link3 } from "react-router";
|
9366
9526
|
|
9367
9527
|
// src/widgets/RebuyProductAddOns/RebuyProductAddOns.module.css
|
9368
9528
|
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" };
|
9369
9529
|
var RebuyProductAddOns_default = result25;
|
9370
9530
|
|
9371
9531
|
// src/widgets/RebuyProductAddOns/RebuyProductAddOnCard.tsx
|
9372
|
-
import { jsx as
|
9532
|
+
import { jsx as jsx51, jsxs as jsxs30 } from "react/jsx-runtime";
|
9373
9533
|
var RebuyProductAddOnCard = ({
|
9374
9534
|
handleChange,
|
9375
9535
|
learnMoreText,
|
@@ -9378,8 +9538,8 @@ var RebuyProductAddOnCard = ({
|
|
9378
9538
|
titleLevel
|
9379
9539
|
}) => {
|
9380
9540
|
const { availableForSale, image } = product.selectedVariant || {};
|
9381
|
-
return /* @__PURE__ */
|
9382
|
-
/* @__PURE__ */
|
9541
|
+
return /* @__PURE__ */ jsx51("label", { className: RebuyProductAddOns_default.addOnCard, htmlFor: product.id, children: /* @__PURE__ */ jsxs30("div", { className: RebuyProductAddOns_default.addOnCardContent, children: [
|
9542
|
+
/* @__PURE__ */ jsx51(
|
9383
9543
|
"input",
|
9384
9544
|
{
|
9385
9545
|
checked: Boolean(product.selected),
|
@@ -9392,7 +9552,7 @@ var RebuyProductAddOnCard = ({
|
|
9392
9552
|
value: ""
|
9393
9553
|
}
|
9394
9554
|
),
|
9395
|
-
/* @__PURE__ */
|
9555
|
+
/* @__PURE__ */ jsx51("div", { className: RebuyProductAddOns_default.addOnCardContentImage, children: image && /* @__PURE__ */ jsx51(
|
9396
9556
|
Image3,
|
9397
9557
|
{
|
9398
9558
|
alt: image.altText || `Picture of ${product.title}`,
|
@@ -9402,35 +9562,44 @@ var RebuyProductAddOnCard = ({
|
|
9402
9562
|
}
|
9403
9563
|
) }),
|
9404
9564
|
/* @__PURE__ */ jsxs30("div", { className: RebuyProductAddOns_default.addOnCardTextContent, children: [
|
9405
|
-
!availableForSale && /* @__PURE__ */
|
9406
|
-
/* @__PURE__ */
|
9407
|
-
/* @__PURE__ */
|
9408
|
-
/* @__PURE__ */
|
9565
|
+
!availableForSale && /* @__PURE__ */ jsx51("p", { className: RebuyProductAddOns_default.addOnCardOutOfStock, children: outOfStockText }),
|
9566
|
+
/* @__PURE__ */ jsx51(Title, { level: titleLevel, text: product.title }),
|
9567
|
+
/* @__PURE__ */ jsx51(RebuyProductPrice, { selectedVariant: product.selectedVariant }),
|
9568
|
+
/* @__PURE__ */ jsx51(
|
9569
|
+
RebuyLink,
|
9570
|
+
{
|
9571
|
+
ariaLabel: `View ${product.title}`,
|
9572
|
+
className: RebuyProductAddOns_default.addOnCardLearnMore,
|
9573
|
+
handle: `/products/${product.handle}`,
|
9574
|
+
children: learnMoreText
|
9575
|
+
}
|
9576
|
+
)
|
9409
9577
|
] })
|
9410
9578
|
] }) });
|
9411
9579
|
};
|
9412
9580
|
|
9413
9581
|
// src/widgets/RebuyProductAddOns/RebuyProductAddOns.tsx
|
9414
|
-
import { jsx as
|
9582
|
+
import { jsx as jsx52, jsxs as jsxs31 } from "react/jsx-runtime";
|
9415
9583
|
var RebuyProductAddOns = (props) => {
|
9416
9584
|
const {
|
9585
|
+
addToCartBtnText = "Add to cart",
|
9417
9586
|
addToCartCallback,
|
9418
|
-
customTitle = `These pair with
|
9587
|
+
customTitle = `These pair with {product_title}`,
|
9419
9588
|
customTitleLevel = "h2",
|
9420
9589
|
customTitleStyle,
|
9421
9590
|
includeMainProduct = false,
|
9422
|
-
isHydrogenReact,
|
9423
9591
|
learnMoreText = "Learn more",
|
9424
9592
|
outOfStockText = "Out of stock",
|
9425
|
-
product,
|
9426
|
-
products = [],
|
9427
|
-
addToCartBtnText = "Add to cart",
|
9428
9593
|
subtotalText = "Add-ons Subtotal: ",
|
9429
|
-
withProductText = `With
|
9594
|
+
withProductText = `With {product_title}: `
|
9430
9595
|
} = props;
|
9596
|
+
const { isHydrogenReact, product, products } = useRebuyWidget();
|
9597
|
+
const productTitleClean = customTitle.replace("{product_title}", product?.title ?? "");
|
9598
|
+
const withProductTextClean = withProductText.replace("{product_title}", product?.title ?? "");
|
9431
9599
|
const [addedItems, setAddedItems] = useState23(products);
|
9432
9600
|
const [subtotalWithProduct, setSubtotalWithProduct] = useState23();
|
9433
9601
|
const [subtotalWithOutProduct, setSubtotalWithOutProduct] = useState23();
|
9602
|
+
const convertedProduct = convertToRebuyProduct(isHydrogenReact || false, product);
|
9434
9603
|
useEffect24(() => {
|
9435
9604
|
let initialTotal = 0;
|
9436
9605
|
let currencyCode = "USD";
|
@@ -9449,14 +9618,14 @@ var RebuyProductAddOns = (props) => {
|
|
9449
9618
|
setSubtotalWithOutProduct({
|
9450
9619
|
amount: String(
|
9451
9620
|
initialTotal - Number(
|
9452
|
-
isHydrogenReact ?
|
9621
|
+
isHydrogenReact ? convertedProduct?.selectedVariant?.priceV2?.amount : product?.selectedOrFirstAvailableVariant?.price.amount
|
9453
9622
|
)
|
9454
9623
|
),
|
9455
9624
|
currencyCode
|
9456
9625
|
});
|
9457
9626
|
setAddedItems(products);
|
9458
9627
|
if (includeMainProduct) {
|
9459
|
-
setAddedItems([
|
9628
|
+
setAddedItems([convertedProduct, ...products]);
|
9460
9629
|
} else {
|
9461
9630
|
setAddedItems(products);
|
9462
9631
|
}
|
@@ -9496,7 +9665,7 @@ var RebuyProductAddOns = (props) => {
|
|
9496
9665
|
setSubtotalWithOutProduct({
|
9497
9666
|
amount: String(
|
9498
9667
|
total - Number(
|
9499
|
-
isHydrogenReact ?
|
9668
|
+
isHydrogenReact ? convertedProduct?.selectedVariant?.priceV2?.amount : product?.selectedOrFirstAvailableVariant?.price.amount
|
9500
9669
|
)
|
9501
9670
|
),
|
9502
9671
|
currencyCode
|
@@ -9507,8 +9676,8 @@ var RebuyProductAddOns = (props) => {
|
|
9507
9676
|
return null;
|
9508
9677
|
}
|
9509
9678
|
return /* @__PURE__ */ jsxs31("div", { className: RebuyProductAddOns_default.container, children: [
|
9510
|
-
/* @__PURE__ */
|
9511
|
-
/* @__PURE__ */
|
9679
|
+
/* @__PURE__ */ jsx52(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: productTitleClean }),
|
9680
|
+
/* @__PURE__ */ jsx52("ul", { className: RebuyProductAddOns_default.productAddOnsList, children: products.map((product2) => /* @__PURE__ */ jsx52("li", { children: /* @__PURE__ */ jsx52(
|
9512
9681
|
RebuyProductAddOnCard,
|
9513
9682
|
{
|
9514
9683
|
handleChange,
|
@@ -9521,13 +9690,13 @@ var RebuyProductAddOns = (props) => {
|
|
9521
9690
|
/* @__PURE__ */ jsxs31("div", { className: RebuyProductAddOns_default.productAddOnsFooter, children: [
|
9522
9691
|
/* @__PURE__ */ jsxs31("div", { className: RebuyProductAddOns_default.moneyContainer, children: [
|
9523
9692
|
subtotalText,
|
9524
|
-
subtotalWithOutProduct && /* @__PURE__ */
|
9693
|
+
subtotalWithOutProduct && /* @__PURE__ */ jsx52(Money5, { data: subtotalWithOutProduct, withoutTrailingZeros: true })
|
9525
9694
|
] }),
|
9526
9695
|
includeMainProduct && /* @__PURE__ */ jsxs31("div", { className: RebuyProductAddOns_default.moneyContainer, children: [
|
9527
|
-
|
9528
|
-
subtotalWithProduct && /* @__PURE__ */
|
9696
|
+
withProductTextClean,
|
9697
|
+
subtotalWithProduct && /* @__PURE__ */ jsx52(Money5, { data: subtotalWithProduct, withoutTrailingZeros: true })
|
9529
9698
|
] }),
|
9530
|
-
/* @__PURE__ */
|
9699
|
+
/* @__PURE__ */ jsx52("div", { className: RebuyProductAddOns_default.addCartBtnContainer, children: includeMainProduct ? /* @__PURE__ */ jsx52(
|
9531
9700
|
AddToCartBtn,
|
9532
9701
|
{
|
9533
9702
|
addToCartBtnText,
|
@@ -9537,7 +9706,7 @@ var RebuyProductAddOns = (props) => {
|
|
9537
9706
|
moneyData: subtotalWithProduct,
|
9538
9707
|
selectedVariants: addedItems.map((item) => item.selectedVariant)
|
9539
9708
|
}
|
9540
|
-
) : /* @__PURE__ */
|
9709
|
+
) : /* @__PURE__ */ jsx52(
|
9541
9710
|
AddToCartBtn,
|
9542
9711
|
{
|
9543
9712
|
addToCartBtnText,
|
@@ -9557,32 +9726,33 @@ var result26 = { "container": "RebuyProductRecommendations_container", "productG
|
|
9557
9726
|
var RebuyProductRecommendations_default = result26;
|
9558
9727
|
|
9559
9728
|
// src/widgets/RebuyProductRecommendations/RebuyProductRecommendations.tsx
|
9560
|
-
import { jsx as
|
9729
|
+
import { jsx as jsx53, jsxs as jsxs32 } from "react/jsx-runtime";
|
9561
9730
|
var RebuyProductRecommendations = (props) => {
|
9562
9731
|
const {
|
9563
9732
|
addToCartBtnText = "Add to cart",
|
9564
9733
|
addToCartCallback,
|
9565
|
-
customTitle = `These pair with
|
9734
|
+
customTitle = `These pair with {product_title}`,
|
9566
9735
|
customTitleLevel = "h2",
|
9567
|
-
customTitleStyle
|
9568
|
-
products = []
|
9736
|
+
customTitleStyle
|
9569
9737
|
} = props;
|
9738
|
+
const { isHydrogenReact, product, products } = useRebuyWidget();
|
9739
|
+
const productTitle = customTitle.replace("{product_title}", product?.title ?? "");
|
9570
9740
|
if (products.length === 0) {
|
9571
9741
|
rebuyDebugLog.log("widget-product-recommendations" /* WIDGET_PRODUCT_RECOMMENDATIONS */, "RebuyProductRecommendations: No products found");
|
9572
9742
|
return null;
|
9573
9743
|
}
|
9574
9744
|
return /* @__PURE__ */ jsxs32("section", { className: RebuyProductRecommendations_default.container, children: [
|
9575
|
-
/* @__PURE__ */
|
9576
|
-
/* @__PURE__ */
|
9745
|
+
/* @__PURE__ */ jsx53(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: productTitle }),
|
9746
|
+
/* @__PURE__ */ jsx53("ul", { className: RebuyProductRecommendations_default.productGrid, children: products.map((product2) => /* @__PURE__ */ jsx53("li", { children: /* @__PURE__ */ jsx53(
|
9577
9747
|
ProductCard,
|
9578
9748
|
{
|
9579
9749
|
addToCartBtnText,
|
9580
9750
|
addToCartCallback,
|
9581
|
-
isHydrogenReact
|
9582
|
-
product,
|
9751
|
+
isHydrogenReact,
|
9752
|
+
product: product2,
|
9583
9753
|
productCardTitleLevel: getTitleLevel(customTitleLevel, true)
|
9584
9754
|
}
|
9585
|
-
) },
|
9755
|
+
) }, product2.id)) })
|
9586
9756
|
] });
|
9587
9757
|
};
|
9588
9758
|
|
@@ -9659,14 +9829,14 @@ var RebuyProductViewed = ({ ...props }) => {
|
|
9659
9829
|
// src/widgets/RebuyRecentlyViewedProducts/RebuyRecentlyViewedProducts.tsx
|
9660
9830
|
import { RebuyClient as RebuyClient5 } from "@rebuy/rebuy";
|
9661
9831
|
import { flattenConnection as flattenConnection5 } from "@shopify/hydrogen";
|
9662
|
-
import { useContext as
|
9832
|
+
import { useContext as useContext6, useEffect as useEffect26, useMemo as useMemo23, useState as useState25 } from "react";
|
9663
9833
|
|
9664
9834
|
// src/widgets/RebuyRecentlyViewedProducts/RebuyRecentlyViewedProducts.module.css
|
9665
9835
|
var result27 = { "rebuy-recently-viewed-products-container": "RebuyRecentlyViewedProducts_rebuy-recently-viewed-products-container", "product-grid": "RebuyRecentlyViewedProducts_product-grid" };
|
9666
9836
|
var RebuyRecentlyViewedProducts_default = result27;
|
9667
9837
|
|
9668
9838
|
// src/widgets/RebuyRecentlyViewedProducts/RebuyRecentlyViewedProducts.tsx
|
9669
|
-
import { jsx as
|
9839
|
+
import { jsx as jsx54, jsxs as jsxs33 } from "react/jsx-runtime";
|
9670
9840
|
var RebuyRecentlyViewedProducts = (props) => {
|
9671
9841
|
const {
|
9672
9842
|
addToCartBtnText = "Add to cart",
|
@@ -9680,7 +9850,7 @@ var RebuyRecentlyViewedProducts = (props) => {
|
|
9680
9850
|
} = props;
|
9681
9851
|
const { customerId, uuid } = useProductViewedStore();
|
9682
9852
|
const { apiKey, loadingStatus: configLoadingStatus, rebuyConfig } = useRebuyConfig();
|
9683
|
-
const rebuyContext =
|
9853
|
+
const rebuyContext = useContext6(RebuyContext);
|
9684
9854
|
const [rebuyApiClient, setRebuyApiClient] = useState25(null);
|
9685
9855
|
const [initialized, setInitialized] = useState25(false);
|
9686
9856
|
const [products, setProducts] = useState25([]);
|
@@ -9756,8 +9926,8 @@ var RebuyRecentlyViewedProducts = (props) => {
|
|
9756
9926
|
return null;
|
9757
9927
|
}
|
9758
9928
|
return /* @__PURE__ */ jsxs33("div", { className: RebuyRecentlyViewedProducts_default["rebuy-recently-viewed-products-container"], children: [
|
9759
|
-
/* @__PURE__ */
|
9760
|
-
/* @__PURE__ */
|
9929
|
+
/* @__PURE__ */ jsx54(Title, { level: getTitleLevel(customTitleLevel), style: customTitleStyle, text: customTitle }),
|
9930
|
+
/* @__PURE__ */ jsx54("ul", { className: RebuyRecentlyViewedProducts_default["product-grid"], children: products?.map((product) => /* @__PURE__ */ jsx54("li", { children: /* @__PURE__ */ jsx54(
|
9761
9931
|
ProductCard,
|
9762
9932
|
{
|
9763
9933
|
addToCartBtnText,
|