@fayz-ai/admin 0.30.0 → 0.30.1
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/index.js
CHANGED
|
@@ -19,8 +19,8 @@ import { usePermissionOptional, usePermissionsStore, PermissionsProvider } from
|
|
|
19
19
|
export { PermissionsProvider, useHasPermission, usePermission, usePermissionOptional, usePermissions, usePermissionsStore } from './chunk-UQ2NTFQC.js';
|
|
20
20
|
import { cn, useOrganizationStore } from './chunk-W5IBKM3K.js';
|
|
21
21
|
export { getPersistedOrgId, useOrganizationStore } from './chunk-W5IBKM3K.js';
|
|
22
|
-
import * as
|
|
23
|
-
import
|
|
22
|
+
import * as React120 from 'react';
|
|
23
|
+
import React120__default, { createContext, useMemo, useState, useRef, useCallback, useEffect, useLayoutEffect, createElement, useContext } from 'react';
|
|
24
24
|
import { createDebug, resetActiveUnit, setUnitMode, setActiveUnitId, setScopedResources, tl, fetchAppConfig, getSupabaseClientOptional, createSafeDataProvider, isKnownMissing, rememberIfMissing, deriveEntityKey, registerEntity, getActiveTenantId, resolveDataProvider, bulkRemove, emitDomainEvent, entityEventKey, errorMessage, useTranslation, useDataChanged, emitDataChanged, exportCSV, formatDateTime as formatDateTime$1, formatDate as formatDate$1, formatCurrency as formatCurrency$1, bulkCreate, matchesRange, isConnectorCategory, usePluginRuntimeOptional, useDataVersion, reportAppError, getWidgetsForZone, resolvePluginComponent, invalidateAppConfig, toTenantPluginBindings, setCurrentLocale, resolveLocale, resolvePluginRuntime, PluginRuntimeProvider, I18nProvider, getAllEntities, resolveIntegrationSurface, defineApp, registerScaffold, useActiveTenantId, useConnectorsForPlugin, renderApp as renderApp$1, parseRangeFilter, isFilterObject, connectionKey, useManifest, registerEventSink, usePluginRuntime, installGlobalErrorHandlers, registerErrorReporter, applyNavComposition, mergeTranslations, coreTranslations, attachPersistentCache, getPersistentCache, createMockProvider, listConnections, connectorPlanes, connectorPermissions, connectorEntities, preferredPlane, connectorDirection, countByTenant, getCurrentLocale, searchEverything, getComponent, getPluginFactory, connectorSettings, groupedPermissions, invocationPlane, missingRequiredSettings, isSettingSet, getEntityByKey, connectorSubscribesTo, eventKeyMatches, formatPostalCode, isValidPostalCode, lookupPostalCode } from '@fayz-ai/core';
|
|
25
25
|
export { ConnectorRuntimeTokenUnavailableError, createSafeDataProvider, formatDate, formatDateTime, getActiveLocale, getActiveTenantId, getConnectorRuntimeTokenSource, getCurrentLocale, getSupabaseClientOptional, preloadLocale, resolveBackendEnv, setConnectorRuntimeTokenSource, setCurrentLocale, tl, useActiveTenantId } from '@fayz-ai/core';
|
|
26
26
|
import { usePasswordSetupGate, SetPasswordPage, AuthGate, AuthProvider, createAuthRuntime } from '@fayz-ai/plugin-auth';
|
|
@@ -31,9 +31,9 @@ import { useAuthStore, useAuth, buildAppHandoffUrl } from '@fayz-ai/auth';
|
|
|
31
31
|
export { useAuth } from '@fayz-ai/auth';
|
|
32
32
|
import { create, useStore as useStore$1 } from 'zustand';
|
|
33
33
|
import * as LucideIcons3 from 'lucide-react';
|
|
34
|
-
import { Trash2, Upload, Search, ArrowDown, ArrowUp, ArrowUpDown, Check, Download, ChevronLeft, ChevronRight, AlertTriangle, Pencil, Inbox, Package, Sparkles, Plug, DollarSign, Clock, X, WandSparkles, Loader2, ArrowDownToLine, ArrowUpFromLine, CheckCircle2, Crown, ArrowRight, History, SquarePen, Settings2, Mic, User, Plus, Minus, ListChecks, ChevronDown, ArrowLeft, Calendar, ClipboardList, CheckSquare, BookOpen, Lock, PinOff, Pin, Eye, Users, StickyNote, CheckSquare2, Square, Building2, RotateCcw, Copy, Globe, LayoutTemplate, Store, ChevronsUpDown, ExternalLink, PenSquare, RefreshCw, XCircle, Camera, Edit, Star, Link2Off, Layers, ShoppingBag, MoreHorizontal, ChevronUp, List, LayoutGrid, CircleDollarSign, Receipt, Settings, Mail, MessageCircle, Cake, HelpCircle, Wrench, TableProperties, ShieldCheck, MessageSquare, Paperclip, Infinity, CheckCheck, PartyPopper, Compass, Play, MapPin, ArrowUpRight, Pause, CalendarDays, CircleCheckBig, UserX, Ban, CircleAlert, CircleEllipsis, FileText, CircleDashed, Power, ArrowRightLeft, File as File$1, FileImage, FileSpreadsheet, AlertCircle, CreditCard, SlidersHorizontal, Puzzle, Shield, Palette, Blocks, ShieldAlert, UserCog, LogOut, Bell, ImagePlus, Database, Radio, Zap, Save, UserPlus, Contact, UserMinus, Send, Sun, Moon, Monitor, Languages, Info, LocateFixed, Link2, KeyRound, Bug, Heart, Briefcase, BarChart3, Tag, Truck } from 'lucide-react';
|
|
35
|
-
import { createPortal } from 'react-dom';
|
|
34
|
+
import { Trash2, Upload, Search, ArrowDown, ArrowUp, ArrowUpDown, Check, Download, ChevronLeft, ChevronRight, AlertTriangle, Pencil, Inbox, Package, Sparkles, Plug, DollarSign, Clock, X, WandSparkles, Loader2, ArrowDownToLine, ArrowUpFromLine, CheckCircle2, Crown, ArrowRight, History, SquarePen, Settings2, Mic, User, Plus, Minus, ListChecks, ChevronDown, ArrowLeft, Calendar, ClipboardList, CheckSquare, BookOpen, Lock, PinOff, Pin, Eye, Users, StickyNote, CheckSquare2, Square, Building2, RotateCcw, Copy, Globe, LayoutTemplate, Store, ChevronsUpDown, ExternalLink, PenSquare, RefreshCw, XCircle, Camera, Edit, Star, Link2Off, Layers, ShoppingBag, MoreHorizontal, ChevronUp, List, LayoutGrid, CircleDollarSign, Receipt, Settings, Mail, MessageCircle, Cake, HelpCircle, Wrench, TableProperties, ShieldCheck, MessageSquare, Paperclip, Infinity, CheckCheck, PartyPopper, Compass, Play, ArrowUpCircle, MapPin, ArrowUpRight, Pause, CalendarDays, CircleCheckBig, UserX, Ban, CircleAlert, CircleEllipsis, FileText, CircleDashed, Power, ArrowRightLeft, File as File$1, FileImage, FileSpreadsheet, AlertCircle, CreditCard, SlidersHorizontal, Puzzle, Shield, Palette, Blocks, ShieldAlert, UserCog, LogOut, Bell, ImagePlus, Database, Radio, Zap, Save, UserPlus, Contact, UserMinus, Send, Sun, Moon, Monitor, Languages, Info, LocateFixed, Link2, KeyRound, Bug, Heart, Briefcase, BarChart3, Tag, Truck } from 'lucide-react';
|
|
36
35
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
36
|
+
import { createPortal } from 'react-dom';
|
|
37
37
|
import { profileHasSystemPermission, mergeLimitDeclarations } from '@fayz-ai/core/access';
|
|
38
38
|
import { createFayzAgentClient } from '@fayz-ai/sdk/agent';
|
|
39
39
|
import { getConnectorCredentialSink, fayzPlatformOrigin, ConnectorOAuthStarterMissingError } from '@fayz-ai/sdk';
|
|
@@ -76,7 +76,7 @@ function useWorkspaceSetupGate(enabled) {
|
|
|
76
76
|
const close = useWorkspaceSetupStore((s) => s.close);
|
|
77
77
|
const path = useAdminPath();
|
|
78
78
|
const onRoute = path === WORKSPACE_SETUP_ROUTE;
|
|
79
|
-
const exitDeliberate =
|
|
79
|
+
const exitDeliberate = React120.useCallback(() => {
|
|
80
80
|
close();
|
|
81
81
|
if (onRoute) navigateTo("/");
|
|
82
82
|
}, [close, onRoute]);
|
|
@@ -182,6 +182,56 @@ function brandInstructions(brand) {
|
|
|
182
182
|
}
|
|
183
183
|
return lines.length > 0 ? lines.join(" ") : void 0;
|
|
184
184
|
}
|
|
185
|
+
var UPDATE_EVENT = "fayz:update-ready";
|
|
186
|
+
function UpdateReady() {
|
|
187
|
+
const { t } = useTranslation$1();
|
|
188
|
+
const [pronta, setPronta] = React120__default.useState(false);
|
|
189
|
+
const [dispensada, setDispensada] = React120__default.useState(false);
|
|
190
|
+
const [aplicando, setAplicando] = React120__default.useState(false);
|
|
191
|
+
React120__default.useEffect(() => {
|
|
192
|
+
const aviso = () => setPronta(true);
|
|
193
|
+
window.addEventListener(UPDATE_EVENT, aviso);
|
|
194
|
+
return () => window.removeEventListener(UPDATE_EVENT, aviso);
|
|
195
|
+
}, []);
|
|
196
|
+
if (!pronta || dispensada) return null;
|
|
197
|
+
return /* @__PURE__ */ jsx(
|
|
198
|
+
"div",
|
|
199
|
+
{
|
|
200
|
+
role: "status",
|
|
201
|
+
"aria-live": "polite",
|
|
202
|
+
className: "fixed bottom-4 left-1/2 z-50 -translate-x-1/2 px-4 sm:left-auto sm:right-4 sm:translate-x-0",
|
|
203
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 rounded-card border bg-card px-4 py-3 shadow-lg", children: [
|
|
204
|
+
/* @__PURE__ */ jsx(ArrowUpCircle, { className: "h-4 w-4 shrink-0 text-primary", "aria-hidden": true }),
|
|
205
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
206
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: t("app.update.title") }),
|
|
207
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("app.update.body") })
|
|
208
|
+
] }),
|
|
209
|
+
/* @__PURE__ */ jsx(
|
|
210
|
+
"button",
|
|
211
|
+
{
|
|
212
|
+
type: "button",
|
|
213
|
+
disabled: aplicando,
|
|
214
|
+
onClick: () => {
|
|
215
|
+
setAplicando(true);
|
|
216
|
+
window.fayzApplyUpdate?.();
|
|
217
|
+
},
|
|
218
|
+
className: "shrink-0 rounded-button bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:opacity-60",
|
|
219
|
+
children: aplicando ? t("app.update.applying") : t("app.update.action")
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
/* @__PURE__ */ jsx(
|
|
223
|
+
"button",
|
|
224
|
+
{
|
|
225
|
+
type: "button",
|
|
226
|
+
onClick: () => setDispensada(true),
|
|
227
|
+
className: "shrink-0 rounded-button px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground",
|
|
228
|
+
children: t("app.update.later")
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
] })
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}
|
|
185
235
|
var STORAGE_PREFIX = "fayz.agent.auto-approve.v1";
|
|
186
236
|
var DESTRUCTIVE = /(delete|destroy|remove|cancel|archive|refund|void)/i;
|
|
187
237
|
function isDestructiveTool(toolName) {
|
|
@@ -1889,7 +1939,7 @@ function getServerVersion() {
|
|
|
1889
1939
|
return 0;
|
|
1890
1940
|
}
|
|
1891
1941
|
function useAssistantActivity() {
|
|
1892
|
-
|
|
1942
|
+
React120.useSyncExternalStore(subscribe, getVersion, getServerVersion);
|
|
1893
1943
|
return pickActivity(activities);
|
|
1894
1944
|
}
|
|
1895
1945
|
var STATE_RANK = {
|
|
@@ -1905,22 +1955,22 @@ function pickActivity(list) {
|
|
|
1905
1955
|
return pool.find((a) => a.kind === "recording") ?? pool[0];
|
|
1906
1956
|
}
|
|
1907
1957
|
function useAssistantLaunchers() {
|
|
1908
|
-
|
|
1958
|
+
React120.useSyncExternalStore(subscribe, getVersion, getServerVersion);
|
|
1909
1959
|
return launchers;
|
|
1910
1960
|
}
|
|
1911
1961
|
function useLaunchersForRole(role) {
|
|
1912
1962
|
const all = useAssistantLaunchers();
|
|
1913
|
-
return
|
|
1963
|
+
return React120.useMemo(() => all.filter((l) => !l.role || l.role === role), [all, role]);
|
|
1914
1964
|
}
|
|
1915
1965
|
function usePublishAssistantActivity(activity) {
|
|
1916
1966
|
const id = activity?.id;
|
|
1917
1967
|
const key = activity ? `${activity.id}|${activity.kind}|${activity.label}|${activity.state}|${activity.elapsedMs ?? ""}|${(activity.actions ?? []).map((a) => a.intent).join(",")}|${activity.confirm?.acknowledge ?? ""}` : null;
|
|
1918
|
-
const ref =
|
|
1968
|
+
const ref = React120.useRef(activity);
|
|
1919
1969
|
ref.current = activity;
|
|
1920
|
-
|
|
1970
|
+
React120.useEffect(() => {
|
|
1921
1971
|
if (ref.current) publishAssistantActivity(ref.current);
|
|
1922
1972
|
}, [key]);
|
|
1923
|
-
|
|
1973
|
+
React120.useEffect(() => {
|
|
1924
1974
|
if (!id) return;
|
|
1925
1975
|
return () => withdrawAssistantActivity(id);
|
|
1926
1976
|
}, [id]);
|
|
@@ -1928,12 +1978,12 @@ function usePublishAssistantActivity(activity) {
|
|
|
1928
1978
|
function useRegisterAssistantLauncher(launcher) {
|
|
1929
1979
|
const id = launcher?.id;
|
|
1930
1980
|
const key = launcher ? `${launcher.id}|${launcher.label}|${launcher.disabled ? "1" : "0"}|${launcher.role ?? ""}` : null;
|
|
1931
|
-
const ref =
|
|
1981
|
+
const ref = React120.useRef(launcher);
|
|
1932
1982
|
ref.current = launcher;
|
|
1933
|
-
|
|
1983
|
+
React120.useEffect(() => {
|
|
1934
1984
|
if (ref.current) registerAssistantLauncher(ref.current);
|
|
1935
1985
|
}, [key]);
|
|
1936
|
-
|
|
1986
|
+
React120.useEffect(() => {
|
|
1937
1987
|
if (!id) return;
|
|
1938
1988
|
return () => unregisterAssistantLauncher(id);
|
|
1939
1989
|
}, [id]);
|
|
@@ -2031,42 +2081,42 @@ function useRightRailPanel(panel) {
|
|
|
2031
2081
|
const sublabel = panel?.sublabel;
|
|
2032
2082
|
const badgeCount = panel?.badge?.count;
|
|
2033
2083
|
const badgeTone = panel?.badge?.tone;
|
|
2034
|
-
const initial =
|
|
2035
|
-
|
|
2084
|
+
const initial = React120.useRef({ label: label2, icon });
|
|
2085
|
+
React120.useEffect(() => {
|
|
2036
2086
|
if (!id || !Component2) return;
|
|
2037
2087
|
register({ id, label: initial.current.label ?? id, order, Component: Component2, icon: initial.current.icon });
|
|
2038
2088
|
return () => unregister(id);
|
|
2039
2089
|
}, [id, order, Component2, register, unregister]);
|
|
2040
|
-
|
|
2090
|
+
React120.useEffect(() => {
|
|
2041
2091
|
if (!id) return;
|
|
2042
2092
|
updateMeta(id, { label: label2, icon, iconBare, trailing, sublabel });
|
|
2043
2093
|
}, [id, label2, icon, iconBare, trailing, sublabel, updateMeta]);
|
|
2044
|
-
|
|
2094
|
+
React120.useEffect(() => {
|
|
2045
2095
|
if (!id) return;
|
|
2046
2096
|
updateBadge(id, badgeCount !== void 0 ? { count: badgeCount, tone: badgeTone } : void 0);
|
|
2047
2097
|
}, [id, badgeCount, badgeTone, updateBadge]);
|
|
2048
2098
|
}
|
|
2049
|
-
var RightRailActionsSlotContext =
|
|
2099
|
+
var RightRailActionsSlotContext = React120.createContext(null);
|
|
2050
2100
|
var RightRailActionsSlotProvider = RightRailActionsSlotContext.Provider;
|
|
2051
2101
|
function RightRailActions({ children }) {
|
|
2052
|
-
const slot =
|
|
2102
|
+
const slot = React120.useContext(RightRailActionsSlotContext);
|
|
2053
2103
|
if (slot) return createPortal(children, slot);
|
|
2054
2104
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end gap-0.5 px-2 pt-1.5", children });
|
|
2055
2105
|
}
|
|
2056
|
-
var RightRailLeadingSlotContext =
|
|
2106
|
+
var RightRailLeadingSlotContext = React120.createContext(null);
|
|
2057
2107
|
var RightRailLeadingSlotProvider = RightRailLeadingSlotContext.Provider;
|
|
2058
2108
|
function RightRailLeading({ children }) {
|
|
2059
|
-
const slot =
|
|
2109
|
+
const slot = React120.useContext(RightRailLeadingSlotContext);
|
|
2060
2110
|
if (slot) return createPortal(children, slot);
|
|
2061
2111
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5 px-2 pt-1.5", children });
|
|
2062
2112
|
}
|
|
2063
2113
|
function useRightRailReselect(id, handler) {
|
|
2064
2114
|
const reselects = useRightRailStore((s) => s.reselects);
|
|
2065
2115
|
const reselectId = useRightRailStore((s) => s.reselectId);
|
|
2066
|
-
const ref =
|
|
2116
|
+
const ref = React120.useRef(handler);
|
|
2067
2117
|
ref.current = handler;
|
|
2068
|
-
const seen =
|
|
2069
|
-
|
|
2118
|
+
const seen = React120.useRef(reselects);
|
|
2119
|
+
React120.useEffect(() => {
|
|
2070
2120
|
if (reselects === seen.current) return;
|
|
2071
2121
|
seen.current = reselects;
|
|
2072
2122
|
if (reselectId === id) ref.current();
|
|
@@ -2083,9 +2133,9 @@ function useRightRailDrill(drill) {
|
|
|
2083
2133
|
const avatarName = drill?.avatar?.name;
|
|
2084
2134
|
const avatarSrc = drill?.avatar?.src;
|
|
2085
2135
|
const avatarFace = drill?.avatar?.Face;
|
|
2086
|
-
const backRef =
|
|
2136
|
+
const backRef = React120.useRef(drill?.back);
|
|
2087
2137
|
backRef.current = drill?.back;
|
|
2088
|
-
|
|
2138
|
+
React120.useEffect(() => {
|
|
2089
2139
|
if (!title) return;
|
|
2090
2140
|
setDrill({
|
|
2091
2141
|
title,
|
|
@@ -2200,7 +2250,7 @@ function buildPersonaGuidance() {
|
|
|
2200
2250
|
}
|
|
2201
2251
|
function useRegisterStaff(staff) {
|
|
2202
2252
|
const setAgent = useAgentStore((s) => s.setAgent);
|
|
2203
|
-
|
|
2253
|
+
React120__default.useEffect(() => {
|
|
2204
2254
|
if (staff && staff.length > 1) {
|
|
2205
2255
|
console.warn(
|
|
2206
2256
|
`[fayz] chat.staff lists ${staff.length} agents; an app has one. Using "${soleAgent(staff)?.name}" and ignoring the rest \u2014 see chat.agent.`
|
|
@@ -2233,7 +2283,7 @@ function AssistantInvite({ className, ...def }) {
|
|
|
2233
2283
|
const { id, persona, headline, pitch, description, placeholder, auto } = def;
|
|
2234
2284
|
const suggestions = def.suggestions;
|
|
2235
2285
|
const suggestionKey = JSON.stringify(suggestions ?? []);
|
|
2236
|
-
|
|
2286
|
+
React120.useEffect(() => {
|
|
2237
2287
|
if (!hasAssistant) return;
|
|
2238
2288
|
setInvite({
|
|
2239
2289
|
id,
|
|
@@ -2247,11 +2297,11 @@ function AssistantInvite({ className, ...def }) {
|
|
|
2247
2297
|
});
|
|
2248
2298
|
return () => setInvite(null, id);
|
|
2249
2299
|
}, [hasAssistant, id, persona, headline, pitch, description, placeholder, auto, suggestionKey, setInvite]);
|
|
2250
|
-
const anchorRef =
|
|
2251
|
-
const [box, setBox] =
|
|
2300
|
+
const anchorRef = React120.useRef(null);
|
|
2301
|
+
const [box, setBox] = React120.useState(null);
|
|
2252
2302
|
const docked = stage === "dock" && !railOpen && hasAssistant;
|
|
2253
2303
|
const showing = hasAssistant && (stage === "hero" || docked);
|
|
2254
|
-
|
|
2304
|
+
React120.useEffect(() => {
|
|
2255
2305
|
if (!showing) return;
|
|
2256
2306
|
const el = anchorRef.current;
|
|
2257
2307
|
if (!el) return;
|
|
@@ -2272,7 +2322,7 @@ function AssistantInvite({ className, ...def }) {
|
|
|
2272
2322
|
}, [showing]);
|
|
2273
2323
|
const setDockBox = useAssistantInviteStore((s) => s.setDockBox);
|
|
2274
2324
|
const wide = useWideViewport();
|
|
2275
|
-
|
|
2325
|
+
React120.useEffect(() => {
|
|
2276
2326
|
if (!docked || !wide || !box) {
|
|
2277
2327
|
setDockBox(null);
|
|
2278
2328
|
return;
|
|
@@ -2286,7 +2336,7 @@ function AssistantInvite({ className, ...def }) {
|
|
|
2286
2336
|
function useAsk() {
|
|
2287
2337
|
const queuePrompt = useChatStore((s) => s.queuePrompt);
|
|
2288
2338
|
const dismiss = useAssistantInviteStore((s) => s.dismiss);
|
|
2289
|
-
return
|
|
2339
|
+
return React120.useCallback(
|
|
2290
2340
|
(text2) => {
|
|
2291
2341
|
const trimmed = text2.trim();
|
|
2292
2342
|
if (!trimmed) return;
|
|
@@ -2304,9 +2354,9 @@ function InviteHero({
|
|
|
2304
2354
|
const { t } = useTranslation$1();
|
|
2305
2355
|
const user = useAuthStore((s) => s.user);
|
|
2306
2356
|
const ask = useAsk();
|
|
2307
|
-
const [draft, setDraft] =
|
|
2357
|
+
const [draft, setDraft] = React120.useState("");
|
|
2308
2358
|
const name = (user?.fullName || user?.email || "").split(/[\s@]/)[0];
|
|
2309
|
-
|
|
2359
|
+
React120.useEffect(() => {
|
|
2310
2360
|
const onKey = (event) => {
|
|
2311
2361
|
if (event.key === "Escape") onDismiss();
|
|
2312
2362
|
};
|
|
@@ -2368,8 +2418,8 @@ function InviteHero({
|
|
|
2368
2418
|
);
|
|
2369
2419
|
}
|
|
2370
2420
|
function useMorphIn(skip = false) {
|
|
2371
|
-
const [entered, setEntered] =
|
|
2372
|
-
|
|
2421
|
+
const [entered, setEntered] = React120.useState(() => skip || prefersReducedMotion());
|
|
2422
|
+
React120.useEffect(() => {
|
|
2373
2423
|
if (entered) return;
|
|
2374
2424
|
let second = 0;
|
|
2375
2425
|
const first = requestAnimationFrame(() => {
|
|
@@ -2388,10 +2438,10 @@ function prefersReducedMotion() {
|
|
|
2388
2438
|
var lastDockExit = null;
|
|
2389
2439
|
var RESUME_WINDOW_MS = 700;
|
|
2390
2440
|
function useWideViewport() {
|
|
2391
|
-
const [wide, setWide] =
|
|
2441
|
+
const [wide, setWide] = React120.useState(
|
|
2392
2442
|
() => typeof window !== "undefined" && !!window.matchMedia?.("(min-width: 768px)").matches
|
|
2393
2443
|
);
|
|
2394
|
-
|
|
2444
|
+
React120.useEffect(() => {
|
|
2395
2445
|
const query = window.matchMedia?.("(min-width: 768px)");
|
|
2396
2446
|
if (!query) return;
|
|
2397
2447
|
const sync = () => setWide(query.matches);
|
|
@@ -2422,21 +2472,21 @@ function InviteDock({ def, left, maxWidth }) {
|
|
|
2422
2472
|
const setOpen = useChatStore((s) => s.setOpen);
|
|
2423
2473
|
const railOpen = useRightRailStore((s) => s.open);
|
|
2424
2474
|
const railWidth = useRightRailStore((s) => s.width);
|
|
2425
|
-
const [draft, setDraft] =
|
|
2426
|
-
const resumed =
|
|
2475
|
+
const [draft, setDraft] = React120.useState("");
|
|
2476
|
+
const resumed = React120.useRef(
|
|
2427
2477
|
!!lastDockExit && lastDockExit.id === def.id && Date.now() - lastDockExit.at < RESUME_WINDOW_MS
|
|
2428
2478
|
).current;
|
|
2429
|
-
|
|
2479
|
+
React120.useEffect(() => () => {
|
|
2430
2480
|
lastDockExit = { id: def.id, at: Date.now() };
|
|
2431
2481
|
}, [def.id]);
|
|
2432
2482
|
const entered = useMorphIn(resumed);
|
|
2433
2483
|
const width = Math.min(maxWidth, DOCK_MAX_WIDTH);
|
|
2434
|
-
const mountGeo =
|
|
2484
|
+
const mountGeo = React120.useRef({ left, width }).current;
|
|
2435
2485
|
const morph = morphStyles({ left: mountGeo.left, width: mountGeo.width }, railOpen, railWidth);
|
|
2436
|
-
const [settled, setSettled] =
|
|
2486
|
+
const [settled, setSettled] = React120.useState(resumed);
|
|
2437
2487
|
const geoLeft = settled ? left : mountGeo.left;
|
|
2438
2488
|
const geoWidth = settled ? width : mountGeo.width;
|
|
2439
|
-
|
|
2489
|
+
React120.useEffect(() => {
|
|
2440
2490
|
if (!entered || settled) return;
|
|
2441
2491
|
const id = setTimeout(() => setSettled(true), MORPH_MS + 60);
|
|
2442
2492
|
return () => clearTimeout(id);
|
|
@@ -2582,7 +2632,7 @@ function MorphBackPill() {
|
|
|
2582
2632
|
const railWidth = useRightRailStore((s) => s.width);
|
|
2583
2633
|
const { t } = useTranslation$1();
|
|
2584
2634
|
const collapsed = useMorphIn();
|
|
2585
|
-
|
|
2635
|
+
React120.useEffect(() => {
|
|
2586
2636
|
if (prefersReducedMotion()) {
|
|
2587
2637
|
endLeave();
|
|
2588
2638
|
return;
|
|
@@ -4496,12 +4546,12 @@ function detectActivePluginId(runtime) {
|
|
|
4496
4546
|
function useAITools() {
|
|
4497
4547
|
const runtime = usePluginRuntimeOptional();
|
|
4498
4548
|
const access = useAccessOptional();
|
|
4499
|
-
const surfaceVersion =
|
|
4549
|
+
const surfaceVersion = React120.useSyncExternalStore(subscribeSurfaces, getSurfaceVersion, getSurfaceVersion);
|
|
4500
4550
|
const features = usePermissionsStore((s) => s.features);
|
|
4501
4551
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
4502
4552
|
const hasSystem = useSystemPermission();
|
|
4503
4553
|
const canManagePermissions = hasSystem("manage_permissions");
|
|
4504
|
-
return
|
|
4554
|
+
return React120.useMemo(() => {
|
|
4505
4555
|
const hasPermission = runtime?.context.hasPermission;
|
|
4506
4556
|
const can = access.can;
|
|
4507
4557
|
const verticalId = runtime?.context.tenant?.verticalId;
|
|
@@ -5509,8 +5559,8 @@ function loadCatalog() {
|
|
|
5509
5559
|
return catalogPromise;
|
|
5510
5560
|
}
|
|
5511
5561
|
function useConnectorCatalog() {
|
|
5512
|
-
const [catalog, setCatalog] =
|
|
5513
|
-
|
|
5562
|
+
const [catalog, setCatalog] = React120__default.useState(null);
|
|
5563
|
+
React120__default.useEffect(() => {
|
|
5514
5564
|
let cancelled = false;
|
|
5515
5565
|
void loadCatalog().then((list) => {
|
|
5516
5566
|
if (!cancelled) setCatalog(list);
|
|
@@ -5534,7 +5584,7 @@ function refreshConnectors() {
|
|
|
5534
5584
|
_revisionListeners.forEach((listener) => listener());
|
|
5535
5585
|
}
|
|
5536
5586
|
function useConnectorsRevision() {
|
|
5537
|
-
return
|
|
5587
|
+
return React120__default.useSyncExternalStore(
|
|
5538
5588
|
(listener) => {
|
|
5539
5589
|
_revisionListeners.add(listener);
|
|
5540
5590
|
return () => _revisionListeners.delete(listener);
|
|
@@ -5553,11 +5603,11 @@ function loadGrants(key, fetcher) {
|
|
|
5553
5603
|
}
|
|
5554
5604
|
function useInstalledModuleIds() {
|
|
5555
5605
|
const runtime = usePluginRuntimeOptional();
|
|
5556
|
-
return
|
|
5606
|
+
return React120__default.useMemo(() => (runtime?.plugins ?? []).map((p) => p.id), [runtime]);
|
|
5557
5607
|
}
|
|
5558
5608
|
function useInstalledDefinitions(hostPluginId) {
|
|
5559
5609
|
const runtime = usePluginRuntimeOptional();
|
|
5560
|
-
return
|
|
5610
|
+
return React120__default.useMemo(() => {
|
|
5561
5611
|
const byHost = runtime?.connectorsByHost;
|
|
5562
5612
|
if (!byHost) return [];
|
|
5563
5613
|
if (hostPluginId) return byHost.get(hostPluginId) ?? [];
|
|
@@ -5570,12 +5620,12 @@ function useConnectors(options = {}) {
|
|
|
5570
5620
|
const catalog = useConnectorCatalog();
|
|
5571
5621
|
const tenant = useTenantOptional();
|
|
5572
5622
|
const tenantId2 = tenant?.org?.id;
|
|
5573
|
-
const connection =
|
|
5574
|
-
const [installed, setInstalled] =
|
|
5575
|
-
const [grants, setGrants] =
|
|
5576
|
-
const [error, setError] =
|
|
5623
|
+
const connection = React120__default.useMemo(() => resolveFayzAgentConnection(), []);
|
|
5624
|
+
const [installed, setInstalled] = React120__default.useState(null);
|
|
5625
|
+
const [grants, setGrants] = React120__default.useState(null);
|
|
5626
|
+
const [error, setError] = React120__default.useState(null);
|
|
5577
5627
|
const nonce = useConnectorsRevision();
|
|
5578
|
-
const call2 =
|
|
5628
|
+
const call2 = React120__default.useCallback(
|
|
5579
5629
|
async (path, init) => {
|
|
5580
5630
|
if (!connection) throw new Error("Este app n\xE3o est\xE1 ligado a um projeto Fayz.");
|
|
5581
5631
|
const supabase = getFayzSupabaseClientOptional();
|
|
@@ -5595,7 +5645,7 @@ function useConnectors(options = {}) {
|
|
|
5595
5645
|
},
|
|
5596
5646
|
[connection]
|
|
5597
5647
|
);
|
|
5598
|
-
|
|
5648
|
+
React120__default.useEffect(() => {
|
|
5599
5649
|
let cancelled = false;
|
|
5600
5650
|
void loadConnectorStatuses(definitions, tenantId2).then((list) => {
|
|
5601
5651
|
if (!cancelled) setInstalled(list);
|
|
@@ -5604,7 +5654,7 @@ function useConnectors(options = {}) {
|
|
|
5604
5654
|
cancelled = true;
|
|
5605
5655
|
};
|
|
5606
5656
|
}, [definitions, tenantId2, nonce]);
|
|
5607
|
-
|
|
5657
|
+
React120__default.useEffect(() => {
|
|
5608
5658
|
if (!includeGrants || !connection || !tenantId2) {
|
|
5609
5659
|
setGrants(includeGrants ? null : []);
|
|
5610
5660
|
return;
|
|
@@ -5628,7 +5678,7 @@ function useConnectors(options = {}) {
|
|
|
5628
5678
|
cancelled = true;
|
|
5629
5679
|
};
|
|
5630
5680
|
}, [call2, tenantId2, includeGrants, connection, nonce]);
|
|
5631
|
-
const revokeGrant =
|
|
5681
|
+
const revokeGrant = React120__default.useCallback(
|
|
5632
5682
|
async (connector) => {
|
|
5633
5683
|
const response = await call2(`/${connector.id}`, { method: "DELETE" });
|
|
5634
5684
|
if (!response.ok) {
|
|
@@ -5641,7 +5691,7 @@ function useConnectors(options = {}) {
|
|
|
5641
5691
|
[call2]
|
|
5642
5692
|
);
|
|
5643
5693
|
const waitingGrants = includeGrants && !!connection && !!tenantId2 && grants === null;
|
|
5644
|
-
const connectors =
|
|
5694
|
+
const connectors = React120__default.useMemo(() => {
|
|
5645
5695
|
if (installed === null || waitingGrants) return null;
|
|
5646
5696
|
return buildConnectorList({
|
|
5647
5697
|
installed,
|
|
@@ -5882,9 +5932,9 @@ function ConnectorMark({
|
|
|
5882
5932
|
connector,
|
|
5883
5933
|
size = "md"
|
|
5884
5934
|
}) {
|
|
5885
|
-
const candidates =
|
|
5886
|
-
const [attempt, setAttempt] =
|
|
5887
|
-
|
|
5935
|
+
const candidates = React120__default.useMemo(() => markCandidates(connector), [connector.logoUrl, connector.name]);
|
|
5936
|
+
const [attempt, setAttempt] = React120__default.useState(0);
|
|
5937
|
+
React120__default.useEffect(() => setAttempt(0), [connector.id]);
|
|
5888
5938
|
const box = size === "sm" ? "h-9 w-9" : "h-10 w-10";
|
|
5889
5939
|
const glyph = size === "sm" ? "h-4 w-4" : "h-5 w-5";
|
|
5890
5940
|
if (connector.builtIn) {
|
|
@@ -7513,9 +7563,9 @@ function prefersReducedMotion2() {
|
|
|
7513
7563
|
return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
7514
7564
|
}
|
|
7515
7565
|
function TypewriterText({ text: text2, speed = 26, onDone }) {
|
|
7516
|
-
const [displayed, setDisplayed] =
|
|
7517
|
-
const indexRef =
|
|
7518
|
-
|
|
7566
|
+
const [displayed, setDisplayed] = React120.useState("");
|
|
7567
|
+
const indexRef = React120.useRef(0);
|
|
7568
|
+
React120.useEffect(() => {
|
|
7519
7569
|
if (prefersReducedMotion2()) {
|
|
7520
7570
|
setDisplayed(text2);
|
|
7521
7571
|
onDone?.();
|
|
@@ -7592,15 +7642,15 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7592
7642
|
const { contextualSuggestions } = useAITools();
|
|
7593
7643
|
const { sendMessage } = useChat({ apiEndpoint, systemPrompt, agent });
|
|
7594
7644
|
const { t } = useTranslation$1();
|
|
7595
|
-
const [phase, setPhase] =
|
|
7596
|
-
const [activeSuggestion, setActiveSuggestion] =
|
|
7597
|
-
const timersRef =
|
|
7598
|
-
const prevSuggestionRef =
|
|
7599
|
-
const [greeting, setGreeting] =
|
|
7600
|
-
const greetTimerRef =
|
|
7601
|
-
|
|
7645
|
+
const [phase, setPhase] = React120.useState("idle");
|
|
7646
|
+
const [activeSuggestion, setActiveSuggestion] = React120.useState(null);
|
|
7647
|
+
const timersRef = React120.useRef([]);
|
|
7648
|
+
const prevSuggestionRef = React120.useRef(null);
|
|
7649
|
+
const [greeting, setGreeting] = React120.useState(false);
|
|
7650
|
+
const greetTimerRef = React120.useRef(0);
|
|
7651
|
+
React120.useEffect(() => () => window.clearTimeout(greetTimerRef.current), []);
|
|
7602
7652
|
const hasFace = !!host?.AvatarComponent;
|
|
7603
|
-
|
|
7653
|
+
React120.useEffect(ensureStyles, []);
|
|
7604
7654
|
const clearTimers = () => {
|
|
7605
7655
|
timersRef.current.forEach(clearTimeout);
|
|
7606
7656
|
timersRef.current = [];
|
|
@@ -7613,10 +7663,10 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7613
7663
|
const invited = useAssistantInviteStore((s) => !!s.invite && s.stage === "dock");
|
|
7614
7664
|
const dockOnScreen = useAssistantInviteStore((s) => !!s.dockBox);
|
|
7615
7665
|
const morphingBack = useAssistantInviteStore((s) => !!s.leaving);
|
|
7616
|
-
const [wide, setWide] =
|
|
7666
|
+
const [wide, setWide] = React120.useState(
|
|
7617
7667
|
() => typeof window !== "undefined" && !!window.matchMedia?.("(min-width: 768px)").matches
|
|
7618
7668
|
);
|
|
7619
|
-
|
|
7669
|
+
React120.useEffect(() => {
|
|
7620
7670
|
const query = window.matchMedia?.("(min-width: 768px)");
|
|
7621
7671
|
if (!query) return;
|
|
7622
7672
|
const sync = () => setWide(query.matches);
|
|
@@ -7625,7 +7675,7 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7625
7675
|
return () => query.removeEventListener("change", sync);
|
|
7626
7676
|
}, []);
|
|
7627
7677
|
const teaserAllowed = !hasMessages && !activity && !invited && !teaserDismissed() && teaserShownCount() < TEASER_MAX_PER_SESSION;
|
|
7628
|
-
|
|
7678
|
+
React120.useEffect(() => {
|
|
7629
7679
|
if (expanded || !topSuggestion || !topLabel || !teaserAllowed || teaserSeen().includes(topLabel)) {
|
|
7630
7680
|
if (phase !== "idle") {
|
|
7631
7681
|
clearTimers();
|
|
@@ -7656,14 +7706,14 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7656
7706
|
}, 9e3);
|
|
7657
7707
|
return clearTimers;
|
|
7658
7708
|
}, [topLabel, expanded, teaserAllowed]);
|
|
7659
|
-
|
|
7709
|
+
React120.useEffect(() => {
|
|
7660
7710
|
if (expanded && phase !== "idle") {
|
|
7661
7711
|
clearTimers();
|
|
7662
7712
|
setPhase("idle");
|
|
7663
7713
|
}
|
|
7664
7714
|
}, [expanded]);
|
|
7665
|
-
const [entrance, setEntrance] =
|
|
7666
|
-
|
|
7715
|
+
const [entrance, setEntrance] = React120.useState("pending");
|
|
7716
|
+
React120.useEffect(() => {
|
|
7667
7717
|
if (!currentOrg || entrance !== "pending") return;
|
|
7668
7718
|
if (prefersReducedMotion2()) {
|
|
7669
7719
|
setEntrance("done");
|
|
@@ -7673,9 +7723,9 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7673
7723
|
const timer = setTimeout(() => setEntrance("done"), 1600);
|
|
7674
7724
|
return () => clearTimeout(timer);
|
|
7675
7725
|
}, [currentOrg, entrance]);
|
|
7676
|
-
const [poppingBack, setPoppingBack] =
|
|
7677
|
-
const wasMorphing =
|
|
7678
|
-
|
|
7726
|
+
const [poppingBack, setPoppingBack] = React120.useState(false);
|
|
7727
|
+
const wasMorphing = React120.useRef(false);
|
|
7728
|
+
React120.useEffect(() => {
|
|
7679
7729
|
const was = wasMorphing.current;
|
|
7680
7730
|
wasMorphing.current = morphingBack;
|
|
7681
7731
|
if (!was || morphingBack || prefersReducedMotion2()) return;
|
|
@@ -7973,7 +8023,7 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7973
8023
|
var MAX_SUGGESTIONS = 5;
|
|
7974
8024
|
function ChatSuggestions({ suggestions, onSelect, onDismiss, compact }) {
|
|
7975
8025
|
const { t } = useTranslation$1();
|
|
7976
|
-
const [open, setOpen] =
|
|
8026
|
+
const [open, setOpen] = React120.useState(true);
|
|
7977
8027
|
const visible = suggestions.slice(0, compact ? 3 : MAX_SUGGESTIONS);
|
|
7978
8028
|
if (!visible.length) return null;
|
|
7979
8029
|
return /* @__PURE__ */ jsxs(
|
|
@@ -8052,8 +8102,8 @@ function SuggestionRow({
|
|
|
8052
8102
|
detail,
|
|
8053
8103
|
onSelect
|
|
8054
8104
|
}) {
|
|
8055
|
-
const labelRef =
|
|
8056
|
-
const [showDetail, setShowDetail] =
|
|
8105
|
+
const labelRef = React120.useRef(null);
|
|
8106
|
+
const [showDetail, setShowDetail] = React120.useState(false);
|
|
8057
8107
|
const evaluate = () => {
|
|
8058
8108
|
const el = labelRef.current;
|
|
8059
8109
|
const clipped = !!el && el.scrollWidth > el.clientWidth + 1;
|
|
@@ -8147,8 +8197,8 @@ function ChatToolsPanel({ toolGroups, onClose }) {
|
|
|
8147
8197
|
}
|
|
8148
8198
|
function AutoApprovalsSection() {
|
|
8149
8199
|
const { t } = useTranslation$1();
|
|
8150
|
-
const [rules, setRules] =
|
|
8151
|
-
|
|
8200
|
+
const [rules, setRules] = React120.useState(() => listAutoApprovals());
|
|
8201
|
+
React120.useEffect(() => subscribeAutoApprovals(() => setRules(listAutoApprovals())), []);
|
|
8152
8202
|
if (!rules.length) return null;
|
|
8153
8203
|
return /* @__PURE__ */ jsxs("div", { className: "border-b border-border/40 px-3 py-2.5", children: [
|
|
8154
8204
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 px-1 pb-1.5", children: [
|
|
@@ -8201,14 +8251,14 @@ function bucketOf(iso) {
|
|
|
8201
8251
|
var ORDER = ["today", "yesterday", "week", "older"];
|
|
8202
8252
|
function ChatHistory({ conversations, activeId, onSelect }) {
|
|
8203
8253
|
const { t } = useTranslation$1();
|
|
8204
|
-
const [query, setQuery] =
|
|
8254
|
+
const [query, setQuery] = React120.useState("");
|
|
8205
8255
|
const mine = conversations;
|
|
8206
|
-
const filtered =
|
|
8256
|
+
const filtered = React120.useMemo(() => {
|
|
8207
8257
|
const needle = query.trim().toLowerCase();
|
|
8208
8258
|
if (!needle) return mine;
|
|
8209
8259
|
return mine.filter((c) => (c.title ?? "").toLowerCase().includes(needle));
|
|
8210
8260
|
}, [mine, query]);
|
|
8211
|
-
const groups =
|
|
8261
|
+
const groups = React120.useMemo(() => {
|
|
8212
8262
|
const map = /* @__PURE__ */ new Map();
|
|
8213
8263
|
for (const conversation of filtered) {
|
|
8214
8264
|
const bucket = bucketOf(conversation.updatedAt);
|
|
@@ -8335,7 +8385,7 @@ function TourCoachCard() {
|
|
|
8335
8385
|
const lastOutcome = useTourStore((s) => s.lastOutcome);
|
|
8336
8386
|
const stop = useTourStore((s) => s.stop);
|
|
8337
8387
|
const restart = useTourStore((s) => s.restart);
|
|
8338
|
-
const [dismissedId, setDismissedId] =
|
|
8388
|
+
const [dismissedId, setDismissedId] = React120.useState(null);
|
|
8339
8389
|
const pTitle = usePracticeStore((s) => s.title);
|
|
8340
8390
|
const pSteps = usePracticeStore((s) => s.steps);
|
|
8341
8391
|
const pDone = usePracticeStore((s) => s.done);
|
|
@@ -8406,8 +8456,8 @@ function AssistantRecordingView({ activity }) {
|
|
|
8406
8456
|
const live = activity.state === "running" || activity.state === "paused";
|
|
8407
8457
|
const running = activity.state === "running";
|
|
8408
8458
|
const actions = activity.actions ?? [];
|
|
8409
|
-
const [acknowledged, setAcknowledged] =
|
|
8410
|
-
|
|
8459
|
+
const [acknowledged, setAcknowledged] = React120.useState(false);
|
|
8460
|
+
React120.useEffect(() => setAcknowledged(false), [activity.id, activity.state]);
|
|
8411
8461
|
const withheld = pending2 && !!activity.confirm && !acknowledged;
|
|
8412
8462
|
const primary = actions.filter((a) => a.intent !== "discard");
|
|
8413
8463
|
const discard = actions.find((a) => a.intent === "discard");
|
|
@@ -8623,10 +8673,10 @@ function RightRailPage({
|
|
|
8623
8673
|
const closePage = useRightRailStore((s) => s.closePage);
|
|
8624
8674
|
const active2 = hosted && open;
|
|
8625
8675
|
const pageOpen = useRightRailStore((s) => s.pageOpen);
|
|
8626
|
-
const onCloseRef =
|
|
8676
|
+
const onCloseRef = React120.useRef(onClose);
|
|
8627
8677
|
onCloseRef.current = onClose;
|
|
8628
|
-
const claimed =
|
|
8629
|
-
|
|
8678
|
+
const claimed = React120.useRef(false);
|
|
8679
|
+
React120.useEffect(() => {
|
|
8630
8680
|
if (!active2) return;
|
|
8631
8681
|
showPage();
|
|
8632
8682
|
claimed.current = true;
|
|
@@ -8635,7 +8685,7 @@ function RightRailPage({
|
|
|
8635
8685
|
closePage();
|
|
8636
8686
|
};
|
|
8637
8687
|
}, [active2, showPage, closePage]);
|
|
8638
|
-
|
|
8688
|
+
React120.useEffect(() => {
|
|
8639
8689
|
if (!claimed.current) return;
|
|
8640
8690
|
if (!useRightRailStore.getState().pageOpen) onCloseRef.current();
|
|
8641
8691
|
}, [pageOpen]);
|
|
@@ -8838,15 +8888,15 @@ function ConnectorSyncActions({
|
|
|
8838
8888
|
actions,
|
|
8839
8889
|
onRan
|
|
8840
8890
|
}) {
|
|
8841
|
-
const [running, setRunning] =
|
|
8842
|
-
const [open, setOpen] =
|
|
8843
|
-
const [pending2, setPending] =
|
|
8844
|
-
const [hidden, setHidden] =
|
|
8845
|
-
const [queued, setQueued] =
|
|
8846
|
-
const [nonce, setNonce] =
|
|
8847
|
-
const [expanded, setExpanded] =
|
|
8848
|
-
const [resolved, setResolved] =
|
|
8849
|
-
|
|
8891
|
+
const [running, setRunning] = React120__default.useState(null);
|
|
8892
|
+
const [open, setOpen] = React120__default.useState(null);
|
|
8893
|
+
const [pending2, setPending] = React120__default.useState(null);
|
|
8894
|
+
const [hidden, setHidden] = React120__default.useState(() => /* @__PURE__ */ new Set());
|
|
8895
|
+
const [queued, setQueued] = React120__default.useState({});
|
|
8896
|
+
const [nonce, setNonce] = React120__default.useState(0);
|
|
8897
|
+
const [expanded, setExpanded] = React120__default.useState(false);
|
|
8898
|
+
const [resolved, setResolved] = React120__default.useState(false);
|
|
8899
|
+
React120__default.useEffect(() => {
|
|
8850
8900
|
let cancelled = false;
|
|
8851
8901
|
setResolved(false);
|
|
8852
8902
|
void Promise.all(
|
|
@@ -9031,10 +9081,10 @@ function formatRelative(iso, t) {
|
|
|
9031
9081
|
}
|
|
9032
9082
|
function useConnectorRuns(connector) {
|
|
9033
9083
|
const listRuns = connector.definition?.listRuns;
|
|
9034
|
-
const [runs, setRuns] =
|
|
9035
|
-
const [loading, setLoading] =
|
|
9036
|
-
const [nonce, setNonce] =
|
|
9037
|
-
|
|
9084
|
+
const [runs, setRuns] = React120__default.useState([]);
|
|
9085
|
+
const [loading, setLoading] = React120__default.useState(!!listRuns);
|
|
9086
|
+
const [nonce, setNonce] = React120__default.useState(0);
|
|
9087
|
+
React120__default.useEffect(() => {
|
|
9038
9088
|
if (!listRuns) {
|
|
9039
9089
|
setRuns([]);
|
|
9040
9090
|
setLoading(false);
|
|
@@ -9056,7 +9106,7 @@ function useConnectorRuns(connector) {
|
|
|
9056
9106
|
return {
|
|
9057
9107
|
runs,
|
|
9058
9108
|
loading,
|
|
9059
|
-
reload:
|
|
9109
|
+
reload: React120__default.useCallback(() => setNonce((n) => n + 1), []),
|
|
9060
9110
|
failing: isFailing(runs)
|
|
9061
9111
|
};
|
|
9062
9112
|
}
|
|
@@ -9156,7 +9206,7 @@ function RunFailure({ run }) {
|
|
|
9156
9206
|
),
|
|
9157
9207
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: t("connectors.runs.seeDetails") })
|
|
9158
9208
|
] }),
|
|
9159
|
-
facts.length > 0 && /* @__PURE__ */ jsx("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 border-t border-border px-2 py-2 text-[11px] leading-relaxed", children: facts.map(([label2, value]) => /* @__PURE__ */ jsxs(
|
|
9209
|
+
facts.length > 0 && /* @__PURE__ */ jsx("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 border-t border-border px-2 py-2 text-[11px] leading-relaxed", children: facts.map(([label2, value]) => /* @__PURE__ */ jsxs(React120__default.Fragment, { children: [
|
|
9160
9210
|
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: label2 }),
|
|
9161
9211
|
/* @__PURE__ */ jsx("dd", { className: "min-w-0 break-words font-mono text-foreground/80", children: value })
|
|
9162
9212
|
] }, label2)) }),
|
|
@@ -9325,13 +9375,13 @@ function ConnectorSettingsPanel({
|
|
|
9325
9375
|
const { t } = useTranslation$1();
|
|
9326
9376
|
const def = connector.definition;
|
|
9327
9377
|
const settings = def ? connectorSettings(def) : [];
|
|
9328
|
-
const [values, setValues] =
|
|
9378
|
+
const [values, setValues] = React120__default.useState(
|
|
9329
9379
|
() => initialValues(settings, {})
|
|
9330
9380
|
);
|
|
9331
|
-
const [loaded2, setLoaded] =
|
|
9332
|
-
const [saving, setSaving] =
|
|
9333
|
-
const [dirty, setDirty] =
|
|
9334
|
-
|
|
9381
|
+
const [loaded2, setLoaded] = React120__default.useState(false);
|
|
9382
|
+
const [saving, setSaving] = React120__default.useState(false);
|
|
9383
|
+
const [dirty, setDirty] = React120__default.useState(false);
|
|
9384
|
+
React120__default.useEffect(() => {
|
|
9335
9385
|
if (settings.length === 0 || !def?.getSettings) return;
|
|
9336
9386
|
let cancelled = false;
|
|
9337
9387
|
setLoaded(false);
|
|
@@ -9582,13 +9632,13 @@ function ConnectorInstall({
|
|
|
9582
9632
|
}) {
|
|
9583
9633
|
const { t } = useTranslation$1();
|
|
9584
9634
|
const def = connector.definition;
|
|
9585
|
-
const [plane, setPlane] =
|
|
9635
|
+
const [plane, setPlane] = React120__default.useState(
|
|
9586
9636
|
connector.planes.includes("agentic") ? "agentic" : connector.planes[0]
|
|
9587
9637
|
);
|
|
9588
|
-
const [values, setValues] =
|
|
9589
|
-
const secrets =
|
|
9590
|
-
const [busy, setBusy] =
|
|
9591
|
-
|
|
9638
|
+
const [values, setValues] = React120__default.useState({});
|
|
9639
|
+
const secrets = React120__default.useRef({});
|
|
9640
|
+
const [busy, setBusy] = React120__default.useState(null);
|
|
9641
|
+
React120__default.useEffect(() => {
|
|
9592
9642
|
setValues({});
|
|
9593
9643
|
secrets.current = {};
|
|
9594
9644
|
setBusy(null);
|
|
@@ -9629,15 +9679,15 @@ function ConnectorHome({
|
|
|
9629
9679
|
const needsSetup = connector.state === "needs_setup";
|
|
9630
9680
|
const settingsAvailable = hasOperatingSettings(connector);
|
|
9631
9681
|
const runsAvailable = hasRunHistory(connector);
|
|
9632
|
-
const [tab, setTab] =
|
|
9682
|
+
const [tab, setTab] = React120__default.useState(
|
|
9633
9683
|
needsSetup && settingsAvailable ? "settings" : "overview"
|
|
9634
9684
|
);
|
|
9635
|
-
const [busy, setBusy] =
|
|
9685
|
+
const [busy, setBusy] = React120__default.useState(null);
|
|
9636
9686
|
const run = useRunner(setBusy, onChanged);
|
|
9637
|
-
const [values, setValues] =
|
|
9638
|
-
const secrets =
|
|
9687
|
+
const [values, setValues] = React120__default.useState({});
|
|
9688
|
+
const secrets = React120__default.useRef({});
|
|
9639
9689
|
const runs = useConnectorRuns(connector);
|
|
9640
|
-
|
|
9690
|
+
React120__default.useEffect(() => {
|
|
9641
9691
|
setTab(needsSetup && settingsAvailable ? "settings" : "overview");
|
|
9642
9692
|
setBusy(null);
|
|
9643
9693
|
setValues({});
|
|
@@ -9727,7 +9777,7 @@ function ConnectorHome({
|
|
|
9727
9777
|
}
|
|
9728
9778
|
function useRunner(setBusy, onChanged) {
|
|
9729
9779
|
const { t } = useTranslation$1();
|
|
9730
|
-
return
|
|
9780
|
+
return React120__default.useCallback(
|
|
9731
9781
|
async (kind, fn, okMessage) => {
|
|
9732
9782
|
setBusy(kind);
|
|
9733
9783
|
try {
|
|
@@ -9843,7 +9893,7 @@ function ConnectPanel({
|
|
|
9843
9893
|
const sinkMissing = needsSink && !getConnectorCredentialSink();
|
|
9844
9894
|
const secretFieldCount = (def.fields ?? []).filter(isSecretField).length;
|
|
9845
9895
|
const hasStoredCredential = connector.state === "connected" || connector.state === "needs_setup";
|
|
9846
|
-
const [formKey, setFormKey] =
|
|
9896
|
+
const [formKey, setFormKey] = React120__default.useState(0);
|
|
9847
9897
|
if (def.authKind === "oauth") {
|
|
9848
9898
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
9849
9899
|
/* @__PURE__ */ jsx(Note, { children: t("connectors.authorize.oauthOnly") }),
|
|
@@ -9976,7 +10026,7 @@ function GrantRevoke({
|
|
|
9976
10026
|
onRevoke
|
|
9977
10027
|
}) {
|
|
9978
10028
|
const { t } = useTranslation$1();
|
|
9979
|
-
const [revoking, setRevoking] =
|
|
10029
|
+
const [revoking, setRevoking] = React120__default.useState(false);
|
|
9980
10030
|
if (connector.revocable === false) {
|
|
9981
10031
|
return /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("connectors.partOfApp") });
|
|
9982
10032
|
}
|
|
@@ -10015,14 +10065,14 @@ function ConnectorsPanel({ onClose }) {
|
|
|
10015
10065
|
const { connectors, reload, revokeGrant, agentAvailable, tenantReady } = useConnectors();
|
|
10016
10066
|
const selectedId = useConnectorsSurface((s) => s.selected);
|
|
10017
10067
|
const select = useConnectorsSurface((s) => s.select);
|
|
10018
|
-
const [query, setQuery] =
|
|
10019
|
-
const [failure, setFailure] =
|
|
10020
|
-
const [revoking, setRevoking] =
|
|
10021
|
-
const selected =
|
|
10068
|
+
const [query, setQuery] = React120__default.useState("");
|
|
10069
|
+
const [failure, setFailure] = React120__default.useState(null);
|
|
10070
|
+
const [revoking, setRevoking] = React120__default.useState(null);
|
|
10071
|
+
const selected = React120__default.useMemo(
|
|
10022
10072
|
() => (connectors ?? []).find((c) => c.id === selectedId) ?? null,
|
|
10023
10073
|
[connectors, selectedId]
|
|
10024
10074
|
);
|
|
10025
|
-
const filtered =
|
|
10075
|
+
const filtered = React120__default.useMemo(
|
|
10026
10076
|
() => filterConnectors(connectors ?? [], "outbound", query),
|
|
10027
10077
|
[connectors, query]
|
|
10028
10078
|
);
|
|
@@ -10033,9 +10083,9 @@ function ConnectorsPanel({ onClose }) {
|
|
|
10033
10083
|
back: onClose
|
|
10034
10084
|
} : null
|
|
10035
10085
|
);
|
|
10036
|
-
const closeRef =
|
|
10086
|
+
const closeRef = React120__default.useRef(onClose);
|
|
10037
10087
|
closeRef.current = onClose;
|
|
10038
|
-
|
|
10088
|
+
React120__default.useEffect(() => {
|
|
10039
10089
|
if (hosted && !selectedId) closeRef.current();
|
|
10040
10090
|
}, [hosted, selectedId]);
|
|
10041
10091
|
return /* @__PURE__ */ jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [
|
|
@@ -10163,20 +10213,20 @@ function useDictation({
|
|
|
10163
10213
|
onInterim
|
|
10164
10214
|
}) {
|
|
10165
10215
|
const resolvedLocale = locale ?? (typeof navigator !== "undefined" ? navigator.language || "pt-BR" : "pt-BR");
|
|
10166
|
-
const [state, setState] =
|
|
10167
|
-
const [error, setError] =
|
|
10168
|
-
const sessionRef =
|
|
10169
|
-
const callbacks =
|
|
10216
|
+
const [state, setState] = React120.useState("idle");
|
|
10217
|
+
const [error, setError] = React120.useState(null);
|
|
10218
|
+
const sessionRef = React120.useRef(null);
|
|
10219
|
+
const callbacks = React120.useRef({ onTranscript, onInterim });
|
|
10170
10220
|
callbacks.current = { onTranscript, onInterim };
|
|
10171
|
-
const supported =
|
|
10221
|
+
const supported = React120.useMemo(
|
|
10172
10222
|
() => isDictationSupported(!!transcribeEndpoint),
|
|
10173
10223
|
[transcribeEndpoint]
|
|
10174
10224
|
);
|
|
10175
|
-
const finish =
|
|
10225
|
+
const finish = React120.useCallback(() => {
|
|
10176
10226
|
sessionRef.current = null;
|
|
10177
10227
|
setState("idle");
|
|
10178
10228
|
}, []);
|
|
10179
|
-
const start =
|
|
10229
|
+
const start = React120.useCallback(() => {
|
|
10180
10230
|
if (sessionRef.current || !supported) return;
|
|
10181
10231
|
stopSpeaking();
|
|
10182
10232
|
setError(null);
|
|
@@ -10197,28 +10247,28 @@ function useDictation({
|
|
|
10197
10247
|
}
|
|
10198
10248
|
);
|
|
10199
10249
|
}, [finish, resolvedLocale, supported, transcribeEndpoint]);
|
|
10200
|
-
const stop =
|
|
10250
|
+
const stop = React120.useCallback(() => {
|
|
10201
10251
|
if (!sessionRef.current) return;
|
|
10202
10252
|
if (transcribeEndpoint) setState("transcribing");
|
|
10203
10253
|
sessionRef.current.stop();
|
|
10204
10254
|
}, [transcribeEndpoint]);
|
|
10205
|
-
const cancel =
|
|
10255
|
+
const cancel = React120.useCallback(() => {
|
|
10206
10256
|
sessionRef.current?.cancel();
|
|
10207
10257
|
sessionRef.current = null;
|
|
10208
10258
|
setState("idle");
|
|
10209
10259
|
setError(null);
|
|
10210
10260
|
}, []);
|
|
10211
|
-
const toggle =
|
|
10261
|
+
const toggle = React120.useCallback(() => {
|
|
10212
10262
|
if (state === "listening" || state === "transcribing") stop();
|
|
10213
10263
|
else start();
|
|
10214
10264
|
}, [state, start, stop]);
|
|
10215
|
-
|
|
10265
|
+
React120.useEffect(() => () => sessionRef.current?.cancel(), []);
|
|
10216
10266
|
return { supported, state, error, start, stop, cancel, toggle, clearError: () => setError(null) };
|
|
10217
10267
|
}
|
|
10218
10268
|
function useMicLevels(active2, bandCount = 28, externalStream) {
|
|
10219
|
-
const levelsRef =
|
|
10220
|
-
const [available, setAvailable] =
|
|
10221
|
-
|
|
10269
|
+
const levelsRef = React120.useRef(new Float32Array(bandCount));
|
|
10270
|
+
const [available, setAvailable] = React120.useState(false);
|
|
10271
|
+
React120.useEffect(() => {
|
|
10222
10272
|
if (!active2) {
|
|
10223
10273
|
levelsRef.current.fill(0);
|
|
10224
10274
|
setAvailable(false);
|
|
@@ -10287,8 +10337,8 @@ var KIND_ICON = {
|
|
|
10287
10337
|
binary: File$1
|
|
10288
10338
|
};
|
|
10289
10339
|
function useFileDrop(enabled, onFiles) {
|
|
10290
|
-
const [dragging, setDragging] =
|
|
10291
|
-
const depth =
|
|
10340
|
+
const [dragging, setDragging] = React120.useState(false);
|
|
10341
|
+
const depth = React120.useRef(0);
|
|
10292
10342
|
const carriesFiles = (event) => Array.from(event.dataTransfer?.types ?? []).includes("Files");
|
|
10293
10343
|
const reset = () => {
|
|
10294
10344
|
depth.current = 0;
|
|
@@ -10348,7 +10398,7 @@ function AttachmentChips({
|
|
|
10348
10398
|
onRemove
|
|
10349
10399
|
}) {
|
|
10350
10400
|
const { t } = useTranslation$1();
|
|
10351
|
-
const [openId, setOpenId] =
|
|
10401
|
+
const [openId, setOpenId] = React120.useState(null);
|
|
10352
10402
|
if (!attachments.length) return null;
|
|
10353
10403
|
const opened = attachments.find((a) => a.id === openId);
|
|
10354
10404
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -10489,8 +10539,8 @@ function ChatComposer({
|
|
|
10489
10539
|
autoFocus
|
|
10490
10540
|
}) {
|
|
10491
10541
|
const { t } = useTranslation$1();
|
|
10492
|
-
const [input, setInput] =
|
|
10493
|
-
const textareaRef =
|
|
10542
|
+
const [input, setInput] = React120.useState("");
|
|
10543
|
+
const textareaRef = React120.useRef(null);
|
|
10494
10544
|
const voiceStartRequested = useChatStore((s) => s.voiceStartRequested);
|
|
10495
10545
|
const consumeVoiceStart = useChatStore((s) => s.consumeVoiceStart);
|
|
10496
10546
|
const draft = useChatStore((s) => s.draft);
|
|
@@ -10503,13 +10553,13 @@ function ChatComposer({
|
|
|
10503
10553
|
const removeAttachment = useChatStore((s) => s.removeAttachment);
|
|
10504
10554
|
const composerMedia = useChatStore((s) => s.composerMedia);
|
|
10505
10555
|
const clearComposerMedia = useChatStore((s) => s.clearComposerMedia);
|
|
10506
|
-
const fileInputRef =
|
|
10556
|
+
const fileInputRef = React120.useRef(null);
|
|
10507
10557
|
const autoSend = voice?.autoSend === true;
|
|
10508
10558
|
const micEnabled = voice?.input !== false;
|
|
10509
10559
|
const canAttach = isConfigured && !blocked && !isStreaming;
|
|
10510
10560
|
const parsing = attachments.some((a) => a.status === "parsing");
|
|
10511
10561
|
const readyAttachments = attachments.filter((a) => a.status === "ready").length;
|
|
10512
|
-
const submit =
|
|
10562
|
+
const submit = React120.useCallback(
|
|
10513
10563
|
(text2) => {
|
|
10514
10564
|
const trimmed = text2.trim();
|
|
10515
10565
|
const media = useChatStore.getState().composerMedia;
|
|
@@ -10539,7 +10589,7 @@ function ChatComposer({
|
|
|
10539
10589
|
}
|
|
10540
10590
|
}
|
|
10541
10591
|
});
|
|
10542
|
-
|
|
10592
|
+
React120.useEffect(() => {
|
|
10543
10593
|
if (!autoFocus) return;
|
|
10544
10594
|
const id = requestAnimationFrame(() => textareaRef.current?.focus());
|
|
10545
10595
|
return () => cancelAnimationFrame(id);
|
|
@@ -10551,7 +10601,7 @@ function ChatComposer({
|
|
|
10551
10601
|
const WAVEFORM_BANDS = 56;
|
|
10552
10602
|
const activity = useAssistantActivity();
|
|
10553
10603
|
const sessionRecording = activity?.kind === "recording" && activity.state === "running";
|
|
10554
|
-
const sessionStream =
|
|
10604
|
+
const sessionStream = React120.useMemo(
|
|
10555
10605
|
() => sessionRecording ? activity?.stream?.() ?? null : null,
|
|
10556
10606
|
[sessionRecording, activity]
|
|
10557
10607
|
);
|
|
@@ -10563,12 +10613,12 @@ function ChatComposer({
|
|
|
10563
10613
|
);
|
|
10564
10614
|
const sessionPause = activity?.actions?.find((a) => a.intent === "pause" || a.intent === "resume");
|
|
10565
10615
|
const sessionOwnsMic = activity?.kind === "recording" && (activity.state === "running" || activity.state === "paused");
|
|
10566
|
-
|
|
10616
|
+
React120.useEffect(() => {
|
|
10567
10617
|
if (!voiceStartRequested) return;
|
|
10568
10618
|
consumeVoiceStart();
|
|
10569
10619
|
if (showMic) dictation.start();
|
|
10570
10620
|
}, [voiceStartRequested, showMic]);
|
|
10571
|
-
|
|
10621
|
+
React120.useEffect(() => {
|
|
10572
10622
|
if (!focusRequested) return;
|
|
10573
10623
|
let frames = 0;
|
|
10574
10624
|
let raf = 0;
|
|
@@ -10585,7 +10635,7 @@ function ChatComposer({
|
|
|
10585
10635
|
raf = requestAnimationFrame(tick);
|
|
10586
10636
|
return () => cancelAnimationFrame(raf);
|
|
10587
10637
|
}, [focusRequested, consumeComposerFocus]);
|
|
10588
|
-
|
|
10638
|
+
React120.useEffect(() => {
|
|
10589
10639
|
if (!draft) return;
|
|
10590
10640
|
setInput(draft);
|
|
10591
10641
|
setDraft("");
|
|
@@ -10595,7 +10645,7 @@ function ChatComposer({
|
|
|
10595
10645
|
el.setSelectionRange(draft.length, draft.length);
|
|
10596
10646
|
}
|
|
10597
10647
|
}, [draft, setDraft]);
|
|
10598
|
-
|
|
10648
|
+
React120.useLayoutEffect(() => {
|
|
10599
10649
|
const el = textareaRef.current;
|
|
10600
10650
|
if (!el) return;
|
|
10601
10651
|
const style = getComputedStyle(el);
|
|
@@ -10798,8 +10848,8 @@ function UploadRequestCard() {
|
|
|
10798
10848
|
const removeUploadFile = useChatStore((s) => s.removeUploadFile);
|
|
10799
10849
|
const submitUpload = useChatStore((s) => s.submitUpload);
|
|
10800
10850
|
const clearUploadRequest = useChatStore((s) => s.clearUploadRequest);
|
|
10801
|
-
const cameraRef =
|
|
10802
|
-
const browseRef =
|
|
10851
|
+
const cameraRef = React120.useRef(null);
|
|
10852
|
+
const browseRef = React120.useRef(null);
|
|
10803
10853
|
if (!request) return null;
|
|
10804
10854
|
const working = request.status === "working";
|
|
10805
10855
|
const accept = request.accept ?? "image/*";
|
|
@@ -10941,8 +10991,8 @@ function LiveWaveform({
|
|
|
10941
10991
|
compact,
|
|
10942
10992
|
tone = "primary"
|
|
10943
10993
|
}) {
|
|
10944
|
-
const barsRef =
|
|
10945
|
-
|
|
10994
|
+
const barsRef = React120.useRef([]);
|
|
10995
|
+
React120.useEffect(() => {
|
|
10946
10996
|
if (!live) return;
|
|
10947
10997
|
let frame = 0;
|
|
10948
10998
|
const draw = () => {
|
|
@@ -11091,7 +11141,7 @@ function ChatMarkdown({ content }) {
|
|
|
11091
11141
|
}
|
|
11092
11142
|
const sub = subOrdered ? /* @__PURE__ */ jsx("ol", { start: subStart, className: "mt-0.5 space-y-0.5 pl-4 list-decimal", children: subItems }, `sub${items.length}`) : /* @__PURE__ */ jsx("ul", { className: "mt-0.5 space-y-0.5 pl-4 list-disc", children: subItems }, `sub${items.length}`);
|
|
11093
11143
|
const prev = items.pop();
|
|
11094
|
-
if (prev &&
|
|
11144
|
+
if (prev && React120.isValidElement(prev)) {
|
|
11095
11145
|
items.push(
|
|
11096
11146
|
/* @__PURE__ */ jsxs("li", { children: [
|
|
11097
11147
|
prev.props.children,
|
|
@@ -11188,7 +11238,7 @@ var CARD_CTA = {
|
|
|
11188
11238
|
function useConnectorJourney(card) {
|
|
11189
11239
|
const panelAvailable = useConnectorsPanelAvailable();
|
|
11190
11240
|
useChatStore((s) => s.setOpen);
|
|
11191
|
-
return
|
|
11241
|
+
return React120.useCallback(() => {
|
|
11192
11242
|
if (panelAvailable && card.id) {
|
|
11193
11243
|
openConnectorsPanel({ id: card.id });
|
|
11194
11244
|
return;
|
|
@@ -11278,7 +11328,7 @@ function ConnectorSuggestionRow({ card }) {
|
|
|
11278
11328
|
] });
|
|
11279
11329
|
}
|
|
11280
11330
|
function ConnectorSuggestionGroup({ cards }) {
|
|
11281
|
-
const shelves =
|
|
11331
|
+
const shelves = React120.useMemo(() => shelveByCategory(cards), [cards]);
|
|
11282
11332
|
return /* @__PURE__ */ jsx("div", { className: "w-full max-w-[88%] overflow-hidden rounded-xl border border-border/60 bg-card/60 motion-safe:animate-zoom-in", children: shelves.map((shelf, shelfIndex) => /* @__PURE__ */ jsxs("div", { className: cn(shelfIndex > 0 && "border-t border-border/50"), children: [
|
|
11283
11333
|
shelf.label && /* @__PURE__ */ jsx("p", { className: "bg-background/40 px-2.5 py-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: shelf.label }),
|
|
11284
11334
|
/* @__PURE__ */ jsx("div", { className: "divide-y divide-border/40", children: shelf.items.map((card) => /* @__PURE__ */ jsx(ConnectorSuggestionRow, { card }, card.slug ?? card.id ?? card.name)) })
|
|
@@ -11288,8 +11338,8 @@ function ChoiceCard({ card }) {
|
|
|
11288
11338
|
const queuePrompt = useChatStore((s) => s.queuePrompt);
|
|
11289
11339
|
const isStreaming = useChatStore((s) => s.isStreaming);
|
|
11290
11340
|
const messages = useChatStore((s) => s.messages);
|
|
11291
|
-
const [optimistic, setOptimistic] =
|
|
11292
|
-
const answeredInThread =
|
|
11341
|
+
const [optimistic, setOptimistic] = React120.useState(null);
|
|
11342
|
+
const answeredInThread = React120.useMemo(
|
|
11293
11343
|
() => answeredOptionId(messages, card.options),
|
|
11294
11344
|
[messages, card.options]
|
|
11295
11345
|
);
|
|
@@ -11344,7 +11394,7 @@ function humanizeToolName(name) {
|
|
|
11344
11394
|
}
|
|
11345
11395
|
function ToolCallRow({ call: call2 }) {
|
|
11346
11396
|
const { t } = useTranslation$1();
|
|
11347
|
-
const [open, setOpen] =
|
|
11397
|
+
const [open, setOpen] = React120.useState(false);
|
|
11348
11398
|
const failed = call2.declined || /"error"\s*:/.test(call2.result ?? "");
|
|
11349
11399
|
return /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-xl border border-border/50 bg-muted/30", children: [
|
|
11350
11400
|
/* @__PURE__ */ jsxs(
|
|
@@ -11421,15 +11471,15 @@ function HandoffNotice({ notice }) {
|
|
|
11421
11471
|
}
|
|
11422
11472
|
function MessageBubble({ message, isPending }) {
|
|
11423
11473
|
const isUser = message.role === "user";
|
|
11424
|
-
const connectorCards =
|
|
11474
|
+
const connectorCards = React120.useMemo(
|
|
11425
11475
|
() => (message.cards ?? []).filter((card) => card.kind === "connector"),
|
|
11426
11476
|
[message.cards]
|
|
11427
11477
|
);
|
|
11428
|
-
const choiceCards =
|
|
11478
|
+
const choiceCards = React120.useMemo(
|
|
11429
11479
|
() => (message.cards ?? []).filter((card) => card.kind === "choice"),
|
|
11430
11480
|
[message.cards]
|
|
11431
11481
|
);
|
|
11432
|
-
const routedLinks =
|
|
11482
|
+
const routedLinks = React120.useMemo(
|
|
11433
11483
|
() => (message.links ?? []).filter(
|
|
11434
11484
|
(l) => !!l.path || !!resolveEntityRoute(l.archetype, l.kind, l.entityKey)
|
|
11435
11485
|
),
|
|
@@ -11520,9 +11570,9 @@ function ConfirmActionCard({
|
|
|
11520
11570
|
onResolveAll
|
|
11521
11571
|
}) {
|
|
11522
11572
|
const { t } = useTranslation$1();
|
|
11523
|
-
const schema =
|
|
11573
|
+
const schema = React120.useMemo(() => action.fields ?? [], [action.fields]);
|
|
11524
11574
|
const partial = action.partial === true;
|
|
11525
|
-
const seedValues =
|
|
11575
|
+
const seedValues = React120.useCallback(
|
|
11526
11576
|
(params) => {
|
|
11527
11577
|
if (partial) return { ...params };
|
|
11528
11578
|
const seeded = {};
|
|
@@ -11531,18 +11581,18 @@ function ConfirmActionCard({
|
|
|
11531
11581
|
},
|
|
11532
11582
|
[schema, partial]
|
|
11533
11583
|
);
|
|
11534
|
-
const [values, setValues] =
|
|
11535
|
-
const [showAll, setShowAll] =
|
|
11584
|
+
const [values, setValues] = React120.useState(() => seedValues(action.params));
|
|
11585
|
+
const [showAll, setShowAll] = React120.useState(false);
|
|
11536
11586
|
const batch = Math.max(0, sameToolQueued);
|
|
11537
|
-
|
|
11587
|
+
React120.useEffect(() => setValues(seedValues(action.params)), [action.params, seedValues]);
|
|
11538
11588
|
const isSet = (v) => v !== void 0 && v !== null && v !== "";
|
|
11539
|
-
const primaryKeys =
|
|
11589
|
+
const primaryKeys = React120.useMemo(() => {
|
|
11540
11590
|
const keys = Object.keys(action.params).filter((k) => isSet(action.params[k]));
|
|
11541
11591
|
if (partial) return keys;
|
|
11542
11592
|
for (const f of schema) if (f.required && !keys.includes(f.key)) keys.push(f.key);
|
|
11543
11593
|
return keys;
|
|
11544
11594
|
}, [action.params, schema, partial]);
|
|
11545
|
-
const extraKeys =
|
|
11595
|
+
const extraKeys = React120.useMemo(
|
|
11546
11596
|
() => schema.map((f) => f.key).filter((k) => !primaryKeys.includes(k) && k !== "id"),
|
|
11547
11597
|
[schema, primaryKeys]
|
|
11548
11598
|
);
|
|
@@ -11559,20 +11609,20 @@ function ConfirmActionCard({
|
|
|
11559
11609
|
const translatedTool = t(toolKey);
|
|
11560
11610
|
const heading = action.title ?? (translatedTool !== toolKey ? translatedTool : humanizeToolName(action.toolName));
|
|
11561
11611
|
const ruleLabel = action.scopeLabel ?? heading;
|
|
11562
|
-
const missingRequiredKeys =
|
|
11612
|
+
const missingRequiredKeys = React120.useMemo(
|
|
11563
11613
|
() => partial ? [] : schema.filter((f) => f.required && !isSet(values[f.key])).map((f) => f.key),
|
|
11564
11614
|
[schema, values, partial]
|
|
11565
11615
|
);
|
|
11566
11616
|
const canConfirm = missingRequiredKeys.length === 0;
|
|
11567
|
-
const submitted =
|
|
11617
|
+
const submitted = React120.useCallback(
|
|
11568
11618
|
() => partial ? Object.fromEntries(Object.entries(values).filter(([, v]) => isSet(v))) : values,
|
|
11569
11619
|
[partial, values]
|
|
11570
11620
|
);
|
|
11571
|
-
const approve =
|
|
11621
|
+
const approve = React120.useCallback(() => {
|
|
11572
11622
|
if (canConfirm) onResolve(true, submitted());
|
|
11573
11623
|
}, [canConfirm, onResolve, submitted]);
|
|
11574
|
-
const decline =
|
|
11575
|
-
const approveAlways =
|
|
11624
|
+
const decline = React120.useCallback(() => onResolve(false), [onResolve]);
|
|
11625
|
+
const approveAlways = React120.useCallback(() => {
|
|
11576
11626
|
if (!canConfirm) return;
|
|
11577
11627
|
grantAutoApproval({
|
|
11578
11628
|
toolName: action.toolName,
|
|
@@ -11582,7 +11632,7 @@ function ConfirmActionCard({
|
|
|
11582
11632
|
});
|
|
11583
11633
|
onResolve(true, submitted());
|
|
11584
11634
|
}, [canConfirm, action.toolName, action.scope, ruleLabel, destructive, onResolve, submitted]);
|
|
11585
|
-
|
|
11635
|
+
React120.useEffect(() => {
|
|
11586
11636
|
const handler = (event) => {
|
|
11587
11637
|
const target = event.target;
|
|
11588
11638
|
const typing = target?.tagName === "INPUT" || target?.tagName === "TEXTAREA" || target?.tagName === "SELECT";
|
|
@@ -11919,8 +11969,8 @@ var TYPE_MS = 620;
|
|
|
11919
11969
|
var MIN_CHAR_MS = 12;
|
|
11920
11970
|
var MAX_CHAR_MS = 34;
|
|
11921
11971
|
function usePrefersReducedMotion() {
|
|
11922
|
-
const [reduced, setReduced] =
|
|
11923
|
-
|
|
11972
|
+
const [reduced, setReduced] = React120.useState(false);
|
|
11973
|
+
React120.useEffect(() => {
|
|
11924
11974
|
if (typeof matchMedia !== "function") return;
|
|
11925
11975
|
const query = matchMedia("(prefers-reduced-motion: reduce)");
|
|
11926
11976
|
const sync = () => setReduced(query.matches);
|
|
@@ -11939,10 +11989,10 @@ function TypedText({
|
|
|
11939
11989
|
onDone
|
|
11940
11990
|
}) {
|
|
11941
11991
|
const reduced = usePrefersReducedMotion();
|
|
11942
|
-
const [count, setCount] =
|
|
11943
|
-
const done =
|
|
11992
|
+
const [count, setCount] = React120.useState(reduced ? text2.length : 0);
|
|
11993
|
+
const done = React120.useRef(onDone);
|
|
11944
11994
|
done.current = onDone;
|
|
11945
|
-
|
|
11995
|
+
React120.useEffect(() => {
|
|
11946
11996
|
if (!start) {
|
|
11947
11997
|
setCount(0);
|
|
11948
11998
|
return;
|
|
@@ -11982,9 +12032,9 @@ function RevealSequence({
|
|
|
11982
12032
|
children
|
|
11983
12033
|
}) {
|
|
11984
12034
|
const reduced = usePrefersReducedMotion();
|
|
11985
|
-
const items =
|
|
11986
|
-
const [shown, setShown] =
|
|
11987
|
-
|
|
12035
|
+
const items = React120.Children.toArray(children);
|
|
12036
|
+
const [shown, setShown] = React120.useState(0);
|
|
12037
|
+
React120.useEffect(() => {
|
|
11988
12038
|
if (!start) {
|
|
11989
12039
|
setShown(0);
|
|
11990
12040
|
return;
|
|
@@ -12046,7 +12096,7 @@ function UpgradePrompt({ feature, inline, className }) {
|
|
|
12046
12096
|
const currentPlan = plans.find((p) => p.id === currentPlanId);
|
|
12047
12097
|
const currentPrice = currentPlan?.price ?? 0;
|
|
12048
12098
|
const currentPlanName = currentPlan?.name ?? tr("billing.free", "Free");
|
|
12049
|
-
const featureName =
|
|
12099
|
+
const featureName = React120.useMemo(() => {
|
|
12050
12100
|
if (!feature) return null;
|
|
12051
12101
|
const label2 = features.find((f) => f.id === feature)?.label;
|
|
12052
12102
|
if (label2) return featureDisplayName(label2);
|
|
@@ -12054,7 +12104,7 @@ function UpgradePrompt({ feature, inline, className }) {
|
|
|
12054
12104
|
const named = t(key);
|
|
12055
12105
|
return named && named !== key ? named : featureDisplayName(feature);
|
|
12056
12106
|
}, [features, feature, t]);
|
|
12057
|
-
const unlockingPlans =
|
|
12107
|
+
const unlockingPlans = React120.useMemo(
|
|
12058
12108
|
() => plans.filter((p) => p.id !== currentPlanId && p.price > currentPrice && planUnlocks(p, feature)).sort((a, b) => a.price - b.price),
|
|
12059
12109
|
[plans, currentPlanId, currentPrice, feature]
|
|
12060
12110
|
);
|
|
@@ -12235,26 +12285,26 @@ function ChatConversation({
|
|
|
12235
12285
|
usable && !pendingAction && !isStreaming,
|
|
12236
12286
|
receiveFiles
|
|
12237
12287
|
);
|
|
12238
|
-
|
|
12239
|
-
const [view, setView] =
|
|
12288
|
+
React120.useEffect(ensureIntroStyles, []);
|
|
12289
|
+
const [view, setView] = React120.useState(
|
|
12240
12290
|
() => useChatStore.getState().messages.length > 0 ? "thread" : "list"
|
|
12241
12291
|
);
|
|
12242
|
-
const [drawer, setDrawer] =
|
|
12243
|
-
const [introStep, setIntroStep] =
|
|
12244
|
-
const [atBottom, setAtBottom] =
|
|
12245
|
-
const scrollRef =
|
|
12292
|
+
const [drawer, setDrawer] = React120.useState("none");
|
|
12293
|
+
const [introStep, setIntroStep] = React120.useState(0);
|
|
12294
|
+
const [atBottom, setAtBottom] = React120.useState(true);
|
|
12295
|
+
const scrollRef = React120.useRef(null);
|
|
12246
12296
|
const hasMessages = messages.length > 0;
|
|
12247
12297
|
const showThread = view === "thread" && hasMessages;
|
|
12248
12298
|
const totalTools = toolGroups.reduce((sum, g) => sum + g.tools.length, 0);
|
|
12249
|
-
const scrollToBottom =
|
|
12299
|
+
const scrollToBottom = React120.useCallback((behavior = "smooth") => {
|
|
12250
12300
|
const el = scrollRef.current;
|
|
12251
12301
|
if (!el) return;
|
|
12252
12302
|
el.scrollTo({ top: el.scrollHeight, behavior });
|
|
12253
12303
|
}, []);
|
|
12254
|
-
|
|
12304
|
+
React120.useEffect(() => {
|
|
12255
12305
|
if (atBottom) scrollToBottom();
|
|
12256
12306
|
}, [messages, activeTools, pendingAction, atBottom, scrollToBottom]);
|
|
12257
|
-
|
|
12307
|
+
React120.useEffect(() => {
|
|
12258
12308
|
loadConversations();
|
|
12259
12309
|
setSuggestionsOpen(useChatStore.getState().messages.length === 0);
|
|
12260
12310
|
return () => stopSpeaking();
|
|
@@ -12271,7 +12321,7 @@ function ChatConversation({
|
|
|
12271
12321
|
};
|
|
12272
12322
|
const queuedPrompt = useChatStore((s) => s.queuedPrompt);
|
|
12273
12323
|
const consumeQueuedPrompt = useChatStore((s) => s.consumeQueuedPrompt);
|
|
12274
|
-
|
|
12324
|
+
React120.useEffect(() => {
|
|
12275
12325
|
if (!queuedPrompt) return;
|
|
12276
12326
|
const prompt = consumeQueuedPrompt();
|
|
12277
12327
|
if (prompt && usable) send(prompt);
|
|
@@ -12303,7 +12353,7 @@ function ChatConversation({
|
|
|
12303
12353
|
);
|
|
12304
12354
|
const connectorsPending = useConnectorsSurface((s) => s.pending);
|
|
12305
12355
|
const consumeConnectorsRequest = useConnectorsSurface((s) => s.consume);
|
|
12306
|
-
|
|
12356
|
+
React120.useEffect(() => {
|
|
12307
12357
|
if (!connectorsPending) return;
|
|
12308
12358
|
setDrawer("connectors");
|
|
12309
12359
|
consumeConnectorsRequest();
|
|
@@ -12311,7 +12361,7 @@ function ChatConversation({
|
|
|
12311
12361
|
const greetingName = (user?.fullName || user?.email || "").split(/[\s@]/)[0];
|
|
12312
12362
|
const invite = useAssistantInviteStore((s) => s.invite);
|
|
12313
12363
|
const introKey = `${onDuty?.role ?? "solo"}:${invite?.id ?? ""}`;
|
|
12314
|
-
|
|
12364
|
+
React120.useEffect(() => setIntroStep(0), [introKey]);
|
|
12315
12365
|
const greeting = invite ? (invite.pitch ?? invite.headline).replace("{{name}}", greetingName) : onDuty?.greeting ? onDuty.greeting.replace("{{name}}", greetingName) : greetingName ? t("chat.greetingNamed", { name: greetingName }) : t("chat.greeting");
|
|
12316
12366
|
const greetingHint = invite?.description ?? onDuty?.goal ?? t("chat.greetingHint");
|
|
12317
12367
|
const openers = invite?.suggestions?.length ? invite.suggestions : onDuty?.suggestions?.length ? onDuty.suggestions : suggestions.length ? suggestions : [
|
|
@@ -12633,7 +12683,7 @@ function AgentAvatar({
|
|
|
12633
12683
|
size = "md",
|
|
12634
12684
|
className
|
|
12635
12685
|
}) {
|
|
12636
|
-
const [failed, setFailed] =
|
|
12686
|
+
const [failed, setFailed] = React120.useState(false);
|
|
12637
12687
|
const { box, text: text2, px } = SIZES[size];
|
|
12638
12688
|
if (Face) {
|
|
12639
12689
|
return /* @__PURE__ */ jsx(
|
|
@@ -13421,7 +13471,7 @@ function TaskStatusGroup({ status, tasks }) {
|
|
|
13421
13471
|
function useDelegateToAssistant() {
|
|
13422
13472
|
const queuePrompt = useChatStore((s) => s.queuePrompt);
|
|
13423
13473
|
const openPanel = useRightRailStore((s) => s.openPanel);
|
|
13424
|
-
return
|
|
13474
|
+
return React120.useCallback(
|
|
13425
13475
|
(prompt) => {
|
|
13426
13476
|
queuePrompt(prompt);
|
|
13427
13477
|
openPanel("chat");
|
|
@@ -13658,12 +13708,12 @@ function TasksPanel() {
|
|
|
13658
13708
|
const fetchTasks = useTasksStore((s) => s.fetchTasks);
|
|
13659
13709
|
const fetchLabels = useTasksStore((s) => s.fetchLabels);
|
|
13660
13710
|
const fetchSummary = useTasksStore((s) => s.fetchSummary);
|
|
13661
|
-
|
|
13711
|
+
React120__default.useEffect(() => {
|
|
13662
13712
|
void fetchTasks();
|
|
13663
13713
|
void fetchLabels();
|
|
13664
13714
|
void fetchSummary();
|
|
13665
13715
|
}, [fetchTasks, fetchLabels, fetchSummary]);
|
|
13666
|
-
const { onboarding, grouped } =
|
|
13716
|
+
const { onboarding, grouped } = React120__default.useMemo(() => {
|
|
13667
13717
|
const split = splitOnboardingTasks(tasks);
|
|
13668
13718
|
const map = /* @__PURE__ */ new Map();
|
|
13669
13719
|
for (const s of STATUS_ORDER) map.set(s, []);
|
|
@@ -13698,7 +13748,7 @@ function TasksPanel() {
|
|
|
13698
13748
|
function useTasksSummaryLine() {
|
|
13699
13749
|
const t = useTranslation();
|
|
13700
13750
|
const summary = useTasksStore((s) => s.summary);
|
|
13701
|
-
return
|
|
13751
|
+
return React120__default.useMemo(() => {
|
|
13702
13752
|
if (!summary) return "";
|
|
13703
13753
|
const parts = [];
|
|
13704
13754
|
if (summary.overdue > 0) parts.push(`${summary.overdue} ${t("tasks.summary.overdue")}`);
|
|
@@ -13723,16 +13773,16 @@ function TasksRailPanel() {
|
|
|
13723
13773
|
const fetchSummary = useTasksStore((s) => s.fetchSummary);
|
|
13724
13774
|
const setCurrentUserId = useTasksStore((s) => s.setCurrentUserId);
|
|
13725
13775
|
const userId = useAuthStore6((s) => s.user?.id);
|
|
13726
|
-
|
|
13776
|
+
React120__default.useEffect(() => {
|
|
13727
13777
|
void fetchSummary();
|
|
13728
13778
|
}, [fetchSummary]);
|
|
13729
|
-
|
|
13779
|
+
React120__default.useEffect(() => {
|
|
13730
13780
|
setCurrentUserId(userId ?? null);
|
|
13731
13781
|
}, [userId, setCurrentUserId]);
|
|
13732
13782
|
const openCount = summary ? summary.todo + summary.inProgress : 0;
|
|
13733
13783
|
const defer = tasksSurfaceOwner() === "plugin";
|
|
13734
13784
|
useRightRailPanel(
|
|
13735
|
-
|
|
13785
|
+
React120__default.useMemo(
|
|
13736
13786
|
() => defer ? null : {
|
|
13737
13787
|
id: "tasks",
|
|
13738
13788
|
label: t("tasks.drawer.title") || "Tasks",
|
|
@@ -13756,15 +13806,15 @@ var useSettingsTabsStore = create((set, get) => ({
|
|
|
13756
13806
|
}));
|
|
13757
13807
|
function usePublishSettingsTabs(ids) {
|
|
13758
13808
|
const key = ids.join(",");
|
|
13759
|
-
|
|
13809
|
+
React120.useEffect(() => {
|
|
13760
13810
|
useSettingsTabsStore.getState().setIds(key ? key.split(",") : []);
|
|
13761
13811
|
}, [key]);
|
|
13762
13812
|
}
|
|
13763
13813
|
function useAgentSurface(contribution) {
|
|
13764
|
-
const ref =
|
|
13814
|
+
const ref = React120.useRef(contribution);
|
|
13765
13815
|
ref.current = contribution;
|
|
13766
13816
|
const id = contribution.id;
|
|
13767
|
-
|
|
13817
|
+
React120.useEffect(() => {
|
|
13768
13818
|
registerSurface({ id, get: () => ref.current });
|
|
13769
13819
|
const names = (ref.current.tools ?? []).map((t) => t.tool.name);
|
|
13770
13820
|
for (const name of names) {
|
|
@@ -14544,9 +14594,9 @@ function featureMap() {
|
|
|
14544
14594
|
}));
|
|
14545
14595
|
}
|
|
14546
14596
|
function ActivationAgentSurface({ programs }) {
|
|
14547
|
-
const programsRef =
|
|
14597
|
+
const programsRef = React120.useRef(programs);
|
|
14548
14598
|
programsRef.current = programs;
|
|
14549
|
-
const contribution =
|
|
14599
|
+
const contribution = React120.useMemo(
|
|
14550
14600
|
() => ({
|
|
14551
14601
|
id: "onboarding.activation",
|
|
14552
14602
|
pluginId: "onboarding",
|
|
@@ -14867,7 +14917,7 @@ Quando a pessoa perguntar COMO fazer algo que tem guia em \`setupGuides\` ("como
|
|
|
14867
14917
|
- Termine dizendo o que isso destrava e oferecendo a pr\xF3xima, uma vez s\xF3.`
|
|
14868
14918
|
);
|
|
14869
14919
|
function SetupAgentSurface() {
|
|
14870
|
-
const contribution =
|
|
14920
|
+
const contribution = React120.useMemo(
|
|
14871
14921
|
() => ({
|
|
14872
14922
|
id: "setup.guides",
|
|
14873
14923
|
pluginId: "setup",
|
|
@@ -14983,7 +15033,7 @@ function SetupAgentSurface() {
|
|
|
14983
15033
|
}
|
|
14984
15034
|
var DEBOUNCE_MS = 1200;
|
|
14985
15035
|
function useActivationWatch() {
|
|
14986
|
-
|
|
15036
|
+
React120.useEffect(() => {
|
|
14987
15037
|
let timer = null;
|
|
14988
15038
|
let running = false;
|
|
14989
15039
|
const sweep = async () => {
|
|
@@ -15022,7 +15072,7 @@ function useActivationWatch() {
|
|
|
15022
15072
|
off();
|
|
15023
15073
|
};
|
|
15024
15074
|
}, []);
|
|
15025
|
-
|
|
15075
|
+
React120.useEffect(() => {
|
|
15026
15076
|
useActivationStore.setState({
|
|
15027
15077
|
onStepCompleted: (step, by) => {
|
|
15028
15078
|
const state = useActivationStore.getState();
|
|
@@ -15679,7 +15729,7 @@ function ActivationProvider() {
|
|
|
15679
15729
|
const programs = runtime?.onboardingPrograms ?? [];
|
|
15680
15730
|
const settingsIds = useSettingsTabsStore((s) => s.ids);
|
|
15681
15731
|
const routeKey = (runtime?.routes.length ?? 0) + ":" + settingsIds.join(",");
|
|
15682
|
-
const hasRoute =
|
|
15732
|
+
const hasRoute = React120.useMemo(() => {
|
|
15683
15733
|
const known = /* @__PURE__ */ new Set(["/", "/settings"]);
|
|
15684
15734
|
for (const route of runtime?.routes ?? []) known.add(route.path);
|
|
15685
15735
|
for (const id of settingsIds) known.add(`/settings/${id}`);
|
|
@@ -15687,14 +15737,14 @@ function ActivationProvider() {
|
|
|
15687
15737
|
}, [routeKey]);
|
|
15688
15738
|
const answers = useBusinessProfileStore((s) => s.profile?.answers);
|
|
15689
15739
|
const programKey = programs.map((p) => p.id).join(",");
|
|
15690
|
-
const catalog =
|
|
15740
|
+
const catalog = React120.useMemo(
|
|
15691
15741
|
() => buildActivationCatalog({ verticalId, programs, hasRoute, answers }),
|
|
15692
15742
|
[verticalId, programKey, hasRoute, answers]
|
|
15693
15743
|
);
|
|
15694
|
-
|
|
15744
|
+
React120.useEffect(() => {
|
|
15695
15745
|
setCatalog(catalog);
|
|
15696
15746
|
}, [catalog, setCatalog]);
|
|
15697
|
-
|
|
15747
|
+
React120.useEffect(() => {
|
|
15698
15748
|
if (!tenantId2) return;
|
|
15699
15749
|
let cancelled = false;
|
|
15700
15750
|
void (async () => {
|
|
@@ -15726,14 +15776,14 @@ function ActivationProvider() {
|
|
|
15726
15776
|
cancelled = true;
|
|
15727
15777
|
};
|
|
15728
15778
|
}, [tenantId2, catalog, answers, hasRoute, settingsIds, user?.id, load]);
|
|
15729
|
-
|
|
15779
|
+
React120.useEffect(() => {
|
|
15730
15780
|
if (!tenantId2) {
|
|
15731
15781
|
useBusinessProfileStore.getState().clear();
|
|
15732
15782
|
return;
|
|
15733
15783
|
}
|
|
15734
15784
|
void useBusinessProfileStore.getState().load(tenantId2, orgName);
|
|
15735
15785
|
}, [tenantId2, orgName]);
|
|
15736
|
-
|
|
15786
|
+
React120.useEffect(() => {
|
|
15737
15787
|
if (!tenantId2) return;
|
|
15738
15788
|
const key = `${GREETING_FLAG}:${tenantId2}`;
|
|
15739
15789
|
let pending2 = false;
|
|
@@ -15755,10 +15805,10 @@ function ActivationProvider() {
|
|
|
15755
15805
|
return () => window.clearTimeout(timer);
|
|
15756
15806
|
}, [tenantId2]);
|
|
15757
15807
|
const guides = runtime?.setupGuides;
|
|
15758
|
-
|
|
15808
|
+
React120.useEffect(() => {
|
|
15759
15809
|
setRuntimeSetupGuides(guides ?? []);
|
|
15760
15810
|
}, [guides]);
|
|
15761
|
-
|
|
15811
|
+
React120.useEffect(() => {
|
|
15762
15812
|
setTourNavigator(navigateTo);
|
|
15763
15813
|
return () => setTourNavigator(void 0);
|
|
15764
15814
|
}, []);
|
|
@@ -15931,7 +15981,7 @@ Escrita:
|
|
|
15931
15981
|
E quando a coisa precisa ser FEITA em vez de lembrada, \xE9 tarefa e n\xE3o p\xE1gina \u2014 crie com createRecord na entidade Task.`
|
|
15932
15982
|
);
|
|
15933
15983
|
function HandbookAgentSurface() {
|
|
15934
|
-
const contribution =
|
|
15984
|
+
const contribution = React120.useMemo(
|
|
15935
15985
|
() => ({
|
|
15936
15986
|
id: "handbook",
|
|
15937
15987
|
pluginId: "handbook",
|
|
@@ -16042,18 +16092,18 @@ function NotebookPanel() {
|
|
|
16042
16092
|
const userId = useHandbookStore((s) => s.userId);
|
|
16043
16093
|
const write3 = useHandbookStore((s) => s.write);
|
|
16044
16094
|
const remove = useHandbookStore((s) => s.remove);
|
|
16045
|
-
const [filter, setFilter] =
|
|
16046
|
-
const [search, setSearch] =
|
|
16047
|
-
const [draft, setDraft] =
|
|
16048
|
-
const [preview, setPreview] =
|
|
16049
|
-
const [confirming, setConfirming] =
|
|
16050
|
-
const entries2 =
|
|
16095
|
+
const [filter, setFilter] = React120.useState("all");
|
|
16096
|
+
const [search, setSearch] = React120.useState("");
|
|
16097
|
+
const [draft, setDraft] = React120.useState(null);
|
|
16098
|
+
const [preview, setPreview] = React120.useState(false);
|
|
16099
|
+
const [confirming, setConfirming] = React120.useState(null);
|
|
16100
|
+
const entries2 = React120.useMemo(
|
|
16051
16101
|
() => (pages ?? []).map((p) => ({ page: p, entry: toEntry2(p) })),
|
|
16052
16102
|
[pages]
|
|
16053
16103
|
);
|
|
16054
|
-
const timer =
|
|
16055
|
-
const inFlight =
|
|
16056
|
-
const persist =
|
|
16104
|
+
const timer = React120.useRef(null);
|
|
16105
|
+
const inFlight = React120.useRef(false);
|
|
16106
|
+
const persist = React120.useCallback(async (d) => {
|
|
16057
16107
|
const title = titleFromBody(d.body);
|
|
16058
16108
|
if (!title && !d.body.trim()) return d.id;
|
|
16059
16109
|
const filed = d.folder !== null;
|
|
@@ -16075,7 +16125,7 @@ function NotebookPanel() {
|
|
|
16075
16125
|
});
|
|
16076
16126
|
return saved?.id ?? d.id;
|
|
16077
16127
|
}, [write3, userId]);
|
|
16078
|
-
const schedule =
|
|
16128
|
+
const schedule = React120.useCallback((next) => {
|
|
16079
16129
|
setDraft(next);
|
|
16080
16130
|
if (timer.current) clearTimeout(timer.current);
|
|
16081
16131
|
timer.current = setTimeout(() => {
|
|
@@ -16107,7 +16157,7 @@ function NotebookPanel() {
|
|
|
16107
16157
|
legacyId: null
|
|
16108
16158
|
});
|
|
16109
16159
|
};
|
|
16110
|
-
const folders =
|
|
16160
|
+
const folders = React120.useMemo(() => {
|
|
16111
16161
|
const set = /* @__PURE__ */ new Set();
|
|
16112
16162
|
for (const { page } of entries2) {
|
|
16113
16163
|
if (page.kind !== "doc" || !page.path) continue;
|
|
@@ -16499,10 +16549,10 @@ ${body}`
|
|
|
16499
16549
|
}
|
|
16500
16550
|
function NoteTodosSection({ noteId, noteTitle }) {
|
|
16501
16551
|
const adapter = useNotesTasksBridge((s) => s.adapter);
|
|
16502
|
-
const [todos, setTodos] =
|
|
16503
|
-
const [draft, setDraft] =
|
|
16504
|
-
const [busy, setBusy] =
|
|
16505
|
-
|
|
16552
|
+
const [todos, setTodos] = React120.useState([]);
|
|
16553
|
+
const [draft, setDraft] = React120.useState("");
|
|
16554
|
+
const [busy, setBusy] = React120.useState(false);
|
|
16555
|
+
React120.useEffect(() => {
|
|
16506
16556
|
if (!adapter) return;
|
|
16507
16557
|
let alive = true;
|
|
16508
16558
|
adapter.listTodos(noteId).then((rows) => {
|
|
@@ -16632,7 +16682,7 @@ function NotebookRailPanel() {
|
|
|
16632
16682
|
const pages = useHandbookStore((s) => s.pages);
|
|
16633
16683
|
const count = pages?.length ?? 0;
|
|
16634
16684
|
useRightRailPanel(
|
|
16635
|
-
|
|
16685
|
+
React120.useMemo(
|
|
16636
16686
|
() => ({
|
|
16637
16687
|
id: "notes",
|
|
16638
16688
|
label: tl("Notes", "Notas"),
|
|
@@ -16651,10 +16701,10 @@ function HandbookProvider() {
|
|
|
16651
16701
|
const userId = useAuthStore((s) => s.user?.id);
|
|
16652
16702
|
const load = useHandbookStore((s) => s.load);
|
|
16653
16703
|
const setUser = useHandbookStore((s) => s.setUser);
|
|
16654
|
-
|
|
16704
|
+
React120.useEffect(() => {
|
|
16655
16705
|
setUser(userId);
|
|
16656
16706
|
}, [userId, setUser]);
|
|
16657
|
-
|
|
16707
|
+
React120.useEffect(() => {
|
|
16658
16708
|
if (tenantId2) void load(tenantId2);
|
|
16659
16709
|
}, [tenantId2, load]);
|
|
16660
16710
|
useLocalNotesImport(tenantId2, userId);
|
|
@@ -16664,7 +16714,7 @@ function HandbookProvider() {
|
|
|
16664
16714
|
] });
|
|
16665
16715
|
}
|
|
16666
16716
|
function useLocalNotesImport(tenantId2, userId) {
|
|
16667
|
-
|
|
16717
|
+
React120.useEffect(() => {
|
|
16668
16718
|
if (!tenantId2 || !userId) return;
|
|
16669
16719
|
const source = `fayz.notes.${tenantId2}.${userId}`;
|
|
16670
16720
|
const flag = `fayz.notes.imported.${tenantId2}.${userId}`;
|
|
@@ -16712,7 +16762,7 @@ function useUnitBootstrap() {
|
|
|
16712
16762
|
const tenant = useTenantOptional();
|
|
16713
16763
|
const userId = useAuthStore((s) => s.user?.id);
|
|
16714
16764
|
const orgId = tenant?.org?.id;
|
|
16715
|
-
|
|
16765
|
+
React120.useEffect(() => {
|
|
16716
16766
|
if (!orgId) return;
|
|
16717
16767
|
const { loadedFor, load, reset } = useUnitStore.getState();
|
|
16718
16768
|
if (loadedFor && loadedFor !== orgId) reset();
|
|
@@ -16751,19 +16801,19 @@ function UnitMembersTab({ item }) {
|
|
|
16751
16801
|
const orgMembers = useOrganizationStore((s) => s.members);
|
|
16752
16802
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
16753
16803
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
16754
|
-
const [rows, setRows] =
|
|
16755
|
-
const [activity, setActivity] =
|
|
16756
|
-
const [adding, setAdding] =
|
|
16757
|
-
const [busy, setBusy] =
|
|
16758
|
-
const reload =
|
|
16804
|
+
const [rows, setRows] = React120.useState(null);
|
|
16805
|
+
const [activity, setActivity] = React120.useState({});
|
|
16806
|
+
const [adding, setAdding] = React120.useState(false);
|
|
16807
|
+
const [busy, setBusy] = React120.useState(null);
|
|
16808
|
+
const reload = React120.useCallback(async () => {
|
|
16759
16809
|
if (!unitId) return;
|
|
16760
16810
|
setRows(await fetchUnitMembers(unitId));
|
|
16761
16811
|
}, [unitId]);
|
|
16762
16812
|
const version5 = useDataVersion(UNIT_ACCESS_CHANGED);
|
|
16763
|
-
|
|
16813
|
+
React120.useEffect(() => {
|
|
16764
16814
|
void reload();
|
|
16765
16815
|
}, [reload, version5]);
|
|
16766
|
-
|
|
16816
|
+
React120.useEffect(() => {
|
|
16767
16817
|
if (!orgId) return;
|
|
16768
16818
|
let alive = true;
|
|
16769
16819
|
void fetchMemberActivity(orgId).then((a) => {
|
|
@@ -16773,7 +16823,7 @@ function UnitMembersTab({ item }) {
|
|
|
16773
16823
|
alive = false;
|
|
16774
16824
|
};
|
|
16775
16825
|
}, [orgId]);
|
|
16776
|
-
const byUser =
|
|
16826
|
+
const byUser = React120.useMemo(() => {
|
|
16777
16827
|
const map = /* @__PURE__ */ new Map();
|
|
16778
16828
|
for (const m of orgMembers) {
|
|
16779
16829
|
map.set(m.userId, {
|
|
@@ -16785,7 +16835,7 @@ function UnitMembersTab({ item }) {
|
|
|
16785
16835
|
}
|
|
16786
16836
|
return map;
|
|
16787
16837
|
}, [orgMembers]);
|
|
16788
|
-
const available =
|
|
16838
|
+
const available = React120.useMemo(
|
|
16789
16839
|
() => orgMembers.filter((m) => !(rows ?? []).some((r) => r.userId === m.userId)),
|
|
16790
16840
|
[orgMembers, rows]
|
|
16791
16841
|
);
|
|
@@ -16991,15 +17041,15 @@ function MemberAccessBody({
|
|
|
16991
17041
|
const units = useUnitStore((s) => s.units);
|
|
16992
17042
|
const byId = useUnitStore((s) => s.byId);
|
|
16993
17043
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
16994
|
-
const [bindings, setBindings] =
|
|
16995
|
-
const [loading, setLoading] =
|
|
16996
|
-
const [adding, setAdding] =
|
|
16997
|
-
const branches =
|
|
16998
|
-
const unbound =
|
|
17044
|
+
const [bindings, setBindings] = React120.useState([]);
|
|
17045
|
+
const [loading, setLoading] = React120.useState(false);
|
|
17046
|
+
const [adding, setAdding] = React120.useState(false);
|
|
17047
|
+
const branches = React120.useMemo(() => units.filter((u) => u.isActive !== false), [units]);
|
|
17048
|
+
const unbound = React120.useMemo(
|
|
16999
17049
|
() => branches.filter((u) => !bindings.some((b) => b.locationId === u.id)),
|
|
17000
17050
|
[branches, bindings]
|
|
17001
17051
|
);
|
|
17002
|
-
const reload =
|
|
17052
|
+
const reload = React120.useCallback(async () => {
|
|
17003
17053
|
if (!userId) return;
|
|
17004
17054
|
setLoading(true);
|
|
17005
17055
|
try {
|
|
@@ -17009,7 +17059,7 @@ function MemberAccessBody({
|
|
|
17009
17059
|
}
|
|
17010
17060
|
}, [userId]);
|
|
17011
17061
|
const version5 = useDataVersion(UNIT_ACCESS_CHANGED);
|
|
17012
|
-
|
|
17062
|
+
React120.useEffect(() => {
|
|
17013
17063
|
void reload();
|
|
17014
17064
|
}, [reload, version5]);
|
|
17015
17065
|
async function add(unitId) {
|
|
@@ -17656,7 +17706,7 @@ function useWrongApp() {
|
|
|
17656
17706
|
const tenantId2 = useAppConfigStore((s) => s.tenantId);
|
|
17657
17707
|
const activeTenantId = useOrganizationStore((s) => s.currentOrg?.id ?? null);
|
|
17658
17708
|
const appId = resolveAppId();
|
|
17659
|
-
return
|
|
17709
|
+
return React120.useMemo(() => {
|
|
17660
17710
|
if (!appId || !activeTenantId || tenantId2 !== activeTenantId) return { app: null };
|
|
17661
17711
|
const list = (apps ?? []).filter((a) => !a.house);
|
|
17662
17712
|
if (!list.length) return { app: null };
|
|
@@ -17779,13 +17829,13 @@ function surveyTokenFromPath(pathname) {
|
|
|
17779
17829
|
return m ? decodeURIComponent(m[1]) : null;
|
|
17780
17830
|
}
|
|
17781
17831
|
function PublicSurveyPage({ token, appName }) {
|
|
17782
|
-
const [loaded2, setLoaded] =
|
|
17783
|
-
const [draft, setDraft] =
|
|
17784
|
-
const [name, setName] =
|
|
17785
|
-
const [sending, setSending] =
|
|
17786
|
-
const [sent, setSent] =
|
|
17787
|
-
const [failed, setFailed] =
|
|
17788
|
-
|
|
17832
|
+
const [loaded2, setLoaded] = React120__default.useState(null);
|
|
17833
|
+
const [draft, setDraft] = React120__default.useState({});
|
|
17834
|
+
const [name, setName] = React120__default.useState("");
|
|
17835
|
+
const [sending, setSending] = React120__default.useState(false);
|
|
17836
|
+
const [sent, setSent] = React120__default.useState(null);
|
|
17837
|
+
const [failed, setFailed] = React120__default.useState(null);
|
|
17838
|
+
React120__default.useEffect(() => {
|
|
17789
17839
|
let alive = true;
|
|
17790
17840
|
const client3 = getFayzSupabaseClientOptional();
|
|
17791
17841
|
if (!client3) {
|
|
@@ -18071,7 +18121,7 @@ function isServed2(route) {
|
|
|
18071
18121
|
function getPersonActions(kind) {
|
|
18072
18122
|
return ACTIONS.filter((a) => !a.kinds || (kind ? a.kinds.includes(kind) : false)).filter((a) => !a.requiresRoute || isServed2(a.requiresRoute)).sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
|
|
18073
18123
|
}
|
|
18074
|
-
var RouteErrorBoundary = class extends
|
|
18124
|
+
var RouteErrorBoundary = class extends React120.Component {
|
|
18075
18125
|
constructor() {
|
|
18076
18126
|
super(...arguments);
|
|
18077
18127
|
this.state = { crashed: false, report: null };
|
|
@@ -18113,7 +18163,7 @@ var RouteErrorBoundary = class extends React119.Component {
|
|
|
18113
18163
|
}
|
|
18114
18164
|
};
|
|
18115
18165
|
function RouteErrorScreen({ report, tr, onBack, onRetry, backLabel }) {
|
|
18116
|
-
const [copied, setCopied] =
|
|
18166
|
+
const [copied, setCopied] = React120.useState(false);
|
|
18117
18167
|
const copyDetails = () => {
|
|
18118
18168
|
if (!report || typeof navigator === "undefined" || !navigator.clipboard) return;
|
|
18119
18169
|
const details = [
|
|
@@ -18218,9 +18268,9 @@ function UnitSwitching({ unitName, isAll, onDone }) {
|
|
|
18218
18268
|
const v = t(key);
|
|
18219
18269
|
return !v || v === key ? fallback : v;
|
|
18220
18270
|
};
|
|
18221
|
-
const doneRef =
|
|
18271
|
+
const doneRef = React120.useRef(onDone);
|
|
18222
18272
|
doneRef.current = onDone;
|
|
18223
|
-
|
|
18273
|
+
React120.useEffect(() => {
|
|
18224
18274
|
const id = window.setTimeout(() => doneRef.current(), HOLD_MS);
|
|
18225
18275
|
return () => window.clearTimeout(id);
|
|
18226
18276
|
}, []);
|
|
@@ -18277,11 +18327,11 @@ function UnitPickerDialog() {
|
|
|
18277
18327
|
const myUnitIds = useUnitStore((s) => s.myUnitIds);
|
|
18278
18328
|
const activeUnitId = useUnitStore((s) => s.activeUnitId);
|
|
18279
18329
|
const beginSwitch = useUnitSwitchingStore((s) => s.begin);
|
|
18280
|
-
const reachable =
|
|
18330
|
+
const reachable = React120.useMemo(
|
|
18281
18331
|
() => myUnitIds.length > 0 ? myUnitIds : units.filter((u) => u.kind !== "region").map((u) => u.id),
|
|
18282
18332
|
[myUnitIds, units]
|
|
18283
18333
|
);
|
|
18284
|
-
const groups =
|
|
18334
|
+
const groups = React120.useMemo(() => {
|
|
18285
18335
|
const out = [];
|
|
18286
18336
|
if (reachable.length > 1) {
|
|
18287
18337
|
out.push({ id: "_all", options: [{ id: ALL_UNITS, label: "Todas as unidades" }] });
|
|
@@ -18480,16 +18530,16 @@ function WorkspaceSetupFlow({
|
|
|
18480
18530
|
const user = useAuthStore((s) => s.user);
|
|
18481
18531
|
const { switchOrg } = useTenant();
|
|
18482
18532
|
const closeSetup = useWorkspaceSetupStore((s) => s.close);
|
|
18483
|
-
const uploadLogo =
|
|
18533
|
+
const uploadLogo = React120.useMemo(
|
|
18484
18534
|
() => user ? createLogoUploader(user.id) : void 0,
|
|
18485
18535
|
[user?.id]
|
|
18486
18536
|
);
|
|
18487
|
-
const country =
|
|
18537
|
+
const country = React120.useMemo(
|
|
18488
18538
|
() => currency === "BRL" || (locale ?? "").toLowerCase().startsWith("pt") ? "BR" : void 0,
|
|
18489
18539
|
[currency, locale]
|
|
18490
18540
|
);
|
|
18491
|
-
const stepsRef =
|
|
18492
|
-
const analyzeSite =
|
|
18541
|
+
const stepsRef = React120.useRef([]);
|
|
18542
|
+
const analyzeSite = React120.useMemo(
|
|
18493
18543
|
() => createSiteAnalyzer({
|
|
18494
18544
|
apiBaseUrl: resolveFayzApiBaseUrl(),
|
|
18495
18545
|
steps: () => stepsRef.current,
|
|
@@ -18497,7 +18547,7 @@ function WorkspaceSetupFlow({
|
|
|
18497
18547
|
}),
|
|
18498
18548
|
[locale]
|
|
18499
18549
|
);
|
|
18500
|
-
const steps =
|
|
18550
|
+
const steps = React120.useMemo(
|
|
18501
18551
|
() => buildWorkspaceSetupSteps({
|
|
18502
18552
|
verticalId,
|
|
18503
18553
|
uploadLogo,
|
|
@@ -18509,13 +18559,13 @@ function WorkspaceSetupFlow({
|
|
|
18509
18559
|
[verticalId, uploadLogo, media, country, analyzeSite]
|
|
18510
18560
|
);
|
|
18511
18561
|
stepsRef.current = steps;
|
|
18512
|
-
const initialValues2 =
|
|
18562
|
+
const initialValues2 = React120.useMemo(
|
|
18513
18563
|
// Seeding the contact email with the account's own is one field fewer to
|
|
18514
18564
|
// type, and it is right far more often than it is wrong.
|
|
18515
18565
|
() => user?.email ? { "workspace.email": user.email } : {},
|
|
18516
18566
|
[user?.email]
|
|
18517
18567
|
);
|
|
18518
|
-
const onSubmit =
|
|
18568
|
+
const onSubmit = React120.useCallback(
|
|
18519
18569
|
async (values) => {
|
|
18520
18570
|
if (!user) throw new Error(tl("You are signed out.", "Sua sess\xE3o terminou."));
|
|
18521
18571
|
const org = await submitWorkspaceSetup({
|
|
@@ -18632,16 +18682,16 @@ function GettingStartedWidget() {
|
|
|
18632
18682
|
const t = useTranslation();
|
|
18633
18683
|
const rows = useActivationStore((s) => s.rows);
|
|
18634
18684
|
const catalog = useActivationStore((s) => s.catalog);
|
|
18635
|
-
const steps =
|
|
18685
|
+
const steps = React120.useMemo(
|
|
18636
18686
|
() => selectSteps({ ...useActivationStore.getState(), rows, catalog }),
|
|
18637
18687
|
[rows, catalog]
|
|
18638
18688
|
);
|
|
18639
|
-
const onNavigate =
|
|
18689
|
+
const onNavigate = React120.useCallback((path) => {
|
|
18640
18690
|
const step = useActivationStore.getState().catalog.find((s) => s.route === path);
|
|
18641
18691
|
navigateTo(path);
|
|
18642
18692
|
if (step?.tour) useTourStore.getState().start(step.tour);
|
|
18643
18693
|
}, []);
|
|
18644
|
-
const onAskAgent =
|
|
18694
|
+
const onAskAgent = React120.useCallback((step) => {
|
|
18645
18695
|
void startGuidedRun(step.id);
|
|
18646
18696
|
}, []);
|
|
18647
18697
|
if (!rows || rows.length === 0) return null;
|
|
@@ -18666,16 +18716,16 @@ function ActivationChecklistCard({
|
|
|
18666
18716
|
}) {
|
|
18667
18717
|
const rows = useActivationStore((s) => s.rows);
|
|
18668
18718
|
const catalog = useActivationStore((s) => s.catalog);
|
|
18669
|
-
const steps =
|
|
18719
|
+
const steps = React120.useMemo(
|
|
18670
18720
|
() => selectSteps({ ...useActivationStore.getState(), rows, catalog }),
|
|
18671
18721
|
[rows, catalog]
|
|
18672
18722
|
);
|
|
18673
|
-
const onNavigate =
|
|
18723
|
+
const onNavigate = React120.useCallback((path) => {
|
|
18674
18724
|
const step = useActivationStore.getState().catalog.find((s) => s.route === path);
|
|
18675
18725
|
navigateTo(path);
|
|
18676
18726
|
if (step?.tour) useTourStore.getState().start(step.tour);
|
|
18677
18727
|
}, []);
|
|
18678
|
-
const onAskAgent =
|
|
18728
|
+
const onAskAgent = React120.useCallback((step) => {
|
|
18679
18729
|
void startGuidedRun(step.id);
|
|
18680
18730
|
}, []);
|
|
18681
18731
|
if (!rows || rows.length === 0) return null;
|
|
@@ -18695,9 +18745,9 @@ function ActivationChecklistCard({
|
|
|
18695
18745
|
}
|
|
18696
18746
|
);
|
|
18697
18747
|
}
|
|
18698
|
-
var WidgetSurfaceContext =
|
|
18748
|
+
var WidgetSurfaceContext = React120.createContext("rail");
|
|
18699
18749
|
function useWidgetSurface() {
|
|
18700
|
-
return
|
|
18750
|
+
return React120.useContext(WidgetSurfaceContext);
|
|
18701
18751
|
}
|
|
18702
18752
|
function WidgetSlot({
|
|
18703
18753
|
zone,
|
|
@@ -18741,7 +18791,7 @@ function useNavContribution(id, entries2) {
|
|
|
18741
18791
|
const setContribution = useNavContributionsStore((s) => s.setContribution);
|
|
18742
18792
|
const clearContribution = useNavContributionsStore((s) => s.clearContribution);
|
|
18743
18793
|
const key = JSON.stringify(entries2);
|
|
18744
|
-
|
|
18794
|
+
React120.useEffect(() => {
|
|
18745
18795
|
setContribution(id, entries2);
|
|
18746
18796
|
return () => clearContribution(id);
|
|
18747
18797
|
}, [id, key]);
|
|
@@ -18811,7 +18861,7 @@ function useAppDirectory() {
|
|
|
18811
18861
|
const tenantId2 = useActiveTenantId();
|
|
18812
18862
|
const apps = useAppDirectoryStore((s) => s.apps);
|
|
18813
18863
|
const load = useAppDirectoryStore((s) => s.load);
|
|
18814
|
-
|
|
18864
|
+
React120.useEffect(() => {
|
|
18815
18865
|
if (tenantId2) void load(tenantId2, resolveAppId());
|
|
18816
18866
|
}, [tenantId2, load]);
|
|
18817
18867
|
return { apps };
|
|
@@ -18903,7 +18953,7 @@ var CSS2 = `
|
|
|
18903
18953
|
}
|
|
18904
18954
|
`;
|
|
18905
18955
|
function useWordmarkStyle() {
|
|
18906
|
-
|
|
18956
|
+
React120.useEffect(() => {
|
|
18907
18957
|
if (typeof document === "undefined") return;
|
|
18908
18958
|
const existing = document.getElementById(STYLE_ID2);
|
|
18909
18959
|
if (existing) {
|
|
@@ -19137,7 +19187,7 @@ var SWAP_CSS = `
|
|
|
19137
19187
|
}
|
|
19138
19188
|
`;
|
|
19139
19189
|
function useSwapStyle() {
|
|
19140
|
-
|
|
19190
|
+
React120.useEffect(() => {
|
|
19141
19191
|
if (typeof document === "undefined" || document.getElementById(SWAP_STYLE_ID)) return;
|
|
19142
19192
|
const el = document.createElement("style");
|
|
19143
19193
|
el.id = SWAP_STYLE_ID;
|
|
@@ -19146,9 +19196,9 @@ function useSwapStyle() {
|
|
|
19146
19196
|
}, []);
|
|
19147
19197
|
}
|
|
19148
19198
|
function AppSwitcherView({ apps, mark, logo, collapsed = false, label: label2, onSelect, brandedByTenant = false }) {
|
|
19149
|
-
const [hovered, setHovered] =
|
|
19150
|
-
const [open, setOpen] =
|
|
19151
|
-
const [pending2, setPending] =
|
|
19199
|
+
const [hovered, setHovered] = React120.useState(false);
|
|
19200
|
+
const [open, setOpen] = React120.useState(false);
|
|
19201
|
+
const [pending2, setPending] = React120.useState(null);
|
|
19152
19202
|
const active2 = hovered || open;
|
|
19153
19203
|
useSwapStyle();
|
|
19154
19204
|
const brand = /* @__PURE__ */ jsx(BrandFace, { mark, logo, collapsed });
|
|
@@ -19295,7 +19345,7 @@ function useContextualNav(nav) {
|
|
|
19295
19345
|
const setNav = useContextualNavStore((s) => s.setNav);
|
|
19296
19346
|
const clearNav = useContextualNavStore((s) => s.clearNav);
|
|
19297
19347
|
const key = nav ? JSON.stringify(nav) : null;
|
|
19298
|
-
|
|
19348
|
+
React120.useEffect(() => {
|
|
19299
19349
|
if (!nav) return;
|
|
19300
19350
|
setNav(nav);
|
|
19301
19351
|
return () => clearNav(nav.base);
|
|
@@ -19367,7 +19417,7 @@ async function findNearestUnit(units, reachable) {
|
|
|
19367
19417
|
}
|
|
19368
19418
|
var UNIT_SEARCH_THRESHOLD = 8;
|
|
19369
19419
|
function WorkspaceUnitSheet({ onClose, canCreate = true }) {
|
|
19370
|
-
const [level, setLevel] =
|
|
19420
|
+
const [level, setLevel] = React120.useState("root");
|
|
19371
19421
|
return /* @__PURE__ */ jsxs(
|
|
19372
19422
|
BottomSheet,
|
|
19373
19423
|
{
|
|
@@ -19430,9 +19480,9 @@ function WorkspaceLevel({ canCreate }) {
|
|
|
19430
19480
|
const closeSheet = useSheetClose();
|
|
19431
19481
|
const beginSwitch = useWorkspaceSwitchingStore((s) => s.begin);
|
|
19432
19482
|
const openSetup = useWorkspaceSetupStore((s) => s.open);
|
|
19433
|
-
const [query, setQuery] =
|
|
19483
|
+
const [query, setQuery] = React120.useState("");
|
|
19434
19484
|
const org = tenant?.org ?? null;
|
|
19435
|
-
const options =
|
|
19485
|
+
const options = React120.useMemo(() => {
|
|
19436
19486
|
const list = tenant?.userOrgs ?? [];
|
|
19437
19487
|
if (list.length) return list;
|
|
19438
19488
|
return org ? [{ orgId: org.id, orgName: org.name, orgSlug: org.slug, orgLogoUrl: org.logoUrl }] : [];
|
|
@@ -19441,7 +19491,7 @@ function WorkspaceLevel({ canCreate }) {
|
|
|
19441
19491
|
const v = t.t(key);
|
|
19442
19492
|
return !v || v === key ? fallback : v;
|
|
19443
19493
|
};
|
|
19444
|
-
const search =
|
|
19494
|
+
const search = React120.useMemo(
|
|
19445
19495
|
() => searchWorkspaces(options, query, org?.id),
|
|
19446
19496
|
[options, query, org?.id]
|
|
19447
19497
|
);
|
|
@@ -19493,8 +19543,8 @@ function WorkspaceLevel({ canCreate }) {
|
|
|
19493
19543
|
function UnitLevel() {
|
|
19494
19544
|
useUnitBootstrap();
|
|
19495
19545
|
const closeSheet = useSheetClose();
|
|
19496
|
-
const [locating, setLocating] =
|
|
19497
|
-
const [query, setQuery] =
|
|
19546
|
+
const [locating, setLocating] = React120.useState(false);
|
|
19547
|
+
const [query, setQuery] = React120.useState("");
|
|
19498
19548
|
const units = useUnitStore((s) => s.units);
|
|
19499
19549
|
const tree = useUnitStore((s) => s.tree);
|
|
19500
19550
|
const byId = useUnitStore((s) => s.byId);
|
|
@@ -19531,7 +19581,7 @@ function UnitLevel() {
|
|
|
19531
19581
|
const leaves = node.children.filter((c) => c.kind !== "region" && reachable.includes(c.id));
|
|
19532
19582
|
const regions = node.children.filter((c) => c.kind === "region");
|
|
19533
19583
|
if (leaves.length === 0 && regions.length === 0) return null;
|
|
19534
|
-
return /* @__PURE__ */ jsxs(
|
|
19584
|
+
return /* @__PURE__ */ jsxs(React120.Fragment, { children: [
|
|
19535
19585
|
/* @__PURE__ */ jsx("p", { className: "px-4 pb-1 pt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: node.name }),
|
|
19536
19586
|
leaves.length > 0 && /* @__PURE__ */ jsx(SheetCard, { children: leaves.map(leaf) }),
|
|
19537
19587
|
regions.map(group)
|
|
@@ -19601,7 +19651,7 @@ function UnitLevel() {
|
|
|
19601
19651
|
}
|
|
19602
19652
|
function WorkspaceUnitRow({ canCreate = true }) {
|
|
19603
19653
|
useUnitBootstrap();
|
|
19604
|
-
const [open, setOpen] =
|
|
19654
|
+
const [open, setOpen] = React120.useState(false);
|
|
19605
19655
|
const tenant = useTenantOptional();
|
|
19606
19656
|
const org = tenant?.org ?? null;
|
|
19607
19657
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
@@ -19788,10 +19838,10 @@ function SeuSiteWidget({ fallback, onEdit }) {
|
|
|
19788
19838
|
const load = useFayzProjectsStore((s) => s.load);
|
|
19789
19839
|
const loadedFor = useFayzProjectsStore((s) => s.loadedFor);
|
|
19790
19840
|
const collapsed = useLayoutStore((s) => s.sidebarCollapsed);
|
|
19791
|
-
const [selectedId, setSelectedId] =
|
|
19792
|
-
const [hovered, setHovered] =
|
|
19793
|
-
const [primed, setPrimed] =
|
|
19794
|
-
const closeTimer =
|
|
19841
|
+
const [selectedId, setSelectedId] = React120.useState(null);
|
|
19842
|
+
const [hovered, setHovered] = React120.useState(false);
|
|
19843
|
+
const [primed, setPrimed] = React120.useState(false);
|
|
19844
|
+
const closeTimer = React120.useRef(null);
|
|
19795
19845
|
const cancelClose = () => {
|
|
19796
19846
|
if (closeTimer.current) {
|
|
19797
19847
|
clearTimeout(closeTimer.current);
|
|
@@ -19807,8 +19857,8 @@ function SeuSiteWidget({ fallback, onEdit }) {
|
|
|
19807
19857
|
cancelClose();
|
|
19808
19858
|
closeTimer.current = setTimeout(() => setHovered(false), 140);
|
|
19809
19859
|
};
|
|
19810
|
-
|
|
19811
|
-
|
|
19860
|
+
React120.useEffect(() => () => cancelClose(), []);
|
|
19861
|
+
React120.useEffect(() => {
|
|
19812
19862
|
if (loadedFor !== (currentOrgId ?? null)) void load(currentOrgId);
|
|
19813
19863
|
}, [currentOrgId, loadedFor, load]);
|
|
19814
19864
|
const active2 = projects.find((p) => p.id === selectedId) ?? defaultProjectOf(projects) ?? synthFromFallback(fallback);
|
|
@@ -19919,10 +19969,10 @@ function SitePreview({
|
|
|
19919
19969
|
onEdit,
|
|
19920
19970
|
tr
|
|
19921
19971
|
}) {
|
|
19922
|
-
const [nonce, setNonce] =
|
|
19923
|
-
const [loading, setLoading] =
|
|
19972
|
+
const [nonce, setNonce] = React120.useState(0);
|
|
19973
|
+
const [loading, setLoading] = React120.useState(true);
|
|
19924
19974
|
const url = previewSourceOf(project);
|
|
19925
|
-
|
|
19975
|
+
React120.useEffect(() => {
|
|
19926
19976
|
setLoading(true);
|
|
19927
19977
|
}, [nonce, url]);
|
|
19928
19978
|
const action = "flex items-center gap-1.5 rounded-button px-2 py-1 text-[11.5px] font-medium text-sidebar-foreground/80 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground disabled:cursor-not-allowed disabled:opacity-40";
|
|
@@ -20032,10 +20082,10 @@ function RightRail({ frame = true, attached = true }) {
|
|
|
20032
20082
|
const pageOpen = useRightRailStore((s) => s.pageOpen);
|
|
20033
20083
|
const setPageSlot = useRightRailStore((s) => s.setPageSlot);
|
|
20034
20084
|
const setWidth = useRightRailStore((s) => s.setWidth);
|
|
20035
|
-
const rootRef =
|
|
20036
|
-
const [actionsSlot, setActionsSlot] =
|
|
20037
|
-
const [leadingSlot, setLeadingSlot] =
|
|
20038
|
-
|
|
20085
|
+
const rootRef = React120.useRef(null);
|
|
20086
|
+
const [actionsSlot, setActionsSlot] = React120.useState(null);
|
|
20087
|
+
const [leadingSlot, setLeadingSlot] = React120.useState(null);
|
|
20088
|
+
React120.useEffect(() => {
|
|
20039
20089
|
if (!open) return;
|
|
20040
20090
|
const el = rootRef.current;
|
|
20041
20091
|
if (!el) return;
|
|
@@ -20057,8 +20107,8 @@ function RightRail({ frame = true, attached = true }) {
|
|
|
20057
20107
|
el.removeEventListener("transitionend", publish);
|
|
20058
20108
|
};
|
|
20059
20109
|
}, [open, setWidth]);
|
|
20060
|
-
const [narrow, setNarrow] =
|
|
20061
|
-
|
|
20110
|
+
const [narrow, setNarrow] = React120.useState(false);
|
|
20111
|
+
React120.useEffect(() => {
|
|
20062
20112
|
if (!open) return;
|
|
20063
20113
|
const el = rootRef.current;
|
|
20064
20114
|
if (!el) return;
|
|
@@ -20412,9 +20462,9 @@ var TYPE_COLORS = {
|
|
|
20412
20462
|
fix: "text-success"
|
|
20413
20463
|
};
|
|
20414
20464
|
function ChangelogFeed({ changelogUrl, className }) {
|
|
20415
|
-
const [entries2, setEntries] =
|
|
20416
|
-
const [loading, setLoading] =
|
|
20417
|
-
|
|
20465
|
+
const [entries2, setEntries] = React120.useState([]);
|
|
20466
|
+
const [loading, setLoading] = React120.useState(false);
|
|
20467
|
+
React120.useEffect(() => {
|
|
20418
20468
|
if (!changelogUrl) return;
|
|
20419
20469
|
setLoading(true);
|
|
20420
20470
|
fetch(changelogUrl).then((r) => r.json()).then((data) => setEntries(data)).catch(() => setEntries([])).finally(() => setLoading(false));
|
|
@@ -20474,7 +20524,7 @@ function NotificationInbox({
|
|
|
20474
20524
|
changelogUrl,
|
|
20475
20525
|
className
|
|
20476
20526
|
}) {
|
|
20477
|
-
const [activeTab, setActiveTab] =
|
|
20527
|
+
const [activeTab, setActiveTab] = React120.useState("inbox");
|
|
20478
20528
|
const unreadCount = notifications.filter((n) => !n.read).length;
|
|
20479
20529
|
const inboxNotifications = notifications.filter((n) => n.category !== "changelog");
|
|
20480
20530
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex w-80 flex-col", className), children: [
|
|
@@ -20571,11 +20621,11 @@ function NotificationInbox({
|
|
|
20571
20621
|
}
|
|
20572
20622
|
function BrandAgentSurface() {
|
|
20573
20623
|
const org = useOrganizationStore((s) => s.currentOrg);
|
|
20574
|
-
const brand =
|
|
20624
|
+
const brand = React120__default.useMemo(
|
|
20575
20625
|
() => normalizeBrand(org?.settings?.branding, { name: org?.name, logoUrl: org?.logoUrl }),
|
|
20576
20626
|
[org?.settings, org?.name, org?.logoUrl]
|
|
20577
20627
|
);
|
|
20578
|
-
const surface =
|
|
20628
|
+
const surface = React120__default.useMemo(() => ({
|
|
20579
20629
|
id: "core.brand",
|
|
20580
20630
|
describe: () => ({
|
|
20581
20631
|
title: "Marca da casa",
|
|
@@ -20588,15 +20638,15 @@ function BrandAgentSurface() {
|
|
|
20588
20638
|
return null;
|
|
20589
20639
|
}
|
|
20590
20640
|
function ConnectConsentPage({ appName, logo }) {
|
|
20591
|
-
const [state, setState] =
|
|
20592
|
-
const [tenantId2, setTenantId] =
|
|
20593
|
-
const request =
|
|
20641
|
+
const [state, setState] = React120__default.useState({ status: "loading" });
|
|
20642
|
+
const [tenantId2, setTenantId] = React120__default.useState("");
|
|
20643
|
+
const request = React120__default.useMemo(
|
|
20594
20644
|
() => new URLSearchParams(window.location.search).get("request") ?? "",
|
|
20595
20645
|
[]
|
|
20596
20646
|
);
|
|
20597
|
-
const connection =
|
|
20647
|
+
const connection = React120__default.useMemo(() => resolveFayzAgentConnection(), []);
|
|
20598
20648
|
const product = appName ?? document.title ?? "este app";
|
|
20599
|
-
const authorizedFetch =
|
|
20649
|
+
const authorizedFetch = React120__default.useCallback(
|
|
20600
20650
|
async (path, init) => {
|
|
20601
20651
|
if (!connection) throw new Error("Este app n\xE3o est\xE1 ligado a um projeto Fayz.");
|
|
20602
20652
|
const supabase = getFayzSupabaseClientOptional();
|
|
@@ -20620,7 +20670,7 @@ function ConnectConsentPage({ appName, logo }) {
|
|
|
20620
20670
|
},
|
|
20621
20671
|
[connection]
|
|
20622
20672
|
);
|
|
20623
|
-
|
|
20673
|
+
React120__default.useEffect(() => {
|
|
20624
20674
|
let cancelled = false;
|
|
20625
20675
|
(async () => {
|
|
20626
20676
|
if (!request) {
|
|
@@ -20864,7 +20914,7 @@ function Row2({ label: label2, value }) {
|
|
|
20864
20914
|
function PageActions({ actions, className }) {
|
|
20865
20915
|
const access = useAccessOptional();
|
|
20866
20916
|
const openUpgrade = useUpgradeModalStore((s) => s.open);
|
|
20867
|
-
const resolved =
|
|
20917
|
+
const resolved = React120__default.useMemo(
|
|
20868
20918
|
() => actions.map((a) => {
|
|
20869
20919
|
const { permission, limitKey, onSelect, ...rest } = a;
|
|
20870
20920
|
let hidden = false;
|
|
@@ -20894,25 +20944,25 @@ function AddConnectorPanel({
|
|
|
20894
20944
|
onSelect
|
|
20895
20945
|
}) {
|
|
20896
20946
|
const { t } = useTranslation$1();
|
|
20897
|
-
const [query, setQuery] =
|
|
20947
|
+
const [query, setQuery] = React120__default.useState("");
|
|
20898
20948
|
const modules = useInstalledModuleIds();
|
|
20899
20949
|
const catalog = useConnectorCatalog();
|
|
20900
20950
|
const scoped = !!categories?.length;
|
|
20901
|
-
const addable =
|
|
20951
|
+
const addable = React120__default.useMemo(
|
|
20902
20952
|
() => inCategories(addableConnectors(connectors ?? []), categories),
|
|
20903
20953
|
[connectors, categories]
|
|
20904
20954
|
);
|
|
20905
|
-
const shelf =
|
|
20955
|
+
const shelf = React120__default.useMemo(() => {
|
|
20906
20956
|
if (connectors === null) return [];
|
|
20907
20957
|
return inCategories(
|
|
20908
20958
|
shelfIntegrations({ present: connectors, installedModules: modules, catalog: catalog ?? [] }),
|
|
20909
20959
|
categories
|
|
20910
20960
|
);
|
|
20911
20961
|
}, [connectors, modules, catalog, categories]);
|
|
20912
|
-
const filtered =
|
|
20913
|
-
const filteredShelf =
|
|
20914
|
-
const soon =
|
|
20915
|
-
const elsewhere =
|
|
20962
|
+
const filtered = React120__default.useMemo(() => filterConnectors(addable, "all", query), [addable, query]);
|
|
20963
|
+
const filteredShelf = React120__default.useMemo(() => filterAvailable(shelf, query), [shelf, query]);
|
|
20964
|
+
const soon = React120__default.useMemo(() => comingSoonHere(filteredShelf), [filteredShelf]);
|
|
20965
|
+
const elsewhere = React120__default.useMemo(() => withAnotherModule(filteredShelf), [filteredShelf]);
|
|
20916
20966
|
const searchable = addable.length + shelf.length > 6;
|
|
20917
20967
|
return /* @__PURE__ */ jsx(Modal, { open, onOpenChange, children: /* @__PURE__ */ jsxs(ModalContent, { size: "2xl", children: [
|
|
20918
20968
|
/* @__PURE__ */ jsxs(ModalHeader, { children: [
|
|
@@ -21071,22 +21121,22 @@ function AddConnectorButton({ onClick }) {
|
|
|
21071
21121
|
function ConnectorsTab() {
|
|
21072
21122
|
const { t } = useTranslation$1();
|
|
21073
21123
|
const { connectors, error, reload, revokeGrant, agentAvailable, tenantReady } = useConnectors();
|
|
21074
|
-
const [adding, setAdding] =
|
|
21075
|
-
const [selected, setSelected] =
|
|
21076
|
-
const [filter, setFilter] =
|
|
21077
|
-
const [failure, setFailure] =
|
|
21078
|
-
const [revoking, setRevoking] =
|
|
21124
|
+
const [adding, setAdding] = React120__default.useState(false);
|
|
21125
|
+
const [selected, setSelected] = React120__default.useState(null);
|
|
21126
|
+
const [filter, setFilter] = React120__default.useState("all");
|
|
21127
|
+
const [failure, setFailure] = React120__default.useState(null);
|
|
21128
|
+
const [revoking, setRevoking] = React120__default.useState(null);
|
|
21079
21129
|
const assistantAvailable = useConnectorsPanelAvailable();
|
|
21080
|
-
const openJourney =
|
|
21130
|
+
const openJourney = React120__default.useCallback(
|
|
21081
21131
|
(connector) => {
|
|
21082
21132
|
if (assistantAvailable) openConnectorsPanel(connector);
|
|
21083
21133
|
else setSelected(connector);
|
|
21084
21134
|
},
|
|
21085
21135
|
[assistantAvailable]
|
|
21086
21136
|
);
|
|
21087
|
-
const visible =
|
|
21088
|
-
const groups =
|
|
21089
|
-
|
|
21137
|
+
const visible = React120__default.useMemo(() => filterConnectors(connectors ?? [], filter), [connectors, filter]);
|
|
21138
|
+
const groups = React120__default.useMemo(() => groupConnectors(visible), [visible]);
|
|
21139
|
+
React120__default.useEffect(() => {
|
|
21090
21140
|
if (!selected || !connectors) return;
|
|
21091
21141
|
const fresh = connectors.find((c) => c.id === selected.id);
|
|
21092
21142
|
if (fresh && fresh !== selected) setSelected(fresh);
|
|
@@ -21121,7 +21171,7 @@ function ConnectorsTab() {
|
|
|
21121
21171
|
(connectors?.length ?? 0) > 4 && /* @__PURE__ */ jsx(Filters, { value: filter, onChange: setFilter }),
|
|
21122
21172
|
connectors === null && /* @__PURE__ */ jsx(ConnectionsSkeleton, {}),
|
|
21123
21173
|
connectors !== null && visible.length === 0 && /* @__PURE__ */ jsx(Empty2, { title: t("connectors.emptyTitle"), body: t("connectors.emptyBody") }),
|
|
21124
|
-
visible.length > 0 && /* @__PURE__ */ jsx("ul", { className: "fayz-glass-surface divide-y divide-border overflow-hidden rounded-card border bg-card text-card-foreground shadow-sm", children: groups.map((group) => /* @__PURE__ */ jsxs(
|
|
21174
|
+
visible.length > 0 && /* @__PURE__ */ jsx("ul", { className: "fayz-glass-surface divide-y divide-border overflow-hidden rounded-card border bg-card text-card-foreground shadow-sm", children: groups.map((group) => /* @__PURE__ */ jsxs(React120__default.Fragment, { children: [
|
|
21125
21175
|
groups.length > 1 && /* @__PURE__ */ jsx(
|
|
21126
21176
|
"li",
|
|
21127
21177
|
{
|
|
@@ -21259,7 +21309,7 @@ function oauthFailureMessage(t, result) {
|
|
|
21259
21309
|
function useConnectorOAuthReturn() {
|
|
21260
21310
|
const { t } = useTranslation$1();
|
|
21261
21311
|
const runtime = usePluginRuntimeOptional();
|
|
21262
|
-
|
|
21312
|
+
React120__default.useEffect(() => {
|
|
21263
21313
|
if (typeof window === "undefined") return;
|
|
21264
21314
|
const result = readConnectorOAuthReturn(window.location.search);
|
|
21265
21315
|
if (!result) return;
|
|
@@ -21294,8 +21344,8 @@ function ConnectorDeliveries({
|
|
|
21294
21344
|
limit = 10
|
|
21295
21345
|
}) {
|
|
21296
21346
|
const { t } = useTranslation$1();
|
|
21297
|
-
const [rows, setRows] =
|
|
21298
|
-
|
|
21347
|
+
const [rows, setRows] = React120__default.useState(null);
|
|
21348
|
+
React120__default.useEffect(() => {
|
|
21299
21349
|
let cancelled = false;
|
|
21300
21350
|
void load({ limit }).then((r) => {
|
|
21301
21351
|
if (!cancelled) setRows(r);
|
|
@@ -21369,11 +21419,11 @@ var CURRENCIES = [
|
|
|
21369
21419
|
function CompanySettings({ tenant, onSave }) {
|
|
21370
21420
|
const { t } = useTranslation$1();
|
|
21371
21421
|
const { locale: uiLocale, setLocale: setUiLocale } = useLocaleStore();
|
|
21372
|
-
const [name, setName] =
|
|
21373
|
-
const [timezone, setTimezone] =
|
|
21374
|
-
const [currency, setCurrency] =
|
|
21375
|
-
const [saving, setSaving] =
|
|
21376
|
-
|
|
21422
|
+
const [name, setName] = React120.useState(tenant?.name ?? "");
|
|
21423
|
+
const [timezone, setTimezone] = React120.useState(tenant?.settings?.timezone ?? "UTC");
|
|
21424
|
+
const [currency, setCurrency] = React120.useState(tenant?.settings?.currency ?? "USD");
|
|
21425
|
+
const [saving, setSaving] = React120.useState(false);
|
|
21426
|
+
React120.useEffect(() => {
|
|
21377
21427
|
if (tenant) {
|
|
21378
21428
|
setName(tenant.name);
|
|
21379
21429
|
setTimezone(tenant.settings?.timezone ?? "UTC");
|
|
@@ -21465,15 +21515,15 @@ function UnitModeCard() {
|
|
|
21465
21515
|
const units = useUnitStore((s) => s.units);
|
|
21466
21516
|
const setMode = useUnitStore((s) => s.setMode);
|
|
21467
21517
|
const load = useUnitStore((s) => s.load);
|
|
21468
|
-
const [unbound, setUnbound] =
|
|
21469
|
-
const [bindEveryone, setBindEveryone] =
|
|
21470
|
-
const [pending2, setPending] =
|
|
21471
|
-
const [saving, setSaving] =
|
|
21472
|
-
const headquarters =
|
|
21518
|
+
const [unbound, setUnbound] = React120.useState(null);
|
|
21519
|
+
const [bindEveryone, setBindEveryone] = React120.useState(true);
|
|
21520
|
+
const [pending2, setPending] = React120.useState(null);
|
|
21521
|
+
const [saving, setSaving] = React120.useState(false);
|
|
21522
|
+
const headquarters = React120.useMemo(
|
|
21473
21523
|
() => units.find((u) => u.isHeadquarters && u.kind !== "region") ?? units.find((u) => u.kind !== "region"),
|
|
21474
21524
|
[units]
|
|
21475
21525
|
);
|
|
21476
|
-
|
|
21526
|
+
React120.useEffect(() => {
|
|
21477
21527
|
if (!org?.id || unitMode) return;
|
|
21478
21528
|
let alive = true;
|
|
21479
21529
|
void countUnboundMembers(org.id).then((n) => {
|
|
@@ -21637,10 +21687,10 @@ function getInitials(name) {
|
|
|
21637
21687
|
}
|
|
21638
21688
|
function UserProfile({ user, onSave, onAvatarChange }) {
|
|
21639
21689
|
const { t } = useTranslation$1();
|
|
21640
|
-
const [fullName, setFullName] =
|
|
21641
|
-
const [saving, setSaving] =
|
|
21642
|
-
const fileInputRef =
|
|
21643
|
-
|
|
21690
|
+
const [fullName, setFullName] = React120.useState(user?.fullName ?? "");
|
|
21691
|
+
const [saving, setSaving] = React120.useState(false);
|
|
21692
|
+
const fileInputRef = React120.useRef(null);
|
|
21693
|
+
React120.useEffect(() => {
|
|
21644
21694
|
if (user) {
|
|
21645
21695
|
setFullName(user.fullName);
|
|
21646
21696
|
}
|
|
@@ -21780,8 +21830,8 @@ async function fetchMyPersonId(tenantId2, userId) {
|
|
|
21780
21830
|
function useMyPersonId(enabled = true) {
|
|
21781
21831
|
const orgId = useOrganizationStore((s) => s.currentOrg?.id);
|
|
21782
21832
|
const userId = useAuthStore((s) => s.user?.id);
|
|
21783
|
-
const [personId, setPersonId] =
|
|
21784
|
-
|
|
21833
|
+
const [personId, setPersonId] = React120.useState(void 0);
|
|
21834
|
+
React120.useEffect(() => {
|
|
21785
21835
|
if (!enabled || !orgId || !userId) return;
|
|
21786
21836
|
let alive = true;
|
|
21787
21837
|
void dedup(`self:person:${orgId}:${userId}`, () => fetchMyPersonId(orgId, userId)).then((id) => {
|
|
@@ -21841,18 +21891,18 @@ function MyWorkspaceCard() {
|
|
|
21841
21891
|
const myUnitIds = useUnitStore((s) => s.myUnitIds);
|
|
21842
21892
|
const activeUnitId = useUnitStore((s) => s.activeUnitId);
|
|
21843
21893
|
const entryReason = useUnitStore((s) => s.entryReason);
|
|
21844
|
-
const [person, setPerson] =
|
|
21845
|
-
const [candidate, setCandidate] =
|
|
21846
|
-
const [linking, setLinking] =
|
|
21894
|
+
const [person, setPerson] = React120.useState(void 0);
|
|
21895
|
+
const [candidate, setCandidate] = React120.useState(null);
|
|
21896
|
+
const [linking, setLinking] = React120.useState(false);
|
|
21847
21897
|
const orgId = currentOrg?.id;
|
|
21848
21898
|
const userId = user?.id;
|
|
21849
|
-
const load =
|
|
21899
|
+
const load = React120.useCallback(async () => {
|
|
21850
21900
|
if (!orgId || !userId) return;
|
|
21851
21901
|
const linked = await fetchMyPersonRecord(orgId, userId);
|
|
21852
21902
|
setPerson(linked);
|
|
21853
21903
|
setCandidate(linked ? null : await findMyPersonCandidate(orgId, user?.email, staffKinds));
|
|
21854
21904
|
}, [orgId, userId, user?.email, staffKinds]);
|
|
21855
|
-
|
|
21905
|
+
React120.useEffect(() => {
|
|
21856
21906
|
void load();
|
|
21857
21907
|
}, [load]);
|
|
21858
21908
|
if (!currentOrg) return null;
|
|
@@ -21946,10 +21996,10 @@ var useStore = create((set) => ({
|
|
|
21946
21996
|
function useHeaderAction(zone, action) {
|
|
21947
21997
|
const register = useStore((s) => s.register);
|
|
21948
21998
|
const unregister = useStore((s) => s.unregister);
|
|
21949
|
-
const latest =
|
|
21999
|
+
const latest = React120.useRef(action);
|
|
21950
22000
|
latest.current = action;
|
|
21951
22001
|
const id = action?.id;
|
|
21952
|
-
|
|
22002
|
+
React120.useEffect(() => {
|
|
21953
22003
|
if (!zone || !id) return;
|
|
21954
22004
|
const current2 = latest.current;
|
|
21955
22005
|
if (current2) register(zone, { ...current2, onSelect: () => latest.current?.onSelect() });
|
|
@@ -21958,7 +22008,7 @@ function useHeaderAction(zone, action) {
|
|
|
21958
22008
|
}
|
|
21959
22009
|
function useHeaderActions(zone) {
|
|
21960
22010
|
const byZone = useStore((s) => s.byZone);
|
|
21961
|
-
return
|
|
22011
|
+
return React120.useMemo(() => Object.values(byZone[zone] ?? {}), [byZone, zone]);
|
|
21962
22012
|
}
|
|
21963
22013
|
function useUserLabel(userId) {
|
|
21964
22014
|
const members = useOrganizationStore((s) => s.members);
|
|
@@ -22688,7 +22738,7 @@ function SubjectFormLayout({ fields, allFields, fieldGroups, values, onChange, r
|
|
|
22688
22738
|
const IconComponent = getLucideIcon(entityIcon ?? "Heart") ?? Heart;
|
|
22689
22739
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
22690
22740
|
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, { className: "pt-5", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-5", children: [
|
|
22691
|
-
/* @__PURE__ */ jsx("div", { className: "flex h-20 w-20 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary", children:
|
|
22741
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-20 w-20 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary", children: React120__default.createElement(IconComponent, { className: "h-8 w-8" }) }),
|
|
22692
22742
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-4", children: [
|
|
22693
22743
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4", children: [
|
|
22694
22744
|
nameField && /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-1.5", children: [
|
|
@@ -23147,14 +23197,14 @@ function ImageSlot({
|
|
|
23147
23197
|
onDraftFile
|
|
23148
23198
|
}) {
|
|
23149
23199
|
const t = useTranslation();
|
|
23150
|
-
const inputRef =
|
|
23151
|
-
const [url, setUrl] =
|
|
23152
|
-
const [busy, setBusy] =
|
|
23153
|
-
const [error, setError] =
|
|
23154
|
-
const draftUrlRef =
|
|
23200
|
+
const inputRef = React120__default.useRef(null);
|
|
23201
|
+
const [url, setUrl] = React120__default.useState(() => image.get(row));
|
|
23202
|
+
const [busy, setBusy] = React120__default.useState(false);
|
|
23203
|
+
const [error, setError] = React120__default.useState(null);
|
|
23204
|
+
const draftUrlRef = React120__default.useRef(null);
|
|
23155
23205
|
const currentUrl = image.get(row);
|
|
23156
23206
|
const draftFile = image.draftField ? row[image.draftField] : void 0;
|
|
23157
|
-
|
|
23207
|
+
React120__default.useEffect(() => {
|
|
23158
23208
|
if (draftFile) return;
|
|
23159
23209
|
if (draftUrlRef.current) {
|
|
23160
23210
|
URL.revokeObjectURL(draftUrlRef.current);
|
|
@@ -23162,7 +23212,7 @@ function ImageSlot({
|
|
|
23162
23212
|
}
|
|
23163
23213
|
setUrl(currentUrl);
|
|
23164
23214
|
}, [currentUrl, draftFile]);
|
|
23165
|
-
|
|
23215
|
+
React120__default.useEffect(() => () => {
|
|
23166
23216
|
if (draftUrlRef.current) URL.revokeObjectURL(draftUrlRef.current);
|
|
23167
23217
|
}, []);
|
|
23168
23218
|
const acceptsDraft = !canEdit && Boolean(image.draftField && onDraftFile);
|
|
@@ -23280,7 +23330,7 @@ function CrudFormPage({ entityDef, mode, initialData, onSubmit, onCancel, namePl
|
|
|
23280
23330
|
const [values, setValues] = useState(computeInit);
|
|
23281
23331
|
const [saving, setSaving] = useState(false);
|
|
23282
23332
|
const [invalidKeys, setInvalidKeys] = useState(EMPTY_KEYS);
|
|
23283
|
-
const initialRef =
|
|
23333
|
+
const initialRef = React120__default.useRef(JSON.stringify(values));
|
|
23284
23334
|
useEffect(() => {
|
|
23285
23335
|
const init = computeInit();
|
|
23286
23336
|
setValues(init);
|
|
@@ -23325,7 +23375,7 @@ function CrudFormPage({ entityDef, mode, initialData, onSubmit, onCancel, namePl
|
|
|
23325
23375
|
if (submitRef) submitRef.current = () => {
|
|
23326
23376
|
void submit();
|
|
23327
23377
|
};
|
|
23328
|
-
|
|
23378
|
+
React120__default.useEffect(() => () => {
|
|
23329
23379
|
if (submitRef) submitRef.current = null;
|
|
23330
23380
|
}, [submitRef]);
|
|
23331
23381
|
const dirty = JSON.stringify(values) !== initialRef.current;
|
|
@@ -23925,7 +23975,7 @@ function CrudListView({
|
|
|
23925
23975
|
if (onImport) {
|
|
23926
23976
|
createRoutes.push({ id: "import", label: t("crud.import.action"), description: t("crud.import.hint"), icon: "Upload", action: onImport });
|
|
23927
23977
|
}
|
|
23928
|
-
const createActions =
|
|
23978
|
+
const createActions = React120__default.useMemo(() => {
|
|
23929
23979
|
const out = createRoutes.map((qa, i) => ({
|
|
23930
23980
|
id: qa.id,
|
|
23931
23981
|
label: qa.label,
|
|
@@ -24329,9 +24379,9 @@ function buildCrudSurfaceContribution(read3) {
|
|
|
24329
24379
|
};
|
|
24330
24380
|
}
|
|
24331
24381
|
function CrudAgentSurface(props) {
|
|
24332
|
-
const ref =
|
|
24382
|
+
const ref = React120.useRef(props);
|
|
24333
24383
|
ref.current = props;
|
|
24334
|
-
const contribution =
|
|
24384
|
+
const contribution = React120.useMemo(
|
|
24335
24385
|
() => buildCrudSurfaceContribution(() => ref.current),
|
|
24336
24386
|
[]
|
|
24337
24387
|
);
|
|
@@ -24382,7 +24432,7 @@ function useFieldRules(entityKey) {
|
|
|
24382
24432
|
};
|
|
24383
24433
|
}, [entityKey, fieldRules]);
|
|
24384
24434
|
}
|
|
24385
|
-
var ImportWizard2 =
|
|
24435
|
+
var ImportWizard2 = React120__default.lazy(
|
|
24386
24436
|
() => import('./ImportWizard-CISHGNQC.js').then((m) => ({ default: m.ImportWizard }))
|
|
24387
24437
|
);
|
|
24388
24438
|
var PAGE_SIZE = 50;
|
|
@@ -24867,7 +24917,7 @@ function CrudPage({ entityDef: rawEntityDef, useStore: useStore2, basePath, disp
|
|
|
24867
24917
|
displayValue: deleteItem ? deleteItem[displayField] : void 0
|
|
24868
24918
|
}
|
|
24869
24919
|
),
|
|
24870
|
-
/* @__PURE__ */ jsx(
|
|
24920
|
+
/* @__PURE__ */ jsx(React120__default.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
|
|
24871
24921
|
ImportWizard2,
|
|
24872
24922
|
{
|
|
24873
24923
|
open: importOpen,
|
|
@@ -25173,7 +25223,7 @@ function columnOf(entity, key) {
|
|
|
25173
25223
|
function RelatedListTab({ item, related }) {
|
|
25174
25224
|
const parentId = item?.id;
|
|
25175
25225
|
const pathname = useHashPath();
|
|
25176
|
-
const Page =
|
|
25226
|
+
const Page = React120.useMemo(() => {
|
|
25177
25227
|
if (!parentId) return null;
|
|
25178
25228
|
const child = related.entity;
|
|
25179
25229
|
const fkColumn = columnOf(child, related.foreignKey);
|
|
@@ -25200,8 +25250,8 @@ function tabBasePath(pathname, tabId) {
|
|
|
25200
25250
|
}
|
|
25201
25251
|
function useHashPath() {
|
|
25202
25252
|
const read3 = () => typeof window === "undefined" ? "/" : window.location.hash.slice(1) || "/";
|
|
25203
|
-
const [path, setPath] =
|
|
25204
|
-
|
|
25253
|
+
const [path, setPath] = React120.useState(read3);
|
|
25254
|
+
React120.useEffect(() => {
|
|
25205
25255
|
const handler = () => setPath(read3());
|
|
25206
25256
|
window.addEventListener("hashchange", handler);
|
|
25207
25257
|
return () => window.removeEventListener("hashchange", handler);
|
|
@@ -25591,30 +25641,30 @@ function AccessTab({ item }) {
|
|
|
25591
25641
|
const hasSystemPermission = useSystemPermission();
|
|
25592
25642
|
const canManageTeam = hasSystemPermission("manage_team");
|
|
25593
25643
|
const guardSeats = useLimitGuard("users");
|
|
25594
|
-
const [access, setAccess] =
|
|
25595
|
-
const [email, setEmail] =
|
|
25596
|
-
const [roleId, setRoleId] =
|
|
25597
|
-
const [busy, setBusy] =
|
|
25598
|
-
const [confirmRemove, setConfirmRemove] =
|
|
25599
|
-
|
|
25644
|
+
const [access, setAccess] = React120.useState(void 0);
|
|
25645
|
+
const [email, setEmail] = React120.useState(person?.email ?? "");
|
|
25646
|
+
const [roleId, setRoleId] = React120.useState("");
|
|
25647
|
+
const [busy, setBusy] = React120.useState(false);
|
|
25648
|
+
const [confirmRemove, setConfirmRemove] = React120.useState(false);
|
|
25649
|
+
React120.useEffect(() => {
|
|
25600
25650
|
if (!roleId && profiles.length) setRoleId(profiles[1]?.id ?? profiles[0].id);
|
|
25601
25651
|
}, [profiles, roleId]);
|
|
25602
|
-
|
|
25652
|
+
React120.useEffect(() => {
|
|
25603
25653
|
setEmail(person?.email ?? "");
|
|
25604
25654
|
}, [person?.email]);
|
|
25605
|
-
const reload =
|
|
25655
|
+
const reload = React120.useCallback(async () => {
|
|
25606
25656
|
if (!personId) return;
|
|
25607
25657
|
setAccess(await fetchPersonAccess(personId));
|
|
25608
25658
|
}, [personId]);
|
|
25609
|
-
|
|
25659
|
+
React120.useEffect(() => {
|
|
25610
25660
|
void reload();
|
|
25611
25661
|
}, [reload]);
|
|
25612
|
-
|
|
25662
|
+
React120.useEffect(() => {
|
|
25613
25663
|
if (!adapter || !currentOrg || invites.length > 0) return;
|
|
25614
25664
|
adapter.listInvites(currentOrg.id).then(setInvites).catch(() => {
|
|
25615
25665
|
});
|
|
25616
25666
|
}, [adapter, currentOrg?.id]);
|
|
25617
|
-
const pendingInvite =
|
|
25667
|
+
const pendingInvite = React120.useMemo(() => {
|
|
25618
25668
|
const target = (person?.email ?? "").trim().toLowerCase();
|
|
25619
25669
|
if (!target) return void 0;
|
|
25620
25670
|
return invites.find((i) => i.status === "pending" && i.email.toLowerCase() === target);
|
|
@@ -25828,11 +25878,11 @@ function PersonUnitsTab({ item }) {
|
|
|
25828
25878
|
const units = useUnitStore((s) => s.units);
|
|
25829
25879
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
25830
25880
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
25831
|
-
const [userId, setUserId] =
|
|
25832
|
-
const [bindings, setBindings] =
|
|
25833
|
-
const [busy, setBusy] =
|
|
25881
|
+
const [userId, setUserId] = React120.useState(void 0);
|
|
25882
|
+
const [bindings, setBindings] = React120.useState({});
|
|
25883
|
+
const [busy, setBusy] = React120.useState(null);
|
|
25834
25884
|
const bindingsVersion = useDataVersion(UNIT_ACCESS_CHANGED);
|
|
25835
|
-
|
|
25885
|
+
React120.useEffect(() => {
|
|
25836
25886
|
if (!personId) return;
|
|
25837
25887
|
let alive = true;
|
|
25838
25888
|
void fetchUserIdForPerson(personId).then((uid2) => {
|
|
@@ -25842,11 +25892,11 @@ function PersonUnitsTab({ item }) {
|
|
|
25842
25892
|
alive = false;
|
|
25843
25893
|
};
|
|
25844
25894
|
}, [personId]);
|
|
25845
|
-
const reload =
|
|
25895
|
+
const reload = React120.useCallback(async (uid2) => {
|
|
25846
25896
|
const rows = await fetchMemberUnits(uid2);
|
|
25847
25897
|
setBindings(Object.fromEntries(rows.map((r) => [r.locationId, r.role])));
|
|
25848
25898
|
}, []);
|
|
25849
|
-
|
|
25899
|
+
React120.useEffect(() => {
|
|
25850
25900
|
if (userId) void reload(userId);
|
|
25851
25901
|
}, [userId, reload, bindingsVersion]);
|
|
25852
25902
|
async function toggle(unitId, on) {
|
|
@@ -25941,7 +25991,7 @@ function PersonUnitsTab({ item }) {
|
|
|
25941
25991
|
] })
|
|
25942
25992
|
] }) });
|
|
25943
25993
|
}
|
|
25944
|
-
var ScheduleEditor2 =
|
|
25994
|
+
var ScheduleEditor2 = React120__default.lazy(
|
|
25945
25995
|
() => import('./ScheduleEditor-QC6OYBUE.js').then((m) => ({ default: m.ScheduleEditor }))
|
|
25946
25996
|
);
|
|
25947
25997
|
function ComingSoon({ icon: Icon, title, description }) {
|
|
@@ -26045,7 +26095,7 @@ function ScheduleTab({ item }) {
|
|
|
26045
26095
|
return (
|
|
26046
26096
|
// O interruptor "Aparece na agenda" agora vem DENTRO do editor: era a
|
|
26047
26097
|
// única coisa que esta porta mostrava e a da agenda não.
|
|
26048
|
-
/* @__PURE__ */ jsx(
|
|
26098
|
+
/* @__PURE__ */ jsx(React120__default.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(ScheduleEditor2, { assigneeId: item.id }) })
|
|
26049
26099
|
);
|
|
26050
26100
|
}
|
|
26051
26101
|
var PERSON_DETAIL_TABS = [
|
|
@@ -26442,7 +26492,7 @@ function InlineEditor({
|
|
|
26442
26492
|
}) {
|
|
26443
26493
|
const [draft, setDraft] = useState(value ?? "");
|
|
26444
26494
|
const [saving, setSaving] = useState(false);
|
|
26445
|
-
const inputRef =
|
|
26495
|
+
const inputRef = React120__default.useRef(null);
|
|
26446
26496
|
useEffect(() => {
|
|
26447
26497
|
inputRef.current?.focus();
|
|
26448
26498
|
if (inputRef.current instanceof HTMLInputElement) inputRef.current.select();
|
|
@@ -26720,7 +26770,7 @@ function CrudDetailPage({
|
|
|
26720
26770
|
const displayFieldDef = entityDef.fields.find((f) => f.key === displayField);
|
|
26721
26771
|
const nameEditable = Boolean(onFieldSave) && Boolean(displayFieldDef) && isInlineEditable(displayFieldDef);
|
|
26722
26772
|
const [editingName, setEditingName] = useState(false);
|
|
26723
|
-
const imageInputRef =
|
|
26773
|
+
const imageInputRef = React120__default.useRef(null);
|
|
26724
26774
|
const runtime = usePluginRuntimeOptional();
|
|
26725
26775
|
const archetypeTabs = getArchetypeTabs(entityDef.layout, entityDef.data?.archetypeKind);
|
|
26726
26776
|
const relatedTabs = (entityDef.relatedLists ?? []).map((related) => ({
|
|
@@ -26778,7 +26828,7 @@ function CrudDetailPage({
|
|
|
26778
26828
|
window.history.replaceState(null, "", `#${segments.length ? `${base}/${segments.join("/")}` : base}`);
|
|
26779
26829
|
}, [basePath, item.id, selectedTab, embedded]);
|
|
26780
26830
|
const parentLabel = usePresetLabel(basePath, namePlural);
|
|
26781
|
-
const headerNode =
|
|
26831
|
+
const headerNode = React120__default.useMemo(
|
|
26782
26832
|
() => embedded ? null : /* @__PURE__ */ jsx(SubpageHeader, { title: displayValue, parentLabel, onBack }),
|
|
26783
26833
|
[embedded, displayValue, parentLabel, onBack]
|
|
26784
26834
|
);
|
|
@@ -26906,12 +26956,12 @@ function CrudDetailPage({
|
|
|
26906
26956
|
] }, tab.id);
|
|
26907
26957
|
})
|
|
26908
26958
|
] }),
|
|
26909
|
-
/* @__PURE__ */ jsx(TabsContent, { value: "overview", className: embedded ? "mt-2" : "mt-4", children: entityDef.overviewComponent ?
|
|
26959
|
+
/* @__PURE__ */ jsx(TabsContent, { value: "overview", className: embedded ? "mt-2" : "mt-4", children: entityDef.overviewComponent ? React120__default.createElement(entityDef.overviewComponent, { item, entityDef }) : /* @__PURE__ */ jsx(OverviewTab, { entityDef, item, compact: embedded, onFieldSave }) }),
|
|
26910
26960
|
customTabs.map((tab) => /* @__PURE__ */ jsx(TabsContent, { value: tab.id, className: "mt-4", children: tab.component ? (
|
|
26911
26961
|
// `tabPath` only to the tab the URL is actually addressing —
|
|
26912
26962
|
// handing it to every tab would have the documents tab trying to
|
|
26913
26963
|
// open a recording id when the user switches across.
|
|
26914
|
-
|
|
26964
|
+
React120__default.createElement(tab.component, {
|
|
26915
26965
|
item,
|
|
26916
26966
|
entityDef,
|
|
26917
26967
|
...tab.id === selectedTab ? { tabPath, setTabPath } : {},
|
|
@@ -26943,8 +26993,8 @@ function MyRecordPanel() {
|
|
|
26943
26993
|
const userId = useAuthStore((s) => s.user?.id);
|
|
26944
26994
|
const members = useOrganizationStore((s) => s.members);
|
|
26945
26995
|
const myRole = members.find((m) => m.userId === userId)?.profileName;
|
|
26946
|
-
const [state, setState] =
|
|
26947
|
-
const load =
|
|
26996
|
+
const [state, setState] = React120.useState({ status: "loading" });
|
|
26997
|
+
const load = React120.useCallback(async () => {
|
|
26948
26998
|
if (!orgId || !userId) return;
|
|
26949
26999
|
const person = await dedup(`self:record:${orgId}:${userId}`, () => fetchMyPersonRecord(orgId, userId));
|
|
26950
27000
|
if (!person) return setState({ status: "none" });
|
|
@@ -26961,10 +27011,10 @@ function MyRecordPanel() {
|
|
|
26961
27011
|
setState({ status: "none" });
|
|
26962
27012
|
}
|
|
26963
27013
|
}, [orgId, userId]);
|
|
26964
|
-
|
|
27014
|
+
React120.useEffect(() => {
|
|
26965
27015
|
void load();
|
|
26966
27016
|
}, [load]);
|
|
26967
|
-
const changePhoto =
|
|
27017
|
+
const changePhoto = React120.useCallback(async (file) => {
|
|
26968
27018
|
if (state.status !== "ready") return;
|
|
26969
27019
|
const supabase = getFayzSupabaseClientOptional();
|
|
26970
27020
|
if (!supabase) return;
|
|
@@ -27020,8 +27070,8 @@ function ConnectedUserProfile() {
|
|
|
27020
27070
|
const myPersonId = useMyPersonId();
|
|
27021
27071
|
const hasRecord = Boolean(myPersonId);
|
|
27022
27072
|
const setUser = useAuthStore((s) => s.setUser);
|
|
27023
|
-
const [profile, setProfile] =
|
|
27024
|
-
|
|
27073
|
+
const [profile, setProfile] = React120.useState(null);
|
|
27074
|
+
React120.useEffect(() => {
|
|
27025
27075
|
const supabase = getFayzSupabaseClientOptional();
|
|
27026
27076
|
if (!user || !supabase) return;
|
|
27027
27077
|
let cancelled = false;
|
|
@@ -27132,9 +27182,9 @@ function SecuritySettings({
|
|
|
27132
27182
|
onTenantSecurityChange
|
|
27133
27183
|
}) {
|
|
27134
27184
|
const { t } = useTranslation$1();
|
|
27135
|
-
const [resetting, setResetting] =
|
|
27136
|
-
const [resetSent, setResetSent] =
|
|
27137
|
-
const [savingTenant, setSavingTenant] =
|
|
27185
|
+
const [resetting, setResetting] = React120.useState(false);
|
|
27186
|
+
const [resetSent, setResetSent] = React120.useState(false);
|
|
27187
|
+
const [savingTenant, setSavingTenant] = React120.useState(false);
|
|
27138
27188
|
const handleResetPassword = async () => {
|
|
27139
27189
|
if (!onResetPassword) return;
|
|
27140
27190
|
setResetting(true);
|
|
@@ -27308,8 +27358,8 @@ function FileUploadField({
|
|
|
27308
27358
|
hint
|
|
27309
27359
|
}) {
|
|
27310
27360
|
const { t } = useTranslation$1();
|
|
27311
|
-
const inputRef =
|
|
27312
|
-
const [preview, setPreview] =
|
|
27361
|
+
const inputRef = React120.useRef(null);
|
|
27362
|
+
const [preview, setPreview] = React120.useState(null);
|
|
27313
27363
|
const handleChange = (e) => {
|
|
27314
27364
|
const file = e.target.files?.[0];
|
|
27315
27365
|
if (file) {
|
|
@@ -27526,13 +27576,13 @@ function BrandPreview({ brand, t }) {
|
|
|
27526
27576
|
}
|
|
27527
27577
|
function BrandingSettings({ brand, onSave }) {
|
|
27528
27578
|
const { t } = useTranslation$1();
|
|
27529
|
-
const [section, setSection] =
|
|
27530
|
-
const [saved, setSaved] =
|
|
27531
|
-
const [draft, setDraft] =
|
|
27532
|
-
const [logoFile, setLogoFile] =
|
|
27533
|
-
const [faviconFile, setFaviconFile] =
|
|
27534
|
-
const [saving, setSaving] =
|
|
27535
|
-
|
|
27579
|
+
const [section, setSection] = React120.useState("identity");
|
|
27580
|
+
const [saved, setSaved] = React120.useState(brand ?? EMPTY_BRAND);
|
|
27581
|
+
const [draft, setDraft] = React120.useState(brand ?? EMPTY_BRAND);
|
|
27582
|
+
const [logoFile, setLogoFile] = React120.useState(null);
|
|
27583
|
+
const [faviconFile, setFaviconFile] = React120.useState(null);
|
|
27584
|
+
const [saving, setSaving] = React120.useState(false);
|
|
27585
|
+
React120.useEffect(() => {
|
|
27536
27586
|
if (brand) {
|
|
27537
27587
|
setSaved(brand);
|
|
27538
27588
|
setDraft(brand);
|
|
@@ -27906,11 +27956,11 @@ function ConnectedBrandingSettings() {
|
|
|
27906
27956
|
toast.error("N\xE3o foi poss\xEDvel salvar a marca", { description: err?.message });
|
|
27907
27957
|
}
|
|
27908
27958
|
};
|
|
27909
|
-
const [brand, setBrand] =
|
|
27959
|
+
const [brand, setBrand] = React120.useState(() => normalizeBrand(
|
|
27910
27960
|
(currentOrg?.settings ?? {}).branding,
|
|
27911
27961
|
{ name: currentOrg?.name, logoUrl: currentOrg?.logoUrl }
|
|
27912
27962
|
));
|
|
27913
|
-
|
|
27963
|
+
React120.useEffect(() => {
|
|
27914
27964
|
let alive = true;
|
|
27915
27965
|
void (async () => {
|
|
27916
27966
|
try {
|
|
@@ -28031,12 +28081,12 @@ function ProjectsSettings() {
|
|
|
28031
28081
|
const projects = useFayzProjectsStore((s) => s.projects);
|
|
28032
28082
|
const load = useFayzProjectsStore((s) => s.load);
|
|
28033
28083
|
const refresh = useFayzProjectsStore((s) => s.refresh);
|
|
28034
|
-
const [linking, setLinking] =
|
|
28084
|
+
const [linking, setLinking] = React120.useState(false);
|
|
28035
28085
|
const connected = isPlatformConnected();
|
|
28036
|
-
|
|
28086
|
+
React120.useEffect(() => {
|
|
28037
28087
|
void load(currentOrgId);
|
|
28038
28088
|
}, [currentOrgId, load]);
|
|
28039
|
-
|
|
28089
|
+
React120.useEffect(() => {
|
|
28040
28090
|
if (!connected || projects.length === 0) return;
|
|
28041
28091
|
let cancelled = false;
|
|
28042
28092
|
void (async () => {
|
|
@@ -28108,7 +28158,7 @@ function SiteRow({
|
|
|
28108
28158
|
showDefaultAction,
|
|
28109
28159
|
onChanged
|
|
28110
28160
|
}) {
|
|
28111
|
-
const [busy, setBusy] =
|
|
28161
|
+
const [busy, setBusy] = React120.useState(false);
|
|
28112
28162
|
const editorUrl = editorUrlOf(project);
|
|
28113
28163
|
const run = async (action) => {
|
|
28114
28164
|
setBusy(true);
|
|
@@ -28179,7 +28229,7 @@ function SiteRow({
|
|
|
28179
28229
|
] });
|
|
28180
28230
|
}
|
|
28181
28231
|
function LinkSiteModal({ onClose, onLinked }) {
|
|
28182
|
-
const [mode, setMode] =
|
|
28232
|
+
const [mode, setMode] = React120.useState("import");
|
|
28183
28233
|
return /* @__PURE__ */ jsx(Modal, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs(ModalContent, { size: "lg", children: [
|
|
28184
28234
|
/* @__PURE__ */ jsxs(ModalHeader, { children: [
|
|
28185
28235
|
/* @__PURE__ */ jsx(ModalTitle, { children: "Vincular um site" }),
|
|
@@ -28215,11 +28265,11 @@ function ModeTab({
|
|
|
28215
28265
|
}
|
|
28216
28266
|
function ImportPane({ onLinked }) {
|
|
28217
28267
|
const linked = useFayzProjectsStore((s) => s.projects);
|
|
28218
|
-
const [search, setSearch] =
|
|
28219
|
-
const [remote, setRemote] =
|
|
28220
|
-
const [error, setError] =
|
|
28221
|
-
const [linkingId, setLinkingId] =
|
|
28222
|
-
|
|
28268
|
+
const [search, setSearch] = React120.useState("");
|
|
28269
|
+
const [remote, setRemote] = React120.useState(null);
|
|
28270
|
+
const [error, setError] = React120.useState(null);
|
|
28271
|
+
const [linkingId, setLinkingId] = React120.useState(null);
|
|
28272
|
+
React120.useEffect(() => {
|
|
28223
28273
|
let cancelled = false;
|
|
28224
28274
|
setError(null);
|
|
28225
28275
|
const timer = setTimeout(() => {
|
|
@@ -28301,9 +28351,9 @@ function ImportPane({ onLinked }) {
|
|
|
28301
28351
|
}
|
|
28302
28352
|
function CreatePane({ onLinked, onCancel }) {
|
|
28303
28353
|
const linked = useFayzProjectsStore((s) => s.projects);
|
|
28304
|
-
const [prompt, setPrompt] =
|
|
28305
|
-
const [busy, setBusy] =
|
|
28306
|
-
const [error, setError] =
|
|
28354
|
+
const [prompt, setPrompt] = React120.useState("");
|
|
28355
|
+
const [busy, setBusy] = React120.useState(false);
|
|
28356
|
+
const [error, setError] = React120.useState(null);
|
|
28307
28357
|
const tooShort = prompt.trim().length < PROMPT_MIN_CHARS;
|
|
28308
28358
|
const submit = async () => {
|
|
28309
28359
|
setBusy(true);
|
|
@@ -28448,10 +28498,10 @@ function ModuleCatalogSections({
|
|
|
28448
28498
|
onToggle,
|
|
28449
28499
|
busy
|
|
28450
28500
|
}) {
|
|
28451
|
-
const [query, setQuery] =
|
|
28501
|
+
const [query, setQuery] = React120.useState("");
|
|
28452
28502
|
const total = categories.reduce((n, c) => n + c.rows.length, 0);
|
|
28453
28503
|
const searchable = total > 6;
|
|
28454
|
-
const filtered =
|
|
28504
|
+
const filtered = React120.useMemo(() => filterCategories(categories, query), [categories, query]);
|
|
28455
28505
|
if (categories.length === 0) {
|
|
28456
28506
|
return /* @__PURE__ */ jsxs("div", { className: "py-8 text-center", children: [
|
|
28457
28507
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: "Nada a adicionar" }),
|
|
@@ -28493,7 +28543,7 @@ function CategorySection({
|
|
|
28493
28543
|
onToggle,
|
|
28494
28544
|
busy
|
|
28495
28545
|
}) {
|
|
28496
|
-
const [open, setOpen] =
|
|
28546
|
+
const [open, setOpen] = React120.useState(category.mine);
|
|
28497
28547
|
const expanded = open || forceOpen;
|
|
28498
28548
|
const Chevron = expanded ? ChevronDown : ChevronRight;
|
|
28499
28549
|
return /* @__PURE__ */ jsxs("section", { children: [
|
|
@@ -28575,8 +28625,8 @@ function buildCategories(catalog, rows) {
|
|
|
28575
28625
|
}
|
|
28576
28626
|
function useModuleCatalog() {
|
|
28577
28627
|
const tenantId2 = useOrganizationStore((s) => s.currentOrg?.id ?? null);
|
|
28578
|
-
const [catalog, setCatalog] =
|
|
28579
|
-
|
|
28628
|
+
const [catalog, setCatalog] = React120.useState([]);
|
|
28629
|
+
React120.useEffect(() => {
|
|
28580
28630
|
const supabase = getSupabaseClientOptional$1();
|
|
28581
28631
|
if (!supabase) return;
|
|
28582
28632
|
let alive = true;
|
|
@@ -28593,15 +28643,15 @@ function useModuleCatalog() {
|
|
|
28593
28643
|
function ModulesSettings({ hidden = [], onToggle, permits, busy, catalog = [] }) {
|
|
28594
28644
|
const runtime = usePluginRuntime();
|
|
28595
28645
|
const offered = useOfferedPlugins();
|
|
28596
|
-
const [adding, setAdding] =
|
|
28597
|
-
const rows =
|
|
28646
|
+
const [adding, setAdding] = React120.useState(false);
|
|
28647
|
+
const rows = React120.useMemo(() => {
|
|
28598
28648
|
const known = catalog.length ? new Set(catalog.flatMap((app) => app.modules)) : new Set(offered);
|
|
28599
28649
|
const inCatalogue = known.size ? runtime.plugins.filter((p) => known.has(p.id) || p.isActive) : runtime.plugins;
|
|
28600
28650
|
return buildRows(inCatalogue, new Set(hidden), permits);
|
|
28601
28651
|
}, [runtime.plugins, hidden, permits, offered, catalog]);
|
|
28602
28652
|
const on = rows.filter((r) => r.plugin.isActive);
|
|
28603
|
-
const off =
|
|
28604
|
-
const categories =
|
|
28653
|
+
const off = React120.useMemo(() => rows.filter((r) => !r.plugin.isActive), [rows]);
|
|
28654
|
+
const categories = React120.useMemo(() => buildCategories(catalog, off), [catalog, off]);
|
|
28605
28655
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-8", children: [
|
|
28606
28656
|
/* @__PURE__ */ jsx(PageHeaderActions, { children: /* @__PURE__ */ jsxs(Button, { size: "sm", className: "shrink-0 gap-1.5", onClick: () => setAdding(true), children: [
|
|
28607
28657
|
/* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
|
|
@@ -28809,8 +28859,8 @@ function ConnectedModulesSettings({ hidden = SHELL_PLUGINS }) {
|
|
|
28809
28859
|
const access = useAccessOptional();
|
|
28810
28860
|
const catalog = useModuleCatalog();
|
|
28811
28861
|
const tenantId2 = useOrganizationStore((s) => s.currentOrg?.id ?? null);
|
|
28812
|
-
const [busy, setBusy] =
|
|
28813
|
-
const onToggle =
|
|
28862
|
+
const [busy, setBusy] = React120.useState(false);
|
|
28863
|
+
const onToggle = React120.useCallback(
|
|
28814
28864
|
async (plugin, status, facet) => {
|
|
28815
28865
|
const supabase = getSupabaseClientOptional$1();
|
|
28816
28866
|
if (!supabase) return;
|
|
@@ -28836,7 +28886,7 @@ function ConnectedModulesSettings({ hidden = SHELL_PLUGINS }) {
|
|
|
28836
28886
|
},
|
|
28837
28887
|
[refresh, tenantId2]
|
|
28838
28888
|
);
|
|
28839
|
-
const permits =
|
|
28889
|
+
const permits = React120.useCallback(
|
|
28840
28890
|
(plugin) => access ? access.can(plugin, "read").allowed || access.entitled(plugin) : true,
|
|
28841
28891
|
[access]
|
|
28842
28892
|
);
|
|
@@ -28847,7 +28897,7 @@ function useCoreSettingsTabs({
|
|
|
28847
28897
|
showBranding = true
|
|
28848
28898
|
} = {}) {
|
|
28849
28899
|
const { t } = useTranslation$1();
|
|
28850
|
-
return
|
|
28900
|
+
return React120.useMemo(() => [
|
|
28851
28901
|
...showCompany ? [{ id: "general", label: t("settings.general"), icon: /* @__PURE__ */ jsx(Building2, { className: "h-4 w-4" }), iconName: "Building2", component: /* @__PURE__ */ jsx(ConnectedCompanySettings, {}) }] : [],
|
|
28852
28902
|
{ id: "profile", label: t("settings.profile"), icon: /* @__PURE__ */ jsx(User, { className: "h-4 w-4" }), iconName: "User", component: /* @__PURE__ */ jsx(ConnectedUserProfile, {}) },
|
|
28853
28903
|
{ id: "security", label: t("settings.security"), icon: /* @__PURE__ */ jsx(Shield, { className: "h-4 w-4" }), iconName: "Shield", component: /* @__PURE__ */ jsx(ConnectedSecuritySettings, {}) },
|
|
@@ -28892,10 +28942,10 @@ function SettingsPage({
|
|
|
28892
28942
|
}
|
|
28893
28943
|
return null;
|
|
28894
28944
|
}
|
|
28895
|
-
const [activeTab, setActiveTab] =
|
|
28945
|
+
const [activeTab, setActiveTab] = React120.useState(() => {
|
|
28896
28946
|
return getTabFromHash() ?? defaultTab ?? null;
|
|
28897
28947
|
});
|
|
28898
|
-
|
|
28948
|
+
React120.useEffect(() => {
|
|
28899
28949
|
const handler = () => {
|
|
28900
28950
|
const tab = getTabFromHash();
|
|
28901
28951
|
if (tab) setActiveTab(tab);
|
|
@@ -28921,7 +28971,7 @@ function SettingsPage({
|
|
|
28921
28971
|
setActiveTab(null);
|
|
28922
28972
|
window.location.hash = "/settings";
|
|
28923
28973
|
};
|
|
28924
|
-
const sections =
|
|
28974
|
+
const sections = React120.useMemo(() => {
|
|
28925
28975
|
const out = [];
|
|
28926
28976
|
for (const tab of resolvedTabs) {
|
|
28927
28977
|
const heading = tab.isPlugin ? tab.group ?? t("common.plugins") : null;
|
|
@@ -29002,14 +29052,14 @@ function InviteMemberDialog({ open, onOpenChange, defaultEmail }) {
|
|
|
29002
29052
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
29003
29053
|
const setInvites = useInviteStore((s) => s.setInvites);
|
|
29004
29054
|
const { user } = useAuthStore();
|
|
29005
|
-
const [emails, setEmails] =
|
|
29006
|
-
const [profileId, setProfileId] =
|
|
29007
|
-
const [sending, setSending] =
|
|
29008
|
-
const [sent, setSent] =
|
|
29009
|
-
|
|
29055
|
+
const [emails, setEmails] = React120.useState([defaultEmail ?? ""]);
|
|
29056
|
+
const [profileId, setProfileId] = React120.useState(profiles[1]?.id ?? profiles[0]?.id ?? "");
|
|
29057
|
+
const [sending, setSending] = React120.useState(false);
|
|
29058
|
+
const [sent, setSent] = React120.useState(false);
|
|
29059
|
+
React120.useEffect(() => {
|
|
29010
29060
|
if (open) setEmails([defaultEmail ?? ""]);
|
|
29011
29061
|
}, [open, defaultEmail]);
|
|
29012
|
-
|
|
29062
|
+
React120.useEffect(() => {
|
|
29013
29063
|
if (!profileId && profiles.length) setProfileId(profiles[1]?.id ?? profiles[0].id);
|
|
29014
29064
|
}, [profiles, profileId]);
|
|
29015
29065
|
const addEmail = () => setEmails((prev) => [...prev, ""]);
|
|
@@ -29113,7 +29163,7 @@ function UnitSwitcher({ collapsed = false, className }) {
|
|
|
29113
29163
|
const myUnitIds = useUnitStore((s) => s.myUnitIds);
|
|
29114
29164
|
const activeUnitId = useUnitStore((s) => s.activeUnitId);
|
|
29115
29165
|
const beginSwitch = useUnitSwitchingStore((s) => s.begin);
|
|
29116
|
-
const [query, setQuery] =
|
|
29166
|
+
const [query, setQuery] = React120.useState("");
|
|
29117
29167
|
const singular = label(t, "unit.singular", "unidade");
|
|
29118
29168
|
const plural = label(t, "unit.plural", "unidades");
|
|
29119
29169
|
if (!unitMode) return null;
|
|
@@ -29138,13 +29188,13 @@ function UnitSwitcher({ collapsed = false, className }) {
|
|
|
29138
29188
|
}
|
|
29139
29189
|
const renderNode = (node, depth) => {
|
|
29140
29190
|
if (node.kind === "region") {
|
|
29141
|
-
return /* @__PURE__ */ jsxs(
|
|
29191
|
+
return /* @__PURE__ */ jsxs(React120.Fragment, { children: [
|
|
29142
29192
|
/* @__PURE__ */ jsx(DropdownLabel, { className: "px-2 pt-2 text-[10px] uppercase tracking-wide text-muted-foreground", children: node.name }),
|
|
29143
29193
|
node.children.map((child) => renderNode(child, depth + 1))
|
|
29144
29194
|
] }, node.id);
|
|
29145
29195
|
}
|
|
29146
29196
|
if (!reachable.includes(node.id)) return null;
|
|
29147
|
-
return /* @__PURE__ */ jsxs(
|
|
29197
|
+
return /* @__PURE__ */ jsxs(React120.Fragment, { children: [
|
|
29148
29198
|
/* @__PURE__ */ jsxs(
|
|
29149
29199
|
DropdownItem,
|
|
29150
29200
|
{
|
|
@@ -29227,7 +29277,7 @@ function UnitSwitcher({ collapsed = false, className }) {
|
|
|
29227
29277
|
var MENU_LIST_CAP = 5;
|
|
29228
29278
|
function UnitMenuSection() {
|
|
29229
29279
|
useUnitBootstrap();
|
|
29230
|
-
const [locating, setLocating] =
|
|
29280
|
+
const [locating, setLocating] = React120.useState(false);
|
|
29231
29281
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
29232
29282
|
const units = useUnitStore((s) => s.units);
|
|
29233
29283
|
const tree = useUnitStore((s) => s.tree);
|
|
@@ -29278,13 +29328,13 @@ function UnitMenuSection() {
|
|
|
29278
29328
|
if (node.kind === "region") {
|
|
29279
29329
|
const visibleChildren = node.children.filter((c) => c.kind === "region" || reachable.includes(c.id));
|
|
29280
29330
|
if (visibleChildren.length === 0) return null;
|
|
29281
|
-
return /* @__PURE__ */ jsxs(
|
|
29331
|
+
return /* @__PURE__ */ jsxs(React120.Fragment, { children: [
|
|
29282
29332
|
/* @__PURE__ */ jsx(DropdownLabel, { className: "px-2 pt-2 text-[10px] uppercase tracking-wide text-muted-foreground", children: node.name }),
|
|
29283
29333
|
visibleChildren.map((child) => renderNode(child, depth + 1))
|
|
29284
29334
|
] }, node.id);
|
|
29285
29335
|
}
|
|
29286
29336
|
if (!reachable.includes(node.id)) return null;
|
|
29287
|
-
return /* @__PURE__ */ jsxs(
|
|
29337
|
+
return /* @__PURE__ */ jsxs(React120.Fragment, { children: [
|
|
29288
29338
|
/* @__PURE__ */ jsxs(
|
|
29289
29339
|
DropdownItem,
|
|
29290
29340
|
{
|
|
@@ -29423,9 +29473,9 @@ function MemberUnitsCell({
|
|
|
29423
29473
|
const byId = useUnitStore((s) => s.byId);
|
|
29424
29474
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
29425
29475
|
const openUnit = useUnitPanel((s) => s.openUnit);
|
|
29426
|
-
const [unitIds, setUnitIds] =
|
|
29476
|
+
const [unitIds, setUnitIds] = React120.useState(null);
|
|
29427
29477
|
const version5 = useDataVersion(UNIT_ACCESS_CHANGED);
|
|
29428
|
-
|
|
29478
|
+
React120.useEffect(() => {
|
|
29429
29479
|
if (!userId) {
|
|
29430
29480
|
setUnitIds([]);
|
|
29431
29481
|
return;
|
|
@@ -29483,10 +29533,10 @@ function TeamTab() {
|
|
|
29483
29533
|
const { user } = useAuthStore();
|
|
29484
29534
|
const hasSystemPermission = useSystemPermission();
|
|
29485
29535
|
const personMode = teamPersonKinds.length > 0 && typeof adapter?.listTeam === "function";
|
|
29486
|
-
const [team, setTeam] =
|
|
29487
|
-
const [inviteOpen, setInviteOpen] =
|
|
29536
|
+
const [team, setTeam] = React120.useState(null);
|
|
29537
|
+
const [inviteOpen, setInviteOpen] = React120.useState(false);
|
|
29488
29538
|
const guardSeats = useLimitGuard("users");
|
|
29489
|
-
const [inviteEmail, setInviteEmail] =
|
|
29539
|
+
const [inviteEmail, setInviteEmail] = React120.useState(void 0);
|
|
29490
29540
|
const handleOpenInvite = async (row) => {
|
|
29491
29541
|
if (row && !row.email && row.personId && entityRouteHasDetail("person", row.kind)) {
|
|
29492
29542
|
openEntity(row.personId, "person", row.kind, "access");
|
|
@@ -29496,7 +29546,7 @@ function TeamTab() {
|
|
|
29496
29546
|
setInviteEmail(row?.email || void 0);
|
|
29497
29547
|
setInviteOpen(true);
|
|
29498
29548
|
};
|
|
29499
|
-
const reloadTeam =
|
|
29549
|
+
const reloadTeam = React120.useCallback(async () => {
|
|
29500
29550
|
if (!adapter || !currentOrg) return;
|
|
29501
29551
|
if (personMode && adapter.listTeam) {
|
|
29502
29552
|
setTeam(await adapter.listTeam(currentOrg.id, teamPersonKinds));
|
|
@@ -29504,12 +29554,12 @@ function TeamTab() {
|
|
|
29504
29554
|
setMembers(await adapter.listMembers(currentOrg.id));
|
|
29505
29555
|
}
|
|
29506
29556
|
}, [adapter, currentOrg?.id, personMode, teamPersonKinds, setMembers]);
|
|
29507
|
-
|
|
29557
|
+
React120.useEffect(() => {
|
|
29508
29558
|
if (personMode && adapter?.listTeam && currentOrg) {
|
|
29509
29559
|
dedup("team:people:" + currentOrg.id, () => adapter.listTeam(currentOrg.id, teamPersonKinds)).then(setTeam).catch(() => setTeam([]));
|
|
29510
29560
|
}
|
|
29511
29561
|
}, [personMode, adapter, currentOrg?.id, teamPersonKinds.join(",")]);
|
|
29512
|
-
|
|
29562
|
+
React120.useEffect(() => {
|
|
29513
29563
|
if (adapter && currentOrg) {
|
|
29514
29564
|
dedup("team:invites:" + currentOrg.id, () => adapter.listInvites(currentOrg.id)).then(setInvites).catch(() => {
|
|
29515
29565
|
});
|
|
@@ -29590,7 +29640,7 @@ function TeamTab() {
|
|
|
29590
29640
|
};
|
|
29591
29641
|
const { t } = useTranslation$1();
|
|
29592
29642
|
const canManageTeam = hasSystemPermission("manage_team");
|
|
29593
|
-
const inviteActions =
|
|
29643
|
+
const inviteActions = React120.useMemo(() => [{
|
|
29594
29644
|
id: "invite",
|
|
29595
29645
|
label: t("organization.team.invite"),
|
|
29596
29646
|
icon: UserPlus,
|
|
@@ -29777,13 +29827,13 @@ var SYSTEM_PERMISSIONS = [
|
|
|
29777
29827
|
];
|
|
29778
29828
|
function PermissionMatrixEditor({ features, profile, onSave, onCancel, saving, isNew, parentLabel }) {
|
|
29779
29829
|
const { t } = useTranslation$1();
|
|
29780
|
-
const [name, setName] =
|
|
29781
|
-
const [description, setDescription] =
|
|
29782
|
-
const [systemPerms, setSystemPerms] =
|
|
29783
|
-
const [grants, setGrants] =
|
|
29784
|
-
const [collapsed, setCollapsed] =
|
|
29785
|
-
const [search, setSearch] =
|
|
29786
|
-
const initial =
|
|
29830
|
+
const [name, setName] = React120.useState(profile?.name ?? "");
|
|
29831
|
+
const [description, setDescription] = React120.useState(profile?.description ?? "");
|
|
29832
|
+
const [systemPerms, setSystemPerms] = React120.useState(profile?.systemPermissions ?? []);
|
|
29833
|
+
const [grants, setGrants] = React120.useState(profile?.grants ?? {});
|
|
29834
|
+
const [collapsed, setCollapsed] = React120.useState(/* @__PURE__ */ new Set());
|
|
29835
|
+
const [search, setSearch] = React120.useState("");
|
|
29836
|
+
const initial = React120.useRef({
|
|
29787
29837
|
name: profile?.name ?? "",
|
|
29788
29838
|
description: profile?.description ?? "",
|
|
29789
29839
|
systemPerms: JSON.stringify(profile?.systemPermissions ?? []),
|
|
@@ -29820,7 +29870,7 @@ function PermissionMatrixEditor({ features, profile, onSave, onCancel, saving, i
|
|
|
29820
29870
|
onDiscard: onCancel,
|
|
29821
29871
|
saveLabel: isNew ? t("organization.permissions.createProfile") : t("organization.permissions.updateProfile")
|
|
29822
29872
|
});
|
|
29823
|
-
const groups =
|
|
29873
|
+
const groups = React120.useMemo(() => {
|
|
29824
29874
|
const filtered = search ? features.filter((f) => f.label.toLowerCase().includes(search.toLowerCase())) : features;
|
|
29825
29875
|
const map = /* @__PURE__ */ new Map();
|
|
29826
29876
|
for (const f of filtered) {
|
|
@@ -29889,7 +29939,7 @@ function PermissionMatrixEditor({ features, profile, onSave, onCancel, saving, i
|
|
|
29889
29939
|
}
|
|
29890
29940
|
) }) })
|
|
29891
29941
|
] }, sp.id)),
|
|
29892
|
-
Array.from(groups.entries()).map(([groupName, groupFeatures]) => /* @__PURE__ */ jsxs(
|
|
29942
|
+
Array.from(groups.entries()).map(([groupName, groupFeatures]) => /* @__PURE__ */ jsxs(React120.Fragment, { children: [
|
|
29893
29943
|
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 5, className: "p-2 px-3", children: /* @__PURE__ */ jsxs(
|
|
29894
29944
|
"button",
|
|
29895
29945
|
{
|
|
@@ -29961,12 +30011,12 @@ function PermissionProfilesTab() {
|
|
|
29961
30011
|
const startImpersonation = usePermissionsStore((s) => s.startImpersonation);
|
|
29962
30012
|
const canPreview = (realProfile?.systemPermissions ?? []).includes("manage_permissions") ?? false;
|
|
29963
30013
|
const { t } = useTranslation$1();
|
|
29964
|
-
const [editingProfile, setEditingProfile] =
|
|
29965
|
-
const [creating, setCreating] =
|
|
29966
|
-
const [duplicateSource, setDuplicateSource] =
|
|
29967
|
-
const [saving, setSaving] =
|
|
29968
|
-
const [error, setError] =
|
|
29969
|
-
const [deleting, setDeleting] =
|
|
30014
|
+
const [editingProfile, setEditingProfile] = React120.useState(null);
|
|
30015
|
+
const [creating, setCreating] = React120.useState(false);
|
|
30016
|
+
const [duplicateSource, setDuplicateSource] = React120.useState(null);
|
|
30017
|
+
const [saving, setSaving] = React120.useState(false);
|
|
30018
|
+
const [error, setError] = React120.useState(null);
|
|
30019
|
+
const [deleting, setDeleting] = React120.useState(null);
|
|
29970
30020
|
const handleDuplicate = (profile) => {
|
|
29971
30021
|
setEditingProfile(null);
|
|
29972
30022
|
setCreating(false);
|
|
@@ -29976,9 +30026,9 @@ function PermissionProfilesTab() {
|
|
|
29976
30026
|
isSystem: false
|
|
29977
30027
|
});
|
|
29978
30028
|
};
|
|
29979
|
-
const surfaceRef =
|
|
30029
|
+
const surfaceRef = React120.useRef({ features, profiles, adapter, currentOrg, setProfiles });
|
|
29980
30030
|
surfaceRef.current = { features, profiles, adapter, currentOrg, setProfiles };
|
|
29981
|
-
const agentSurface =
|
|
30031
|
+
const agentSurface = React120.useMemo(() => ({
|
|
29982
30032
|
id: "org.permissions",
|
|
29983
30033
|
instructions: PERMISSIONS_INSTRUCTIONS,
|
|
29984
30034
|
describe: () => {
|
|
@@ -30032,7 +30082,7 @@ function PermissionProfilesTab() {
|
|
|
30032
30082
|
}]
|
|
30033
30083
|
}), []);
|
|
30034
30084
|
useAgentSurface(agentSurface);
|
|
30035
|
-
const createActions =
|
|
30085
|
+
const createActions = React120.useMemo(() => [
|
|
30036
30086
|
{
|
|
30037
30087
|
id: "new",
|
|
30038
30088
|
label: t("organization.permissions.createProfile"),
|
|
@@ -30061,7 +30111,7 @@ function PermissionProfilesTab() {
|
|
|
30061
30111
|
})
|
|
30062
30112
|
}
|
|
30063
30113
|
], [t]);
|
|
30064
|
-
const memberCountByProfile =
|
|
30114
|
+
const memberCountByProfile = React120.useMemo(() => {
|
|
30065
30115
|
const counts = {};
|
|
30066
30116
|
for (const m of members) {
|
|
30067
30117
|
counts[m.profileId] = (counts[m.profileId] ?? 0) + 1;
|
|
@@ -30366,7 +30416,7 @@ function FieldRulesSettings({ entities, rules: initialRules, onSave }) {
|
|
|
30366
30416
|
const [saving, setSaving] = useState(false);
|
|
30367
30417
|
const [search, setSearch] = useState("");
|
|
30368
30418
|
const [showMore, setShowMore] = useState(false);
|
|
30369
|
-
|
|
30419
|
+
React120.useEffect(() => {
|
|
30370
30420
|
setDraft(initialRules);
|
|
30371
30421
|
}, [initialRules]);
|
|
30372
30422
|
const isDirty = useMemo(
|
|
@@ -30766,19 +30816,19 @@ function SoftLimitWidget() {
|
|
|
30766
30816
|
function LimitProbe({ limitKey }) {
|
|
30767
30817
|
const info = useLimit(limitKey);
|
|
30768
30818
|
const report = useSoftLimitStore((s) => s.report);
|
|
30769
|
-
|
|
30819
|
+
React120.useEffect(() => {
|
|
30770
30820
|
report(limitKey, info);
|
|
30771
30821
|
}, [limitKey, info, report]);
|
|
30772
30822
|
return null;
|
|
30773
30823
|
}
|
|
30774
30824
|
function SoftLimitProbes({ keys }) {
|
|
30775
|
-
const monitored =
|
|
30825
|
+
const monitored = React120.useMemo(() => Array.from(new Set(keys)), [keys]);
|
|
30776
30826
|
return /* @__PURE__ */ jsx(Fragment, { children: monitored.map((k) => /* @__PURE__ */ jsx(LimitProbe, { limitKey: k }, k)) });
|
|
30777
30827
|
}
|
|
30778
|
-
var CommandPalette =
|
|
30828
|
+
var CommandPalette = React120.lazy(
|
|
30779
30829
|
() => import('./CommandPalette-B5PMQFDG.js').then((m) => ({ default: m.CommandPalette }))
|
|
30780
30830
|
);
|
|
30781
|
-
var SubscriptionPage =
|
|
30831
|
+
var SubscriptionPage = React120.lazy(
|
|
30782
30832
|
() => import('./SubscriptionPage-TVAEOFNC.js').then((m) => ({ default: m.SubscriptionPage }))
|
|
30783
30833
|
);
|
|
30784
30834
|
function WorkspaceSwitcher({
|
|
@@ -30828,8 +30878,8 @@ function WorkspaceSwitcher({
|
|
|
30828
30878
|
const v = t(key);
|
|
30829
30879
|
return !v || v === key ? fallback : v;
|
|
30830
30880
|
};
|
|
30831
|
-
const [query, setQuery] =
|
|
30832
|
-
const search =
|
|
30881
|
+
const [query, setQuery] = React120.useState("");
|
|
30882
|
+
const search = React120.useMemo(
|
|
30833
30883
|
() => searchWorkspaces(
|
|
30834
30884
|
options,
|
|
30835
30885
|
query,
|
|
@@ -31143,9 +31193,9 @@ function PluginHeaderControls() {
|
|
|
31143
31193
|
}
|
|
31144
31194
|
function AdminNotifications() {
|
|
31145
31195
|
const { notifications, unreadCount, fetchNotifications, markAsRead, markAllAsRead } = useNotifications();
|
|
31146
|
-
const [open, setOpen] =
|
|
31147
|
-
const fetchedRef =
|
|
31148
|
-
|
|
31196
|
+
const [open, setOpen] = React120.useState(false);
|
|
31197
|
+
const fetchedRef = React120.useRef(false);
|
|
31198
|
+
React120.useEffect(() => {
|
|
31149
31199
|
if (fetchedRef.current) return;
|
|
31150
31200
|
fetchedRef.current = true;
|
|
31151
31201
|
void fetchNotifications();
|
|
@@ -31291,7 +31341,7 @@ function buildSettingsTabs(pluginTabs, can, hasSystem, t, showOrgSettings, hasBi
|
|
|
31291
31341
|
// sidebar ICON_MAP, which made the settings rail fall back to Home.
|
|
31292
31342
|
icon: /* @__PURE__ */ jsx(CreditCard, { className: "h-4 w-4" }),
|
|
31293
31343
|
iconName: "CreditCard",
|
|
31294
|
-
component: /* @__PURE__ */ jsx(
|
|
31344
|
+
component: /* @__PURE__ */ jsx(React120.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(SubscriptionPage, {}) })
|
|
31295
31345
|
});
|
|
31296
31346
|
}
|
|
31297
31347
|
if (showOrgSettings) {
|
|
@@ -31319,9 +31369,9 @@ function buildSettingsTabs(pluginTabs, can, hasSystem, t, showOrgSettings, hasBi
|
|
|
31319
31369
|
settingsTabs.push({
|
|
31320
31370
|
id: tab.id,
|
|
31321
31371
|
label: translated === labelKey ? tab.label : translated,
|
|
31322
|
-
icon:
|
|
31372
|
+
icon: React120.createElement(IconComp, { className: "h-4 w-4" }),
|
|
31323
31373
|
iconName,
|
|
31324
|
-
component:
|
|
31374
|
+
component: React120.createElement(tab.component),
|
|
31325
31375
|
// Flag plugin-contributed tabs so SettingsPage draws the core/plugins divider.
|
|
31326
31376
|
isPlugin: true,
|
|
31327
31377
|
group: tab.group
|
|
@@ -31369,12 +31419,12 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31369
31419
|
profileKnown: !activeTenantId || profileKnownFor === activeTenantId
|
|
31370
31420
|
});
|
|
31371
31421
|
const navError = configError ?? tenantCtx?.loadError ?? null;
|
|
31372
|
-
const onNavRetry =
|
|
31422
|
+
const onNavRetry = React120.useCallback(() => {
|
|
31373
31423
|
if (tenantCtx?.loadError) tenantCtx.retryOrgs();
|
|
31374
31424
|
else window.location.reload();
|
|
31375
31425
|
}, [tenantCtx]);
|
|
31376
31426
|
const currentProfile = usePermissionsStore((s) => s.currentProfile);
|
|
31377
|
-
const hasSystem =
|
|
31427
|
+
const hasSystem = React120.useCallback(
|
|
31378
31428
|
(perm) => {
|
|
31379
31429
|
if (!currentProfile) return false;
|
|
31380
31430
|
if (currentProfile.id === "owner" || currentProfile.name?.toLowerCase() === "owner") return true;
|
|
@@ -31388,8 +31438,8 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31388
31438
|
};
|
|
31389
31439
|
const path = useAdminPath();
|
|
31390
31440
|
const { user, signOut } = useAuth();
|
|
31391
|
-
|
|
31392
|
-
|
|
31441
|
+
React120.useEffect(() => installGlobalErrorHandlers(), []);
|
|
31442
|
+
React120.useEffect(() => registerErrorReporter((report) => {
|
|
31393
31443
|
if (report.source !== "data") return;
|
|
31394
31444
|
const alvo = report.extra?.operation;
|
|
31395
31445
|
toast.error(
|
|
@@ -31407,15 +31457,15 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31407
31457
|
const hasChatPanel = useRightRailStore((s) => s.panels.some((pn) => pn.id === "chat"));
|
|
31408
31458
|
const rightRail = railHasPanels ? /* @__PURE__ */ jsx(RightRail, { frame: contentFrame, attached: layout !== "topbar" }) : null;
|
|
31409
31459
|
const setRailMounted = useRightRailStore((s) => s.setMounted);
|
|
31410
|
-
|
|
31460
|
+
React120.useEffect(() => {
|
|
31411
31461
|
setRailMounted(true);
|
|
31412
31462
|
return () => setRailMounted(false);
|
|
31413
31463
|
}, [setRailMounted]);
|
|
31414
31464
|
useConnectorOAuthReturn();
|
|
31415
31465
|
const railWidthLive = useRightRailStore((s) => s.width);
|
|
31416
31466
|
const setSidebarCollapsed = useLayoutStore((s) => s.setSidebarCollapsed);
|
|
31417
|
-
const railAutoCollapsedRef =
|
|
31418
|
-
|
|
31467
|
+
const railAutoCollapsedRef = React120.useRef(false);
|
|
31468
|
+
React120.useEffect(() => {
|
|
31419
31469
|
if (layout !== "sidebar") return;
|
|
31420
31470
|
const SIDEBAR_EXPANDED = 224;
|
|
31421
31471
|
const MIN_CONTENT = 620;
|
|
@@ -31437,22 +31487,22 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31437
31487
|
window.addEventListener("resize", apply);
|
|
31438
31488
|
return () => window.removeEventListener("resize", apply);
|
|
31439
31489
|
}, [railOpen, railWidthLive, layout, setSidebarCollapsed]);
|
|
31440
|
-
const [railWidth] =
|
|
31490
|
+
const [railWidth] = React120.useState(() => readRightRailWidth());
|
|
31441
31491
|
const billingPlans = useBillingStore((s) => s.plans);
|
|
31442
31492
|
const hasBilling = billingPlans.length > 0;
|
|
31443
31493
|
const orgPlan = useTenantOptional()?.org?.plan;
|
|
31444
|
-
const planBadge =
|
|
31494
|
+
const planBadge = React120.useMemo(
|
|
31445
31495
|
() => hasBilling ? resolvePlanBadge(orgPlan, billingPlans) : null,
|
|
31446
31496
|
[hasBilling, orgPlan, billingPlans]
|
|
31447
31497
|
);
|
|
31448
|
-
const softLimitKeys =
|
|
31498
|
+
const softLimitKeys = React120.useMemo(() => {
|
|
31449
31499
|
const plan = billingPlans.find((p) => p.id === (orgPlan || "free"));
|
|
31450
31500
|
return Object.keys(getPlanEntitlements(plan)?.limits ?? {});
|
|
31451
31501
|
}, [billingPlans, orgPlan]);
|
|
31452
31502
|
const overshoots = useOvershoots();
|
|
31453
31503
|
const navContributions = useNavContributionsStore((s) => s.contributions);
|
|
31454
31504
|
const appConfigNav = useAppConfigStore((state) => state.config.nav);
|
|
31455
|
-
const navigation =
|
|
31505
|
+
const navigation = React120.useMemo(() => {
|
|
31456
31506
|
const contributed = Object.values(navContributions).flat();
|
|
31457
31507
|
const flat = dedupeByRoute(
|
|
31458
31508
|
[...runtime.navigation, ...contributed].map((entry) => ({
|
|
@@ -31523,7 +31573,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31523
31573
|
}).filter((item) => item !== null).sort(compareNavigation);
|
|
31524
31574
|
return applyRailPreset(gated, presetRail, presetHide, presetWhole);
|
|
31525
31575
|
}, [runtime.navigation, runtime.routes, navContributions, pages, access, navWaiting, presetRail, presetHide, presetWhole, presetLabels]);
|
|
31526
|
-
const composedNavigation =
|
|
31576
|
+
const composedNavigation = React120.useMemo(() => {
|
|
31527
31577
|
if (!appConfigNav.length) return navigation;
|
|
31528
31578
|
const keyed = navigation.map((item) => ({ ...item, key: item.route }));
|
|
31529
31579
|
return applyNavComposition(keyed, appConfigNav).map((item) => {
|
|
@@ -31539,13 +31589,13 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31539
31589
|
};
|
|
31540
31590
|
});
|
|
31541
31591
|
}, [navigation, appConfigNav]);
|
|
31542
|
-
const resolvedBottomNav =
|
|
31592
|
+
const resolvedBottomNav = React120.useMemo(
|
|
31543
31593
|
() => deriveBottomNav(navigation, bottomNav, { assistant: hasChatPanel }),
|
|
31544
31594
|
[navigation, bottomNav, hasChatPanel]
|
|
31545
31595
|
);
|
|
31546
31596
|
const commandPaletteOpen = useLayoutStore((s) => s.commandPaletteOpen);
|
|
31547
31597
|
const setCommandPaletteOpen = useLayoutStore((s) => s.setCommandPaletteOpen);
|
|
31548
|
-
const commandItems =
|
|
31598
|
+
const commandItems = React120.useMemo(() => {
|
|
31549
31599
|
const navGroup = tr("layout.commandPalette.navigation", "Navigation");
|
|
31550
31600
|
const items = [];
|
|
31551
31601
|
for (const nav of navigation) {
|
|
@@ -31557,7 +31607,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31557
31607
|
return items;
|
|
31558
31608
|
}, [navigation]);
|
|
31559
31609
|
const globalSearch = useGlobalSearch();
|
|
31560
|
-
const routes =
|
|
31610
|
+
const routes = React120.useMemo(() => {
|
|
31561
31611
|
const list = [];
|
|
31562
31612
|
const entityRouteMap = /* @__PURE__ */ new Map();
|
|
31563
31613
|
for (const r of runtime.routes) {
|
|
@@ -31580,14 +31630,14 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31580
31630
|
setEntityRouteMap(entityRouteMap);
|
|
31581
31631
|
return list.sort((a, b) => routeScore(b.path) - routeScore(a.path));
|
|
31582
31632
|
}, [runtime.routes, pages, showSettings]);
|
|
31583
|
-
const match =
|
|
31633
|
+
const match = React120.useMemo(() => {
|
|
31584
31634
|
for (const r of routes) {
|
|
31585
31635
|
const params = matchRoute(r.path, path);
|
|
31586
31636
|
if (params) return { route: r, params };
|
|
31587
31637
|
}
|
|
31588
31638
|
return null;
|
|
31589
31639
|
}, [routes, path]);
|
|
31590
|
-
|
|
31640
|
+
React120.useEffect(() => {
|
|
31591
31641
|
if (!match && (path === "/" || path === "") && navigation.length > 0) {
|
|
31592
31642
|
navigateTo(navigation[0].route);
|
|
31593
31643
|
}
|
|
@@ -31595,11 +31645,11 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31595
31645
|
const ActiveComponent = match?.route.Component;
|
|
31596
31646
|
const activeParams = match?.params ?? {};
|
|
31597
31647
|
const routeKey = (match?.route.path ?? path).replace(/\/\*$/, "");
|
|
31598
|
-
const settingsTabs =
|
|
31648
|
+
const settingsTabs = React120.useMemo(
|
|
31599
31649
|
() => buildSettingsTabs(runtime.settingsTabs, can, hasSystem, t, showOrgSettings, hasBilling),
|
|
31600
31650
|
[runtime.settingsTabs, can, hasSystem, t, showOrgSettings, hasBilling]
|
|
31601
31651
|
);
|
|
31602
|
-
const profileRoute =
|
|
31652
|
+
const profileRoute = React120.useMemo(() => {
|
|
31603
31653
|
const explicit = routes.find((r) => r.path === "/perfil" || r.path === "/profile");
|
|
31604
31654
|
if (explicit) return explicit.path;
|
|
31605
31655
|
return showSettings ? "/settings/profile" : null;
|
|
@@ -31607,7 +31657,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31607
31657
|
const onProfile = profileRoute ? () => navigateTo(profileRoute) : void 0;
|
|
31608
31658
|
const onBilling = hasBilling && showSettings ? () => navigateTo("/settings/subscription") : void 0;
|
|
31609
31659
|
const coreSettingsTabs = useCoreSettingsTabs({ showCompany: showBranding, showBranding });
|
|
31610
|
-
const allSettingsTabs =
|
|
31660
|
+
const allSettingsTabs = React120.useMemo(
|
|
31611
31661
|
() => {
|
|
31612
31662
|
const hidden = new Set(hiddenSettingsTabs ?? []);
|
|
31613
31663
|
const visible = [...coreSettingsTabs, ...settingsTabs].filter((tab) => !hidden.has(tab.id));
|
|
@@ -31623,12 +31673,12 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31623
31673
|
const moduleRail = !inSettings && layout === "sidebar" && contextualNav && (path === contextualNav.base || path.startsWith(contextualNav.base + "/")) ? contextualNav : null;
|
|
31624
31674
|
const settingsPathActive = showSettings && (path === "/settings" || path.startsWith("/settings/"));
|
|
31625
31675
|
const activeSettingsTab = settingsPathActive ? path === "/settings" ? null : path.slice("/settings/".length).split("/")[0] : void 0;
|
|
31626
|
-
const settingsTabDef =
|
|
31676
|
+
const settingsTabDef = React120.useMemo(() => {
|
|
31627
31677
|
if (!showSettings || !path.startsWith("/settings/")) return void 0;
|
|
31628
31678
|
const id = path.slice("/settings/".length).split("/")[0];
|
|
31629
31679
|
return allSettingsTabs.find((tab) => tab.id === id);
|
|
31630
31680
|
}, [showSettings, path, allSettingsTabs]);
|
|
31631
|
-
const settingsNavigation =
|
|
31681
|
+
const settingsNavigation = React120.useMemo(
|
|
31632
31682
|
() => allSettingsTabs.map((tab) => ({
|
|
31633
31683
|
id: `settings:${tab.id}`,
|
|
31634
31684
|
label: tab.label,
|
|
@@ -31646,10 +31696,10 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31646
31696
|
const shellUser = user ? { fullName: user.fullName ?? user.email, email: user.email, avatarUrl: user.avatarUrl } : void 0;
|
|
31647
31697
|
const moduleVariant = moduleNav ?? (layout === "sidebar" ? "tabs" : "rail");
|
|
31648
31698
|
const setRailAvailable = useContextualNavStore((s) => s.setRailAvailable);
|
|
31649
|
-
|
|
31699
|
+
React120.useEffect(() => {
|
|
31650
31700
|
setRailAvailable(layout === "sidebar" && moduleVariant !== "rail");
|
|
31651
31701
|
}, [layout, moduleVariant, setRailAvailable]);
|
|
31652
|
-
const activePageTitle =
|
|
31702
|
+
const activePageTitle = React120.useMemo(() => {
|
|
31653
31703
|
if (settingsTabDef) return settingsTabDef.label;
|
|
31654
31704
|
if (path === "/settings" || path.startsWith("/settings/")) return tr("common.settings", "Settings");
|
|
31655
31705
|
if (match?.route.title) return match.route.title;
|
|
@@ -31663,7 +31713,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31663
31713
|
if (hiddenHit?.label) return hiddenHit.label;
|
|
31664
31714
|
return candidates.find((n) => n.route === "/")?.label ?? "";
|
|
31665
31715
|
}, [navigation, pages, path, tr, match, settingsTabDef]);
|
|
31666
|
-
const parentBack =
|
|
31716
|
+
const parentBack = React120.useMemo(() => {
|
|
31667
31717
|
if (settingsTabDef) {
|
|
31668
31718
|
const first = allSettingsTabs[0]?.id;
|
|
31669
31719
|
return {
|
|
@@ -31701,9 +31751,9 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31701
31751
|
]
|
|
31702
31752
|
}
|
|
31703
31753
|
);
|
|
31704
|
-
const [railQuery, setRailQuery] =
|
|
31754
|
+
const [railQuery, setRailQuery] = React120.useState("");
|
|
31705
31755
|
const railBase = moduleRail?.base ?? null;
|
|
31706
|
-
|
|
31756
|
+
React120.useEffect(() => {
|
|
31707
31757
|
setRailQuery("");
|
|
31708
31758
|
}, [railBase]);
|
|
31709
31759
|
const railSearch = (placeholder) => /* @__PURE__ */ jsxs("div", { className: "relative px-0.5 pt-1", children: [
|
|
@@ -31916,7 +31966,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31916
31966
|
]
|
|
31917
31967
|
}
|
|
31918
31968
|
),
|
|
31919
|
-
/* @__PURE__ */ jsx(
|
|
31969
|
+
/* @__PURE__ */ jsx(React120.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
|
|
31920
31970
|
CommandPalette,
|
|
31921
31971
|
{
|
|
31922
31972
|
commands: commandItems,
|
|
@@ -32183,7 +32233,7 @@ function buildI18nConfig(config) {
|
|
|
32183
32233
|
function BillingInitializer({ config }) {
|
|
32184
32234
|
const setPlans = useBillingStore((s) => s.setPlans);
|
|
32185
32235
|
const setCheckout = useBillingStore((s) => s.setCheckout);
|
|
32186
|
-
|
|
32236
|
+
React120.useEffect(() => {
|
|
32187
32237
|
if (config.billing?.plans) setPlans(config.billing.plans.map(normalizeBillingPlan));
|
|
32188
32238
|
setCheckout(config.billing?.onCheckout ?? null);
|
|
32189
32239
|
}, [config.billing, setPlans, setCheckout]);
|
|
@@ -32300,9 +32350,9 @@ function ThemeInitializer({ config }) {
|
|
|
32300
32350
|
const setOverrides = useThemeStore((s) => s.setOverrides);
|
|
32301
32351
|
const setMode = useThemeStore((s) => s.setMode);
|
|
32302
32352
|
const rawBranding = useOrganizationStore((s) => s.currentOrg?.settings?.branding);
|
|
32303
|
-
const brandTokens =
|
|
32353
|
+
const brandTokens = React120.useMemo(() => normalizeBrand(rawBranding).tokens, [rawBranding]);
|
|
32304
32354
|
const brandKey = JSON.stringify(brandTokens);
|
|
32305
|
-
|
|
32355
|
+
React120.useEffect(() => {
|
|
32306
32356
|
const tokens = JSON.parse(brandKey);
|
|
32307
32357
|
const brand = tokens.color?.primary ? hexToHslTriplet(tokens.color.primary) : null;
|
|
32308
32358
|
if (config.theme) {
|
|
@@ -32319,20 +32369,20 @@ function ThemeInitializer({ config }) {
|
|
|
32319
32369
|
return null;
|
|
32320
32370
|
}
|
|
32321
32371
|
function PersistentCacheInitializer() {
|
|
32322
|
-
|
|
32372
|
+
React120.useEffect(() => {
|
|
32323
32373
|
attachPersistentCache();
|
|
32324
32374
|
void getPersistentCache()?.hydrate();
|
|
32325
32375
|
}, []);
|
|
32326
32376
|
return null;
|
|
32327
32377
|
}
|
|
32328
32378
|
function FayzEventBridgeInitializer({ config }) {
|
|
32329
|
-
|
|
32379
|
+
React120.useEffect(() => startFayzEventBridge(config.chat?.agent), [config.chat?.agent]);
|
|
32330
32380
|
return null;
|
|
32331
32381
|
}
|
|
32332
32382
|
function TeamInitializer({ config }) {
|
|
32333
32383
|
const setTeamPersonKinds = useOrganizationStore((s) => s.setTeamPersonKinds);
|
|
32334
32384
|
const kinds = config.team?.personKinds;
|
|
32335
|
-
|
|
32385
|
+
React120.useEffect(() => {
|
|
32336
32386
|
setTeamPersonKinds(kinds ?? []);
|
|
32337
32387
|
}, [setTeamPersonKinds, kinds]);
|
|
32338
32388
|
return null;
|
|
@@ -32348,7 +32398,7 @@ function ChatRailPanel({ config }) {
|
|
|
32348
32398
|
const agent = config.chat?.agent;
|
|
32349
32399
|
const voice = config.chat?.voice;
|
|
32350
32400
|
const whatsapp = config.chat?.whatsapp;
|
|
32351
|
-
const Component2 =
|
|
32401
|
+
const Component2 = React120.useMemo(() => {
|
|
32352
32402
|
const Panel = () => /* @__PURE__ */ jsx(
|
|
32353
32403
|
ChatConversation,
|
|
32354
32404
|
{
|
|
@@ -32365,8 +32415,8 @@ function ChatRailPanel({ config }) {
|
|
|
32365
32415
|
const conversations = useChatStore((s) => s.conversations);
|
|
32366
32416
|
const setConversations = useChatStore((s) => s.setConversations);
|
|
32367
32417
|
const user = useAuthStore((s) => s.user);
|
|
32368
|
-
const connection =
|
|
32369
|
-
|
|
32418
|
+
const connection = React120.useMemo(() => resolveFayzAgentConnection(agent), [agent]);
|
|
32419
|
+
React120.useEffect(() => {
|
|
32370
32420
|
if (!connection) return;
|
|
32371
32421
|
getFayzAgentClient(connection).listConversations(user?.id).then(setConversations).catch(() => {
|
|
32372
32422
|
});
|
|
@@ -32375,7 +32425,7 @@ function ChatRailPanel({ config }) {
|
|
|
32375
32425
|
useAssistantInviteStore((s) => s.invite?.id === ASK_AI_HANDOFF_ID);
|
|
32376
32426
|
const activeAgent = useAgent();
|
|
32377
32427
|
const persona = activeAgent?.name ?? invitePersona;
|
|
32378
|
-
const icon =
|
|
32428
|
+
const icon = React120.useMemo(
|
|
32379
32429
|
() => activeAgent ? function AgentTabIcon() {
|
|
32380
32430
|
return /* @__PURE__ */ jsx(
|
|
32381
32431
|
AgentAvatar,
|
|
@@ -32390,7 +32440,7 @@ function ChatRailPanel({ config }) {
|
|
|
32390
32440
|
[activeAgent]
|
|
32391
32441
|
);
|
|
32392
32442
|
useRightRailPanel(
|
|
32393
|
-
|
|
32443
|
+
React120.useMemo(
|
|
32394
32444
|
() => ({
|
|
32395
32445
|
id: "chat",
|
|
32396
32446
|
label: persona ?? "Chat",
|
|
@@ -32404,17 +32454,17 @@ function ChatRailPanel({ config }) {
|
|
|
32404
32454
|
[Component2, conversations.length, persona, icon, activeAgent]
|
|
32405
32455
|
)
|
|
32406
32456
|
);
|
|
32407
|
-
|
|
32457
|
+
React120.useEffect(() => {
|
|
32408
32458
|
if (chatOpen) openPanel("chat");
|
|
32409
32459
|
}, [chatOpen, openPanel]);
|
|
32410
|
-
|
|
32460
|
+
React120.useEffect(() => {
|
|
32411
32461
|
if (!(railOpen && railActive === "chat")) setChatOpen(false);
|
|
32412
32462
|
}, [railOpen, railActive, setChatOpen]);
|
|
32413
32463
|
return null;
|
|
32414
32464
|
}
|
|
32415
32465
|
function AdminProviders({ config, children }) {
|
|
32416
32466
|
const currentOrg = useOrganizationStore((s) => s.currentOrg);
|
|
32417
|
-
const hasFayzAgent =
|
|
32467
|
+
const hasFayzAgent = React120.useMemo(
|
|
32418
32468
|
() => !!resolveFayzAgentConnection(config.chat?.agent),
|
|
32419
32469
|
[config.chat?.agent]
|
|
32420
32470
|
);
|
|
@@ -32423,7 +32473,7 @@ function AdminProviders({ config, children }) {
|
|
|
32423
32473
|
const surface = config.chat?.surface ?? "dock";
|
|
32424
32474
|
const onConsentScreen = typeof window !== "undefined" && window.location.pathname.replace(/\/+$/, "").endsWith("/connect");
|
|
32425
32475
|
const showFab = assistantEnabled && surface === "dock" && !onConsentScreen;
|
|
32426
|
-
const resolved =
|
|
32476
|
+
const resolved = React120.useMemo(() => {
|
|
32427
32477
|
if (config.supabaseUrl && config.supabaseAnonKey) {
|
|
32428
32478
|
createFayzSupabaseClient(config.supabaseUrl, config.supabaseAnonKey);
|
|
32429
32479
|
}
|
|
@@ -32441,7 +32491,7 @@ function AdminProviders({ config, children }) {
|
|
|
32441
32491
|
const { bindings, ready: configReady } = useAppConfig();
|
|
32442
32492
|
const offeredPlugins = useOfferedPlugins();
|
|
32443
32493
|
const path = useAdminPath();
|
|
32444
|
-
const runtime =
|
|
32494
|
+
const runtime = React120.useMemo(
|
|
32445
32495
|
() => resolvePluginRuntime({
|
|
32446
32496
|
plugins: resolved.plugins,
|
|
32447
32497
|
// Só as ligações DESTA conta. Na janela da troca o config em mãos ainda
|
|
@@ -32481,7 +32531,7 @@ function AdminProviders({ config, children }) {
|
|
|
32481
32531
|
}),
|
|
32482
32532
|
[resolved.plugins, bindings, offeredPlugins, configReady, path, config.layout, currentOrg]
|
|
32483
32533
|
);
|
|
32484
|
-
|
|
32534
|
+
React120.useEffect(() => {
|
|
32485
32535
|
if (!import.meta.env?.DEV || !currentOrg) return;
|
|
32486
32536
|
const registered = new Set(resolved.plugins.map((p) => p.id));
|
|
32487
32537
|
const bound = new Set(bindings.map((b) => b.pluginId));
|
|
@@ -32506,6 +32556,7 @@ function AdminProviders({ config, children }) {
|
|
|
32506
32556
|
/* @__PURE__ */ jsx(BillingInitializer, { config }),
|
|
32507
32557
|
/* @__PURE__ */ jsx(FayzEventBridgeInitializer, { config }),
|
|
32508
32558
|
/* @__PURE__ */ jsx(ToastProvider, {}),
|
|
32559
|
+
/* @__PURE__ */ jsx(UpdateReady, {}),
|
|
32509
32560
|
assistantEnabled && surface === "dock" && /* @__PURE__ */ jsx(ChatRailPanel, { config }),
|
|
32510
32561
|
/* @__PURE__ */ jsx(TasksRailPanel, {}),
|
|
32511
32562
|
/* @__PURE__ */ jsx(ActivationProvider, {}),
|
|
@@ -32832,8 +32883,8 @@ function manifestToFayzConfig(manifest, surfaceName) {
|
|
|
32832
32883
|
};
|
|
32833
32884
|
}
|
|
32834
32885
|
function AdminScaffold({ manifest, surface }) {
|
|
32835
|
-
const config =
|
|
32836
|
-
const authShellProps =
|
|
32886
|
+
const config = React120.useMemo(() => manifestToFayzConfig(manifest, surface), [manifest, surface]);
|
|
32887
|
+
const authShellProps = React120.useMemo(() => getAuthShellProps(config.auth), [config.auth]);
|
|
32837
32888
|
return /* @__PURE__ */ jsx(AdminProviders, { config, children: /* @__PURE__ */ jsx(ScaffoldShell, { config, authShellProps }) });
|
|
32838
32889
|
}
|
|
32839
32890
|
function ScaffoldShell({
|
|
@@ -33274,12 +33325,12 @@ function CrudRecordModal({
|
|
|
33274
33325
|
essentialFirst,
|
|
33275
33326
|
notice
|
|
33276
33327
|
}) {
|
|
33277
|
-
const [record, setRecord] =
|
|
33278
|
-
const [loading, setLoading] =
|
|
33279
|
-
const [saving, setSaving] =
|
|
33280
|
-
const [error, setError] =
|
|
33281
|
-
const formId =
|
|
33282
|
-
|
|
33328
|
+
const [record, setRecord] = React120.useState(null);
|
|
33329
|
+
const [loading, setLoading] = React120.useState(false);
|
|
33330
|
+
const [saving, setSaving] = React120.useState(false);
|
|
33331
|
+
const [error, setError] = React120.useState(null);
|
|
33332
|
+
const formId = React120.useId();
|
|
33333
|
+
React120.useEffect(() => {
|
|
33283
33334
|
if (!open) return;
|
|
33284
33335
|
setError(null);
|
|
33285
33336
|
if (mode === "create" || !load) {
|
|
@@ -33355,9 +33406,9 @@ function LookupCreateInline({
|
|
|
33355
33406
|
className
|
|
33356
33407
|
}) {
|
|
33357
33408
|
const t = useTranslation();
|
|
33358
|
-
const [saving, setSaving] =
|
|
33359
|
-
const [error, setError] =
|
|
33360
|
-
const submitForm =
|
|
33409
|
+
const [saving, setSaving] = React120.useState(false);
|
|
33410
|
+
const [error, setError] = React120.useState(null);
|
|
33411
|
+
const submitForm = React120.useRef(null);
|
|
33361
33412
|
async function submit(data) {
|
|
33362
33413
|
setSaving(true);
|
|
33363
33414
|
setError(null);
|
|
@@ -33434,17 +33485,17 @@ function LookupCreateInline({
|
|
|
33434
33485
|
);
|
|
33435
33486
|
}
|
|
33436
33487
|
function useLookupCreate(lookup, onCreated, options = {}) {
|
|
33437
|
-
const [draftName, setDraftName] =
|
|
33488
|
+
const [draftName, setDraftName] = React120.useState(null);
|
|
33438
33489
|
const can = usePermissionOptional();
|
|
33439
33490
|
const entityDef = lookup?.entityDef;
|
|
33440
33491
|
const feature = entityDef?.permission?.feature;
|
|
33441
33492
|
const allowed = !feature || can(feature, "create");
|
|
33442
33493
|
const canCreate = !!lookup?.create && allowed;
|
|
33443
|
-
const createByName =
|
|
33494
|
+
const createByName = React120.useCallback(async (name) => {
|
|
33444
33495
|
if (!lookup?.create) return;
|
|
33445
33496
|
onCreated(await lookup.create({ name }));
|
|
33446
33497
|
}, [lookup, onCreated]);
|
|
33447
|
-
const onCreate =
|
|
33498
|
+
const onCreate = React120.useMemo(() => {
|
|
33448
33499
|
if (!canCreate) return void 0;
|
|
33449
33500
|
if (!entityDef) return (name) => {
|
|
33450
33501
|
void createByName(name);
|
|
@@ -33532,8 +33583,8 @@ function OrderFormItemRow({
|
|
|
33532
33583
|
const rawKindLabel = itemTypes.find((tp) => tp.value === itemKind)?.label ?? itemKind;
|
|
33533
33584
|
const kindLabel = !itemKind || itemKind === "other" ? null : rawKindLabel;
|
|
33534
33585
|
const hasAdjustments = (discount ?? 0) > 0 || (surcharge ?? 0) > 0;
|
|
33535
|
-
const [showAdjustments, setShowAdjustments] =
|
|
33536
|
-
const [openExtras, setOpenExtras] =
|
|
33586
|
+
const [showAdjustments, setShowAdjustments] = React120.useState(hasAdjustments);
|
|
33587
|
+
const [openExtras, setOpenExtras] = React120.useState(
|
|
33537
33588
|
() => (extraFieldGroups ?? []).filter((g) => g.filled).map((g) => g.id)
|
|
33538
33589
|
);
|
|
33539
33590
|
const lookup = entityLookups[itemKind];
|
|
@@ -34177,7 +34228,7 @@ function OrderCreateScreen({
|
|
|
34177
34228
|
errorActions,
|
|
34178
34229
|
saveBar
|
|
34179
34230
|
}) {
|
|
34180
|
-
const subtotal =
|
|
34231
|
+
const subtotal = React120.useMemo(
|
|
34181
34232
|
() => lines.reduce((sum, line) => sum + line.unitPrice * line.quantity, 0),
|
|
34182
34233
|
[lines]
|
|
34183
34234
|
);
|
|
@@ -34328,7 +34379,7 @@ function mergeLines(current2, incoming) {
|
|
|
34328
34379
|
return merged;
|
|
34329
34380
|
}
|
|
34330
34381
|
function ItemPicker({ search, onPick }) {
|
|
34331
|
-
const [open, setOpen] =
|
|
34382
|
+
const [open, setOpen] = React120.useState(false);
|
|
34332
34383
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34333
34384
|
/* @__PURE__ */ jsxs(
|
|
34334
34385
|
"button",
|
|
@@ -34406,9 +34457,9 @@ function KanbanBoard({
|
|
|
34406
34457
|
toolbarActions
|
|
34407
34458
|
}) {
|
|
34408
34459
|
const collapsible = !!onToggleColumn;
|
|
34409
|
-
const frameRef =
|
|
34410
|
-
const [hoveredCol, setHoveredCol] =
|
|
34411
|
-
const centerFocused =
|
|
34460
|
+
const frameRef = React120.useRef(null);
|
|
34461
|
+
const [hoveredCol, setHoveredCol] = React120.useState(null);
|
|
34462
|
+
const centerFocused = React120.useCallback((event) => {
|
|
34412
34463
|
const frame = frameRef.current;
|
|
34413
34464
|
const column = event.target?.closest("[data-kanban-column]");
|
|
34414
34465
|
if (!frame || !column || frame.scrollWidth <= frame.clientWidth) return;
|
|
@@ -34520,10 +34571,10 @@ function BoardFrame({
|
|
|
34520
34571
|
toolbarActions,
|
|
34521
34572
|
className = ""
|
|
34522
34573
|
}) {
|
|
34523
|
-
const [open, setOpen] =
|
|
34524
|
-
const inputRef =
|
|
34574
|
+
const [open, setOpen] = React120.useState(false);
|
|
34575
|
+
const inputRef = React120.useRef(null);
|
|
34525
34576
|
const expanded = open || !!search;
|
|
34526
|
-
|
|
34577
|
+
React120.useEffect(() => {
|
|
34527
34578
|
if (open) inputRef.current?.focus();
|
|
34528
34579
|
}, [open]);
|
|
34529
34580
|
function collapse() {
|
|
@@ -34602,14 +34653,14 @@ function OrderBoardView({
|
|
|
34602
34653
|
rowId,
|
|
34603
34654
|
selectedRowId
|
|
34604
34655
|
}) {
|
|
34605
|
-
const getId =
|
|
34656
|
+
const getId = React120.useCallback(
|
|
34606
34657
|
(row) => rowId ? rowId(row) : String(row.id ?? ""),
|
|
34607
34658
|
[rowId]
|
|
34608
34659
|
);
|
|
34609
|
-
const [lastClicked, setLastClicked] =
|
|
34610
|
-
const [advancing, setAdvancing] =
|
|
34660
|
+
const [lastClicked, setLastClicked] = React120.useState(null);
|
|
34661
|
+
const [advancing, setAdvancing] = React120.useState({});
|
|
34611
34662
|
const selected = selectedRowId !== void 0 ? selectedRowId : lastClicked;
|
|
34612
|
-
const grouped =
|
|
34663
|
+
const grouped = React120.useMemo(() => {
|
|
34613
34664
|
const map = /* @__PURE__ */ new Map();
|
|
34614
34665
|
for (const col of board.columns) map.set(col.id, []);
|
|
34615
34666
|
for (const row of rows) {
|
|
@@ -34733,24 +34784,24 @@ function OrderListView({
|
|
|
34733
34784
|
boards,
|
|
34734
34785
|
viewKey
|
|
34735
34786
|
}) {
|
|
34736
|
-
const [search, setSearch] =
|
|
34737
|
-
const [page, setPage] =
|
|
34738
|
-
const [rawSelection, setRawSelection] =
|
|
34739
|
-
const offered =
|
|
34787
|
+
const [search, setSearch] = React120.useState("");
|
|
34788
|
+
const [page, setPage] = React120.useState(1);
|
|
34789
|
+
const [rawSelection, setRawSelection] = React120.useState([]);
|
|
34790
|
+
const offered = React120.useMemo(
|
|
34740
34791
|
() => views && views.length > 0 ? views : ["list"],
|
|
34741
34792
|
[views]
|
|
34742
34793
|
);
|
|
34743
|
-
const customFor =
|
|
34794
|
+
const customFor = React120.useCallback(
|
|
34744
34795
|
(id) => boards?.[id]?.render ?? null,
|
|
34745
34796
|
[boards]
|
|
34746
34797
|
);
|
|
34747
|
-
const boardFor =
|
|
34798
|
+
const boardFor = React120.useCallback(
|
|
34748
34799
|
(id) => (id === "board" ? board : boards?.[id]?.config) ?? null,
|
|
34749
34800
|
[board, boards]
|
|
34750
34801
|
);
|
|
34751
34802
|
const canBoard = offered.length > 1 && offered.some((id) => id !== "list" && (!!boardFor(id) || !!customFor(id)));
|
|
34752
34803
|
const storageKey2 = viewKey ? `fayz.orderView.${viewKey}` : null;
|
|
34753
|
-
const [view, setView] =
|
|
34804
|
+
const [view, setView] = React120.useState(() => {
|
|
34754
34805
|
const fallback = offered.includes(defaultView) ? defaultView : offered[0];
|
|
34755
34806
|
if (!storageKey2) return fallback;
|
|
34756
34807
|
try {
|
|
@@ -34760,7 +34811,7 @@ function OrderListView({
|
|
|
34760
34811
|
return fallback;
|
|
34761
34812
|
}
|
|
34762
34813
|
});
|
|
34763
|
-
const viewTabs =
|
|
34814
|
+
const viewTabs = React120.useMemo(
|
|
34764
34815
|
() => offered.map((option) => ({
|
|
34765
34816
|
value: option,
|
|
34766
34817
|
label: option === "list" ? "Lista" : boards?.[option]?.label ?? "Quadro",
|
|
@@ -34768,7 +34819,7 @@ function OrderListView({
|
|
|
34768
34819
|
})),
|
|
34769
34820
|
[offered, boards]
|
|
34770
34821
|
);
|
|
34771
|
-
const chooseView =
|
|
34822
|
+
const chooseView = React120.useCallback((next) => {
|
|
34772
34823
|
setView(next);
|
|
34773
34824
|
if (!storageKey2) return;
|
|
34774
34825
|
try {
|
|
@@ -34786,7 +34837,7 @@ function OrderListView({
|
|
|
34786
34837
|
const activeBoard = view === "list" ? null : boardFor(view);
|
|
34787
34838
|
const activeCustom = view === "list" ? null : customFor(view);
|
|
34788
34839
|
const showingBoard = !!activeBoard || !!activeCustom;
|
|
34789
|
-
const cols =
|
|
34840
|
+
const cols = React120.useMemo(
|
|
34790
34841
|
() => columns.map((c) => ({
|
|
34791
34842
|
id: c.key,
|
|
34792
34843
|
header: () => /* @__PURE__ */ jsx("div", { className: c.align === "right" ? "text-right" : "", children: c.header }),
|
|
@@ -34794,25 +34845,25 @@ function OrderListView({
|
|
|
34794
34845
|
})),
|
|
34795
34846
|
[columns]
|
|
34796
34847
|
);
|
|
34797
|
-
const filtered =
|
|
34848
|
+
const filtered = React120.useMemo(() => {
|
|
34798
34849
|
const term = search.trim().toLowerCase();
|
|
34799
34850
|
if (!term || !searchText) return rows;
|
|
34800
34851
|
return rows.filter((row) => searchText(row).toLowerCase().includes(term));
|
|
34801
34852
|
}, [rows, search, searchText]);
|
|
34802
|
-
|
|
34853
|
+
React120.useEffect(() => {
|
|
34803
34854
|
setPage(1);
|
|
34804
34855
|
}, [search]);
|
|
34805
34856
|
const paged = pageSize > 0 ? filtered.slice((page - 1) * pageSize, page * pageSize) : filtered;
|
|
34806
|
-
const getId =
|
|
34857
|
+
const getId = React120.useCallback(
|
|
34807
34858
|
(row) => rowId ? rowId(row) : String(row.id ?? ""),
|
|
34808
34859
|
[rowId]
|
|
34809
34860
|
);
|
|
34810
|
-
const pageIds =
|
|
34811
|
-
const selectedIds =
|
|
34861
|
+
const pageIds = React120.useMemo(() => paged.map(getId), [paged, getId]);
|
|
34862
|
+
const selectedIds = React120.useMemo(
|
|
34812
34863
|
() => rawSelection.filter((id) => pageIds.includes(id)),
|
|
34813
34864
|
[rawSelection, pageIds]
|
|
34814
34865
|
);
|
|
34815
|
-
const selectedRows =
|
|
34866
|
+
const selectedRows = React120.useMemo(
|
|
34816
34867
|
() => paged.filter((row) => selectedIds.includes(getId(row))),
|
|
34817
34868
|
[paged, selectedIds, getId]
|
|
34818
34869
|
);
|
|
@@ -34962,13 +35013,13 @@ function PaymentStatusBadge({
|
|
|
34962
35013
|
receiveLabel = "Receber",
|
|
34963
35014
|
onOpenDetails
|
|
34964
35015
|
}) {
|
|
34965
|
-
const [open, setOpen] =
|
|
34966
|
-
const [lines, setLines] =
|
|
34967
|
-
const timer =
|
|
34968
|
-
|
|
35016
|
+
const [open, setOpen] = React120__default.useState(false);
|
|
35017
|
+
const [lines, setLines] = React120__default.useState(null);
|
|
35018
|
+
const timer = React120__default.useRef(null);
|
|
35019
|
+
React120__default.useEffect(() => {
|
|
34969
35020
|
setLines(null);
|
|
34970
35021
|
}, [status, paidAmount]);
|
|
34971
|
-
const load =
|
|
35022
|
+
const load = React120__default.useCallback(() => {
|
|
34972
35023
|
if (lines || !onLoadDetails) return;
|
|
34973
35024
|
void onLoadDetails().then(setLines).catch(() => setLines([]));
|
|
34974
35025
|
}, [lines, onLoadDetails]);
|
|
@@ -35103,13 +35154,13 @@ function invalidateOrdersPaymentStatus(orderId) {
|
|
|
35103
35154
|
else cache2.clear();
|
|
35104
35155
|
}
|
|
35105
35156
|
function useOrdersPaymentStatus(orderIds) {
|
|
35106
|
-
const key =
|
|
35157
|
+
const key = React120.useMemo(
|
|
35107
35158
|
() => Array.from(new Set(orderIds.filter(Boolean))).sort().join(","),
|
|
35108
35159
|
[orderIds]
|
|
35109
35160
|
);
|
|
35110
|
-
const [byOrder, setByOrder] =
|
|
35111
|
-
const [loading, setLoading] =
|
|
35112
|
-
const load =
|
|
35161
|
+
const [byOrder, setByOrder] = React120.useState(() => /* @__PURE__ */ new Map());
|
|
35162
|
+
const [loading, setLoading] = React120.useState(false);
|
|
35163
|
+
const load = React120.useCallback(async (force = false) => {
|
|
35113
35164
|
const ids = key ? key.split(",") : [];
|
|
35114
35165
|
if (ids.length === 0) {
|
|
35115
35166
|
setByOrder(/* @__PURE__ */ new Map());
|
|
@@ -35140,7 +35191,7 @@ function useOrdersPaymentStatus(orderIds) {
|
|
|
35140
35191
|
}
|
|
35141
35192
|
setByOrder(new Map(ids.map((id) => [id, cache2.get(id)]).filter(([, v]) => Boolean(v))));
|
|
35142
35193
|
}, [key]);
|
|
35143
|
-
|
|
35194
|
+
React120.useEffect(() => {
|
|
35144
35195
|
void load();
|
|
35145
35196
|
}, [load]);
|
|
35146
35197
|
return { byOrder, loading, reload: () => load(true) };
|
|
@@ -35207,12 +35258,12 @@ function money(value, currency) {
|
|
|
35207
35258
|
return value.toLocaleString("pt-BR", { style: "currency", currency: currency || "BRL" });
|
|
35208
35259
|
}
|
|
35209
35260
|
function useOrderDetail(orderId) {
|
|
35210
|
-
const [order, setOrder] =
|
|
35211
|
-
const [loading, setLoading] =
|
|
35212
|
-
const [error, setError] =
|
|
35213
|
-
const [nonce, setNonce] =
|
|
35214
|
-
const reload =
|
|
35215
|
-
|
|
35261
|
+
const [order, setOrder] = React120.useState(null);
|
|
35262
|
+
const [loading, setLoading] = React120.useState(false);
|
|
35263
|
+
const [error, setError] = React120.useState(null);
|
|
35264
|
+
const [nonce, setNonce] = React120.useState(0);
|
|
35265
|
+
const reload = React120.useCallback(() => setNonce((n) => n + 1), []);
|
|
35266
|
+
React120.useEffect(() => {
|
|
35216
35267
|
if (!orderId) {
|
|
35217
35268
|
setOrder(null);
|
|
35218
35269
|
setError(null);
|
|
@@ -35329,8 +35380,8 @@ function OrderDetailRail({
|
|
|
35329
35380
|
}) {
|
|
35330
35381
|
const { order, loading, error, reload } = useOrderDetail(orderId);
|
|
35331
35382
|
const { byOrder: paymentByOrder } = useOrdersPaymentStatus([orderId]);
|
|
35332
|
-
const [running, setRunning] =
|
|
35333
|
-
const [pending2, setPending] =
|
|
35383
|
+
const [running, setRunning] = React120.useState(null);
|
|
35384
|
+
const [pending2, setPending] = React120.useState(null);
|
|
35334
35385
|
const perform = async (action) => {
|
|
35335
35386
|
if (!order) return;
|
|
35336
35387
|
setRunning(action.id);
|
|
@@ -35488,11 +35539,11 @@ function receivableTone(value) {
|
|
|
35488
35539
|
return "warning";
|
|
35489
35540
|
}
|
|
35490
35541
|
function useOrderReceivable(orderId) {
|
|
35491
|
-
const [receivable, setReceivable] =
|
|
35542
|
+
const [receivable, setReceivable] = React120.useState(
|
|
35492
35543
|
() => orderId ? cache3.get(orderId) ?? null : null
|
|
35493
35544
|
);
|
|
35494
|
-
const [loading, setLoading] =
|
|
35495
|
-
const reload =
|
|
35545
|
+
const [loading, setLoading] = React120.useState(() => Boolean(orderId) && !cache3.has(orderId));
|
|
35546
|
+
const reload = React120.useCallback(async (force = false) => {
|
|
35496
35547
|
if (!orderId) return;
|
|
35497
35548
|
const db2 = getSupabaseClientOptional();
|
|
35498
35549
|
if (!db2) {
|
|
@@ -35515,7 +35566,7 @@ function useOrderReceivable(orderId) {
|
|
|
35515
35566
|
setReceivable(next);
|
|
35516
35567
|
setLoading(false);
|
|
35517
35568
|
}, [orderId]);
|
|
35518
|
-
|
|
35569
|
+
React120.useEffect(() => {
|
|
35519
35570
|
void reload();
|
|
35520
35571
|
}, [reload]);
|
|
35521
35572
|
return { receivable, loading, reload };
|
|
@@ -35668,15 +35719,15 @@ function linesOf(order) {
|
|
|
35668
35719
|
}
|
|
35669
35720
|
function useOrderEditor(orderId) {
|
|
35670
35721
|
const { order, loading, error } = useOrderDetail(orderId);
|
|
35671
|
-
const [lines, setLines] =
|
|
35672
|
-
const [saving, setSaving] =
|
|
35673
|
-
const originalRef =
|
|
35674
|
-
|
|
35722
|
+
const [lines, setLines] = React120.useState([]);
|
|
35723
|
+
const [saving, setSaving] = React120.useState(false);
|
|
35724
|
+
const originalRef = React120.useRef([]);
|
|
35725
|
+
React120.useEffect(() => {
|
|
35675
35726
|
const seeded = linesOf(order);
|
|
35676
35727
|
originalRef.current = seeded;
|
|
35677
35728
|
setLines(seeded);
|
|
35678
35729
|
}, [order]);
|
|
35679
|
-
const dirty =
|
|
35730
|
+
const dirty = React120.useMemo(() => {
|
|
35680
35731
|
const before = originalRef.current;
|
|
35681
35732
|
if (before.length !== lines.length) return true;
|
|
35682
35733
|
return lines.some((line, i) => {
|
|
@@ -35684,7 +35735,7 @@ function useOrderEditor(orderId) {
|
|
|
35684
35735
|
return !was || was.key !== line.key || was.quantity !== line.quantity || was.unitPrice !== line.unitPrice;
|
|
35685
35736
|
});
|
|
35686
35737
|
}, [lines]);
|
|
35687
|
-
const save =
|
|
35738
|
+
const save = React120.useCallback(async () => {
|
|
35688
35739
|
if (!orderId || !order) return { ok: false, error: "Pedido n\xE3o carregado" };
|
|
35689
35740
|
const db2 = getSupabaseClientOptional();
|
|
35690
35741
|
if (!db2) return { ok: false, error: "Sem conex\xE3o" };
|
|
@@ -36014,11 +36065,11 @@ function PersonTimeline({
|
|
|
36014
36065
|
pageSize,
|
|
36015
36066
|
activeSourceIds
|
|
36016
36067
|
});
|
|
36017
|
-
const toneBySource =
|
|
36068
|
+
const toneBySource = React120__default.useMemo(
|
|
36018
36069
|
() => new Map(sources2.map((s) => [s.id, s.tone ?? "neutral"])),
|
|
36019
36070
|
[sources2]
|
|
36020
36071
|
);
|
|
36021
|
-
const hrefFor =
|
|
36072
|
+
const hrefFor = React120__default.useCallback(
|
|
36022
36073
|
(item) => {
|
|
36023
36074
|
if (item.href) return item.href;
|
|
36024
36075
|
if (!recordPath || !item.targetTab) return void 0;
|
|
@@ -36061,19 +36112,19 @@ function PersonTimeline({
|
|
|
36061
36112
|
}
|
|
36062
36113
|
function createPlaceholder(title, description) {
|
|
36063
36114
|
return function PlaceholderPage() {
|
|
36064
|
-
return
|
|
36115
|
+
return React120__default.createElement(
|
|
36065
36116
|
"div",
|
|
36066
36117
|
{ className: "mx-auto max-w-4xl" },
|
|
36067
|
-
|
|
36068
|
-
description ?
|
|
36069
|
-
|
|
36118
|
+
React120__default.createElement("h1", { className: "text-3xl font-bold text-foreground" }, title),
|
|
36119
|
+
description ? React120__default.createElement("p", { className: "mt-1 text-muted-foreground" }, description) : null,
|
|
36120
|
+
React120__default.createElement(
|
|
36070
36121
|
"div",
|
|
36071
36122
|
{ className: "mt-8 flex items-center justify-center rounded-card border border-dashed border-border bg-card p-16" },
|
|
36072
|
-
|
|
36123
|
+
React120__default.createElement(
|
|
36073
36124
|
"div",
|
|
36074
36125
|
{ className: "text-center" },
|
|
36075
|
-
|
|
36076
|
-
|
|
36126
|
+
React120__default.createElement("p", { className: "text-lg font-medium text-muted-foreground" }, "Coming Soon"),
|
|
36127
|
+
React120__default.createElement(
|
|
36077
36128
|
"p",
|
|
36078
36129
|
{ className: "mt-1 text-sm text-muted-foreground/70" },
|
|
36079
36130
|
"This module is being built as a plugin."
|
|
@@ -36154,7 +36205,7 @@ function ModuleActionBar({
|
|
|
36154
36205
|
trailing
|
|
36155
36206
|
}) {
|
|
36156
36207
|
const t = useTranslation();
|
|
36157
|
-
const actions =
|
|
36208
|
+
const actions = React120__default.useMemo(() => {
|
|
36158
36209
|
const out = (quickActions ?? []).map((qa, i) => ({
|
|
36159
36210
|
id: qa.id,
|
|
36160
36211
|
label: qa.label,
|
|
@@ -36186,9 +36237,9 @@ function ModuleActionBar({
|
|
|
36186
36237
|
] });
|
|
36187
36238
|
}
|
|
36188
36239
|
function createPluginContext(displayName) {
|
|
36189
|
-
const ConfigContext =
|
|
36190
|
-
const ProviderContext =
|
|
36191
|
-
const StoreContext =
|
|
36240
|
+
const ConfigContext = React120__default.createContext(null);
|
|
36241
|
+
const ProviderContext = React120__default.createContext(null);
|
|
36242
|
+
const StoreContext = React120__default.createContext(null);
|
|
36192
36243
|
const ContextProvider = ({
|
|
36193
36244
|
config,
|
|
36194
36245
|
provider: provider2,
|
|
@@ -36197,17 +36248,17 @@ function createPluginContext(displayName) {
|
|
|
36197
36248
|
}) => /* @__PURE__ */ jsx(ConfigContext.Provider, { value: config, children: /* @__PURE__ */ jsx(ProviderContext.Provider, { value: provider2, children: /* @__PURE__ */ jsx(StoreContext.Provider, { value: store, children }) }) });
|
|
36198
36249
|
ContextProvider.displayName = `${displayName}ContextProvider`;
|
|
36199
36250
|
function useConfig() {
|
|
36200
|
-
const ctx =
|
|
36251
|
+
const ctx = React120__default.useContext(ConfigContext);
|
|
36201
36252
|
if (!ctx) throw new Error(`useConfig must be used within ${displayName}`);
|
|
36202
36253
|
return ctx;
|
|
36203
36254
|
}
|
|
36204
36255
|
function useProvider() {
|
|
36205
|
-
const ctx =
|
|
36256
|
+
const ctx = React120__default.useContext(ProviderContext);
|
|
36206
36257
|
if (!ctx) throw new Error(`useProvider must be used within ${displayName}`);
|
|
36207
36258
|
return ctx;
|
|
36208
36259
|
}
|
|
36209
36260
|
function useStore2(selector) {
|
|
36210
|
-
const store =
|
|
36261
|
+
const store = React120__default.useContext(StoreContext);
|
|
36211
36262
|
if (!store) throw new Error(`useStore must be used within ${displayName}`);
|
|
36212
36263
|
return useStore$1(store, selector);
|
|
36213
36264
|
}
|
|
@@ -36264,7 +36315,7 @@ function PluginRegistryManager({ registries, routeBase, className }) {
|
|
|
36264
36315
|
return registries[0]?.id ?? "";
|
|
36265
36316
|
};
|
|
36266
36317
|
const [activeTab, setActiveTab] = useState(getTabFromHash);
|
|
36267
|
-
|
|
36318
|
+
React120__default.useEffect(() => {
|
|
36268
36319
|
if (!routeBase) return;
|
|
36269
36320
|
const handler = () => setActiveTab(getTabFromHash());
|
|
36270
36321
|
window.addEventListener("hashchange", handler);
|
|
@@ -36475,7 +36526,7 @@ function PersonLink2({ personId, name, lookup, kind, profileHref, tab, size = "d
|
|
|
36475
36526
|
const email = data?.email;
|
|
36476
36527
|
const phone = data?.phone;
|
|
36477
36528
|
const resolvedKind = kind ?? data?.kind ?? person?.group;
|
|
36478
|
-
const actions =
|
|
36529
|
+
const actions = React120__default.useMemo(
|
|
36479
36530
|
() => personId ? getPersonActions(resolvedKind) : [],
|
|
36480
36531
|
[personId, resolvedKind]
|
|
36481
36532
|
);
|
|
@@ -37170,10 +37221,10 @@ function useTeachMe(def) {
|
|
|
37170
37221
|
return useFeatureHelp(def).teach;
|
|
37171
37222
|
}
|
|
37172
37223
|
function useFeatureHelp(def) {
|
|
37173
|
-
const ref =
|
|
37224
|
+
const ref = React120.useRef(def);
|
|
37174
37225
|
ref.current = def;
|
|
37175
37226
|
const id = `teach.${def.feature}`;
|
|
37176
|
-
const contribution =
|
|
37227
|
+
const contribution = React120.useMemo(
|
|
37177
37228
|
() => ({
|
|
37178
37229
|
id,
|
|
37179
37230
|
pluginId: "teach-me",
|
|
@@ -37207,7 +37258,7 @@ function useFeatureHelp(def) {
|
|
|
37207
37258
|
[id]
|
|
37208
37259
|
);
|
|
37209
37260
|
useAgentSurface(contribution);
|
|
37210
|
-
return
|
|
37261
|
+
return React120.useMemo(
|
|
37211
37262
|
() => ({
|
|
37212
37263
|
help: () => helpWith(ref.current),
|
|
37213
37264
|
teach: () => teachMe(ref.current),
|
|
@@ -37373,21 +37424,21 @@ function ConnectorsHub({ hostPluginId }) {
|
|
|
37373
37424
|
const { t } = useTranslation$1();
|
|
37374
37425
|
const { connectors, reload } = useConnectors({ includeGrants: false });
|
|
37375
37426
|
const assistantAvailable = useConnectorsPanelAvailable();
|
|
37376
|
-
const [selected, setSelected] =
|
|
37377
|
-
const [adding, setAdding] =
|
|
37378
|
-
const hosted =
|
|
37427
|
+
const [selected, setSelected] = React120__default.useState(null);
|
|
37428
|
+
const [adding, setAdding] = React120__default.useState(false);
|
|
37429
|
+
const hosted = React120__default.useMemo(
|
|
37379
37430
|
() => (connectors ?? []).filter((c) => c.hostPluginId === hostPluginId),
|
|
37380
37431
|
[connectors, hostPluginId]
|
|
37381
37432
|
);
|
|
37382
|
-
const categories =
|
|
37433
|
+
const categories = React120__default.useMemo(
|
|
37383
37434
|
() => [...new Set(hosted.map((c) => c.category).filter((c) => !!c))],
|
|
37384
37435
|
[hosted]
|
|
37385
37436
|
);
|
|
37386
|
-
const scoped =
|
|
37437
|
+
const scoped = React120__default.useMemo(() => {
|
|
37387
37438
|
const siblings = inCategories(connectors ?? [], categories).filter((c) => c.hostPluginId !== hostPluginId);
|
|
37388
37439
|
return [...hosted, ...siblings];
|
|
37389
37440
|
}, [connectors, hosted, categories, hostPluginId]);
|
|
37390
|
-
|
|
37441
|
+
React120__default.useEffect(() => {
|
|
37391
37442
|
if (!selected || !connectors) return;
|
|
37392
37443
|
const fresh = connectors.find((c) => c.id === selected.id);
|
|
37393
37444
|
if (fresh && fresh !== selected) setSelected(fresh);
|
|
@@ -37522,7 +37573,7 @@ function PropertiesTab({ registries, routeBase, regLabel }) {
|
|
|
37522
37573
|
return registries[0]?.id ?? "";
|
|
37523
37574
|
}
|
|
37524
37575
|
const [active2, setActive] = useState(getActive);
|
|
37525
|
-
|
|
37576
|
+
React120__default.useEffect(() => {
|
|
37526
37577
|
const handler = () => setActive(getActive());
|
|
37527
37578
|
window.addEventListener("hashchange", handler);
|
|
37528
37579
|
return () => window.removeEventListener("hashchange", handler);
|
|
@@ -37597,7 +37648,7 @@ function PluginSettingsPanel({ title, generalSettings, registries, customTabs, r
|
|
|
37597
37648
|
return tabs[0]?.id ?? "";
|
|
37598
37649
|
}
|
|
37599
37650
|
const [activeTab, setActiveTab] = useState(getActiveFromHash);
|
|
37600
|
-
|
|
37651
|
+
React120__default.useEffect(() => {
|
|
37601
37652
|
const handler = () => setActiveTab(getActiveFromHash());
|
|
37602
37653
|
window.addEventListener("hashchange", handler);
|
|
37603
37654
|
return () => window.removeEventListener("hashchange", handler);
|