randmarcomps 1.100.0 → 1.101.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.
@@ -1,3 +1,4 @@
1
+ import { Account } from 'randmar-api-client';
1
2
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
2
3
  import { ButtonProps as ButtonProps_2 } from './button';
3
4
  import { ClassProp } from 'class-variance-authority/types';
@@ -242,13 +243,13 @@ declare interface LayoutProps {
242
243
  chatRef?: React.Ref<ChatLayoutHandle>;
243
244
  }
244
245
 
245
- export declare function ManufacturerCard({ manufacturer, goToManufacturerLink, actionItems, isLoading, }: ManufacturerCardProps): JSX.Element;
246
+ export declare function ManufacturerCard({ manufacturer, link, actionItems, loading, }: ManufacturerCardProps): JSX.Element;
246
247
 
247
248
  export declare interface ManufacturerCardProps {
248
- manufacturer: Manufacturer;
249
- goToManufacturerLink: string;
249
+ manufacturer?: Manufacturer;
250
+ link?: string;
250
251
  actionItems?: ActionItem[];
251
- isLoading?: boolean;
252
+ loading?: boolean;
252
253
  }
253
254
 
254
255
  declare type MaskType = "phone" | "postal-code-ca" | "zip-code-us";
@@ -272,15 +273,10 @@ export declare interface NavRoute {
272
273
  showInNav?: boolean;
273
274
  }
274
275
 
275
- export declare function PartnerCard({ id, name, about, voiceName, voiceStyle, sceneName, action, loading, }: PartnerCardProps): JSX.Element;
276
+ export declare function PartnerCard({ account, action, loading, }: PartnerCardProps): JSX.Element;
276
277
 
277
278
  declare interface PartnerCardProps {
278
- id: string;
279
- name: string;
280
- about: string;
281
- voiceName?: string;
282
- voiceStyle?: string;
283
- sceneName?: string;
279
+ account?: Account;
284
280
  action?: ReactNode;
285
281
  loading?: boolean;
286
282
  }
@@ -327,13 +323,13 @@ declare interface ProductInventoryGridProps {
327
323
  showBinLocation?: boolean;
328
324
  }
329
325
 
330
- export declare function ResellerCard({ reseller, goToResellerLink, actionItems, isLoading, }: ResellerCardProps): JSX.Element;
326
+ export declare function ResellerCard({ reseller, link, actionItems, loading, }: ResellerCardProps): JSX.Element;
331
327
 
332
328
  export declare interface ResellerCardProps {
333
- reseller: Reseller;
334
- goToResellerLink: string;
329
+ reseller?: Reseller;
330
+ link?: string;
335
331
  actionItems?: ActionItem_2[];
336
- isLoading?: boolean;
332
+ loading?: boolean;
337
333
  }
338
334
 
339
335
  export declare const ScrollArea: React_2.ForwardRefExoticComponent<ScrollAreaProps & React_2.RefAttributes<HTMLDivElement>>;
