randmarcomps 1.646.0 → 1.650.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.cjs +12 -12
- package/dist/randmarcomps.d.ts +39 -39
- package/dist/randmarcomps.js +242 -248
- package/package.json +1 -1
package/dist/randmarcomps.js
CHANGED
|
@@ -491,8 +491,8 @@ const le = P.forwardRef(
|
|
|
491
491
|
const y = x.replace(/[^a-zA-Z0-9]/g, "").toUpperCase();
|
|
492
492
|
let C = "";
|
|
493
493
|
for (let S = 0; S < Math.min(y.length, 6); S++) {
|
|
494
|
-
const
|
|
495
|
-
S === 0 || S === 2 || S === 4 ? /[A-Z]/.test(
|
|
494
|
+
const D = y[S];
|
|
495
|
+
S === 0 || S === 2 || S === 4 ? /[A-Z]/.test(D) && (C += D) : (S === 1 || S === 3 || S === 5) && /[0-9]/.test(D) && (C += D);
|
|
496
496
|
}
|
|
497
497
|
C.length <= 3 ? b = C : b = `${C.slice(0, 3)} ${C.slice(3, 6)}`;
|
|
498
498
|
} else if (n === "zip-code-us") {
|
|
@@ -774,8 +774,8 @@ function Hc(t) {
|
|
|
774
774
|
] }) }) });
|
|
775
775
|
}
|
|
776
776
|
function Ts({ inventory: t, showBinLocation: r, className: n }) {
|
|
777
|
-
const s = (y, C, S = !1,
|
|
778
|
-
const k = y.WarehouseType === "Fulfillment Center",
|
|
777
|
+
const s = (y, C, S = !1, D = !0) => {
|
|
778
|
+
const k = y.WarehouseType === "Fulfillment Center", I = k ? "bg-background" : "bg-background/70 text-muted-foreground", L = D && C > 0 ? "border-t" : "", M = S ? "border-r" : "", A = y.Status ?? "Unknown", $ = A === "Active";
|
|
779
779
|
let q = "bg-secondary text-secondary-foreground ring-1 ring-border";
|
|
780
780
|
switch (y.WarehouseType) {
|
|
781
781
|
case "Fulfillment Center":
|
|
@@ -803,7 +803,7 @@ function Ts({ inventory: t, showBinLocation: r, className: n }) {
|
|
|
803
803
|
"article",
|
|
804
804
|
{
|
|
805
805
|
"aria-labelledby": `wh-${y.WarehouseId}-name`,
|
|
806
|
-
className: `p-3 text-sm ${L} ${M} ${
|
|
806
|
+
className: `p-3 text-sm ${L} ${M} ${I}`,
|
|
807
807
|
children: [
|
|
808
808
|
/* @__PURE__ */ a("div", { className: "flex items-start justify-between", children: [
|
|
809
809
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-3", children: [
|
|
@@ -1118,17 +1118,17 @@ const td = "sidebar:state", ad = 3600 * 24 * 7, rd = "16rem", nd = "3rem", sd =
|
|
|
1118
1118
|
...h
|
|
1119
1119
|
}, d) => {
|
|
1120
1120
|
const c = ed(), m = n ?? c, [p, g] = P.useState(r), [N, w] = P.useState(t), x = s ?? N, b = P.useCallback(
|
|
1121
|
-
(
|
|
1122
|
-
const k = typeof
|
|
1121
|
+
(D) => {
|
|
1122
|
+
const k = typeof D == "function" ? D(x) : D;
|
|
1123
1123
|
i ? i(k) : w(k), document.cookie = `${td}=${k}; path=/; max-age=${ad}`;
|
|
1124
1124
|
},
|
|
1125
1125
|
[i, x]
|
|
1126
|
-
), y = P.useCallback(() => m ? g((
|
|
1126
|
+
), y = P.useCallback(() => m ? g((D) => !D) : b((D) => !D), [m, b, g]);
|
|
1127
1127
|
P.useEffect(() => {
|
|
1128
|
-
const
|
|
1128
|
+
const D = (k) => {
|
|
1129
1129
|
k.key === sd && (k.metaKey || k.ctrlKey) && (k.preventDefault(), y());
|
|
1130
1130
|
};
|
|
1131
|
-
return window.addEventListener("keydown",
|
|
1131
|
+
return window.addEventListener("keydown", D), () => window.removeEventListener("keydown", D);
|
|
1132
1132
|
}, [y]);
|
|
1133
1133
|
const C = x ? "expanded" : "collapsed", S = P.useMemo(
|
|
1134
1134
|
() => ({
|
|
@@ -1822,9 +1822,9 @@ function Pf({ appID: t, manufPath: r, withBot: n }) {
|
|
|
1822
1822
|
M.has(q) || M.set(q, $);
|
|
1823
1823
|
}
|
|
1824
1824
|
return Array.from(M.entries()).map(([A, $]) => ({ key: A, label: $ })).sort((A, $) => A.label.localeCompare($.label, void 0, { sensitivity: "base" }));
|
|
1825
|
-
}, [h]), S = d.trim().length > 0 || m.length > 0 || g !== "az" || w || b,
|
|
1825
|
+
}, [h]), S = d.trim().length > 0 || m.length > 0 || g !== "az" || w || b, D = ae(() => {
|
|
1826
1826
|
c(""), p([]), N("az"), x(!1), y(!1);
|
|
1827
|
-
}, []), { sendMessage: k } = Na(),
|
|
1827
|
+
}, []), { sendMessage: k } = Na(), I = ae(
|
|
1828
1828
|
(M) => {
|
|
1829
1829
|
const A = M?.trim().length > 0 ? M.trim() : "this manufacturer";
|
|
1830
1830
|
k(`Search for ${A} and tell me more about this manufacturer.`);
|
|
@@ -1861,7 +1861,7 @@ function Pf({ appID: t, manufPath: r, withBot: n }) {
|
|
|
1861
1861
|
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
1862
1862
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-3", children: [
|
|
1863
1863
|
/* @__PURE__ */ e("p", { id: "manufacturer-categories-label", className: "text-sm font-medium leading-none", children: "Categories" }),
|
|
1864
|
-
S && /* @__PURE__ */ e(E, { type: "button", variant: "ghost", size: "sm", className: "h-8 px-2", onClick:
|
|
1864
|
+
S && /* @__PURE__ */ e(E, { type: "button", variant: "ghost", size: "sm", className: "h-8 px-2", onClick: D, children: "Clear filters" })
|
|
1865
1865
|
] }),
|
|
1866
1866
|
/* @__PURE__ */ e(
|
|
1867
1867
|
"div",
|
|
@@ -1964,7 +1964,7 @@ function Pf({ appID: t, manufPath: r, withBot: n }) {
|
|
|
1964
1964
|
variant: "outline",
|
|
1965
1965
|
size: "icon",
|
|
1966
1966
|
"aria-label": `Assistant: ${$ || "manufacturer"}`,
|
|
1967
|
-
onClick: () =>
|
|
1967
|
+
onClick: () => I($),
|
|
1968
1968
|
children: /* @__PURE__ */ e(zt, {})
|
|
1969
1969
|
}
|
|
1970
1970
|
) : void 0,
|
|
@@ -1974,7 +1974,7 @@ function Pf({ appID: t, manufPath: r, withBot: n }) {
|
|
|
1974
1974
|
);
|
|
1975
1975
|
}) }) : /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ a(G, { className: "p-8 text-center space-y-3", children: [
|
|
1976
1976
|
/* @__PURE__ */ e("p", { className: "text-muted-foreground", children: "No manufacturers match your current filters." }),
|
|
1977
|
-
/* @__PURE__ */ e(E, { type: "button", variant: "outline", onClick:
|
|
1977
|
+
/* @__PURE__ */ e(E, { type: "button", variant: "outline", onClick: D, disabled: !S, children: "Reset filters" })
|
|
1978
1978
|
] }) })
|
|
1979
1979
|
] })
|
|
1980
1980
|
] });
|
|
@@ -2433,7 +2433,7 @@ function bu({
|
|
|
2433
2433
|
const [m, p] = T(""), [g, N] = T(null), [w, x] = T(null), b = ye(() => r.filter((z) => {
|
|
2434
2434
|
const _ = t === z.partner1 ? z.partner2 : z.partner1;
|
|
2435
2435
|
return z.name.toLowerCase().includes(m.toLowerCase()) || _.toLocaleLowerCase().includes(m.toLowerCase());
|
|
2436
|
-
}), [t, r, m]), { toast: y } = Ee(), { data: C, isLoading: S } = an(),
|
|
2436
|
+
}), [t, r, m]), { toast: y } = Ee(), { data: C, isLoading: S } = an(), D = C?.Name || C?.EmailAddress || "User", k = C?.Role || "Partner", [I] = vs(), [L] = mo(), [M] = ho(), A = (z) => {
|
|
2437
2437
|
if (!C?.ApplicationId || !C.EmailAddress) {
|
|
2438
2438
|
y({
|
|
2439
2439
|
title: "Not ready",
|
|
@@ -2445,16 +2445,16 @@ function bu({
|
|
|
2445
2445
|
z ? L({ routeApplicationId: C.ApplicationId, emailAddress: C.EmailAddress, notificationType: "PartnerChatNotifications" }) : M({ routeApplicationId: C.ApplicationId, emailAddress: C.EmailAddress, notificationType: "PartnerChatNotifications" });
|
|
2446
2446
|
};
|
|
2447
2447
|
K(() => {
|
|
2448
|
-
g === null &&
|
|
2449
|
-
}, [g,
|
|
2448
|
+
g === null && D && N(D);
|
|
2449
|
+
}, [g, D]), K(() => {
|
|
2450
2450
|
w === null && k && x(k);
|
|
2451
2451
|
}, [w, k]);
|
|
2452
2452
|
const $ = () => {
|
|
2453
|
-
g && g !==
|
|
2453
|
+
g && g !== D && g.trim() !== "" && I({ fieldName: "Name", newValue: g }).unwrap().then(() => {
|
|
2454
2454
|
y({ title: "Success", description: "Name updated successfully" });
|
|
2455
2455
|
});
|
|
2456
2456
|
}, q = () => {
|
|
2457
|
-
w && w !== k && w.trim() !== "" &&
|
|
2457
|
+
w && w !== k && w.trim() !== "" && I({ fieldName: "Role", newValue: w }).unwrap().then(() => {
|
|
2458
2458
|
y({ title: "Success", description: "Role updated successfully" });
|
|
2459
2459
|
});
|
|
2460
2460
|
};
|
|
@@ -2711,8 +2711,8 @@ const vu = Za(function({
|
|
|
2711
2711
|
onCopy: w
|
|
2712
2712
|
}) {
|
|
2713
2713
|
const x = ye(() => ai(r.content), [r.content]), b = x.trim().length > 0, y = ye(() => (r.images ?? []).map((S) => {
|
|
2714
|
-
const
|
|
2715
|
-
return !
|
|
2714
|
+
const D = typeof S?.mimeType == "string" ? S.mimeType.trim() : "", k = typeof S?.base64Data == "string" ? S.base64Data.replace(/\s+/g, "") : "";
|
|
2715
|
+
return !D.startsWith("image/") || k.length === 0 ? null : `data:${D};base64,${k}`;
|
|
2716
2716
|
}).filter((S) => !!S), [r.images]);
|
|
2717
2717
|
return /* @__PURE__ */ e(
|
|
2718
2718
|
"div",
|
|
@@ -2842,8 +2842,8 @@ const vu = Za(function({
|
|
|
2842
2842
|
onCopy: w
|
|
2843
2843
|
}) {
|
|
2844
2844
|
const x = ye(() => ai(r.content), [r.content]), b = x.trim().length > 0, y = ye(() => (r.images ?? []).map((S) => {
|
|
2845
|
-
const
|
|
2846
|
-
return !
|
|
2845
|
+
const D = typeof S?.mimeType == "string" ? S.mimeType.trim() : "", k = typeof S?.base64Data == "string" ? S.base64Data.replace(/\s+/g, "") : "";
|
|
2846
|
+
return !D.startsWith("image/") || k.length === 0 ? null : `data:${D};base64,${k}`;
|
|
2847
2847
|
}).filter((S) => !!S), [r.images]);
|
|
2848
2848
|
return /* @__PURE__ */ e("div", { className: v("flex items-start gap-2 mt-2 mb-2", n && "flex-row-reverse"), children: /* @__PURE__ */ a("div", { className: v("flex flex-col", h ? "w-full max-w-none" : "max-w-[70%]"), children: [
|
|
2849
2849
|
!s && !!r.senderName?.trim() && /* @__PURE__ */ e("p", { className: v("mb-1 flex", n && "flex-row-reverse"), children: r.senderName }),
|
|
@@ -2952,42 +2952,42 @@ const vu = Za(function({
|
|
|
2952
2952
|
K(() => () => {
|
|
2953
2953
|
b.current != null && window.clearTimeout(b.current);
|
|
2954
2954
|
}, []);
|
|
2955
|
-
const y = ae(async (
|
|
2956
|
-
await yu(L) && (x(
|
|
2955
|
+
const y = ae(async (I, L) => {
|
|
2956
|
+
await yu(L) && (x(I), b.current != null && window.clearTimeout(b.current), b.current = window.setTimeout(() => x(null), 2e3));
|
|
2957
2957
|
}, []), C = ye(() => {
|
|
2958
|
-
const
|
|
2958
|
+
const I = /* @__PURE__ */ new Set();
|
|
2959
2959
|
let L = null;
|
|
2960
2960
|
for (const M of r) {
|
|
2961
2961
|
const A = (M.senderName ?? "").trim();
|
|
2962
|
-
A && (L === A ?
|
|
2962
|
+
A && (L === A ? I.add(M.id) : L = A);
|
|
2963
2963
|
}
|
|
2964
|
-
return
|
|
2965
|
-
}, [r]), S = l ?? (i ? "assistant" : "dashboard"),
|
|
2964
|
+
return I;
|
|
2965
|
+
}, [r]), S = l ?? (i ? "assistant" : "dashboard"), D = S === "assistant" ? wu : vu, k = S === "assistant" ? Nu : xu;
|
|
2966
2966
|
return /* @__PURE__ */ a("div", { className: S === "dashboard" ? "py-3" : "", children: [
|
|
2967
|
-
r.map((
|
|
2968
|
-
const L =
|
|
2967
|
+
r.map((I) => {
|
|
2968
|
+
const L = I.fromPartnerID === n, M = !!(u && i && L && m && g && p), A = !!(u && i && L && N), $ = !!(i && !L && (I.content ?? "").trim().length > 0), q = h === I.id;
|
|
2969
2969
|
return /* @__PURE__ */ e(
|
|
2970
|
-
|
|
2970
|
+
D,
|
|
2971
2971
|
{
|
|
2972
|
-
message:
|
|
2972
|
+
message: I,
|
|
2973
2973
|
isCurrentUser: L,
|
|
2974
|
-
hideSenderName: o || C.has(
|
|
2974
|
+
hideSenderName: o || C.has(I.id),
|
|
2975
2975
|
canEdit: M,
|
|
2976
2976
|
canRetry: A,
|
|
2977
2977
|
canCopy: $,
|
|
2978
|
-
isCopied: w ===
|
|
2978
|
+
isCopied: w === I.id,
|
|
2979
2979
|
isEditing: q,
|
|
2980
2980
|
editValue: q ? d : "",
|
|
2981
2981
|
onEditValueChange: c,
|
|
2982
|
-
onStartEdit: () => m?.(
|
|
2982
|
+
onStartEdit: () => m?.(I),
|
|
2983
2983
|
onCancelEdit: () => p?.(),
|
|
2984
|
-
onSaveEdit: () => g?.(
|
|
2985
|
-
onRetry: () => N?.(
|
|
2984
|
+
onSaveEdit: () => g?.(I.id, d),
|
|
2985
|
+
onRetry: () => N?.(I),
|
|
2986
2986
|
onCopy: () => {
|
|
2987
|
-
y(
|
|
2987
|
+
y(I.id, I.content);
|
|
2988
2988
|
}
|
|
2989
2989
|
},
|
|
2990
|
-
|
|
2990
|
+
I.id
|
|
2991
2991
|
);
|
|
2992
2992
|
}),
|
|
2993
2993
|
s !== "" && /* @__PURE__ */ e(k, { botStatus: s }),
|
|
@@ -3208,7 +3208,7 @@ const ku = ({ appID: t, activeChatObj: r }) => {
|
|
|
3208
3208
|
] });
|
|
3209
3209
|
}, ha = (t, r) => t.unread > 0 && r.unread === 0 ? -1 : r.unread > 0 && t.unread === 0 ? 1 : t.name.localeCompare(r.name);
|
|
3210
3210
|
function Df({ appID: t, inputRef: r, className: n }) {
|
|
3211
|
-
const { setHasUnreads: s } = Na(), i = cr(), { data: l, refetch: o } = yo({ routeApplicationId: t }), [u, h] = T(!1), [d, c] = T(!1), [m, p] = T(!1), [g, { isLoading: N }] = Ka(), w = ce(null), [x] = ws(), { sendPrompt: b } = uu({ applicationId: t, outputFormat: "text", useProModel: !0 }), [y, C] = T(!1), [S] = Ka(), [
|
|
3211
|
+
const { setHasUnreads: s } = Na(), i = cr(), { data: l, refetch: o } = yo({ routeApplicationId: t }), [u, h] = T(!1), [d, c] = T(!1), [m, p] = T(!1), [g, { isLoading: N }] = Ka(), w = ce(null), [x] = ws(), { sendPrompt: b } = uu({ applicationId: t, outputFormat: "text", useProModel: !0 }), [y, C] = T(!1), [S] = Ka(), [D] = xo(), [k] = No(), [I] = vo(), [L, M] = T(!1);
|
|
3212
3212
|
K(() => {
|
|
3213
3213
|
l && (se((W) => {
|
|
3214
3214
|
const oe = l.map((ee) => {
|
|
@@ -3280,7 +3280,7 @@ function Df({ appID: t, inputRef: r, className: n }) {
|
|
|
3280
3280
|
const W = V.map((oe) => oe.conversationID).filter((oe) => oe > 0);
|
|
3281
3281
|
await Promise.allSettled(
|
|
3282
3282
|
W.map(async (oe) => {
|
|
3283
|
-
await
|
|
3283
|
+
await D({ routeApplicationId: t, conversationId: oe }).unwrap();
|
|
3284
3284
|
})
|
|
3285
3285
|
), se((oe) => oe.map((ee) => ({ ...ee, unread: 0 })).sort(ha)), pe({ title: "All read", description: "All conversations marked as read." });
|
|
3286
3286
|
} catch (W) {
|
|
@@ -3293,10 +3293,10 @@ function Df({ appID: t, inputRef: r, className: n }) {
|
|
|
3293
3293
|
p(!1);
|
|
3294
3294
|
}
|
|
3295
3295
|
}
|
|
3296
|
-
}, [t, V, m,
|
|
3296
|
+
}, [t, V, m, D, pe]);
|
|
3297
3297
|
function te() {
|
|
3298
3298
|
const W = H();
|
|
3299
|
-
W &&
|
|
3299
|
+
W && D({ routeApplicationId: t, conversationId: W.conversationID });
|
|
3300
3300
|
}
|
|
3301
3301
|
const Ne = (W) => We((oe) => [...oe, W]);
|
|
3302
3302
|
K(() => {
|
|
@@ -3366,7 +3366,7 @@ function Df({ appID: t, inputRef: r, className: n }) {
|
|
|
3366
3366
|
if (A)
|
|
3367
3367
|
try {
|
|
3368
3368
|
M(!0);
|
|
3369
|
-
const W = await x({ applicationId: t }), oe = A[0] === t ? A[1] : A[0], ee = await
|
|
3369
|
+
const W = await x({ applicationId: t }), oe = A[0] === t ? A[1] : A[0], ee = await I({ routeApplicationId: t, partnerId: oe, withSpecification: !0 }), be = mu(W.data, ee.data);
|
|
3370
3370
|
be ? Me(be) : pe({
|
|
3371
3371
|
title: "Missing data",
|
|
3372
3372
|
description: "We couldn't load enough data to analyze this partnership yet. Please try again shortly.",
|
|
@@ -3381,7 +3381,7 @@ function Df({ appID: t, inputRef: r, className: n }) {
|
|
|
3381
3381
|
} finally {
|
|
3382
3382
|
M(!1);
|
|
3383
3383
|
}
|
|
3384
|
-
}, [A, x,
|
|
3384
|
+
}, [A, x, I, Me, pe, t]);
|
|
3385
3385
|
K(() => {
|
|
3386
3386
|
s(V.some((W) => W.unread > 0));
|
|
3387
3387
|
}, [V, s]);
|
|
@@ -3652,21 +3652,21 @@ function Iu({ manufacturer: t, readonly: r = !1, isLoading: n, onUnsavedChanges:
|
|
|
3652
3652
|
) : /* @__PURE__ */ a("form", { onSubmit: c(async (y) => {
|
|
3653
3653
|
if (r) return;
|
|
3654
3654
|
let C = !0, S = !1;
|
|
3655
|
-
const
|
|
3655
|
+
const D = [
|
|
3656
3656
|
{ key: "accountsPayableRep", apiKey: "ContactName", value: y.accountsPayableRep },
|
|
3657
3657
|
{ key: "representativeEmail", apiKey: "RepresentativeEmail", value: y.representativeEmail },
|
|
3658
3658
|
{ key: "phone", apiKey: "Phone", value: y.phone },
|
|
3659
3659
|
{ key: "terms", apiKey: "Terms", value: y.terms }
|
|
3660
3660
|
];
|
|
3661
|
-
for (const k of
|
|
3662
|
-
const
|
|
3663
|
-
if (
|
|
3661
|
+
for (const k of D) {
|
|
3662
|
+
const I = k.value, L = t?.[k.apiKey];
|
|
3663
|
+
if (I !== L && I !== void 0) {
|
|
3664
3664
|
S = !0;
|
|
3665
3665
|
try {
|
|
3666
3666
|
await l({
|
|
3667
3667
|
applicationId: t?.ManufacturerId ?? "",
|
|
3668
3668
|
fieldName: k.apiKey,
|
|
3669
|
-
newValue: String(
|
|
3669
|
+
newValue: String(I)
|
|
3670
3670
|
}).unwrap() || (C = !1, console.error(`Failed to update ${k.apiKey}`));
|
|
3671
3671
|
} catch (M) {
|
|
3672
3672
|
console.error(`Error updating ${k.apiKey}:`, M), C = !1;
|
|
@@ -3829,7 +3829,7 @@ function Tu({ manufacturer: t, readonly: r = !1, isLoading: n, onUnsavedChanges:
|
|
|
3829
3829
|
}, [t, g, c]);
|
|
3830
3830
|
const C = async (k) => {
|
|
3831
3831
|
if (r) return;
|
|
3832
|
-
let
|
|
3832
|
+
let I = !0, L = !1;
|
|
3833
3833
|
const M = [
|
|
3834
3834
|
{ key: "publicName", apiKey: "PublicName", value: k.publicName },
|
|
3835
3835
|
{ key: "website", apiKey: "Website", value: k.website },
|
|
@@ -3846,22 +3846,22 @@ function Tu({ manufacturer: t, readonly: r = !1, isLoading: n, onUnsavedChanges:
|
|
|
3846
3846
|
applicationId: t?.ManufacturerId ?? "",
|
|
3847
3847
|
fieldName: A.apiKey,
|
|
3848
3848
|
newValue: String($)
|
|
3849
|
-
}).unwrap() || (
|
|
3849
|
+
}).unwrap() || (I = !1);
|
|
3850
3850
|
} catch (_) {
|
|
3851
|
-
console.error(`Error updating ${A.apiKey}:`, _),
|
|
3851
|
+
console.error(`Error updating ${A.apiKey}:`, _), I = !1;
|
|
3852
3852
|
}
|
|
3853
3853
|
}
|
|
3854
3854
|
}
|
|
3855
|
-
|
|
3855
|
+
I && L ? (i({
|
|
3856
3856
|
title: "Public info",
|
|
3857
3857
|
description: "Information updated successfully",
|
|
3858
3858
|
variant: "success"
|
|
3859
|
-
}), d({ ...k }), s && s(!1)) :
|
|
3859
|
+
}), d({ ...k }), s && s(!1)) : I || i({
|
|
3860
3860
|
title: "Update error",
|
|
3861
3861
|
description: "Failed to update",
|
|
3862
3862
|
variant: "destructive"
|
|
3863
3863
|
});
|
|
3864
|
-
}, S = (k) => !k || k.trim() === "",
|
|
3864
|
+
}, S = (k) => !k || k.trim() === "", D = (k) => {
|
|
3865
3865
|
u(k);
|
|
3866
3866
|
};
|
|
3867
3867
|
return /* @__PURE__ */ a(Q, { children: [
|
|
@@ -3945,7 +3945,7 @@ function Tu({ manufacturer: t, readonly: r = !1, isLoading: n, onUnsavedChanges:
|
|
|
3945
3945
|
{
|
|
3946
3946
|
options: Mu,
|
|
3947
3947
|
selected: o,
|
|
3948
|
-
onChange:
|
|
3948
|
+
onChange: D,
|
|
3949
3949
|
placeholder: "Select or type categories...",
|
|
3950
3950
|
disabled: r
|
|
3951
3951
|
}
|
|
@@ -4011,31 +4011,31 @@ function Ou({ manufacturer: t, readonly: r = !1, isLoading: n, onUnsavedChanges:
|
|
|
4011
4011
|
}, [t, m, h]);
|
|
4012
4012
|
const b = async (C) => {
|
|
4013
4013
|
if (r) return !1;
|
|
4014
|
-
let S = !0,
|
|
4014
|
+
let S = !0, D = !1;
|
|
4015
4015
|
const k = [
|
|
4016
4016
|
{ key: "partnerPortal", apiKey: "PartnerPortal", value: C.partnerPortal },
|
|
4017
4017
|
{ key: "partnerRegistrationLink", apiKey: "PartnerRegistrationLink", value: C.partnerRegistrationLink }
|
|
4018
4018
|
];
|
|
4019
|
-
for (const
|
|
4020
|
-
const L =
|
|
4019
|
+
for (const I of k) {
|
|
4020
|
+
const L = I.value, M = t?.[I.apiKey];
|
|
4021
4021
|
if (L !== M && L !== void 0) {
|
|
4022
|
-
|
|
4022
|
+
D = !0;
|
|
4023
4023
|
try {
|
|
4024
4024
|
await l({
|
|
4025
4025
|
applicationId: t?.ManufacturerId ?? "",
|
|
4026
|
-
fieldName:
|
|
4026
|
+
fieldName: I.apiKey,
|
|
4027
4027
|
newValue: String(L)
|
|
4028
|
-
}).unwrap() || (S = !1, console.error(`Failed to update ${
|
|
4028
|
+
}).unwrap() || (S = !1, console.error(`Failed to update ${I.apiKey}`));
|
|
4029
4029
|
} catch (A) {
|
|
4030
|
-
console.error(`Error updating ${
|
|
4030
|
+
console.error(`Error updating ${I.apiKey}:`, A), S = !1;
|
|
4031
4031
|
}
|
|
4032
4032
|
}
|
|
4033
4033
|
}
|
|
4034
|
-
S &&
|
|
4034
|
+
S && D ? (i({
|
|
4035
4035
|
title: "Qualifications info",
|
|
4036
4036
|
description: "Information updated successfully",
|
|
4037
4037
|
variant: "success"
|
|
4038
|
-
}), u({ ...C }), s && s(!1)) : S ?
|
|
4038
|
+
}), u({ ...C }), s && s(!1)) : S ? D || i({
|
|
4039
4039
|
title: "No changes",
|
|
4040
4040
|
description: "No changes were made to the information.",
|
|
4041
4041
|
variant: "info"
|
|
@@ -4157,7 +4157,7 @@ function Eu({ manufacturerId: t, userEmail: r, isLoading: n }) {
|
|
|
4157
4157
|
}
|
|
4158
4158
|
]
|
|
4159
4159
|
}
|
|
4160
|
-
], [w, { isLoading: x }] = wo(), [b, { isLoading: y }] = So(), [C, { isLoading: S }] = Co(), [
|
|
4160
|
+
], [w, { isLoading: x }] = wo(), [b, { isLoading: y }] = So(), [C, { isLoading: S }] = Co(), [D, { isLoading: k }] = ko(), [I, { isLoading: L }] = Ro(), [M, { isLoading: A }] = Po(), $ = x || y || S || k || L || A, q = (V) => {
|
|
4161
4161
|
l(V), d(!0);
|
|
4162
4162
|
}, z = (V) => {
|
|
4163
4163
|
d(V), V || (m(void 0), g(void 0));
|
|
@@ -4186,13 +4186,13 @@ function Eu({ manufacturerId: t, userEmail: r, isLoading: n }) {
|
|
|
4186
4186
|
}).unwrap();
|
|
4187
4187
|
break;
|
|
4188
4188
|
case "Reorder":
|
|
4189
|
-
await
|
|
4189
|
+
await D({
|
|
4190
4190
|
routeManufacturerId: t,
|
|
4191
4191
|
emailAddress: o
|
|
4192
4192
|
}).unwrap();
|
|
4193
4193
|
break;
|
|
4194
4194
|
case "Inventory":
|
|
4195
|
-
await
|
|
4195
|
+
await I({
|
|
4196
4196
|
routeManufacturerId: t,
|
|
4197
4197
|
emailAddress: o,
|
|
4198
4198
|
inventoryDate: c?.toISOString()
|
|
@@ -4358,7 +4358,7 @@ function Lu(t) {
|
|
|
4358
4358
|
shipped: { orders: 0, amount: 0 },
|
|
4359
4359
|
delayed: { orders: 0, amount: 0 }
|
|
4360
4360
|
};
|
|
4361
|
-
const h = i.filter((S) => S.DocumentType === "Order"), d = i.filter((S) => S.DocumentType === "Shipment"), c = h.filter((S) => S.WarehouseCode !== "3PLE"), m = c.reduce((S,
|
|
4361
|
+
const h = i.filter((S) => S.DocumentType === "Order"), d = i.filter((S) => S.DocumentType === "Shipment"), c = h.filter((S) => S.WarehouseCode !== "3PLE"), m = c.reduce((S, D) => S + (D.Quantity || 0), 0), p = c.reduce((S, D) => S + (D.ExtendedPrice || 0), 0), g = h.filter((S) => S.WarehouseCode === "3PLE"), N = g.reduce((S, D) => S + (D.Quantity || 0), 0), w = g.reduce((S, D) => S + (D.ExtendedPrice || 0), 0), x = d.length, b = d.reduce((S, D) => S + (D.ExtendedPrice || 0), 0), y = m + N + x, C = p + w + b;
|
|
4362
4362
|
return {
|
|
4363
4363
|
all: { orders: y, amount: C },
|
|
4364
4364
|
processing: { orders: m, amount: p },
|
|
@@ -5234,10 +5234,10 @@ function Hu({
|
|
|
5234
5234
|
const [s] = Mo(), [i, l] = T(() => {
|
|
5235
5235
|
const k = r.Categories?.[0]?.CategoryCode ?? "";
|
|
5236
5236
|
if (typeof window > "u") return k;
|
|
5237
|
-
const
|
|
5238
|
-
return
|
|
5239
|
-
(M) => M.CategoryCode ===
|
|
5240
|
-
) ?
|
|
5237
|
+
const I = new URLSearchParams(window.location.search).get("category")?.trim();
|
|
5238
|
+
return I && r.Categories?.some(
|
|
5239
|
+
(M) => M.CategoryCode === I
|
|
5240
|
+
) ? I : k;
|
|
5241
5241
|
}), [o, u] = T(!1), [h, d] = T(!1), [c, m] = T("percentile"), [p, g] = T(!1), { toast: N } = Ee(), {
|
|
5242
5242
|
data: w,
|
|
5243
5243
|
isLoading: x,
|
|
@@ -5272,9 +5272,9 @@ function Hu({
|
|
|
5272
5272
|
} finally {
|
|
5273
5273
|
u(!1);
|
|
5274
5274
|
}
|
|
5275
|
-
}, C = () => r.Categories?.find((k) => k.CategoryCode === i)?.CategoryName || i, S = ye(() => w?.Products ? [...w.Products].sort((k,
|
|
5276
|
-
const
|
|
5277
|
-
return !Array.isArray(
|
|
5275
|
+
}, C = () => r.Categories?.find((k) => k.CategoryCode === i)?.CategoryName || i, S = ye(() => w?.Products ? [...w.Products].sort((k, I) => c === "price-asc" ? (k.MAP ?? 0) - (I.MAP ?? 0) : c === "price-desc" ? (I.MAP ?? 0) - (k.MAP ?? 0) : c === "name" ? (k.Title ?? "").localeCompare(I.Title ?? "") : c === "percentile" ? (I.OverallPercentileRank ?? 0) - (k.OverallPercentileRank ?? 0) : 0) : [], [w?.Products, c]), D = ye(() => p ? S.filter((k) => {
|
|
5276
|
+
const I = k.Distribution?.Inventory;
|
|
5277
|
+
return !Array.isArray(I) || I.length === 0 ? !1 : I.reduce((M, A) => M + (A?.AvailableQuantity ?? 0), 0) > 0;
|
|
5278
5278
|
}) : S, [p, S]);
|
|
5279
5279
|
return /* @__PURE__ */ a(U, { children: [
|
|
5280
5280
|
/* @__PURE__ */ a("div", { className: "mb-4", children: [
|
|
@@ -5364,7 +5364,7 @@ function Hu({
|
|
|
5364
5364
|
] })
|
|
5365
5365
|
] })
|
|
5366
5366
|
] }),
|
|
5367
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4", children: x || b ? Array.from({ length: 4 }).map((k,
|
|
5367
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 @md:grid-cols-2 gap-4 mb-4", children: x || b ? Array.from({ length: 4 }).map((k, I) => /* @__PURE__ */ e(Hr, {}, I)) : D.length > 0 ? D.map((k) => /* @__PURE__ */ e(
|
|
5368
5368
|
Hr,
|
|
5369
5369
|
{
|
|
5370
5370
|
applicationId: t,
|
|
@@ -5596,12 +5596,12 @@ const Wu = ({ reseller: t, appID: r, isLoading: n, readonly: s, onUnsavedChanges
|
|
|
5596
5596
|
t && Object.keys(t).length > 0 && (p(d), h(d));
|
|
5597
5597
|
}, [t, p, d]);
|
|
5598
5598
|
const y = async (S) => {
|
|
5599
|
-
let
|
|
5600
|
-
const
|
|
5599
|
+
let D = !0, k = !1;
|
|
5600
|
+
const I = Object.keys(S).map((L) => ({
|
|
5601
5601
|
key: L,
|
|
5602
5602
|
keyApi: L.charAt(0).toUpperCase() + L.slice(1)
|
|
5603
5603
|
}));
|
|
5604
|
-
for (const L of
|
|
5604
|
+
for (const L of I) {
|
|
5605
5605
|
const M = S[L.key], A = t[L.keyApi];
|
|
5606
5606
|
if (M !== A && M !== void 0) {
|
|
5607
5607
|
k = !0;
|
|
@@ -5610,17 +5610,17 @@ const Wu = ({ reseller: t, appID: r, isLoading: n, readonly: s, onUnsavedChanges
|
|
|
5610
5610
|
applicationId: r,
|
|
5611
5611
|
fieldName: L.keyApi,
|
|
5612
5612
|
newValue: String(M)
|
|
5613
|
-
}).unwrap() || (
|
|
5613
|
+
}).unwrap() || (D = !1);
|
|
5614
5614
|
} catch ($) {
|
|
5615
|
-
console.error(`Error updating ${L.keyApi}:`, $),
|
|
5615
|
+
console.error(`Error updating ${L.keyApi}:`, $), D = !1;
|
|
5616
5616
|
}
|
|
5617
5617
|
}
|
|
5618
5618
|
}
|
|
5619
|
-
|
|
5619
|
+
D && k ? (l({
|
|
5620
5620
|
title: "Public info",
|
|
5621
5621
|
description: "Information updated successfully",
|
|
5622
5622
|
variant: "success"
|
|
5623
|
-
}), h({ ...S }), i && i(!1)) :
|
|
5623
|
+
}), h({ ...S }), i && i(!1)) : D || l({
|
|
5624
5624
|
title: "Updation error",
|
|
5625
5625
|
description: "Failed to update",
|
|
5626
5626
|
variant: "destructive"
|
|
@@ -5745,7 +5745,7 @@ const Wu = ({ reseller: t, appID: r, isLoading: n, readonly: s, onUnsavedChanges
|
|
|
5745
5745
|
] });
|
|
5746
5746
|
};
|
|
5747
5747
|
function Gu({ appID: t, reseller: r, isLoading: n, withoutReports: s, userEmail: i, isSuperAdmin: l }) {
|
|
5748
|
-
const { toast: o } = Ee(), { Statement: u, CreditLimit: h } = r, [d, c] = T(!1), [m, p] = T(!1), [g, N] = T(!1), [w, x] = T(!1), [b, y] = T(i || ""), [C, S] = T(!1), [
|
|
5748
|
+
const { toast: o } = Ee(), { Statement: u, CreditLimit: h } = r, [d, c] = T(!1), [m, p] = T(!1), [g, N] = T(!1), [w, x] = T(!1), [b, y] = T(i || ""), [C, S] = T(!1), [D, k] = T(h?.toString() || ""), [I, { isLoading: L }] = Eo(), M = [
|
|
5749
5749
|
{
|
|
5750
5750
|
label: "0 - 30 Days",
|
|
5751
5751
|
value: /* @__PURE__ */ e(pt, { value: u?.Over0 || 0, style: "currency", currency: "CAD", currencyDisplay: "symbol" }),
|
|
@@ -5970,7 +5970,7 @@ function Gu({ appID: t, reseller: r, isLoading: n, withoutReports: s, userEmail:
|
|
|
5970
5970
|
{
|
|
5971
5971
|
id: "creditLimit",
|
|
5972
5972
|
type: "number",
|
|
5973
|
-
value:
|
|
5973
|
+
value: D,
|
|
5974
5974
|
onChange: (O) => k(O.target.value),
|
|
5975
5975
|
className: "col-span-3",
|
|
5976
5976
|
placeholder: "0.00"
|
|
@@ -5982,7 +5982,7 @@ function Gu({ appID: t, reseller: r, isLoading: n, withoutReports: s, userEmail:
|
|
|
5982
5982
|
{
|
|
5983
5983
|
type: "submit",
|
|
5984
5984
|
onClick: async () => {
|
|
5985
|
-
const O = Number(
|
|
5985
|
+
const O = Number(D);
|
|
5986
5986
|
if (isNaN(O)) {
|
|
5987
5987
|
o({
|
|
5988
5988
|
title: "Invalid Amount",
|
|
@@ -5992,7 +5992,7 @@ function Gu({ appID: t, reseller: r, isLoading: n, withoutReports: s, userEmail:
|
|
|
5992
5992
|
return;
|
|
5993
5993
|
}
|
|
5994
5994
|
try {
|
|
5995
|
-
await
|
|
5995
|
+
await I({
|
|
5996
5996
|
applicationId: t,
|
|
5997
5997
|
newValue: O
|
|
5998
5998
|
}).unwrap(), S(!1), o({
|
|
@@ -6058,7 +6058,7 @@ $10 with opportunities under $1,000` : t === "D" ? "$15 under $1,500" : t === "E
|
|
|
6058
6058
|
COOPSCO: "coopsco",
|
|
6059
6059
|
"Jean Coutu": "jeancoutu",
|
|
6060
6060
|
Exclusive: "exclusive"
|
|
6061
|
-
}[O] || "", g = (O) => O && { A: "free", B: "fixed", C: "dropshipped", D: "under1500", E: "fullcharges" }[O] || "", N = (O) => O && { 1: "exclusive", 2: "ecommerce", 3: "commercial", 4: "buyinggroup", 5: "cost" }[O] || "", [w, x] = T(p(n?.Priority ?? "")), [b, y] = T(g(n?.ShippingProfile ?? "")), [C, S] = T(N(n?.PriceProfile)),
|
|
6061
|
+
}[O] || "", g = (O) => O && { A: "free", B: "fixed", C: "dropshipped", D: "under1500", E: "fullcharges" }[O] || "", N = (O) => O && { 1: "exclusive", 2: "ecommerce", 3: "commercial", 4: "buyinggroup", 5: "cost" }[O] || "", [w, x] = T(p(n?.Priority ?? "")), [b, y] = T(g(n?.ShippingProfile ?? "")), [C, S] = T(N(n?.PriceProfile)), D = (O) => ({ starter: "Starter", ecommerce: "E-Commerce", commercial: "Commercial", cws: "Basics", novexco: "Novexco", coopsco: "COOPSCO", jeancoutu: "Jean Coutu", exclusive: "Exclusive" })[O] || O, k = (O) => ({ free: "A", fixed: "B", dropshipped: "C", under1500: "D", fullcharges: "E" })[O] || O, I = (O) => ({ exclusive: "1", ecommerce: "2", commercial: "3", buyinggroup: "4", cost: "5" })[O] || O;
|
|
6062
6062
|
K(() => {
|
|
6063
6063
|
x(p(n?.Priority ?? "")), y(g(n?.ShippingProfile ?? "")), S(N(n?.PriceProfile));
|
|
6064
6064
|
}, [n]);
|
|
@@ -6070,7 +6070,7 @@ $10 with opportunities under $1,000` : t === "D" ? "$15 under $1,500" : t === "E
|
|
|
6070
6070
|
}
|
|
6071
6071
|
}, M = async (O) => {
|
|
6072
6072
|
x(O);
|
|
6073
|
-
const V =
|
|
6073
|
+
const V = D(O);
|
|
6074
6074
|
L("Priority", V, `Priority updated to ${V}`, "Failed to update priority");
|
|
6075
6075
|
}, A = async (O) => {
|
|
6076
6076
|
y(O);
|
|
@@ -6078,7 +6078,7 @@ $10 with opportunities under $1,000` : t === "D" ? "$15 under $1,500" : t === "E
|
|
|
6078
6078
|
L("ShippingProfile", V, `Shipping profile updated to ${V}`, "Failed to update shipping profile");
|
|
6079
6079
|
}, $ = async (O) => {
|
|
6080
6080
|
S(O);
|
|
6081
|
-
const V =
|
|
6081
|
+
const V = I(O);
|
|
6082
6082
|
L("PriceProfile", V, `Pricing profile updated to ${V}`, "Failed to update pricing profile");
|
|
6083
6083
|
}, q = async () => {
|
|
6084
6084
|
try {
|
|
@@ -6309,7 +6309,7 @@ function em({ openOrders: t = [], isLoading: r = !1 }) {
|
|
|
6309
6309
|
] });
|
|
6310
6310
|
}
|
|
6311
6311
|
function tm({ isLoading: t, userEmail: r, appID: n }) {
|
|
6312
|
-
const { toast: s } = Ee(), [i, { isLoading: l }] = Fo(), [o, { isLoading: u }] = $o(), [h, { isLoading: d }] = Bo(), [c, { isLoading: m }] = Rs(), [p, { isLoading: g }] = zo(), [N, { isLoading: w }] = ks(), [x, b] = T(null), [y, C] = T(r), [S,
|
|
6312
|
+
const { toast: s } = Ee(), [i, { isLoading: l }] = Fo(), [o, { isLoading: u }] = $o(), [h, { isLoading: d }] = Bo(), [c, { isLoading: m }] = Rs(), [p, { isLoading: g }] = zo(), [N, { isLoading: w }] = ks(), [x, b] = T(null), [y, C] = T(r), [S, D] = T(!1), [k, I] = T("all"), { data: L, isLoading: M } = Tr(
|
|
6313
6313
|
{
|
|
6314
6314
|
routeApplicationId: n,
|
|
6315
6315
|
withSpecification: !1
|
|
@@ -6367,7 +6367,7 @@ function tm({ isLoading: t, userEmail: r, appID: n }) {
|
|
|
6367
6367
|
]
|
|
6368
6368
|
}
|
|
6369
6369
|
], $ = async (_) => {
|
|
6370
|
-
b(_), _.id === "Products" &&
|
|
6370
|
+
b(_), _.id === "Products" && I("all"), D(!0);
|
|
6371
6371
|
}, q = async () => {
|
|
6372
6372
|
if (!(!x || !n))
|
|
6373
6373
|
try {
|
|
@@ -6417,7 +6417,7 @@ function tm({ isLoading: t, userEmail: r, appID: n }) {
|
|
|
6417
6417
|
title: "Report requested",
|
|
6418
6418
|
description: `The ${x.title} will be sent to ${y} shortly.`,
|
|
6419
6419
|
variant: "success"
|
|
6420
|
-
}),
|
|
6420
|
+
}), D(!1);
|
|
6421
6421
|
} catch (_) {
|
|
6422
6422
|
console.error("Error requesting report:", _), s({
|
|
6423
6423
|
title: "Error",
|
|
@@ -6471,7 +6471,7 @@ function tm({ isLoading: t, userEmail: r, appID: n }) {
|
|
|
6471
6471
|
O.id
|
|
6472
6472
|
))
|
|
6473
6473
|
] }, _.name)) }) }),
|
|
6474
|
-
/* @__PURE__ */ e($e, { open: S, onOpenChange:
|
|
6474
|
+
/* @__PURE__ */ e($e, { open: S, onOpenChange: D, children: /* @__PURE__ */ a(Be, { children: [
|
|
6475
6475
|
/* @__PURE__ */ a(qe, { children: [
|
|
6476
6476
|
/* @__PURE__ */ a(He, { children: [
|
|
6477
6477
|
"Request ",
|
|
@@ -6500,7 +6500,7 @@ function tm({ isLoading: t, userEmail: r, appID: n }) {
|
|
|
6500
6500
|
id: "manufacturer",
|
|
6501
6501
|
className: "mt-2 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
|
|
6502
6502
|
value: k,
|
|
6503
|
-
onChange: (_) =>
|
|
6503
|
+
onChange: (_) => I(_.target.value),
|
|
6504
6504
|
disabled: M,
|
|
6505
6505
|
children: [
|
|
6506
6506
|
/* @__PURE__ */ e("option", { value: "all", children: "All manufacturers" }),
|
|
@@ -6515,7 +6515,7 @@ function tm({ isLoading: t, userEmail: r, appID: n }) {
|
|
|
6515
6515
|
] }),
|
|
6516
6516
|
/* @__PURE__ */ e(Ge, { children: "The report will take around 5 minutes to generate." }),
|
|
6517
6517
|
/* @__PURE__ */ a(Ke, { children: [
|
|
6518
|
-
/* @__PURE__ */ e(E, { variant: "outline", onClick: () =>
|
|
6518
|
+
/* @__PURE__ */ e(E, { variant: "outline", onClick: () => D(!1), children: "Cancel" }),
|
|
6519
6519
|
/* @__PURE__ */ e(E, { onClick: q, disabled: !y || z, children: z ? /* @__PURE__ */ a(U, { children: [
|
|
6520
6520
|
/* @__PURE__ */ e(he, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
6521
6521
|
"Sending..."
|
|
@@ -6593,9 +6593,9 @@ function la({
|
|
|
6593
6593
|
const S = `${C.substring(0, 4)}-${C.substring(4, 6)}`;
|
|
6594
6594
|
b[S] && (b[S].price += y.ExtendedPrice ?? 0, b[S].quantity += y.Quantity ?? 0);
|
|
6595
6595
|
}), c = x.map((y) => {
|
|
6596
|
-
const C = b[y], [S,
|
|
6596
|
+
const C = b[y], [S, D] = y.split("-").map(Number);
|
|
6597
6597
|
return {
|
|
6598
|
-
date: new Date(S,
|
|
6598
|
+
date: new Date(S, D - 1).toLocaleString("default", { month: "short", year: "numeric" }),
|
|
6599
6599
|
dollarVolume: C.price,
|
|
6600
6600
|
unitsSold: C.quantity
|
|
6601
6601
|
};
|
|
@@ -6604,8 +6604,8 @@ function la({
|
|
|
6604
6604
|
if (y && y.price > 0 && N > 0) {
|
|
6605
6605
|
const C = new Date(p, g + 1, 0).getDate();
|
|
6606
6606
|
if (N < C) {
|
|
6607
|
-
const S = y.price / N,
|
|
6608
|
-
L && (L.dollarVolume = k, L.unitsSold =
|
|
6607
|
+
const S = y.price / N, D = y.quantity / N, k = S * C, I = D * C, L = c[c.length - 1];
|
|
6608
|
+
L && (L.dollarVolume = k, L.unitsSold = I);
|
|
6609
6609
|
}
|
|
6610
6610
|
}
|
|
6611
6611
|
}
|
|
@@ -6772,7 +6772,7 @@ function va({
|
|
|
6772
6772
|
"Open To Work"
|
|
6773
6773
|
] }),
|
|
6774
6774
|
!!t.OnHold && t.OnHold !== 0 && /* @__PURE__ */ e(xe, { variant: "warning", children: "On Hold" }),
|
|
6775
|
-
y.map((S,
|
|
6775
|
+
y.map((S, D) => /* @__PURE__ */ e(xe, { variant: "outline", children: S }, D))
|
|
6776
6776
|
] }),
|
|
6777
6777
|
/* @__PURE__ */ a("div", { className: "space-y-1 pt-2", children: [
|
|
6778
6778
|
t.Phone && /* @__PURE__ */ a(
|
|
@@ -6901,7 +6901,7 @@ function am({
|
|
|
6901
6901
|
...q,
|
|
6902
6902
|
[A]: $
|
|
6903
6903
|
} : q);
|
|
6904
|
-
}, []), { NavigationGuardDialog: C } = ii(b), S = p ?? r,
|
|
6904
|
+
}, []), { NavigationGuardDialog: C } = ii(b), S = p ?? r, D = g && !S, k = N && !S, I = !n || !!S?.Statement && (S.Statement.Total ?? 0) !== 0, L = S?.QualifiedManufacturers ?? [], M = S?.Qualifications ?? [];
|
|
6905
6905
|
return /* @__PURE__ */ a("div", { className: "@container", children: [
|
|
6906
6906
|
k ? /* @__PURE__ */ e(Q, { className: "p-6", children: /* @__PURE__ */ a(Tt, { variant: "destructive", children: [
|
|
6907
6907
|
/* @__PURE__ */ e(Nt, { className: "h-4 w-4" }),
|
|
@@ -6913,7 +6913,7 @@ function am({
|
|
|
6913
6913
|
{
|
|
6914
6914
|
fiscalYearMonthStart: S?.FiscalYearMonthStart || 1,
|
|
6915
6915
|
salesData: S?.SalesData,
|
|
6916
|
-
isLoading:
|
|
6916
|
+
isLoading: D
|
|
6917
6917
|
}
|
|
6918
6918
|
),
|
|
6919
6919
|
/* @__PURE__ */ a("div", { className: "grid @lg:grid-cols-2 gap-6", children: [
|
|
@@ -6921,17 +6921,17 @@ function am({
|
|
|
6921
6921
|
ln,
|
|
6922
6922
|
{
|
|
6923
6923
|
statistics: S?.SalesStatistics ?? [],
|
|
6924
|
-
loading:
|
|
6924
|
+
loading: D
|
|
6925
6925
|
}
|
|
6926
6926
|
),
|
|
6927
|
-
/* @__PURE__ */ e(em, { openOrders: S?.ActiveOrderDetails ?? [], isLoading:
|
|
6928
|
-
|
|
6927
|
+
/* @__PURE__ */ e(em, { openOrders: S?.ActiveOrderDetails ?? [], isLoading: D }),
|
|
6928
|
+
I && /* @__PURE__ */ e(
|
|
6929
6929
|
Gu,
|
|
6930
6930
|
{
|
|
6931
6931
|
appID: t,
|
|
6932
6932
|
reseller: S || {},
|
|
6933
6933
|
withoutReports: l,
|
|
6934
|
-
isLoading:
|
|
6934
|
+
isLoading: D,
|
|
6935
6935
|
userEmail: s,
|
|
6936
6936
|
isSuperAdmin: i
|
|
6937
6937
|
}
|
|
@@ -6941,7 +6941,7 @@ function am({
|
|
|
6941
6941
|
{
|
|
6942
6942
|
reseller: S || {},
|
|
6943
6943
|
appID: t ?? "",
|
|
6944
|
-
isLoading:
|
|
6944
|
+
isLoading: D,
|
|
6945
6945
|
readonly: n,
|
|
6946
6946
|
onUnsavedChanges: (A) => y("publicInfo", { hasUnsavedChanges: A })
|
|
6947
6947
|
}
|
|
@@ -6953,12 +6953,12 @@ function am({
|
|
|
6953
6953
|
readonly: n,
|
|
6954
6954
|
reseller: S || {},
|
|
6955
6955
|
appID: t ?? "",
|
|
6956
|
-
isLoading:
|
|
6956
|
+
isLoading: D
|
|
6957
6957
|
}
|
|
6958
6958
|
),
|
|
6959
|
-
|
|
6959
|
+
D || L.length > 0 ? /* @__PURE__ */ a(Q, { className: "w-full", children: [
|
|
6960
6960
|
/* @__PURE__ */ e(Z, { children: /* @__PURE__ */ e(fe, { children: "Manufacturers you are qualified for" }) }),
|
|
6961
|
-
/* @__PURE__ */ e(G, { children: /* @__PURE__ */ e("div", { className: "grid @lg:grid-cols-2 gap-4", children:
|
|
6961
|
+
/* @__PURE__ */ e(G, { children: /* @__PURE__ */ e("div", { className: "grid @lg:grid-cols-2 gap-4", children: D ? Array.from({ length: 2 }).map((A, $) => /* @__PURE__ */ e(va, { loading: !0 }, $)) : L.map((A) => /* @__PURE__ */ e(
|
|
6962
6962
|
va,
|
|
6963
6963
|
{
|
|
6964
6964
|
manufacturer: A,
|
|
@@ -6980,7 +6980,7 @@ function am({
|
|
|
6980
6980
|
opportunities: [...S.Opportunities].sort(
|
|
6981
6981
|
(A, $) => new Date($.LastUpdate) - new Date(A.LastUpdate)
|
|
6982
6982
|
),
|
|
6983
|
-
loading:
|
|
6983
|
+
loading: D
|
|
6984
6984
|
}
|
|
6985
6985
|
),
|
|
6986
6986
|
!l && /* @__PURE__ */ e(
|
|
@@ -6988,7 +6988,7 @@ function am({
|
|
|
6988
6988
|
{
|
|
6989
6989
|
appID: t,
|
|
6990
6990
|
userEmail: s,
|
|
6991
|
-
isLoading:
|
|
6991
|
+
isLoading: !1
|
|
6992
6992
|
}
|
|
6993
6993
|
)
|
|
6994
6994
|
] }),
|
|
@@ -7752,25 +7752,25 @@ function um({
|
|
|
7752
7752
|
`loading-${C}`
|
|
7753
7753
|
))
|
|
7754
7754
|
] }) }) : t.length === 0 ? /* @__PURE__ */ e("div", { className: v(x, p), ...g, children: h ?? /* @__PURE__ */ e("div", { className: "rounded-xl border border-dashed border-border bg-muted/30 p-4 text-sm text-muted-foreground", children: "No options are available." }) }) : /* @__PURE__ */ e("div", { className: v(x, p), role: "group", "aria-disabled": s || void 0, ...g, children: t.map((y, C) => {
|
|
7755
|
-
const S = w.has(y.id),
|
|
7755
|
+
const S = w.has(y.id), D = s || y.disabled === !0, k = `${N}-${C}-label`, I = `${N}-${C}-description`;
|
|
7756
7756
|
return /* @__PURE__ */ a(
|
|
7757
7757
|
"button",
|
|
7758
7758
|
{
|
|
7759
7759
|
type: "button",
|
|
7760
7760
|
role: "checkbox",
|
|
7761
7761
|
"aria-checked": S,
|
|
7762
|
-
"aria-disabled":
|
|
7762
|
+
"aria-disabled": D,
|
|
7763
7763
|
"aria-label": c?.(y) ?? y.label,
|
|
7764
7764
|
"aria-labelledby": m ? void 0 : k,
|
|
7765
|
-
"aria-describedby": !m && y.description ?
|
|
7766
|
-
disabled:
|
|
7765
|
+
"aria-describedby": !m && y.description ? I : void 0,
|
|
7766
|
+
disabled: D,
|
|
7767
7767
|
onClick: () => b(y),
|
|
7768
7768
|
className: v(
|
|
7769
7769
|
"flex w-full items-start gap-3 rounded-xl border bg-card p-4 text-left shadow-sm transition-colors transition-shadow",
|
|
7770
7770
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
7771
7771
|
"hover:bg-muted/30 hover:shadow",
|
|
7772
7772
|
S ? "border-primary bg-primary/5 ring-2 ring-primary/20" : "border-border",
|
|
7773
|
-
|
|
7773
|
+
D && "cursor-not-allowed opacity-60 hover:bg-card hover:shadow-sm"
|
|
7774
7774
|
),
|
|
7775
7775
|
children: [
|
|
7776
7776
|
/* @__PURE__ */ e(
|
|
@@ -7786,14 +7786,14 @@ function um({
|
|
|
7786
7786
|
),
|
|
7787
7787
|
/* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: m ? /* @__PURE__ */ a(U, { children: [
|
|
7788
7788
|
/* @__PURE__ */ e("span", { className: "sr-only", children: y.label }),
|
|
7789
|
-
m(y, { checked: S, disabled:
|
|
7789
|
+
m(y, { checked: S, disabled: D, index: C })
|
|
7790
7790
|
] }) : /* @__PURE__ */ a(U, { children: [
|
|
7791
7791
|
(y.prefix || y.emphasis) && /* @__PURE__ */ a("div", { className: "flex flex-wrap items-baseline gap-1 text-xs", children: [
|
|
7792
7792
|
y.prefix && /* @__PURE__ */ e("span", { className: "font-semibold uppercase tracking-wide text-muted-foreground", children: y.prefix }),
|
|
7793
7793
|
y.emphasis && /* @__PURE__ */ e("span", { className: "font-semibold text-foreground", children: y.emphasis })
|
|
7794
7794
|
] }),
|
|
7795
7795
|
/* @__PURE__ */ e("span", { id: k, className: v("block text-sm font-medium text-foreground", (y.prefix || y.emphasis) && "mt-1"), children: y.label }),
|
|
7796
|
-
y.description && /* @__PURE__ */ e("span", { id:
|
|
7796
|
+
y.description && /* @__PURE__ */ e("span", { id: I, className: "mt-1 block text-sm text-muted-foreground", children: y.description })
|
|
7797
7797
|
] }) })
|
|
7798
7798
|
]
|
|
7799
7799
|
},
|
|
@@ -8043,16 +8043,16 @@ ${m.description}` : m.summary || `${c.toUpperCase()} ${p[p.length - 1]}`,
|
|
|
8043
8043
|
} catch ($) {
|
|
8044
8044
|
return console.error(`Error in ${w}:`, $), `I'm sorry, I couldn't retrieve the requested information. Error: ${$ instanceof Error ? $.message : "Unknown error"}`;
|
|
8045
8045
|
}
|
|
8046
|
-
},
|
|
8046
|
+
}, D = m.tags?.[0] ?? "Partner", I = `${{
|
|
8047
8047
|
get: "Fetching",
|
|
8048
8048
|
put: "Inserting",
|
|
8049
8049
|
post: "Updating",
|
|
8050
8050
|
delete: "Deleting"
|
|
8051
|
-
}[c]} - ${
|
|
8051
|
+
}[c]} - ${D}.`, L = `${c} ${u}`;
|
|
8052
8052
|
o.push({
|
|
8053
8053
|
declaration: C,
|
|
8054
8054
|
handler: S,
|
|
8055
|
-
prettyName:
|
|
8055
|
+
prettyName: I,
|
|
8056
8056
|
details: L
|
|
8057
8057
|
});
|
|
8058
8058
|
}
|
|
@@ -8063,7 +8063,7 @@ ${m.description}` : m.summary || `${c.toUpperCase()} ${p[p.length - 1]}`,
|
|
|
8063
8063
|
}
|
|
8064
8064
|
}
|
|
8065
8065
|
function Sm({ userId: t, apiConfig: r, onGeneratedImageUploaded: n }) {
|
|
8066
|
-
const [s, i] = T(""), [l, o] = T([]), [u, h] = T([]), [d, c] = T([]), [m, p] = T(!1), [g, N] = T([]), [w, x] = T([]), [b, y] = T(0), C = ce(!1), S = ce(null),
|
|
8066
|
+
const [s, i] = T(""), [l, o] = T([]), [u, h] = T([]), [d, c] = T([]), [m, p] = T(!1), [g, N] = T([]), [w, x] = T([]), [b, y] = T(0), C = ce(!1), S = ce(null), D = ce(null), k = ce([]), I = ce([]), L = ce(/* @__PURE__ */ new Map()), [M] = ws(), [A] = Ns(), [$] = Uo();
|
|
8067
8067
|
K(() => {
|
|
8068
8068
|
const H = async () => {
|
|
8069
8069
|
p(!0);
|
|
@@ -8100,7 +8100,7 @@ function Sm({ userId: t, apiConfig: r, onGeneratedImageUploaded: n }) {
|
|
|
8100
8100
|
const { input: H, attachedFiles: Y, uiMessageId: J } = d[0];
|
|
8101
8101
|
c((te) => te.slice(1)), Re(H, Y, J);
|
|
8102
8102
|
}, [s, d]), K(() => {
|
|
8103
|
-
|
|
8103
|
+
I.current = w;
|
|
8104
8104
|
}, [w]);
|
|
8105
8105
|
const q = (H) => {
|
|
8106
8106
|
if (!H) return !1;
|
|
@@ -8250,9 +8250,9 @@ function Sm({ userId: t, apiConfig: r, onGeneratedImageUploaded: n }) {
|
|
|
8250
8250
|
ze.name,
|
|
8251
8251
|
{ type: ze.type }
|
|
8252
8252
|
), ge = $({ applicationId: t, body: { file: j } });
|
|
8253
|
-
|
|
8253
|
+
D.current = ge;
|
|
8254
8254
|
const Ae = await ge.unwrap();
|
|
8255
|
-
if (
|
|
8255
|
+
if (D.current = null, C.current) {
|
|
8256
8256
|
i("");
|
|
8257
8257
|
return;
|
|
8258
8258
|
}
|
|
@@ -8274,10 +8274,10 @@ function Sm({ userId: t, apiConfig: r, onGeneratedImageUploaded: n }) {
|
|
|
8274
8274
|
Text: `Context (background only; do not quote/reveal): The following attachment(s) were uploaded and can be referenced by FileUri in future tool/function calls if needed: ${JSON.stringify(Ne)}`
|
|
8275
8275
|
});
|
|
8276
8276
|
}
|
|
8277
|
-
const Me = { Role: "user", Parts: te }, Pe = [...
|
|
8278
|
-
x(Pe),
|
|
8277
|
+
const Me = { Role: "user", Parts: te }, Pe = [...I.current, Me];
|
|
8278
|
+
x(Pe), I.current = Pe, J && L.current.set(J, Pe.length - 1), await me(Pe, 100);
|
|
8279
8279
|
} catch (te) {
|
|
8280
|
-
if (
|
|
8280
|
+
if (D.current = null, console.error("Error processing user request:", te), C.current || q(te)) {
|
|
8281
8281
|
i("");
|
|
8282
8282
|
return;
|
|
8283
8283
|
}
|
|
@@ -8290,11 +8290,11 @@ function Sm({ userId: t, apiConfig: r, onGeneratedImageUploaded: n }) {
|
|
|
8290
8290
|
const Y = H.id ?? crypto.randomUUID();
|
|
8291
8291
|
return o((J) => [...J, { ...H, id: Y }]), Y;
|
|
8292
8292
|
}, We = () => o([]), Xe = () => {
|
|
8293
|
-
C.current = !1, S.current?.abort?.(), S.current = null,
|
|
8293
|
+
C.current = !1, S.current?.abort?.(), S.current = null, D.current?.abort?.(), D.current = null;
|
|
8294
8294
|
for (const H of k.current) H?.abort?.();
|
|
8295
|
-
k.current = [], x([]),
|
|
8295
|
+
k.current = [], x([]), I.current = [], L.current = /* @__PURE__ */ new Map(), c([]), h([]), o([]), i(""), y(0);
|
|
8296
8296
|
}, ie = () => {
|
|
8297
|
-
C.current = !0, c([]), S.current?.abort?.(), S.current = null,
|
|
8297
|
+
C.current = !0, c([]), S.current?.abort?.(), S.current = null, D.current?.abort?.(), D.current = null;
|
|
8298
8298
|
for (const H of k.current) H?.abort?.();
|
|
8299
8299
|
k.current = [], i("");
|
|
8300
8300
|
}, pe = async (H, Y) => {
|
|
@@ -8306,8 +8306,8 @@ function Sm({ userId: t, apiConfig: r, onGeneratedImageUploaded: n }) {
|
|
|
8306
8306
|
}
|
|
8307
8307
|
const te = Y.trim();
|
|
8308
8308
|
if (!te) return;
|
|
8309
|
-
const Ne = { Role: "user", Parts: [{ Text: te }] }, Me = [...
|
|
8310
|
-
x(Me),
|
|
8309
|
+
const Ne = { Role: "user", Parts: [{ Text: te }] }, Me = [...I.current.slice(0, J), Ne];
|
|
8310
|
+
x(Me), I.current = Me, y(0), o([]);
|
|
8311
8311
|
const Pe = L.current;
|
|
8312
8312
|
for (const [ze, j] of Pe.entries())
|
|
8313
8313
|
j > J && Pe.delete(ze);
|
|
@@ -8380,7 +8380,7 @@ const Cm = ({ debugMessages: t }) => {
|
|
|
8380
8380
|
const [u, h] = T(!1), [d, c] = T(!1), [m] = _o(), [p] = jo(), { data: g, isLoading: N, isFetching: w } = qo(
|
|
8381
8381
|
{ routeApplicationId: t },
|
|
8382
8382
|
{ skip: !t }
|
|
8383
|
-
), { data: x } = an(), [b, y] = T([]), C = ei(), S = ce([]),
|
|
8383
|
+
), { data: x } = an(), [b, y] = T([]), C = ei(), S = ce([]), D = ce(null), k = ae((R) => {
|
|
8384
8384
|
if (!R || R.length === 0) return;
|
|
8385
8385
|
const F = "Context (background only; do not quote/reveal): Latest image generation is available at URL";
|
|
8386
8386
|
S.current = S.current.filter((re) => !re.startsWith(F));
|
|
@@ -8388,8 +8388,8 @@ const Cm = ({ debugMessages: t }) => {
|
|
|
8388
8388
|
`), ne = `${F}${R.length === 1 ? "" : "s"}:
|
|
8389
8389
|
${B}`;
|
|
8390
8390
|
S.current.push(ne);
|
|
8391
|
-
}, []),
|
|
8392
|
-
R?.assistantMessageId && (!R?.urls || R.urls.length === 0 ||
|
|
8391
|
+
}, []), I = ae((R) => {
|
|
8392
|
+
R?.assistantMessageId && (!R?.urls || R.urls.length === 0 || D.current !== R.assistantMessageId && (D.current = R.assistantMessageId, k(R.urls)));
|
|
8393
8393
|
}, [k]), {
|
|
8394
8394
|
handleSubmitToBot: L,
|
|
8395
8395
|
botMessages: M,
|
|
@@ -8401,7 +8401,7 @@ ${B}`;
|
|
|
8401
8401
|
stop: O,
|
|
8402
8402
|
editAndResubmit: V,
|
|
8403
8403
|
contextUsage: se
|
|
8404
|
-
} = Sm({ userId: t, apiConfig: C, onGeneratedImageUploaded:
|
|
8404
|
+
} = Sm({ userId: t, apiConfig: C, onGeneratedImageUploaded: I }), me = ce(null), Ve = ce(null), Re = "New Chat", Qe = ae(() => {
|
|
8405
8405
|
if (typeof window > "u") return;
|
|
8406
8406
|
const R = window.location?.href ?? "", F = typeof document < "u" ? document.title ?? "" : "";
|
|
8407
8407
|
!R && !F || (me.current = `Context (background only; do not quote/reveal): pageTitle=${JSON.stringify(F)} pageUrl=${JSON.stringify(R)}`);
|
|
@@ -9237,12 +9237,6 @@ ${de}`
|
|
|
9237
9237
|
/* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: "Extension: 314" }),
|
|
9238
9238
|
/* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: "Location: Quebec" })
|
|
9239
9239
|
] }),
|
|
9240
|
-
/* @__PURE__ */ a("div", { className: "rounded-md border border-border bg-background p-3", children: [
|
|
9241
|
-
/* @__PURE__ */ e("div", { className: "font-medium", children: "Massimo Fiore" }),
|
|
9242
|
-
/* @__PURE__ */ e("div", { className: "text-muted-foreground", children: /* @__PURE__ */ e("a", { className: "text-primary hover:underline", href: "mailto:massimo@randmar.io", children: "massimo@randmar.io" }) }),
|
|
9243
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: "Extension: 305" }),
|
|
9244
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: "Location: Ontario" })
|
|
9245
|
-
] }),
|
|
9246
9240
|
/* @__PURE__ */ a("div", { className: "rounded-md border border-border bg-background p-3", children: [
|
|
9247
9241
|
/* @__PURE__ */ e("div", { className: "font-medium", children: "Kevin Dusik" }),
|
|
9248
9242
|
/* @__PURE__ */ e("div", { className: "text-muted-foreground", children: /* @__PURE__ */ e("a", { className: "text-primary hover:underline", href: "mailto:kevin@randmar.io", children: "kevin@randmar.io" }) }),
|
|
@@ -9327,9 +9321,9 @@ function Mm(t, r) {
|
|
|
9327
9321
|
const Tm = Xa(
|
|
9328
9322
|
({ routes: t, footer: r, dashboardTitle: n, chatUserName: s, appID: i, chatRoutePath: l }, o) => {
|
|
9329
9323
|
const u = t.filter((k) => k.showInNav), h = ce(null), d = ce(null), c = ce(null), [m, p] = T(!1), { isMobile: g, setOpenMobile: N } = Pa(), w = As(), { data: x } = Qo({ routeApplicationId: i }), { hasUnreads: b } = Na(), y = ae(
|
|
9330
|
-
(k,
|
|
9324
|
+
(k, I = null, L = null, M) => {
|
|
9331
9325
|
p(!0), setTimeout(() => {
|
|
9332
|
-
h.current?.focus(), d.current && (M?.clear ? d.current.sendMessageToAssistantWithClear(k,
|
|
9326
|
+
h.current?.focus(), d.current && (M?.clear ? d.current.sendMessageToAssistantWithClear(k, I, L) : d.current.sendMessageToAssistant(k, I, L));
|
|
9333
9327
|
}, 100);
|
|
9334
9328
|
},
|
|
9335
9329
|
[]
|
|
@@ -9337,17 +9331,17 @@ const Tm = Xa(
|
|
|
9337
9331
|
N(!1);
|
|
9338
9332
|
}, [N]);
|
|
9339
9333
|
os(o, () => ({
|
|
9340
|
-
sendMessageToAssistant: (k,
|
|
9341
|
-
y(k,
|
|
9334
|
+
sendMessageToAssistant: (k, I, L) => {
|
|
9335
|
+
y(k, I, L);
|
|
9342
9336
|
},
|
|
9343
|
-
sendMessageToAssistantWithClear(k,
|
|
9344
|
-
y(k,
|
|
9337
|
+
sendMessageToAssistantWithClear(k, I, L) {
|
|
9338
|
+
y(k, I, L, { clear: !0 });
|
|
9345
9339
|
}
|
|
9346
9340
|
}));
|
|
9347
9341
|
const S = u.map((k) => {
|
|
9348
|
-
const
|
|
9349
|
-
return { route: k, linkPath:
|
|
9350
|
-
}),
|
|
9342
|
+
const I = Mm(k.path, i), L = Dm(w.pathname, I, i);
|
|
9343
|
+
return { route: k, linkPath: I, isActive: L };
|
|
9344
|
+
}), D = S.find((k) => k.isActive)?.route.label ?? "None";
|
|
9351
9345
|
return /* @__PURE__ */ a($s, { className: "border-r border-sidebar-border", children: [
|
|
9352
9346
|
/* @__PURE__ */ e(zs, { className: "border-b border-sidebar-border px-6 h-16 justify-center bg-sidebar text-sidebar-foreground", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
9353
9347
|
/* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
@@ -9365,15 +9359,15 @@ const Tm = Xa(
|
|
|
9365
9359
|
/* @__PURE__ */ e("p", { className: "text-xs font-semibold uppercase tracking-wide text-sidebar-foreground/70", children: "App Launchpad" }),
|
|
9366
9360
|
/* @__PURE__ */ a("p", { className: "mt-1 text-sm text-sidebar-foreground/85", children: [
|
|
9367
9361
|
"Current: ",
|
|
9368
|
-
/* @__PURE__ */ e("span", { className: "font-semibold text-sidebar-foreground", children:
|
|
9362
|
+
/* @__PURE__ */ e("span", { className: "font-semibold text-sidebar-foreground", children: D })
|
|
9369
9363
|
] })
|
|
9370
9364
|
] }),
|
|
9371
|
-
/* @__PURE__ */ e("div", { className: "mt-4 grid grid-cols-3 gap-3", children: S.map(({ route: k, linkPath:
|
|
9365
|
+
/* @__PURE__ */ e("div", { className: "mt-4 grid grid-cols-3 gap-3", children: S.map(({ route: k, linkPath: I, isActive: L }) => {
|
|
9372
9366
|
const M = k.icon ?? Ml;
|
|
9373
9367
|
return /* @__PURE__ */ a(
|
|
9374
9368
|
Te,
|
|
9375
9369
|
{
|
|
9376
|
-
to:
|
|
9370
|
+
to: I,
|
|
9377
9371
|
"aria-current": L ? "page" : void 0,
|
|
9378
9372
|
onClickCapture: C,
|
|
9379
9373
|
className: v(
|
|
@@ -9389,9 +9383,9 @@ const Tm = Xa(
|
|
|
9389
9383
|
k.key
|
|
9390
9384
|
);
|
|
9391
9385
|
}) })
|
|
9392
|
-
] }) : /* @__PURE__ */ e(_s, { children: S.map(({ route: k, linkPath:
|
|
9386
|
+
] }) : /* @__PURE__ */ e(_s, { children: S.map(({ route: k, linkPath: I, isActive: L }) => {
|
|
9393
9387
|
const M = k.icon;
|
|
9394
|
-
return /* @__PURE__ */ e(js, { children: /* @__PURE__ */ e(qs, { asChild: !0, isActive: L, children: /* @__PURE__ */ a(Te, { to:
|
|
9388
|
+
return /* @__PURE__ */ e(js, { children: /* @__PURE__ */ e(qs, { asChild: !0, isActive: L, children: /* @__PURE__ */ a(Te, { to: I, className: "transition-colors hover:bg-muted px-6", children: [
|
|
9395
9389
|
M && /* @__PURE__ */ e(M, { className: "h-4 w-4" }),
|
|
9396
9390
|
/* @__PURE__ */ e("span", { children: k.label })
|
|
9397
9391
|
] }) }) }, k.key);
|
|
@@ -9508,7 +9502,7 @@ const Zn = [
|
|
|
9508
9502
|
{ id: "other-market", label: "Other (please specify)" }
|
|
9509
9503
|
];
|
|
9510
9504
|
function bi({ applicationId: t, manufacturer: r }) {
|
|
9511
|
-
const { toast: n } = Ee(), [s, i] = T(!1), [l, o] = T(!1), [u, h] = T(!1), [d, c] = T(""), [m, p] = T(""), [g, N] = T(!1), [w, x] = T(""), [b, y] = T(""), [C, S] = T([]), [
|
|
9505
|
+
const { toast: n } = Ee(), [s, i] = T(!1), [l, o] = T(!1), [u, h] = T(!1), [d, c] = T(""), [m, p] = T(""), [g, N] = T(!1), [w, x] = T(""), [b, y] = T(""), [C, S] = T([]), [D, k] = T(""), [I, L] = T(""), [M, A] = T([]), [$, q] = T(""), [z, _] = T(""), [O] = Ka(), V = () => {
|
|
9512
9506
|
c(""), p("");
|
|
9513
9507
|
}, se = () => {
|
|
9514
9508
|
x(""), y(""), S([]), k(""), L(""), A([]), q(""), _("");
|
|
@@ -9542,7 +9536,7 @@ function bi({ applicationId: t, manufacturer: r }) {
|
|
|
9542
9536
|
let pe = !1;
|
|
9543
9537
|
if (w.trim().length < 10 && (y("Please provide a brief description of your business (minimum 10 characters)"), pe = !0), C.length === 0 && (k("Please select at least one sales channel"), pe = !0), M.length === 0 && (q("Please select at least one market"), pe = !0), pe) return;
|
|
9544
9538
|
const H = Zn.filter((te) => C.includes(te.id)).map((te) => te.label);
|
|
9545
|
-
|
|
9539
|
+
I && H.push(`Other: ${I}`);
|
|
9546
9540
|
const Y = Xn.filter((te) => M.includes(te.id)).map((te) => te.label);
|
|
9547
9541
|
z && Y.push(`Other: ${z}`);
|
|
9548
9542
|
const J = [
|
|
@@ -9673,8 +9667,8 @@ function bi({ applicationId: t, manufacturer: r }) {
|
|
|
9673
9667
|
),
|
|
9674
9668
|
/* @__PURE__ */ e(X, { htmlFor: `channel-${ie.id}`, className: "text-sm font-normal", children: ie.label })
|
|
9675
9669
|
] }, ie.id)) }),
|
|
9676
|
-
We && /* @__PURE__ */ e(le, { placeholder: "Please specify", value:
|
|
9677
|
-
|
|
9670
|
+
We && /* @__PURE__ */ e(le, { placeholder: "Please specify", value: I, onChange: (ie) => L(ie.target.value) }),
|
|
9671
|
+
D && /* @__PURE__ */ e("p", { className: "text-sm font-medium text-destructive", children: D })
|
|
9678
9672
|
] }),
|
|
9679
9673
|
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
9680
9674
|
/* @__PURE__ */ a(X, { children: [
|
|
@@ -10112,12 +10106,12 @@ function zm({
|
|
|
10112
10106
|
P.useEffect(() => {
|
|
10113
10107
|
C?.length && (b.current || (N(S), b.current = !0));
|
|
10114
10108
|
}, [S, C]);
|
|
10115
|
-
const
|
|
10109
|
+
const D = C?.length ?? 0, k = P.useMemo(() => {
|
|
10116
10110
|
const O = (n ?? "").trim();
|
|
10117
10111
|
return O ? `${O} (Product ${t})` : `Product ${t}`;
|
|
10118
|
-
}, [n, t]),
|
|
10119
|
-
(O) =>
|
|
10120
|
-
[k,
|
|
10112
|
+
}, [n, t]), I = P.useCallback(
|
|
10113
|
+
(O) => D > 1 ? `${k} image ${O + 1}` : k,
|
|
10114
|
+
[k, D]
|
|
10121
10115
|
), L = C?.[g], M = P.useMemo(() => L ? es({
|
|
10122
10116
|
apiOrigin: h,
|
|
10123
10117
|
randmarSKU: t,
|
|
@@ -10126,14 +10120,14 @@ function zm({
|
|
|
10126
10120
|
height: l * 1.5
|
|
10127
10121
|
}) : null, [L, h, l, t]), A = P.useCallback(
|
|
10128
10122
|
(O) => {
|
|
10129
|
-
if (
|
|
10130
|
-
const V = (O %
|
|
10123
|
+
if (D <= 0) return;
|
|
10124
|
+
const V = (O % D + D) % D;
|
|
10131
10125
|
N(V);
|
|
10132
10126
|
},
|
|
10133
|
-
[
|
|
10127
|
+
[D]
|
|
10134
10128
|
), $ = P.useCallback(() => A(g - 1), [g, A]), q = P.useCallback(() => A(g + 1), [g, A]), z = P.useCallback(
|
|
10135
10129
|
(O) => {
|
|
10136
|
-
if (!(
|
|
10130
|
+
if (!(D <= 1))
|
|
10137
10131
|
switch (O.key) {
|
|
10138
10132
|
case "ArrowLeft":
|
|
10139
10133
|
O.preventDefault(), $();
|
|
@@ -10145,15 +10139,15 @@ function zm({
|
|
|
10145
10139
|
O.preventDefault(), A(0);
|
|
10146
10140
|
break;
|
|
10147
10141
|
case "End":
|
|
10148
|
-
O.preventDefault(), A(
|
|
10142
|
+
O.preventDefault(), A(D - 1);
|
|
10149
10143
|
break;
|
|
10150
10144
|
}
|
|
10151
10145
|
},
|
|
10152
|
-
[q, $, A,
|
|
10146
|
+
[q, $, A, D]
|
|
10153
10147
|
);
|
|
10154
10148
|
if (P.useEffect(() => {
|
|
10155
|
-
if (!C?.length ||
|
|
10156
|
-
const O = (g - 1 +
|
|
10149
|
+
if (!C?.length || D <= 1) return;
|
|
10150
|
+
const O = (g - 1 + D) % D, V = (g + 1) % D, se = [O, V];
|
|
10157
10151
|
for (const me of se) {
|
|
10158
10152
|
const Ve = C[me];
|
|
10159
10153
|
if (!Ve) continue;
|
|
@@ -10169,7 +10163,7 @@ function zm({
|
|
|
10169
10163
|
const Qe = new Image();
|
|
10170
10164
|
Qe.src = Re;
|
|
10171
10165
|
}
|
|
10172
|
-
}, [g, h, l, t,
|
|
10166
|
+
}, [g, h, l, t, D, C]), c)
|
|
10173
10167
|
return /* @__PURE__ */ e(U, { children: i ?? null });
|
|
10174
10168
|
if (p === null && u && m)
|
|
10175
10169
|
return /* @__PURE__ */ e("div", { className: s, ref: o, children: /* @__PURE__ */ e(f, { className: "rounded-md", style: { width: l, height: l } }) });
|
|
@@ -10210,13 +10204,13 @@ function zm({
|
|
|
10210
10204
|
role: "region",
|
|
10211
10205
|
"aria-roledescription": "carousel",
|
|
10212
10206
|
"aria-label": `Product images for ${t}`,
|
|
10213
|
-
tabIndex:
|
|
10207
|
+
tabIndex: D > 1 ? 0 : -1,
|
|
10214
10208
|
onKeyDown: z,
|
|
10215
10209
|
children: [
|
|
10216
10210
|
/* @__PURE__ */ e(
|
|
10217
10211
|
"img",
|
|
10218
10212
|
{
|
|
10219
|
-
alt:
|
|
10213
|
+
alt: I(g),
|
|
10220
10214
|
className: "w-full h-full object-contain",
|
|
10221
10215
|
src: M,
|
|
10222
10216
|
width: l,
|
|
@@ -10224,7 +10218,7 @@ function zm({
|
|
|
10224
10218
|
loading: "eager"
|
|
10225
10219
|
}
|
|
10226
10220
|
),
|
|
10227
|
-
|
|
10221
|
+
D > 1 && /* @__PURE__ */ a(U, { children: [
|
|
10228
10222
|
/* @__PURE__ */ e(
|
|
10229
10223
|
E,
|
|
10230
10224
|
{
|
|
@@ -10249,7 +10243,7 @@ function zm({
|
|
|
10249
10243
|
children: /* @__PURE__ */ e(er, { className: "h-4 w-4" })
|
|
10250
10244
|
}
|
|
10251
10245
|
),
|
|
10252
|
-
/* @__PURE__ */ e("div", { className: "absolute bottom-2 left-1/2 -translate-x-1/2 flex items-center gap-1 rounded-full bg-background/80 px-2 py-1", children: Array.from({ length:
|
|
10246
|
+
/* @__PURE__ */ e("div", { className: "absolute bottom-2 left-1/2 -translate-x-1/2 flex items-center gap-1 rounded-full bg-background/80 px-2 py-1", children: Array.from({ length: D }).map((O, V) => {
|
|
10253
10247
|
const se = V === g;
|
|
10254
10248
|
return /* @__PURE__ */ e(
|
|
10255
10249
|
"button",
|
|
@@ -10260,7 +10254,7 @@ function zm({
|
|
|
10260
10254
|
se ? "bg-foreground" : "bg-muted-foreground/40 hover:bg-muted-foreground/60"
|
|
10261
10255
|
].join(" "),
|
|
10262
10256
|
onClick: () => A(V),
|
|
10263
|
-
"aria-label": `Go to image ${V + 1} of ${
|
|
10257
|
+
"aria-label": `Go to image ${V + 1} of ${D}`,
|
|
10264
10258
|
"aria-current": se ? "true" : void 0
|
|
10265
10259
|
},
|
|
10266
10260
|
V
|
|
@@ -10301,16 +10295,16 @@ function yi({
|
|
|
10301
10295
|
withSpecification: !1
|
|
10302
10296
|
}, {
|
|
10303
10297
|
skip: !!n || !o
|
|
10304
|
-
}), [S] = Wo(),
|
|
10298
|
+
}), [S] = Wo(), D = n ?? b?.Distribution?.Inventory;
|
|
10305
10299
|
K(() => {
|
|
10306
10300
|
d(!1);
|
|
10307
10301
|
}, [r]);
|
|
10308
|
-
const { inventoryQuantity: k, totalIncomingQuantity:
|
|
10309
|
-
if (!
|
|
10302
|
+
const { inventoryQuantity: k, totalIncomingQuantity: I } = ye(() => {
|
|
10303
|
+
if (!D || D.length === 0)
|
|
10310
10304
|
return { inventoryQuantity: 0, totalIncomingQuantity: 0 };
|
|
10311
|
-
const $ =
|
|
10305
|
+
const $ = D.reduce((z, _) => z + (_.AvailableQuantity || 0), 0), q = D.reduce((z, _) => z + (_.PurchaseOrderQuantity || 0), 0);
|
|
10312
10306
|
return { inventoryQuantity: $, totalIncomingQuantity: q };
|
|
10313
|
-
}, [
|
|
10307
|
+
}, [D]);
|
|
10314
10308
|
if (w || x || y || C)
|
|
10315
10309
|
return /* @__PURE__ */ e("div", { ref: l, children: /* @__PURE__ */ e(f, { className: v("h-10 w-36 rounded-md", i) }) });
|
|
10316
10310
|
const M = () => {
|
|
@@ -10325,7 +10319,7 @@ function yi({
|
|
|
10325
10319
|
g(!1);
|
|
10326
10320
|
}));
|
|
10327
10321
|
};
|
|
10328
|
-
if (!
|
|
10322
|
+
if (!D)
|
|
10329
10323
|
return /* @__PURE__ */ e("div", { ref: l, children: /* @__PURE__ */ e(ke, { children: /* @__PURE__ */ a(we, { children: [
|
|
10330
10324
|
/* @__PURE__ */ e(Se, { asChild: !0, children: /* @__PURE__ */ e("span", { tabIndex: 0, children: /* @__PURE__ */ a(E, { disabled: !0, size: s, variant: "outline", className: v("text-sm", i), children: [
|
|
10331
10325
|
/* @__PURE__ */ e(Zt, { size: "16", className: "mr-2" }),
|
|
@@ -10333,7 +10327,7 @@ function yi({
|
|
|
10333
10327
|
] }) }) }),
|
|
10334
10328
|
/* @__PURE__ */ e(ve, { children: /* @__PURE__ */ e("p", { children: "No inventory data could be found for this product." }) })
|
|
10335
10329
|
] }) }) });
|
|
10336
|
-
if (N?.IsReseller && k <= 0 &&
|
|
10330
|
+
if (N?.IsReseller && k <= 0 && I <= 0)
|
|
10337
10331
|
return /* @__PURE__ */ e("div", { ref: l, children: /* @__PURE__ */ a($e, { open: c, onOpenChange: m, children: [
|
|
10338
10332
|
/* @__PURE__ */ e(xa, { asChild: !0, children: /* @__PURE__ */ a(E, { variant: "outline", size: s, className: v("text-sm text-primary", i), children: [
|
|
10339
10333
|
/* @__PURE__ */ e(Zt, { size: "16", className: "mr-2" }),
|
|
@@ -10351,7 +10345,7 @@ function yi({
|
|
|
10351
10345
|
] })
|
|
10352
10346
|
] })
|
|
10353
10347
|
] }) });
|
|
10354
|
-
const A = k <= 0 &&
|
|
10348
|
+
const A = k <= 0 && I > 0;
|
|
10355
10349
|
return /* @__PURE__ */ e("div", { ref: l, children: /* @__PURE__ */ a($e, { open: h, onOpenChange: d, children: [
|
|
10356
10350
|
/* @__PURE__ */ e(xa, { asChild: !0, children: /* @__PURE__ */ a(
|
|
10357
10351
|
E,
|
|
@@ -10366,7 +10360,7 @@ function yi({
|
|
|
10366
10360
|
children: [
|
|
10367
10361
|
/* @__PURE__ */ e(Zt, { size: "16", className: "mr-2" }),
|
|
10368
10362
|
A ? /* @__PURE__ */ a(U, { children: [
|
|
10369
|
-
xt(
|
|
10363
|
+
xt(I),
|
|
10370
10364
|
" Incoming"
|
|
10371
10365
|
] }) : k > 0 ? /* @__PURE__ */ a(U, { children: [
|
|
10372
10366
|
xt(k),
|
|
@@ -10380,7 +10374,7 @@ function yi({
|
|
|
10380
10374
|
/* @__PURE__ */ e(Zt, { className: "mr-2", size: 18 }),
|
|
10381
10375
|
"Inventory Information"
|
|
10382
10376
|
] }) }),
|
|
10383
|
-
/* @__PURE__ */ e(Ts, { inventory:
|
|
10377
|
+
/* @__PURE__ */ e(Ts, { inventory: D })
|
|
10384
10378
|
] })
|
|
10385
10379
|
] }) });
|
|
10386
10380
|
}
|
|
@@ -10400,7 +10394,7 @@ function Hr({
|
|
|
10400
10394
|
customAction: u = /* @__PURE__ */ e(U, {}),
|
|
10401
10395
|
showUsdLabelOnCost: h = !1
|
|
10402
10396
|
}) {
|
|
10403
|
-
const d = Nc(), { toast: c } = Ee(), [m, p] = T(1), [g, N] = T(null), [w, x] = T(0), [b, y] = T(!1), [C] = Go(), [S,
|
|
10397
|
+
const d = Nc(), { toast: c } = Ee(), [m, p] = T(1), [g, N] = T(null), [w, x] = T(0), [b, y] = T(!1), [C] = Go(), [S, D] = T(!1), [k, I] = T(null), [L, M] = T("idle"), [A, $] = T(null), [q] = Ko(), z = r?.Distribution?.Cost || 0, _ = r?.Distribution?.RegularPrice || 0, O = r?.Distribution?.Price || 0, V = !!(t && r?.RandmarSKU);
|
|
10404
10398
|
K(() => {
|
|
10405
10399
|
p(1), N(null), x(0);
|
|
10406
10400
|
}, [r?.RandmarSKU]), K(() => {
|
|
@@ -10416,7 +10410,7 @@ function Hr({
|
|
|
10416
10410
|
l || p(1);
|
|
10417
10411
|
}, [l]), K(() => {
|
|
10418
10412
|
if (!S) {
|
|
10419
|
-
|
|
10413
|
+
I(null), M("idle"), $(null);
|
|
10420
10414
|
return;
|
|
10421
10415
|
}
|
|
10422
10416
|
if (!t || !r?.RandmarSKU) {
|
|
@@ -10436,7 +10430,7 @@ function Hr({
|
|
|
10436
10430
|
if (j) return;
|
|
10437
10431
|
if ("error" in Ie && Ie.error)
|
|
10438
10432
|
throw Ie.error;
|
|
10439
|
-
|
|
10433
|
+
I(Ie.data ?? null), M("detailed");
|
|
10440
10434
|
const _e = await q({
|
|
10441
10435
|
routeApplicationId: t,
|
|
10442
10436
|
randmarSku: ge,
|
|
@@ -10445,7 +10439,7 @@ function Hr({
|
|
|
10445
10439
|
if (j) return;
|
|
10446
10440
|
if ("error" in _e && _e.error)
|
|
10447
10441
|
throw _e.error;
|
|
10448
|
-
|
|
10442
|
+
I(_e.data ?? Ie.data ?? null), M("complete");
|
|
10449
10443
|
} catch (Ie) {
|
|
10450
10444
|
if (j) return;
|
|
10451
10445
|
console.error("Failed to load performance data for product modal", Ie), M("error"), $("We couldn't load the performance details. Please try again.");
|
|
@@ -10973,7 +10967,7 @@ function Hr({
|
|
|
10973
10967
|
variant: "outline",
|
|
10974
10968
|
type: "button",
|
|
10975
10969
|
className: "h-11 px-4 text-sm font-medium justify-start w-full",
|
|
10976
|
-
onClick: () =>
|
|
10970
|
+
onClick: () => D(!0),
|
|
10977
10971
|
disabled: !V,
|
|
10978
10972
|
children: [
|
|
10979
10973
|
/* @__PURE__ */ e(zl, { className: "mr-2" }),
|
|
@@ -10998,7 +10992,7 @@ function Hr({
|
|
|
10998
10992
|
] })
|
|
10999
10993
|
] })
|
|
11000
10994
|
] }) }),
|
|
11001
|
-
/* @__PURE__ */ e($e, { open: S, onOpenChange:
|
|
10995
|
+
/* @__PURE__ */ e($e, { open: S, onOpenChange: D, children: /* @__PURE__ */ a(Be, { className: "w-[min(95vw,1100px)] max-w-5xl space-y-6", children: [
|
|
11002
10996
|
/* @__PURE__ */ a(qe, { children: [
|
|
11003
10997
|
/* @__PURE__ */ e(He, { children: "Monthly Sales Performance" }),
|
|
11004
10998
|
/* @__PURE__ */ a(Ge, { children: [
|
|
@@ -11070,7 +11064,7 @@ function Ni({ randmarSKU: t, sceneName: r, size: n = "md", alt: s, secondaryCont
|
|
|
11070
11064
|
), { data: C, isFetching: S } = Xo(
|
|
11071
11065
|
{ productNumber: t },
|
|
11072
11066
|
{ skip: !y || !l }
|
|
11073
|
-
),
|
|
11067
|
+
), D = w || b;
|
|
11074
11068
|
function k() {
|
|
11075
11069
|
if (C)
|
|
11076
11070
|
try {
|
|
@@ -11080,7 +11074,7 @@ function Ni({ randmarSKU: t, sceneName: r, size: n = "md", alt: s, secondaryCont
|
|
|
11080
11074
|
console.error("Error downloading video:", A);
|
|
11081
11075
|
}
|
|
11082
11076
|
}
|
|
11083
|
-
function
|
|
11077
|
+
function I() {
|
|
11084
11078
|
const A = `/Product/${encodeURIComponent(t)}/Video`;
|
|
11085
11079
|
navigator.clipboard.writeText(At(A, c)), h(!0), setTimeout(() => h(!1), 2e3);
|
|
11086
11080
|
}
|
|
@@ -11117,7 +11111,7 @@ Repeat and ask me what to change or improve until we are done creating pictures.
|
|
|
11117
11111
|
] }),
|
|
11118
11112
|
/* @__PURE__ */ a("div", { className: "absolute top-2 right-12 flex gap-1", children: [
|
|
11119
11113
|
/* @__PURE__ */ e(ke, { children: /* @__PURE__ */ a(we, { children: [
|
|
11120
|
-
/* @__PURE__ */ e(Se, { asChild: !0, children: /* @__PURE__ */ e(E, { variant: "secondary", size: "icon", onClick:
|
|
11114
|
+
/* @__PURE__ */ e(Se, { asChild: !0, children: /* @__PURE__ */ e(E, { variant: "secondary", size: "icon", onClick: I, "aria-label": "Copy video link", children: u ? /* @__PURE__ */ e(ct, { className: "h-4 w-4" }) : /* @__PURE__ */ e(tr, { className: "h-4 w-4" }) }) }),
|
|
11121
11115
|
/* @__PURE__ */ e(ve, { children: /* @__PURE__ */ e("p", { children: "Copy video link" }) })
|
|
11122
11116
|
] }) }),
|
|
11123
11117
|
/* @__PURE__ */ e(ke, { children: /* @__PURE__ */ a(we, { children: [
|
|
@@ -11128,7 +11122,7 @@ Repeat and ask me what to change or improve until we are done creating pictures.
|
|
|
11128
11122
|
] }) })
|
|
11129
11123
|
) }) }),
|
|
11130
11124
|
/* @__PURE__ */ a("div", { className: "relative w-max h-max", ref: p, children: [
|
|
11131
|
-
|
|
11125
|
+
D ? (
|
|
11132
11126
|
// Use the Skeleton component while checking for the image or fetching its URL.
|
|
11133
11127
|
/* @__PURE__ */ e(f, { className: "rounded-md", style: { width: m, height: m } })
|
|
11134
11128
|
) : x ? (
|
|
@@ -12737,8 +12731,8 @@ function Wr(t) {
|
|
|
12737
12731
|
if (l) {
|
|
12738
12732
|
const b = l.trim(), [y, C, S] = b.split(":");
|
|
12739
12733
|
if (p = Number.parseInt(y ?? "0", 10), g = Number.parseInt(C ?? "0", 10), S) {
|
|
12740
|
-
const [
|
|
12741
|
-
N = Number.parseInt(
|
|
12734
|
+
const [D, k] = S.split(".");
|
|
12735
|
+
N = Number.parseInt(D ?? "0", 10), k && (w = Number.parseInt(k.slice(0, 3).padEnd(3, "0"), 10));
|
|
12742
12736
|
}
|
|
12743
12737
|
}
|
|
12744
12738
|
if (!Number.isFinite(p) || !Number.isFinite(g) || !Number.isFinite(N) || !Number.isFinite(w))
|
|
@@ -12853,13 +12847,13 @@ function qf({
|
|
|
12853
12847
|
O && x(O);
|
|
12854
12848
|
}
|
|
12855
12849
|
}, [m, p, n, w, g?.IsManufacturer]);
|
|
12856
|
-
const C = !n && (d || m), S = p?.Title || p?.RandmarTitle || p?.RandmarSKU || "Product",
|
|
12850
|
+
const C = !n && (d || m), S = p?.Title || p?.RandmarTitle || p?.RandmarSKU || "Product", D = p?.VoiceoverCaption || "", k = typeof p?.MAP == "number" && p.MAP > 0 ? p.MAP : typeof p?.Distribution?.MAP == "number" && p.Distribution.MAP > 0 ? p.Distribution.MAP : null, I = typeof p?.MSRP == "number" && p.MSRP > 0 ? p.MSRP : typeof p?.Distribution?.MSRP == "number" && p.Distribution.MSRP > 0 ? p.Distribution.MSRP : null, L = s ? p?.Opportunities?.find((z) => z.BidNumber === s)?.Price : null, M = typeof L == "number" && L > 0 ? L : typeof p?.Distribution?.Price == "number" && p.Distribution.Price > 0 ? p.Distribution.Price : null, A = C || typeof M == "number", $ = typeof k == "number" && typeof M == "number" ? k - M : null, q = typeof $ == "number" && typeof k == "number" && k > 0 ? Math.round($ / k * 100) : null;
|
|
12857
12851
|
return /* @__PURE__ */ a("div", { className: "@container", children: [
|
|
12858
12852
|
/* @__PURE__ */ a("div", { className: "grid gap-4 grid-cols-1 @md:grid-cols-3", children: [
|
|
12859
12853
|
/* @__PURE__ */ a(Q, { className: "@md:col-span-2", children: [
|
|
12860
12854
|
/* @__PURE__ */ a(Z, { className: "space-y-2", children: [
|
|
12861
12855
|
/* @__PURE__ */ e(fe, { className: "text-2xl font-semibold leading-tight", children: C && !p ? /* @__PURE__ */ e(f, { className: "h-7 w-2/3" }) : S }),
|
|
12862
|
-
|
|
12856
|
+
D ? /* @__PURE__ */ e("div", { className: "text-sm text-muted-foreground", children: D }) : C && !p ? /* @__PURE__ */ e(f, { className: "h-4 w-4/5" }) : null
|
|
12863
12857
|
] }),
|
|
12864
12858
|
/* @__PURE__ */ a(G, { className: "space-y-6", children: [
|
|
12865
12859
|
/* @__PURE__ */ a("div", { className: "rounded-lg border bg-card p-4", children: [
|
|
@@ -12923,7 +12917,7 @@ function qf({
|
|
|
12923
12917
|
) }),
|
|
12924
12918
|
/* @__PURE__ */ e(ve, { children: "Manufacturer's Suggested Retail Price — a reference retail list price." })
|
|
12925
12919
|
] }) }),
|
|
12926
|
-
/* @__PURE__ */ e("div", { className: "font-medium", children: typeof
|
|
12920
|
+
/* @__PURE__ */ e("div", { className: "font-medium", children: typeof I == "number" ? ue(I) : "—" })
|
|
12927
12921
|
] }) })
|
|
12928
12922
|
] }) })
|
|
12929
12923
|
] }),
|
|
@@ -13718,29 +13712,29 @@ function ki({
|
|
|
13718
13712
|
applicationId: t
|
|
13719
13713
|
}, {
|
|
13720
13714
|
skip: !t
|
|
13721
|
-
}), g = ae((
|
|
13715
|
+
}), g = ae((I, L, M) => {
|
|
13722
13716
|
l((A) => ({
|
|
13723
13717
|
...A,
|
|
13724
|
-
[
|
|
13725
|
-
...A[
|
|
13718
|
+
[I]: {
|
|
13719
|
+
...A[I],
|
|
13726
13720
|
[L]: M
|
|
13727
13721
|
}
|
|
13728
13722
|
}));
|
|
13729
|
-
}, []), [N] = ac(), w = ae(async (
|
|
13723
|
+
}, []), [N] = ac(), w = ae(async (I) => {
|
|
13730
13724
|
if (!p?.IsReseller) return;
|
|
13731
|
-
if (!
|
|
13725
|
+
if (!I.BidNumber) {
|
|
13732
13726
|
s({ title: "Error", description: "Bid Number is missing, cannot set default.", variant: "destructive" });
|
|
13733
13727
|
return;
|
|
13734
13728
|
}
|
|
13735
|
-
const L =
|
|
13729
|
+
const L = I.BidNumber;
|
|
13736
13730
|
g(L, "isSettingDefault", !0), N({
|
|
13737
13731
|
routeResellerId: t,
|
|
13738
|
-
manufacturerId:
|
|
13732
|
+
manufacturerId: I.ManufacturerId ?? "",
|
|
13739
13733
|
opportunityNumber: L
|
|
13740
13734
|
}).unwrap().then(() => {
|
|
13741
13735
|
s({
|
|
13742
13736
|
title: "Success",
|
|
13743
|
-
description: `Opportunity "${
|
|
13737
|
+
description: `Opportunity "${I.OpportunityName || I.Opportunity || L}" was successfully set as default.`,
|
|
13744
13738
|
variant: "success"
|
|
13745
13739
|
});
|
|
13746
13740
|
}).catch((M) => {
|
|
@@ -13752,13 +13746,13 @@ function ki({
|
|
|
13752
13746
|
}).finally(() => {
|
|
13753
13747
|
g(L, "isSettingDefault", !1);
|
|
13754
13748
|
});
|
|
13755
|
-
}, [t, N, s, g, p?.IsReseller]), [x] = rc(), b = ae((
|
|
13749
|
+
}, [t, N, s, g, p?.IsReseller]), [x] = rc(), b = ae((I) => {
|
|
13756
13750
|
if (p?.IsReseller) {
|
|
13757
|
-
if (!
|
|
13751
|
+
if (!I.BidNumber) {
|
|
13758
13752
|
s({ title: "Error", description: "Bid Number is missing, cannot prepare report.", variant: "destructive" });
|
|
13759
13753
|
return;
|
|
13760
13754
|
}
|
|
13761
|
-
m(
|
|
13755
|
+
m(I), d(""), u(!0);
|
|
13762
13756
|
}
|
|
13763
13757
|
}, [s, p?.IsReseller]), y = ae(async () => {
|
|
13764
13758
|
if (!p?.IsReseller) return;
|
|
@@ -13770,16 +13764,16 @@ function ki({
|
|
|
13770
13764
|
s({ title: "Validation Error", description: "Please enter a valid email address.", variant: "destructive" });
|
|
13771
13765
|
return;
|
|
13772
13766
|
}
|
|
13773
|
-
const
|
|
13774
|
-
g(
|
|
13767
|
+
const I = c.BidNumber;
|
|
13768
|
+
g(I, "isSendingReport", !0), x({
|
|
13775
13769
|
routeResellerId: t,
|
|
13776
13770
|
manufacturerId: c.ManufacturerId ?? "",
|
|
13777
|
-
bidNumber:
|
|
13771
|
+
bidNumber: I,
|
|
13778
13772
|
emailAddress: h
|
|
13779
13773
|
}).unwrap().then(() => {
|
|
13780
13774
|
s({
|
|
13781
13775
|
title: "Success",
|
|
13782
|
-
description: `A report for "${c.OpportunityName || c.Opportunity ||
|
|
13776
|
+
description: `A report for "${c.OpportunityName || c.Opportunity || I}" was successfully sent to ${h}.`,
|
|
13783
13777
|
variant: "success"
|
|
13784
13778
|
}), u(!1);
|
|
13785
13779
|
}).catch((L) => {
|
|
@@ -13789,17 +13783,17 @@ function ki({
|
|
|
13789
13783
|
variant: "destructive"
|
|
13790
13784
|
});
|
|
13791
13785
|
}).finally(() => {
|
|
13792
|
-
g(
|
|
13786
|
+
g(I, "isSendingReport", !1), o || (m(null), d(""));
|
|
13793
13787
|
});
|
|
13794
13788
|
}, [c, h, t, x, s, g, u]), C = ye(
|
|
13795
13789
|
() => [
|
|
13796
13790
|
{
|
|
13797
13791
|
accessorKey: "ManufacturerId",
|
|
13798
13792
|
header: "Manuf.",
|
|
13799
|
-
cell: ({ row:
|
|
13793
|
+
cell: ({ row: I }) => /* @__PURE__ */ e("div", { className: "w-20 h-8", children: /* @__PURE__ */ e(
|
|
13800
13794
|
vt,
|
|
13801
13795
|
{
|
|
13802
|
-
id:
|
|
13796
|
+
id: I.original.ManufacturerId,
|
|
13803
13797
|
width: 80,
|
|
13804
13798
|
height: 32
|
|
13805
13799
|
}
|
|
@@ -13809,24 +13803,24 @@ function ki({
|
|
|
13809
13803
|
},
|
|
13810
13804
|
{
|
|
13811
13805
|
id: "opportunityDisplay",
|
|
13812
|
-
accessorFn: (
|
|
13806
|
+
accessorFn: (I) => I.OpportunityName || I.Opportunity,
|
|
13813
13807
|
header: "Opportunity",
|
|
13814
|
-
cell: ({ getValue:
|
|
13808
|
+
cell: ({ getValue: I }) => /* @__PURE__ */ e("div", { className: "min-w-[150px]", children: I() ?? "N/A" }),
|
|
13815
13809
|
enableSorting: !0,
|
|
13816
13810
|
enableFiltering: !0
|
|
13817
13811
|
},
|
|
13818
13812
|
{
|
|
13819
13813
|
accessorKey: "BidNumber",
|
|
13820
13814
|
header: "Bid Number",
|
|
13821
|
-
cell: ({ row:
|
|
13815
|
+
cell: ({ row: I }) => I.original.BidNumber ?? "N/A",
|
|
13822
13816
|
enableSorting: !0,
|
|
13823
13817
|
enableFiltering: !0
|
|
13824
13818
|
},
|
|
13825
13819
|
{
|
|
13826
13820
|
id: "statusInfo",
|
|
13827
13821
|
header: "Status",
|
|
13828
|
-
cell: ({ row:
|
|
13829
|
-
const L =
|
|
13822
|
+
cell: ({ row: I }) => {
|
|
13823
|
+
const L = I.original, M = L.Active === !0, A = Ih(L.EndDate), $ = M ? "success" : "secondary", q = A.variant === "destructive" ? "destructive" : A.variant === "warning" ? "warning" : "secondary";
|
|
13830
13824
|
return /* @__PURE__ */ a("div", { className: "flex items-center space-x-2 min-w-[200px]", children: [
|
|
13831
13825
|
/* @__PURE__ */ e(xe, { variant: $, className: "font-medium", children: M ? "Active" : "Inactive" }),
|
|
13832
13826
|
L.EndDate && /* @__PURE__ */ e(xe, { variant: q, className: "font-medium", children: A.text }),
|
|
@@ -13857,8 +13851,8 @@ function ki({
|
|
|
13857
13851
|
{
|
|
13858
13852
|
id: "actions",
|
|
13859
13853
|
header: "Actions",
|
|
13860
|
-
cell: ({ row:
|
|
13861
|
-
const L =
|
|
13854
|
+
cell: ({ row: I }) => {
|
|
13855
|
+
const L = I.original;
|
|
13862
13856
|
if (!L.BidNumber)
|
|
13863
13857
|
return /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: "Actions unavailable" });
|
|
13864
13858
|
const M = L.BidNumber, A = i[M]?.isSettingDefault, $ = c?.BidNumber === M && i[M]?.isSendingReport, q = A || $, z = L.CanBeSetAsDefault === !0, _ = p?.IsManufacturer ? `/${t}/Opportunity/${L.BidNumber}` : `/${t}/Opportunity/${L.ManufacturerId}/${L.BidNumber}`;
|
|
@@ -13890,19 +13884,19 @@ function ki({
|
|
|
13890
13884
|
t
|
|
13891
13885
|
]
|
|
13892
13886
|
), S = ye(() => {
|
|
13893
|
-
const
|
|
13887
|
+
const I = {};
|
|
13894
13888
|
if (r) {
|
|
13895
13889
|
const L = Array.from(
|
|
13896
13890
|
new Set(r.map((A) => A.ManufacturerId).filter((A) => A != null))
|
|
13897
13891
|
);
|
|
13898
|
-
|
|
13892
|
+
I.ManufacturerId = L;
|
|
13899
13893
|
const M = Array.from(
|
|
13900
13894
|
new Set(r.map((A) => A.OpportunityName || A.Opportunity).filter((A) => A != null))
|
|
13901
13895
|
);
|
|
13902
|
-
|
|
13896
|
+
I.opportunityDisplay = M;
|
|
13903
13897
|
}
|
|
13904
|
-
return
|
|
13905
|
-
}, [r]),
|
|
13898
|
+
return I;
|
|
13899
|
+
}, [r]), D = r || [], k = c?.BidNumber ? i[c.BidNumber]?.isSendingReport : !1;
|
|
13906
13900
|
return n ? /* @__PURE__ */ a(Q, { className: "w-full", children: [
|
|
13907
13901
|
/* @__PURE__ */ a(Z, { children: [
|
|
13908
13902
|
" ",
|
|
@@ -13932,10 +13926,10 @@ function ki({
|
|
|
13932
13926
|
/* @__PURE__ */ e(fe, { className: "text-1xl font-bold", children: "Opportunities" }),
|
|
13933
13927
|
" "
|
|
13934
13928
|
] }),
|
|
13935
|
-
/* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(Qt, { columns: C, data:
|
|
13929
|
+
/* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(Qt, { columns: C, data: D, uniqueValues: S }) })
|
|
13936
13930
|
] }),
|
|
13937
|
-
/* @__PURE__ */ e($e, { open: o, onOpenChange: (
|
|
13938
|
-
u(
|
|
13931
|
+
/* @__PURE__ */ e($e, { open: o, onOpenChange: (I) => {
|
|
13932
|
+
u(I), I || (m(null), d(""));
|
|
13939
13933
|
}, children: /* @__PURE__ */ a(Be, { className: "@sm:max-w-[425px]", children: [
|
|
13940
13934
|
/* @__PURE__ */ a(qe, { children: [
|
|
13941
13935
|
/* @__PURE__ */ e(He, { children: "Send Opportunity Report" }),
|
|
@@ -13951,7 +13945,7 @@ function ki({
|
|
|
13951
13945
|
] }),
|
|
13952
13946
|
/* @__PURE__ */ e("div", { className: "grid gap-4 py-4", children: /* @__PURE__ */ a("div", { className: "grid grid-cols-4 items-center gap-4", children: [
|
|
13953
13947
|
/* @__PURE__ */ e(X, { htmlFor: "email", className: "text-right", children: "Email" }),
|
|
13954
|
-
/* @__PURE__ */ e(le, { id: "email", type: "email", value: h, onChange: (
|
|
13948
|
+
/* @__PURE__ */ e(le, { id: "email", type: "email", value: h, onChange: (I) => d(I.target.value), placeholder: "recipient@example.com", className: "col-span-3", disabled: k })
|
|
13955
13949
|
] }) }),
|
|
13956
13950
|
/* @__PURE__ */ a(Ke, { children: [
|
|
13957
13951
|
/* @__PURE__ */ e(E, { variant: "outline", onClick: () => u(!1), disabled: k, children: "Cancel" }),
|
|
@@ -14047,11 +14041,11 @@ const Ri = P.forwardRef(
|
|
|
14047
14041
|
if (y) {
|
|
14048
14042
|
const C = Lh(y);
|
|
14049
14043
|
if (C) {
|
|
14050
|
-
const { h: S, s:
|
|
14044
|
+
const { h: S, s: D, l: k } = C;
|
|
14051
14045
|
c({
|
|
14052
|
-
minColor: Ar(S,
|
|
14053
|
-
midColor: Ar(S,
|
|
14054
|
-
maxColor: Ar(S,
|
|
14046
|
+
minColor: Ar(S, D, Math.min(100, k + 50)),
|
|
14047
|
+
midColor: Ar(S, D, Math.min(100, k + 35)),
|
|
14048
|
+
maxColor: Ar(S, D, Math.min(100, k + 20))
|
|
14055
14049
|
});
|
|
14056
14050
|
}
|
|
14057
14051
|
return !0;
|