randmarcomps 1.322.0 → 1.325.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.d.ts +5 -6
- package/dist/randmarcomps.js +50 -47
- package/dist/randmarcomps.umd.cjs +8 -8
- package/package.json +1 -1
package/dist/randmarcomps.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
|
12
12
|
import { FC } from 'react';
|
|
13
13
|
import { ForwardRefExoticComponent } from 'react';
|
|
14
14
|
import { GeneralDocument } from 'randmar-api-client';
|
|
15
|
+
import { GoogleChartOptions } from 'react-google-charts';
|
|
15
16
|
import { InputProps as InputProps_2 } from './input';
|
|
16
17
|
import { Inventory } from 'randmar-api-client';
|
|
17
18
|
import { JSX } from 'react/jsx-runtime';
|
|
@@ -804,7 +805,7 @@ export declare const Sidebar: React_2.ForwardRefExoticComponent<Omit<React_2.Cla
|
|
|
804
805
|
|
|
805
806
|
export declare const SidebarContent: React_2.ForwardRefExoticComponent<Omit<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
806
807
|
|
|
807
|
-
declare type
|
|
808
|
+
declare type SidebarContextValue = {
|
|
808
809
|
state: "expanded" | "collapsed";
|
|
809
810
|
open: boolean;
|
|
810
811
|
setOpen: (open: boolean) => void;
|
|
@@ -814,8 +815,6 @@ declare type SidebarContext = {
|
|
|
814
815
|
toggleSidebar: () => void;
|
|
815
816
|
};
|
|
816
817
|
|
|
817
|
-
declare const SidebarContext: React_2.Context<SidebarContext | null>;
|
|
818
|
-
|
|
819
818
|
export declare const SidebarFooter: React_2.ForwardRefExoticComponent<Omit<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
820
819
|
|
|
821
820
|
export declare const SidebarGroup: React_2.ForwardRefExoticComponent<Omit<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
@@ -985,12 +984,12 @@ declare interface TopPercentTreemapProps {
|
|
|
985
984
|
export declare const Treemap: React_2.ForwardRefExoticComponent<TreemapProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
986
985
|
|
|
987
986
|
declare interface TreemapProps {
|
|
988
|
-
data:
|
|
987
|
+
data: (string | number | null)[][];
|
|
989
988
|
/**
|
|
990
989
|
* A Google Charts options object for customizing the treemap's appearance and behavior.
|
|
991
990
|
* @see https://developers.google.com/chart/interactive/docs/gallery/treemap#configuration-options
|
|
992
991
|
*/
|
|
993
|
-
options?:
|
|
992
|
+
options?: GoogleChartOptions;
|
|
994
993
|
height?: string;
|
|
995
994
|
className?: string;
|
|
996
995
|
loading?: boolean;
|
|
@@ -1003,7 +1002,7 @@ export declare const useGeminiApiKey: () => ApiKeyContextType;
|
|
|
1003
1002
|
|
|
1004
1003
|
export declare function useIsMobile(): boolean;
|
|
1005
1004
|
|
|
1006
|
-
export declare function useSidebar():
|
|
1005
|
+
export declare function useSidebar(): SidebarContextValue;
|
|
1007
1006
|
|
|
1008
1007
|
export declare function useToast(): {
|
|
1009
1008
|
toast: typeof toast;
|
package/dist/randmarcomps.js
CHANGED
|
@@ -16288,6 +16288,13 @@ function useIsMobile() {
|
|
|
16288
16288
|
return n.addEventListener("change", o), e(window.innerWidth < MOBILE_BREAKPOINT), () => n.removeEventListener("change", o);
|
|
16289
16289
|
}, []), !!t;
|
|
16290
16290
|
}
|
|
16291
|
+
const SidebarContext = React.createContext(null);
|
|
16292
|
+
function useSidebar() {
|
|
16293
|
+
const t = React.useContext(SidebarContext);
|
|
16294
|
+
if (!t)
|
|
16295
|
+
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
16296
|
+
return t;
|
|
16297
|
+
}
|
|
16291
16298
|
function Skeleton({
|
|
16292
16299
|
className: t,
|
|
16293
16300
|
...e
|
|
@@ -16300,14 +16307,7 @@ function Skeleton({
|
|
|
16300
16307
|
}
|
|
16301
16308
|
);
|
|
16302
16309
|
}
|
|
16303
|
-
const SIDEBAR_COOKIE_NAME = "sidebar:state", SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7, SIDEBAR_WIDTH = "16rem", SIDEBAR_WIDTH_MOBILE = "18rem", SIDEBAR_WIDTH_ICON = "3rem", SIDEBAR_KEYBOARD_SHORTCUT = "b",
|
|
16304
|
-
function useSidebar() {
|
|
16305
|
-
const t = React.useContext(SidebarContext);
|
|
16306
|
-
if (!t)
|
|
16307
|
-
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
16308
|
-
return t;
|
|
16309
|
-
}
|
|
16310
|
-
const SidebarProvider = React.forwardRef(
|
|
16310
|
+
const SIDEBAR_COOKIE_NAME = "sidebar:state", SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7, SIDEBAR_WIDTH = "16rem", SIDEBAR_WIDTH_MOBILE = "18rem", SIDEBAR_WIDTH_ICON = "3rem", SIDEBAR_KEYBOARD_SHORTCUT = "b", SidebarProvider = React.forwardRef(
|
|
16311
16311
|
({
|
|
16312
16312
|
defaultOpen: t = !0,
|
|
16313
16313
|
open: e,
|
|
@@ -35593,7 +35593,7 @@ function ChartTooltipContent({ active: t, payload: e, label: n, series: o }) {
|
|
|
35593
35593
|
return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-background p-2 text-sm shadow-sm", children: [
|
|
35594
35594
|
/* @__PURE__ */ jsx("div", { className: "mb-1 font-medium", children: n }),
|
|
35595
35595
|
/* @__PURE__ */ jsx("div", { className: "space-y-1", children: e.map((d) => {
|
|
35596
|
-
if (d.value === null || d.value === void 0)
|
|
35596
|
+
if (typeof d.dataKey != "string" || d.value === null || d.value === void 0)
|
|
35597
35597
|
return null;
|
|
35598
35598
|
const f = l.get(d.dataKey);
|
|
35599
35599
|
if (!f) return null;
|
|
@@ -54132,7 +54132,8 @@ async function convertExcelWithApi(t, e, n, o) {
|
|
|
54132
54132
|
const b = await f.json();
|
|
54133
54133
|
g += `
|
|
54134
54134
|
Server response: ${JSON.stringify(b)}`;
|
|
54135
|
-
} catch {
|
|
54135
|
+
} catch (b) {
|
|
54136
|
+
console.error(b);
|
|
54136
54137
|
const S = await f.text().catch(() => "Could not read error text.");
|
|
54137
54138
|
g += `
|
|
54138
54139
|
Server response (text): ${S}`;
|
|
@@ -54274,35 +54275,35 @@ function useAIAssistant({ userId: t, smartAndSlow: e = !1 }) {
|
|
|
54274
54275
|
}
|
|
54275
54276
|
const oe = async ($e, Ne) => {
|
|
54276
54277
|
try {
|
|
54277
|
-
const
|
|
54278
|
+
const Ve = [$e.trim()];
|
|
54278
54279
|
if (Ne) {
|
|
54279
54280
|
o("Receiving attached file...");
|
|
54280
|
-
let
|
|
54281
|
+
let ze = new Blob(
|
|
54281
54282
|
[await Ne.arrayBuffer()],
|
|
54282
54283
|
{ type: Ne.type }
|
|
54283
|
-
),
|
|
54284
|
-
if (
|
|
54285
|
-
|
|
54286
|
-
|
|
54287
|
-
}
|
|
54288
|
-
const
|
|
54289
|
-
file:
|
|
54290
|
-
config: { displayName:
|
|
54284
|
+
), Oe = Ne.name;
|
|
54285
|
+
if (Oe.indexOf(".xl") !== -1) {
|
|
54286
|
+
const Ge = await convertExcelWithApi(t, ze, Oe, localStorage.getItem("access_token"));
|
|
54287
|
+
Oe = Oe.replace(/\.(xlsx|xls)$/, ".txt"), ze = new Blob([ne(Ge)], { type: "text/plain" });
|
|
54288
|
+
}
|
|
54289
|
+
const Le = await O.files.upload({
|
|
54290
|
+
file: ze,
|
|
54291
|
+
config: { displayName: Oe }
|
|
54291
54292
|
});
|
|
54292
|
-
let
|
|
54293
|
-
for (;
|
|
54294
|
-
|
|
54295
|
-
setTimeout(
|
|
54293
|
+
let qe = await O.files.get({ name: Le.name });
|
|
54294
|
+
for (; qe.state === "PROCESSING"; )
|
|
54295
|
+
qe = await O.files.get({ name: Le.name }), await new Promise((Ge) => {
|
|
54296
|
+
setTimeout(Ge, 1e3);
|
|
54296
54297
|
});
|
|
54297
|
-
if (
|
|
54298
|
+
if (Le.state === "FAILED")
|
|
54298
54299
|
throw new Error("File processing failed.");
|
|
54299
|
-
|
|
54300
|
+
Ve.push({ fileData: { fileUri: Le.uri, mimeType: Le.mimeType } });
|
|
54300
54301
|
}
|
|
54301
54302
|
o("Thinking...");
|
|
54302
|
-
const
|
|
54303
|
-
await F(
|
|
54304
|
-
} catch (
|
|
54305
|
-
console.error("[debug] error sending message:",
|
|
54303
|
+
const je = await f.sendMessage({ message: Ve });
|
|
54304
|
+
await F(je);
|
|
54305
|
+
} catch (Ve) {
|
|
54306
|
+
console.error("[debug] error sending message:", Ve), ge({
|
|
54306
54307
|
content: "I'm sorry, I encountered an error processing your request. Please try again later.",
|
|
54307
54308
|
timestamp: /* @__PURE__ */ new Date()
|
|
54308
54309
|
});
|
|
@@ -60274,7 +60275,7 @@ function createDOMPurify() {
|
|
|
60274
60275
|
}
|
|
60275
60276
|
var purify = createDOMPurify();
|
|
60276
60277
|
function markdownToSafeHTML(t) {
|
|
60277
|
-
|
|
60278
|
+
const e = marked(t, { async: !1 });
|
|
60278
60279
|
return purify.sanitize(e, {
|
|
60279
60280
|
ALLOWED_TAGS: [
|
|
60280
60281
|
// ======== Headings ========
|
|
@@ -60698,10 +60699,9 @@ const DebugMessageDisplay = ({ debugMessages: t }) => {
|
|
|
60698
60699
|
if (useEffect(() => {
|
|
60699
60700
|
if (je === null) return;
|
|
60700
60701
|
const pt = Oe.find((Kt) => Kt.conversationID === je[0]);
|
|
60701
|
-
if (pt
|
|
60702
|
-
|
|
60703
|
-
|
|
60704
|
-
}
|
|
60702
|
+
if (!pt || (pt.pending && se("pending"), $e([pt.partner1, pt.partner2]), je[0] === -1 && !F) || je[0] !== -1 && !He) return;
|
|
60703
|
+
const Zt = je[1];
|
|
60704
|
+
ze(null), Zt && Ke(Zt);
|
|
60705
60705
|
}, [je, Oe, se, $e, F, He]), useImperativeHandle(f, () => ({
|
|
60706
60706
|
setActiveChatAndSendMessage: it
|
|
60707
60707
|
})), !F)
|
|
@@ -64857,7 +64857,7 @@ function SalesChart({
|
|
|
64857
64857
|
const z = String(q.Day ?? 0);
|
|
64858
64858
|
if (z.length !== 8) return;
|
|
64859
64859
|
const Q = `${z.substring(0, 4)}-${z.substring(4, 6)}`;
|
|
64860
|
-
O
|
|
64860
|
+
O[Q] && (O[Q].price += q.ExtendedPrice ?? 0, O[Q].quantity += q.Quantity ?? 0);
|
|
64861
64861
|
}), _ = I.map((q) => {
|
|
64862
64862
|
const z = O[q], [Q, j] = q.split("-").map(Number);
|
|
64863
64863
|
return {
|
|
@@ -93274,9 +93274,7 @@ const Treemap = React.forwardRef(
|
|
|
93274
93274
|
const b = React.useRef(null), [S, _] = React.useState(null);
|
|
93275
93275
|
React.useEffect(() => {
|
|
93276
93276
|
if (!b.current) return;
|
|
93277
|
-
const R = b.current
|
|
93278
|
-
let A;
|
|
93279
|
-
const M = () => {
|
|
93277
|
+
const R = b.current, A = () => {
|
|
93280
93278
|
const q = getComputedStyle(R).getPropertyValue("--primary").trim();
|
|
93281
93279
|
if (q) {
|
|
93282
93280
|
const z = parseHsl(q);
|
|
@@ -93292,14 +93290,14 @@ const Treemap = React.forwardRef(
|
|
|
93292
93290
|
}
|
|
93293
93291
|
return !1;
|
|
93294
93292
|
};
|
|
93295
|
-
if (
|
|
93293
|
+
if (A())
|
|
93296
93294
|
return;
|
|
93297
|
-
let
|
|
93298
|
-
const O =
|
|
93299
|
-
|
|
93300
|
-
|
|
93301
|
-
|
|
93302
|
-
|
|
93295
|
+
let M = 0;
|
|
93296
|
+
const I = 20, O = setInterval(() => {
|
|
93297
|
+
(A() || M >= I) && clearInterval(O), M++;
|
|
93298
|
+
}, 100);
|
|
93299
|
+
return () => {
|
|
93300
|
+
O && clearInterval(O);
|
|
93303
93301
|
};
|
|
93304
93302
|
}, []);
|
|
93305
93303
|
const C = React.useMemo(() => {
|
|
@@ -93308,6 +93306,7 @@ const Treemap = React.forwardRef(
|
|
|
93308
93306
|
fontSize: 14,
|
|
93309
93307
|
showScale: !1,
|
|
93310
93308
|
isHtml: !0,
|
|
93309
|
+
backgroundColor: "hsl(var(--background))",
|
|
93311
93310
|
generateTooltip: (A, M) => {
|
|
93312
93311
|
var q;
|
|
93313
93312
|
const I = (q = t[A + 1]) == null ? void 0 : q[0];
|
|
@@ -93321,6 +93320,9 @@ const Treemap = React.forwardRef(
|
|
|
93321
93320
|
return S && (!e || !e.colorAxis) && (R.minColor = S.minColor, R.midColor = S.midColor, R.maxColor = S.maxColor), { ...R, ...e };
|
|
93322
93321
|
}, [t, e, S]), E = React.useMemo(() => d ? [{
|
|
93323
93322
|
eventName: "select",
|
|
93323
|
+
// react-google-charts is not officially maintained by Google and not up
|
|
93324
|
+
// to date with the GoogleChartWrapper type, setSelection is missing
|
|
93325
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93324
93326
|
callback: ({ chartWrapper: A }) => {
|
|
93325
93327
|
A.getChart().setSelection(null);
|
|
93326
93328
|
}
|
|
@@ -93368,7 +93370,8 @@ const TopPercentTreemap = ({
|
|
|
93368
93370
|
return _;
|
|
93369
93371
|
}, [t, e]), f = React.useMemo(() => ({
|
|
93370
93372
|
title: n,
|
|
93371
|
-
maxDepth: 1
|
|
93373
|
+
maxDepth: 1,
|
|
93374
|
+
backgroundColor: "hsl(var(--background))"
|
|
93372
93375
|
}), [n]);
|
|
93373
93376
|
return /* @__PURE__ */ jsx(
|
|
93374
93377
|
Treemap,
|