randmarcomps 1.100.0 → 1.102.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,67 @@ 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
+ let A = !0;
48016
+ E(null);
48017
+ const I = async () => {
48016
48018
  try {
48017
- const B = await fetch(g);
48018
- if (B.ok) {
48019
- const V = (await B.text()).toLowerCase() === "true";
48020
- return A(V), V;
48019
+ const N = await fetch(R.logoExistsUrl);
48020
+ if (N.ok) {
48021
+ const j = (await N.text()).toLowerCase() === "true";
48022
+ return A && f(j), j;
48021
48023
  }
48022
48024
  return !1;
48023
- } catch (B) {
48024
- return console.error("Failed to check if logo exists:", B), A(!1), !1;
48025
+ } catch (N) {
48026
+ return console.error("Failed to check if logo exists:", N), A && f(!1), !1;
48025
48027
  }
48026
- }, j = async () => {
48027
- S(!0);
48028
+ }, O = async () => {
48029
+ A && u(!0);
48028
48030
  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);
48031
+ const N = await fetch(R.logoUrl);
48032
+ if (N.ok) {
48033
+ const D = await N.blob();
48034
+ A && (i && URL.revokeObjectURL(i), o(URL.createObjectURL(D)));
48035
+ } else
48036
+ throw new Error(`Failed to load logo: ${N.status}`);
48037
+ } catch (N) {
48038
+ console.error("Failed to load logo:", N), A && E("Failed to load partner logo");
48036
48039
  } finally {
48037
- S(!1);
48040
+ A && u(!1);
48038
48041
  }
48039
- }, F = async () => {
48042
+ }, T = async () => {
48040
48043
  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);
48044
+ const N = await fetch(R.videoExistsUrl);
48045
+ if (N.ok) {
48046
+ const D = await N.text();
48047
+ A && m(D.toLowerCase() === "true");
48048
+ } else
48049
+ throw new Error(`Failed to check video: ${N.status}`);
48050
+ } catch (N) {
48051
+ console.error("Failed to check if video exists:", N), A && m(!1);
48048
48052
  }
48049
48053
  };
48050
- (async () => {
48051
- await D() && j(), F();
48052
- })();
48053
- }, [e, m, g, p, d]);
48054
- const N = () => {
48055
- M(!1);
48054
+ return (async () => {
48055
+ await I() && O(), T();
48056
+ })(), () => {
48057
+ A = !1, i && URL.revokeObjectURL(i);
48058
+ };
48059
+ }, [R, n]);
48060
+ const C = () => {
48061
+ b(!1);
48056
48062
  };
48057
- return d ? /* @__PURE__ */ jsx(Card, { className: "hover:shadow-lg transition-shadow", children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
48063
+ return n || !e ? /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
48058
48064
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row justify-between items-start gap-4 mb-4", children: [
48059
48065
  /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
48060
48066
  /* @__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 +48093,57 @@ function PartnerCard({
48087
48093
  ] }),
48088
48094
  /* @__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
48095
  ] })
48090
- ] }) }) : /* @__PURE__ */ jsx(Card, { className: "hover:shadow-lg transition-shadow", children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
48096
+ ] }) }) : /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
48091
48097
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row justify-between items-start gap-4 mb-4", children: [
48092
48098
  /* @__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(
48099
+ 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
48100
  "img",
48095
48101
  {
48096
- src: _ || "/placeholder.svg",
48097
- alt: `${t} logo`,
48102
+ src: i || "/placeholder.svg",
48103
+ alt: `${e.PublicName}'s logo`,
48098
48104
  className: "max-h-10 w-auto object-contain"
48099
48105
  }
48100
48106
  ) }),
48101
- /* @__PURE__ */ jsx("h3", { className: "font-semibold text-xl", children: t })
48107
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold text-xl", children: e.PublicName })
48102
48108
  ] }),
48103
- u && /* @__PURE__ */ jsx("div", { className: "w-full sm:w-auto", children: u })
48109
+ t && /* @__PURE__ */ jsx("div", { className: "w-full sm:w-auto", children: t })
48104
48110
  ] }),
