randmarcomps 1.356.0 → 1.358.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/randmarcomps.js +100 -94
- package/dist/randmarcomps.umd.cjs +3 -3
- package/package.json +1 -1
package/dist/randmarcomps.js
CHANGED
|
@@ -62455,13 +62455,14 @@ function ManufacturerCategorySummary({
|
|
|
62455
62455
|
productsNumber: n = 0,
|
|
62456
62456
|
autoreorder: o = !1,
|
|
62457
62457
|
starred: l = !1,
|
|
62458
|
-
isLoading: d = !1
|
|
62458
|
+
isLoading: d = !1,
|
|
62459
|
+
children: f
|
|
62459
62460
|
}) {
|
|
62460
|
-
return d ? /* @__PURE__ */ jsxs(Card, {
|
|
62461
|
+
return d ? /* @__PURE__ */ jsxs(Card, { children: [
|
|
62461
62462
|
/* @__PURE__ */ jsx(CardHeader, { className: "pb-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
|
|
62462
62463
|
/* @__PURE__ */ jsx("div", { className: "space-y-1 flex-1", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
62463
|
-
/* @__PURE__ */ jsx("div", { className: "h-3 w-
|
|
62464
|
-
/* @__PURE__ */ jsx("div", { className: "h-5 w-
|
|
62464
|
+
/* @__PURE__ */ jsx("div", { className: "h-3 w-28 bg-muted rounded-md animate-pulse" }),
|
|
62465
|
+
/* @__PURE__ */ jsx("div", { className: "h-5 w-48 bg-muted rounded-md animate-pulse" })
|
|
62465
62466
|
] }) }),
|
|
62466
62467
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-end gap-1", children: [
|
|
62467
62468
|
/* @__PURE__ */ jsx("div", { className: "h-3 w-12 bg-muted rounded-md animate-pulse" }),
|
|
@@ -62490,54 +62491,53 @@ function ManufacturerCategorySummary({
|
|
|
62490
62491
|
] })
|
|
62491
62492
|
] })
|
|
62492
62493
|
] })
|
|
62493
|
-
] }) : /* @__PURE__ */
|
|
62494
|
-
/* @__PURE__ */
|
|
62495
|
-
/* @__PURE__ */
|
|
62494
|
+
] }) : /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "grid grid-cols-[1fr_auto] items-start gap-4 pt-6", children: [
|
|
62495
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start gap-4", children: [
|
|
62496
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
62496
62497
|
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: "Category Name" }),
|
|
62497
62498
|
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold leading-none tracking-tight", children: t })
|
|
62498
|
-
] })
|
|
62499
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-end gap-1", children: [
|
|
62500
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: "Starred" }),
|
|
62501
|
-
l ? /* @__PURE__ */ jsx(Star, { className: "h-5 w-5 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ jsx(Star, { className: "h-5 w-5 text-muted-foreground" })
|
|
62502
|
-
] })
|
|
62503
|
-
] }) }),
|
|
62504
|
-
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-4", children: [
|
|
62499
|
+
] }),
|
|
62505
62500
|
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
62506
62501
|
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: "Niche" }),
|
|
62507
62502
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: e })
|
|
62508
62503
|
] }),
|
|
62509
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
62510
|
-
/* @__PURE__ */
|
|
62511
|
-
|
|
62512
|
-
/* @__PURE__ */
|
|
62513
|
-
|
|
62514
|
-
|
|
62515
|
-
|
|
62516
|
-
|
|
62517
|
-
|
|
62518
|
-
|
|
62519
|
-
|
|
62520
|
-
|
|
62521
|
-
|
|
62522
|
-
|
|
62523
|
-
|
|
62524
|
-
|
|
62525
|
-
|
|
62526
|
-
|
|
62527
|
-
|
|
62528
|
-
|
|
62529
|
-
|
|
62504
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
62505
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: "Products" }),
|
|
62506
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
62507
|
+
/* @__PURE__ */ jsx(Package, { className: "h-4 w-4 text-muted-foreground" }),
|
|
62508
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: n })
|
|
62509
|
+
] })
|
|
62510
|
+
] })
|
|
62511
|
+
] }),
|
|
62512
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-end justify-between gap-4 h-full", children: [
|
|
62513
|
+
f,
|
|
62514
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-end gap-1", children: [
|
|
62515
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: "Starred" }),
|
|
62516
|
+
l ? /* @__PURE__ */ jsx(Star, { className: "h-5 w-5 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ jsx(Star, { className: "h-5 w-5 text-muted-foreground" })
|
|
62517
|
+
] }),
|
|
62518
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1 flex flex-col items-end", children: [
|
|
62519
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: "Auto-reorder" }),
|
|
62520
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
62521
|
+
o ? /* @__PURE__ */ jsx(RefreshCw, { className: "size-4 text-green-600" }) : /* @__PURE__ */ jsx(RefreshCwOff, { className: "size-4 text-amber-600" }),
|
|
62522
|
+
/* @__PURE__ */ jsx(
|
|
62523
|
+
Badge,
|
|
62524
|
+
{
|
|
62525
|
+
variant: o ? "default" : "secondary",
|
|
62526
|
+
className: cn("text-xs", o ? "text-green-600 bg-green-100 hover:bg-green-200" : "text-amber-600 bg-amber-100 hover:bg-amber-200"),
|
|
62527
|
+
children: o ? "Enabled" : "Disabled"
|
|
62528
|
+
}
|
|
62529
|
+
)
|
|
62530
62530
|
] })
|
|
62531
62531
|
] })
|
|
62532
62532
|
] })
|
|
62533
|
-
] });
|
|
62533
|
+
] }) });
|
|
62534
62534
|
}
|
|
62535
62535
|
function ManufacturerProducts({
|
|
62536
62536
|
applicationId: t,
|
|
62537
62537
|
manufacturer: e,
|
|
62538
62538
|
shopifyHostName: n
|
|
62539
62539
|
}) {
|
|
62540
|
-
var I, V, q, z, Q, F, j
|
|
62540
|
+
var I, V, q, z, Q, F, j;
|
|
62541
62541
|
const [o] = usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeShopifyMutation(), [l, d] = useState(((V = (I = e.Categories) == null ? void 0 : I[0]) == null ? void 0 : V.CategoryCode) || ""), [f, g] = useState(!1), [b, S] = useState(!1), { toast: _ } = useToast(), {
|
|
62542
62542
|
data: C,
|
|
62543
62543
|
isLoading: E,
|
|
@@ -62563,8 +62563,8 @@ function ManufacturerProducts({
|
|
|
62563
62563
|
description: "Category synced to Shopify successfully",
|
|
62564
62564
|
variant: "success"
|
|
62565
62565
|
});
|
|
62566
|
-
} catch (
|
|
62567
|
-
console.error("Error syncing to Shopify:",
|
|
62566
|
+
} catch (te) {
|
|
62567
|
+
console.error("Error syncing to Shopify:", te), _({
|
|
62568
62568
|
title: "Error",
|
|
62569
62569
|
description: "Error syncing category to Shopify.",
|
|
62570
62570
|
variant: "destructive"
|
|
@@ -62573,8 +62573,8 @@ function ManufacturerProducts({
|
|
|
62573
62573
|
g(!1);
|
|
62574
62574
|
}
|
|
62575
62575
|
}, M = () => {
|
|
62576
|
-
var
|
|
62577
|
-
return ((
|
|
62576
|
+
var te, ne;
|
|
62577
|
+
return ((ne = (te = e.Categories) == null ? void 0 : te.find((oe) => oe.CategoryCode === l)) == null ? void 0 : ne.CategoryName) || l;
|
|
62578
62578
|
};
|
|
62579
62579
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
62580
62580
|
/* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
|
|
@@ -62586,56 +62586,37 @@ function ManufacturerProducts({
|
|
|
62586
62586
|
onSelectCategory: d
|
|
62587
62587
|
}
|
|
62588
62588
|
),
|
|
62589
|
-
|
|
62590
|
-
/* @__PURE__ */ jsx(DialogTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Button, { className: "bg-green-600 hover:bg-green-700 mb-4", disabled: f, children: f ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
62591
|
-
/* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
62592
|
-
"Syncing..."
|
|
62593
|
-
] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
62594
|
-
/* @__PURE__ */ jsx(ShoppingCart, { className: "mr-2 h-4 w-4" }),
|
|
62595
|
-
"Sync Category to Shopify"
|
|
62596
|
-
] }) }) }),
|
|
62597
|
-
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
62598
|
-
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
62599
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: "Confirm Sync to Shopify" }),
|
|
62600
|
-
/* @__PURE__ */ jsxs(DialogDescription, { children: [
|
|
62601
|
-
'Are you sure you want to sync the category "',
|
|
62602
|
-
M(),
|
|
62603
|
-
'" to Shopify? This will add all products in this category to your Shopify store.'
|
|
62604
|
-
] })
|
|
62605
|
-
] }),
|
|
62606
|
-
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
62607
|
-
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => S(!1), children: "Cancel" }),
|
|
62608
|
-
/* @__PURE__ */ jsx(
|
|
62609
|
-
Button,
|
|
62610
|
-
{
|
|
62611
|
-
className: "bg-green-600 hover:bg-green-700",
|
|
62612
|
-
onClick: A,
|
|
62613
|
-
disabled: f,
|
|
62614
|
-
children: f ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
62615
|
-
/* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
62616
|
-
"Syncing..."
|
|
62617
|
-
] }) : "Confirm Sync"
|
|
62618
|
-
}
|
|
62619
|
-
)
|
|
62620
|
-
] })
|
|
62621
|
-
] })
|
|
62622
|
-
] }) }),
|
|
62623
|
-
/* @__PURE__ */ jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsx(
|
|
62589
|
+
/* @__PURE__ */ jsx("div", { className: "mb-4 w-full", children: /* @__PURE__ */ jsx(
|
|
62624
62590
|
ManufacturerCategorySummary,
|
|
62625
62591
|
{
|
|
62626
62592
|
name: M(),
|
|
62627
|
-
niche: (
|
|
62628
|
-
productsNumber: ((
|
|
62593
|
+
niche: (C == null ? void 0 : C.Niche) || "",
|
|
62594
|
+
productsNumber: ((q = C == null ? void 0 : C.Products) == null ? void 0 : q.length) || 0,
|
|
62629
62595
|
autoreorder: (C == null ? void 0 : C.AutoReorder) || !1,
|
|
62630
62596
|
starred: (C == null ? void 0 : C.Starred) || !1,
|
|
62631
|
-
isLoading: E
|
|
62597
|
+
isLoading: E || R,
|
|
62598
|
+
children: n && ((z = e.Categories) == null ? void 0 : z.findIndex((te) => te.AvailableToBuy)) !== -1 && /* @__PURE__ */ jsx(
|
|
62599
|
+
Button,
|
|
62600
|
+
{
|
|
62601
|
+
className: "bg-green-600 hover:bg-green-700",
|
|
62602
|
+
disabled: f,
|
|
62603
|
+
onClick: () => S(!0),
|
|
62604
|
+
children: f ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
62605
|
+
/* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
62606
|
+
"Syncing..."
|
|
62607
|
+
] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
62608
|
+
/* @__PURE__ */ jsx(ShoppingCart, { className: "mr-2 h-4 w-4" }),
|
|
62609
|
+
"Sync Category to Shopify"
|
|
62610
|
+
] })
|
|
62611
|
+
}
|
|
62612
|
+
)
|
|
62632
62613
|
}
|
|
62633
62614
|
) }),
|
|
62634
62615
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 @md:grid-cols-2 gap-4", children: [
|
|
62635
62616
|
/* @__PURE__ */ jsx(
|
|
62636
62617
|
ManufacturerCategoriesStats,
|
|
62637
62618
|
{
|
|
62638
|
-
categories: [(
|
|
62619
|
+
categories: [(Q = e.Categories) == null ? void 0 : Q.find((te) => te.CategoryCode === l)].filter(Boolean),
|
|
62639
62620
|
manufID: e.ManufacturerId,
|
|
62640
62621
|
appID: t
|
|
62641
62622
|
}
|
|
@@ -62643,9 +62624,9 @@ function ManufacturerProducts({
|
|
|
62643
62624
|
/* @__PURE__ */ jsx(
|
|
62644
62625
|
ActiveOrdersCard,
|
|
62645
62626
|
{
|
|
62646
|
-
orders: (
|
|
62647
|
-
(
|
|
62648
|
-
(
|
|
62627
|
+
orders: (F = C == null ? void 0 : C.Products) == null ? void 0 : F.flatMap(
|
|
62628
|
+
(te) => (te.ActiveOrderDetails || []).filter(
|
|
62629
|
+
(ne) => ne.Category === l
|
|
62649
62630
|
)
|
|
62650
62631
|
),
|
|
62651
62632
|
loading: E || R
|
|
@@ -62653,22 +62634,47 @@ function ManufacturerProducts({
|
|
|
62653
62634
|
)
|
|
62654
62635
|
] })
|
|
62655
62636
|
] }),
|
|
62656
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4", children: E || R ? Array.from({ length: 4 }).map((
|
|
62657
|
-
const
|
|
62658
|
-
return (
|
|
62659
|
-
})) == null ? void 0 :
|
|
62637
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4", children: E || R ? Array.from({ length: 4 }).map((te, ne) => /* @__PURE__ */ jsx(ProductCard, {}, ne)) : C != null && C.Products && (C == null ? void 0 : C.Products.length) > 0 ? (j = [...C.Products].sort((te, ne) => {
|
|
62638
|
+
const oe = te.OverallPercentileRank ?? 0;
|
|
62639
|
+
return (ne.OverallPercentileRank ?? 0) - oe;
|
|
62640
|
+
})) == null ? void 0 : j.map((te) => /* @__PURE__ */ jsx(
|
|
62660
62641
|
ProductCard,
|
|
62661
62642
|
{
|
|
62662
62643
|
applicationId: t,
|
|
62663
|
-
product:
|
|
62664
|
-
viewProductLink: `/${t}/Product/${
|
|
62644
|
+
product: te,
|
|
62645
|
+
viewProductLink: `/${t}/Product/${te.RandmarSKU}`,
|
|
62665
62646
|
shopifyHostname: n
|
|
62666
62647
|
},
|
|
62667
|
-
|
|
62648
|
+
te.RandmarSKU
|
|
62668
62649
|
)) : /* @__PURE__ */ jsxs(Alert, { variant: "warning", className: "col-span-1 @md:col-span-2", children: [
|
|
62669
62650
|
/* @__PURE__ */ jsx(CircleAlert, { className: "h-4 w-4" }),
|
|
62670
62651
|
/* @__PURE__ */ jsx(AlertTitle, { children: "Warning" }),
|
|
62671
62652
|
/* @__PURE__ */ jsx(AlertDescription, { children: "No products found for this manufacturer category." })
|
|
62653
|
+
] }) }),
|
|
62654
|
+
/* @__PURE__ */ jsx(Dialog, { open: b, onOpenChange: S, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
62655
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
62656
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: "Confirm Sync to Shopify" }),
|
|
62657
|
+
/* @__PURE__ */ jsxs(DialogDescription, { children: [
|
|
62658
|
+
'Are you sure you want to sync the category "',
|
|
62659
|
+
M(),
|
|
62660
|
+
'" to Shopify? This will add all products in this category to your Shopify store.'
|
|
62661
|
+
] })
|
|
62662
|
+
] }),
|
|
62663
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
62664
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => S(!1), children: "Cancel" }),
|
|
62665
|
+
/* @__PURE__ */ jsx(
|
|
62666
|
+
Button,
|
|
62667
|
+
{
|
|
62668
|
+
className: "bg-green-600 hover:bg-green-700",
|
|
62669
|
+
onClick: A,
|
|
62670
|
+
disabled: f,
|
|
62671
|
+
children: f ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
62672
|
+
/* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
62673
|
+
"Syncing..."
|
|
62674
|
+
] }) : "Confirm Sync"
|
|
62675
|
+
}
|
|
62676
|
+
)
|
|
62677
|
+
] })
|
|
62672
62678
|
] }) })
|
|
62673
62679
|
] });
|
|
62674
62680
|
}
|
|
@@ -73351,7 +73357,7 @@ function ProductCard({
|
|
|
73351
73357
|
) }) })
|
|
73352
73358
|
] }) })
|
|
73353
73359
|
] }),
|
|
73354
|
-
e.Distribution && /* @__PURE__ */ jsxs("div", { className: "flex flex-row justify-between items-end mt-4 gap-4", children: [
|
|
73360
|
+
e.Distribution && /* @__PURE__ */ jsxs("div", { className: "flex flex-row flex-wrap justify-between items-end mt-4 gap-4", children: [
|
|
73355
73361
|
/* @__PURE__ */ jsx("div", { className: "flex-shrink-1 flex flex-col gap-1", children: Be > 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxs("span", { className: "text-2xl font-bold whitespace-nowrap", children: [
|
|
73356
73362
|
"Cost: ",
|
|
73357
73363
|
formatMoney(Be)
|
|
@@ -92536,9 +92542,9 @@ const TopPercentTreemap = ({
|
|
|
92536
92542
|
] })
|
|
92537
92543
|
] }) }) }) : e.length > 0 ? (
|
|
92538
92544
|
// Main responsive grid for the results and the assistant sidebar.
|
|
92539
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-
|
|
92540
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
92541
|
-
/* @__PURE__ */ jsx("aside", { className: "
|
|
92545
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-8", children: [
|
|
92546
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-3 xl:col-span-2", children: o }),
|
|
92547
|
+
/* @__PURE__ */ jsx("aside", { className: "col-span-1 block bg-white rounded-xl collapse xl:visible", children: /* @__PURE__ */ jsx("div", { className: "sticky top-16", children: /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsx(
|
|
92542
92548
|
AssistantInsight,
|
|
92543
92549
|
{
|
|
92544
92550
|
prompt: l,
|
|
@@ -1130,7 +1130,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An err
|
|
|
1130
1130
|
- less than the value passed to \`max\` (or ${DEFAULT_MAX} if no \`max\` prop is set)
|
|
1131
1131
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
1132
1132
|
|
|
1133
|
-
Defaulting to \`null\`.`}var Root=Progress$1,Indicator=ProgressIndicator;const Progress=React__namespace.forwardRef(({className:t,value:e,...n},o)=>jsxRuntime.jsx(Root,{ref:o,className:cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:jsxRuntime.jsx(Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Progress.displayName=Root.displayName;function ManufacturerInventoryFinanceCard({manufacturer:t,isLoading:e}){const{data:n,isLoading:o,isFetching:l}=useGetV4ManufacturerByRouteManufacturerIdInventoryValueQuery({routeManufacturerId:(t==null?void 0:t.ManufacturerId)??""},{skip:!(t!=null&&t.ManufacturerId)}),d=(t==null?void 0:t.DefaultMaxInventoryValue)??0,f=(n||[]).reduce((S,_)=>S+(_.InventoryValue||0),0),g=d-f,b=Math.round(f/d*100);return e||o||l?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(DollarSign,{className:"h-5 w-5 text-muted-foreground"}),"Inventory Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current inventory financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[d!==0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Max Allowance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(d)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Current value"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(f)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available"}),jsxRuntime.jsx("span",{className:`font-bold ${g>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(g)})]})]}),d!==0&&jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Budget Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[b,"%"]}),b>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:b>80?"High usage alert":"Budget usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:b,className:"h-2"})]})]})]})}function ManufacturerCreditFinanceCard({manufacturer:t,isLoading:e}){const n=(t==null?void 0:t.CreditLimit)??0,o=(t==null?void 0:t.OutstandingBalance)??0,l=n-o,d=Math.round(o/n*100);return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(CreditCard,{className:"h-5 w-5 text-muted-foreground"}),"Credit Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current credit financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Limit"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(n)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Outstanding Balance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(o)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available Credit"}),jsxRuntime.jsx("span",{className:`font-bold ${l>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(l)})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[d,"%"]}),d>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:d>80?"High credit usage alert":"Credit usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:d,className:"h-2"})]})]})]})}function SalesChartCard({statistics:t,loading:e=!1,mode:n="month",chartHeight:o=300,className:l,size:d="default"}){return e?jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-48 rounded-md"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{style:{height:o},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}),d==="default"&&n==="month"&&jsxRuntime.jsxs("div",{className:"mt-4 flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40 rounded-md"})]})]})]}):jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:n==="week"?"Weekly Sales Performance":"Monthly Sales Performance"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(SalesChart,{statistics:t,mode:n,chartHeight:o,size:d})})]})}function ManufacturerOverviewPage({applicationId:t,readonly:e,withReports:n,manufacturer:o,userEmail:l}){const{data:d,isLoading:f,isError:g}=useGetV4PartnerByApplicationIdAccountManufacturerQuery({applicationId:t,withSpecification:!0},{skip:!!o}),[b,S]=React.useState({publicInfo:{hasUnsavedChanges:!1},qualifications:{hasUnsavedChanges:!1},billingInfo:{hasUnsavedChanges:!1}}),_=React.useCallback(()=>e?!1:b.publicInfo.hasUnsavedChanges||b.qualifications.hasUnsavedChanges||b.billingInfo.hasUnsavedChanges,[e,b]),R=React.useCallback((A,M)=>{S(I=>{var j;return((j=I[A])==null?void 0:j.hasUnsavedChanges)!==M.hasUnsavedChanges?(console.log(`Updating form state for ${A}:`,M.hasUnsavedChanges),{...I,[A]:M}):I})},[]),{NavigationGuardDialog:C}=useRouterNavigationGuard(_),E=o??d;return jsxRuntime.jsxs("div",{className:"@container",children:[g?jsxRuntime.jsx(Card,{className:"p-6",children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"There was an error loading your manufacturer information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:E==null?void 0:E.FiscalYearMonthStart,salesData:E==null?void 0:E.SalesData,isLoading:f}),jsxRuntime.jsxs("div",{className:"grid @2xl:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChartCard,{statistics:(E==null?void 0:E.SalesStatistics)??[],loading:f}),jsxRuntime.jsx(ManufacturerResellerOrdersSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",activeOrders:(E==null?void 0:E.ActiveOrderDetails)??void 0,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerInventoryFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerCreditFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerReorderingCard,{manufacturer:E??{},onSave:()=>{},loading:f,readonly:e}),n&&jsxRuntime.jsx(ManufacturerPublicInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("publicInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(OpenToWorkSection,{manufacturer:E,readonly:e,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerBillingInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("billingInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(ManufacturerQualificationsSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("qualifications",{hasUnsavedChanges:A})})]}),n&&jsxRuntime.jsx(ManufacturerReportsSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",userEmail:l,isLoading:f})]}),jsxRuntime.jsx(C,{})]})}function ManufacturerCategories({categories:t,activeCategory:e,onSelectCategory:n}){return jsxRuntime.jsx("div",{className:"grid",children:jsxRuntime.jsx("div",{className:"flex overflow-x-auto small-scrollbar pb-4",children:jsxRuntime.jsx("div",{className:"flex gap-2",children:t.map(o=>jsxRuntime.jsxs(Button,{onClick:()=>n(o.CategoryCode??""),variant:e===o.CategoryCode?"default":"outline",size:"sm",className:"px-3 py-1.5 text-xs whitespace-nowrap rounded-full",children:[o.CategoryName??"Undefined",o.QualificationRequired&&jsxRuntime.jsx(ShieldCheck,{className:`ml-1 w-5 h-5 ${e!==o.CategoryCode?"text-red-500":""}`})]},o.CategoryCode))})})})}function CategoryStats(t){const{data:e,isLoading:n,isFetching:o}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t.appID,manufacturerId:t.manufID,categoryCode:t.categoryCode});return jsxRuntime.jsx(Card,{className:"w-full",children:jsxRuntime.jsx(CardContent,{className:"p-4 space-y-1",children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:t.categoryName}),jsxRuntime.jsx(SalesChart,{statistics:(e==null?void 0:e.SalesStatistics)??[],loading:n||o,chartHeight:300})]})})})}function ManufacturerCategoriesStats(t){return(t.categories??[]).filter(n=>n.CategoryName).map(n=>jsxRuntime.jsx(CategoryStats,{appID:t.appID,manufID:t.manufID,categoryCode:n.CategoryCode,categoryName:n.CategoryName},`${t.manufID}-${n.CategoryCode}`))}const badgeVariants=cva("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground border border-input hover:bg-accent hover:text-accent-foreground",success:"bg-green-600 text-white hover:bg-green-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-blue-500 text-white hover:bg-blue-600",ghost:"bg-background hover:bg-accent hover:text-accent-foreground",randmarRed:"bg-randmar-red text-white hover:bg-randmar-red/80",randmarBlue:"bg-randmar-blue text-white hover:bg-randmar-blue/80",randmarPurple:"bg-randmar-purple text-white hover:bg-randmar-purple/80",randmarGreen:"bg-randmar-green text-black hover:bg-randmar-green/80",randmarBlack:"bg-randmar-black text-white hover:bg-randmar-black/80",randmarYellow:"bg-randmar-yellow text-black hover:bg-randmar-yellow/80"},size:{default:"h-6",sm:"h-5 text-[10px]",lg:"h-7 px-3"}},defaultVariants:{variant:"default",size:"default"}}),Badge=React__namespace.forwardRef(({className:t,variant:e,size:n,icon:o,children:l,...d},f)=>jsxRuntime.jsxs("div",{ref:f,className:cn(badgeVariants({variant:e,size:n}),t),...d,children:[o&&jsxRuntime.jsx("span",{className:"mr-1",children:o}),l]}));Badge.displayName="Badge";function ManufacturerCategorySummary({name:t="N/A",niche:e="N/A",productsNumber:n=0,autoreorder:o=!1,starred:l=!1,isLoading:d=!1}){return d?jsxRuntime.jsxs(Card,{className:"w-full max-w-lg mx-auto",children:[jsxRuntime.jsx(CardHeader,{className:"pb-4",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between",children:[jsxRuntime.jsx("div",{className:"space-y-1 flex-1",children:jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-20 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-5 w-40 bg-muted rounded-md animate-pulse"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-12 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-5 w-5 bg-muted rounded-md animate-pulse"})]})]})}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-8 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-4 w-32 bg-muted rounded-md animate-pulse"})]}),jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-16 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-4 w-4 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-4 w-6 bg-muted rounded-md animate-pulse"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-1 flex-1 flex flex-col items-end",children:[jsxRuntime.jsx("div",{className:"h-3 w-20 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-4 w-4 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-6 w-16 bg-muted rounded-md animate-pulse"})]})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full max-w-lg mx-auto",children:[jsxRuntime.jsx(CardHeader,{className:"pb-4",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between",children:[jsxRuntime.jsx("div",{className:"space-y-1 flex-1",children:jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Category Name"}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold leading-none tracking-tight",children:t})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Starred"}),l?jsxRuntime.jsx(Star,{className:"h-5 w-5 fill-yellow-400 text-yellow-400"}):jsxRuntime.jsx(Star,{className:"h-5 w-5 text-muted-foreground"})]})]})}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Niche"}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:e})]}),jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Products"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Package,{className:"h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:n})]})]}),jsxRuntime.jsxs("div",{className:"space-y-1 flex-1 flex flex-col items-end ",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Auto-reorder"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[o?jsxRuntime.jsx(RefreshCw,{className:"size-4 text-green-600"}):jsxRuntime.jsx(RefreshCwOff,{className:"size-4 text-amber-600"}),jsxRuntime.jsx(Badge,{variant:o?"default":"secondary",className:cn("text-xs",o?"text-green-600 bg-green-100 hover:bg-green-200":"text-amber-600 bg-amber-100 hover:bg-amber-200"),children:o?"Enabled":"Disabled"})]})]})]})]})]})}function ManufacturerProducts({applicationId:t,manufacturer:e,shopifyHostName:n}){var I,j,q,z,Q,O,F,te,ne;const[o]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeShopifyMutation(),[l,d]=React.useState(((j=(I=e.Categories)==null?void 0:I[0])==null?void 0:j.CategoryCode)||""),[f,g]=React.useState(!1),[b,S]=React.useState(!1),{toast:_}=useToast(),{data:R,isLoading:C,isFetching:E}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t,manufacturerId:e.ManufacturerId,categoryCode:l??""},{skip:!e.ManufacturerId||!l}),A=async()=>{try{g(!0),S(!1),await o({routeResellerId:t,manufacturerId:e.ManufacturerId??"",categoryCode:l,shopifyHostName:n}).unwrap()&&_({title:"Success",description:"Category synced to Shopify successfully",variant:"success"})}catch(se){console.error("Error syncing to Shopify:",se),_({title:"Error",description:"Error syncing category to Shopify.",variant:"destructive"})}finally{g(!1)}},M=()=>{var se,ge;return((ge=(se=e.Categories)==null?void 0:se.find(oe=>oe.CategoryCode===l))==null?void 0:ge.CategoryName)||l};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx(ManufacturerCategories,{categories:e.Categories||[],activeCategory:l,onSelectCategory:d}),n&&((q=e.Categories)==null?void 0:q.findIndex(se=>se.AvailableToBuy))!==-1&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsxs(Dialog,{open:b,onOpenChange:S,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700 mb-4",disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Category to Shopify"]})})}),jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the category "',M(),'" to Shopify? This will add all products in this category to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:A,disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})]})}),jsxRuntime.jsx("div",{className:"mb-4",children:jsxRuntime.jsx(ManufacturerCategorySummary,{name:M(),niche:((Q=(z=e.Categories)==null?void 0:z.find(se=>se.CategoryCode===l))==null?void 0:Q.CategoryName)||l,productsNumber:((O=R==null?void 0:R.Products)==null?void 0:O.length)||0,autoreorder:(R==null?void 0:R.AutoReorder)||!1,starred:(R==null?void 0:R.Starred)||!1,isLoading:C})}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsx(ManufacturerCategoriesStats,{categories:[(F=e.Categories)==null?void 0:F.find(se=>se.CategoryCode===l)].filter(Boolean),manufID:e.ManufacturerId,appID:t}),jsxRuntime.jsx(ActiveOrdersCard,{orders:(te=R==null?void 0:R.Products)==null?void 0:te.flatMap(se=>(se.ActiveOrderDetails||[]).filter(ge=>ge.Category===l)),loading:C||E})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4",children:C||E?Array.from({length:4}).map((se,ge)=>jsxRuntime.jsx(ProductCard,{},ge)):R!=null&&R.Products&&(R==null?void 0:R.Products.length)>0?(ne=[...R.Products].sort((se,ge)=>{const oe=se.OverallPercentileRank??0;return(ge.OverallPercentileRank??0)-oe}))==null?void 0:ne.map(se=>jsxRuntime.jsx(ProductCard,{applicationId:t,product:se,viewProductLink:`/${t}/Product/${se.RandmarSKU}`,shopifyHostname:n},se.RandmarSKU)):jsxRuntime.jsxs(Alert,{variant:"warning",className:"col-span-1 @md:col-span-2",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Warning"}),jsxRuntime.jsx(AlertDescription,{children:"No products found for this manufacturer category."})]})})]})}function PartnerRelationshipPage({applicationId:t,partnerId:e,userEmail:n,shopifyHostName:o,isSuperAdmin:l}){var q,z,Q;const{data:d}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t}),{data:f,isLoading:g,isFetching:b}=useGetV4PartnerByRouteApplicationIdPartnerAndPartnerIdQuery({routeApplicationId:t,partnerId:e,withSpecification:!0}),{toast:S}=useToast(),[_]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdShopifyMutation(),[R,C]=React.useState(!1),[E,A]=React.useState(!1),M=async()=>{try{C(!0),A(!1),await _({routeResellerId:t??"",manufacturerId:e??"",shopifyHostName:o}).unwrap()&&S({title:"Success",description:"Manufacturer synced to Shopify successfully",variant:"success"})}catch(O){console.error("Error syncing to Shopify:",O),S({title:"Error",description:"Error syncing manufacturer to Shopify.",variant:"destructive"})}finally{C(!1)}},I=()=>f!=null&&f.Reseller?"reseller-overview":f!=null&&f.Manufacturer?"manufacturer-overview":"",j=React.useMemo(()=>!d||!f?"":`
|
|
1133
|
+
Defaulting to \`null\`.`}var Root=Progress$1,Indicator=ProgressIndicator;const Progress=React__namespace.forwardRef(({className:t,value:e,...n},o)=>jsxRuntime.jsx(Root,{ref:o,className:cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:jsxRuntime.jsx(Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Progress.displayName=Root.displayName;function ManufacturerInventoryFinanceCard({manufacturer:t,isLoading:e}){const{data:n,isLoading:o,isFetching:l}=useGetV4ManufacturerByRouteManufacturerIdInventoryValueQuery({routeManufacturerId:(t==null?void 0:t.ManufacturerId)??""},{skip:!(t!=null&&t.ManufacturerId)}),d=(t==null?void 0:t.DefaultMaxInventoryValue)??0,f=(n||[]).reduce((S,_)=>S+(_.InventoryValue||0),0),g=d-f,b=Math.round(f/d*100);return e||o||l?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(DollarSign,{className:"h-5 w-5 text-muted-foreground"}),"Inventory Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current inventory financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[d!==0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Max Allowance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(d)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Current value"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(f)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available"}),jsxRuntime.jsx("span",{className:`font-bold ${g>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(g)})]})]}),d!==0&&jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Budget Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[b,"%"]}),b>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:b>80?"High usage alert":"Budget usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:b,className:"h-2"})]})]})]})}function ManufacturerCreditFinanceCard({manufacturer:t,isLoading:e}){const n=(t==null?void 0:t.CreditLimit)??0,o=(t==null?void 0:t.OutstandingBalance)??0,l=n-o,d=Math.round(o/n*100);return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/2 mt-2"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/4"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-1/3"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-2 w-full"})]})]})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsxs(CardHeader,{children:[jsxRuntime.jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(CreditCard,{className:"h-5 w-5 text-muted-foreground"}),"Credit Finance"]}),jsxRuntime.jsx(CardDescription,{children:"Current credit financial status"})]}),jsxRuntime.jsxs(CardContent,{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Limit"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(n)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Outstanding Balance"}),jsxRuntime.jsx("span",{className:"font-bold",children:formatMoney(o)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Available Credit"}),jsxRuntime.jsx("span",{className:`font-bold ${l>=0?"text-emerald-600 dark:text-emerald-500":"text-red-600 dark:text-red-500"}`,children:formatMoney(l)})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Credit Usage"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[d,"%"]}),d>80&&jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4 text-amber-500"})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:d>80?"High credit usage alert":"Credit usage"})})]})})]}),jsxRuntime.jsx(Progress,{value:d,className:"h-2"})]})]})]})}function SalesChartCard({statistics:t,loading:e=!1,mode:n="month",chartHeight:o=300,className:l,size:d="default"}){return e?jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-48 rounded-md"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{style:{height:o},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}),d==="default"&&n==="month"&&jsxRuntime.jsxs("div",{className:"mt-4 flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40 rounded-md"})]})]})]}):jsxRuntime.jsxs(Card,{className:cn("w-full",l),children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:n==="week"?"Weekly Sales Performance":"Monthly Sales Performance"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(SalesChart,{statistics:t,mode:n,chartHeight:o,size:d})})]})}function ManufacturerOverviewPage({applicationId:t,readonly:e,withReports:n,manufacturer:o,userEmail:l}){const{data:d,isLoading:f,isError:g}=useGetV4PartnerByApplicationIdAccountManufacturerQuery({applicationId:t,withSpecification:!0},{skip:!!o}),[b,S]=React.useState({publicInfo:{hasUnsavedChanges:!1},qualifications:{hasUnsavedChanges:!1},billingInfo:{hasUnsavedChanges:!1}}),_=React.useCallback(()=>e?!1:b.publicInfo.hasUnsavedChanges||b.qualifications.hasUnsavedChanges||b.billingInfo.hasUnsavedChanges,[e,b]),R=React.useCallback((A,M)=>{S(I=>{var j;return((j=I[A])==null?void 0:j.hasUnsavedChanges)!==M.hasUnsavedChanges?(console.log(`Updating form state for ${A}:`,M.hasUnsavedChanges),{...I,[A]:M}):I})},[]),{NavigationGuardDialog:C}=useRouterNavigationGuard(_),E=o??d;return jsxRuntime.jsxs("div",{className:"@container",children:[g?jsxRuntime.jsx(Card,{className:"p-6",children:jsxRuntime.jsxs(Alert,{variant:"destructive",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Error"}),jsxRuntime.jsx(AlertDescription,{children:"There was an error loading your manufacturer information. Please try again later."})]})}):jsxRuntime.jsxs("div",{className:"space-y-6 mb-6",children:[jsxRuntime.jsx(SalesSummary,{fiscalYearMonthStart:E==null?void 0:E.FiscalYearMonthStart,salesData:E==null?void 0:E.SalesData,isLoading:f}),jsxRuntime.jsxs("div",{className:"grid @2xl:grid-cols-2 gap-6",children:[jsxRuntime.jsx(SalesChartCard,{statistics:(E==null?void 0:E.SalesStatistics)??[],loading:f}),jsxRuntime.jsx(ManufacturerResellerOrdersSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",activeOrders:(E==null?void 0:E.ActiveOrderDetails)??void 0,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerInventoryFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerCreditFinanceCard,{manufacturer:E,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerReorderingCard,{manufacturer:E??{},onSave:()=>{},loading:f,readonly:e}),n&&jsxRuntime.jsx(ManufacturerPublicInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("publicInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(OpenToWorkSection,{manufacturer:E,readonly:e,isLoading:f}),n&&jsxRuntime.jsx(ManufacturerBillingInfoSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("billingInfo",{hasUnsavedChanges:A})}),n&&jsxRuntime.jsx(ManufacturerQualificationsSection,{manufacturer:E,readonly:e,isLoading:f,onUnsavedChanges:A=>R("qualifications",{hasUnsavedChanges:A})})]}),n&&jsxRuntime.jsx(ManufacturerReportsSection,{manufacturerId:(E==null?void 0:E.ManufacturerId)??"",userEmail:l,isLoading:f})]}),jsxRuntime.jsx(C,{})]})}function ManufacturerCategories({categories:t,activeCategory:e,onSelectCategory:n}){return jsxRuntime.jsx("div",{className:"grid",children:jsxRuntime.jsx("div",{className:"flex overflow-x-auto small-scrollbar pb-4",children:jsxRuntime.jsx("div",{className:"flex gap-2",children:t.map(o=>jsxRuntime.jsxs(Button,{onClick:()=>n(o.CategoryCode??""),variant:e===o.CategoryCode?"default":"outline",size:"sm",className:"px-3 py-1.5 text-xs whitespace-nowrap rounded-full",children:[o.CategoryName??"Undefined",o.QualificationRequired&&jsxRuntime.jsx(ShieldCheck,{className:`ml-1 w-5 h-5 ${e!==o.CategoryCode?"text-red-500":""}`})]},o.CategoryCode))})})})}function CategoryStats(t){const{data:e,isLoading:n,isFetching:o}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t.appID,manufacturerId:t.manufID,categoryCode:t.categoryCode});return jsxRuntime.jsx(Card,{className:"w-full",children:jsxRuntime.jsx(CardContent,{className:"p-4 space-y-1",children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:t.categoryName}),jsxRuntime.jsx(SalesChart,{statistics:(e==null?void 0:e.SalesStatistics)??[],loading:n||o,chartHeight:300})]})})})}function ManufacturerCategoriesStats(t){return(t.categories??[]).filter(n=>n.CategoryName).map(n=>jsxRuntime.jsx(CategoryStats,{appID:t.appID,manufID:t.manufID,categoryCode:n.CategoryCode,categoryName:n.CategoryName},`${t.manufID}-${n.CategoryCode}`))}const badgeVariants=cva("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground border border-input hover:bg-accent hover:text-accent-foreground",success:"bg-green-600 text-white hover:bg-green-700",warning:"bg-yellow-500 text-white hover:bg-yellow-600",info:"bg-blue-500 text-white hover:bg-blue-600",ghost:"bg-background hover:bg-accent hover:text-accent-foreground",randmarRed:"bg-randmar-red text-white hover:bg-randmar-red/80",randmarBlue:"bg-randmar-blue text-white hover:bg-randmar-blue/80",randmarPurple:"bg-randmar-purple text-white hover:bg-randmar-purple/80",randmarGreen:"bg-randmar-green text-black hover:bg-randmar-green/80",randmarBlack:"bg-randmar-black text-white hover:bg-randmar-black/80",randmarYellow:"bg-randmar-yellow text-black hover:bg-randmar-yellow/80"},size:{default:"h-6",sm:"h-5 text-[10px]",lg:"h-7 px-3"}},defaultVariants:{variant:"default",size:"default"}}),Badge=React__namespace.forwardRef(({className:t,variant:e,size:n,icon:o,children:l,...d},f)=>jsxRuntime.jsxs("div",{ref:f,className:cn(badgeVariants({variant:e,size:n}),t),...d,children:[o&&jsxRuntime.jsx("span",{className:"mr-1",children:o}),l]}));Badge.displayName="Badge";function ManufacturerCategorySummary({name:t="N/A",niche:e="N/A",productsNumber:n=0,autoreorder:o=!1,starred:l=!1,isLoading:d=!1,children:f}){return d?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-4",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between",children:[jsxRuntime.jsx("div",{className:"space-y-1 flex-1",children:jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-28 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-5 w-48 bg-muted rounded-md animate-pulse"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-12 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-5 w-5 bg-muted rounded-md animate-pulse"})]})]})}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-8 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-4 w-32 bg-muted rounded-md animate-pulse"})]}),jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[jsxRuntime.jsx("div",{className:"h-3 w-16 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-4 w-4 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-4 w-6 bg-muted rounded-md animate-pulse"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-1 flex-1 flex flex-col items-end",children:[jsxRuntime.jsx("div",{className:"h-3 w-20 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-4 w-4 bg-muted rounded-md animate-pulse"}),jsxRuntime.jsx("div",{className:"h-6 w-16 bg-muted rounded-md animate-pulse"})]})]})]})]})]}):jsxRuntime.jsx(Card,{children:jsxRuntime.jsxs(CardContent,{className:"grid grid-cols-[1fr_auto] items-start gap-4 pt-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-start gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Category Name"}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold leading-none tracking-tight",children:t})]}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Niche"}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:e})]}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Products"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Package,{className:"h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:n})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end justify-between gap-4 h-full",children:[f,jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Starred"}),l?jsxRuntime.jsx(Star,{className:"h-5 w-5 fill-yellow-400 text-yellow-400"}):jsxRuntime.jsx(Star,{className:"h-5 w-5 text-muted-foreground"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 flex flex-col items-end",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Auto-reorder"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[o?jsxRuntime.jsx(RefreshCw,{className:"size-4 text-green-600"}):jsxRuntime.jsx(RefreshCwOff,{className:"size-4 text-amber-600"}),jsxRuntime.jsx(Badge,{variant:o?"default":"secondary",className:cn("text-xs",o?"text-green-600 bg-green-100 hover:bg-green-200":"text-amber-600 bg-amber-100 hover:bg-amber-200"),children:o?"Enabled":"Disabled"})]})]})]})]})})}function ManufacturerProducts({applicationId:t,manufacturer:e,shopifyHostName:n}){var I,j,q,z,Q,O,F;const[o]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeShopifyMutation(),[l,d]=React.useState(((j=(I=e.Categories)==null?void 0:I[0])==null?void 0:j.CategoryCode)||""),[f,g]=React.useState(!1),[b,S]=React.useState(!1),{toast:_}=useToast(),{data:R,isLoading:C,isFetching:E}=useGetV4ResellerByRouteResellerIdManufacturerAndManufacturerIdCategoryCodeQuery({routeResellerId:t,manufacturerId:e.ManufacturerId,categoryCode:l??""},{skip:!e.ManufacturerId||!l}),A=async()=>{try{g(!0),S(!1),await o({routeResellerId:t,manufacturerId:e.ManufacturerId??"",categoryCode:l,shopifyHostName:n}).unwrap()&&_({title:"Success",description:"Category synced to Shopify successfully",variant:"success"})}catch(te){console.error("Error syncing to Shopify:",te),_({title:"Error",description:"Error syncing category to Shopify.",variant:"destructive"})}finally{g(!1)}},M=()=>{var te,ne;return((ne=(te=e.Categories)==null?void 0:te.find(se=>se.CategoryCode===l))==null?void 0:ne.CategoryName)||l};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx(ManufacturerCategories,{categories:e.Categories||[],activeCategory:l,onSelectCategory:d}),jsxRuntime.jsx("div",{className:"mb-4 w-full",children:jsxRuntime.jsx(ManufacturerCategorySummary,{name:M(),niche:(R==null?void 0:R.Niche)||"",productsNumber:((q=R==null?void 0:R.Products)==null?void 0:q.length)||0,autoreorder:(R==null?void 0:R.AutoReorder)||!1,starred:(R==null?void 0:R.Starred)||!1,isLoading:C||E,children:n&&((z=e.Categories)==null?void 0:z.findIndex(te=>te.AvailableToBuy))!==-1&&jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",disabled:f,onClick:()=>S(!0),children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2 h-4 w-4"}),"Sync Category to Shopify"]})})})}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4",children:[jsxRuntime.jsx(ManufacturerCategoriesStats,{categories:[(Q=e.Categories)==null?void 0:Q.find(te=>te.CategoryCode===l)].filter(Boolean),manufID:e.ManufacturerId,appID:t}),jsxRuntime.jsx(ActiveOrdersCard,{orders:(O=R==null?void 0:R.Products)==null?void 0:O.flatMap(te=>(te.ActiveOrderDetails||[]).filter(ne=>ne.Category===l)),loading:C||E})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4",children:C||E?Array.from({length:4}).map((te,ne)=>jsxRuntime.jsx(ProductCard,{},ne)):R!=null&&R.Products&&(R==null?void 0:R.Products.length)>0?(F=[...R.Products].sort((te,ne)=>{const se=te.OverallPercentileRank??0;return(ne.OverallPercentileRank??0)-se}))==null?void 0:F.map(te=>jsxRuntime.jsx(ProductCard,{applicationId:t,product:te,viewProductLink:`/${t}/Product/${te.RandmarSKU}`,shopifyHostname:n},te.RandmarSKU)):jsxRuntime.jsxs(Alert,{variant:"warning",className:"col-span-1 @md:col-span-2",children:[jsxRuntime.jsx(CircleAlert,{className:"h-4 w-4"}),jsxRuntime.jsx(AlertTitle,{children:"Warning"}),jsxRuntime.jsx(AlertDescription,{children:"No products found for this manufacturer category."})]})}),jsxRuntime.jsx(Dialog,{open:b,onOpenChange:S,children:jsxRuntime.jsxs(DialogContent,{children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Confirm Sync to Shopify"}),jsxRuntime.jsxs(DialogDescription,{children:['Are you sure you want to sync the category "',M(),'" to Shopify? This will add all products in this category to your Shopify store.']})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),jsxRuntime.jsx(Button,{className:"bg-green-600 hover:bg-green-700",onClick:A,disabled:f,children:f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):"Confirm Sync"})]})]})})]})}function PartnerRelationshipPage({applicationId:t,partnerId:e,userEmail:n,shopifyHostName:o,isSuperAdmin:l}){var q,z,Q;const{data:d}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t}),{data:f,isLoading:g,isFetching:b}=useGetV4PartnerByRouteApplicationIdPartnerAndPartnerIdQuery({routeApplicationId:t,partnerId:e,withSpecification:!0}),{toast:S}=useToast(),[_]=usePostV4ResellerByRouteResellerIdManufacturerAndManufacturerIdShopifyMutation(),[R,C]=React.useState(!1),[E,A]=React.useState(!1),M=async()=>{try{C(!0),A(!1),await _({routeResellerId:t??"",manufacturerId:e??"",shopifyHostName:o}).unwrap()&&S({title:"Success",description:"Manufacturer synced to Shopify successfully",variant:"success"})}catch(O){console.error("Error syncing to Shopify:",O),S({title:"Error",description:"Error syncing manufacturer to Shopify.",variant:"destructive"})}finally{C(!1)}},I=()=>f!=null&&f.Reseller?"reseller-overview":f!=null&&f.Manufacturer?"manufacturer-overview":"",j=React.useMemo(()=>!d||!f?"":`
|
|
1134
1134
|
Act as a business analyst. Your task is to provide a short, high-level summary
|
|
1135
1135
|
of the relationship between the two companies described in the JSON data below.
|
|
1136
1136
|
Suggest how these two entities can best work together.
|
|
@@ -1191,7 +1191,7 @@ Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=1
|
|
|
1191
1191
|
`;break;default:t+=String.fromCharCode(n);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}},pp.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(types$1.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
|
|
1192
1192
|
`&&++this.pos;case`
|
|
1193
1193
|
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},pp.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return`
|
|
1194
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var o=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],l=parseInt(o,8);return l>255&&(o=o.slice(0,-1),l=parseInt(o,8)),this.pos+=o.length-1,e=this.input.charCodeAt(this.pos),(o!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-o.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(l)}return isNewLine(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}},pp.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return n===null&&this.invalidStringToken(e,"Bad character escape sequence"),n},pp.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,n=this.pos,o=this.options.ecmaVersion>=6;this.pos<this.input.length;){var l=this.fullCharCodeAtPos();if(isIdentifierChar(l,o))this.pos+=l<=65535?1:2;else if(l===92){this.containsEsc=!0,t+=this.input.slice(n,this.pos);var d=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var f=this.readCodePoint();(e?isIdentifierStart:isIdentifierChar)(f,o)||this.invalidStringToken(d,"Invalid Unicode escape"),t+=codePointToString(f),n=this.pos}else break;e=!1}return t+this.input.slice(n,this.pos)},pp.readWord=function(){var t=this.readWord1(),e=types$1.name;return this.keywords.test(t)&&(e=keywords[t]),this.finishToken(e,t)};var version="8.12.1";Parser.acorn={Parser,version,defaultOptions,Position,SourceLocation,getLineInfo,Node:Node$3,TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext,tokContexts:types,isIdentifierChar,isIdentifierStart,Token,isNewLine,lineBreak,lineBreakG,nonASCIIwhitespace};var AcornJSX=__toESM(require_acorn_jsx(),1),attributeNames_default={acceptcharset:"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",autocapitalize:"autoCapitalize",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",colspan:"colSpan",contenteditable:"contentEditable",crossorigin:"crossOrigin",datetime:"dateTime",enctype:"encType",for:"htmlFor",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",httpequiv:"httpEquiv",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap"},VOID_ELEMENTS=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],NO_WHITESPACE=["table","tbody","tfoot","thead","tr"];function canHaveChildren(t){return VOID_ELEMENTS.indexOf(t.toLowerCase())===-1}function canHaveWhitespace(t){return NO_WHITESPACE.indexOf(t.toLowerCase())!==-1}class NullishShortCircuit extends Error{constructor(e="Nullish value encountered"){super(e),this.name="NullishShortCircuit"}}var hash=(t="",e=16)=>{const n=String(t);let o=0;return n.split("").forEach(l=>{o=(o<<5)-o+l.charCodeAt(0),o&=o}),Math.abs(o).toString(e)},randomHash=()=>hash(Math.random().toString()),camelCase=t=>t.replace(/([A-Z])([A-Z])/g,"$1 $2").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[^a-zA-Z\u00C0-\u00ff]/g," ").toLowerCase().split(" ").filter(e=>e).map((e,n)=>n>0?e[0].toUpperCase()+e.slice(1):e).join(""),parseStyle=t=>{switch(typeof t){case"string":return t.split(";").filter(e=>e).reduce((e,n)=>{const o=n.slice(0,n.indexOf(":")).trim(),l=n.slice(n.indexOf(":")+1).trim();return{...e,[camelCase(o)]:l}},{});case"object":return t;default:return}},pathToArrayPath=t=>t==null||t===""?[]:t.split("."),resolveArrayPath=(t,e)=>{const[n,...o]=e;if(!(t==null||n==null))return o.length===0?t[n]:resolveArrayPath(t[n],o)},resolvePath=(t,e)=>resolveArrayPath(t,pathToArrayPath(e));function handleNaN(t){return Number.isNaN(t)?"NaN":t}class JsxParser extends React.Component{constructor(){super(...arguments);nn(this,"ParsedChildren",null);zn(this,hn,n=>{const o=Parser.extend(AcornJSX.default({autoCloseVoidElements:this.props.autoCloseVoidElements})),l=`<root>${n}</root>`;let d=[];try{d=o.parse(l,{ecmaVersion:"latest"}),d=d.body[0].expression.children||[]}catch(f){return this.props.showWarnings&&console.warn(f),this.props.onError&&this.props.onError(f),this.props.renderError?this.props.renderError({error:String(f)}):null}return d.map(f=>un(this,an).call(this,f)).filter(Boolean)});zn(this,an,(n,o)=>{var l,d;switch(n.type){case"JSXAttribute":return n.value===null?!0:un(this,an).call(this,n.value,o);case"JSXElement":case"JSXFragment":return un(this,Xn).call(this,n,o);case"JSXExpressionContainer":return un(this,an).call(this,n.expression,o);case"JSXText":const f=this.props.disableKeyGeneration?void 0:randomHash();return this.props.disableFragments?n.value:React.createElement(React.Fragment,{key:f},n.value);case"ArrayExpression":return n.elements.map(A=>un(this,an).call(this,A,o));case"BinaryExpression":const g=un(this,an).call(this,n.left,o),b=un(this,an).call(this,n.right,o);let S;switch(n.operator){case"-":S=g-b;break;case"!=":S=g!=b;break;case"!==":S=g!==b;break;case"*":S=g*b;break;case"**":S=g**b;break;case"/":S=g/b;break;case"%":S=g%b;break;case"+":S=g+b;break;case"<":S=g<b;break;case"<=":S=g<=b;break;case"==":S=g==b;break;case"===":S=g===b;break;case">":S=g>b;break;case">=":S=g>=b;break;default:this.props.onError(new Error(`Unsupported binary operator: ${n.operator}`));return}return handleNaN(S);case"CallExpression":const _=un(this,an).call(this,n.callee,o);if(_===void 0){if(n.optional)throw new NullishShortCircuit;this.props.onError(new Error(`The expression '${n.callee}' could not be resolved, resulting in an undefined return value.`));return}return _(...n.arguments.map(A=>un(this,an).call(this,A,o)));case"ConditionalExpression":return un(this,an).call(this,n.test,o)?un(this,an).call(this,n.consequent,o):un(this,an).call(this,n.alternate,o);case"ExpressionStatement":return un(this,an).call(this,n.expression,o);case"Identifier":return n.name==="Infinity"?1/0:n.name==="-Infinity"?-1/0:n.name==="NaN"?NaN:o&&n.name in o?handleNaN(o[n.name]):handleNaN((this.props.bindings||{})[n.name]);case"Literal":return n.value;case"LogicalExpression":const R=un(this,an).call(this,n.left,o);return n.operator==="||"&&R?R:n.operator==="&&"&&R||n.operator==="||"&&!R?un(this,an).call(this,n.right,o):!1;case"MemberExpression":return un(this,ar).call(this,n,o);case"ChainExpression":return un(this,ir).call(this,n,o);case"ObjectExpression":const C={};return n.properties.forEach(A=>{C[A.key.name||A.key.value]=un(this,an).call(this,A.value,o)}),C;case"TemplateElement":return n.value.cooked;case"TemplateLiteral":return[...n.expressions,...n.quasis].sort((A,M)=>A.start<M.start?-1:1).map(A=>un(this,an).call(this,A,o)).join("");case"UnaryExpression":const E=un(this,an).call(this,n.argument,o);switch(n.operator){case"+":return+E;case"-":return-E;case"!":return!E}return;case"ArrowFunctionExpression":return(n.async||n.generator)&&((d=(l=this.props).onError)==null||d.call(l,new Error("Async and generator arrow functions are not supported."))),(...A)=>{const M={...o};return n.params.forEach((I,j)=>{M[I.name]=A[j]}),un(this,an).call(this,n.body,M)};default:this.props.onError(new Error(`The expression type '${n.type}' is not supported.`));return}});zn(this,ir,(n,o)=>{try{return un(this,an).call(this,n.expression,o)}catch(l){if(l instanceof NullishShortCircuit)return;throw l}});zn(this,ar,(n,o)=>{const l=un(this,an).call(this,n.object,o);let d;if(n.computed)d=un(this,an).call(this,n.property,o);else if(n.property.type==="Identifier")d=n.property.name;else{this.props.onError(new Error("Only simple MemberExpressions are supported."));return}if(l==null&&n.optional)throw new NullishShortCircuit;let f;try{f=l[d]}catch{this.props.onError(new Error(`The property '${d}' could not be resolved on the object '${l}'.`));return}return typeof f=="function"?f.bind(l):f});zn(this,Gn,n=>n.type==="JSXIdentifier"?n.name:`${un(this,Gn).call(this,n.object)}.${un(this,Gn).call(this,n.property)}`);zn(this,Xn,(n,o)=>{const{allowUnknownElements:l,components:d,componentsOnly:f,onError:g}=this.props,{children:b=[]}=n,S=n.type==="JSXElement"?n.openingElement:n.openingFragment,{attributes:_=[]}=S,R=n.type==="JSXElement"?un(this,Gn).call(this,S.name):"",C=(this.props.blacklistedAttrs||[]).map(z=>z instanceof RegExp?z:new RegExp(z,"i")),E=(this.props.blacklistedTags||[]).map(z=>z.trim().toLowerCase()).filter(Boolean);if(/^(html|head|body)$/i.test(R))return b.map(z=>un(this,Xn).call(this,z,o));const A=R.trim().toLowerCase();if(E.indexOf(A)!==-1)return g(new Error(`The tag <${R}> is blacklisted, and will not be rendered.`)),null;if(R!==""&&!resolvePath(d,R)){if(f)return g(new Error(`The component <${R}> is unrecognized, and will not be rendered.`)),this.props.renderUnrecognized(R);if(!l&&document.createElement(R)instanceof HTMLUnknownElement)return g(new Error(`The tag <${R}> is unrecognized in this browser, and will not be rendered.`)),this.props.renderUnrecognized(R)}let M,I=n.type==="JSXElement"?resolvePath(d,R):React.Fragment;if(I||canHaveChildren(R)){if(M=b.map(Q=>un(this,an).call(this,Q,o)),R.includes(".")){const O=R.split(".").reduce((F,te)=>F?F[te]:d==null?void 0:d[te],null);O&&(I=O)}!I&&!canHaveWhitespace(R)&&(M=M.filter(Q=>typeof Q!="string"||!/^\s*$/.test(Q)));const z=M.find(Q=>typeof Q=="function");M.length===0?M=void 0:z?M=z:M.length===1?[M]=M:M.length>1&&!this.props.disableKeyGeneration&&(M=M.map((Q,O)=>Q!=null&&Q.type&&!(Q!=null&&Q.key)?{...Q,key:Q.key||O}:Q))}const j={key:this.props.disableKeyGeneration?void 0:randomHash()};_.forEach(z=>{if(z.type==="JSXAttribute"){const Q=z.name.name,O=attributeNames_default[Q]||Q,F=un(this,an).call(this,z,o);C.filter(ne=>ne.test(O)).length===0&&(j[O]=F)}else if(z.type==="JSXSpreadAttribute"&&z.argument.type==="Identifier"||z.argument.type==="MemberExpression"){const Q=un(this,an).call(this,z.argument,o);typeof Q=="object"&&Object.keys(Q).forEach(O=>{const F=attributeNames_default[O]||O;C.filter(ne=>ne.test(F)).length===0&&(j[F]=Q[O])})}}),typeof j.style=="string"&&(j.style=parseStyle(j.style));const q=R.toLowerCase();return q==="option"&&(M=M.props.children),React.createElement(I||q,j,M)})}render(){const n=(this.props.jsx||"").trim().replace(/<!DOCTYPE([^>]*)>/g,"");this.ParsedChildren=un(this,hn).call(this,n);const o=[...new Set(["jsx-parser",...String(this.props.className).split(" ")])].filter(Boolean).join(" ");return this.props.renderInWrapper?React.createElement("div",{className:o},this.ParsedChildren):this.ParsedChildren}}hn=new WeakMap,an=new WeakMap,ir=new WeakMap,ar=new WeakMap,Gn=new WeakMap,Xn=new WeakMap,nn(JsxParser,"displayName","JsxParser"),nn(JsxParser,"defaultProps",{allowUnknownElements:!0,autoCloseVoidElements:!1,bindings:{},blacklistedAttrs:[/^on.+/i],blacklistedTags:["script"],className:"",components:{},componentsOnly:!1,disableFragments:!1,disableKeyGeneration:!1,jsx:"",onError:()=>{},showWarnings:!1,renderError:void 0,renderInWrapper:!0,renderUnrecognized:()=>null});var source_default=JsxParser;const CountryFlag=({countryCode:t,className:e=""})=>{const[n,o]=React.useState(null),[l,d]=React.useState(!1);return React.useEffect(()=>{if(!t)return;const g=`https://purecatamphetamine.github.io/country-flag-icons/3x2/${t.toUpperCase()}.svg`;fetch(g,{method:"HEAD"}).then(b=>{b.ok?(o(g),d(!1)):d(!0)}).catch(()=>{d(!0)})},[t]),l||!n?jsxRuntime.jsx("span",{className:e,children:t}):jsxRuntime.jsx("img",{src:n,alt:`${t} flag`,className:`inline-block ${e}`,style:{width:"24px",height:"auto"}})};function ProductCard({applicationId:t,product:e,viewProductLink:n,defaultOpportunityNumber:o="",onAddToCart:l,addingToCart:d=!1,shopifyHostname:f,customAction:g=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){var it,He,Rt,Qe,pt,Mt,$t,Ut,Ft,Ke,rt,ot;const b=React.useRef(null),S=useIntersectionObserver({elementRef:b,threshold:.1,rootMargin:"100px",freezeOnceVisible:!0}),_=reactRouterDom.useNavigate(),{toast:R}=useToast(),[C,E]=React.useState(1),[A,M]=React.useState(null),[I,j]=React.useState(0),[q,z]=React.useState(!1),[Q,O]=React.useState(!1),[F,te]=React.useState(!1),[ne]=usePutV4ResellerByRouteResellerIdProductAndRandmarSkuRequisitionMutation(),[se,ge]=React.useState(!1),[oe]=usePostV4ResellerByRouteResellerIdProductAndRandmarSkuShopifyMutation(),{data:Ae,isLoading:je,isFetching:Ne}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t},{skip:!t||!S}),$e=((it=e==null?void 0:e.Distribution)==null?void 0:it.Cost)||0,Le=((He=e==null?void 0:e.Distribution)==null?void 0:He.RegularPrice)||0,Ue=((Rt=e==null?void 0:e.Distribution)==null?void 0:Rt.Price)||0,Ve=React.useMemo(()=>{var ut;return!((ut=e==null?void 0:e.Distribution)!=null&&ut.Inventory)||e.Distribution.Inventory.length===0?0:e.Distribution.Inventory.reduce((dt,ft)=>dt+(ft.PurchaseOrderQuantity||0),0)},[(Qe=e==null?void 0:e.Distribution)==null?void 0:Qe.Inventory]);React.useEffect(()=>{E(1),M(null),j(0),z(!1)},[e==null?void 0:e.RandmarSKU]),React.useEffect(()=>{var ut;if(e&&o){const dt=(ut=e.Opportunities)==null?void 0:ut.find(ft=>ft.BidNumber==o);dt&&Oe(dt)&&M(dt)}},[e,o]),React.useEffect(()=>{if(!e)return;const ut=A!=null&&A.Price?A.Price:Ue;j(Le>0?Math.round((Le-ut)/Le*100):0)},[e,A,Ue,Le]),React.useEffect(()=>{d||E(1)},[d]);const Oe=ut=>{if(ut.Active!==!0)return!1;const dt=new Date().toISOString().split("T")[0];return!(ut.EndDate&&ut.EndDate.split("T")[0]<dt||ut.StartDate&&ut.StartDate.split("T")[0]>dt)};if(!e||je||Ne)return jsxRuntime.jsx(Card,{children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx("div",{className:"h-10 w-24 flex items-center justify-end ml-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"})})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-28 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx("div",{className:"w-60 h-40",children:jsxRuntime.jsx(Skeleton,{className:"w-full h-full rounded-lg"})})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24 mb-3"}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-full rounded-md"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-32 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 mt-4"})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-start gap-1 mb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-10 flex-1 rounded-md"})]})]})]})});const qe=(e==null?void 0:e.Opportunities)||[],Ge=qe.length>0,ze=()=>{if(C==null){E(1);return}C>1&&E(C-1)},Ye=()=>{if(C==null){E(1);return}E(C+1)},Ze=ut=>{const dt=Number.parseInt(ut.target.value,10);if(!isNaN(dt)&&dt>0){E(dt);return}E(void 0)},Je=()=>{(C==null||C<1)&&E(1)},tt=()=>{Q||!(Ae!=null&&Ae.IsReseller)||(O(!0),ne({routeResellerId:Ae.ApplicationId??"",randmarSku:e.RandmarSKU??""}).then(ut=>{ut.error||ut.data===!1?R({title:"Error",description:"Error submitting your qualification. Please reach out to Randmar.",variant:"destructive"}):R({title:"Success",description:"Qualification successfully submitted.",variant:"success"}),te(!1)}).catch(ut=>{console.error(ut),R({title:"Error",description:"Error submitting your qualification.",variant:"destructive"})}).finally(()=>{O(!1)}))},Xe=((Mt=(pt=e.Distribution)==null?void 0:pt.Inventory)==null?void 0:Mt.reduce((ut,dt)=>ut+(dt.AvailableQuantity||0),0))||0,at=ut=>{try{return new Date(ut).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch(dt){return console.error(dt),ut.split("T")[0]||"N/A"}},et=()=>{typeof l<"u"&&l({quantity:C??1,bidNumber:(A==null?void 0:A.BidNumber)??null})},st=()=>{se||!f||(ge(!0),oe({routeResellerId:t??"",randmarSku:e.RandmarSKU??"",shopifyHostName:f}).then(ut=>{if(ut.error){console.error("Error syncing to Shopify:",ut.error),R({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"});return}R({title:"Product synced",description:"Product synced to Shopify successfully",variant:"success"})}).catch(ut=>{console.error("Error syncing to Shopify:",ut),R({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"})}).finally(()=>{ge(!1)}))};return jsxRuntime.jsx(Card,{className:"w-full hover:shadow-lg transition-shadow @container",ref:b,children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-3",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-xl",children:e.Title||e.RandmarTitle}),jsxRuntime.jsx("div",{className:"w-24 h-10 flex items-center justify-end ml-4 flex-shrink-0",children:jsxRuntime.jsx(PartnerLogo,{id:e.ManufacturerId,name:e.ManufacturerName,width:96,height:40},`partner_logo_${e.ManufacturerId}`)})]}),jsxRuntime.jsxs("div",{className:"flex flex-col @[36rem]:flex-row gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-1 @[36rem]:order-1 order-2 flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 items-center justify-center @[36rem]:items-start @[36rem]:justify-start",children:[e.State&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.State==="Active"?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Check,{size:"12",className:"mr-1.5"})," ",e.State]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.SerialNumber?"bg-green-50 text-green-700 hover:bg-green-50":"bg-yellow-50 text-yellow-700 hover:bg-yellow-50"}`,children:[jsxRuntime.jsx(QrCode,{size:"12",className:"mr-1.5"})," ",e.SerialNumber?"Serialized":"Unserialized"]}),e.TransparencyCode&&jsxRuntime.jsxs(Badge,{variant:"outline",className:"rounded-full px-3 bg-green-50 text-green-700 hover:bg-green-50",children:[jsxRuntime.jsx(CircleDashed,{size:"12",className:"mr-1.5"})," Transparency Code"]}),e.AvailableToBuy!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.AvailableToBuy?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(ShoppingCart,{size:"12",className:"mr-1.5"})," ",e.AvailableToBuy?"Available":"Unavailable"]}),e.ManufacturerCategory!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${($t=e.ManufacturerCategory)!=null&&$t.QualificationRequired?"bg-blue-50 text-blue-700 hover:bg-blue-50":"bg-neutral-50 text-neutral-700 hover:bg-neutral-50"}`,children:[jsxRuntime.jsx(ShieldCheck,{size:"12",className:"mr-1.5"})," ",(Ut=e.ManufacturerCategory)!=null&&Ut.QualificationRequired?"Qualified Only":"Available to all"]}),e.ManufacturerId&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.AutoUpdate?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(RefreshCw,{size:"12",className:"mr-1.5"})," ",e.AutoUpdate?`Automatic Reorder (${e.MasterCarton})`:"Manually Reorders"]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.BodyHTML&&e.Title&&e.MAP?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Store,{size:"12",className:"mr-1.5"})," ",e.BodyHTML&&e.Title&&e.MAP?"Shopify Ready":"Not Shopify Ready"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"MPN"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.MPN||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"UPC"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.UPC||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Unit Weight"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.UnitWeight?`${formatNumber(e.UnitWeight)} lbs`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"text-sm text-muted-foreground",children:["MAP",jsxRuntime.jsx("span",{className:"text-primary",children:" / "}),"MSRP"]}),jsxRuntime.jsxs("div",{className:"font-medium",children:[e.MAP?formatMoney(e.MAP):"N/A",jsxRuntime.jsx("span",{className:"text-primary",children:" / "}),e.MSRP?formatMoney(e.MSRP):"N/A"]})]}),!!e.OverallPercentileRank&&!!e.ManufacturerPercentileRank&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Percentile"}),jsxRuntime.jsxs("div",{className:`font-medium flex items-center ${e.OverallPercentileRank>=80?"text-green-700":""}`,children:[formatNumber(Math.round(e.OverallPercentileRank))," Overall"]}),jsxRuntime.jsxs("div",{className:"font-light flex items-center text-sm",children:[formatNumber(Math.round(e.ManufacturerPercentileRank))," with Manufacturer"]})]}),e.CountryCodeOfOrigin&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Origin"}),jsxRuntime.jsxs("div",{className:"font-medium flex items-center",children:[jsxRuntime.jsx(CountryFlag,{countryCode:e.CountryCodeOfOrigin,className:"mr-2"}),e.CountryCodeOfOrigin]})]})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col @[36rem]:order-2 order-1 items-center",children:jsxRuntime.jsx(ProductImage,{randmarSKU:e.RandmarSKU||"",alt:e.RandmarTitle||""},`product_image_${e.RandmarSKU}`)})]}),jsxRuntime.jsxs("div",{className:"flex flex-col @[36rem]:flex-row gap-6 mt-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-row @[36rem]:flex-col gap-4 justify-center @[36rem]:justify-start @[36rem]:order-2 order-1",children:[n&&jsxRuntime.jsx(reactRouterDom.Link,{to:n,children:jsxRuntime.jsxs(Button,{variant:"secondary",children:[jsxRuntime.jsx(Eye,{className:"mr-2"}),"View Product"]})}),((Ft=e.Distribution)==null?void 0:Ft.Inventory)&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:Ae!=null&&Ae.IsReseller&&Xe<=0&&Ve<=0?jsxRuntime.jsxs(Dialog,{open:F,onOpenChange:te,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:"flex items-center text-sm reseller-theme text-primary",children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),"Request to stock"]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-md",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Request to stock"})}),jsxRuntime.jsx("p",{className:"py-4",children:"Are you sure you want to request this product to be stocked?"}),jsxRuntime.jsxs("div",{className:"flex justify-end gap-2",children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>te(!1),disabled:Q,children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:tt,disabled:Q,children:Q?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin mr-2"}),"Requesting..."]}):"Confirm"})]})]})]}):Xe<=0&&Ve>0?jsxRuntime.jsxs(Dialog,{open:q,onOpenChange:z,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:"flex items-center text-sm manufacturer-theme text-primary",children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),formatNumber(Ve)," Incoming"]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-4xl",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{className:"flex items-center",children:[jsxRuntime.jsx(Warehouse,{className:"mr-2",size:18}),"Inventory Information"]})}),jsxRuntime.jsx(ProductInventoryGrid,{inventory:e.Distribution.Inventory})]})]}):jsxRuntime.jsxs(Dialog,{open:q,onOpenChange:z,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:`flex items-center text-sm ${Xe>0?"text-green-700":"text-red-700"}`,children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),Xe>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[formatNumber(Xe)," in stock"]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Out of stock"})]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-4xl",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{className:"flex items-center",children:[jsxRuntime.jsx(Warehouse,{className:"mr-2",size:18}),"Inventory Information"]})}),jsxRuntime.jsx(ProductInventoryGrid,{inventory:e.Distribution.Inventory})]})]})})]}),jsxRuntime.jsx("div",{className:"flex flex-1 @[36rem]:order-1 order-2",children:Ge&&e.Distribution&&jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx("div",{className:"flex items-center",children:"You have "+qe.length+(qe.length>1?" opportunities":" opportunity")+" for this product:"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto p-2 mt-1",children:qe.map((ut,dt)=>Oe(ut)?jsxRuntime.jsxs("div",{className:`flex justify-between items-center rounded-lg transition-colors py-2 px-4 border border-muted cursor-pointer ${ut.BidNumber==(A==null?void 0:A.BidNumber)?"bg-purple-100 border-2 border-purple-900":"bg-white border-1 border-purple-600 hover:bg-purple-200"}`,onClick:()=>{M(ut.BidNumber!==(A==null?void 0:A.BidNumber)?ut:null)},children:[jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"font-medium text-sm",children:ut.Opportunity}),jsxRuntime.jsx("span",{className:"text-xs text-neutral-900",children:ut.BidNumber})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsx("span",{className:"font-semibold",children:formatMoney(ut.Price??0)}),ut.Rebate&&ut.Rebate>0&&jsxRuntime.jsxs("span",{className:"text-xs text-green-600",children:["Rebate: ",formatMoney(ut.Rebate)]}),ut.EndDate&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral-600",children:["Ends: ",at(ut.EndDate)]})]})]},dt):jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex justify-between items-center rounded-lg transition-colors py-2 px-4 bg-purple-100 border border-muted cursor-pointer !bg-neutral-50 hover:bg-neutral-100",onClick:()=>{ut.BidNumber&&_(`/${t}/Opportunity/${ut.ManufacturerId}/${ut.BidNumber}`)},children:[jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"font-medium text-sm",children:ut.Opportunity}),jsxRuntime.jsxs("span",{className:"text-xs text-neutral-900",children:[ut.BidNumber," ",jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs mx-1 h-5 bg-gray-100",children:"Currently unavailable"})]})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsx("span",{className:"font-semibold",children:formatMoney(ut.Price??0)}),ut.Rebate&&ut.Rebate>0&&jsxRuntime.jsxs("span",{className:"text-xs text-green-600",children:["Rebate: ",formatMoney(ut.Rebate)]}),ut.EndDate&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral-600",children:["Ends: ",at(ut.EndDate)]})]})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"View Opportunity"})})]},dt))})})]})})]}),e.Distribution&&jsxRuntime.jsxs("div",{className:"flex flex-row justify-between items-end mt-4 gap-4",children:[jsxRuntime.jsx("div",{className:"flex-shrink-1 flex flex-col gap-1",children:$e>0?jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:["Cost: ",formatMoney($e)]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap",children:[jsxRuntime.jsx("span",{className:"text-2xl font-bold whitespace-nowrap",children:formatMoney((A?(rt=(Ke=e.Opportunities)==null?void 0:Ke.find(ut=>ut.BidNumber==A.BidNumber))==null?void 0:rt.Price:Ue)??0)}),I>0&&jsxRuntime.jsx("span",{className:"text-muted-foreground line-through ml-2 whitespace-nowrap",children:formatMoney(Le)})]}),I>0&&jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs(Badge,{variant:"outline",className:"bg-red-50 text-red-700 rounded-full px-3 whitespace-nowrap",children:[jsxRuntime.jsxs("span",{children:[I,"% OFF"]}),((ot=e.InstantRebate)==null?void 0:ot.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",e.InstantRebate.EndDate.split("T")[0]]}),(A==null?void 0:A.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",A.EndDate.split("T")[0]]})]})})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center @[36rem]:justify-end items-end gap-2 w-full",children:[f&&jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap bg-green-600 hover:bg-green-700",onClick:st,disabled:se,children:se?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Sync to Shopify"]})}),g,typeof l<"u"&&jsxRuntime.jsxs("div",{className:"flex gap-2 whitespace-nowrap",children:[jsxRuntime.jsxs("div",{className:"flex items-center border rounded-md",children:[jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-r-none",onClick:ze,disabled:typeof C<"u"&&(C<=1||!e.AvailableToBuy||d),children:"-"}),jsxRuntime.jsx("input",{value:C,onChange:Ze,onBlur:Je,onClick:ut=>ut.currentTarget.select(),className:`w-6 @[36rem]:w-12 text-center border-0 focus:ring-0 focus:outline-none ${!e.AvailableToBuy||d?"text-gray-400":""}`,disabled:!e.AvailableToBuy||d}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-l-none",onClick:Ye,disabled:!e.AvailableToBuy||d,children:"+"})]}),jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap",onClick:et,disabled:!e.AvailableToBuy||d,children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Adding..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Add to Cart"]})})]})]})]})]})})}const complexComponents=[`----
|
|
1194
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var o=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],l=parseInt(o,8);return l>255&&(o=o.slice(0,-1),l=parseInt(o,8)),this.pos+=o.length-1,e=this.input.charCodeAt(this.pos),(o!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-o.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(l)}return isNewLine(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}},pp.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return n===null&&this.invalidStringToken(e,"Bad character escape sequence"),n},pp.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,n=this.pos,o=this.options.ecmaVersion>=6;this.pos<this.input.length;){var l=this.fullCharCodeAtPos();if(isIdentifierChar(l,o))this.pos+=l<=65535?1:2;else if(l===92){this.containsEsc=!0,t+=this.input.slice(n,this.pos);var d=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var f=this.readCodePoint();(e?isIdentifierStart:isIdentifierChar)(f,o)||this.invalidStringToken(d,"Invalid Unicode escape"),t+=codePointToString(f),n=this.pos}else break;e=!1}return t+this.input.slice(n,this.pos)},pp.readWord=function(){var t=this.readWord1(),e=types$1.name;return this.keywords.test(t)&&(e=keywords[t]),this.finishToken(e,t)};var version="8.12.1";Parser.acorn={Parser,version,defaultOptions,Position,SourceLocation,getLineInfo,Node:Node$3,TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext,tokContexts:types,isIdentifierChar,isIdentifierStart,Token,isNewLine,lineBreak,lineBreakG,nonASCIIwhitespace};var AcornJSX=__toESM(require_acorn_jsx(),1),attributeNames_default={acceptcharset:"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",autocapitalize:"autoCapitalize",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",colspan:"colSpan",contenteditable:"contentEditable",crossorigin:"crossOrigin",datetime:"dateTime",enctype:"encType",for:"htmlFor",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",httpequiv:"httpEquiv",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap"},VOID_ELEMENTS=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],NO_WHITESPACE=["table","tbody","tfoot","thead","tr"];function canHaveChildren(t){return VOID_ELEMENTS.indexOf(t.toLowerCase())===-1}function canHaveWhitespace(t){return NO_WHITESPACE.indexOf(t.toLowerCase())!==-1}class NullishShortCircuit extends Error{constructor(e="Nullish value encountered"){super(e),this.name="NullishShortCircuit"}}var hash=(t="",e=16)=>{const n=String(t);let o=0;return n.split("").forEach(l=>{o=(o<<5)-o+l.charCodeAt(0),o&=o}),Math.abs(o).toString(e)},randomHash=()=>hash(Math.random().toString()),camelCase=t=>t.replace(/([A-Z])([A-Z])/g,"$1 $2").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[^a-zA-Z\u00C0-\u00ff]/g," ").toLowerCase().split(" ").filter(e=>e).map((e,n)=>n>0?e[0].toUpperCase()+e.slice(1):e).join(""),parseStyle=t=>{switch(typeof t){case"string":return t.split(";").filter(e=>e).reduce((e,n)=>{const o=n.slice(0,n.indexOf(":")).trim(),l=n.slice(n.indexOf(":")+1).trim();return{...e,[camelCase(o)]:l}},{});case"object":return t;default:return}},pathToArrayPath=t=>t==null||t===""?[]:t.split("."),resolveArrayPath=(t,e)=>{const[n,...o]=e;if(!(t==null||n==null))return o.length===0?t[n]:resolveArrayPath(t[n],o)},resolvePath=(t,e)=>resolveArrayPath(t,pathToArrayPath(e));function handleNaN(t){return Number.isNaN(t)?"NaN":t}class JsxParser extends React.Component{constructor(){super(...arguments);nn(this,"ParsedChildren",null);zn(this,hn,n=>{const o=Parser.extend(AcornJSX.default({autoCloseVoidElements:this.props.autoCloseVoidElements})),l=`<root>${n}</root>`;let d=[];try{d=o.parse(l,{ecmaVersion:"latest"}),d=d.body[0].expression.children||[]}catch(f){return this.props.showWarnings&&console.warn(f),this.props.onError&&this.props.onError(f),this.props.renderError?this.props.renderError({error:String(f)}):null}return d.map(f=>un(this,an).call(this,f)).filter(Boolean)});zn(this,an,(n,o)=>{var l,d;switch(n.type){case"JSXAttribute":return n.value===null?!0:un(this,an).call(this,n.value,o);case"JSXElement":case"JSXFragment":return un(this,Xn).call(this,n,o);case"JSXExpressionContainer":return un(this,an).call(this,n.expression,o);case"JSXText":const f=this.props.disableKeyGeneration?void 0:randomHash();return this.props.disableFragments?n.value:React.createElement(React.Fragment,{key:f},n.value);case"ArrayExpression":return n.elements.map(A=>un(this,an).call(this,A,o));case"BinaryExpression":const g=un(this,an).call(this,n.left,o),b=un(this,an).call(this,n.right,o);let S;switch(n.operator){case"-":S=g-b;break;case"!=":S=g!=b;break;case"!==":S=g!==b;break;case"*":S=g*b;break;case"**":S=g**b;break;case"/":S=g/b;break;case"%":S=g%b;break;case"+":S=g+b;break;case"<":S=g<b;break;case"<=":S=g<=b;break;case"==":S=g==b;break;case"===":S=g===b;break;case">":S=g>b;break;case">=":S=g>=b;break;default:this.props.onError(new Error(`Unsupported binary operator: ${n.operator}`));return}return handleNaN(S);case"CallExpression":const _=un(this,an).call(this,n.callee,o);if(_===void 0){if(n.optional)throw new NullishShortCircuit;this.props.onError(new Error(`The expression '${n.callee}' could not be resolved, resulting in an undefined return value.`));return}return _(...n.arguments.map(A=>un(this,an).call(this,A,o)));case"ConditionalExpression":return un(this,an).call(this,n.test,o)?un(this,an).call(this,n.consequent,o):un(this,an).call(this,n.alternate,o);case"ExpressionStatement":return un(this,an).call(this,n.expression,o);case"Identifier":return n.name==="Infinity"?1/0:n.name==="-Infinity"?-1/0:n.name==="NaN"?NaN:o&&n.name in o?handleNaN(o[n.name]):handleNaN((this.props.bindings||{})[n.name]);case"Literal":return n.value;case"LogicalExpression":const R=un(this,an).call(this,n.left,o);return n.operator==="||"&&R?R:n.operator==="&&"&&R||n.operator==="||"&&!R?un(this,an).call(this,n.right,o):!1;case"MemberExpression":return un(this,ar).call(this,n,o);case"ChainExpression":return un(this,ir).call(this,n,o);case"ObjectExpression":const C={};return n.properties.forEach(A=>{C[A.key.name||A.key.value]=un(this,an).call(this,A.value,o)}),C;case"TemplateElement":return n.value.cooked;case"TemplateLiteral":return[...n.expressions,...n.quasis].sort((A,M)=>A.start<M.start?-1:1).map(A=>un(this,an).call(this,A,o)).join("");case"UnaryExpression":const E=un(this,an).call(this,n.argument,o);switch(n.operator){case"+":return+E;case"-":return-E;case"!":return!E}return;case"ArrowFunctionExpression":return(n.async||n.generator)&&((d=(l=this.props).onError)==null||d.call(l,new Error("Async and generator arrow functions are not supported."))),(...A)=>{const M={...o};return n.params.forEach((I,j)=>{M[I.name]=A[j]}),un(this,an).call(this,n.body,M)};default:this.props.onError(new Error(`The expression type '${n.type}' is not supported.`));return}});zn(this,ir,(n,o)=>{try{return un(this,an).call(this,n.expression,o)}catch(l){if(l instanceof NullishShortCircuit)return;throw l}});zn(this,ar,(n,o)=>{const l=un(this,an).call(this,n.object,o);let d;if(n.computed)d=un(this,an).call(this,n.property,o);else if(n.property.type==="Identifier")d=n.property.name;else{this.props.onError(new Error("Only simple MemberExpressions are supported."));return}if(l==null&&n.optional)throw new NullishShortCircuit;let f;try{f=l[d]}catch{this.props.onError(new Error(`The property '${d}' could not be resolved on the object '${l}'.`));return}return typeof f=="function"?f.bind(l):f});zn(this,Gn,n=>n.type==="JSXIdentifier"?n.name:`${un(this,Gn).call(this,n.object)}.${un(this,Gn).call(this,n.property)}`);zn(this,Xn,(n,o)=>{const{allowUnknownElements:l,components:d,componentsOnly:f,onError:g}=this.props,{children:b=[]}=n,S=n.type==="JSXElement"?n.openingElement:n.openingFragment,{attributes:_=[]}=S,R=n.type==="JSXElement"?un(this,Gn).call(this,S.name):"",C=(this.props.blacklistedAttrs||[]).map(z=>z instanceof RegExp?z:new RegExp(z,"i")),E=(this.props.blacklistedTags||[]).map(z=>z.trim().toLowerCase()).filter(Boolean);if(/^(html|head|body)$/i.test(R))return b.map(z=>un(this,Xn).call(this,z,o));const A=R.trim().toLowerCase();if(E.indexOf(A)!==-1)return g(new Error(`The tag <${R}> is blacklisted, and will not be rendered.`)),null;if(R!==""&&!resolvePath(d,R)){if(f)return g(new Error(`The component <${R}> is unrecognized, and will not be rendered.`)),this.props.renderUnrecognized(R);if(!l&&document.createElement(R)instanceof HTMLUnknownElement)return g(new Error(`The tag <${R}> is unrecognized in this browser, and will not be rendered.`)),this.props.renderUnrecognized(R)}let M,I=n.type==="JSXElement"?resolvePath(d,R):React.Fragment;if(I||canHaveChildren(R)){if(M=b.map(Q=>un(this,an).call(this,Q,o)),R.includes(".")){const O=R.split(".").reduce((F,te)=>F?F[te]:d==null?void 0:d[te],null);O&&(I=O)}!I&&!canHaveWhitespace(R)&&(M=M.filter(Q=>typeof Q!="string"||!/^\s*$/.test(Q)));const z=M.find(Q=>typeof Q=="function");M.length===0?M=void 0:z?M=z:M.length===1?[M]=M:M.length>1&&!this.props.disableKeyGeneration&&(M=M.map((Q,O)=>Q!=null&&Q.type&&!(Q!=null&&Q.key)?{...Q,key:Q.key||O}:Q))}const j={key:this.props.disableKeyGeneration?void 0:randomHash()};_.forEach(z=>{if(z.type==="JSXAttribute"){const Q=z.name.name,O=attributeNames_default[Q]||Q,F=un(this,an).call(this,z,o);C.filter(ne=>ne.test(O)).length===0&&(j[O]=F)}else if(z.type==="JSXSpreadAttribute"&&z.argument.type==="Identifier"||z.argument.type==="MemberExpression"){const Q=un(this,an).call(this,z.argument,o);typeof Q=="object"&&Object.keys(Q).forEach(O=>{const F=attributeNames_default[O]||O;C.filter(ne=>ne.test(F)).length===0&&(j[F]=Q[O])})}}),typeof j.style=="string"&&(j.style=parseStyle(j.style));const q=R.toLowerCase();return q==="option"&&(M=M.props.children),React.createElement(I||q,j,M)})}render(){const n=(this.props.jsx||"").trim().replace(/<!DOCTYPE([^>]*)>/g,"");this.ParsedChildren=un(this,hn).call(this,n);const o=[...new Set(["jsx-parser",...String(this.props.className).split(" ")])].filter(Boolean).join(" ");return this.props.renderInWrapper?React.createElement("div",{className:o},this.ParsedChildren):this.ParsedChildren}}hn=new WeakMap,an=new WeakMap,ir=new WeakMap,ar=new WeakMap,Gn=new WeakMap,Xn=new WeakMap,nn(JsxParser,"displayName","JsxParser"),nn(JsxParser,"defaultProps",{allowUnknownElements:!0,autoCloseVoidElements:!1,bindings:{},blacklistedAttrs:[/^on.+/i],blacklistedTags:["script"],className:"",components:{},componentsOnly:!1,disableFragments:!1,disableKeyGeneration:!1,jsx:"",onError:()=>{},showWarnings:!1,renderError:void 0,renderInWrapper:!0,renderUnrecognized:()=>null});var source_default=JsxParser;const CountryFlag=({countryCode:t,className:e=""})=>{const[n,o]=React.useState(null),[l,d]=React.useState(!1);return React.useEffect(()=>{if(!t)return;const g=`https://purecatamphetamine.github.io/country-flag-icons/3x2/${t.toUpperCase()}.svg`;fetch(g,{method:"HEAD"}).then(b=>{b.ok?(o(g),d(!1)):d(!0)}).catch(()=>{d(!0)})},[t]),l||!n?jsxRuntime.jsx("span",{className:e,children:t}):jsxRuntime.jsx("img",{src:n,alt:`${t} flag`,className:`inline-block ${e}`,style:{width:"24px",height:"auto"}})};function ProductCard({applicationId:t,product:e,viewProductLink:n,defaultOpportunityNumber:o="",onAddToCart:l,addingToCart:d=!1,shopifyHostname:f,customAction:g=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){var it,He,Rt,Qe,pt,Mt,$t,Ut,Ft,Ke,rt,ot;const b=React.useRef(null),S=useIntersectionObserver({elementRef:b,threshold:.1,rootMargin:"100px",freezeOnceVisible:!0}),_=reactRouterDom.useNavigate(),{toast:R}=useToast(),[C,E]=React.useState(1),[A,M]=React.useState(null),[I,j]=React.useState(0),[q,z]=React.useState(!1),[Q,O]=React.useState(!1),[F,te]=React.useState(!1),[ne]=usePutV4ResellerByRouteResellerIdProductAndRandmarSkuRequisitionMutation(),[se,ge]=React.useState(!1),[oe]=usePostV4ResellerByRouteResellerIdProductAndRandmarSkuShopifyMutation(),{data:Ae,isLoading:je,isFetching:Ne}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t},{skip:!t||!S}),$e=((it=e==null?void 0:e.Distribution)==null?void 0:it.Cost)||0,Le=((He=e==null?void 0:e.Distribution)==null?void 0:He.RegularPrice)||0,Ue=((Rt=e==null?void 0:e.Distribution)==null?void 0:Rt.Price)||0,Ve=React.useMemo(()=>{var ut;return!((ut=e==null?void 0:e.Distribution)!=null&&ut.Inventory)||e.Distribution.Inventory.length===0?0:e.Distribution.Inventory.reduce((dt,ft)=>dt+(ft.PurchaseOrderQuantity||0),0)},[(Qe=e==null?void 0:e.Distribution)==null?void 0:Qe.Inventory]);React.useEffect(()=>{E(1),M(null),j(0),z(!1)},[e==null?void 0:e.RandmarSKU]),React.useEffect(()=>{var ut;if(e&&o){const dt=(ut=e.Opportunities)==null?void 0:ut.find(ft=>ft.BidNumber==o);dt&&Oe(dt)&&M(dt)}},[e,o]),React.useEffect(()=>{if(!e)return;const ut=A!=null&&A.Price?A.Price:Ue;j(Le>0?Math.round((Le-ut)/Le*100):0)},[e,A,Ue,Le]),React.useEffect(()=>{d||E(1)},[d]);const Oe=ut=>{if(ut.Active!==!0)return!1;const dt=new Date().toISOString().split("T")[0];return!(ut.EndDate&&ut.EndDate.split("T")[0]<dt||ut.StartDate&&ut.StartDate.split("T")[0]>dt)};if(!e||je||Ne)return jsxRuntime.jsx(Card,{children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx("div",{className:"h-10 w-24 flex items-center justify-end ml-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"})})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-28 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx("div",{className:"w-60 h-40",children:jsxRuntime.jsx(Skeleton,{className:"w-full h-full rounded-lg"})})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24 mb-3"}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-full rounded-md"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-32 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 mt-4"})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-start gap-1 mb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-10 flex-1 rounded-md"})]})]})]})});const qe=(e==null?void 0:e.Opportunities)||[],Ge=qe.length>0,ze=()=>{if(C==null){E(1);return}C>1&&E(C-1)},Ye=()=>{if(C==null){E(1);return}E(C+1)},Ze=ut=>{const dt=Number.parseInt(ut.target.value,10);if(!isNaN(dt)&&dt>0){E(dt);return}E(void 0)},Je=()=>{(C==null||C<1)&&E(1)},tt=()=>{Q||!(Ae!=null&&Ae.IsReseller)||(O(!0),ne({routeResellerId:Ae.ApplicationId??"",randmarSku:e.RandmarSKU??""}).then(ut=>{ut.error||ut.data===!1?R({title:"Error",description:"Error submitting your qualification. Please reach out to Randmar.",variant:"destructive"}):R({title:"Success",description:"Qualification successfully submitted.",variant:"success"}),te(!1)}).catch(ut=>{console.error(ut),R({title:"Error",description:"Error submitting your qualification.",variant:"destructive"})}).finally(()=>{O(!1)}))},Xe=((Mt=(pt=e.Distribution)==null?void 0:pt.Inventory)==null?void 0:Mt.reduce((ut,dt)=>ut+(dt.AvailableQuantity||0),0))||0,at=ut=>{try{return new Date(ut).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch(dt){return console.error(dt),ut.split("T")[0]||"N/A"}},et=()=>{typeof l<"u"&&l({quantity:C??1,bidNumber:(A==null?void 0:A.BidNumber)??null})},st=()=>{se||!f||(ge(!0),oe({routeResellerId:t??"",randmarSku:e.RandmarSKU??"",shopifyHostName:f}).then(ut=>{if(ut.error){console.error("Error syncing to Shopify:",ut.error),R({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"});return}R({title:"Product synced",description:"Product synced to Shopify successfully",variant:"success"})}).catch(ut=>{console.error("Error syncing to Shopify:",ut),R({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"})}).finally(()=>{ge(!1)}))};return jsxRuntime.jsx(Card,{className:"w-full hover:shadow-lg transition-shadow @container",ref:b,children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-3",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-xl",children:e.Title||e.RandmarTitle}),jsxRuntime.jsx("div",{className:"w-24 h-10 flex items-center justify-end ml-4 flex-shrink-0",children:jsxRuntime.jsx(PartnerLogo,{id:e.ManufacturerId,name:e.ManufacturerName,width:96,height:40},`partner_logo_${e.ManufacturerId}`)})]}),jsxRuntime.jsxs("div",{className:"flex flex-col @[36rem]:flex-row gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-1 @[36rem]:order-1 order-2 flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 items-center justify-center @[36rem]:items-start @[36rem]:justify-start",children:[e.State&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.State==="Active"?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Check,{size:"12",className:"mr-1.5"})," ",e.State]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.SerialNumber?"bg-green-50 text-green-700 hover:bg-green-50":"bg-yellow-50 text-yellow-700 hover:bg-yellow-50"}`,children:[jsxRuntime.jsx(QrCode,{size:"12",className:"mr-1.5"})," ",e.SerialNumber?"Serialized":"Unserialized"]}),e.TransparencyCode&&jsxRuntime.jsxs(Badge,{variant:"outline",className:"rounded-full px-3 bg-green-50 text-green-700 hover:bg-green-50",children:[jsxRuntime.jsx(CircleDashed,{size:"12",className:"mr-1.5"})," Transparency Code"]}),e.AvailableToBuy!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.AvailableToBuy?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(ShoppingCart,{size:"12",className:"mr-1.5"})," ",e.AvailableToBuy?"Available":"Unavailable"]}),e.ManufacturerCategory!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${($t=e.ManufacturerCategory)!=null&&$t.QualificationRequired?"bg-blue-50 text-blue-700 hover:bg-blue-50":"bg-neutral-50 text-neutral-700 hover:bg-neutral-50"}`,children:[jsxRuntime.jsx(ShieldCheck,{size:"12",className:"mr-1.5"})," ",(Ut=e.ManufacturerCategory)!=null&&Ut.QualificationRequired?"Qualified Only":"Available to all"]}),e.ManufacturerId&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.AutoUpdate?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(RefreshCw,{size:"12",className:"mr-1.5"})," ",e.AutoUpdate?`Automatic Reorder (${e.MasterCarton})`:"Manually Reorders"]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.BodyHTML&&e.Title&&e.MAP?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Store,{size:"12",className:"mr-1.5"})," ",e.BodyHTML&&e.Title&&e.MAP?"Shopify Ready":"Not Shopify Ready"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"MPN"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.MPN||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"UPC"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.UPC||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Unit Weight"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.UnitWeight?`${formatNumber(e.UnitWeight)} lbs`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"text-sm text-muted-foreground",children:["MAP",jsxRuntime.jsx("span",{className:"text-primary",children:" / "}),"MSRP"]}),jsxRuntime.jsxs("div",{className:"font-medium",children:[e.MAP?formatMoney(e.MAP):"N/A",jsxRuntime.jsx("span",{className:"text-primary",children:" / "}),e.MSRP?formatMoney(e.MSRP):"N/A"]})]}),!!e.OverallPercentileRank&&!!e.ManufacturerPercentileRank&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Percentile"}),jsxRuntime.jsxs("div",{className:`font-medium flex items-center ${e.OverallPercentileRank>=80?"text-green-700":""}`,children:[formatNumber(Math.round(e.OverallPercentileRank))," Overall"]}),jsxRuntime.jsxs("div",{className:"font-light flex items-center text-sm",children:[formatNumber(Math.round(e.ManufacturerPercentileRank))," with Manufacturer"]})]}),e.CountryCodeOfOrigin&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Origin"}),jsxRuntime.jsxs("div",{className:"font-medium flex items-center",children:[jsxRuntime.jsx(CountryFlag,{countryCode:e.CountryCodeOfOrigin,className:"mr-2"}),e.CountryCodeOfOrigin]})]})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col @[36rem]:order-2 order-1 items-center",children:jsxRuntime.jsx(ProductImage,{randmarSKU:e.RandmarSKU||"",alt:e.RandmarTitle||""},`product_image_${e.RandmarSKU}`)})]}),jsxRuntime.jsxs("div",{className:"flex flex-col @[36rem]:flex-row gap-6 mt-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-row @[36rem]:flex-col gap-4 justify-center @[36rem]:justify-start @[36rem]:order-2 order-1",children:[n&&jsxRuntime.jsx(reactRouterDom.Link,{to:n,children:jsxRuntime.jsxs(Button,{variant:"secondary",children:[jsxRuntime.jsx(Eye,{className:"mr-2"}),"View Product"]})}),((Ft=e.Distribution)==null?void 0:Ft.Inventory)&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:Ae!=null&&Ae.IsReseller&&Xe<=0&&Ve<=0?jsxRuntime.jsxs(Dialog,{open:F,onOpenChange:te,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:"flex items-center text-sm reseller-theme text-primary",children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),"Request to stock"]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-md",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Request to stock"})}),jsxRuntime.jsx("p",{className:"py-4",children:"Are you sure you want to request this product to be stocked?"}),jsxRuntime.jsxs("div",{className:"flex justify-end gap-2",children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>te(!1),disabled:Q,children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:tt,disabled:Q,children:Q?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin mr-2"}),"Requesting..."]}):"Confirm"})]})]})]}):Xe<=0&&Ve>0?jsxRuntime.jsxs(Dialog,{open:q,onOpenChange:z,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:"flex items-center text-sm manufacturer-theme text-primary",children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),formatNumber(Ve)," Incoming"]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-4xl",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{className:"flex items-center",children:[jsxRuntime.jsx(Warehouse,{className:"mr-2",size:18}),"Inventory Information"]})}),jsxRuntime.jsx(ProductInventoryGrid,{inventory:e.Distribution.Inventory})]})]}):jsxRuntime.jsxs(Dialog,{open:q,onOpenChange:z,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:`flex items-center text-sm ${Xe>0?"text-green-700":"text-red-700"}`,children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),Xe>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[formatNumber(Xe)," in stock"]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Out of stock"})]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-4xl",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{className:"flex items-center",children:[jsxRuntime.jsx(Warehouse,{className:"mr-2",size:18}),"Inventory Information"]})}),jsxRuntime.jsx(ProductInventoryGrid,{inventory:e.Distribution.Inventory})]})]})})]}),jsxRuntime.jsx("div",{className:"flex flex-1 @[36rem]:order-1 order-2",children:Ge&&e.Distribution&&jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx("div",{className:"flex items-center",children:"You have "+qe.length+(qe.length>1?" opportunities":" opportunity")+" for this product:"}),jsxRuntime.jsx(TooltipProvider,{children:jsxRuntime.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto p-2 mt-1",children:qe.map((ut,dt)=>Oe(ut)?jsxRuntime.jsxs("div",{className:`flex justify-between items-center rounded-lg transition-colors py-2 px-4 border border-muted cursor-pointer ${ut.BidNumber==(A==null?void 0:A.BidNumber)?"bg-purple-100 border-2 border-purple-900":"bg-white border-1 border-purple-600 hover:bg-purple-200"}`,onClick:()=>{M(ut.BidNumber!==(A==null?void 0:A.BidNumber)?ut:null)},children:[jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"font-medium text-sm",children:ut.Opportunity}),jsxRuntime.jsx("span",{className:"text-xs text-neutral-900",children:ut.BidNumber})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsx("span",{className:"font-semibold",children:formatMoney(ut.Price??0)}),ut.Rebate&&ut.Rebate>0&&jsxRuntime.jsxs("span",{className:"text-xs text-green-600",children:["Rebate: ",formatMoney(ut.Rebate)]}),ut.EndDate&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral-600",children:["Ends: ",at(ut.EndDate)]})]})]},dt):jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxs("div",{className:"flex justify-between items-center rounded-lg transition-colors py-2 px-4 bg-purple-100 border border-muted cursor-pointer !bg-neutral-50 hover:bg-neutral-100",onClick:()=>{ut.BidNumber&&_(`/${t}/Opportunity/${ut.ManufacturerId}/${ut.BidNumber}`)},children:[jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"font-medium text-sm",children:ut.Opportunity}),jsxRuntime.jsxs("span",{className:"text-xs text-neutral-900",children:[ut.BidNumber," ",jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs mx-1 h-5 bg-gray-100",children:"Currently unavailable"})]})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsx("span",{className:"font-semibold",children:formatMoney(ut.Price??0)}),ut.Rebate&&ut.Rebate>0&&jsxRuntime.jsxs("span",{className:"text-xs text-green-600",children:["Rebate: ",formatMoney(ut.Rebate)]}),ut.EndDate&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral-600",children:["Ends: ",at(ut.EndDate)]})]})]})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsx("p",{children:"View Opportunity"})})]},dt))})})]})})]}),e.Distribution&&jsxRuntime.jsxs("div",{className:"flex flex-row flex-wrap justify-between items-end mt-4 gap-4",children:[jsxRuntime.jsx("div",{className:"flex-shrink-1 flex flex-col gap-1",children:$e>0?jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:["Cost: ",formatMoney($e)]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center flex-wrap",children:[jsxRuntime.jsx("span",{className:"text-2xl font-bold whitespace-nowrap",children:formatMoney((A?(rt=(Ke=e.Opportunities)==null?void 0:Ke.find(ut=>ut.BidNumber==A.BidNumber))==null?void 0:rt.Price:Ue)??0)}),I>0&&jsxRuntime.jsx("span",{className:"text-muted-foreground line-through ml-2 whitespace-nowrap",children:formatMoney(Le)})]}),I>0&&jsxRuntime.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxs(Badge,{variant:"outline",className:"bg-red-50 text-red-700 rounded-full px-3 whitespace-nowrap",children:[jsxRuntime.jsxs("span",{children:[I,"% OFF"]}),((ot=e.InstantRebate)==null?void 0:ot.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",e.InstantRebate.EndDate.split("T")[0]]}),(A==null?void 0:A.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",A.EndDate.split("T")[0]]})]})})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center @[36rem]:justify-end items-end gap-2 w-full",children:[f&&jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap bg-green-600 hover:bg-green-700",onClick:st,disabled:se,children:se?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Sync to Shopify"]})}),g,typeof l<"u"&&jsxRuntime.jsxs("div",{className:"flex gap-2 whitespace-nowrap",children:[jsxRuntime.jsxs("div",{className:"flex items-center border rounded-md",children:[jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-r-none",onClick:ze,disabled:typeof C<"u"&&(C<=1||!e.AvailableToBuy||d),children:"-"}),jsxRuntime.jsx("input",{value:C,onChange:Ze,onBlur:Je,onClick:ut=>ut.currentTarget.select(),className:`w-6 @[36rem]:w-12 text-center border-0 focus:ring-0 focus:outline-none ${!e.AvailableToBuy||d?"text-gray-400":""}`,disabled:!e.AvailableToBuy||d}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-l-none",onClick:Ye,disabled:!e.AvailableToBuy||d,children:"+"})]}),jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap",onClick:et,disabled:!e.AvailableToBuy||d,children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Adding..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Add to Cart"]})})]})]})]})]})})}const complexComponents=[`----
|
|
1195
1195
|
PartnerCard: For data that fits this shape:
|
|
1196
1196
|
{ "ApplicationId": "19022", "PublicName": "BiOSS", "VoiceName": null, "VoiceStyle": null, "About": "example", "SceneName": "Kitchen Counter", "IsReseller": true, "IsManufacturer": true, "IsSalesAgency": false, "Socials": [ { "ApplicationId": "19022", "SocialNetwork": "Facebook", "Tag": "@bioss.ca" }, { "ApplicationId": "19022", "SocialNetwork": "Instagram", "Tag": "@bioss.ca" }, { "ApplicationId": "19022", "SocialNetwork": "LinkedIn", "Tag": "@biossinc" }, { "ApplicationId": "19022", "SocialNetwork": "Youtube", "Tag": "@biosssolutionssanitairessa4095" } ], "Manufacturer": null, "Reseller": null }
|
|
1197
1197
|
Use <PartnerCard account={data} action={<></>}>`,`----
|
|
@@ -1410,4 +1410,4 @@ img.ProseMirror-separator {
|
|
|
1410
1410
|
\`\`\`json
|
|
1411
1411
|
${JSON.stringify(e,null,2)}
|
|
1412
1412
|
\`\`\`
|
|
1413
|
-
`:"",[t,e]);return n?jsxRuntime.jsx("div",{className:"flex w-full justify-center items-center py-24",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t&&e.length===0?jsxRuntime.jsx("div",{className:"flex w-full justify-center items-start pt-16",children:jsxRuntime.jsx(Card,{className:"w-full max-w-lg",children:jsxRuntime.jsxs(CardHeader,{className:"text-center items-center",children:[jsxRuntime.jsx("div",{className:"rounded-full border bg-muted p-3 mb-4",children:jsxRuntime.jsx(SearchX,{className:"h-8 w-8 text-muted-foreground"})}),jsxRuntime.jsx(CardTitle,{children:"No Results Found"}),jsxRuntime.jsxs(CardDescription,{children:['Your search for "',t,'" did not return any results. Please try a different search term.']})]})})}):e.length>0?jsxRuntime.jsxs("div",{className:"grid grid-cols-
|
|
1413
|
+
`:"",[t,e]);return n?jsxRuntime.jsx("div",{className:"flex w-full justify-center items-center py-24",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t&&e.length===0?jsxRuntime.jsx("div",{className:"flex w-full justify-center items-start pt-16",children:jsxRuntime.jsx(Card,{className:"w-full max-w-lg",children:jsxRuntime.jsxs(CardHeader,{className:"text-center items-center",children:[jsxRuntime.jsx("div",{className:"rounded-full border bg-muted p-3 mb-4",children:jsxRuntime.jsx(SearchX,{className:"h-8 w-8 text-muted-foreground"})}),jsxRuntime.jsx(CardTitle,{children:"No Results Found"}),jsxRuntime.jsxs(CardDescription,{children:['Your search for "',t,'" did not return any results. Please try a different search term.']})]})})}):e.length>0?jsxRuntime.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[jsxRuntime.jsx("div",{className:"col-span-3 xl:col-span-2",children:o}),jsxRuntime.jsx("aside",{className:"col-span-1 block bg-white rounded-xl collapse xl:visible",children:jsxRuntime.jsx("div",{className:"sticky top-16",children:jsxRuntime.jsx("div",{className:"p-6",children:jsxRuntime.jsx(AssistantInsight,{prompt:l,thinkingPlaceholderText:"Analyzing search results...",withCard:!1})})})})]}):null},colClasses={base:{1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6"},sm:{1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},md:{1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6"},lg:{1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6"},xl:{1:"xl:grid-cols-1",2:"xl:grid-cols-2",3:"xl:grid-cols-3",4:"xl:grid-cols-4",5:"xl:grid-cols-5",6:"xl:grid-cols-6"}},buildGridClassName=t=>{const e={base:1,md:2,...t};return["grid","gap-4",e.base?colClasses.base[e.base]:"",e.sm?colClasses.sm[e.sm]:"",e.md?colClasses.md[e.md]:"",e.lg?colClasses.lg[e.lg]:"",e.xl?colClasses.xl[e.xl]:""].filter(Boolean).join(" ")},SearchPageGrid=({results:t,groupBy:e,renderItem:n})=>{const o=e(t);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Object.entries(o).map(([l,d])=>{const{items:f,gridCols:g}=d;if(f.length===0)return null;const b=buildGridClassName(g);return jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("h2",{className:"text-xl font-semibold tracking-tight mb-4",children:l}),jsxRuntime.jsx("div",{className:b,children:f.map((S,_)=>n(S,_))})]},l)})})};exports.ActiveOrdersCard=ActiveOrdersCard,exports.AiGeneratedContent=AiGeneratedContent,exports.Alert=Alert,exports.AlertDescription=AlertDescription,exports.AlertDialog=AlertDialog,exports.AlertDialogAction=AlertDialogAction,exports.AlertDialogCancel=AlertDialogCancel,exports.AlertDialogContent=AlertDialogContent,exports.AlertDialogDescription=AlertDialogDescription,exports.AlertDialogFooter=AlertDialogFooter,exports.AlertDialogHeader=AlertDialogHeader,exports.AlertDialogTitle=AlertDialogTitle,exports.AlertDialogTrigger=AlertDialogTrigger,exports.AlertTitle=AlertTitle,exports.AreaChart=AreaChart,exports.AssistantChat=AssistantChat,exports.AssistantInsight=AssistantInsight,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.ChatProvider=ChatProvider,exports.Checkbox=Checkbox,exports.Command=Command,exports.CommandDialog=CommandDialog,exports.CommandEmpty=CommandEmpty,exports.CommandGroup=CommandGroup,exports.CommandInput=CommandInput,exports.CommandItem=CommandItem,exports.CommandList=CommandList,exports.CommandSeparator=CommandSeparator,exports.CommandShortcut=CommandShortcut,exports.CountryFlag=CountryFlag,exports.DataTable=DataTable,exports.Dialog=Dialog,exports.DialogClose=DialogClose,exports.DialogContent=DialogContent,exports.DialogDescription=DialogDescription,exports.DialogFooter=DialogFooter,exports.DialogHeader=DialogHeader,exports.DialogOverlay=DialogOverlay,exports.DialogPortal=DialogPortal,exports.DialogTitle=DialogTitle,exports.DialogTrigger=DialogTrigger,exports.DropdownMenu=DropdownMenu,exports.DropdownMenuCheckboxItem=DropdownMenuCheckboxItem,exports.DropdownMenuContent=DropdownMenuContent,exports.DropdownMenuGroup=DropdownMenuGroup,exports.DropdownMenuItem=DropdownMenuItem,exports.DropdownMenuLabel=DropdownMenuLabel,exports.DropdownMenuPortal=DropdownMenuPortal,exports.DropdownMenuRadioGroup=DropdownMenuRadioGroup,exports.DropdownMenuRadioItem=DropdownMenuRadioItem,exports.DropdownMenuSeparator=DropdownMenuSeparator,exports.DropdownMenuShortcut=DropdownMenuShortcut,exports.DropdownMenuSub=DropdownMenuSub,exports.DropdownMenuSubContent=DropdownMenuSubContent,exports.DropdownMenuSubTrigger=DropdownMenuSubTrigger,exports.DropdownMenuTrigger=DropdownMenuTrigger,exports.ExploreManufacturers=ExploreManufacturers,exports.ExternalProductCard=ExternalProductCard,exports.GeminiApiKeyProvider=GeminiApiKeyProvider,exports.GeneralDocumentCard=GeneralDocumentCard,exports.Input=Input,exports.InputOTP=InputOTP,exports.InputOTPGroup=InputOTPGroup,exports.InputOTPSeparator=InputOTPSeparator,exports.InputOTPSlot=InputOTPSlot,exports.Label=Label$2,exports.Layout=Layout,exports.ManufacturerCard=ManufacturerCard,exports.ManufacturerGetStartedButton=ManufacturerGetStartedButton,exports.ManufacturerOverviewPage=ManufacturerOverviewPage,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.MultiSelect=MultiSelect,exports.Navbar=Navbar,exports.OpportunitiesTable=OpportunitiesTable,exports.PageHeader=PageHeader,exports.PartnerCard=PartnerCard,exports.PartnerRelationshipPage=PartnerRelationshipPage,exports.Popover=Popover,exports.PopoverAnchor=PopoverAnchor,exports.PopoverContent=PopoverContent,exports.PopoverTrigger=PopoverTrigger,exports.Preloader=Preloader,exports.ProductCard=ProductCard,exports.ProductImage=ProductImage,exports.ProductInventoryGrid=ProductInventoryGrid,exports.ProductOverviewPage=ProductOverviewPage,exports.Progress=Progress,exports.RadioGroup=RadioGroup$1,exports.RadioGroupItem=RadioGroupItem,exports.ResellerBillingOverviewCard=ResellerBillingOverviewCard,exports.ResellerCard=ResellerCard,exports.ResellerOverview=ResellerOverview,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.ReturnsTable=ReturnsTable,exports.RichTextEditor=RichTextEditor,exports.SalesChart=SalesChart,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.SearchPage=SearchPage,exports.SearchPageGrid=SearchPageGrid,exports.Select=Select,exports.SelectContent=SelectContent,exports.SelectGroup=SelectGroup,exports.SelectItem=SelectItem,exports.SelectLabel=SelectLabel,exports.SelectScrollDownButton=SelectScrollDownButton,exports.SelectScrollUpButton=SelectScrollUpButton,exports.SelectTrigger=SelectTrigger,exports.SelectValue=SelectValue,exports.Separator=Separator$1,exports.Sheet=Sheet,exports.SheetClose=SheetClose,exports.SheetContent=SheetContent,exports.SheetDescription=SheetDescription,exports.SheetFooter=SheetFooter,exports.SheetHeader=SheetHeader,exports.SheetOverlay=SheetOverlay,exports.SheetPortal=SheetPortal,exports.SheetTitle=SheetTitle,exports.SheetTrigger=SheetTrigger,exports.Sidebar=Sidebar,exports.SidebarContent=SidebarContent,exports.SidebarFooter=SidebarFooter,exports.SidebarGroup=SidebarGroup,exports.SidebarGroupAction=SidebarGroupAction,exports.SidebarGroupContent=SidebarGroupContent,exports.SidebarGroupLabel=SidebarGroupLabel,exports.SidebarHeader=SidebarHeader,exports.SidebarInput=SidebarInput,exports.SidebarInset=SidebarInset,exports.SidebarMenu=SidebarMenu,exports.SidebarMenuAction=SidebarMenuAction,exports.SidebarMenuBadge=SidebarMenuBadge,exports.SidebarMenuButton=SidebarMenuButton,exports.SidebarMenuItem=SidebarMenuItem,exports.SidebarMenuSkeleton=SidebarMenuSkeleton,exports.SidebarMenuSub=SidebarMenuSub,exports.SidebarMenuSubButton=SidebarMenuSubButton,exports.SidebarMenuSubItem=SidebarMenuSubItem,exports.SidebarProvider=SidebarProvider,exports.SidebarRail=SidebarRail,exports.SidebarSeparator=SidebarSeparator,exports.SidebarTrigger=SidebarTrigger,exports.Skeleton=Skeleton,exports.Switch=Switch,exports.Table=Table,exports.TableBody=TableBody,exports.TableCaption=TableCaption,exports.TableCell=TableCell,exports.TableFooter=TableFooter,exports.TableHead=TableHead,exports.TableHeader=TableHeader,exports.TableRow=TableRow,exports.Tabs=Tabs,exports.TabsContent=TabsContent,exports.TabsList=TabsList,exports.TabsTrigger=TabsTrigger,exports.Textarea=Textarea,exports.Toast=Toast,exports.ToastAction=ToastAction,exports.ToastClose=ToastClose,exports.ToastDescription=ToastDescription,exports.ToastProvider=ToastProvider,exports.ToastTitle=ToastTitle,exports.ToastViewport=ToastViewport,exports.Toaster=Toaster,exports.Tooltip=Tooltip$1,exports.TooltipContent=TooltipContent,exports.TooltipProvider=TooltipProvider,exports.TooltipTrigger=TooltipTrigger,exports.TopPercentTreemap=TopPercentTreemap,exports.Topbar=Topbar,exports.Treemap=Treemap,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.formatMoney=formatMoney,exports.formatNumber=formatNumber,exports.formatYYYYMMDDIntToDateString=formatYYYYMMDDIntToDateString,exports.toast=toast,exports.useChat=useChat,exports.useGeminiApiKey=useGeminiApiKey,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|