@@ -48000,61 +48000,66 @@ const CardFooter = React.forwardRef(({ className: e, ...t }, n) => /* @__PURE__
48000
48000
  ));
48001
48001
  CardFooter.displayName = "CardFooter";
48002
48002
  function PartnerCard({
48003
- id: e,
48004
- name: t,
48005
- about: n,
48006
- voiceName: i,
48007
- voiceStyle: o,
48008
- sceneName: l,
48009
- action: u,
48010
- loading: d = !1
48003
+ account: e,
48004
+ action: t,
48005
+ loading: n = !1
48011
48006
  }) {
48012
- const f = `https://api.randmar.io/V4/Partner/${e}/Account/Video`, p = `https://api.randmar.io/V4/Partner/${e}/Account/Video/Exists`, m = `https://api.randmar.io/V4/Partner/${e}/Account/Logo?width=64&height=64`, g = `https://api.randmar.io/V4/Partner/${e}/Account/Logo/Exists`, b = !!(i || o || l), [_, E] = useState(null), [R, S] = useState(!1), [C, A] = useState(!1), [I, O] = useState(!1), [T, M] = useState(!0);
48007
+ const [i, o] = useState(null), [l, u] = useState(!1), [d, f] = useState(!1), [p, m] = useState(!1), [g, b] = useState(!0), [_, E] = useState(null), R = useMemo(() => e != null && e.ApplicationId ? {
48008
+ videoUrl: `https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Video`,
48009
+ videoExistsUrl: `https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Video/Exists`,
48010
+ logoUrl: `https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Logo?width=64&height=64`,
48011
+ logoExistsUrl: `https://api.randmar.io/V4/Partner/${e.ApplicationId}/Account/Logo/Exists`
48012
+ } : null, [e == null ? void 0 : e.ApplicationId]), S = !!(e != null && e.VoiceName || e != null && e.VoiceStyle || e != null && e.SceneName);
48013
48013
  useEffect(() => {
48014
- if (!e || d) return;
48015
- const D = async () => {
48014
+ if (!R || n) return;
48015
+ E(null);
48016
+ const A = async () => {
48016
48017
  try {
48017
- const B = await fetch(g);
48018
- if (B.ok) {
48019
- const V = (await B.text()).toLowerCase() === "true";
48020
- return A(V), V;
48018
+ const M = await fetch(R.logoExistsUrl);
48019
+ if (M.ok) {
48020
+ const D = (await M.text()).toLowerCase() === "true";
48021
+ return f(D), D;
48021
48022
  }
48022
48023
  return !1;
48023
- } catch (B) {
48024
- return console.error("Failed to check if logo exists:", B), A(!1), !1;
48024
+ } catch (M) {
48025
+ return console.error("Failed to check if logo exists:", M), f(!1), !1;
48025
48026
  }
48026
- }, j = async () => {
48027
- S(!0);
48027
+ }, I = async () => {
48028
+ u(!0);
48028
48029
  try {
48029
- const B = await fetch(m);
48030
- if (B.ok) {
48031
- const z = await B.blob();
48032
- E(URL.createObjectURL(z));
48033
- }
48034
- } catch (B) {
48035
- console.error("Failed to load logo:", B);
48030
+ const M = await fetch(R.logoUrl);
48031
+ if (M.ok) {
48032
+ const N = await M.blob();
48033
+ o(URL.createObjectURL(N));
48034
+ } else
48035
+ throw new Error(`Failed to load logo: ${M.status}`);
48036
+ } catch (M) {
48037
+ console.error("Failed to load logo:", M), E("Failed to load partner logo");
48036
48038
  } finally {
48037
- S(!1);
48039
+ u(!1);
48038
48040
  }
48039
- }, F = async () => {
48041
+ }, O = async () => {
48040
48042
  try {
48041
- const B = await fetch(p);
48042
- if (B.ok) {
48043
- const z = await B.text();
48044
- O(z.toLowerCase() === "true");
48045
- }
48046
- } catch (B) {
48047
- console.error("Failed to check if video exists:", B), O(!1);
48043
+ const M = await fetch(R.videoExistsUrl);
48044
+ if (M.ok) {
48045
+ const N = await M.text();
48046
+ m(N.toLowerCase() === "true");
48047
+ } else
48048
+ throw new Error(`Failed to check video: ${M.status}`);
48049
+ } catch (M) {
48050
+ console.error("Failed to check if video exists:", M), m(!1);
48048
48051
  }
48049
48052
  };
48050
- (async () => {
48051
- await D() && j(), F();
48052
- })();
48053
- }, [e, m, g, p, d]);
48054
- const N = () => {
48055
- M(!1);
48053
+ return (async () => {
48054
+ await A() && I(), O();
48055
+ })(), () => {
48056
+ i && URL.revokeObjectURL(i);
48057
+ };
48058
+ }, [R, n, i]);
48059
+ const C = () => {
48060
+ b(!1);
48056
48061
  };
48057
- return d ? /* @__PURE__ */ jsx(Card, { className: "hover:shadow-lg transition-shadow", children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
48062
+ return n || !e ? /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
48058
48063
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row justify-between items-start gap-4 mb-4", children: [
48059
48064
  /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
48060
48065
  /* @__PURE__ */ jsx("div", { className: "h-10 flex items-center justify-center mr-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-10 rounded-md" }) }),
@@ -48087,55 +48092,57 @@ function PartnerCard({
48087
48092
  ] }),