48111
+ _ && /* @__PURE__ */ jsx("div", { className: "text-red-500 mb-4 text-sm", role: "alert", children: _ }),
48105
48112
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row gap-6", children: [
48106
48113
  /* @__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: [
48114
+ /* @__PURE__ */ jsx("div", { className: "prose prose-sm max-w-none", dangerouslySetInnerHTML: { __html: e.About ?? "" } }),
48115
+ 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: [
48116
+ e.VoiceName && /* @__PURE__ */ jsxs("div", { children: [
48110
48117
  /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Voice Name" }),
48111
- /* @__PURE__ */ jsx("div", { className: "font-medium", children: i })
48118
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: e.VoiceName })
48112
48119
  ] }),
48113
- o && /* @__PURE__ */ jsxs("div", { children: [
48120
+ e.VoiceStyle && /* @__PURE__ */ jsxs("div", { children: [
48114
48121
  /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Voice Style" }),
48115
- /* @__PURE__ */ jsx("div", { className: "font-medium", children: o })
48122
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: e.VoiceStyle })
48116
48123
  ] }),
48117
- l && /* @__PURE__ */ jsxs("div", { children: [
48124
+ e.SceneName && /* @__PURE__ */ jsxs("div", { children: [
48118
48125
  /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Scene Name" }),
48119
- /* @__PURE__ */ jsx("div", { className: "font-medium", children: l })
48126
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: e.SceneName })
48120
48127
  ] })
48121
48128
  ] }) })
48122
48129
  ] }),
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" }),
48130
+ 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: [
48131
+ g && /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-full" }),
48125
48132
  /* @__PURE__ */ jsx(
48126
48133
  "video",
48127
48134
  {
48128
- src: f,
48135
+ src: R.videoUrl,
48129
48136
  controls: !0,
48130
48137
  preload: "auto",
48131
48138
  playsInline: !0,
48132
- className: `w-full h-full object-contain ${T ? "invisible" : "visible"}`,
48139
+ "aria-label": `Video for ${e.PublicName}`,
48140
+ className: `w-full h-full object-contain ${g ? "invisible" : "visible"}`,
48133
48141
  style: {
48134
48142
  objectPosition: "center",
48135
48143
  imageRendering: "auto"
48136
48144
  },
48137
- onLoadedData: N,
48138
- onError: () => M(!1)
48145
+ onLoadedData: C,
48146
+ onError: () => b(!1)
48139
48147
  }
48140
48148
  )
48141
48149
  ] }) })
