randmarcomps 1.644.0 → 1.645.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 +13 -13
- package/dist/randmarcomps.js +232 -230
- 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 I = y[S];
|
|
495
|
+
S === 0 || S === 2 || S === 4 ? /[A-Z]/.test(I) && (C += I) : (S === 1 || S === 3 || S === 5) && /[0-9]/.test(I) && (C += I);
|
|
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 Wc(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", D = k ? "bg-background" : "bg-background/70 text-muted-foreground", L =
|
|
777
|
+
const s = (y, C, S = !1, I = !0) => {
|
|
778
|
+
const k = y.WarehouseType === "Fulfillment Center", D = k ? "bg-background" : "bg-background/70 text-muted-foreground", L = I && 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":
|
|
@@ -788,7 +788,7 @@ function Ts({ inventory: t, showBinLocation: r, className: n }) {
|
|
|
788
788
|
q = "bg-randmar-purple text-primary-foreground ring-1 ring-randmar-purple/40";
|
|
789
789
|
break;
|
|
790
790
|
}
|
|
791
|
-
switch (
|
|
791
|
+
switch (A) {
|
|
792
792
|
case "Opening":
|
|
793
793
|
q = "bg-success text-success-foreground ring-1 ring-success/40";
|
|
794
794
|
break;
|
|
@@ -813,11 +813,11 @@ function Ts({ inventory: t, showBinLocation: r, className: n }) {
|
|
|
813
813
|
{
|
|
814
814
|
className: `inline-flex items-center gap-2 rounded-full px-2 py-0.5 text-xs font-semibold ${q}`,
|
|
815
815
|
"aria-hidden": "false",
|
|
816
|
-
title: $ ? k ? "Fulfillment Center" : "Satellite Warehouse" : `Status: ${
|
|
816
|
+
title: $ ? k ? "Fulfillment Center" : "Satellite Warehouse" : `Status: ${A}`,
|
|
817
817
|
children: [
|
|
818
818
|
k ? /* @__PURE__ */ e(Yi, { className: "h-3 w-3", "aria-hidden": "true" }) : /* @__PURE__ */ e(wa, { className: `h-3 w-3 ${$ ? "opacity-80" : "opacity-95"}`, "aria-hidden": "true" }),
|
|
819
|
-
/* @__PURE__ */ e("span", { className: "sr-only", children: $ ? y.WarehouseType ? `${y.WarehouseType} warehouse` : "Warehouse" : `Status: ${
|
|
820
|
-
/* @__PURE__ */ e("span", { "aria-hidden": "true", children: $ ? y.WarehouseType || (k ? "Fulfillment Center" : "Satellite") :
|
|
819
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: $ ? y.WarehouseType ? `${y.WarehouseType} warehouse` : "Warehouse" : `Status: ${A}` }),
|
|
820
|
+
/* @__PURE__ */ e("span", { "aria-hidden": "true", children: $ ? y.WarehouseType || (k ? "Fulfillment Center" : "Satellite") : A })
|
|
821
821
|
]
|
|
822
822
|
}
|
|
823
823
|
)
|
|
@@ -1118,17 +1118,17 @@ const ad = "sidebar:state", rd = 3600 * 24 * 7, nd = "16rem", sd = "3rem", id =
|
|
|
1118
1118
|
...h
|
|
1119
1119
|
}, d) => {
|
|
1120
1120
|
const c = td(), 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
|
+
(I) => {
|
|
1122
|
+
const k = typeof I == "function" ? I(x) : I;
|
|
1123
1123
|
i ? i(k) : w(k), document.cookie = `${ad}=${k}; path=/; max-age=${rd}`;
|
|
1124
1124
|
},
|
|
1125
1125
|
[i, x]
|
|
1126
|
-
), y = P.useCallback(() => m ? g((
|
|
1126
|
+
), y = P.useCallback(() => m ? g((I) => !I) : b((I) => !I), [m, b, g]);
|
|
1127
1127
|
P.useEffect(() => {
|
|
1128
|
-
const
|
|
1128
|
+
const I = (k) => {
|
|
1129
1129
|
k.key === id && (k.metaKey || k.ctrlKey) && (k.preventDefault(), y());
|
|
1130
1130
|
};
|
|
1131
|
-
return window.addEventListener("keydown",
|
|
1131
|
+
return window.addEventListener("keydown", I), () => window.removeEventListener("keydown", I);
|
|
1132
1132
|
}, [y]);
|
|
1133
1133
|
const C = x ? "expanded" : "collapsed", S = P.useMemo(
|
|
1134
1134
|
() => ({
|
|
@@ -1816,25 +1816,25 @@ function Pf({ appID: t, manufPath: r, withBot: n }) {
|
|
|
1816
1816
|
{ skip: !s }
|
|
1817
1817
|
), h = ye(() => (u ?? l)?.slice() ?? [], [l, u]), [d, c] = T(""), [m, p] = T([]), [g, N] = T("az"), [w, x] = T(!1), [b, y] = T(!1), C = ye(() => {
|
|
1818
1818
|
const M = /* @__PURE__ */ new Map();
|
|
1819
|
-
for (const
|
|
1820
|
-
for (const $ of Br(
|
|
1819
|
+
for (const A of h)
|
|
1820
|
+
for (const $ of Br(A.Tags)) {
|
|
1821
1821
|
const q = Js($);
|
|
1822
1822
|
M.has(q) || M.set(q, $);
|
|
1823
1823
|
}
|
|
1824
|
-
return Array.from(M.entries()).map(([
|
|
1825
|
-
}, [h]), S = d.trim().length > 0 || m.length > 0 || g !== "az" || w || b,
|
|
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, I = ae(() => {
|
|
1826
1826
|
c(""), p([]), N("az"), x(!1), y(!1);
|
|
1827
1827
|
}, []), { sendMessage: k } = Na(), D = ae(
|
|
1828
1828
|
(M) => {
|
|
1829
|
-
const
|
|
1830
|
-
k(`Search for ${
|
|
1829
|
+
const A = M?.trim().length > 0 ? M.trim() : "this manufacturer";
|
|
1830
|
+
k(`Search for ${A} and tell me more about this manufacturer.`);
|
|
1831
1831
|
},
|
|
1832
1832
|
[k]
|
|
1833
1833
|
), L = ye(() => {
|
|
1834
|
-
const M = d.trim().toLocaleLowerCase(),
|
|
1834
|
+
const M = d.trim().toLocaleLowerCase(), A = new Set(m), q = h.filter((z) => {
|
|
1835
1835
|
if (w && !z.OpenToWork || b && !Od(z)) return !1;
|
|
1836
1836
|
const _ = Td(z);
|
|
1837
|
-
if (
|
|
1837
|
+
if (A.size > 0 && !_.some((O) => A.has(O))) return !1;
|
|
1838
1838
|
if (M.length > 0) {
|
|
1839
1839
|
const O = Va(z).toLocaleLowerCase(), V = Br(z.Tags).map((me) => me.toLocaleLowerCase());
|
|
1840
1840
|
if (!(O.includes(M) || V.some((me) => me.includes(M)))) return !1;
|
|
@@ -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: I, children: "Clear filters" })
|
|
1865
1865
|
] }),
|
|
1866
1866
|
/* @__PURE__ */ e(
|
|
1867
1867
|
"div",
|
|
@@ -1870,7 +1870,7 @@ function Pf({ appID: t, manufPath: r, withBot: n }) {
|
|
|
1870
1870
|
"aria-labelledby": "manufacturer-categories-label",
|
|
1871
1871
|
"aria-describedby": "manufacturer-categories-help",
|
|
1872
1872
|
className: "flex flex-wrap gap-2",
|
|
1873
|
-
children: C.length === 0 ? /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "No categories available." }) : C.map(({ key: M, label:
|
|
1873
|
+
children: C.length === 0 ? /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "No categories available." }) : C.map(({ key: M, label: A }) => {
|
|
1874
1874
|
const $ = m.includes(M);
|
|
1875
1875
|
return /* @__PURE__ */ e(
|
|
1876
1876
|
E,
|
|
@@ -1884,7 +1884,7 @@ function Pf({ appID: t, manufPath: r, withBot: n }) {
|
|
|
1884
1884
|
(q) => q.includes(M) ? q.filter((z) => z !== M) : [...q, M]
|
|
1885
1885
|
);
|
|
1886
1886
|
},
|
|
1887
|
-
children:
|
|
1887
|
+
children: A
|
|
1888
1888
|
},
|
|
1889
1889
|
M
|
|
1890
1890
|
);
|
|
@@ -1948,7 +1948,7 @@ function Pf({ appID: t, manufPath: r, withBot: n }) {
|
|
|
1948
1948
|
h.length,
|
|
1949
1949
|
" manufacturers"
|
|
1950
1950
|
] }),
|
|
1951
|
-
o && h.length === 0 ? /* @__PURE__ */ e("div", { className: "grid grid-cols-1 @md:grid-cols-1 @lg:grid-cols-2 @xl:grid-cols-3 gap-4", children: Array.from({ length: 9 }).map((M,
|
|
1951
|
+
o && h.length === 0 ? /* @__PURE__ */ e("div", { className: "grid grid-cols-1 @md:grid-cols-1 @lg:grid-cols-2 @xl:grid-cols-3 gap-4", children: Array.from({ length: 9 }).map((M, A) => /* @__PURE__ */ e(va, { loading: !0 }, A)) }) : L.length > 0 ? /* @__PURE__ */ e("div", { className: "grid grid-cols-1 @md:grid-cols-1 @lg:grid-cols-2 @xl:grid-cols-3 gap-4", children: L.map((M, A) => {
|
|
1952
1952
|
const $ = Va(M);
|
|
1953
1953
|
return /* @__PURE__ */ e(
|
|
1954
1954
|
va,
|
|
@@ -1970,11 +1970,11 @@ function Pf({ appID: t, manufPath: r, withBot: n }) {
|
|
|
1970
1970
|
) : void 0,
|
|
1971
1971
|
mainAction: /* @__PURE__ */ e(yi, { applicationId: t, manufacturer: M })
|
|
1972
1972
|
},
|
|
1973
|
-
M.ManufacturerId ?? `${$}-${
|
|
1973
|
+
M.ManufacturerId ?? `${$}-${A}`
|
|
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: I, disabled: !S, children: "Reset filters" })
|
|
1978
1978
|
] }) })
|
|
1979
1979
|
] })
|
|
1980
1980
|
] });
|
|
@@ -2433,7 +2433,7 @@ function yu({
|
|
|
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 } = rn(),
|
|
2436
|
+
}), [t, r, m]), { toast: y } = Ee(), { data: C, isLoading: S } = rn(), I = C?.Name || C?.EmailAddress || "User", k = C?.Role || "Partner", [D] = vs(), [L] = ho(), [M] = fo(), A = (z) => {
|
|
2437
2437
|
if (!C?.ApplicationId || !C.EmailAddress) {
|
|
2438
2438
|
y({
|
|
2439
2439
|
title: "Not ready",
|
|
@@ -2445,12 +2445,12 @@ function yu({
|
|
|
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 && I && N(I);
|
|
2449
|
+
}, [g, I]), K(() => {
|
|
2450
2450
|
w === null && k && x(k);
|
|
2451
2451
|
}, [w, k]);
|
|
2452
2452
|
const $ = () => {
|
|
2453
|
-
g && g !==
|
|
2453
|
+
g && g !== I && g.trim() !== "" && D({ fieldName: "Name", newValue: g }).unwrap().then(() => {
|
|
2454
2454
|
y({ title: "Success", description: "Name updated successfully" });
|
|
2455
2455
|
});
|
|
2456
2456
|
}, q = () => {
|
|
@@ -2556,7 +2556,7 @@ function yu({
|
|
|
2556
2556
|
Aa,
|
|
2557
2557
|
{
|
|
2558
2558
|
disabled: S || !C,
|
|
2559
|
-
onCheckedChange:
|
|
2559
|
+
onCheckedChange: A,
|
|
2560
2560
|
checked: C?.Notifications?.find((z) => z.NotificationType === "PartnerChatNotifications") !== void 0
|
|
2561
2561
|
}
|
|
2562
2562
|
)
|
|
@@ -2711,8 +2711,8 @@ const wu = Xa(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 I = typeof S?.mimeType == "string" ? S.mimeType.trim() : "", k = typeof S?.base64Data == "string" ? S.base64Data.replace(/\s+/g, "") : "";
|
|
2715
|
+
return !I.startsWith("image/") || k.length === 0 ? null : `data:${I};base64,${k}`;
|
|
2716
2716
|
}).filter((S) => !!S), [r.images]);
|
|
2717
2717
|
return /* @__PURE__ */ e(
|
|
2718
2718
|
"div",
|
|
@@ -2842,8 +2842,8 @@ const wu = Xa(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 I = typeof S?.mimeType == "string" ? S.mimeType.trim() : "", k = typeof S?.base64Data == "string" ? S.base64Data.replace(/\s+/g, "") : "";
|
|
2846
|
+
return !I.startsWith("image/") || k.length === 0 ? null : `data:${I};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 }),
|
|
@@ -2958,22 +2958,22 @@ const wu = Xa(function({
|
|
|
2958
2958
|
const D = /* @__PURE__ */ new Set();
|
|
2959
2959
|
let L = null;
|
|
2960
2960
|
for (const M of r) {
|
|
2961
|
-
const
|
|
2962
|
-
|
|
2961
|
+
const A = (M.senderName ?? "").trim();
|
|
2962
|
+
A && (L === A ? D.add(M.id) : L = A);
|
|
2963
2963
|
}
|
|
2964
2964
|
return D;
|
|
2965
|
-
}, [r]), S = l ?? (i ? "assistant" : "dashboard"),
|
|
2965
|
+
}, [r]), S = l ?? (i ? "assistant" : "dashboard"), I = S === "assistant" ? Su : wu, k = S === "assistant" ? vu : Nu;
|
|
2966
2966
|
return /* @__PURE__ */ a("div", { className: S === "dashboard" ? "py-3" : "", children: [
|
|
2967
2967
|
r.map((D) => {
|
|
2968
|
-
const L = D.fromPartnerID === n, M = !!(u && i && L && m && g && p),
|
|
2968
|
+
const L = D.fromPartnerID === n, M = !!(u && i && L && m && g && p), A = !!(u && i && L && N), $ = !!(i && !L && (D.content ?? "").trim().length > 0), q = h === D.id;
|
|
2969
2969
|
return /* @__PURE__ */ e(
|
|
2970
|
-
|
|
2970
|
+
I,
|
|
2971
2971
|
{
|
|
2972
2972
|
message: D,
|
|
2973
2973
|
isCurrentUser: L,
|
|
2974
2974
|
hideSenderName: o || C.has(D.id),
|
|
2975
2975
|
canEdit: M,
|
|
2976
|
-
canRetry:
|
|
2976
|
+
canRetry: A,
|
|
2977
2977
|
canCopy: $,
|
|
2978
2978
|
isCopied: w === D.id,
|
|
2979
2979
|
isEditing: q,
|
|
@@ -3208,7 +3208,7 @@ const Ru = ({ 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 = dr(), { data: l, refetch: o } = xo({ 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 } = mu({ applicationId: t, outputFormat: "text", useProModel: !0 }), [y, C] = T(!1), [S] = Ka(), [
|
|
3211
|
+
const { setHasUnreads: s } = Na(), i = dr(), { data: l, refetch: o } = xo({ 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 } = mu({ applicationId: t, outputFormat: "text", useProModel: !0 }), [y, C] = T(!1), [S] = Ka(), [I] = No(), [k] = vo(), [D] = wo(), [L, M] = T(!1);
|
|
3212
3212
|
K(() => {
|
|
3213
3213
|
l && (se((W) => {
|
|
3214
3214
|
const oe = l.map((ee) => {
|
|
@@ -3227,10 +3227,10 @@ function Df({ appID: t, inputRef: r, className: n }) {
|
|
|
3227
3227
|
return oe.sort(ha), oe;
|
|
3228
3228
|
}), h(!0), setTimeout(() => Xe.current?.focus(), 50));
|
|
3229
3229
|
}, [l, t]);
|
|
3230
|
-
const [
|
|
3230
|
+
const [A, $] = T(void 0), [q, z] = T(""), [_, O] = T(null), [V, se] = T([]), [me, Ve] = T(null), Re = ce(null), Qe = ce(null), [Ue, We] = T([]), Xe = r || Qe, ie = ce(null), { toast: pe } = Ee(), H = () => V.find((W) => W.partner1 === A?.[0] && W.partner2 === A?.[1]), Y = ae(async () => {
|
|
3231
3231
|
if (d) return;
|
|
3232
3232
|
c(!0);
|
|
3233
|
-
const W =
|
|
3233
|
+
const W = A;
|
|
3234
3234
|
try {
|
|
3235
3235
|
We([]), O(null);
|
|
3236
3236
|
const be = ((await o()).data ?? []).map((Oe) => ({
|
|
@@ -3273,14 +3273,14 @@ function Df({ appID: t, inputRef: r, className: n }) {
|
|
|
3273
3273
|
} finally {
|
|
3274
3274
|
c(!1);
|
|
3275
3275
|
}
|
|
3276
|
-
}, [
|
|
3276
|
+
}, [A, t, k, d, o, pe]), J = ae(async () => {
|
|
3277
3277
|
if (!m) {
|
|
3278
3278
|
p(!0);
|
|
3279
3279
|
try {
|
|
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 I({ 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, I, pe]);
|
|
3297
3297
|
function te() {
|
|
3298
3298
|
const W = H();
|
|
3299
|
-
W &&
|
|
3299
|
+
W && I({ routeApplicationId: t, conversationId: W.conversationID });
|
|
3300
3300
|
}
|
|
3301
3301
|
const Ne = (W) => We((oe) => [...oe, W]);
|
|
3302
3302
|
K(() => {
|
|
@@ -3315,10 +3315,10 @@ function Df({ appID: t, inputRef: r, className: n }) {
|
|
|
3315
3315
|
if (rt.some((nt) => nt.id === ee.id)) return Fe;
|
|
3316
3316
|
let Oe = 1;
|
|
3317
3317
|
const Ye = document.activeElement && document.activeElement === Xe.current;
|
|
3318
|
-
return
|
|
3318
|
+
return A?.[0] == Fe.partner1 && A[1] == Fe.partner2 && Ye && (Ye && (Oe = 0, te()), setTimeout(() => Re.current?.scrollIntoView({ behavior: "smooth" }), 50)), { ...Fe, pending: !1, unread: Fe.unread + Oe, messages: [...rt, ee] };
|
|
3319
3319
|
}).sort(ha));
|
|
3320
3320
|
}), console.log("need refetch:", oe), oe && o(), We([]);
|
|
3321
|
-
}, [Ue, We, se, $,
|
|
3321
|
+
}, [Ue, We, se, $, A]), K(() => {
|
|
3322
3322
|
const W = new hc().withUrl(At("/hub", i), {
|
|
3323
3323
|
accessTokenFactory: () => localStorage.getItem("access_token"),
|
|
3324
3324
|
headers: { "X-Impersonated-Id": t }
|
|
@@ -3327,9 +3327,9 @@ function Df({ appID: t, inputRef: r, className: n }) {
|
|
|
3327
3327
|
W && W.stop();
|
|
3328
3328
|
};
|
|
3329
3329
|
}, [t, i]), K(() => {
|
|
3330
|
-
!
|
|
3331
|
-
}, [
|
|
3332
|
-
if (!
|
|
3330
|
+
!A || !H() || (Xe.current?.focus(), setTimeout(() => Re.current?.scrollIntoView({ behavior: "smooth" }), 50));
|
|
3331
|
+
}, [A]), K(() => {
|
|
3332
|
+
if (!A) return;
|
|
3333
3333
|
const W = H();
|
|
3334
3334
|
W && W.conversationID !== -1 && (async () => {
|
|
3335
3335
|
try {
|
|
@@ -3353,20 +3353,20 @@ function Df({ appID: t, inputRef: r, className: n }) {
|
|
|
3353
3353
|
console.error("Error fetching conversation messages:", oe);
|
|
3354
3354
|
}
|
|
3355
3355
|
})();
|
|
3356
|
-
}, [
|
|
3357
|
-
if (!
|
|
3356
|
+
}, [A, k, t]), K(() => {
|
|
3357
|
+
if (!A) return;
|
|
3358
3358
|
const W = H();
|
|
3359
3359
|
if (!W) return;
|
|
3360
3360
|
const oe = document.activeElement && document.activeElement === Xe.current;
|
|
3361
|
-
W.unread > 0 && oe && (te(), se((ee) => ee.map((be) => be.partner1 ===
|
|
3362
|
-
}, [
|
|
3361
|
+
W.unread > 0 && oe && (te(), se((ee) => ee.map((be) => be.partner1 === A[0] && be.partner2 === A[1] ? { ...be, unread: 0 } : be)));
|
|
3362
|
+
}, [A, V]);
|
|
3363
3363
|
const { sendMessage: Me } = Na(), Pe = ae((W) => {
|
|
3364
3364
|
Me(`We have been talking with another Randmar partner and would like you to have the conversation as context for follow-up questions. Please acknowledge your reception of this chat history (one line summary of recent messages will do) and let me know that you're ready to answer questions: ${JSON.stringify(W, null, 2)}`);
|
|
3365
3365
|
}, [Me]), ze = ae(async () => {
|
|
3366
|
-
if (
|
|
3366
|
+
if (A)
|
|
3367
3367
|
try {
|
|
3368
3368
|
M(!0);
|
|
3369
|
-
const W = await x({ applicationId: t }), oe =
|
|
3369
|
+
const W = await x({ applicationId: t }), oe = A[0] === t ? A[1] : A[0], ee = await D({ routeApplicationId: t, partnerId: oe, withSpecification: !0 }), be = hu(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
|
-
}, [
|
|
3384
|
+
}, [A, x, D, Me, pe, t]);
|
|
3385
3385
|
K(() => {
|
|
3386
3386
|
s(V.some((W) => W.unread > 0));
|
|
3387
3387
|
}, [V, s]);
|
|
@@ -3399,7 +3399,7 @@ function Df({ appID: t, inputRef: r, className: n }) {
|
|
|
3399
3399
|
Ne(ee), me.invoke("NewMessage", ee).catch((be) => console.error("Error sending message:", be)), z(""), ie.current && (ie.current.value = "");
|
|
3400
3400
|
}, ge = () => {
|
|
3401
3401
|
const W = q.trim();
|
|
3402
|
-
!ht || !W || !
|
|
3402
|
+
!ht || !W || !A || !me || (ht.unread > 0 && (te(), se((oe) => oe.map((ee) => ee.partner1 === A[0] && ee.partner2 === A[1] ? { ...ee, unread: 0 } : ee))), j(ht, W));
|
|
3403
3403
|
}, Ae = (W, oe) => O([W, oe]);
|
|
3404
3404
|
K(() => {
|
|
3405
3405
|
if (_ === null) return;
|
|
@@ -3452,14 +3452,14 @@ function Df({ appID: t, inputRef: r, className: n }) {
|
|
|
3452
3452
|
w.current && (w.current.disabled = !1), C(!1);
|
|
3453
3453
|
}
|
|
3454
3454
|
}, Ht = () => {
|
|
3455
|
-
|
|
3455
|
+
A && g({ routeApplicationId: t, partnerId: A[0] == t ? A[1] : A[0] });
|
|
3456
3456
|
}, ht = H();
|
|
3457
3457
|
return /* @__PURE__ */ a("div", { className: v("flex grow-1 overflow-hidden", n), children: [
|
|
3458
3458
|
/* @__PURE__ */ e(
|
|
3459
3459
|
yu,
|
|
3460
3460
|
{
|
|
3461
3461
|
appID: t,
|
|
3462
|
-
activeChat:
|
|
3462
|
+
activeChat: A,
|
|
3463
3463
|
chats: V,
|
|
3464
3464
|
chatWithRandmarButton: w,
|
|
3465
3465
|
isStartingChat: y,
|
|
@@ -3474,7 +3474,7 @@ function Df({ appID: t, inputRef: r, className: n }) {
|
|
|
3474
3474
|
/* @__PURE__ */ e(
|
|
3475
3475
|
Cu,
|
|
3476
3476
|
{
|
|
3477
|
-
activeChat:
|
|
3477
|
+
activeChat: A,
|
|
3478
3478
|
activeChatObj: ht,
|
|
3479
3479
|
appID: t,
|
|
3480
3480
|
messagesEndRef: Re,
|
|
@@ -3652,13 +3652,13 @@ function Du({ 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 I = [
|
|
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
|
|
3661
|
+
for (const k of I) {
|
|
3662
3662
|
const D = k.value, L = t?.[k.apiKey];
|
|
3663
3663
|
if (D !== L && D !== void 0) {
|
|
3664
3664
|
S = !0;
|
|
@@ -3837,18 +3837,18 @@ function Ou({ manufacturer: t, readonly: r = !1, isLoading: n, onUnsavedChanges:
|
|
|
3837
3837
|
{ key: "customerServiceEmail", apiKey: "PublicEmail", value: k.customerServiceEmail },
|
|
3838
3838
|
{ key: "publicResources", apiKey: "PublicResourcesLink", value: k.publicResources }
|
|
3839
3839
|
];
|
|
3840
|
-
for (const
|
|
3841
|
-
const $ =
|
|
3840
|
+
for (const A of M) {
|
|
3841
|
+
const $ = A.value, q = t?.[A.apiKey], z = typeof q == "boolean" ? String(q) : q;
|
|
3842
3842
|
if ($ !== z && $ !== void 0) {
|
|
3843
3843
|
L = !0;
|
|
3844
3844
|
try {
|
|
3845
3845
|
await l({
|
|
3846
3846
|
applicationId: t?.ManufacturerId ?? "",
|
|
3847
|
-
fieldName:
|
|
3847
|
+
fieldName: A.apiKey,
|
|
3848
3848
|
newValue: String($)
|
|
3849
3849
|
}).unwrap() || (D = !1);
|
|
3850
3850
|
} catch (_) {
|
|
3851
|
-
console.error(`Error updating ${
|
|
3851
|
+
console.error(`Error updating ${A.apiKey}:`, _), D = !1;
|
|
3852
3852
|
}
|
|
3853
3853
|
}
|
|
3854
3854
|
}
|
|
@@ -3861,7 +3861,7 @@ function Ou({ manufacturer: t, readonly: r = !1, isLoading: n, onUnsavedChanges:
|
|
|
3861
3861
|
description: "Failed to update",
|
|
3862
3862
|
variant: "destructive"
|
|
3863
3863
|
});
|
|
3864
|
-
}, S = (k) => !k || k.trim() === "",
|
|
3864
|
+
}, S = (k) => !k || k.trim() === "", I = (k) => {
|
|
3865
3865
|
u(k);
|
|
3866
3866
|
};
|
|
3867
3867
|
return /* @__PURE__ */ a(Q, { children: [
|
|
@@ -3945,7 +3945,7 @@ function Ou({ manufacturer: t, readonly: r = !1, isLoading: n, onUnsavedChanges:
|
|
|
3945
3945
|
{
|
|
3946
3946
|
options: Tu,
|
|
3947
3947
|
selected: o,
|
|
3948
|
-
onChange:
|
|
3948
|
+
onChange: I,
|
|
3949
3949
|
placeholder: "Select or type categories...",
|
|
3950
3950
|
disabled: r
|
|
3951
3951
|
}
|
|
@@ -4011,7 +4011,7 @@ function Eu({ 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, I = !1;
|
|
4015
4015
|
const k = [
|
|
4016
4016
|
{ key: "partnerPortal", apiKey: "PartnerPortal", value: C.partnerPortal },
|
|
4017
4017
|
{ key: "partnerRegistrationLink", apiKey: "PartnerRegistrationLink", value: C.partnerRegistrationLink }
|
|
@@ -4019,23 +4019,23 @@ function Eu({ manufacturer: t, readonly: r = !1, isLoading: n, onUnsavedChanges:
|
|
|
4019
4019
|
for (const D of k) {
|
|
4020
4020
|
const L = D.value, M = t?.[D.apiKey];
|
|
4021
4021
|
if (L !== M && L !== void 0) {
|
|
4022
|
-
|
|
4022
|
+
I = !0;
|
|
4023
4023
|
try {
|
|
4024
4024
|
await l({
|
|
4025
4025
|
applicationId: t?.ManufacturerId ?? "",
|
|
4026
4026
|
fieldName: D.apiKey,
|
|
4027
4027
|
newValue: String(L)
|
|
4028
4028
|
}).unwrap() || (S = !1, console.error(`Failed to update ${D.apiKey}`));
|
|
4029
|
-
} catch (
|
|
4030
|
-
console.error(`Error updating ${D.apiKey}:`,
|
|
4029
|
+
} catch (A) {
|
|
4030
|
+
console.error(`Error updating ${D.apiKey}:`, A), S = !1;
|
|
4031
4031
|
}
|
|
4032
4032
|
}
|
|
4033
4033
|
}
|
|
4034
|
-
S &&
|
|
4034
|
+
S && I ? (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 ? I || 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 Lu({ manufacturerId: t, userEmail: r, isLoading: n }) {
|
|
|
4157
4157
|
}
|
|
4158
4158
|
]
|
|
4159
4159
|
}
|
|
4160
|
-
], [w, { isLoading: x }] = So(), [b, { isLoading: y }] = Co(), [C, { isLoading: S }] = ko(), [
|
|
4160
|
+
], [w, { isLoading: x }] = So(), [b, { isLoading: y }] = Co(), [C, { isLoading: S }] = ko(), [I, { isLoading: k }] = Ro(), [D, { isLoading: L }] = Po(), [M, { isLoading: A }] = Ao(), $ = 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,7 +4186,7 @@ function Lu({ manufacturerId: t, userEmail: r, isLoading: n }) {
|
|
|
4186
4186
|
}).unwrap();
|
|
4187
4187
|
break;
|
|
4188
4188
|
case "Reorder":
|
|
4189
|
-
await
|
|
4189
|
+
await I({
|
|
4190
4190
|
routeManufacturerId: t,
|
|
4191
4191
|
emailAddress: o
|
|
4192
4192
|
}).unwrap();
|
|
@@ -4358,7 +4358,7 @@ function Fu(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, I) => S + (I.Quantity || 0), 0), p = c.reduce((S, I) => S + (I.ExtendedPrice || 0), 0), g = h.filter((S) => S.WarehouseCode === "3PLE"), N = g.reduce((S, I) => S + (I.Quantity || 0), 0), w = g.reduce((S, I) => S + (I.ExtendedPrice || 0), 0), x = d.length, b = d.reduce((S, I) => S + (I.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 },
|
|
@@ -5272,9 +5272,9 @@ function Wu({
|
|
|
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, D) => c === "price-asc" ? (k.MAP ?? 0) - (D.MAP ?? 0) : c === "price-desc" ? (D.MAP ?? 0) - (k.MAP ?? 0) : c === "name" ? (k.Title ?? "").localeCompare(D.Title ?? "") : c === "percentile" ? (D.OverallPercentileRank ?? 0) - (k.OverallPercentileRank ?? 0) : 0) : [], [w?.Products, c]),
|
|
5275
|
+
}, C = () => r.Categories?.find((k) => k.CategoryCode === i)?.CategoryName || i, S = ye(() => w?.Products ? [...w.Products].sort((k, D) => c === "price-asc" ? (k.MAP ?? 0) - (D.MAP ?? 0) : c === "price-desc" ? (D.MAP ?? 0) - (k.MAP ?? 0) : c === "name" ? (k.Title ?? "").localeCompare(D.Title ?? "") : c === "percentile" ? (D.OverallPercentileRank ?? 0) - (k.OverallPercentileRank ?? 0) : 0) : [], [w?.Products, c]), I = ye(() => p ? S.filter((k) => {
|
|
5276
5276
|
const D = k.Distribution?.Inventory;
|
|
5277
|
-
return !Array.isArray(D) || D.length === 0 ? !1 : D.reduce((M,
|
|
5277
|
+
return !Array.isArray(D) || D.length === 0 ? !1 : D.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 Wu({
|
|
|
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, D) => /* @__PURE__ */ e(Wr, {}, D)) :
|
|
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, D) => /* @__PURE__ */ e(Wr, {}, D)) : I.length > 0 ? I.map((k) => /* @__PURE__ */ e(
|
|
5368
5368
|
Wr,
|
|
5369
5369
|
{
|
|
5370
5370
|
applicationId: t,
|
|
@@ -5596,31 +5596,31 @@ const Gu = ({ 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
|
|
5599
|
+
let I = !0, k = !1;
|
|
5600
5600
|
const D = Object.keys(S).map((L) => ({
|
|
5601
5601
|
key: L,
|
|
5602
5602
|
keyApi: L.charAt(0).toUpperCase() + L.slice(1)
|
|
5603
5603
|
}));
|
|
5604
5604
|
for (const L of D) {
|
|
5605
|
-
const M = S[L.key],
|
|
5606
|
-
if (M !==
|
|
5605
|
+
const M = S[L.key], A = t[L.keyApi];
|
|
5606
|
+
if (M !== A && M !== void 0) {
|
|
5607
5607
|
k = !0;
|
|
5608
5608
|
try {
|
|
5609
5609
|
await o({
|
|
5610
5610
|
applicationId: r,
|
|
5611
5611
|
fieldName: L.keyApi,
|
|
5612
5612
|
newValue: String(M)
|
|
5613
|
-
}).unwrap() || (
|
|
5613
|
+
}).unwrap() || (I = !1);
|
|
5614
5614
|
} catch ($) {
|
|
5615
|
-
console.error(`Error updating ${L.keyApi}:`, $),
|
|
5615
|
+
console.error(`Error updating ${L.keyApi}:`, $), I = !1;
|
|
5616
5616
|
}
|
|
5617
5617
|
}
|
|
5618
5618
|
}
|
|
5619
|
-
|
|
5619
|
+
I && 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)) : I || l({
|
|
5624
5624
|
title: "Updation error",
|
|
5625
5625
|
description: "Failed to update",
|
|
5626
5626
|
variant: "destructive"
|
|
@@ -5745,7 +5745,7 @@ const Gu = ({ reseller: t, appID: r, isLoading: n, readonly: s, onUnsavedChanges
|
|
|
5745
5745
|
] });
|
|
5746
5746
|
};
|
|
5747
5747
|
function Ku({ 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), [I, k] = T(h?.toString() || ""), [D, { isLoading: L }] = Lo(), 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" }),
|
|
@@ -5776,10 +5776,10 @@ function Ku({ appID: t, reseller: r, isLoading: n, withoutReports: s, userEmail:
|
|
|
5776
5776
|
] }),
|
|
5777
5777
|
icon: Wa
|
|
5778
5778
|
}
|
|
5779
|
-
], [
|
|
5779
|
+
], [A] = Fo(), $ = async (O) => {
|
|
5780
5780
|
O ? c(!0) : p(!0);
|
|
5781
5781
|
try {
|
|
5782
|
-
const se = (await
|
|
5782
|
+
const se = (await A({
|
|
5783
5783
|
routeResellerId: t,
|
|
5784
5784
|
documentNumber: `ST${t}`
|
|
5785
5785
|
})).data;
|
|
@@ -5970,7 +5970,7 @@ function Ku({ appID: t, reseller: r, isLoading: n, withoutReports: s, userEmail:
|
|
|
5970
5970
|
{
|
|
5971
5971
|
id: "creditLimit",
|
|
5972
5972
|
type: "number",
|
|
5973
|
-
value:
|
|
5973
|
+
value: I,
|
|
5974
5974
|
onChange: (O) => k(O.target.value),
|
|
5975
5975
|
className: "col-span-3",
|
|
5976
5976
|
placeholder: "0.00"
|
|
@@ -5982,7 +5982,7 @@ function Ku({ 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(I);
|
|
5986
5986
|
if (isNaN(O)) {
|
|
5987
5987
|
o({
|
|
5988
5988
|
title: "Invalid Amount",
|
|
@@ -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)), I = (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, D = (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,9 +6070,9 @@ $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 = I(O);
|
|
6074
6074
|
L("Priority", V, `Priority updated to ${V}`, "Failed to update priority");
|
|
6075
|
-
},
|
|
6075
|
+
}, A = async (O) => {
|
|
6076
6076
|
y(O);
|
|
6077
6077
|
const V = k(O);
|
|
6078
6078
|
L("ShippingProfile", V, `Shipping profile updated to ${V}`, "Failed to update shipping profile");
|
|
@@ -6201,7 +6201,7 @@ $10 with opportunities under $1,000` : t === "D" ? "$15 under $1,500" : t === "E
|
|
|
6201
6201
|
] }),
|
|
6202
6202
|
/* @__PURE__ */ a("div", { className: "bg-muted/30 p-2 rounded-lg", children: [
|
|
6203
6203
|
/* @__PURE__ */ e(X, { className: "block mb-1 text-xs font-medium", children: "Shipping Profile" }),
|
|
6204
|
-
/* @__PURE__ */ e(pa, { value: b, onValueChange:
|
|
6204
|
+
/* @__PURE__ */ e(pa, { value: b, onValueChange: A, className: "grid grid-cols-1 @md:grid-cols-2 gap-1", children: [{ value: "free", label: "Free (A)" }, { value: "fixed", label: "Fixed $10 Shipping (B)" }, { value: "dropshipped", label: "$15 for drop shipped (C)" }, { value: "under1500", label: "15$ under 1,500 (D)" }, { value: "fullcharges", label: "Full shipping charges (E)" }].map((O) => /* @__PURE__ */ a("div", { className: "flex items-center space-x-1", children: [
|
|
6205
6205
|
/* @__PURE__ */ e(Rt, { value: O.value, id: `shipping-${O.value}`, className: "h-6 w-6 scale-50" }),
|
|
6206
6206
|
/* @__PURE__ */ e(X, { htmlFor: `shipping-${O.value}`, className: "cursor-pointer text-xs", children: O.label })
|
|
6207
6207
|
] }, O.value)) })
|
|
@@ -6309,12 +6309,12 @@ function tm({ openOrders: t = [], isLoading: r = !1 }) {
|
|
|
6309
6309
|
] });
|
|
6310
6310
|
}
|
|
6311
6311
|
function am({ isLoading: t, userEmail: r, appID: n }) {
|
|
6312
|
-
const { toast: s } = Ee(), [i, { isLoading: l }] = $o(), [o, { isLoading: u }] = Bo(), [h, { isLoading: d }] = zo(), [c, { isLoading: m }] = Rs(), [p, { isLoading: g }] = Vo(), [N, { isLoading: w }] = ks(), [x, b] = T(null), [y, C] = T(r), [S,
|
|
6312
|
+
const { toast: s } = Ee(), [i, { isLoading: l }] = $o(), [o, { isLoading: u }] = Bo(), [h, { isLoading: d }] = zo(), [c, { isLoading: m }] = Rs(), [p, { isLoading: g }] = Vo(), [N, { isLoading: w }] = ks(), [x, b] = T(null), [y, C] = T(r), [S, I] = T(!1), [k, D] = T("all"), { data: L, isLoading: M } = Or(
|
|
6313
6313
|
{
|
|
6314
6314
|
routeApplicationId: n,
|
|
6315
6315
|
withSpecification: !1
|
|
6316
6316
|
}
|
|
6317
|
-
),
|
|
6317
|
+
), A = [
|
|
6318
6318
|
{
|
|
6319
6319
|
name: "Products",
|
|
6320
6320
|
reports: [
|
|
@@ -6367,7 +6367,7 @@ function am({ isLoading: t, userEmail: r, appID: n }) {
|
|
|
6367
6367
|
]
|
|
6368
6368
|
}
|
|
6369
6369
|
], $ = async (_) => {
|
|
6370
|
-
b(_), _.id === "Products" && D("all"),
|
|
6370
|
+
b(_), _.id === "Products" && D("all"), I(!0);
|
|
6371
6371
|
}, q = async () => {
|
|
6372
6372
|
if (!(!x || !n))
|
|
6373
6373
|
try {
|
|
@@ -6417,7 +6417,7 @@ function am({ 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
|
+
}), I(!1);
|
|
6421
6421
|
} catch (_) {
|
|
6422
6422
|
console.error("Error requesting report:", _), s({
|
|
6423
6423
|
title: "Error",
|
|
@@ -6441,7 +6441,7 @@ function am({ isLoading: t, userEmail: r, appID: n }) {
|
|
|
6441
6441
|
] }),
|
|
6442
6442
|
/* @__PURE__ */ e(f, { className: "h-9 w-24" })
|
|
6443
6443
|
] }, O))
|
|
6444
|
-
] }, _)) }) : /* @__PURE__ */ e(U, { children:
|
|
6444
|
+
] }, _)) }) : /* @__PURE__ */ e(U, { children: A.map((_) => /* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
6445
6445
|
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold", children: _.name }),
|
|
6446
6446
|
_.reports.map((O) => /* @__PURE__ */ a(
|
|
6447
6447
|
"div",
|
|
@@ -6471,7 +6471,7 @@ function am({ 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: I, children: /* @__PURE__ */ a(Be, { children: [
|
|
6475
6475
|
/* @__PURE__ */ a(qe, { children: [
|
|
6476
6476
|
/* @__PURE__ */ a(He, { children: [
|
|
6477
6477
|
"Request ",
|
|
@@ -6515,7 +6515,7 @@ function am({ 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: () => I(!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, I] = y.split("-").map(Number);
|
|
6597
6597
|
return {
|
|
6598
|
-
date: new Date(S,
|
|
6598
|
+
date: new Date(S, I - 1).toLocaleString("default", { month: "short", year: "numeric" }),
|
|
6599
6599
|
dollarVolume: C.price,
|
|
6600
6600
|
unitsSold: C.quantity
|
|
6601
6601
|
};
|
|
@@ -6604,7 +6604,7 @@ 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,
|
|
6607
|
+
const S = y.price / N, I = y.quantity / N, k = S * C, D = I * C, L = c[c.length - 1];
|
|
6608
6608
|
L && (L.dollarVolume = k, L.unitsSold = D);
|
|
6609
6609
|
}
|
|
6610
6610
|
}
|
|
@@ -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, I) => /* @__PURE__ */ e(xe, { variant: "outline", children: S }, I))
|
|
6776
6776
|
] }),
|
|
6777
6777
|
/* @__PURE__ */ a("div", { className: "space-y-1 pt-2", children: [
|
|
6778
6778
|
t.Phone && /* @__PURE__ */ a(
|
|
@@ -6899,16 +6899,16 @@ function ui({
|
|
|
6899
6899
|
withSpecification: !1
|
|
6900
6900
|
}, {
|
|
6901
6901
|
skip: !!n || !o
|
|
6902
|
-
}), [S] = Uo(),
|
|
6902
|
+
}), [S] = Uo(), I = n ?? b?.Distribution?.Inventory;
|
|
6903
6903
|
K(() => {
|
|
6904
6904
|
d(!1);
|
|
6905
6905
|
}, [r]);
|
|
6906
6906
|
const { inventoryQuantity: k, totalIncomingQuantity: D } = ye(() => {
|
|
6907
|
-
if (!
|
|
6907
|
+
if (!I || I.length === 0)
|
|
6908
6908
|
return { inventoryQuantity: 0, totalIncomingQuantity: 0 };
|
|
6909
|
-
const $ =
|
|
6909
|
+
const $ = I.reduce((z, _) => z + (_.AvailableQuantity || 0), 0), q = I.reduce((z, _) => z + (_.PurchaseOrderQuantity || 0), 0);
|
|
6910
6910
|
return { inventoryQuantity: $, totalIncomingQuantity: q };
|
|
6911
|
-
}, [
|
|
6911
|
+
}, [I]);
|
|
6912
6912
|
if (w || x || y || C)
|
|
6913
6913
|
return /* @__PURE__ */ e("div", { ref: l, children: /* @__PURE__ */ e(f, { className: v("h-10 w-36 rounded-md", i) }) });
|
|
6914
6914
|
const M = () => {
|
|
@@ -6923,7 +6923,7 @@ function ui({
|
|
|
6923
6923
|
g(!1);
|
|
6924
6924
|
}));
|
|
6925
6925
|
};
|
|
6926
|
-
if (!
|
|
6926
|
+
if (!I)
|
|
6927
6927
|
return /* @__PURE__ */ e("div", { ref: l, children: /* @__PURE__ */ e(ke, { children: /* @__PURE__ */ a(we, { children: [
|
|
6928
6928
|
/* @__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: [
|
|
6929
6929
|
/* @__PURE__ */ e(Zt, { size: "16", className: "mr-2" }),
|
|
@@ -6949,7 +6949,7 @@ function ui({
|
|
|
6949
6949
|
] })
|
|
6950
6950
|
] })
|
|
6951
6951
|
] }) });
|
|
6952
|
-
const
|
|
6952
|
+
const A = k <= 0 && D > 0;
|
|
6953
6953
|
return /* @__PURE__ */ e("div", { ref: l, children: /* @__PURE__ */ a($e, { open: h, onOpenChange: d, children: [
|
|
6954
6954
|
/* @__PURE__ */ e(xa, { asChild: !0, children: /* @__PURE__ */ a(
|
|
6955
6955
|
E,
|
|
@@ -6958,12 +6958,12 @@ function ui({
|
|
|
6958
6958
|
size: s,
|
|
6959
6959
|
className: v(
|
|
6960
6960
|
"text-sm",
|
|
6961
|
-
|
|
6961
|
+
A ? "text-info" : k > 0 ? "text-success" : "text-destructive",
|
|
6962
6962
|
i
|
|
6963
6963
|
),
|
|
6964
6964
|
children: [
|
|
6965
6965
|
/* @__PURE__ */ e(Zt, { size: "16", className: "mr-2" }),
|
|
6966
|
-
|
|
6966
|
+
A ? /* @__PURE__ */ a(U, { children: [
|
|
6967
6967
|
xt(D),
|
|
6968
6968
|
" Incoming"
|
|
6969
6969
|
] }) : k > 0 ? /* @__PURE__ */ a(U, { children: [
|
|
@@ -6978,7 +6978,7 @@ function ui({
|
|
|
6978
6978
|
/* @__PURE__ */ e(Zt, { className: "mr-2", size: 18 }),
|
|
6979
6979
|
"Inventory Information"
|
|
6980
6980
|
] }) }),
|
|
6981
|
-
/* @__PURE__ */ e(Ts, { inventory:
|
|
6981
|
+
/* @__PURE__ */ e(Ts, { inventory: I })
|
|
6982
6982
|
] })
|
|
6983
6983
|
] }) });
|
|
6984
6984
|
}
|
|
@@ -7169,12 +7169,12 @@ function rm({
|
|
|
7169
7169
|
// This should ideally make Qualifications include full Manufacturer details
|
|
7170
7170
|
}, { skip: !t || !m }), [w, x] = T({
|
|
7171
7171
|
publicInfo: { hasUnsavedChanges: !1 }
|
|
7172
|
-
}), b = ae(() => n ? !1 : w.publicInfo.hasUnsavedChanges, [n, w]), y = ae((
|
|
7173
|
-
x((q) => q[
|
|
7172
|
+
}), b = ae(() => n ? !1 : w.publicInfo.hasUnsavedChanges, [n, w]), y = ae((A, $) => {
|
|
7173
|
+
x((q) => q[A]?.hasUnsavedChanges !== $.hasUnsavedChanges ? {
|
|
7174
7174
|
...q,
|
|
7175
|
-
[
|
|
7175
|
+
[A]: $
|
|
7176
7176
|
} : q);
|
|
7177
|
-
}, []), { NavigationGuardDialog: C } = ii(b), S = p ?? r,
|
|
7177
|
+
}, []), { NavigationGuardDialog: C } = ii(b), S = p ?? r, I = g && !S, k = N && !S, D = !n || !!S?.Statement && (S.Statement.Total ?? 0) !== 0, L = S?.QualifiedManufacturers ?? [], M = S?.Qualifications ?? [];
|
|
7178
7178
|
return /* @__PURE__ */ a("div", { className: "@container", children: [
|
|
7179
7179
|
k ? /* @__PURE__ */ e(Q, { className: "p-6", children: /* @__PURE__ */ a(Tt, { variant: "destructive", children: [
|
|
7180
7180
|
/* @__PURE__ */ e(Nt, { className: "h-4 w-4" }),
|
|
@@ -7186,7 +7186,7 @@ function rm({
|
|
|
7186
7186
|
{
|
|
7187
7187
|
fiscalYearMonthStart: S?.FiscalYearMonthStart || 1,
|
|
7188
7188
|
salesData: S?.SalesData,
|
|
7189
|
-
isLoading:
|
|
7189
|
+
isLoading: I
|
|
7190
7190
|
}
|
|
7191
7191
|
),
|
|
7192
7192
|
/* @__PURE__ */ a("div", { className: "grid @lg:grid-cols-2 gap-6", children: [
|
|
@@ -7194,17 +7194,17 @@ function rm({
|
|
|
7194
7194
|
on,
|
|
7195
7195
|
{
|
|
7196
7196
|
statistics: S?.SalesStatistics ?? [],
|
|
7197
|
-
loading:
|
|
7197
|
+
loading: I
|
|
7198
7198
|
}
|
|
7199
7199
|
),
|
|
7200
|
-
/* @__PURE__ */ e(tm, { openOrders: S?.ActiveOrderDetails ?? [], isLoading:
|
|
7200
|
+
/* @__PURE__ */ e(tm, { openOrders: S?.ActiveOrderDetails ?? [], isLoading: I }),
|
|
7201
7201
|
D && /* @__PURE__ */ e(
|
|
7202
7202
|
Ku,
|
|
7203
7203
|
{
|
|
7204
7204
|
appID: t,
|
|
7205
7205
|
reseller: S || {},
|
|
7206
7206
|
withoutReports: l,
|
|
7207
|
-
isLoading:
|
|
7207
|
+
isLoading: I,
|
|
7208
7208
|
userEmail: s,
|
|
7209
7209
|
isSuperAdmin: i
|
|
7210
7210
|
}
|
|
@@ -7214,9 +7214,9 @@ function rm({
|
|
|
7214
7214
|
{
|
|
7215
7215
|
reseller: S || {},
|
|
7216
7216
|
appID: t ?? "",
|
|
7217
|
-
isLoading:
|
|
7217
|
+
isLoading: I,
|
|
7218
7218
|
readonly: n,
|
|
7219
|
-
onUnsavedChanges: (
|
|
7219
|
+
onUnsavedChanges: (A) => y("publicInfo", { hasUnsavedChanges: A })
|
|
7220
7220
|
}
|
|
7221
7221
|
),
|
|
7222
7222
|
/* @__PURE__ */ e(
|
|
@@ -7226,18 +7226,18 @@ function rm({
|
|
|
7226
7226
|
readonly: n,
|
|
7227
7227
|
reseller: S || {},
|
|
7228
7228
|
appID: t ?? "",
|
|
7229
|
-
isLoading:
|
|
7229
|
+
isLoading: I
|
|
7230
7230
|
}
|
|
7231
7231
|
),
|
|
7232
|
-
|
|
7232
|
+
I || L.length > 0 ? /* @__PURE__ */ a(Q, { className: "w-full", children: [
|
|
7233
7233
|
/* @__PURE__ */ e(Z, { children: /* @__PURE__ */ e(fe, { children: "Manufacturers you are qualified for" }) }),
|
|
7234
|
-
/* @__PURE__ */ e(G, { children: /* @__PURE__ */ e("div", { className: "grid @lg:grid-cols-2 gap-4", children:
|
|
7234
|
+
/* @__PURE__ */ e(G, { children: /* @__PURE__ */ e("div", { className: "grid @lg:grid-cols-2 gap-4", children: I ? Array.from({ length: 2 }).map((A, $) => /* @__PURE__ */ e(va, { loading: !0 }, $)) : L.map((A) => /* @__PURE__ */ e(
|
|
7235
7235
|
va,
|
|
7236
7236
|
{
|
|
7237
|
-
manufacturer:
|
|
7238
|
-
link: `https://dashboard.randmar.io/${t}/Partner/${
|
|
7237
|
+
manufacturer: A,
|
|
7238
|
+
link: `https://dashboard.randmar.io/${t}/Partner/${A.ManufacturerId}`
|
|
7239
7239
|
},
|
|
7240
|
-
|
|
7240
|
+
A.ManufacturerId
|
|
7241
7241
|
)) }) })
|
|
7242
7242
|
] }) : M.length > 0 && /* @__PURE__ */ e(
|
|
7243
7243
|
Wm,
|
|
@@ -7250,8 +7250,10 @@ function rm({
|
|
|
7250
7250
|
Ri,
|
|
7251
7251
|
{
|
|
7252
7252
|
applicationId: t,
|
|
7253
|
-
opportunities: S
|
|
7254
|
-
|
|
7253
|
+
opportunities: [...S.Opportunities].sort(
|
|
7254
|
+
(A, $) => new Date($.LastUpdate) - new Date(A.LastUpdate)
|
|
7255
|
+
),
|
|
7256
|
+
loading: I
|
|
7255
7257
|
}
|
|
7256
7258
|
),
|
|
7257
7259
|
(S?.ActiveOrderDetails?.length ?? 0) > 0 && /* @__PURE__ */ e(
|
|
@@ -7260,7 +7262,7 @@ function rm({
|
|
|
7260
7262
|
applicationId: t,
|
|
7261
7263
|
title: "Active Orders",
|
|
7262
7264
|
orders: S?.ActiveOrderDetails,
|
|
7263
|
-
loading:
|
|
7265
|
+
loading: I
|
|
7264
7266
|
}
|
|
7265
7267
|
),
|
|
7266
7268
|
(S?.CompletedOrderDetails?.length ?? 0) > 0 && /* @__PURE__ */ e(
|
|
@@ -7269,7 +7271,7 @@ function rm({
|
|
|
7269
7271
|
applicationId: t,
|
|
7270
7272
|
title: "Completed Orders",
|
|
7271
7273
|
orders: S?.CompletedOrderDetails,
|
|
7272
|
-
loading:
|
|
7274
|
+
loading: I
|
|
7273
7275
|
}
|
|
7274
7276
|
),
|
|
7275
7277
|
(S?.Returns?.length ?? 0) > 0 && /* @__PURE__ */ e(
|
|
@@ -7277,7 +7279,7 @@ function rm({
|
|
|
7277
7279
|
{
|
|
7278
7280
|
applicationId: t,
|
|
7279
7281
|
returns: S?.Returns,
|
|
7280
|
-
loading:
|
|
7282
|
+
loading: I
|
|
7281
7283
|
}
|
|
7282
7284
|
),
|
|
7283
7285
|
!l && /* @__PURE__ */ e(
|
|
@@ -7285,7 +7287,7 @@ function rm({
|
|
|
7285
7287
|
{
|
|
7286
7288
|
appID: t,
|
|
7287
7289
|
userEmail: s,
|
|
7288
|
-
isLoading:
|
|
7290
|
+
isLoading: I
|
|
7289
7291
|
}
|
|
7290
7292
|
)
|
|
7291
7293
|
] }),
|
|
@@ -8049,25 +8051,25 @@ function mm({
|
|
|
8049
8051
|
`loading-${C}`
|
|
8050
8052
|
))
|
|
8051
8053
|
] }) }) : 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) => {
|
|
8052
|
-
const S = w.has(y.id),
|
|
8054
|
+
const S = w.has(y.id), I = s || y.disabled === !0, k = `${N}-${C}-label`, D = `${N}-${C}-description`;
|
|
8053
8055
|
return /* @__PURE__ */ a(
|
|
8054
8056
|
"button",
|
|
8055
8057
|
{
|
|
8056
8058
|
type: "button",
|
|
8057
8059
|
role: "checkbox",
|
|
8058
8060
|
"aria-checked": S,
|
|
8059
|
-
"aria-disabled":
|
|
8061
|
+
"aria-disabled": I,
|
|
8060
8062
|
"aria-label": c?.(y) ?? y.label,
|
|
8061
8063
|
"aria-labelledby": m ? void 0 : k,
|
|
8062
8064
|
"aria-describedby": !m && y.description ? D : void 0,
|
|
8063
|
-
disabled:
|
|
8065
|
+
disabled: I,
|
|
8064
8066
|
onClick: () => b(y),
|
|
8065
8067
|
className: v(
|
|
8066
8068
|
"flex w-full items-start gap-3 rounded-xl border bg-card p-4 text-left shadow-sm transition-colors transition-shadow",
|
|
8067
8069
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
8068
8070
|
"hover:bg-muted/30 hover:shadow",
|
|
8069
8071
|
S ? "border-primary bg-primary/5 ring-2 ring-primary/20" : "border-border",
|
|
8070
|
-
|
|
8072
|
+
I && "cursor-not-allowed opacity-60 hover:bg-card hover:shadow-sm"
|
|
8071
8073
|
),
|
|
8072
8074
|
children: [
|
|
8073
8075
|
/* @__PURE__ */ e(
|
|
@@ -8083,7 +8085,7 @@ function mm({
|
|
|
8083
8085
|
),
|
|
8084
8086
|
/* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: m ? /* @__PURE__ */ a(U, { children: [
|
|
8085
8087
|
/* @__PURE__ */ e("span", { className: "sr-only", children: y.label }),
|
|
8086
|
-
m(y, { checked: S, disabled:
|
|
8088
|
+
m(y, { checked: S, disabled: I, index: C })
|
|
8087
8089
|
] }) : /* @__PURE__ */ a(U, { children: [
|
|
8088
8090
|
(y.prefix || y.emphasis) && /* @__PURE__ */ a("div", { className: "flex flex-wrap items-baseline gap-1 text-xs", children: [
|
|
8089
8091
|
y.prefix && /* @__PURE__ */ e("span", { className: "font-semibold uppercase tracking-wide text-muted-foreground", children: y.prefix }),
|
|
@@ -8275,7 +8277,7 @@ async function Sm(t) {
|
|
|
8275
8277
|
p.length > 0 && p[0].toLowerCase() === "v4" ? g = p.length > 1 ? p[1] : "api" : g = p.length > 0 ? p[0] : "api", g = g.replace(/[{}]/g, "");
|
|
8276
8278
|
const N = ym(u), w = `${c}-${g.toLowerCase()}-${N}`, x = {}, b = [];
|
|
8277
8279
|
m.parameters?.forEach((M) => {
|
|
8278
|
-
const
|
|
8280
|
+
const A = M.schema?.type, $ = A === "integer" || A === "number" ? "number" : A === "boolean" ? "boolean" : "string";
|
|
8279
8281
|
x[M.name] = {
|
|
8280
8282
|
type: $,
|
|
8281
8283
|
description: M.description || `The ${M.name} parameter`
|
|
@@ -8283,17 +8285,17 @@ async function Sm(t) {
|
|
|
8283
8285
|
});
|
|
8284
8286
|
const y = m.parameters?.filter((M) => M.in === "path").map((M) => M.name) || [];
|
|
8285
8287
|
if ((c === "post" || c === "put") && m.requestBody) {
|
|
8286
|
-
const M = wm(m.requestBody),
|
|
8288
|
+
const M = wm(m.requestBody), A = m.requestBody.description || bm;
|
|
8287
8289
|
if (M && Nm(M) && M.$ref.startsWith("#/components/schemas/")) {
|
|
8288
8290
|
const $ = M.$ref.substring(21), q = l.components.schemas[$], z = vm(q) ? q.properties : void 0, _ = z ? JSON.stringify(z) : "Refer to API schema for details.";
|
|
8289
8291
|
x[_a] = {
|
|
8290
8292
|
type: "string",
|
|
8291
|
-
description: `${
|
|
8293
|
+
description: `${A}. Must be a JSON string with these properties: ${_}`
|
|
8292
8294
|
};
|
|
8293
8295
|
} else
|
|
8294
8296
|
x[_a] = {
|
|
8295
8297
|
type: "string",
|
|
8296
|
-
description:
|
|
8298
|
+
description: A
|
|
8297
8299
|
};
|
|
8298
8300
|
b.push(_a);
|
|
8299
8301
|
}
|
|
@@ -8308,13 +8310,13 @@ ${m.description}` : m.summary || `${c.toUpperCase()} ${p[p.length - 1]}`,
|
|
|
8308
8310
|
required: b
|
|
8309
8311
|
}
|
|
8310
8312
|
}, S = async (M) => {
|
|
8311
|
-
let
|
|
8313
|
+
let A = u;
|
|
8312
8314
|
try {
|
|
8313
8315
|
y.forEach((Re) => {
|
|
8314
8316
|
const Qe = `{${Re}}`, We = M[Re];
|
|
8315
|
-
We != null && (
|
|
8317
|
+
We != null && (A = A.replace(Qe, encodeURIComponent(String(We))));
|
|
8316
8318
|
});
|
|
8317
|
-
const $ = At(
|
|
8319
|
+
const $ = At(A, n), q = localStorage.getItem("access_token"), z = {
|
|
8318
8320
|
method: c.toUpperCase(),
|
|
8319
8321
|
headers: {
|
|
8320
8322
|
Authorization: q ? `Bearer ${q}` : "",
|
|
@@ -8340,12 +8342,12 @@ ${m.description}` : m.summary || `${c.toUpperCase()} ${p[p.length - 1]}`,
|
|
|
8340
8342
|
} catch ($) {
|
|
8341
8343
|
return console.error(`Error in ${w}:`, $), `I'm sorry, I couldn't retrieve the requested information. Error: ${$ instanceof Error ? $.message : "Unknown error"}`;
|
|
8342
8344
|
}
|
|
8343
|
-
},
|
|
8345
|
+
}, I = m.tags?.[0] ?? "Partner", D = `${{
|
|
8344
8346
|
get: "Fetching",
|
|
8345
8347
|
put: "Inserting",
|
|
8346
8348
|
post: "Updating",
|
|
8347
8349
|
delete: "Deleting"
|
|
8348
|
-
}[c]} - ${
|
|
8350
|
+
}[c]} - ${I}.`, L = `${c} ${u}`;
|
|
8349
8351
|
o.push({
|
|
8350
8352
|
declaration: C,
|
|
8351
8353
|
handler: S,
|
|
@@ -8360,7 +8362,7 @@ ${m.description}` : m.summary || `${c.toUpperCase()} ${p[p.length - 1]}`,
|
|
|
8360
8362
|
}
|
|
8361
8363
|
}
|
|
8362
8364
|
function Cm({ userId: t, apiConfig: r, onGeneratedImageUploaded: n }) {
|
|
8363
|
-
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),
|
|
8365
|
+
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), I = ce(null), k = ce([]), D = ce([]), L = ce(/* @__PURE__ */ new Map()), [M] = ws(), [A] = Ns(), [$] = jo();
|
|
8364
8366
|
K(() => {
|
|
8365
8367
|
const H = async () => {
|
|
8366
8368
|
p(!0);
|
|
@@ -8476,7 +8478,7 @@ function Cm({ userId: t, apiConfig: r, onGeneratedImageUploaded: n }) {
|
|
|
8476
8478
|
}
|
|
8477
8479
|
try {
|
|
8478
8480
|
i("Thinking...");
|
|
8479
|
-
const J =
|
|
8481
|
+
const J = A({
|
|
8480
8482
|
applicationId: t,
|
|
8481
8483
|
body: H
|
|
8482
8484
|
});
|
|
@@ -8547,9 +8549,9 @@ function Cm({ userId: t, apiConfig: r, onGeneratedImageUploaded: n }) {
|
|
|
8547
8549
|
ze.name,
|
|
8548
8550
|
{ type: ze.type }
|
|
8549
8551
|
), ge = $({ applicationId: t, body: { file: j } });
|
|
8550
|
-
|
|
8552
|
+
I.current = ge;
|
|
8551
8553
|
const Ae = await ge.unwrap();
|
|
8552
|
-
if (
|
|
8554
|
+
if (I.current = null, C.current) {
|
|
8553
8555
|
i("");
|
|
8554
8556
|
return;
|
|
8555
8557
|
}
|
|
@@ -8574,7 +8576,7 @@ function Cm({ userId: t, apiConfig: r, onGeneratedImageUploaded: n }) {
|
|
|
8574
8576
|
const Me = { Role: "user", Parts: te }, Pe = [...D.current, Me];
|
|
8575
8577
|
x(Pe), D.current = Pe, J && L.current.set(J, Pe.length - 1), await me(Pe, 100);
|
|
8576
8578
|
} catch (te) {
|
|
8577
|
-
if (
|
|
8579
|
+
if (I.current = null, console.error("Error processing user request:", te), C.current || q(te)) {
|
|
8578
8580
|
i("");
|
|
8579
8581
|
return;
|
|
8580
8582
|
}
|
|
@@ -8587,11 +8589,11 @@ function Cm({ userId: t, apiConfig: r, onGeneratedImageUploaded: n }) {
|
|
|
8587
8589
|
const Y = H.id ?? crypto.randomUUID();
|
|
8588
8590
|
return o((J) => [...J, { ...H, id: Y }]), Y;
|
|
8589
8591
|
}, We = () => o([]), Xe = () => {
|
|
8590
|
-
C.current = !1, S.current?.abort?.(), S.current = null,
|
|
8592
|
+
C.current = !1, S.current?.abort?.(), S.current = null, I.current?.abort?.(), I.current = null;
|
|
8591
8593
|
for (const H of k.current) H?.abort?.();
|
|
8592
8594
|
k.current = [], x([]), D.current = [], L.current = /* @__PURE__ */ new Map(), c([]), h([]), o([]), i(""), y(0);
|
|
8593
8595
|
}, ie = () => {
|
|
8594
|
-
C.current = !0, c([]), S.current?.abort?.(), S.current = null,
|
|
8596
|
+
C.current = !0, c([]), S.current?.abort?.(), S.current = null, I.current?.abort?.(), I.current = null;
|
|
8595
8597
|
for (const H of k.current) H?.abort?.();
|
|
8596
8598
|
k.current = [], i("");
|
|
8597
8599
|
}, pe = async (H, Y) => {
|
|
@@ -8677,7 +8679,7 @@ const km = ({ debugMessages: t }) => {
|
|
|
8677
8679
|
const [u, h] = T(!1), [d, c] = T(!1), [m] = qo(), [p] = Qo(), { data: g, isLoading: N, isFetching: w } = Ho(
|
|
8678
8680
|
{ routeApplicationId: t },
|
|
8679
8681
|
{ skip: !t }
|
|
8680
|
-
), { data: x } = rn(), [b, y] = T([]), C = ei(), S = ce([]),
|
|
8682
|
+
), { data: x } = rn(), [b, y] = T([]), C = ei(), S = ce([]), I = ce(null), k = ae((R) => {
|
|
8681
8683
|
if (!R || R.length === 0) return;
|
|
8682
8684
|
const F = "Context (background only; do not quote/reveal): Latest image generation is available at URL";
|
|
8683
8685
|
S.current = S.current.filter((re) => !re.startsWith(F));
|
|
@@ -8686,11 +8688,11 @@ const km = ({ debugMessages: t }) => {
|
|
|
8686
8688
|
${B}`;
|
|
8687
8689
|
S.current.push(ne);
|
|
8688
8690
|
}, []), D = ae((R) => {
|
|
8689
|
-
R?.assistantMessageId && (!R?.urls || R.urls.length === 0 ||
|
|
8691
|
+
R?.assistantMessageId && (!R?.urls || R.urls.length === 0 || I.current !== R.assistantMessageId && (I.current = R.assistantMessageId, k(R.urls)));
|
|
8690
8692
|
}, [k]), {
|
|
8691
8693
|
handleSubmitToBot: L,
|
|
8692
8694
|
botMessages: M,
|
|
8693
|
-
clearBotMessages:
|
|
8695
|
+
clearBotMessages: A,
|
|
8694
8696
|
botReady: $,
|
|
8695
8697
|
debugMessages: q,
|
|
8696
8698
|
botStatus: z,
|
|
@@ -8810,8 +8812,8 @@ ${B}`;
|
|
|
8810
8812
|
content: F.content,
|
|
8811
8813
|
images: F.images
|
|
8812
8814
|
});
|
|
8813
|
-
R.length > 0 && y((F) => [...F, ...R]),
|
|
8814
|
-
}, [M,
|
|
8815
|
+
R.length > 0 && y((F) => [...F, ...R]), A();
|
|
8816
|
+
}, [M, A, t]);
|
|
8815
8817
|
const Sn = ae((R) => {
|
|
8816
8818
|
y((F) => [...F, R]);
|
|
8817
8819
|
}, []);
|
|
@@ -9644,7 +9646,7 @@ const Om = er(
|
|
|
9644
9646
|
const S = u.map((k) => {
|
|
9645
9647
|
const D = Tm(k.path, i), L = Mm(w.pathname, D, i);
|
|
9646
9648
|
return { route: k, linkPath: D, isActive: L };
|
|
9647
|
-
}),
|
|
9649
|
+
}), I = S.find((k) => k.isActive)?.route.label ?? "None";
|
|
9648
9650
|
return /* @__PURE__ */ a($s, { className: "border-r border-sidebar-border", children: [
|
|
9649
9651
|
/* @__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: [
|
|
9650
9652
|
/* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
@@ -9662,7 +9664,7 @@ const Om = er(
|
|
|
9662
9664
|
/* @__PURE__ */ e("p", { className: "text-xs font-semibold uppercase tracking-wide text-sidebar-foreground/70", children: "App Launchpad" }),
|
|
9663
9665
|
/* @__PURE__ */ a("p", { className: "mt-1 text-sm text-sidebar-foreground/85", children: [
|
|
9664
9666
|
"Current: ",
|
|
9665
|
-
/* @__PURE__ */ e("span", { className: "font-semibold text-sidebar-foreground", children:
|
|
9667
|
+
/* @__PURE__ */ e("span", { className: "font-semibold text-sidebar-foreground", children: I })
|
|
9666
9668
|
] })
|
|
9667
9669
|
] }),
|
|
9668
9670
|
/* @__PURE__ */ e("div", { className: "mt-4 grid grid-cols-3 gap-3", children: S.map(({ route: k, linkPath: D, isActive: L }) => {
|
|
@@ -9805,10 +9807,10 @@ const Xn = [
|
|
|
9805
9807
|
{ id: "other-market", label: "Other (please specify)" }
|
|
9806
9808
|
];
|
|
9807
9809
|
function yi({ applicationId: t, manufacturer: r }) {
|
|
9808
|
-
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([]), [
|
|
9810
|
+
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([]), [I, k] = T(""), [D, L] = T(""), [M, A] = T([]), [$, q] = T(""), [z, _] = T(""), [O] = Ka(), V = () => {
|
|
9809
9811
|
c(""), p("");
|
|
9810
9812
|
}, se = () => {
|
|
9811
|
-
x(""), y(""), S([]), k(""), L(""),
|
|
9813
|
+
x(""), y(""), S([]), k(""), L(""), A([]), q(""), _("");
|
|
9812
9814
|
}, me = () => {
|
|
9813
9815
|
r.PartnerRegistrationLink ? i(!0) : r.OpenToWork && o(!0);
|
|
9814
9816
|
}, Ve = (ie) => {
|
|
@@ -9868,7 +9870,7 @@ function yi({ applicationId: t, manufacturer: r }) {
|
|
|
9868
9870
|
}, Qe = (ie, pe) => {
|
|
9869
9871
|
S((H) => pe ? [...H, ie] : H.filter((Y) => Y !== ie)), k("");
|
|
9870
9872
|
}, Ue = (ie, pe) => {
|
|
9871
|
-
|
|
9873
|
+
A((H) => pe ? [...H, ie] : H.filter((Y) => Y !== ie)), q("");
|
|
9872
9874
|
}, We = C.includes("other-channel"), Xe = M.includes("other-market");
|
|
9873
9875
|
return /* @__PURE__ */ a(U, { children: [
|
|
9874
9876
|
!r.Qualification && /* @__PURE__ */ a(E, { onClick: me, disabled: !r.PartnerRegistrationLink && !r.OpenToWork, children: [
|
|
@@ -9971,7 +9973,7 @@ function yi({ applicationId: t, manufacturer: r }) {
|
|
|
9971
9973
|
/* @__PURE__ */ e(X, { htmlFor: `channel-${ie.id}`, className: "text-sm font-normal", children: ie.label })
|
|
9972
9974
|
] }, ie.id)) }),
|
|
9973
9975
|
We && /* @__PURE__ */ e(le, { placeholder: "Please specify", value: D, onChange: (ie) => L(ie.target.value) }),
|
|
9974
|
-
|
|
9976
|
+
I && /* @__PURE__ */ e("p", { className: "text-sm font-medium text-destructive", children: I })
|
|
9975
9977
|
] }),
|
|
9976
9978
|
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
9977
9979
|
/* @__PURE__ */ a(X, { children: [
|
|
@@ -10409,28 +10411,28 @@ function Vm({
|
|
|
10409
10411
|
P.useEffect(() => {
|
|
10410
10412
|
C?.length && (b.current || (N(S), b.current = !0));
|
|
10411
10413
|
}, [S, C]);
|
|
10412
|
-
const
|
|
10414
|
+
const I = C?.length ?? 0, k = P.useMemo(() => {
|
|
10413
10415
|
const O = (n ?? "").trim();
|
|
10414
10416
|
return O ? `${O} (Product ${t})` : `Product ${t}`;
|
|
10415
10417
|
}, [n, t]), D = P.useCallback(
|
|
10416
|
-
(O) =>
|
|
10417
|
-
[k,
|
|
10418
|
+
(O) => I > 1 ? `${k} image ${O + 1}` : k,
|
|
10419
|
+
[k, I]
|
|
10418
10420
|
), L = C?.[g], M = P.useMemo(() => L ? ts({
|
|
10419
10421
|
apiOrigin: h,
|
|
10420
10422
|
randmarSKU: t,
|
|
10421
10423
|
image: L,
|
|
10422
10424
|
width: l * 1.5,
|
|
10423
10425
|
height: l * 1.5
|
|
10424
|
-
}) : null, [L, h, l, t]),
|
|
10426
|
+
}) : null, [L, h, l, t]), A = P.useCallback(
|
|
10425
10427
|
(O) => {
|
|
10426
|
-
if (
|
|
10427
|
-
const V = (O %
|
|
10428
|
+
if (I <= 0) return;
|
|
10429
|
+
const V = (O % I + I) % I;
|
|
10428
10430
|
N(V);
|
|
10429
10431
|
},
|
|
10430
|
-
[
|
|
10431
|
-
), $ = P.useCallback(() =>
|
|
10432
|
+
[I]
|
|
10433
|
+
), $ = P.useCallback(() => A(g - 1), [g, A]), q = P.useCallback(() => A(g + 1), [g, A]), z = P.useCallback(
|
|
10432
10434
|
(O) => {
|
|
10433
|
-
if (!(
|
|
10435
|
+
if (!(I <= 1))
|
|
10434
10436
|
switch (O.key) {
|
|
10435
10437
|
case "ArrowLeft":
|
|
10436
10438
|
O.preventDefault(), $();
|
|
@@ -10439,18 +10441,18 @@ function Vm({
|
|
|
10439
10441
|
O.preventDefault(), q();
|
|
10440
10442
|
break;
|
|
10441
10443
|
case "Home":
|
|
10442
|
-
O.preventDefault(),
|
|
10444
|
+
O.preventDefault(), A(0);
|
|
10443
10445
|
break;
|
|
10444
10446
|
case "End":
|
|
10445
|
-
O.preventDefault(), I
|
|
10447
|
+
O.preventDefault(), A(I - 1);
|
|
10446
10448
|
break;
|
|
10447
10449
|
}
|
|
10448
10450
|
},
|
|
10449
|
-
[q, $,
|
|
10451
|
+
[q, $, A, I]
|
|
10450
10452
|
);
|
|
10451
10453
|
if (P.useEffect(() => {
|
|
10452
|
-
if (!C?.length ||
|
|
10453
|
-
const O = (g - 1 +
|
|
10454
|
+
if (!C?.length || I <= 1) return;
|
|
10455
|
+
const O = (g - 1 + I) % I, V = (g + 1) % I, se = [O, V];
|
|
10454
10456
|
for (const me of se) {
|
|
10455
10457
|
const Ve = C[me];
|
|
10456
10458
|
if (!Ve) continue;
|
|
@@ -10466,7 +10468,7 @@ function Vm({
|
|
|
10466
10468
|
const Qe = new Image();
|
|
10467
10469
|
Qe.src = Re;
|
|
10468
10470
|
}
|
|
10469
|
-
}, [g, h, l, t,
|
|
10471
|
+
}, [g, h, l, t, I, C]), c)
|
|
10470
10472
|
return /* @__PURE__ */ e(U, { children: i ?? null });
|
|
10471
10473
|
if (p === null && u && m)
|
|
10472
10474
|
return /* @__PURE__ */ e("div", { className: s, ref: o, children: /* @__PURE__ */ e(f, { className: "rounded-md", style: { width: l, height: l } }) });
|
|
@@ -10507,7 +10509,7 @@ function Vm({
|
|
|
10507
10509
|
role: "region",
|
|
10508
10510
|
"aria-roledescription": "carousel",
|
|
10509
10511
|
"aria-label": `Product images for ${t}`,
|
|
10510
|
-
tabIndex:
|
|
10512
|
+
tabIndex: I > 1 ? 0 : -1,
|
|
10511
10513
|
onKeyDown: z,
|
|
10512
10514
|
children: [
|
|
10513
10515
|
/* @__PURE__ */ e(
|
|
@@ -10521,7 +10523,7 @@ function Vm({
|
|
|
10521
10523
|
loading: "eager"
|
|
10522
10524
|
}
|
|
10523
10525
|
),
|
|
10524
|
-
|
|
10526
|
+
I > 1 && /* @__PURE__ */ a(U, { children: [
|
|
10525
10527
|
/* @__PURE__ */ e(
|
|
10526
10528
|
E,
|
|
10527
10529
|
{
|
|
@@ -10546,7 +10548,7 @@ function Vm({
|
|
|
10546
10548
|
children: /* @__PURE__ */ e(tr, { className: "h-4 w-4" })
|
|
10547
10549
|
}
|
|
10548
10550
|
),
|
|
10549
|
-
/* @__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:
|
|
10551
|
+
/* @__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: I }).map((O, V) => {
|
|
10550
10552
|
const se = V === g;
|
|
10551
10553
|
return /* @__PURE__ */ e(
|
|
10552
10554
|
"button",
|
|
@@ -10556,8 +10558,8 @@ function Vm({
|
|
|
10556
10558
|
"h-1.5 w-1.5 rounded-full transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
10557
10559
|
se ? "bg-foreground" : "bg-muted-foreground/40 hover:bg-muted-foreground/60"
|
|
10558
10560
|
].join(" "),
|
|
10559
|
-
onClick: () =>
|
|
10560
|
-
"aria-label": `Go to image ${V + 1} of ${
|
|
10561
|
+
onClick: () => A(V),
|
|
10562
|
+
"aria-label": `Go to image ${V + 1} of ${I}`,
|
|
10561
10563
|
"aria-current": se ? "true" : void 0
|
|
10562
10564
|
},
|
|
10563
10565
|
V
|
|
@@ -10584,7 +10586,7 @@ function Wr({
|
|
|
10584
10586
|
customAction: u = /* @__PURE__ */ e(U, {}),
|
|
10585
10587
|
showUsdLabelOnCost: h = !1
|
|
10586
10588
|
}) {
|
|
10587
|
-
const d = vc(), { toast: c } = Ee(), [m, p] = T(1), [g, N] = T(null), [w, x] = T(0), [b, y] = T(!1), [C] = Ko(), [S,
|
|
10589
|
+
const d = vc(), { toast: c } = Ee(), [m, p] = T(1), [g, N] = T(null), [w, x] = T(0), [b, y] = T(!1), [C] = Ko(), [S, I] = T(!1), [k, D] = T(null), [L, M] = T("idle"), [A, $] = T(null), [q] = Yo(), z = r?.Distribution?.Cost || 0, _ = r?.Distribution?.RegularPrice || 0, O = r?.Distribution?.Price || 0, V = !!(t && r?.RandmarSKU);
|
|
10588
10590
|
K(() => {
|
|
10589
10591
|
p(1), N(null), x(0);
|
|
10590
10592
|
}, [r?.RandmarSKU]), K(() => {
|
|
@@ -11157,7 +11159,7 @@ function Wr({
|
|
|
11157
11159
|
variant: "outline",
|
|
11158
11160
|
type: "button",
|
|
11159
11161
|
className: "h-11 px-4 text-sm font-medium justify-start w-full",
|
|
11160
|
-
onClick: () =>
|
|
11162
|
+
onClick: () => I(!0),
|
|
11161
11163
|
disabled: !V,
|
|
11162
11164
|
children: [
|
|
11163
11165
|
/* @__PURE__ */ e(Vl, { className: "mr-2" }),
|
|
@@ -11182,7 +11184,7 @@ function Wr({
|
|
|
11182
11184
|
] })
|
|
11183
11185
|
] })
|
|
11184
11186
|
] }) }),
|
|
11185
|
-
/* @__PURE__ */ e($e, { open: S, onOpenChange:
|
|
11187
|
+
/* @__PURE__ */ e($e, { open: S, onOpenChange: I, children: /* @__PURE__ */ a(Be, { className: "w-[min(95vw,1100px)] max-w-5xl space-y-6", children: [
|
|
11186
11188
|
/* @__PURE__ */ a(qe, { children: [
|
|
11187
11189
|
/* @__PURE__ */ e(He, { children: "Monthly Sales Performance" }),
|
|
11188
11190
|
/* @__PURE__ */ a(Ge, { children: [
|
|
@@ -11191,9 +11193,9 @@ function Wr({
|
|
|
11191
11193
|
We ? ` (SKU ${We})` : ""
|
|
11192
11194
|
] })
|
|
11193
11195
|
] }),
|
|
11194
|
-
/* @__PURE__ */ e("div", { className: "space-y-6", children:
|
|
11196
|
+
/* @__PURE__ */ e("div", { className: "space-y-6", children: A ? /* @__PURE__ */ a(Tt, { variant: "destructive", children: [
|
|
11195
11197
|
/* @__PURE__ */ e(Ot, { children: "Unable to load details" }),
|
|
11196
|
-
/* @__PURE__ */ e(Et, { children:
|
|
11198
|
+
/* @__PURE__ */ e(Et, { children: A })
|
|
11197
11199
|
] }) : /* @__PURE__ */ a("div", { className: "rounded-xl border bg-background p-4", children: [
|
|
11198
11200
|
/* @__PURE__ */ a("div", { className: "mb-4 space-y-2", children: [
|
|
11199
11201
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "Rolling 12-month sales dollars and units sold pulled from the detailed endpoint." }),
|
|
@@ -11254,26 +11256,26 @@ function Ni({ randmarSKU: t, sceneName: r, size: n = "md", alt: s, secondaryCont
|
|
|
11254
11256
|
), { data: C, isFetching: S } = ec(
|
|
11255
11257
|
{ productNumber: t },
|
|
11256
11258
|
{ skip: !y || !l }
|
|
11257
|
-
),
|
|
11259
|
+
), I = w || b;
|
|
11258
11260
|
function k() {
|
|
11259
11261
|
if (C)
|
|
11260
11262
|
try {
|
|
11261
|
-
const
|
|
11262
|
-
|
|
11263
|
-
} catch (
|
|
11264
|
-
console.error("Error downloading video:",
|
|
11263
|
+
const A = document.createElement("a");
|
|
11264
|
+
A.href = C, A.download = `${t || "product"}-video.mp4`, A.target = "_blank", A.rel = "noopener noreferrer", document.body.appendChild(A), A.click(), document.body.removeChild(A);
|
|
11265
|
+
} catch (A) {
|
|
11266
|
+
console.error("Error downloading video:", A);
|
|
11265
11267
|
}
|
|
11266
11268
|
}
|
|
11267
11269
|
function D() {
|
|
11268
|
-
const
|
|
11269
|
-
navigator.clipboard.writeText(At(
|
|
11270
|
+
const A = `/Product/${encodeURIComponent(t)}/Video`;
|
|
11271
|
+
navigator.clipboard.writeText(At(A, c)), h(!0), setTimeout(() => h(!1), 2e3);
|
|
11270
11272
|
}
|
|
11271
11273
|
function L() {
|
|
11272
11274
|
y && o(!0);
|
|
11273
11275
|
}
|
|
11274
11276
|
const M = P.useCallback(() => {
|
|
11275
11277
|
if (!x) return;
|
|
11276
|
-
const
|
|
11278
|
+
const A = (r ?? "").trim(), $ = A ? `Use this concept as a background/stage scene: "${A}".` : "Use a modern and clean office as the background/stage, with no people present.";
|
|
11277
11279
|
d(
|
|
11278
11280
|
`Help me generate product images for (Randmar SKU: ${t}).
|
|
11279
11281
|
|
|
@@ -11312,7 +11314,7 @@ Repeat and ask me what to change or improve until we are done creating pictures.
|
|
|
11312
11314
|
] }) })
|
|
11313
11315
|
) }) }),
|
|
11314
11316
|
/* @__PURE__ */ a("div", { className: "relative w-max h-max", ref: p, children: [
|
|
11315
|
-
|
|
11317
|
+
I ? (
|
|
11316
11318
|
// Use the Skeleton component while checking for the image or fetching its URL.
|
|
11317
11319
|
/* @__PURE__ */ e(f, { className: "rounded-md", style: { width: m, height: m } })
|
|
11318
11320
|
) : x ? (
|
|
@@ -12761,8 +12763,8 @@ function Gr(t) {
|
|
|
12761
12763
|
if (l) {
|
|
12762
12764
|
const b = l.trim(), [y, C, S] = b.split(":");
|
|
12763
12765
|
if (p = Number.parseInt(y ?? "0", 10), g = Number.parseInt(C ?? "0", 10), S) {
|
|
12764
|
-
const [
|
|
12765
|
-
N = Number.parseInt(
|
|
12766
|
+
const [I, k] = S.split(".");
|
|
12767
|
+
N = Number.parseInt(I ?? "0", 10), k && (w = Number.parseInt(k.slice(0, 3).padEnd(3, "0"), 10));
|
|
12766
12768
|
}
|
|
12767
12769
|
}
|
|
12768
12770
|
if (!Number.isFinite(p) || !Number.isFinite(g) || !Number.isFinite(N) || !Number.isFinite(w))
|
|
@@ -12877,17 +12879,17 @@ function qf({
|
|
|
12877
12879
|
O && x(O);
|
|
12878
12880
|
}
|
|
12879
12881
|
}, [m, p, n, w, g?.IsManufacturer]);
|
|
12880
|
-
const C = !n && (d || m), S = p?.Title || p?.RandmarTitle || p?.RandmarSKU || "Product",
|
|
12882
|
+
const C = !n && (d || m), S = p?.Title || p?.RandmarTitle || p?.RandmarSKU || "Product", I = 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, D = 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;
|
|
12881
12883
|
return /* @__PURE__ */ a("div", { className: "@container", children: [
|
|
12882
12884
|
/* @__PURE__ */ a("div", { className: "grid gap-4 grid-cols-1 @md:grid-cols-3", children: [
|
|
12883
12885
|
/* @__PURE__ */ a(Q, { className: "@md:col-span-2", children: [
|
|
12884
12886
|
/* @__PURE__ */ a(Z, { className: "space-y-2", children: [
|
|
12885
12887
|
/* @__PURE__ */ e(fe, { className: "text-2xl font-semibold leading-tight", children: C && !p ? /* @__PURE__ */ e(f, { className: "h-7 w-2/3" }) : S }),
|
|
12886
|
-
|
|
12888
|
+
I ? /* @__PURE__ */ e("div", { className: "text-sm text-muted-foreground", children: I }) : C && !p ? /* @__PURE__ */ e(f, { className: "h-4 w-4/5" }) : null
|
|
12887
12889
|
] }),
|
|
12888
12890
|
/* @__PURE__ */ a(G, { className: "space-y-6", children: [
|
|
12889
12891
|
/* @__PURE__ */ a("div", { className: "rounded-lg border bg-card p-4", children: [
|
|
12890
|
-
|
|
12892
|
+
A ? /* @__PURE__ */ a("div", { className: "flex flex-col gap-4 @sm:flex-row @sm:items-start @sm:justify-between", children: [
|
|
12891
12893
|
/* @__PURE__ */ a("div", { children: [
|
|
12892
12894
|
/* @__PURE__ */ e("div", { className: "text-sm text-muted-foreground", children: "Your Price" }),
|
|
12893
12895
|
/* @__PURE__ */ e("div", { className: "mt-1 text-3xl font-semibold tracking-tight", children: typeof M == "number" ? ue(M) : C ? /* @__PURE__ */ e(f, { className: "h-9 w-40" }) : null })
|
|
@@ -12908,7 +12910,7 @@ function qf({
|
|
|
12908
12910
|
/* @__PURE__ */ e("div", { className: "mt-1 text-xs text-muted-foreground", children: $ >= 0 ? `${q}% margin vs MAP` : `${Math.abs(q)}% under MAP` })
|
|
12909
12911
|
] }) : null
|
|
12910
12912
|
] }) : null,
|
|
12911
|
-
/* @__PURE__ */ e(ke, { children: /* @__PURE__ */ a("div", { className: `${
|
|
12913
|
+
/* @__PURE__ */ e(ke, { children: /* @__PURE__ */ a("div", { className: `${A ? "mt-5" : "mt-0"} grid grid-cols-1 gap-4 @sm:grid-cols-2`, children: [
|
|
12912
12914
|
/* @__PURE__ */ a("div", { className: "flex items-start justify-between gap-4 rounded-md border bg-background/50 p-3", children: [
|
|
12913
12915
|
/* @__PURE__ */ a("div", { children: [
|
|
12914
12916
|
/* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ a(we, { children: [
|
|
@@ -13743,10 +13745,10 @@ function Ri({
|
|
|
13743
13745
|
}, {
|
|
13744
13746
|
skip: !t
|
|
13745
13747
|
}), g = ae((D, L, M) => {
|
|
13746
|
-
l((
|
|
13747
|
-
...
|
|
13748
|
+
l((A) => ({
|
|
13749
|
+
...A,
|
|
13748
13750
|
[D]: {
|
|
13749
|
-
...
|
|
13751
|
+
...A[D],
|
|
13750
13752
|
[L]: M
|
|
13751
13753
|
}
|
|
13752
13754
|
}));
|
|
@@ -13850,10 +13852,10 @@ function Ri({
|
|
|
13850
13852
|
id: "statusInfo",
|
|
13851
13853
|
header: "Status",
|
|
13852
13854
|
cell: ({ row: D }) => {
|
|
13853
|
-
const L = D.original, M = L.Active === !0,
|
|
13855
|
+
const L = D.original, M = L.Active === !0, A = Ih(L.EndDate), $ = M ? "success" : "secondary", q = A.variant === "destructive" ? "destructive" : A.variant === "warning" ? "warning" : "secondary";
|
|
13854
13856
|
return /* @__PURE__ */ a("div", { className: "flex items-center space-x-2 min-w-[200px]", children: [
|
|
13855
13857
|
/* @__PURE__ */ e(xe, { variant: $, className: "font-medium", children: M ? "Active" : "Inactive" }),
|
|
13856
|
-
L.EndDate && /* @__PURE__ */ e(xe, { variant: q, className: "font-medium", children:
|
|
13858
|
+
L.EndDate && /* @__PURE__ */ e(xe, { variant: q, className: "font-medium", children: A.text }),
|
|
13857
13859
|
/* @__PURE__ */ e(ke, { delayDuration: 100, children: /* @__PURE__ */ a(we, { children: [
|
|
13858
13860
|
/* @__PURE__ */ e(Se, { asChild: !0, children: /* @__PURE__ */ e(E, { variant: "ghost", size: "icon", className: "h-6 w-6 p-0 data-[state=delayed-open]:bg-accent data-[state=instant-open]:bg-accent", children: /* @__PURE__ */ e(ys, { className: "h-4 w-4 text-muted-foreground" }) }) }),
|
|
13859
13861
|
/* @__PURE__ */ e(ve, { side: "top", align: "center", className: "bg-popover text-popover-foreground p-2 rounded shadow-lg", children: /* @__PURE__ */ a("div", { className: "text-sm space-y-1", children: [
|
|
@@ -13885,7 +13887,7 @@ function Ri({
|
|
|
13885
13887
|
const L = D.original;
|
|
13886
13888
|
if (!L.BidNumber)
|
|
13887
13889
|
return /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: "Actions unavailable" });
|
|
13888
|
-
const M = L.BidNumber,
|
|
13890
|
+
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}`;
|
|
13889
13891
|
return /* @__PURE__ */ a("div", { className: "flex space-x-2", children: [
|
|
13890
13892
|
/* @__PURE__ */ e(Te, { to: _, children: /* @__PURE__ */ a(E, { variant: "outline", size: "sm", className: "flex items-center", children: [
|
|
13891
13893
|
/* @__PURE__ */ e(Ga, { className: "mr-2 h-4 w-4" }),
|
|
@@ -13893,7 +13895,7 @@ function Ri({
|
|
|
13893
13895
|
] }) }),
|
|
13894
13896
|
p?.IsReseller && /* @__PURE__ */ a(U, { children: [
|
|
13895
13897
|
/* @__PURE__ */ a(E, { variant: "outline", size: "sm", onClick: () => w(L), disabled: q || !z, title: z ? "Set as default" : "This opportunity cannot be set as default", className: "flex items-center", children: [
|
|
13896
|
-
|
|
13898
|
+
A ? /* @__PURE__ */ e(he, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ e(Ga, { className: "mr-2 h-4 w-4" }),
|
|
13897
13899
|
" Set Default"
|
|
13898
13900
|
] }),
|
|
13899
13901
|
/* @__PURE__ */ a(E, { variant: "outline", size: "sm", onClick: () => b(L), disabled: q, title: "Send report by email", className: "flex items-center", children: [
|
|
@@ -13917,16 +13919,16 @@ function Ri({
|
|
|
13917
13919
|
const D = {};
|
|
13918
13920
|
if (r) {
|
|
13919
13921
|
const L = Array.from(
|
|
13920
|
-
new Set(r.map((
|
|
13922
|
+
new Set(r.map((A) => A.ManufacturerId).filter((A) => A != null))
|
|
13921
13923
|
);
|
|
13922
13924
|
D.ManufacturerId = L;
|
|
13923
13925
|
const M = Array.from(
|
|
13924
|
-
new Set(r.map((
|
|
13926
|
+
new Set(r.map((A) => A.OpportunityName || A.Opportunity).filter((A) => A != null))
|
|
13925
13927
|
);
|
|
13926
13928
|
D.opportunityDisplay = M;
|
|
13927
13929
|
}
|
|
13928
13930
|
return D;
|
|
13929
|
-
}, [r]),
|
|
13931
|
+
}, [r]), I = r || [], k = c?.BidNumber ? i[c.BidNumber]?.isSendingReport : !1;
|
|
13930
13932
|
return n ? /* @__PURE__ */ a(Q, { className: "w-full", children: [
|
|
13931
13933
|
/* @__PURE__ */ a(Z, { children: [
|
|
13932
13934
|
" ",
|
|
@@ -13956,7 +13958,7 @@ function Ri({
|
|
|
13956
13958
|
/* @__PURE__ */ e(fe, { className: "text-1xl font-bold", children: "Opportunities" }),
|
|
13957
13959
|
" "
|
|
13958
13960
|
] }),
|
|
13959
|
-
/* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(Qt, { columns: C, data:
|
|
13961
|
+
/* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(Qt, { columns: C, data: I, uniqueValues: S }) })
|
|
13960
13962
|
] }),
|
|
13961
13963
|
/* @__PURE__ */ e($e, { open: o, onOpenChange: (D) => {
|
|
13962
13964
|
u(D), D || (m(null), d(""));
|
|
@@ -14071,11 +14073,11 @@ const Pi = P.forwardRef(
|
|
|
14071
14073
|
if (y) {
|
|
14072
14074
|
const C = Lh(y);
|
|
14073
14075
|
if (C) {
|
|
14074
|
-
const { h: S, s:
|
|
14076
|
+
const { h: S, s: I, l: k } = C;
|
|
14075
14077
|
c({
|
|
14076
|
-
minColor: Ir(S,
|
|
14077
|
-
midColor: Ir(S,
|
|
14078
|
-
maxColor: Ir(S,
|
|
14078
|
+
minColor: Ir(S, I, Math.min(100, k + 50)),
|
|
14079
|
+
midColor: Ir(S, I, Math.min(100, k + 35)),
|
|
14080
|
+
maxColor: Ir(S, I, Math.min(100, k + 20))
|
|
14079
14081
|
});
|
|
14080
14082
|
}
|
|
14081
14083
|
return !0;
|