48088
48093
  /* @__PURE__ */ jsx("div", { className: "flex flex-col order-1 md:order-1 md:w-auto", children: /* @__PURE__ */ jsx("div", { className: "w-[180px] h-[320px] rounded-md overflow-hidden", children: /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-full" }) }) })
48089
48094
  ] })
48090
- ] }) }) : /* @__PURE__ */ jsx(Card, { className: "hover:shadow-lg transition-shadow", children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
48095
+ ] }) }) : /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
48091
48096
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row justify-between items-start gap-4 mb-4", children: [
48092
48097
  /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
48093
- C && /* @__PURE__ */ jsx("div", { className: "h-10 flex items-center justify-center mr-4", children: R ? /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-10 rounded-md" }) : _ && /* @__PURE__ */ jsx(
48098
+ d && /* @__PURE__ */ jsx("div", { className: "h-10 flex items-center justify-center mr-4", children: l ? /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-10 rounded-md" }) : i && /* @__PURE__ */ jsx(
48094
48099
  "img",
48095
48100
  {
48096
- src: _ || "/placeholder.svg",
48097
- alt: `${t} logo`,
48101
+ src: i || "/placeholder.svg",
48102
+ alt: `${e.PublicName}'s logo`,
48098
48103
  className: "max-h-10 w-auto object-contain"
48099
48104
  }
48100
48105
  ) }),
48101
- /* @__PURE__ */ jsx("h3", { className: "font-semibold text-xl", children: t })
48106
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold text-xl", children: e.PublicName })
48102
48107
  ] }),
48103
- u && /* @__PURE__ */ jsx("div", { className: "w-full sm:w-auto", children: u })
48108
+ t && /* @__PURE__ */ jsx("div", { className: "w-full sm:w-auto", children: t })
48104
48109
  ] }),
48110
+ _ && /* @__PURE__ */ jsx("div", { className: "text-red-500 mb-4 text-sm", role: "alert", children: _ }),
48105
48111
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row gap-6", children: [
48106
48112
  /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col order-1 md:order-1", children: [
48107
- /* @__PURE__ */ jsx("div", { className: "prose prose-sm max-w-none", dangerouslySetInnerHTML: { __html: n } }),
48108
- b && /* @__PURE__ */ jsx("div", { className: "mt-4 p-3 bg-slate-50 rounded-md", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-2", children: [
48109
- i && /* @__PURE__ */ jsxs("div", { children: [
48113
+ /* @__PURE__ */ jsx("div", { className: "prose prose-sm max-w-none", dangerouslySetInnerHTML: { __html: e.About ?? "" } }),
48114
+ S && /* @__PURE__ */ jsx("div", { className: "mt-4 p-3 bg-slate-50 rounded-md", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-2", children: [
48115
+ e.VoiceName && /* @__PURE__ */ jsxs("div", { children: [
48110
48116
  /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Voice Name" }),
48111
- /* @__PURE__ */ jsx("div", { className: "font-medium", children: i })
48117
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: e.VoiceName })
48112
48118
  ] }),
48113
- o && /* @__PURE__ */ jsxs("div", { children: [
48119
+ e.VoiceStyle && /* @__PURE__ */ jsxs("div", { children: [
48114
48120
  /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Voice Style" }),
48115
- /* @__PURE__ */ jsx("div", { className: "font-medium", children: o })
48121
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: e.VoiceStyle })
48116
48122
  ] }),
48117
- l && /* @__PURE__ */ jsxs("div", { children: [
48123
+ e.SceneName && /* @__PURE__ */ jsxs("div", { children: [
48118
48124
  /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Scene Name" }),
48119
- /* @__PURE__ */ jsx("div", { className: "font-medium", children: l })
48125
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: e.SceneName })
48120
48126
  ] })
48121
48127
  ] }) })
48122
48128
  ] }),