@@ -48528,7 +48536,7 @@ function ProductCard({
48528
48536
  return !(ce.EndDate && ce.EndDate < J || ce.StartDate && ce.StartDate > J);
48529
48537
  };
48530
48538
  if (!e)
48531
- return /* @__PURE__ */ jsx(Card, { className: "hover:shadow-lg transition-shadow", children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
48539
+ return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "p-6", children: [
48532
48540
  /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start mb-3", children: [
48533
48541
  /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-3/4" }),
48534
48542
  /* @__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 +48925,13 @@ function ProductCard({
48917
48925
  }
48918
48926
  function ManufacturerCard({
48919
48927
  manufacturer: e,
48920
- goToManufacturerLink: t,
48928
+ link: t,
48921
48929
  actionItems: n = [],
48922
- isLoading: i = !1
48930
+ loading: i = !1
48923
48931
  }) {
48924
48932
  var m;
48925
- if (i)
48926
- return /* @__PURE__ */ jsxs(Card, { className: "w-full max-w-md overflow-hidden", children: [
48933
+ if (i || !e)
48934
+ return /* @__PURE__ */ jsxs(Card, { children: [
48927
48935
  /* @__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
48936
  /* @__PURE__ */ jsx(Skeleton, { className: "h-12 w-12 rounded-md" }),
48929
48937
  /* @__PURE__ */ jsxs("div", { children: [
@@ -48966,7 +48974,7 @@ function ManufacturerCard({
48966
48974
  ] });
48967
48975
  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
48976
  };
48969
- return /* @__PURE__ */ jsxs(Card, { className: "w-full max-w-md overflow-hidden manufacturer-theme", children: [
48977
+ return /* @__PURE__ */ jsxs(Card, { className: "manufacturer-theme", children: [
48970
48978
  /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: [
48971
48979
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
48972
48980
  /* @__PURE__ */ jsx("div", { className: "h-12 w-12 overflow-hidden rounded-md", children: /* @__PURE__ */ jsx(
@@ -49007,7 +49015,7 @@ function ManufacturerCard({
49007
49015
  ] })
49008
49016
  ] })
49009
49017
  ] }) }),
49010
- /* @__PURE__ */ jsxs(CardFooter, { className: `flex pt-2 gap-2 ${n.length > 0 ? "justify-between" : "justify-end"}`, children: [
49018
+ (n.length > 0 || t) && /* @__PURE__ */ jsxs(CardFooter, { className: `flex pt-2 gap-2 ${n.length > 0 ? "justify-between" : "justify-end"}`, children: [
49011
49019
  n.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [
49012
49020
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", className: "text-primary", children: [
49013
49021
  "Actions ",
@@ -49015,7 +49023,7 @@ function ManufacturerCard({
49015
49023
  ] }) }),
49016
49024
  /* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", children: n.map((g, b) => p(g, b)) })
49017
49025
  ] }),
49018
- /* @__PURE__ */ jsx(Button, { className: "flex items-center gap-1", asChild: !0, children: /* @__PURE__ */ jsxs(Link, { to: t, children: [
49026
+ t && /* @__PURE__ */ jsx(Button, { className: "flex items-center gap-1", asChild: !0, children: /* @__PURE__ */ jsxs(Link, { to: t, children: [
49019
49027
  "Go to Manufacturer",
49020
49028
  /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
49021
49029
  ] }) })
@@ -49024,12 +49032,12 @@ function ManufacturerCard({
49024
49032
  }
49025
49033
  function ResellerCard({
49026
49034
  reseller: e,
49027
- goToResellerLink: t,
49035
+ link: t,
49028
49036
  actionItems: n = [],
49029
- isLoading: i = !1
49037
+ loading: i = !1
49030
49038
  }) {
49031
- if (i)
49032
- return /* @__PURE__ */ jsxs(Card, { className: "w-full max-w-md overflow-hidden", children: [
49039
+ if (i || !e)
49040
+ return /* @__PURE__ */ jsxs(Card, { children: [
49033
49041
  /* @__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
49042
  /* @__PURE__ */ jsx(Skeleton, { className: "h-12 w-12 rounded-md" }),
49035
49043
  /* @__PURE__ */ jsxs("div", { children: [
@@ -49065,7 +49073,7 @@ function ResellerCard({
49065
49073
  ] });
49066
49074
  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
49075
  };
49068
- return /* @__PURE__ */ jsxs(Card, { className: "w-full max-w-md overflow-hidden reseller-theme", children: [
49076
+ return /* @__PURE__ */ jsxs(Card, { className: "reseller-theme", children: [
49069
49077
  /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-start justify-between space-y-0 pb-2 pt-4", children: [
49070
49078
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
49071
49079
  /* @__PURE__ */ jsx("div", { className: "h-12 w-12 overflow-hidden rounded-md", children: /* @__PURE__ */ jsx(
@@ -49103,7 +49111,7 @@ function ResellerCard({
49103
49111
  /* @__PURE__ */ jsx("span", { children: e.Website })
49104
49112
  ] })
49105
49113
  ] }) }) }),
49106
- /* @__PURE__ */ jsxs(CardFooter, { className: `flex pt-2 gap-2 ${n.length > 0 ? "justify-between" : "justify-end"}`, children: [
49114
+ (n.length > 0 || t) && /* @__PURE__ */ jsxs(CardFooter, { className: `flex pt-2 gap-2 ${n.length > 0 ? "justify-between" : "justify-end"}`, children: [
49107
49115
  n.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [
49108
49116
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", className: "text-primary", children: [
49109
49117
  "Actions ",
@@ -49111,7 +49119,7 @@ function ResellerCard({
49111
49119
  ] }) }),
49112
49120
  /* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", children: n.map((p, m) => f(p, m)) })
49113
49121
  ] }),
49114
- /* @__PURE__ */ jsx(Button, { className: "flex items-center gap-1", asChild: !0, children: /* @__PURE__ */ jsxs(Link, { to: t, children: [
49122
+ t && /* @__PURE__ */ jsx(Button, { className: "flex items-center gap-1", asChild: !0, children: /* @__PURE__ */ jsxs(Link, { to: t, children: [
49115
49123
  "Go to Reseller",
49116
49124
  /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
49117
49125
  ] }) })