@fluid-app/portal-sdk 0.1.84 → 0.1.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ShopScreen-CaTpU5go.cjs → ShopScreen-BK6QNd3h.cjs} +1 -1
- package/dist/{ShopScreen-CDwCW5Go.cjs → ShopScreen-D2S24-LK.cjs} +90 -71
- package/dist/ShopScreen-D2S24-LK.cjs.map +1 -0
- package/dist/{ShopScreen-B0Pr0CTu.mjs → ShopScreen-DdPigYbj.mjs} +91 -72
- package/dist/{ShopScreen-B0Pr0CTu.mjs.map → ShopScreen-DdPigYbj.mjs.map} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +1 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -3
- package/package.json +10 -10
- package/dist/ShopScreen-CDwCW5Go.cjs.map +0 -1
|
@@ -9,7 +9,7 @@ import { n as listProducts, t as getProduct } from "./products-Dkwd_Bh0.mjs";
|
|
|
9
9
|
import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
10
10
|
import { useInfiniteQuery, useQuery } from "@tanstack/react-query";
|
|
11
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { ArrowLeft, ChevronLeft, ChevronRight, CirclePlay, Search, ShoppingCart } from "lucide-react";
|
|
12
|
+
import { ArrowLeft, ChevronLeft, ChevronRight, CirclePlay, Link, Search, ShoppingCart } from "lucide-react";
|
|
13
13
|
import { createPortal } from "react-dom";
|
|
14
14
|
import { create } from "zustand";
|
|
15
15
|
import "zustand/middleware";
|
|
@@ -1345,7 +1345,7 @@ function ProductListing({ countryCode, companyLogoUrl, renderImage, onSelectProd
|
|
|
1345
1345
|
})]
|
|
1346
1346
|
});
|
|
1347
1347
|
}
|
|
1348
|
-
function ProductDetail({ productId, countryCode, renderImage, onBack, onAddToCart, cartButton }) {
|
|
1348
|
+
function ProductDetail({ productId, countryCode, renderImage, onBack, onAddToCart, cartButton, companyName }) {
|
|
1349
1349
|
const { product, isLoading, error, currentVariant, productOptions, effectiveSelectedOptions, handleOptionChange, quantity, setQuantity, isSubscribe, userSelectedSubscribe, setUserSelectedSubscribe, showBuyOnce, showSubscribe, selectedSubscriptionPlan, setSelectedSubscriptionPlan, displayPrice, displayWholesalePrice, displayWholesaleSubscriptionPrice, wholesaleCv, wholesaleQv, currentVariantCountry } = useProductDetail({
|
|
1350
1350
|
productId,
|
|
1351
1351
|
countryCode
|
|
@@ -1361,6 +1361,8 @@ function ProductDetail({ productId, countryCode, renderImage, onBack, onAddToCar
|
|
|
1361
1361
|
currentVariant?.images,
|
|
1362
1362
|
coverImage
|
|
1363
1363
|
]);
|
|
1364
|
+
const isBundle = product?.bundle === true;
|
|
1365
|
+
const bundleUrl = isBundle && product?.canonical_url ? product.canonical_url : null;
|
|
1364
1366
|
const handleAddToCart = () => {
|
|
1365
1367
|
if (!onAddToCart || !currentVariant?.id) return;
|
|
1366
1368
|
onAddToCart(currentVariant.id, quantity, isSubscribe, selectedSubscriptionPlan?.subscription_plan?.id?.toString());
|
|
@@ -1435,7 +1437,7 @@ function ProductDetail({ productId, countryCode, renderImage, onBack, onAddToCar
|
|
|
1435
1437
|
className: "text-foreground text-3xl font-bold",
|
|
1436
1438
|
children: title
|
|
1437
1439
|
}),
|
|
1438
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1440
|
+
!isBundle && /* @__PURE__ */ jsxs("div", {
|
|
1439
1441
|
className: "mb-2 flex items-center gap-2",
|
|
1440
1442
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1441
1443
|
className: "text-foreground text-sm",
|
|
@@ -1455,81 +1457,96 @@ function ProductDetail({ productId, countryCode, renderImage, onBack, onAddToCar
|
|
|
1455
1457
|
dangerouslySetInnerHTML: { __html: sanitizeHtml(product.description ?? "") }
|
|
1456
1458
|
})]
|
|
1457
1459
|
}),
|
|
1458
|
-
/* @__PURE__ */
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
isSubscribe,
|
|
1462
|
-
userSelectedSubscribe,
|
|
1463
|
-
onSubscribeChange: setUserSelectedSubscribe,
|
|
1464
|
-
wholesalePrice: currentVariantCountry?.wholesale,
|
|
1465
|
-
wholesaleSubscriptionPrice: currentVariantCountry?.wholesale_subscription_price,
|
|
1466
|
-
product_subscription_plans: product.product_subscription_plans || [],
|
|
1467
|
-
selectedSubscriptionPlan,
|
|
1468
|
-
onSubscriptionPlanChange: setSelectedSubscriptionPlan
|
|
1469
|
-
}),
|
|
1470
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1471
|
-
className: "text-muted-foreground mb-3 text-sm",
|
|
1472
|
-
children: [
|
|
1473
|
-
"CV ",
|
|
1474
|
-
countryCode && wholesaleCv != null ? wholesaleCv : "-",
|
|
1475
|
-
" | QV",
|
|
1476
|
-
" ",
|
|
1477
|
-
countryCode && wholesaleQv != null ? wholesaleQv : "-"
|
|
1478
|
-
]
|
|
1479
|
-
}),
|
|
1480
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center border-t" }),
|
|
1481
|
-
productOptions.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
1482
|
-
className: "mb-4 pt-4",
|
|
1483
|
-
children: productOptions.map((option) => /* @__PURE__ */ jsxs("div", {
|
|
1484
|
-
className: "mb-3 flex items-center",
|
|
1485
|
-
children: [/* @__PURE__ */ jsx("h3", {
|
|
1486
|
-
className: "text-md text-foreground w-24 font-bold",
|
|
1487
|
-
children: option.name.charAt(0).toUpperCase() + option.name.slice(1)
|
|
1488
|
-
}), /* @__PURE__ */ jsxs(Select, {
|
|
1489
|
-
value: effectiveSelectedOptions[option.id] || "",
|
|
1490
|
-
onValueChange: (value) => handleOptionChange(option.id, value),
|
|
1491
|
-
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
1492
|
-
className: "w-48 max-w-full",
|
|
1493
|
-
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: `Select ${option.name}` })
|
|
1494
|
-
}), /* @__PURE__ */ jsx(SelectContent, { children: option.values.map((value) => /* @__PURE__ */ jsx(SelectItem, {
|
|
1495
|
-
value,
|
|
1496
|
-
children: value
|
|
1497
|
-
}, value)) })]
|
|
1498
|
-
})]
|
|
1499
|
-
}, option.id))
|
|
1500
|
-
}),
|
|
1501
|
-
currentVariant?.subscription_only && !currentVariant.allow_subscription && /* @__PURE__ */ jsx("div", {
|
|
1502
|
-
className: "text-muted-foreground text-sm",
|
|
1503
|
-
children: "This product is unavailable for purchase."
|
|
1504
|
-
}),
|
|
1505
|
-
/* @__PURE__ */ jsx("div", { className: "mb-3" }),
|
|
1506
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1507
|
-
className: "flex items-center gap-3 pb-3",
|
|
1508
|
-
children: [/* @__PURE__ */ jsx(QuantitySelector, {
|
|
1509
|
-
quantity,
|
|
1510
|
-
setQuantity
|
|
1511
|
-
}), /* @__PURE__ */ jsxs(Button, {
|
|
1512
|
-
disabled: !currentVariant?.id || currentVariant?.subscription_only && !currentVariant.allow_subscription,
|
|
1460
|
+
isBundle ? /* @__PURE__ */ jsxs("div", {
|
|
1461
|
+
className: "pt-4",
|
|
1462
|
+
children: [/* @__PURE__ */ jsxs(Button, {
|
|
1513
1463
|
variant: "default",
|
|
1514
|
-
className: "
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
"data-fluid-quantity": quantity,
|
|
1519
|
-
"data-fluid-subscribe": isSubscribe,
|
|
1520
|
-
"data-fluid-subscription-plan-id": isSubscribe ? selectedSubscriptionPlan?.subscription_plan?.id?.toString() || product.product_subscription_plans?.find((plan) => plan.default)?.subscription_plan.id.toString() || product.product_subscription_plans?.[0]?.subscription_plan.id.toString() || "" : "",
|
|
1521
|
-
"data-fluid-open-cart-after-add": "false"
|
|
1464
|
+
className: "w-full gap-2 py-2 text-base font-medium",
|
|
1465
|
+
disabled: !bundleUrl,
|
|
1466
|
+
onClick: () => {
|
|
1467
|
+
if (bundleUrl) window.open(bundleUrl, "_blank", "noopener,noreferrer");
|
|
1522
1468
|
},
|
|
1523
|
-
children: [/* @__PURE__ */ jsx(
|
|
1469
|
+
children: [/* @__PURE__ */ jsx(Link, { className: "h-5 w-5" }), companyName ? `Purchase at ${companyName}` : "Purchase Bundle"]
|
|
1470
|
+
}), !bundleUrl && /* @__PURE__ */ jsx("p", {
|
|
1471
|
+
className: "text-muted-foreground mt-2 text-center text-xs",
|
|
1472
|
+
children: "Bundle configuration is unavailable. Please contact support."
|
|
1524
1473
|
})]
|
|
1525
|
-
})
|
|
1474
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1475
|
+
/* @__PURE__ */ jsx(PurchaseOptions, {
|
|
1476
|
+
showBuyOnce,
|
|
1477
|
+
showSubscribe,
|
|
1478
|
+
isSubscribe,
|
|
1479
|
+
userSelectedSubscribe,
|
|
1480
|
+
onSubscribeChange: setUserSelectedSubscribe,
|
|
1481
|
+
wholesalePrice: currentVariantCountry?.wholesale,
|
|
1482
|
+
wholesaleSubscriptionPrice: currentVariantCountry?.wholesale_subscription_price,
|
|
1483
|
+
product_subscription_plans: product.product_subscription_plans || [],
|
|
1484
|
+
selectedSubscriptionPlan,
|
|
1485
|
+
onSubscriptionPlanChange: setSelectedSubscriptionPlan
|
|
1486
|
+
}),
|
|
1487
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1488
|
+
className: "text-muted-foreground mb-3 text-sm",
|
|
1489
|
+
children: [
|
|
1490
|
+
"CV ",
|
|
1491
|
+
countryCode && wholesaleCv != null ? wholesaleCv : "-",
|
|
1492
|
+
" | QV ",
|
|
1493
|
+
countryCode && wholesaleQv != null ? wholesaleQv : "-"
|
|
1494
|
+
]
|
|
1495
|
+
}),
|
|
1496
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center border-t" }),
|
|
1497
|
+
productOptions.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
1498
|
+
className: "mb-4 pt-4",
|
|
1499
|
+
children: productOptions.map((option) => /* @__PURE__ */ jsxs("div", {
|
|
1500
|
+
className: "mb-3 flex items-center",
|
|
1501
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
1502
|
+
className: "text-md text-foreground w-24 font-bold",
|
|
1503
|
+
children: option.name.charAt(0).toUpperCase() + option.name.slice(1)
|
|
1504
|
+
}), /* @__PURE__ */ jsxs(Select, {
|
|
1505
|
+
value: effectiveSelectedOptions[option.id] || "",
|
|
1506
|
+
onValueChange: (value) => handleOptionChange(option.id, value),
|
|
1507
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
1508
|
+
className: "w-48 max-w-full",
|
|
1509
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: `Select ${option.name}` })
|
|
1510
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: option.values.map((value) => /* @__PURE__ */ jsx(SelectItem, {
|
|
1511
|
+
value,
|
|
1512
|
+
children: value
|
|
1513
|
+
}, value)) })]
|
|
1514
|
+
})]
|
|
1515
|
+
}, option.id))
|
|
1516
|
+
}),
|
|
1517
|
+
currentVariant?.subscription_only && !currentVariant.allow_subscription && /* @__PURE__ */ jsx("div", {
|
|
1518
|
+
className: "text-muted-foreground text-sm",
|
|
1519
|
+
children: "This product is unavailable for purchase."
|
|
1520
|
+
}),
|
|
1521
|
+
/* @__PURE__ */ jsx("div", { className: "mb-3" }),
|
|
1522
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1523
|
+
className: "flex items-center gap-3 pb-3",
|
|
1524
|
+
children: [/* @__PURE__ */ jsx(QuantitySelector, {
|
|
1525
|
+
quantity,
|
|
1526
|
+
setQuantity
|
|
1527
|
+
}), /* @__PURE__ */ jsxs(Button, {
|
|
1528
|
+
disabled: !currentVariant?.id || currentVariant?.subscription_only && !currentVariant.allow_subscription,
|
|
1529
|
+
variant: "default",
|
|
1530
|
+
className: "flex-1 gap-2 py-2 text-base font-medium",
|
|
1531
|
+
onClick: onAddToCart ? handleAddToCart : void 0,
|
|
1532
|
+
...!onAddToCart && {
|
|
1533
|
+
"data-fluid-add-to-cart": String(currentVariant?.id ?? ""),
|
|
1534
|
+
"data-fluid-quantity": quantity,
|
|
1535
|
+
"data-fluid-subscribe": isSubscribe,
|
|
1536
|
+
"data-fluid-subscription-plan-id": isSubscribe ? selectedSubscriptionPlan?.subscription_plan?.id?.toString() || product.product_subscription_plans?.find((plan) => plan.default)?.subscription_plan.id.toString() || product.product_subscription_plans?.[0]?.subscription_plan.id.toString() || "" : "",
|
|
1537
|
+
"data-fluid-open-cart-after-add": "false"
|
|
1538
|
+
},
|
|
1539
|
+
children: [/* @__PURE__ */ jsx(ShoppingCart, { className: "h-4 w-4" }), isSubscribe ? "Subscribe" : "Add to Cart"]
|
|
1540
|
+
})]
|
|
1541
|
+
})
|
|
1542
|
+
] })
|
|
1526
1543
|
]
|
|
1527
1544
|
})]
|
|
1528
1545
|
})
|
|
1529
1546
|
})]
|
|
1530
1547
|
});
|
|
1531
1548
|
}
|
|
1532
|
-
function ShopApp({ countryCode, companyLogoUrl, renderImage, onAddToCart, productId: controlledProductId, onSelectProduct: onSelectProductProp, onBack: onBackProp, cartButton }) {
|
|
1549
|
+
function ShopApp({ countryCode, companyLogoUrl, renderImage, onAddToCart, productId: controlledProductId, onSelectProduct: onSelectProductProp, onBack: onBackProp, cartButton, companyName }) {
|
|
1533
1550
|
const [internalProductId, setInternalProductId] = useState(null);
|
|
1534
1551
|
const activeProductId = controlledProductId !== void 0 ? controlledProductId : internalProductId;
|
|
1535
1552
|
const handleSelectProduct = onSelectProductProp ?? setInternalProductId;
|
|
@@ -1540,7 +1557,8 @@ function ShopApp({ countryCode, companyLogoUrl, renderImage, onAddToCart, produc
|
|
|
1540
1557
|
renderImage,
|
|
1541
1558
|
onBack: handleBack,
|
|
1542
1559
|
onAddToCart,
|
|
1543
|
-
cartButton
|
|
1560
|
+
cartButton,
|
|
1561
|
+
companyName
|
|
1544
1562
|
});
|
|
1545
1563
|
return /* @__PURE__ */ jsx(ProductListing, {
|
|
1546
1564
|
countryCode,
|
|
@@ -1742,7 +1760,8 @@ function ShopScreen({ background, textColor, accentColor, padding, borderRadius,
|
|
|
1742
1760
|
companyLogoUrl: userData?.company?.logo_url,
|
|
1743
1761
|
productId,
|
|
1744
1762
|
onSelectProduct: (id) => navigate(`shop/${id}`),
|
|
1745
|
-
onBack: () => navigate("shop")
|
|
1763
|
+
onBack: () => navigate("shop"),
|
|
1764
|
+
companyName: userData?.company?.name
|
|
1746
1765
|
})
|
|
1747
1766
|
})
|
|
1748
1767
|
})
|
|
@@ -1760,4 +1779,4 @@ const shopScreenPropertySchema = {
|
|
|
1760
1779
|
//#endregion
|
|
1761
1780
|
export { ShopScreen_exports as n, shopScreenPropertySchema as r, ShopScreen as t };
|
|
1762
1781
|
|
|
1763
|
-
//# sourceMappingURL=ShopScreen-
|
|
1782
|
+
//# sourceMappingURL=ShopScreen-DdPigYbj.mjs.map
|