48123
- I && /* @__PURE__ */ jsx("div", { className: "flex flex-col order-1 md:order-1 md:w-auto", children: /* @__PURE__ */ jsxs("div", { className: "w-[180px] h-[320px] rounded-md overflow-hidden", children: [
48124
- T && /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-full" }),
48129
+ p && R && /* @__PURE__ */ jsx("div", { className: "flex flex-col order-1 md:order-1 md:w-auto", children: /* @__PURE__ */ jsxs("div", { className: "w-[180px] h-[320px] rounded-md overflow-hidden", children: [
48130
+ g && /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-full" }),
48125
48131
  /* @__PURE__ */ jsx(
48126
48132
  "video",
48127
48133
  {
48128
- src: f,
48134
+ src: R.videoUrl,
48129
48135
  controls: !0,
48130
48136
  preload: "auto",
48131
48137
  playsInline: !0,
48132
- className: `w-full h-full object-contain ${T ? "invisible" : "visible"}`,
48138
+ "aria-label": `Video for ${e.PublicName}`,
48139
+ className: `w-full h-full object-contain ${g ? "invisible" : "visible"}`,
48133
48140
  style: {
48134
48141
  objectPosition: "center",
48135
48142
  imageRendering: "auto"
48136
48143
  },
48137
- onLoadedData: N,
48138
- onError: () => M(!1)
48144
+ onLoadedData: C,
48145
+ onError: () => b(!1)
48139
48146
  }
48140
48147
  )
48141
48148
  ] }) })
@@ -48528,7 +48535,7 @@ function ProductCard({
48528
48535
  return !(ce.EndDate && ce.EndDate < J || ce.StartDate && ce.StartDate > J);
48529
48536
  };
48530
48537
  if (!e)
48531
- return /* @__PURE__ */ jsx(Card, { className: "hover:shadow-lg transition-shadow", children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
48538
+ return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
48532
48539
  /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start mb-3", children: [
48533
48540
  /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-3/4" }),
48534
48541
  /* @__PURE__ */ jsx("div", { className: "h-10 w-24 flex items-center justify-end ml-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-24 rounded-md" }) })
@@ -48917,13 +48924,13 @@ function ProductCard({
48917
48924
  }
48918
48925
  function ManufacturerCard({
48919
48926
  manufacturer: e,
48920
- goToManufacturerLink: t,
48927
+ link: t,
48921
48928
  actionItems: n = [],
48922
- isLoading: i = !1
48929
+ loading: i = !1
48923
48930
  }) {
48924
48931
  var m;
48925
- if (i)
48926
- return /* @__PURE__ */ jsxs(Card, { className: "w-full max-w-md overflow-hidden", children: [
48932
+ if (i || !e)
48933
+ return /* @__PURE__ */ jsxs(Card, { children: [
48927
48934
  /* @__PURE__ */ jsx(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
48928
48935
  /* @__PURE__ */ jsx(Skeleton, { className: "h-12 w-12 rounded-md" }),
48929
48936
  /* @__PURE__ */ jsxs("div", { children: [
@@ -48966,7 +48973,7 @@ function ManufacturerCard({
48966
48973
  ] });
48967
48974
  return g.link ? /* @__PURE__ */ jsx(DropdownMenuItem, { asChild: !0, children: /* @__PURE__ */ jsx(Link, { to: g.link, children: E }) }, b) : /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: g.onClick, children: E }, b);
48968
48975
  };
48969
- return /* @__PURE__ */ jsxs(Card, { className: "w-full max-w-md overflow-hidden manufacturer-theme", children: [
48976
+ return /* @__PURE__ */ jsxs(Card, { className: "manufacturer-theme", children: [
48970
48977
  /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: [
48971
48978
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
48972
48979
  /* @__PURE__ */ jsx("div", { className: "h-12 w-12 overflow-hidden rounded-md", children: /* @__PURE__ */ jsx(
@@ -49007,7 +49014,7 @@ function ManufacturerCard({
49007
49014
  ] })
49008
49015
  ] })
49009
49016
  ] }) }),
49010
- /* @__PURE__ */ jsxs(CardFooter, { className: `flex pt-2 gap-2 ${n.length > 0 ? "justify-between" : "justify-end"}`, children: [
49017
+ (n.length > 0 || t) && /* @__PURE__ */ jsxs(CardFooter, { className: `flex pt-2 gap-2 ${n.length > 0 ? "justify-between" : "justify-end"}`, children: [
49011
49018
  n.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [
49012
49019
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", className: "text-primary", children: [
49013
49020
  "Actions ",
@@ -49015,7 +49022,7 @@ function ManufacturerCard({
49015
49022
  ] }) }),
49016
49023
  /* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", children: n.map((g, b) => p(g, b)) })
49017
49024
  ] }),
49018
- /* @__PURE__ */ jsx(Button, { className: "flex items-center gap-1", asChild: !0, children: /* @__PURE__ */ jsxs(Link, { to: t, children: [
49025
+ t && /* @__PURE__ */ jsx(Button, { className: "flex items-center gap-1", asChild: !0, children: /* @__PURE__ */ jsxs(Link, { to: t, children: [
49019
49026
  "Go to Manufacturer",
49020
49027
  /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
49021
49028
  ] }) })
@@ -49024,12 +49031,12 @@ function ManufacturerCard({
49024
49031
  }
49025
49032
  function ResellerCard({
49026
49033
  reseller: e,
49027
- goToResellerLink: t,
49034
+ link: t,
49028
49035
  actionItems: n = [],
49029
- isLoading: i = !1
49036
+ loading: i = !1
49030
49037
  }) {
49031
- if (i)
49032
- return /* @__PURE__ */ jsxs(Card, { className: "w-full max-w-md overflow-hidden", children: [
49038
+ if (i || !e)
49039
+ return /* @__PURE__ */ jsxs(Card, { children: [
49033
49040
  /* @__PURE__ */ jsx(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
49034
49041
  /* @__PURE__ */ jsx(Skeleton, { className: "h-12 w-12 rounded-md" }),
49035
49042
  /* @__PURE__ */ jsxs("div", { children: [
@@ -49065,7 +49072,7 @@ function ResellerCard({
49065
49072
  ] });
49066
49073
  return p.link ? /* @__PURE__ */ jsx(DropdownMenuItem, { asChild: !0, children: /* @__PURE__ */ jsx(Link, { to: p.link, children: b }) }, m) : /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: p.onClick, children: b }, m);
49067
49074
  };
49068
- return /* @__PURE__ */ jsxs(Card, { className: "w-full max-w-md overflow-hidden reseller-theme", children: [
49075
+ return /* @__PURE__ */ jsxs(Card, { className: "reseller-theme", children: [
49069
49076
  /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: [
49070
49077
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
49071
49078
  /* @__PURE__ */ jsx("div", { className: "h-12 w-12 overflow-hidden rounded-md", children: /* @__PURE__ */ jsx(
@@ -49103,7 +49110,7 @@ function ResellerCard({
49103
49110
  /* @__PURE__ */ jsx("span", { children: e.Website })
49104
49111
  ] })
49105
49112
  ] }) }) }),
49106
- /* @__PURE__ */ jsxs(CardFooter, { className: `flex pt-2 gap-2 ${n.length > 0 ? "justify-between" : "justify-end"}`, children: [
49113
+ (n.length > 0 || t) && /* @__PURE__ */ jsxs(CardFooter, { className: `flex pt-2 gap-2 ${n.length > 0 ? "justify-between" : "justify-end"}`, children: [
49107
49114
  n.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [
49108
49115
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", className: "text-primary", children: [
49109
49116
  "Actions ",
@@ -49111,7 +49118,7 @@ function ResellerCard({
49111
49118
  ] }) }),
49112
49119
  /* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", children: n.map((p, m) => f(p, m)) })
49113
49120
  ] }),
49114
- /* @__PURE__ */ jsx(Button, { className: "flex items-center gap-1", asChild: !0, children: /* @__PURE__ */ jsxs(Link, { to: t, children: [
49121
+ t && /* @__PURE__ */ jsx(Button, { className: "flex items-center gap-1", asChild: !0, children: /* @__PURE__ */ jsxs(Link, { to: t, children: [
49115
49122
  "Go to Reseller",
49116
49123
  /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
49117
49124
  ] }) })