@fayz-ai/admin 0.39.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/AdminShell.d.ts.map +1 -1
- package/dist/app/ConnectionBanner.d.ts +7 -0
- package/dist/app/ConnectionBanner.d.ts.map +1 -0
- package/dist/app/OfflineBoot.d.ts +32 -0
- package/dist/app/OfflineBoot.d.ts.map +1 -0
- package/dist/app/admin-app.d.ts.map +1 -1
- package/dist/crud/CrudListView.d.ts.map +1 -1
- package/dist/crud/CrudPage.d.ts.map +1 -1
- package/dist/crud/archetypes/OrderFormView.d.ts.map +1 -1
- package/dist/index.js +969 -813
- package/dist/index.js.map +1 -1
- package/dist/projects/ProjectsSettings.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -20,10 +20,13 @@ import { usePermissionOptional, usePermissionsStore, PermissionsProvider } from
|
|
|
20
20
|
export { PermissionsProvider, useHasPermission, usePermission, usePermissionOptional, usePermissions, usePermissionsStore } from './chunk-UQ2NTFQC.js';
|
|
21
21
|
import { cn, useOrganizationStore } from './chunk-QOS6UAQ4.js';
|
|
22
22
|
export { getPersistedOrgId, useOrganizationStore } from './chunk-QOS6UAQ4.js';
|
|
23
|
-
import * as
|
|
24
|
-
import
|
|
25
|
-
import
|
|
23
|
+
import * as React132 from 'react';
|
|
24
|
+
import React132__default, { createContext, useMemo, useState, useRef, useCallback, useEffect, useLayoutEffect, useContext, createElement } from 'react';
|
|
25
|
+
import * as LucideIcons from 'lucide-react';
|
|
26
|
+
import { RotateCcw, WifiOff, Pencil, Copy, Trash2, Upload, Search, ArrowDown, ArrowUp, ArrowUpDown, Check, Download, ChevronLeft, ChevronRight, AlertTriangle, Building2, 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, 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, ShieldCheck, MessageSquare, Paperclip, Infinity, CheckCheck, PartyPopper, Compass, Play, MapPin, Landmark, LocateFixed, ArrowUpCircle, 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, Database, Radio, Zap, Save, ImagePlus, UserPlus, Contact, UserMinus, Send, Sun, Moon, Monitor, Languages, Info, Link2, KeyRound, Bug, Home, Heart, Briefcase, BarChart3, Tag, Truck, Globe2 } from 'lucide-react';
|
|
27
|
+
import { reportAppError, toDataError, tl, createDebug, resetActiveUnit, setUnitMode, setActiveUnitId, setScopedResources, fetchAppConfig, getSupabaseClientOptional, payeeAccountFields, maskCpfCnpj, recordRailFields, RECORD_GROUP, activeFacet, createSafeDataProvider, isKnownMissing, rememberIfMissing, deriveEntityKey, registerEntity, getActiveTenantId, resolveDataProvider, bulkRemove, emitDomainEvent, entityEventKey, errorMessage, useTranslation, describeError, useDataChanged, emitDataChanged, exportCSV, getScopedResource, formatDateTime as formatDateTime$1, formatDate as formatDate$1, formatCurrency as formatCurrency$1, bulkCreate, matchesRange, isConnectorCategory, usePluginRuntimeOptional, useDataVersion, getWidgetsForZone, resolvePluginComponent, useUnitMode, invalidateAppConfig, toTenantPluginBindings, setCurrentLocale, resolveLocale, resolvePluginRuntime, PluginRuntimeProvider, I18nProvider, getAllEntities, resolveIntegrationSurface, defineApp, registerScaffold, useActiveTenantId, onDataChanged, useConnectorsForPlugin, renderApp as renderApp$1, parseRangeFilter, isFilterObject, connectionKey, useManifest, registerEventSink, formatPostalCode, isValidPostalCode, lookupPostalCode, usePluginRuntime, useConnectivity, RECONNECTED_EVENT, installGlobalErrorHandlers, registerErrorReporter, getConnectivity, applyNavComposition, mergeTranslations, coreTranslations, attachPersistentCache, getPersistentCache, createMockProvider, listConnections, connectorPlanes, connectorPermissions, connectorEntities, preferredPlane, connectorDirection, countByTenant, isAddressIncomplete, isBankIncomplete, payeeMethodOf, getCurrentLocale, searchEverything, readImpersonation, getComponent, getPluginFactory, connectorSettings, groupedPermissions, invocationPlane, missingRequiredSettings, isBankEmpty, isAddressEmpty, writeImpersonation, isSettingSet, getEntityByKey, connectorSubscribesTo, eventKeyMatches } from '@fayz-ai/core';
|
|
26
28
|
export { ConnectorRuntimeTokenUnavailableError, createSafeDataProvider, formatDate, formatDateTime, getActiveLocale, getActiveTenantId, getConnectorRuntimeTokenSource, getCurrentLocale, getSupabaseClientOptional, preloadLocale, resolveBackendEnv, setConnectorRuntimeTokenSource, setCurrentLocale, tl, useActiveTenantId } from '@fayz-ai/core';
|
|
29
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
27
30
|
import { usePasswordSetupGate, SetPasswordPage, AuthGate, AuthProvider, createAuthRuntime } from '@fayz-ai/plugin-auth';
|
|
28
31
|
export { LoginPage } from '@fayz-ai/plugin-auth';
|
|
29
32
|
import { Input, SearchSelect, toast, usePageTrailParent, navigateToCrumb, Button, PageHeader, ConfirmDialog, RowActions, useRowSelection, getLucideIcon, ListFilterBar, Dropdown, DropdownTrigger, Hint, cn as cn$1, DropdownContent, DropdownLabel, DropdownItem, DropdownSeparator, RefreshButton, PageHeaderActions, PageTabs, StatTiles, Card, BulkActionBar, DataTable, Modal, ModalContent, ModalHeader, ModalTitle, ModalDescription, ModalFooter, Badge, PersonAvatar, PageActionBar, ICON_MAP, Sheet, SheetContent, SheetBody, useIsWide, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, Checkbox, useTourStore, setTourNavigator, TourSpotlight, PracticeOverlay, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Wizard, SidebarOnboarding, OnboardingWidget, Skeleton, useLayoutStore, ModalPortal, ModalOverlay, ModalBody, useSaveBar, useBackHandler, SubpageHeader, Separator, Tabs, TabsList, TabsTrigger, TabsContent, CardContent, ToastProvider, NavTransitionProvider, ListView, Thumbnail, CurrencyInput, SearchField, ChevronPager, Popover, PopoverTrigger, PopoverContent, useModuleLayout, PhoneLink, normalizePhone, SearchCombobox, HeaderTabs, usePageTrail, PageHeaderOutlet, AppShellSkeleton, usePracticeStore, ViewTabs, Switch, ModalTask, setPrintBrand, useModuleViewLabel, ModuleLayoutProvider, AppShell, PageTransition, PickerDialog, MarkdownEditor, PhoneField, isCreateRoute, PageSubNav, createFayzTheme, Avatar, AvatarImage, AvatarFallback, Markdown, PageTrail, CardTitle, CardDescription, DropdownSub, DropdownSubTrigger, DropdownSubContent, DropdownRadioGroup, DropdownRadioItem, BottomSheet, CardHeader, CardFooter, SegmentedControl, SheetCard, SheetRow, useSheetClose } from '@fayz-ai/ui';
|
|
@@ -31,9 +34,6 @@ export { createFayzTheme, fayzThemePresets } from '@fayz-ai/ui';
|
|
|
31
34
|
import { useAuthStore, useAuth, buildAppHandoffUrl } from '@fayz-ai/auth';
|
|
32
35
|
export { useAuth } from '@fayz-ai/auth';
|
|
33
36
|
import { create, useStore as useStore$1 } from 'zustand';
|
|
34
|
-
import * as LucideIcons from 'lucide-react';
|
|
35
|
-
import { Pencil, Copy, Trash2, Upload, Search, ArrowDown, ArrowUp, ArrowUpDown, Check, Download, ChevronLeft, ChevronRight, AlertTriangle, Building2, 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, RotateCcw, 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, ShieldCheck, MessageSquare, Paperclip, Infinity, CheckCheck, PartyPopper, Compass, Play, MapPin, Landmark, LocateFixed, ArrowUpCircle, 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, Database, Radio, Zap, Save, ImagePlus, UserPlus, Contact, UserMinus, Send, Sun, Moon, Monitor, Languages, Info, Link2, KeyRound, Bug, Home, Heart, Briefcase, BarChart3, Tag, Truck, Globe2 } from 'lucide-react';
|
|
36
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
37
37
|
import { createPortal } from 'react-dom';
|
|
38
38
|
import { profileHasSystemPermission, mergeLimitDeclarations } from '@fayz-ai/core/access';
|
|
39
39
|
import { createFayzAgentClient } from '@fayz-ai/sdk/agent';
|
|
@@ -41,6 +41,101 @@ import { getConnectorCredentialSink, fayzPlatformOrigin, ConnectorOAuthStarterMi
|
|
|
41
41
|
export { ConnectorCredentialSinkError, ConnectorOAuthError, ConnectorOAuthStarterMissingError, createFayzConnectorAccountSource, createFayzConnectorCredentialSink, createFayzConnectorOAuthStarter, describeConnectorAccount, fayz, fayzConnectorOAuth, getConnectorAccountSource, getConnectorCredentialSink, getConnectorOAuthStarter, setConnectorAccountSource, setConnectorCredentialSink, setConnectorOAuthStarter, startConnectorOAuth } from '@fayz-ai/sdk';
|
|
42
42
|
import { createFayzEventsClient } from '@fayz-ai/sdk/events';
|
|
43
43
|
|
|
44
|
+
var shellMounted = false;
|
|
45
|
+
function ShellMountedMarker() {
|
|
46
|
+
React132__default.useEffect(() => {
|
|
47
|
+
shellMounted = true;
|
|
48
|
+
}, []);
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
function OfflineScreen({ onRetry }) {
|
|
52
|
+
return /* @__PURE__ */ jsxs(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
role: "alert",
|
|
56
|
+
className: "fixed inset-0 z-[200] flex flex-col items-center justify-center gap-3 bg-background px-6 text-center",
|
|
57
|
+
"data-testid": "offline-boot",
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ jsx(WifiOff, { className: "h-10 w-10 text-muted-foreground", "aria-hidden": true }),
|
|
60
|
+
/* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold text-foreground", children: tl("No internet connection", "Sem conex\xE3o com a internet") }),
|
|
61
|
+
/* @__PURE__ */ jsx("p", { className: "max-w-sm text-sm text-muted-foreground", children: tl(
|
|
62
|
+
"We could not open the app right now. It will open by itself as soon as the internet is back.",
|
|
63
|
+
"N\xE3o conseguimos abrir o sistema agora. Assim que a internet voltar, a tela abre sozinha."
|
|
64
|
+
) }),
|
|
65
|
+
/* @__PURE__ */ jsxs(
|
|
66
|
+
"button",
|
|
67
|
+
{
|
|
68
|
+
type: "button",
|
|
69
|
+
onClick: onRetry,
|
|
70
|
+
className: "mt-2 inline-flex items-center gap-1.5 rounded-button border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground hover:bg-muted",
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ jsx(RotateCcw, { className: "h-4 w-4", "aria-hidden": true }),
|
|
73
|
+
tl("Try again", "Tentar de novo")
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
var reload = () => window.location.reload();
|
|
82
|
+
function OfflineBootGuard({ children }) {
|
|
83
|
+
const { online } = useConnectivity();
|
|
84
|
+
const blocked = !online && !shellMounted;
|
|
85
|
+
const wasBlocked = React132__default.useRef(false);
|
|
86
|
+
if (blocked) wasBlocked.current = true;
|
|
87
|
+
React132__default.useEffect(() => {
|
|
88
|
+
if (online && wasBlocked.current && !shellMounted) reload();
|
|
89
|
+
}, [online]);
|
|
90
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
91
|
+
children,
|
|
92
|
+
blocked && /* @__PURE__ */ jsx(OfflineScreen, { onRetry: reload })
|
|
93
|
+
] });
|
|
94
|
+
}
|
|
95
|
+
var AppErrorBoundary = class extends React132__default.Component {
|
|
96
|
+
constructor() {
|
|
97
|
+
super(...arguments);
|
|
98
|
+
this.state = { error: null };
|
|
99
|
+
this.onlineAgain = () => {
|
|
100
|
+
if (this.state.error) reload();
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
static getDerivedStateFromError(error) {
|
|
104
|
+
return { error };
|
|
105
|
+
}
|
|
106
|
+
componentDidCatch(error, info) {
|
|
107
|
+
reportAppError(error, { source: "render", componentStack: info.componentStack });
|
|
108
|
+
}
|
|
109
|
+
componentDidMount() {
|
|
110
|
+
window.addEventListener("online", this.onlineAgain);
|
|
111
|
+
}
|
|
112
|
+
componentWillUnmount() {
|
|
113
|
+
window.removeEventListener("online", this.onlineAgain);
|
|
114
|
+
}
|
|
115
|
+
render() {
|
|
116
|
+
const { error } = this.state;
|
|
117
|
+
if (!error) return this.props.children;
|
|
118
|
+
const offline = toDataError(error).kind === "offline" || typeof navigator !== "undefined" && navigator.onLine === false;
|
|
119
|
+
if (offline) return /* @__PURE__ */ jsx(OfflineScreen, { onRetry: reload });
|
|
120
|
+
return /* @__PURE__ */ jsxs("div", { role: "alert", className: "fixed inset-0 flex flex-col items-center justify-center gap-3 bg-background px-6 text-center", children: [
|
|
121
|
+
/* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold text-foreground", children: tl("Something went wrong", "Algo deu errado") }),
|
|
122
|
+
/* @__PURE__ */ jsx("p", { className: "max-w-sm text-sm text-muted-foreground", children: tl("Reload the page to continue.", "Recarregue a p\xE1gina para continuar.") }),
|
|
123
|
+
/* @__PURE__ */ jsxs(
|
|
124
|
+
"button",
|
|
125
|
+
{
|
|
126
|
+
type: "button",
|
|
127
|
+
onClick: reload,
|
|
128
|
+
className: "mt-2 inline-flex items-center gap-1.5 rounded-button border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground hover:bg-muted",
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ jsx(RotateCcw, { className: "h-4 w-4", "aria-hidden": true }),
|
|
131
|
+
tl("Reload", "Recarregar")
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
] });
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
44
139
|
// src/onboarding/resolve.ts
|
|
45
140
|
function resolveSetupMode(org) {
|
|
46
141
|
if (org?.setup) return org.setup;
|
|
@@ -77,7 +172,7 @@ function useWorkspaceSetupGate(enabled) {
|
|
|
77
172
|
const close = useWorkspaceSetupStore((s) => s.close);
|
|
78
173
|
const path = useAdminPath();
|
|
79
174
|
const onRoute = path === WORKSPACE_SETUP_ROUTE;
|
|
80
|
-
const exitDeliberate =
|
|
175
|
+
const exitDeliberate = React132.useCallback(() => {
|
|
81
176
|
close();
|
|
82
177
|
if (onRoute) navigateTo("/");
|
|
83
178
|
}, [close, onRoute]);
|
|
@@ -186,10 +281,10 @@ function brandInstructions(brand) {
|
|
|
186
281
|
var UPDATE_EVENT = "fayz:update-ready";
|
|
187
282
|
function UpdateReady() {
|
|
188
283
|
const { t } = useTranslation$1();
|
|
189
|
-
const [pronta, setPronta] =
|
|
190
|
-
const [dispensada, setDispensada] =
|
|
191
|
-
const [aplicando, setAplicando] =
|
|
192
|
-
|
|
284
|
+
const [pronta, setPronta] = React132__default.useState(false);
|
|
285
|
+
const [dispensada, setDispensada] = React132__default.useState(false);
|
|
286
|
+
const [aplicando, setAplicando] = React132__default.useState(false);
|
|
287
|
+
React132__default.useEffect(() => {
|
|
193
288
|
const aviso = () => setPronta(true);
|
|
194
289
|
window.addEventListener(UPDATE_EVENT, aviso);
|
|
195
290
|
return () => window.removeEventListener(UPDATE_EVENT, aviso);
|
|
@@ -1940,7 +2035,7 @@ function getServerVersion() {
|
|
|
1940
2035
|
return 0;
|
|
1941
2036
|
}
|
|
1942
2037
|
function useAssistantActivity() {
|
|
1943
|
-
|
|
2038
|
+
React132.useSyncExternalStore(subscribe, getVersion, getServerVersion);
|
|
1944
2039
|
return pickActivity(activities);
|
|
1945
2040
|
}
|
|
1946
2041
|
var STATE_RANK = {
|
|
@@ -1956,22 +2051,22 @@ function pickActivity(list) {
|
|
|
1956
2051
|
return pool.find((a) => a.kind === "recording") ?? pool[0];
|
|
1957
2052
|
}
|
|
1958
2053
|
function useAssistantLaunchers() {
|
|
1959
|
-
|
|
2054
|
+
React132.useSyncExternalStore(subscribe, getVersion, getServerVersion);
|
|
1960
2055
|
return launchers;
|
|
1961
2056
|
}
|
|
1962
2057
|
function useLaunchersForRole(role) {
|
|
1963
2058
|
const all = useAssistantLaunchers();
|
|
1964
|
-
return
|
|
2059
|
+
return React132.useMemo(() => all.filter((l) => !l.role || l.role === role), [all, role]);
|
|
1965
2060
|
}
|
|
1966
2061
|
function usePublishAssistantActivity(activity) {
|
|
1967
2062
|
const id = activity?.id;
|
|
1968
2063
|
const key = activity ? `${activity.id}|${activity.kind}|${activity.label}|${activity.state}|${activity.elapsedMs ?? ""}|${(activity.actions ?? []).map((a) => a.intent).join(",")}|${activity.confirm?.acknowledge ?? ""}` : null;
|
|
1969
|
-
const ref =
|
|
2064
|
+
const ref = React132.useRef(activity);
|
|
1970
2065
|
ref.current = activity;
|
|
1971
|
-
|
|
2066
|
+
React132.useEffect(() => {
|
|
1972
2067
|
if (ref.current) publishAssistantActivity(ref.current);
|
|
1973
2068
|
}, [key]);
|
|
1974
|
-
|
|
2069
|
+
React132.useEffect(() => {
|
|
1975
2070
|
if (!id) return;
|
|
1976
2071
|
return () => withdrawAssistantActivity(id);
|
|
1977
2072
|
}, [id]);
|
|
@@ -1979,12 +2074,12 @@ function usePublishAssistantActivity(activity) {
|
|
|
1979
2074
|
function useRegisterAssistantLauncher(launcher) {
|
|
1980
2075
|
const id = launcher?.id;
|
|
1981
2076
|
const key = launcher ? `${launcher.id}|${launcher.label}|${launcher.disabled ? "1" : "0"}|${launcher.role ?? ""}` : null;
|
|
1982
|
-
const ref =
|
|
2077
|
+
const ref = React132.useRef(launcher);
|
|
1983
2078
|
ref.current = launcher;
|
|
1984
|
-
|
|
2079
|
+
React132.useEffect(() => {
|
|
1985
2080
|
if (ref.current) registerAssistantLauncher(ref.current);
|
|
1986
2081
|
}, [key]);
|
|
1987
|
-
|
|
2082
|
+
React132.useEffect(() => {
|
|
1988
2083
|
if (!id) return;
|
|
1989
2084
|
return () => unregisterAssistantLauncher(id);
|
|
1990
2085
|
}, [id]);
|
|
@@ -2082,42 +2177,42 @@ function useRightRailPanel(panel) {
|
|
|
2082
2177
|
const sublabel = panel?.sublabel;
|
|
2083
2178
|
const badgeCount = panel?.badge?.count;
|
|
2084
2179
|
const badgeTone = panel?.badge?.tone;
|
|
2085
|
-
const initial =
|
|
2086
|
-
|
|
2180
|
+
const initial = React132.useRef({ label: label3, icon });
|
|
2181
|
+
React132.useEffect(() => {
|
|
2087
2182
|
if (!id || !Component2) return;
|
|
2088
2183
|
register({ id, label: initial.current.label ?? id, order, Component: Component2, icon: initial.current.icon });
|
|
2089
2184
|
return () => unregister(id);
|
|
2090
2185
|
}, [id, order, Component2, register, unregister]);
|
|
2091
|
-
|
|
2186
|
+
React132.useEffect(() => {
|
|
2092
2187
|
if (!id) return;
|
|
2093
2188
|
updateMeta(id, { label: label3, icon, iconBare, trailing, sublabel });
|
|
2094
2189
|
}, [id, label3, icon, iconBare, trailing, sublabel, updateMeta]);
|
|
2095
|
-
|
|
2190
|
+
React132.useEffect(() => {
|
|
2096
2191
|
if (!id) return;
|
|
2097
2192
|
updateBadge(id, badgeCount !== void 0 ? { count: badgeCount, tone: badgeTone } : void 0);
|
|
2098
2193
|
}, [id, badgeCount, badgeTone, updateBadge]);
|
|
2099
2194
|
}
|
|
2100
|
-
var RightRailActionsSlotContext =
|
|
2195
|
+
var RightRailActionsSlotContext = React132.createContext(null);
|
|
2101
2196
|
var RightRailActionsSlotProvider = RightRailActionsSlotContext.Provider;
|
|
2102
2197
|
function RightRailActions({ children }) {
|
|
2103
|
-
const slot =
|
|
2198
|
+
const slot = React132.useContext(RightRailActionsSlotContext);
|
|
2104
2199
|
if (slot) return createPortal(children, slot);
|
|
2105
2200
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end gap-0.5 px-2 pt-1.5", children });
|
|
2106
2201
|
}
|
|
2107
|
-
var RightRailLeadingSlotContext =
|
|
2202
|
+
var RightRailLeadingSlotContext = React132.createContext(null);
|
|
2108
2203
|
var RightRailLeadingSlotProvider = RightRailLeadingSlotContext.Provider;
|
|
2109
2204
|
function RightRailLeading({ children }) {
|
|
2110
|
-
const slot =
|
|
2205
|
+
const slot = React132.useContext(RightRailLeadingSlotContext);
|
|
2111
2206
|
if (slot) return createPortal(children, slot);
|
|
2112
2207
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5 px-2 pt-1.5", children });
|
|
2113
2208
|
}
|
|
2114
2209
|
function useRightRailReselect(id, handler) {
|
|
2115
2210
|
const reselects = useRightRailStore((s) => s.reselects);
|
|
2116
2211
|
const reselectId = useRightRailStore((s) => s.reselectId);
|
|
2117
|
-
const ref =
|
|
2212
|
+
const ref = React132.useRef(handler);
|
|
2118
2213
|
ref.current = handler;
|
|
2119
|
-
const seen =
|
|
2120
|
-
|
|
2214
|
+
const seen = React132.useRef(reselects);
|
|
2215
|
+
React132.useEffect(() => {
|
|
2121
2216
|
if (reselects === seen.current) return;
|
|
2122
2217
|
seen.current = reselects;
|
|
2123
2218
|
if (reselectId === id) ref.current();
|
|
@@ -2134,9 +2229,9 @@ function useRightRailDrill(drill) {
|
|
|
2134
2229
|
const avatarName = drill?.avatar?.name;
|
|
2135
2230
|
const avatarSrc = drill?.avatar?.src;
|
|
2136
2231
|
const avatarFace = drill?.avatar?.Face;
|
|
2137
|
-
const backRef =
|
|
2232
|
+
const backRef = React132.useRef(drill?.back);
|
|
2138
2233
|
backRef.current = drill?.back;
|
|
2139
|
-
|
|
2234
|
+
React132.useEffect(() => {
|
|
2140
2235
|
if (!title) return;
|
|
2141
2236
|
setDrill({
|
|
2142
2237
|
title,
|
|
@@ -2264,7 +2359,7 @@ Voc\xEA cuida do sistema inteiro. As telas desta conta est\xE3o em \`pages\`, e
|
|
|
2264
2359
|
}
|
|
2265
2360
|
function useRegisterStaff(staff) {
|
|
2266
2361
|
const setAgent = useAgentStore((s) => s.setAgent);
|
|
2267
|
-
|
|
2362
|
+
React132__default.useEffect(() => {
|
|
2268
2363
|
if (staff && staff.length > 1) {
|
|
2269
2364
|
console.warn(
|
|
2270
2365
|
`[fayz] chat.staff lists ${staff.length} agents; an app has one. Using "${soleAgent(staff)?.name}" and ignoring the rest \u2014 see chat.agent.`
|
|
@@ -2297,7 +2392,7 @@ function AssistantInvite({ className, ...def }) {
|
|
|
2297
2392
|
const { id, persona, headline, pitch, description, placeholder, auto } = def;
|
|
2298
2393
|
const suggestions = def.suggestions;
|
|
2299
2394
|
const suggestionKey = JSON.stringify(suggestions ?? []);
|
|
2300
|
-
|
|
2395
|
+
React132.useEffect(() => {
|
|
2301
2396
|
if (!hasAssistant) return;
|
|
2302
2397
|
setInvite({
|
|
2303
2398
|
id,
|
|
@@ -2311,11 +2406,11 @@ function AssistantInvite({ className, ...def }) {
|
|
|
2311
2406
|
});
|
|
2312
2407
|
return () => setInvite(null, id);
|
|
2313
2408
|
}, [hasAssistant, id, persona, headline, pitch, description, placeholder, auto, suggestionKey, setInvite]);
|
|
2314
|
-
const anchorRef =
|
|
2315
|
-
const [box, setBox] =
|
|
2409
|
+
const anchorRef = React132.useRef(null);
|
|
2410
|
+
const [box, setBox] = React132.useState(null);
|
|
2316
2411
|
const docked = stage === "dock" && !railOpen && hasAssistant;
|
|
2317
2412
|
const showing = hasAssistant && (stage === "hero" || docked);
|
|
2318
|
-
|
|
2413
|
+
React132.useEffect(() => {
|
|
2319
2414
|
if (!showing) return;
|
|
2320
2415
|
const el = anchorRef.current;
|
|
2321
2416
|
if (!el) return;
|
|
@@ -2336,7 +2431,7 @@ function AssistantInvite({ className, ...def }) {
|
|
|
2336
2431
|
}, [showing]);
|
|
2337
2432
|
const setDockBox = useAssistantInviteStore((s) => s.setDockBox);
|
|
2338
2433
|
const wide = useWideViewport();
|
|
2339
|
-
|
|
2434
|
+
React132.useEffect(() => {
|
|
2340
2435
|
if (!docked || !wide || !box) {
|
|
2341
2436
|
setDockBox(null);
|
|
2342
2437
|
return;
|
|
@@ -2350,7 +2445,7 @@ function AssistantInvite({ className, ...def }) {
|
|
|
2350
2445
|
function useAsk() {
|
|
2351
2446
|
const queuePrompt = useChatStore((s) => s.queuePrompt);
|
|
2352
2447
|
const dismiss = useAssistantInviteStore((s) => s.dismiss);
|
|
2353
|
-
return
|
|
2448
|
+
return React132.useCallback(
|
|
2354
2449
|
(text2) => {
|
|
2355
2450
|
const trimmed = text2.trim();
|
|
2356
2451
|
if (!trimmed) return;
|
|
@@ -2368,9 +2463,9 @@ function InviteHero({
|
|
|
2368
2463
|
const { t } = useTranslation$1();
|
|
2369
2464
|
const user = useAuthStore((s) => s.user);
|
|
2370
2465
|
const ask = useAsk();
|
|
2371
|
-
const [draft, setDraft] =
|
|
2466
|
+
const [draft, setDraft] = React132.useState("");
|
|
2372
2467
|
const name = (user?.fullName || user?.email || "").split(/[\s@]/)[0];
|
|
2373
|
-
|
|
2468
|
+
React132.useEffect(() => {
|
|
2374
2469
|
const onKey = (event) => {
|
|
2375
2470
|
if (event.key === "Escape") onDismiss();
|
|
2376
2471
|
};
|
|
@@ -2432,8 +2527,8 @@ function InviteHero({
|
|
|
2432
2527
|
);
|
|
2433
2528
|
}
|
|
2434
2529
|
function useMorphIn(skip = false) {
|
|
2435
|
-
const [entered, setEntered] =
|
|
2436
|
-
|
|
2530
|
+
const [entered, setEntered] = React132.useState(() => skip || prefersReducedMotion());
|
|
2531
|
+
React132.useEffect(() => {
|
|
2437
2532
|
if (entered) return;
|
|
2438
2533
|
let second = 0;
|
|
2439
2534
|
const first = requestAnimationFrame(() => {
|
|
@@ -2452,10 +2547,10 @@ function prefersReducedMotion() {
|
|
|
2452
2547
|
var lastDockExit = null;
|
|
2453
2548
|
var RESUME_WINDOW_MS = 700;
|
|
2454
2549
|
function useWideViewport() {
|
|
2455
|
-
const [wide, setWide] =
|
|
2550
|
+
const [wide, setWide] = React132.useState(
|
|
2456
2551
|
() => typeof window !== "undefined" && !!window.matchMedia?.("(min-width: 768px)").matches
|
|
2457
2552
|
);
|
|
2458
|
-
|
|
2553
|
+
React132.useEffect(() => {
|
|
2459
2554
|
const query = window.matchMedia?.("(min-width: 768px)");
|
|
2460
2555
|
if (!query) return;
|
|
2461
2556
|
const sync = () => setWide(query.matches);
|
|
@@ -2486,21 +2581,21 @@ function InviteDock({ def, left, maxWidth }) {
|
|
|
2486
2581
|
const setOpen = useChatStore((s) => s.setOpen);
|
|
2487
2582
|
const railOpen = useRightRailStore((s) => s.open);
|
|
2488
2583
|
const railWidth = useRightRailStore((s) => s.width);
|
|
2489
|
-
const [draft, setDraft] =
|
|
2490
|
-
const resumed =
|
|
2584
|
+
const [draft, setDraft] = React132.useState("");
|
|
2585
|
+
const resumed = React132.useRef(
|
|
2491
2586
|
!!lastDockExit && lastDockExit.id === def.id && Date.now() - lastDockExit.at < RESUME_WINDOW_MS
|
|
2492
2587
|
).current;
|
|
2493
|
-
|
|
2588
|
+
React132.useEffect(() => () => {
|
|
2494
2589
|
lastDockExit = { id: def.id, at: Date.now() };
|
|
2495
2590
|
}, [def.id]);
|
|
2496
2591
|
const entered = useMorphIn(resumed);
|
|
2497
2592
|
const width = Math.min(maxWidth, DOCK_MAX_WIDTH);
|
|
2498
|
-
const mountGeo =
|
|
2593
|
+
const mountGeo = React132.useRef({ left, width }).current;
|
|
2499
2594
|
const morph = morphStyles({ left: mountGeo.left, width: mountGeo.width }, railOpen, railWidth);
|
|
2500
|
-
const [settled, setSettled] =
|
|
2595
|
+
const [settled, setSettled] = React132.useState(resumed);
|
|
2501
2596
|
const geoLeft = settled ? left : mountGeo.left;
|
|
2502
2597
|
const geoWidth = settled ? width : mountGeo.width;
|
|
2503
|
-
|
|
2598
|
+
React132.useEffect(() => {
|
|
2504
2599
|
if (!entered || settled) return;
|
|
2505
2600
|
const id = setTimeout(() => setSettled(true), MORPH_MS + 60);
|
|
2506
2601
|
return () => clearTimeout(id);
|
|
@@ -2646,7 +2741,7 @@ function MorphBackPill() {
|
|
|
2646
2741
|
const railWidth = useRightRailStore((s) => s.width);
|
|
2647
2742
|
const { t } = useTranslation$1();
|
|
2648
2743
|
const collapsed = useMorphIn();
|
|
2649
|
-
|
|
2744
|
+
React132.useEffect(() => {
|
|
2650
2745
|
if (prefersReducedMotion()) {
|
|
2651
2746
|
endLeave();
|
|
2652
2747
|
return;
|
|
@@ -4562,12 +4657,12 @@ function detectActivePluginId(runtime) {
|
|
|
4562
4657
|
function useAITools() {
|
|
4563
4658
|
const runtime = usePluginRuntimeOptional();
|
|
4564
4659
|
const access = useAccessOptional();
|
|
4565
|
-
const surfaceVersion =
|
|
4660
|
+
const surfaceVersion = React132.useSyncExternalStore(subscribeSurfaces, getSurfaceVersion, getSurfaceVersion);
|
|
4566
4661
|
const features = usePermissionsStore((s) => s.features);
|
|
4567
4662
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
4568
4663
|
const hasSystem = useSystemPermission();
|
|
4569
4664
|
const canManagePermissions = hasSystem("manage_permissions");
|
|
4570
|
-
return
|
|
4665
|
+
return React132.useMemo(() => {
|
|
4571
4666
|
const hasPermission = runtime?.context.hasPermission;
|
|
4572
4667
|
const can = access.can;
|
|
4573
4668
|
const verticalId = runtime?.context.tenant?.verticalId;
|
|
@@ -5583,8 +5678,8 @@ function loadCatalog() {
|
|
|
5583
5678
|
return catalogPromise;
|
|
5584
5679
|
}
|
|
5585
5680
|
function useConnectorCatalog() {
|
|
5586
|
-
const [catalog, setCatalog] =
|
|
5587
|
-
|
|
5681
|
+
const [catalog, setCatalog] = React132__default.useState(null);
|
|
5682
|
+
React132__default.useEffect(() => {
|
|
5588
5683
|
let cancelled = false;
|
|
5589
5684
|
void loadCatalog().then((list) => {
|
|
5590
5685
|
if (!cancelled) setCatalog(list);
|
|
@@ -5608,7 +5703,7 @@ function refreshConnectors() {
|
|
|
5608
5703
|
_revisionListeners.forEach((listener) => listener());
|
|
5609
5704
|
}
|
|
5610
5705
|
function useConnectorsRevision() {
|
|
5611
|
-
return
|
|
5706
|
+
return React132__default.useSyncExternalStore(
|
|
5612
5707
|
(listener) => {
|
|
5613
5708
|
_revisionListeners.add(listener);
|
|
5614
5709
|
return () => _revisionListeners.delete(listener);
|
|
@@ -5627,11 +5722,11 @@ function loadGrants(key, fetcher) {
|
|
|
5627
5722
|
}
|
|
5628
5723
|
function useInstalledModuleIds() {
|
|
5629
5724
|
const runtime = usePluginRuntimeOptional();
|
|
5630
|
-
return
|
|
5725
|
+
return React132__default.useMemo(() => (runtime?.plugins ?? []).map((p) => p.id), [runtime]);
|
|
5631
5726
|
}
|
|
5632
5727
|
function useInstalledDefinitions(hostPluginId) {
|
|
5633
5728
|
const runtime = usePluginRuntimeOptional();
|
|
5634
|
-
return
|
|
5729
|
+
return React132__default.useMemo(() => {
|
|
5635
5730
|
const byHost = runtime?.connectorsByHost;
|
|
5636
5731
|
if (!byHost) return [];
|
|
5637
5732
|
if (hostPluginId) return byHost.get(hostPluginId) ?? [];
|
|
@@ -5644,12 +5739,12 @@ function useConnectors(options = {}) {
|
|
|
5644
5739
|
const catalog = useConnectorCatalog();
|
|
5645
5740
|
const tenant = useTenantOptional();
|
|
5646
5741
|
const tenantId2 = tenant?.org?.id;
|
|
5647
|
-
const connection =
|
|
5648
|
-
const [installed, setInstalled] =
|
|
5649
|
-
const [grants, setGrants] =
|
|
5650
|
-
const [error, setError] =
|
|
5742
|
+
const connection = React132__default.useMemo(() => resolveFayzAgentConnection(), []);
|
|
5743
|
+
const [installed, setInstalled] = React132__default.useState(null);
|
|
5744
|
+
const [grants, setGrants] = React132__default.useState(null);
|
|
5745
|
+
const [error, setError] = React132__default.useState(null);
|
|
5651
5746
|
const nonce = useConnectorsRevision();
|
|
5652
|
-
const call2 =
|
|
5747
|
+
const call2 = React132__default.useCallback(
|
|
5653
5748
|
async (path, init) => {
|
|
5654
5749
|
if (!connection) throw new Error("Este app n\xE3o est\xE1 ligado a um projeto Fayz.");
|
|
5655
5750
|
const supabase = getFayzSupabaseClientOptional();
|
|
@@ -5669,7 +5764,7 @@ function useConnectors(options = {}) {
|
|
|
5669
5764
|
},
|
|
5670
5765
|
[connection]
|
|
5671
5766
|
);
|
|
5672
|
-
|
|
5767
|
+
React132__default.useEffect(() => {
|
|
5673
5768
|
let cancelled = false;
|
|
5674
5769
|
void loadConnectorStatuses(definitions, tenantId2).then((list) => {
|
|
5675
5770
|
if (!cancelled) setInstalled(list);
|
|
@@ -5678,7 +5773,7 @@ function useConnectors(options = {}) {
|
|
|
5678
5773
|
cancelled = true;
|
|
5679
5774
|
};
|
|
5680
5775
|
}, [definitions, tenantId2, nonce]);
|
|
5681
|
-
|
|
5776
|
+
React132__default.useEffect(() => {
|
|
5682
5777
|
if (!includeGrants || !connection || !tenantId2) {
|
|
5683
5778
|
setGrants(includeGrants ? null : []);
|
|
5684
5779
|
return;
|
|
@@ -5702,7 +5797,7 @@ function useConnectors(options = {}) {
|
|
|
5702
5797
|
cancelled = true;
|
|
5703
5798
|
};
|
|
5704
5799
|
}, [call2, tenantId2, includeGrants, connection, nonce]);
|
|
5705
|
-
const revokeGrant =
|
|
5800
|
+
const revokeGrant = React132__default.useCallback(
|
|
5706
5801
|
async (connector) => {
|
|
5707
5802
|
const response = await call2(`/${connector.id}`, { method: "DELETE" });
|
|
5708
5803
|
if (!response.ok) {
|
|
@@ -5715,7 +5810,7 @@ function useConnectors(options = {}) {
|
|
|
5715
5810
|
[call2]
|
|
5716
5811
|
);
|
|
5717
5812
|
const waitingGrants = includeGrants && !!connection && !!tenantId2 && grants === null;
|
|
5718
|
-
const connectors =
|
|
5813
|
+
const connectors = React132__default.useMemo(() => {
|
|
5719
5814
|
if (installed === null || waitingGrants) return null;
|
|
5720
5815
|
return buildConnectorList({
|
|
5721
5816
|
installed,
|
|
@@ -5956,9 +6051,9 @@ function ConnectorMark({
|
|
|
5956
6051
|
connector,
|
|
5957
6052
|
size = "md"
|
|
5958
6053
|
}) {
|
|
5959
|
-
const candidates =
|
|
5960
|
-
const [attempt, setAttempt] =
|
|
5961
|
-
|
|
6054
|
+
const candidates = React132__default.useMemo(() => markCandidates(connector), [connector.logoUrl, connector.name]);
|
|
6055
|
+
const [attempt, setAttempt] = React132__default.useState(0);
|
|
6056
|
+
React132__default.useEffect(() => setAttempt(0), [connector.id]);
|
|
5962
6057
|
const box = size === "sm" ? "h-9 w-9" : "h-10 w-10";
|
|
5963
6058
|
const glyph = size === "sm" ? "h-4 w-4" : "h-5 w-5";
|
|
5964
6059
|
if (connector.builtIn) {
|
|
@@ -7594,9 +7689,9 @@ function prefersReducedMotion2() {
|
|
|
7594
7689
|
return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
7595
7690
|
}
|
|
7596
7691
|
function TypewriterText({ text: text2, speed = 26, onDone }) {
|
|
7597
|
-
const [displayed, setDisplayed] =
|
|
7598
|
-
const indexRef =
|
|
7599
|
-
|
|
7692
|
+
const [displayed, setDisplayed] = React132.useState("");
|
|
7693
|
+
const indexRef = React132.useRef(0);
|
|
7694
|
+
React132.useEffect(() => {
|
|
7600
7695
|
if (prefersReducedMotion2()) {
|
|
7601
7696
|
setDisplayed(text2);
|
|
7602
7697
|
onDone?.();
|
|
@@ -7673,16 +7768,16 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7673
7768
|
const { contextualSuggestions } = useAITools();
|
|
7674
7769
|
const { sendMessage } = useChat({ apiEndpoint, systemPrompt, agent });
|
|
7675
7770
|
const { t } = useTranslation$1();
|
|
7676
|
-
const [phase, setPhase] =
|
|
7677
|
-
const [activeSuggestion, setActiveSuggestion] =
|
|
7678
|
-
const timersRef =
|
|
7679
|
-
const prevSuggestionRef =
|
|
7680
|
-
const [greeting, setGreeting] =
|
|
7681
|
-
const greetTimerRef =
|
|
7682
|
-
|
|
7771
|
+
const [phase, setPhase] = React132.useState("idle");
|
|
7772
|
+
const [activeSuggestion, setActiveSuggestion] = React132.useState(null);
|
|
7773
|
+
const timersRef = React132.useRef([]);
|
|
7774
|
+
const prevSuggestionRef = React132.useRef(null);
|
|
7775
|
+
const [greeting, setGreeting] = React132.useState(false);
|
|
7776
|
+
const greetTimerRef = React132.useRef(0);
|
|
7777
|
+
React132.useEffect(() => () => window.clearTimeout(greetTimerRef.current), []);
|
|
7683
7778
|
const hasFace = !!host?.AvatarComponent;
|
|
7684
|
-
|
|
7685
|
-
|
|
7779
|
+
React132.useEffect(ensureStyles, []);
|
|
7780
|
+
React132.useEffect(() => {
|
|
7686
7781
|
document.documentElement.classList.add("fz-has-fab");
|
|
7687
7782
|
return () => document.documentElement.classList.remove("fz-has-fab");
|
|
7688
7783
|
}, []);
|
|
@@ -7698,10 +7793,10 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7698
7793
|
const invited = useAssistantInviteStore((s) => !!s.invite && s.stage === "dock");
|
|
7699
7794
|
const dockOnScreen = useAssistantInviteStore((s) => !!s.dockBox);
|
|
7700
7795
|
const morphingBack = useAssistantInviteStore((s) => !!s.leaving);
|
|
7701
|
-
const [wide, setWide] =
|
|
7796
|
+
const [wide, setWide] = React132.useState(
|
|
7702
7797
|
() => typeof window !== "undefined" && !!window.matchMedia?.("(min-width: 768px)").matches
|
|
7703
7798
|
);
|
|
7704
|
-
|
|
7799
|
+
React132.useEffect(() => {
|
|
7705
7800
|
const query = window.matchMedia?.("(min-width: 768px)");
|
|
7706
7801
|
if (!query) return;
|
|
7707
7802
|
const sync = () => setWide(query.matches);
|
|
@@ -7710,7 +7805,7 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7710
7805
|
return () => query.removeEventListener("change", sync);
|
|
7711
7806
|
}, []);
|
|
7712
7807
|
const teaserAllowed = !hasMessages && !activity && !invited && !teaserDismissed() && teaserShownCount() < TEASER_MAX_PER_SESSION;
|
|
7713
|
-
|
|
7808
|
+
React132.useEffect(() => {
|
|
7714
7809
|
if (expanded || !topSuggestion || !topLabel || !teaserAllowed || teaserSeen().includes(topLabel)) {
|
|
7715
7810
|
if (phase !== "idle") {
|
|
7716
7811
|
clearTimers();
|
|
@@ -7741,14 +7836,14 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7741
7836
|
}, 9e3);
|
|
7742
7837
|
return clearTimers;
|
|
7743
7838
|
}, [topLabel, expanded, teaserAllowed]);
|
|
7744
|
-
|
|
7839
|
+
React132.useEffect(() => {
|
|
7745
7840
|
if (expanded && phase !== "idle") {
|
|
7746
7841
|
clearTimers();
|
|
7747
7842
|
setPhase("idle");
|
|
7748
7843
|
}
|
|
7749
7844
|
}, [expanded]);
|
|
7750
|
-
const [entrance, setEntrance] =
|
|
7751
|
-
|
|
7845
|
+
const [entrance, setEntrance] = React132.useState("pending");
|
|
7846
|
+
React132.useEffect(() => {
|
|
7752
7847
|
if (!currentOrg || entrance !== "pending") return;
|
|
7753
7848
|
if (prefersReducedMotion2()) {
|
|
7754
7849
|
setEntrance("done");
|
|
@@ -7758,9 +7853,9 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7758
7853
|
const timer = setTimeout(() => setEntrance("done"), 1600);
|
|
7759
7854
|
return () => clearTimeout(timer);
|
|
7760
7855
|
}, [currentOrg, entrance]);
|
|
7761
|
-
const [poppingBack, setPoppingBack] =
|
|
7762
|
-
const wasMorphing =
|
|
7763
|
-
|
|
7856
|
+
const [poppingBack, setPoppingBack] = React132.useState(false);
|
|
7857
|
+
const wasMorphing = React132.useRef(false);
|
|
7858
|
+
React132.useEffect(() => {
|
|
7764
7859
|
const was = wasMorphing.current;
|
|
7765
7860
|
wasMorphing.current = morphingBack;
|
|
7766
7861
|
if (!was || morphingBack || prefersReducedMotion2()) return;
|
|
@@ -8058,7 +8153,7 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
8058
8153
|
var MAX_SUGGESTIONS = 5;
|
|
8059
8154
|
function ChatSuggestions({ suggestions, onSelect, onDismiss, compact }) {
|
|
8060
8155
|
const { t } = useTranslation$1();
|
|
8061
|
-
const [open, setOpen] =
|
|
8156
|
+
const [open, setOpen] = React132.useState(true);
|
|
8062
8157
|
const visible = suggestions.slice(0, compact ? 3 : MAX_SUGGESTIONS);
|
|
8063
8158
|
if (!visible.length) return null;
|
|
8064
8159
|
return /* @__PURE__ */ jsxs(
|
|
@@ -8137,8 +8232,8 @@ function SuggestionRow({
|
|
|
8137
8232
|
detail,
|
|
8138
8233
|
onSelect
|
|
8139
8234
|
}) {
|
|
8140
|
-
const labelRef =
|
|
8141
|
-
const [showDetail, setShowDetail] =
|
|
8235
|
+
const labelRef = React132.useRef(null);
|
|
8236
|
+
const [showDetail, setShowDetail] = React132.useState(false);
|
|
8142
8237
|
const evaluate = () => {
|
|
8143
8238
|
const el = labelRef.current;
|
|
8144
8239
|
const clipped = !!el && el.scrollWidth > el.clientWidth + 1;
|
|
@@ -8232,8 +8327,8 @@ function ChatToolsPanel({ toolGroups, onClose }) {
|
|
|
8232
8327
|
}
|
|
8233
8328
|
function AutoApprovalsSection() {
|
|
8234
8329
|
const { t } = useTranslation$1();
|
|
8235
|
-
const [rules, setRules] =
|
|
8236
|
-
|
|
8330
|
+
const [rules, setRules] = React132.useState(() => listAutoApprovals());
|
|
8331
|
+
React132.useEffect(() => subscribeAutoApprovals(() => setRules(listAutoApprovals())), []);
|
|
8237
8332
|
if (!rules.length) return null;
|
|
8238
8333
|
return /* @__PURE__ */ jsxs("div", { className: "border-b border-border/40 px-3 py-2.5", children: [
|
|
8239
8334
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 px-1 pb-1.5", children: [
|
|
@@ -8286,14 +8381,14 @@ function bucketOf(iso) {
|
|
|
8286
8381
|
var ORDER = ["today", "yesterday", "week", "older"];
|
|
8287
8382
|
function ChatHistory({ conversations, activeId, onSelect }) {
|
|
8288
8383
|
const { t } = useTranslation$1();
|
|
8289
|
-
const [query, setQuery] =
|
|
8384
|
+
const [query, setQuery] = React132.useState("");
|
|
8290
8385
|
const mine = conversations;
|
|
8291
|
-
const filtered =
|
|
8386
|
+
const filtered = React132.useMemo(() => {
|
|
8292
8387
|
const needle = query.trim().toLowerCase();
|
|
8293
8388
|
if (!needle) return mine;
|
|
8294
8389
|
return mine.filter((c) => (c.title ?? "").toLowerCase().includes(needle));
|
|
8295
8390
|
}, [mine, query]);
|
|
8296
|
-
const groups =
|
|
8391
|
+
const groups = React132.useMemo(() => {
|
|
8297
8392
|
const map = /* @__PURE__ */ new Map();
|
|
8298
8393
|
for (const conversation of filtered) {
|
|
8299
8394
|
const bucket = bucketOf(conversation.updatedAt);
|
|
@@ -8420,7 +8515,7 @@ function TourCoachCard() {
|
|
|
8420
8515
|
const lastOutcome = useTourStore((s) => s.lastOutcome);
|
|
8421
8516
|
const stop = useTourStore((s) => s.stop);
|
|
8422
8517
|
const restart = useTourStore((s) => s.restart);
|
|
8423
|
-
const [dismissedId, setDismissedId] =
|
|
8518
|
+
const [dismissedId, setDismissedId] = React132.useState(null);
|
|
8424
8519
|
const pTitle = usePracticeStore((s) => s.title);
|
|
8425
8520
|
const pSteps = usePracticeStore((s) => s.steps);
|
|
8426
8521
|
const pDone = usePracticeStore((s) => s.done);
|
|
@@ -8491,8 +8586,8 @@ function AssistantRecordingView({ activity }) {
|
|
|
8491
8586
|
const live = activity.state === "running" || activity.state === "paused";
|
|
8492
8587
|
const running = activity.state === "running";
|
|
8493
8588
|
const actions = activity.actions ?? [];
|
|
8494
|
-
const [acknowledged, setAcknowledged] =
|
|
8495
|
-
|
|
8589
|
+
const [acknowledged, setAcknowledged] = React132.useState(false);
|
|
8590
|
+
React132.useEffect(() => setAcknowledged(false), [activity.id, activity.state]);
|
|
8496
8591
|
const withheld = pending2 && !!activity.confirm && !acknowledged;
|
|
8497
8592
|
const primary = actions.filter((a) => a.intent !== "discard");
|
|
8498
8593
|
const discard = actions.find((a) => a.intent === "discard");
|
|
@@ -8708,10 +8803,10 @@ function RightRailPage({
|
|
|
8708
8803
|
const closePage = useRightRailStore((s) => s.closePage);
|
|
8709
8804
|
const active2 = hosted && open;
|
|
8710
8805
|
const pageOpen = useRightRailStore((s) => s.pageOpen);
|
|
8711
|
-
const onCloseRef =
|
|
8806
|
+
const onCloseRef = React132.useRef(onClose);
|
|
8712
8807
|
onCloseRef.current = onClose;
|
|
8713
|
-
const claimed =
|
|
8714
|
-
|
|
8808
|
+
const claimed = React132.useRef(false);
|
|
8809
|
+
React132.useEffect(() => {
|
|
8715
8810
|
if (!active2) return;
|
|
8716
8811
|
showPage();
|
|
8717
8812
|
claimed.current = true;
|
|
@@ -8720,7 +8815,7 @@ function RightRailPage({
|
|
|
8720
8815
|
closePage();
|
|
8721
8816
|
};
|
|
8722
8817
|
}, [active2, showPage, closePage]);
|
|
8723
|
-
|
|
8818
|
+
React132.useEffect(() => {
|
|
8724
8819
|
if (!claimed.current) return;
|
|
8725
8820
|
if (!useRightRailStore.getState().pageOpen) onCloseRef.current();
|
|
8726
8821
|
}, [pageOpen]);
|
|
@@ -8923,15 +9018,15 @@ function ConnectorSyncActions({
|
|
|
8923
9018
|
actions,
|
|
8924
9019
|
onRan
|
|
8925
9020
|
}) {
|
|
8926
|
-
const [running, setRunning] =
|
|
8927
|
-
const [open, setOpen] =
|
|
8928
|
-
const [pending2, setPending] =
|
|
8929
|
-
const [hidden, setHidden] =
|
|
8930
|
-
const [queued, setQueued] =
|
|
8931
|
-
const [nonce, setNonce] =
|
|
8932
|
-
const [expanded, setExpanded] =
|
|
8933
|
-
const [resolved, setResolved] =
|
|
8934
|
-
|
|
9021
|
+
const [running, setRunning] = React132__default.useState(null);
|
|
9022
|
+
const [open, setOpen] = React132__default.useState(null);
|
|
9023
|
+
const [pending2, setPending] = React132__default.useState(null);
|
|
9024
|
+
const [hidden, setHidden] = React132__default.useState(() => /* @__PURE__ */ new Set());
|
|
9025
|
+
const [queued, setQueued] = React132__default.useState({});
|
|
9026
|
+
const [nonce, setNonce] = React132__default.useState(0);
|
|
9027
|
+
const [expanded, setExpanded] = React132__default.useState(false);
|
|
9028
|
+
const [resolved, setResolved] = React132__default.useState(false);
|
|
9029
|
+
React132__default.useEffect(() => {
|
|
8935
9030
|
let cancelled = false;
|
|
8936
9031
|
setResolved(false);
|
|
8937
9032
|
void Promise.all(
|
|
@@ -9116,10 +9211,10 @@ function formatRelative(iso, t) {
|
|
|
9116
9211
|
}
|
|
9117
9212
|
function useConnectorRuns(connector) {
|
|
9118
9213
|
const listRuns = connector.definition?.listRuns;
|
|
9119
|
-
const [runs, setRuns] =
|
|
9120
|
-
const [loading, setLoading] =
|
|
9121
|
-
const [nonce, setNonce] =
|
|
9122
|
-
|
|
9214
|
+
const [runs, setRuns] = React132__default.useState([]);
|
|
9215
|
+
const [loading, setLoading] = React132__default.useState(!!listRuns);
|
|
9216
|
+
const [nonce, setNonce] = React132__default.useState(0);
|
|
9217
|
+
React132__default.useEffect(() => {
|
|
9123
9218
|
if (!listRuns) {
|
|
9124
9219
|
setRuns([]);
|
|
9125
9220
|
setLoading(false);
|
|
@@ -9141,7 +9236,7 @@ function useConnectorRuns(connector) {
|
|
|
9141
9236
|
return {
|
|
9142
9237
|
runs,
|
|
9143
9238
|
loading,
|
|
9144
|
-
reload:
|
|
9239
|
+
reload: React132__default.useCallback(() => setNonce((n) => n + 1), []),
|
|
9145
9240
|
failing: isFailing(runs)
|
|
9146
9241
|
};
|
|
9147
9242
|
}
|
|
@@ -9164,12 +9259,12 @@ function ConnectorRuns({
|
|
|
9164
9259
|
}) {
|
|
9165
9260
|
const { t } = useTranslation$1();
|
|
9166
9261
|
const def = connector.definition;
|
|
9167
|
-
const { runs, loading, reload } = state;
|
|
9262
|
+
const { runs, loading, reload: reload2 } = state;
|
|
9168
9263
|
const firstLoad = def?.firstLoad;
|
|
9169
9264
|
const backfilling = !!firstLoad && runs.some((r) => r.status === "running");
|
|
9170
9265
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
9171
|
-
def?.syncActions?.length ? /* @__PURE__ */ jsx(ConnectorSyncActions, { actions: def.syncActions, onRan:
|
|
9172
|
-
def?.RunActions && /* @__PURE__ */ jsx(def.RunActions, { onRan:
|
|
9266
|
+
def?.syncActions?.length ? /* @__PURE__ */ jsx(ConnectorSyncActions, { actions: def.syncActions, onRan: reload2 }) : null,
|
|
9267
|
+
def?.RunActions && /* @__PURE__ */ jsx(def.RunActions, { onRan: reload2 }),
|
|
9173
9268
|
backfilling && /* @__PURE__ */ jsxs("p", { className: "flex items-start gap-2 text-xs text-muted-foreground", children: [
|
|
9174
9269
|
/* @__PURE__ */ jsx(Loader2, { className: "mt-px h-3.5 w-3.5 shrink-0 animate-spin" }),
|
|
9175
9270
|
/* @__PURE__ */ jsx("span", { children: t("connectors.runs.backfilling") })
|
|
@@ -9241,7 +9336,7 @@ function RunFailure({ run }) {
|
|
|
9241
9336
|
),
|
|
9242
9337
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: t("connectors.runs.seeDetails") })
|
|
9243
9338
|
] }),
|
|
9244
|
-
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(([label3, value]) => /* @__PURE__ */ jsxs(
|
|
9339
|
+
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(([label3, value]) => /* @__PURE__ */ jsxs(React132__default.Fragment, { children: [
|
|
9245
9340
|
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: label3 }),
|
|
9246
9341
|
/* @__PURE__ */ jsx("dd", { className: "min-w-0 break-words font-mono text-foreground/80", children: value })
|
|
9247
9342
|
] }, label3)) }),
|
|
@@ -9410,13 +9505,13 @@ function ConnectorSettingsPanel({
|
|
|
9410
9505
|
const { t } = useTranslation$1();
|
|
9411
9506
|
const def = connector.definition;
|
|
9412
9507
|
const settings = def ? connectorSettings(def) : [];
|
|
9413
|
-
const [values, setValues] =
|
|
9508
|
+
const [values, setValues] = React132__default.useState(
|
|
9414
9509
|
() => initialValues(settings, {})
|
|
9415
9510
|
);
|
|
9416
|
-
const [loaded2, setLoaded] =
|
|
9417
|
-
const [saving, setSaving] =
|
|
9418
|
-
const [dirty, setDirty] =
|
|
9419
|
-
|
|
9511
|
+
const [loaded2, setLoaded] = React132__default.useState(false);
|
|
9512
|
+
const [saving, setSaving] = React132__default.useState(false);
|
|
9513
|
+
const [dirty, setDirty] = React132__default.useState(false);
|
|
9514
|
+
React132__default.useEffect(() => {
|
|
9420
9515
|
if (settings.length === 0 || !def?.getSettings) return;
|
|
9421
9516
|
let cancelled = false;
|
|
9422
9517
|
setLoaded(false);
|
|
@@ -9667,13 +9762,13 @@ function ConnectorInstall({
|
|
|
9667
9762
|
}) {
|
|
9668
9763
|
const { t } = useTranslation$1();
|
|
9669
9764
|
const def = connector.definition;
|
|
9670
|
-
const [plane, setPlane] =
|
|
9765
|
+
const [plane, setPlane] = React132__default.useState(
|
|
9671
9766
|
connector.planes.includes("agentic") ? "agentic" : connector.planes[0]
|
|
9672
9767
|
);
|
|
9673
|
-
const [values, setValues] =
|
|
9674
|
-
const secrets =
|
|
9675
|
-
const [busy, setBusy] =
|
|
9676
|
-
|
|
9768
|
+
const [values, setValues] = React132__default.useState({});
|
|
9769
|
+
const secrets = React132__default.useRef({});
|
|
9770
|
+
const [busy, setBusy] = React132__default.useState(null);
|
|
9771
|
+
React132__default.useEffect(() => {
|
|
9677
9772
|
setValues({});
|
|
9678
9773
|
secrets.current = {};
|
|
9679
9774
|
setBusy(null);
|
|
@@ -9714,15 +9809,15 @@ function ConnectorHome({
|
|
|
9714
9809
|
const needsSetup = connector.state === "needs_setup";
|
|
9715
9810
|
const settingsAvailable = hasOperatingSettings(connector);
|
|
9716
9811
|
const runsAvailable = hasRunHistory(connector);
|
|
9717
|
-
const [tab, setTab] =
|
|
9812
|
+
const [tab, setTab] = React132__default.useState(
|
|
9718
9813
|
needsSetup && settingsAvailable ? "settings" : "overview"
|
|
9719
9814
|
);
|
|
9720
|
-
const [busy, setBusy] =
|
|
9815
|
+
const [busy, setBusy] = React132__default.useState(null);
|
|
9721
9816
|
const run = useRunner(setBusy, onChanged);
|
|
9722
|
-
const [values, setValues] =
|
|
9723
|
-
const secrets =
|
|
9817
|
+
const [values, setValues] = React132__default.useState({});
|
|
9818
|
+
const secrets = React132__default.useRef({});
|
|
9724
9819
|
const runs = useConnectorRuns(connector);
|
|
9725
|
-
|
|
9820
|
+
React132__default.useEffect(() => {
|
|
9726
9821
|
setTab(needsSetup && settingsAvailable ? "settings" : "overview");
|
|
9727
9822
|
setBusy(null);
|
|
9728
9823
|
setValues({});
|
|
@@ -9812,7 +9907,7 @@ function ConnectorHome({
|
|
|
9812
9907
|
}
|
|
9813
9908
|
function useRunner(setBusy, onChanged) {
|
|
9814
9909
|
const { t } = useTranslation$1();
|
|
9815
|
-
return
|
|
9910
|
+
return React132__default.useCallback(
|
|
9816
9911
|
async (kind, fn, okMessage) => {
|
|
9817
9912
|
setBusy(kind);
|
|
9818
9913
|
try {
|
|
@@ -9928,7 +10023,7 @@ function ConnectPanel({
|
|
|
9928
10023
|
const sinkMissing = needsSink && !getConnectorCredentialSink();
|
|
9929
10024
|
const secretFieldCount = (def.fields ?? []).filter(isSecretField).length;
|
|
9930
10025
|
const hasStoredCredential = connector.state === "connected" || connector.state === "needs_setup";
|
|
9931
|
-
const [formKey, setFormKey] =
|
|
10026
|
+
const [formKey, setFormKey] = React132__default.useState(0);
|
|
9932
10027
|
if (def.authKind === "oauth") {
|
|
9933
10028
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
9934
10029
|
/* @__PURE__ */ jsx(Note, { children: t("connectors.authorize.oauthOnly") }),
|
|
@@ -10061,7 +10156,7 @@ function GrantRevoke({
|
|
|
10061
10156
|
onRevoke
|
|
10062
10157
|
}) {
|
|
10063
10158
|
const { t } = useTranslation$1();
|
|
10064
|
-
const [revoking, setRevoking] =
|
|
10159
|
+
const [revoking, setRevoking] = React132__default.useState(false);
|
|
10065
10160
|
if (connector.revocable === false) {
|
|
10066
10161
|
return /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("connectors.partOfApp") });
|
|
10067
10162
|
}
|
|
@@ -10097,17 +10192,17 @@ function useConnectorsPanelAvailable() {
|
|
|
10097
10192
|
}
|
|
10098
10193
|
function ConnectorsPanel({ onClose }) {
|
|
10099
10194
|
const { t } = useTranslation$1();
|
|
10100
|
-
const { connectors, reload, revokeGrant, agentAvailable, tenantReady } = useConnectors();
|
|
10195
|
+
const { connectors, reload: reload2, revokeGrant, agentAvailable, tenantReady } = useConnectors();
|
|
10101
10196
|
const selectedId = useConnectorsSurface((s) => s.selected);
|
|
10102
10197
|
const select = useConnectorsSurface((s) => s.select);
|
|
10103
|
-
const [query, setQuery] =
|
|
10104
|
-
const [failure, setFailure] =
|
|
10105
|
-
const [revoking, setRevoking] =
|
|
10106
|
-
const selected =
|
|
10198
|
+
const [query, setQuery] = React132__default.useState("");
|
|
10199
|
+
const [failure, setFailure] = React132__default.useState(null);
|
|
10200
|
+
const [revoking, setRevoking] = React132__default.useState(null);
|
|
10201
|
+
const selected = React132__default.useMemo(
|
|
10107
10202
|
() => (connectors ?? []).find((c) => c.id === selectedId) ?? null,
|
|
10108
10203
|
[connectors, selectedId]
|
|
10109
10204
|
);
|
|
10110
|
-
const filtered =
|
|
10205
|
+
const filtered = React132__default.useMemo(
|
|
10111
10206
|
() => filterConnectors(connectors ?? [], "outbound", query),
|
|
10112
10207
|
[connectors, query]
|
|
10113
10208
|
);
|
|
@@ -10118,9 +10213,9 @@ function ConnectorsPanel({ onClose }) {
|
|
|
10118
10213
|
back: onClose
|
|
10119
10214
|
} : null
|
|
10120
10215
|
);
|
|
10121
|
-
const closeRef =
|
|
10216
|
+
const closeRef = React132__default.useRef(onClose);
|
|
10122
10217
|
closeRef.current = onClose;
|
|
10123
|
-
|
|
10218
|
+
React132__default.useEffect(() => {
|
|
10124
10219
|
if (hosted && !selectedId) closeRef.current();
|
|
10125
10220
|
}, [hosted, selectedId]);
|
|
10126
10221
|
return /* @__PURE__ */ jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [
|
|
@@ -10152,7 +10247,7 @@ function ConnectorsPanel({ onClose }) {
|
|
|
10152
10247
|
ConnectorJourney,
|
|
10153
10248
|
{
|
|
10154
10249
|
connector: selected,
|
|
10155
|
-
onChanged:
|
|
10250
|
+
onChanged: reload2,
|
|
10156
10251
|
onRevoke: (connector) => setRevoking(connector)
|
|
10157
10252
|
}
|
|
10158
10253
|
),
|
|
@@ -10248,20 +10343,20 @@ function useDictation({
|
|
|
10248
10343
|
onInterim
|
|
10249
10344
|
}) {
|
|
10250
10345
|
const resolvedLocale = locale ?? (typeof navigator !== "undefined" ? navigator.language || "pt-BR" : "pt-BR");
|
|
10251
|
-
const [state, setState] =
|
|
10252
|
-
const [error, setError] =
|
|
10253
|
-
const sessionRef =
|
|
10254
|
-
const callbacks =
|
|
10346
|
+
const [state, setState] = React132.useState("idle");
|
|
10347
|
+
const [error, setError] = React132.useState(null);
|
|
10348
|
+
const sessionRef = React132.useRef(null);
|
|
10349
|
+
const callbacks = React132.useRef({ onTranscript, onInterim });
|
|
10255
10350
|
callbacks.current = { onTranscript, onInterim };
|
|
10256
|
-
const supported =
|
|
10351
|
+
const supported = React132.useMemo(
|
|
10257
10352
|
() => isDictationSupported(!!transcribeEndpoint),
|
|
10258
10353
|
[transcribeEndpoint]
|
|
10259
10354
|
);
|
|
10260
|
-
const finish =
|
|
10355
|
+
const finish = React132.useCallback(() => {
|
|
10261
10356
|
sessionRef.current = null;
|
|
10262
10357
|
setState("idle");
|
|
10263
10358
|
}, []);
|
|
10264
|
-
const start =
|
|
10359
|
+
const start = React132.useCallback(() => {
|
|
10265
10360
|
if (sessionRef.current || !supported) return;
|
|
10266
10361
|
stopSpeaking();
|
|
10267
10362
|
setError(null);
|
|
@@ -10282,28 +10377,28 @@ function useDictation({
|
|
|
10282
10377
|
}
|
|
10283
10378
|
);
|
|
10284
10379
|
}, [finish, resolvedLocale, supported, transcribeEndpoint]);
|
|
10285
|
-
const stop =
|
|
10380
|
+
const stop = React132.useCallback(() => {
|
|
10286
10381
|
if (!sessionRef.current) return;
|
|
10287
10382
|
if (transcribeEndpoint) setState("transcribing");
|
|
10288
10383
|
sessionRef.current.stop();
|
|
10289
10384
|
}, [transcribeEndpoint]);
|
|
10290
|
-
const cancel =
|
|
10385
|
+
const cancel = React132.useCallback(() => {
|
|
10291
10386
|
sessionRef.current?.cancel();
|
|
10292
10387
|
sessionRef.current = null;
|
|
10293
10388
|
setState("idle");
|
|
10294
10389
|
setError(null);
|
|
10295
10390
|
}, []);
|
|
10296
|
-
const toggle =
|
|
10391
|
+
const toggle = React132.useCallback(() => {
|
|
10297
10392
|
if (state === "listening" || state === "transcribing") stop();
|
|
10298
10393
|
else start();
|
|
10299
10394
|
}, [state, start, stop]);
|
|
10300
|
-
|
|
10395
|
+
React132.useEffect(() => () => sessionRef.current?.cancel(), []);
|
|
10301
10396
|
return { supported, state, error, start, stop, cancel, toggle, clearError: () => setError(null) };
|
|
10302
10397
|
}
|
|
10303
10398
|
function useMicLevels(active2, bandCount = 28, externalStream) {
|
|
10304
|
-
const levelsRef =
|
|
10305
|
-
const [available, setAvailable] =
|
|
10306
|
-
|
|
10399
|
+
const levelsRef = React132.useRef(new Float32Array(bandCount));
|
|
10400
|
+
const [available, setAvailable] = React132.useState(false);
|
|
10401
|
+
React132.useEffect(() => {
|
|
10307
10402
|
if (!active2) {
|
|
10308
10403
|
levelsRef.current.fill(0);
|
|
10309
10404
|
setAvailable(false);
|
|
@@ -10372,8 +10467,8 @@ var KIND_ICON = {
|
|
|
10372
10467
|
binary: File$1
|
|
10373
10468
|
};
|
|
10374
10469
|
function useFileDrop(enabled, onFiles) {
|
|
10375
|
-
const [dragging, setDragging] =
|
|
10376
|
-
const depth =
|
|
10470
|
+
const [dragging, setDragging] = React132.useState(false);
|
|
10471
|
+
const depth = React132.useRef(0);
|
|
10377
10472
|
const carriesFiles = (event) => Array.from(event.dataTransfer?.types ?? []).includes("Files");
|
|
10378
10473
|
const reset = () => {
|
|
10379
10474
|
depth.current = 0;
|
|
@@ -10433,7 +10528,7 @@ function AttachmentChips({
|
|
|
10433
10528
|
onRemove
|
|
10434
10529
|
}) {
|
|
10435
10530
|
const { t } = useTranslation$1();
|
|
10436
|
-
const [openId, setOpenId] =
|
|
10531
|
+
const [openId, setOpenId] = React132.useState(null);
|
|
10437
10532
|
if (!attachments.length) return null;
|
|
10438
10533
|
const opened = attachments.find((a) => a.id === openId);
|
|
10439
10534
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -10574,8 +10669,8 @@ function ChatComposer({
|
|
|
10574
10669
|
autoFocus
|
|
10575
10670
|
}) {
|
|
10576
10671
|
const { t } = useTranslation$1();
|
|
10577
|
-
const [input, setInput] =
|
|
10578
|
-
const textareaRef =
|
|
10672
|
+
const [input, setInput] = React132.useState("");
|
|
10673
|
+
const textareaRef = React132.useRef(null);
|
|
10579
10674
|
const voiceStartRequested = useChatStore((s) => s.voiceStartRequested);
|
|
10580
10675
|
const consumeVoiceStart = useChatStore((s) => s.consumeVoiceStart);
|
|
10581
10676
|
const draft = useChatStore((s) => s.draft);
|
|
@@ -10588,13 +10683,13 @@ function ChatComposer({
|
|
|
10588
10683
|
const removeAttachment = useChatStore((s) => s.removeAttachment);
|
|
10589
10684
|
const composerMedia = useChatStore((s) => s.composerMedia);
|
|
10590
10685
|
const clearComposerMedia = useChatStore((s) => s.clearComposerMedia);
|
|
10591
|
-
const fileInputRef =
|
|
10686
|
+
const fileInputRef = React132.useRef(null);
|
|
10592
10687
|
const autoSend = voice?.autoSend === true;
|
|
10593
10688
|
const micEnabled = voice?.input !== false;
|
|
10594
10689
|
const canAttach = isConfigured && !blocked && !isStreaming;
|
|
10595
10690
|
const parsing = attachments.some((a) => a.status === "parsing");
|
|
10596
10691
|
const readyAttachments = attachments.filter((a) => a.status === "ready").length;
|
|
10597
|
-
const submit =
|
|
10692
|
+
const submit = React132.useCallback(
|
|
10598
10693
|
(text2) => {
|
|
10599
10694
|
const trimmed = text2.trim();
|
|
10600
10695
|
const media = useChatStore.getState().composerMedia;
|
|
@@ -10624,7 +10719,7 @@ function ChatComposer({
|
|
|
10624
10719
|
}
|
|
10625
10720
|
}
|
|
10626
10721
|
});
|
|
10627
|
-
|
|
10722
|
+
React132.useEffect(() => {
|
|
10628
10723
|
if (!autoFocus) return;
|
|
10629
10724
|
const id = requestAnimationFrame(() => textareaRef.current?.focus());
|
|
10630
10725
|
return () => cancelAnimationFrame(id);
|
|
@@ -10636,7 +10731,7 @@ function ChatComposer({
|
|
|
10636
10731
|
const WAVEFORM_BANDS = 56;
|
|
10637
10732
|
const activity = useAssistantActivity();
|
|
10638
10733
|
const sessionRecording = activity?.kind === "recording" && activity.state === "running";
|
|
10639
|
-
const sessionStream =
|
|
10734
|
+
const sessionStream = React132.useMemo(
|
|
10640
10735
|
() => sessionRecording ? activity?.stream?.() ?? null : null,
|
|
10641
10736
|
[sessionRecording, activity]
|
|
10642
10737
|
);
|
|
@@ -10648,12 +10743,12 @@ function ChatComposer({
|
|
|
10648
10743
|
);
|
|
10649
10744
|
const sessionPause = activity?.actions?.find((a) => a.intent === "pause" || a.intent === "resume");
|
|
10650
10745
|
const sessionOwnsMic = activity?.kind === "recording" && (activity.state === "running" || activity.state === "paused");
|
|
10651
|
-
|
|
10746
|
+
React132.useEffect(() => {
|
|
10652
10747
|
if (!voiceStartRequested) return;
|
|
10653
10748
|
consumeVoiceStart();
|
|
10654
10749
|
if (showMic) dictation.start();
|
|
10655
10750
|
}, [voiceStartRequested, showMic]);
|
|
10656
|
-
|
|
10751
|
+
React132.useEffect(() => {
|
|
10657
10752
|
if (!focusRequested) return;
|
|
10658
10753
|
let frames = 0;
|
|
10659
10754
|
let raf = 0;
|
|
@@ -10670,7 +10765,7 @@ function ChatComposer({
|
|
|
10670
10765
|
raf = requestAnimationFrame(tick);
|
|
10671
10766
|
return () => cancelAnimationFrame(raf);
|
|
10672
10767
|
}, [focusRequested, consumeComposerFocus]);
|
|
10673
|
-
|
|
10768
|
+
React132.useEffect(() => {
|
|
10674
10769
|
if (!draft) return;
|
|
10675
10770
|
setInput(draft);
|
|
10676
10771
|
setDraft("");
|
|
@@ -10680,7 +10775,7 @@ function ChatComposer({
|
|
|
10680
10775
|
el.setSelectionRange(draft.length, draft.length);
|
|
10681
10776
|
}
|
|
10682
10777
|
}, [draft, setDraft]);
|
|
10683
|
-
|
|
10778
|
+
React132.useLayoutEffect(() => {
|
|
10684
10779
|
const el = textareaRef.current;
|
|
10685
10780
|
if (!el) return;
|
|
10686
10781
|
const style = getComputedStyle(el);
|
|
@@ -10883,8 +10978,8 @@ function UploadRequestCard() {
|
|
|
10883
10978
|
const removeUploadFile = useChatStore((s) => s.removeUploadFile);
|
|
10884
10979
|
const submitUpload = useChatStore((s) => s.submitUpload);
|
|
10885
10980
|
const clearUploadRequest = useChatStore((s) => s.clearUploadRequest);
|
|
10886
|
-
const cameraRef =
|
|
10887
|
-
const browseRef =
|
|
10981
|
+
const cameraRef = React132.useRef(null);
|
|
10982
|
+
const browseRef = React132.useRef(null);
|
|
10888
10983
|
if (!request) return null;
|
|
10889
10984
|
const working = request.status === "working";
|
|
10890
10985
|
const accept = request.accept ?? "image/*";
|
|
@@ -11026,8 +11121,8 @@ function LiveWaveform({
|
|
|
11026
11121
|
compact,
|
|
11027
11122
|
tone = "primary"
|
|
11028
11123
|
}) {
|
|
11029
|
-
const barsRef =
|
|
11030
|
-
|
|
11124
|
+
const barsRef = React132.useRef([]);
|
|
11125
|
+
React132.useEffect(() => {
|
|
11031
11126
|
if (!live) return;
|
|
11032
11127
|
let frame = 0;
|
|
11033
11128
|
const draw = () => {
|
|
@@ -11176,7 +11271,7 @@ function ChatMarkdown({ content }) {
|
|
|
11176
11271
|
}
|
|
11177
11272
|
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}`);
|
|
11178
11273
|
const prev = items.pop();
|
|
11179
|
-
if (prev &&
|
|
11274
|
+
if (prev && React132.isValidElement(prev)) {
|
|
11180
11275
|
items.push(
|
|
11181
11276
|
/* @__PURE__ */ jsxs("li", { children: [
|
|
11182
11277
|
prev.props.children,
|
|
@@ -11273,7 +11368,7 @@ var CARD_CTA = {
|
|
|
11273
11368
|
function useConnectorJourney(card) {
|
|
11274
11369
|
const panelAvailable = useConnectorsPanelAvailable();
|
|
11275
11370
|
useChatStore((s) => s.setOpen);
|
|
11276
|
-
return
|
|
11371
|
+
return React132.useCallback(() => {
|
|
11277
11372
|
if (panelAvailable && card.id) {
|
|
11278
11373
|
openConnectorsPanel({ id: card.id });
|
|
11279
11374
|
return;
|
|
@@ -11363,7 +11458,7 @@ function ConnectorSuggestionRow({ card }) {
|
|
|
11363
11458
|
] });
|
|
11364
11459
|
}
|
|
11365
11460
|
function ConnectorSuggestionGroup({ cards }) {
|
|
11366
|
-
const shelves =
|
|
11461
|
+
const shelves = React132.useMemo(() => shelveByCategory(cards), [cards]);
|
|
11367
11462
|
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: [
|
|
11368
11463
|
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 }),
|
|
11369
11464
|
/* @__PURE__ */ jsx("div", { className: "divide-y divide-border/40", children: shelf.items.map((card) => /* @__PURE__ */ jsx(ConnectorSuggestionRow, { card }, card.slug ?? card.id ?? card.name)) })
|
|
@@ -11373,8 +11468,8 @@ function ChoiceCard({ card }) {
|
|
|
11373
11468
|
const queuePrompt = useChatStore((s) => s.queuePrompt);
|
|
11374
11469
|
const isStreaming = useChatStore((s) => s.isStreaming);
|
|
11375
11470
|
const messages = useChatStore((s) => s.messages);
|
|
11376
|
-
const [optimistic, setOptimistic] =
|
|
11377
|
-
const answeredInThread =
|
|
11471
|
+
const [optimistic, setOptimistic] = React132.useState(null);
|
|
11472
|
+
const answeredInThread = React132.useMemo(
|
|
11378
11473
|
() => answeredOptionId(messages, card.options),
|
|
11379
11474
|
[messages, card.options]
|
|
11380
11475
|
);
|
|
@@ -11429,7 +11524,7 @@ function humanizeToolName(name) {
|
|
|
11429
11524
|
}
|
|
11430
11525
|
function ToolCallRow({ call: call2 }) {
|
|
11431
11526
|
const { t } = useTranslation$1();
|
|
11432
|
-
const [open, setOpen] =
|
|
11527
|
+
const [open, setOpen] = React132.useState(false);
|
|
11433
11528
|
const failed = call2.declined || /"error"\s*:/.test(call2.result ?? "");
|
|
11434
11529
|
return /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-xl border border-border/50 bg-muted/30", children: [
|
|
11435
11530
|
/* @__PURE__ */ jsxs(
|
|
@@ -11506,15 +11601,15 @@ function HandoffNotice({ notice }) {
|
|
|
11506
11601
|
}
|
|
11507
11602
|
function MessageBubble({ message, isPending }) {
|
|
11508
11603
|
const isUser = message.role === "user";
|
|
11509
|
-
const connectorCards =
|
|
11604
|
+
const connectorCards = React132.useMemo(
|
|
11510
11605
|
() => (message.cards ?? []).filter((card) => card.kind === "connector"),
|
|
11511
11606
|
[message.cards]
|
|
11512
11607
|
);
|
|
11513
|
-
const choiceCards =
|
|
11608
|
+
const choiceCards = React132.useMemo(
|
|
11514
11609
|
() => (message.cards ?? []).filter((card) => card.kind === "choice"),
|
|
11515
11610
|
[message.cards]
|
|
11516
11611
|
);
|
|
11517
|
-
const routedLinks =
|
|
11612
|
+
const routedLinks = React132.useMemo(
|
|
11518
11613
|
() => (message.links ?? []).filter(
|
|
11519
11614
|
(l) => !!l.path || !!resolveEntityRoute(l.archetype, l.kind, l.entityKey)
|
|
11520
11615
|
),
|
|
@@ -11605,9 +11700,9 @@ function ConfirmActionCard({
|
|
|
11605
11700
|
onResolveAll
|
|
11606
11701
|
}) {
|
|
11607
11702
|
const { t } = useTranslation$1();
|
|
11608
|
-
const schema =
|
|
11703
|
+
const schema = React132.useMemo(() => action.fields ?? [], [action.fields]);
|
|
11609
11704
|
const partial = action.partial === true;
|
|
11610
|
-
const seedValues =
|
|
11705
|
+
const seedValues = React132.useCallback(
|
|
11611
11706
|
(params) => {
|
|
11612
11707
|
if (partial) return { ...params };
|
|
11613
11708
|
const seeded = {};
|
|
@@ -11616,18 +11711,18 @@ function ConfirmActionCard({
|
|
|
11616
11711
|
},
|
|
11617
11712
|
[schema, partial]
|
|
11618
11713
|
);
|
|
11619
|
-
const [values, setValues] =
|
|
11620
|
-
const [showAll, setShowAll] =
|
|
11714
|
+
const [values, setValues] = React132.useState(() => seedValues(action.params));
|
|
11715
|
+
const [showAll, setShowAll] = React132.useState(false);
|
|
11621
11716
|
const batch = Math.max(0, sameToolQueued);
|
|
11622
|
-
|
|
11717
|
+
React132.useEffect(() => setValues(seedValues(action.params)), [action.params, seedValues]);
|
|
11623
11718
|
const isSet = (v) => v !== void 0 && v !== null && v !== "";
|
|
11624
|
-
const primaryKeys =
|
|
11719
|
+
const primaryKeys = React132.useMemo(() => {
|
|
11625
11720
|
const keys = Object.keys(action.params).filter((k) => isSet(action.params[k]));
|
|
11626
11721
|
if (partial) return keys;
|
|
11627
11722
|
for (const f of schema) if (f.required && !keys.includes(f.key)) keys.push(f.key);
|
|
11628
11723
|
return keys;
|
|
11629
11724
|
}, [action.params, schema, partial]);
|
|
11630
|
-
const extraKeys =
|
|
11725
|
+
const extraKeys = React132.useMemo(
|
|
11631
11726
|
() => schema.map((f) => f.key).filter((k) => !primaryKeys.includes(k) && k !== "id"),
|
|
11632
11727
|
[schema, primaryKeys]
|
|
11633
11728
|
);
|
|
@@ -11654,20 +11749,20 @@ function ConfirmActionCard({
|
|
|
11654
11749
|
if (sharedLabel !== shared) return sharedLabel;
|
|
11655
11750
|
return humanizeKey(key);
|
|
11656
11751
|
};
|
|
11657
|
-
const missingRequiredKeys =
|
|
11752
|
+
const missingRequiredKeys = React132.useMemo(
|
|
11658
11753
|
() => partial ? [] : schema.filter((f) => f.required && !isSet(values[f.key])).map((f) => f.key),
|
|
11659
11754
|
[schema, values, partial]
|
|
11660
11755
|
);
|
|
11661
11756
|
const canConfirm = missingRequiredKeys.length === 0;
|
|
11662
|
-
const submitted =
|
|
11757
|
+
const submitted = React132.useCallback(
|
|
11663
11758
|
() => partial ? Object.fromEntries(Object.entries(values).filter(([, v]) => isSet(v))) : values,
|
|
11664
11759
|
[partial, values]
|
|
11665
11760
|
);
|
|
11666
|
-
const approve =
|
|
11761
|
+
const approve = React132.useCallback(() => {
|
|
11667
11762
|
if (canConfirm) onResolve(true, submitted());
|
|
11668
11763
|
}, [canConfirm, onResolve, submitted]);
|
|
11669
|
-
const decline =
|
|
11670
|
-
const approveAlways =
|
|
11764
|
+
const decline = React132.useCallback(() => onResolve(false), [onResolve]);
|
|
11765
|
+
const approveAlways = React132.useCallback(() => {
|
|
11671
11766
|
if (!canConfirm) return;
|
|
11672
11767
|
grantAutoApproval({
|
|
11673
11768
|
toolName: action.toolName,
|
|
@@ -11677,7 +11772,7 @@ function ConfirmActionCard({
|
|
|
11677
11772
|
});
|
|
11678
11773
|
onResolve(true, submitted());
|
|
11679
11774
|
}, [canConfirm, action.toolName, action.scope, ruleLabel, destructive, onResolve, submitted]);
|
|
11680
|
-
|
|
11775
|
+
React132.useEffect(() => {
|
|
11681
11776
|
const handler = (event) => {
|
|
11682
11777
|
const target = event.target;
|
|
11683
11778
|
const typing = target?.tagName === "INPUT" || target?.tagName === "TEXTAREA" || target?.tagName === "SELECT";
|
|
@@ -12014,8 +12109,8 @@ var TYPE_MS = 620;
|
|
|
12014
12109
|
var MIN_CHAR_MS = 12;
|
|
12015
12110
|
var MAX_CHAR_MS = 34;
|
|
12016
12111
|
function usePrefersReducedMotion() {
|
|
12017
|
-
const [reduced, setReduced] =
|
|
12018
|
-
|
|
12112
|
+
const [reduced, setReduced] = React132.useState(false);
|
|
12113
|
+
React132.useEffect(() => {
|
|
12019
12114
|
if (typeof matchMedia !== "function") return;
|
|
12020
12115
|
const query = matchMedia("(prefers-reduced-motion: reduce)");
|
|
12021
12116
|
const sync = () => setReduced(query.matches);
|
|
@@ -12034,10 +12129,10 @@ function TypedText({
|
|
|
12034
12129
|
onDone
|
|
12035
12130
|
}) {
|
|
12036
12131
|
const reduced = usePrefersReducedMotion();
|
|
12037
|
-
const [count, setCount] =
|
|
12038
|
-
const done =
|
|
12132
|
+
const [count, setCount] = React132.useState(reduced ? text2.length : 0);
|
|
12133
|
+
const done = React132.useRef(onDone);
|
|
12039
12134
|
done.current = onDone;
|
|
12040
|
-
|
|
12135
|
+
React132.useEffect(() => {
|
|
12041
12136
|
if (!start) {
|
|
12042
12137
|
setCount(0);
|
|
12043
12138
|
return;
|
|
@@ -12077,9 +12172,9 @@ function RevealSequence({
|
|
|
12077
12172
|
children
|
|
12078
12173
|
}) {
|
|
12079
12174
|
const reduced = usePrefersReducedMotion();
|
|
12080
|
-
const items =
|
|
12081
|
-
const [shown, setShown] =
|
|
12082
|
-
|
|
12175
|
+
const items = React132.Children.toArray(children);
|
|
12176
|
+
const [shown, setShown] = React132.useState(0);
|
|
12177
|
+
React132.useEffect(() => {
|
|
12083
12178
|
if (!start) {
|
|
12084
12179
|
setShown(0);
|
|
12085
12180
|
return;
|
|
@@ -12141,7 +12236,7 @@ function UpgradePrompt({ feature, inline, className }) {
|
|
|
12141
12236
|
const currentPlan = plans.find((p) => p.id === currentPlanId);
|
|
12142
12237
|
const currentPrice = currentPlan?.price ?? 0;
|
|
12143
12238
|
const currentPlanName = currentPlan?.name ?? tr("billing.free", "Free");
|
|
12144
|
-
const featureName =
|
|
12239
|
+
const featureName = React132.useMemo(() => {
|
|
12145
12240
|
if (!feature) return null;
|
|
12146
12241
|
const label3 = features.find((f) => f.id === feature)?.label;
|
|
12147
12242
|
if (label3) return featureDisplayName(label3);
|
|
@@ -12149,7 +12244,7 @@ function UpgradePrompt({ feature, inline, className }) {
|
|
|
12149
12244
|
const named = t(key);
|
|
12150
12245
|
return named && named !== key ? named : featureDisplayName(feature);
|
|
12151
12246
|
}, [features, feature, t]);
|
|
12152
|
-
const unlockingPlans =
|
|
12247
|
+
const unlockingPlans = React132.useMemo(
|
|
12153
12248
|
() => plans.filter((p) => p.id !== currentPlanId && p.price > currentPrice && planUnlocks(p, feature)).sort((a, b) => a.price - b.price),
|
|
12154
12249
|
[plans, currentPlanId, currentPrice, feature]
|
|
12155
12250
|
);
|
|
@@ -12331,26 +12426,26 @@ function ChatConversation({
|
|
|
12331
12426
|
usable && !pendingAction && !isStreaming,
|
|
12332
12427
|
receiveFiles
|
|
12333
12428
|
);
|
|
12334
|
-
|
|
12335
|
-
const [view, setView] =
|
|
12429
|
+
React132.useEffect(ensureIntroStyles, []);
|
|
12430
|
+
const [view, setView] = React132.useState(
|
|
12336
12431
|
() => useChatStore.getState().messages.length > 0 ? "thread" : "list"
|
|
12337
12432
|
);
|
|
12338
|
-
const [drawer, setDrawer] =
|
|
12339
|
-
const [introStep, setIntroStep] =
|
|
12340
|
-
const [atBottom, setAtBottom] =
|
|
12341
|
-
const scrollRef =
|
|
12433
|
+
const [drawer, setDrawer] = React132.useState("none");
|
|
12434
|
+
const [introStep, setIntroStep] = React132.useState(0);
|
|
12435
|
+
const [atBottom, setAtBottom] = React132.useState(true);
|
|
12436
|
+
const scrollRef = React132.useRef(null);
|
|
12342
12437
|
const hasMessages = messages.length > 0;
|
|
12343
12438
|
const showThread = view === "thread" && hasMessages;
|
|
12344
12439
|
const totalTools = toolGroups.reduce((sum, g) => sum + g.tools.length, 0);
|
|
12345
|
-
const scrollToBottom =
|
|
12440
|
+
const scrollToBottom = React132.useCallback((behavior = "smooth") => {
|
|
12346
12441
|
const el = scrollRef.current;
|
|
12347
12442
|
if (!el) return;
|
|
12348
12443
|
el.scrollTo({ top: el.scrollHeight, behavior });
|
|
12349
12444
|
}, []);
|
|
12350
|
-
|
|
12445
|
+
React132.useEffect(() => {
|
|
12351
12446
|
if (atBottom) scrollToBottom();
|
|
12352
12447
|
}, [messages, activeTools, pendingAction, atBottom, scrollToBottom]);
|
|
12353
|
-
|
|
12448
|
+
React132.useEffect(() => {
|
|
12354
12449
|
loadConversations();
|
|
12355
12450
|
setSuggestionsOpen(useChatStore.getState().messages.length === 0);
|
|
12356
12451
|
return () => stopSpeaking();
|
|
@@ -12367,7 +12462,7 @@ function ChatConversation({
|
|
|
12367
12462
|
};
|
|
12368
12463
|
const queuedPrompt = useChatStore((s) => s.queuedPrompt);
|
|
12369
12464
|
const consumeQueuedPrompt = useChatStore((s) => s.consumeQueuedPrompt);
|
|
12370
|
-
|
|
12465
|
+
React132.useEffect(() => {
|
|
12371
12466
|
if (!queuedPrompt) return;
|
|
12372
12467
|
const prompt = consumeQueuedPrompt();
|
|
12373
12468
|
if (prompt && usable) send(prompt);
|
|
@@ -12403,7 +12498,7 @@ function ChatConversation({
|
|
|
12403
12498
|
);
|
|
12404
12499
|
const connectorsPending = useConnectorsSurface((s) => s.pending);
|
|
12405
12500
|
const consumeConnectorsRequest = useConnectorsSurface((s) => s.consume);
|
|
12406
|
-
|
|
12501
|
+
React132.useEffect(() => {
|
|
12407
12502
|
if (!connectorsPending) return;
|
|
12408
12503
|
setDrawer("connectors");
|
|
12409
12504
|
consumeConnectorsRequest();
|
|
@@ -12411,7 +12506,7 @@ function ChatConversation({
|
|
|
12411
12506
|
const greetingName = (user?.fullName || user?.email || "").split(/[\s@]/)[0];
|
|
12412
12507
|
const invite = useAssistantInviteStore((s) => s.invite);
|
|
12413
12508
|
const introKey = `${onDuty?.role ?? "solo"}:${invite?.id ?? ""}`;
|
|
12414
|
-
|
|
12509
|
+
React132.useEffect(() => setIntroStep(0), [introKey]);
|
|
12415
12510
|
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");
|
|
12416
12511
|
const greetingHint = invite?.description ?? onDuty?.goal ?? t("chat.greetingHint");
|
|
12417
12512
|
const openers2 = invite?.suggestions?.length ? invite.suggestions : onDuty?.suggestions?.length ? onDuty.suggestions : suggestions.length ? suggestions : [
|
|
@@ -12733,7 +12828,7 @@ function AgentAvatar({
|
|
|
12733
12828
|
size = "md",
|
|
12734
12829
|
className
|
|
12735
12830
|
}) {
|
|
12736
|
-
const [failed, setFailed] =
|
|
12831
|
+
const [failed, setFailed] = React132.useState(false);
|
|
12737
12832
|
const { box, text: text2, px } = SIZES[size];
|
|
12738
12833
|
if (Face) {
|
|
12739
12834
|
return /* @__PURE__ */ jsx(
|
|
@@ -13521,7 +13616,7 @@ function TaskStatusGroup({ status, tasks }) {
|
|
|
13521
13616
|
function useDelegateToAssistant() {
|
|
13522
13617
|
const queuePrompt = useChatStore((s) => s.queuePrompt);
|
|
13523
13618
|
const openPanel = useRightRailStore((s) => s.openPanel);
|
|
13524
|
-
return
|
|
13619
|
+
return React132.useCallback(
|
|
13525
13620
|
(prompt) => {
|
|
13526
13621
|
queuePrompt(prompt);
|
|
13527
13622
|
openPanel("chat");
|
|
@@ -13758,12 +13853,12 @@ function TasksPanel() {
|
|
|
13758
13853
|
const fetchTasks = useTasksStore((s) => s.fetchTasks);
|
|
13759
13854
|
const fetchLabels = useTasksStore((s) => s.fetchLabels);
|
|
13760
13855
|
const fetchSummary = useTasksStore((s) => s.fetchSummary);
|
|
13761
|
-
|
|
13856
|
+
React132__default.useEffect(() => {
|
|
13762
13857
|
void fetchTasks();
|
|
13763
13858
|
void fetchLabels();
|
|
13764
13859
|
void fetchSummary();
|
|
13765
13860
|
}, [fetchTasks, fetchLabels, fetchSummary]);
|
|
13766
|
-
const { onboarding, grouped } =
|
|
13861
|
+
const { onboarding, grouped } = React132__default.useMemo(() => {
|
|
13767
13862
|
const split = splitOnboardingTasks(tasks);
|
|
13768
13863
|
const map = /* @__PURE__ */ new Map();
|
|
13769
13864
|
for (const s of STATUS_ORDER) map.set(s, []);
|
|
@@ -13798,7 +13893,7 @@ function TasksPanel() {
|
|
|
13798
13893
|
function useTasksSummaryLine() {
|
|
13799
13894
|
const t = useTranslation();
|
|
13800
13895
|
const summary = useTasksStore((s) => s.summary);
|
|
13801
|
-
return
|
|
13896
|
+
return React132__default.useMemo(() => {
|
|
13802
13897
|
if (!summary) return "";
|
|
13803
13898
|
const parts = [];
|
|
13804
13899
|
if (summary.overdue > 0) parts.push(`${summary.overdue} ${t("tasks.summary.overdue")}`);
|
|
@@ -13823,16 +13918,16 @@ function TasksRailPanel() {
|
|
|
13823
13918
|
const fetchSummary = useTasksStore((s) => s.fetchSummary);
|
|
13824
13919
|
const setCurrentUserId = useTasksStore((s) => s.setCurrentUserId);
|
|
13825
13920
|
const userId = useAuthStore6((s) => s.user?.id);
|
|
13826
|
-
|
|
13921
|
+
React132__default.useEffect(() => {
|
|
13827
13922
|
void fetchSummary();
|
|
13828
13923
|
}, [fetchSummary]);
|
|
13829
|
-
|
|
13924
|
+
React132__default.useEffect(() => {
|
|
13830
13925
|
setCurrentUserId(userId ?? null);
|
|
13831
13926
|
}, [userId, setCurrentUserId]);
|
|
13832
13927
|
const openCount = summary ? summary.todo + summary.inProgress : 0;
|
|
13833
13928
|
const defer = tasksSurfaceOwner() === "plugin";
|
|
13834
13929
|
useRightRailPanel(
|
|
13835
|
-
|
|
13930
|
+
React132__default.useMemo(
|
|
13836
13931
|
() => defer ? null : {
|
|
13837
13932
|
id: "tasks",
|
|
13838
13933
|
label: t("tasks.drawer.title") || "Tasks",
|
|
@@ -13856,15 +13951,15 @@ var useSettingsTabsStore = create((set, get) => ({
|
|
|
13856
13951
|
}));
|
|
13857
13952
|
function usePublishSettingsTabs(ids) {
|
|
13858
13953
|
const key = ids.join(",");
|
|
13859
|
-
|
|
13954
|
+
React132.useEffect(() => {
|
|
13860
13955
|
useSettingsTabsStore.getState().setIds(key ? key.split(",") : []);
|
|
13861
13956
|
}, [key]);
|
|
13862
13957
|
}
|
|
13863
13958
|
function useAgentSurface(contribution) {
|
|
13864
|
-
const ref =
|
|
13959
|
+
const ref = React132.useRef(contribution);
|
|
13865
13960
|
ref.current = contribution;
|
|
13866
13961
|
const id = contribution.id;
|
|
13867
|
-
|
|
13962
|
+
React132.useEffect(() => {
|
|
13868
13963
|
registerSurface({ id, get: () => ref.current });
|
|
13869
13964
|
const names = (ref.current.tools ?? []).map((t) => t.tool.name);
|
|
13870
13965
|
for (const name of names) {
|
|
@@ -14644,9 +14739,9 @@ function featureMap() {
|
|
|
14644
14739
|
}));
|
|
14645
14740
|
}
|
|
14646
14741
|
function ActivationAgentSurface({ programs }) {
|
|
14647
|
-
const programsRef =
|
|
14742
|
+
const programsRef = React132.useRef(programs);
|
|
14648
14743
|
programsRef.current = programs;
|
|
14649
|
-
const contribution =
|
|
14744
|
+
const contribution = React132.useMemo(
|
|
14650
14745
|
() => ({
|
|
14651
14746
|
id: "onboarding.activation",
|
|
14652
14747
|
pluginId: "onboarding",
|
|
@@ -14967,7 +15062,7 @@ Quando a pessoa perguntar COMO fazer algo que tem guia em \`setupGuides\` ("como
|
|
|
14967
15062
|
- Termine dizendo o que isso destrava e oferecendo a pr\xF3xima, uma vez s\xF3.`
|
|
14968
15063
|
);
|
|
14969
15064
|
function SetupAgentSurface() {
|
|
14970
|
-
const contribution =
|
|
15065
|
+
const contribution = React132.useMemo(
|
|
14971
15066
|
() => ({
|
|
14972
15067
|
id: "setup.guides",
|
|
14973
15068
|
pluginId: "setup",
|
|
@@ -15083,7 +15178,7 @@ function SetupAgentSurface() {
|
|
|
15083
15178
|
}
|
|
15084
15179
|
var DEBOUNCE_MS = 1200;
|
|
15085
15180
|
function useActivationWatch() {
|
|
15086
|
-
|
|
15181
|
+
React132.useEffect(() => {
|
|
15087
15182
|
let timer = null;
|
|
15088
15183
|
let running = false;
|
|
15089
15184
|
const sweep = async () => {
|
|
@@ -15122,7 +15217,7 @@ function useActivationWatch() {
|
|
|
15122
15217
|
off();
|
|
15123
15218
|
};
|
|
15124
15219
|
}, []);
|
|
15125
|
-
|
|
15220
|
+
React132.useEffect(() => {
|
|
15126
15221
|
useActivationStore.setState({
|
|
15127
15222
|
onStepCompleted: (step, by) => {
|
|
15128
15223
|
const state = useActivationStore.getState();
|
|
@@ -15779,7 +15874,7 @@ function ActivationProvider() {
|
|
|
15779
15874
|
const programs = runtime?.onboardingPrograms ?? [];
|
|
15780
15875
|
const settingsIds = useSettingsTabsStore((s) => s.ids);
|
|
15781
15876
|
const routeKey = (runtime?.routes.length ?? 0) + ":" + settingsIds.join(",");
|
|
15782
|
-
const hasRoute =
|
|
15877
|
+
const hasRoute = React132.useMemo(() => {
|
|
15783
15878
|
const known = /* @__PURE__ */ new Set(["/", "/settings"]);
|
|
15784
15879
|
for (const route of runtime?.routes ?? []) known.add(route.path);
|
|
15785
15880
|
for (const id of settingsIds) known.add(`/settings/${id}`);
|
|
@@ -15787,14 +15882,14 @@ function ActivationProvider() {
|
|
|
15787
15882
|
}, [routeKey]);
|
|
15788
15883
|
const answers = useBusinessProfileStore((s) => s.profile?.answers);
|
|
15789
15884
|
const programKey = programs.map((p) => p.id).join(",");
|
|
15790
|
-
const catalog =
|
|
15885
|
+
const catalog = React132.useMemo(
|
|
15791
15886
|
() => buildActivationCatalog({ verticalId, programs, hasRoute, answers }),
|
|
15792
15887
|
[verticalId, programKey, hasRoute, answers]
|
|
15793
15888
|
);
|
|
15794
|
-
|
|
15889
|
+
React132.useEffect(() => {
|
|
15795
15890
|
setCatalog(catalog);
|
|
15796
15891
|
}, [catalog, setCatalog]);
|
|
15797
|
-
|
|
15892
|
+
React132.useEffect(() => {
|
|
15798
15893
|
if (!tenantId2) return;
|
|
15799
15894
|
let cancelled = false;
|
|
15800
15895
|
void (async () => {
|
|
@@ -15826,14 +15921,14 @@ function ActivationProvider() {
|
|
|
15826
15921
|
cancelled = true;
|
|
15827
15922
|
};
|
|
15828
15923
|
}, [tenantId2, catalog, answers, hasRoute, settingsIds, user?.id, load]);
|
|
15829
|
-
|
|
15924
|
+
React132.useEffect(() => {
|
|
15830
15925
|
if (!tenantId2) {
|
|
15831
15926
|
useBusinessProfileStore.getState().clear();
|
|
15832
15927
|
return;
|
|
15833
15928
|
}
|
|
15834
15929
|
void useBusinessProfileStore.getState().load(tenantId2, orgName);
|
|
15835
15930
|
}, [tenantId2, orgName]);
|
|
15836
|
-
|
|
15931
|
+
React132.useEffect(() => {
|
|
15837
15932
|
if (!tenantId2) return;
|
|
15838
15933
|
const key = `${GREETING_FLAG}:${tenantId2}`;
|
|
15839
15934
|
let pending2 = false;
|
|
@@ -15855,10 +15950,10 @@ function ActivationProvider() {
|
|
|
15855
15950
|
return () => window.clearTimeout(timer);
|
|
15856
15951
|
}, [tenantId2]);
|
|
15857
15952
|
const guides = runtime?.setupGuides;
|
|
15858
|
-
|
|
15953
|
+
React132.useEffect(() => {
|
|
15859
15954
|
setRuntimeSetupGuides(guides ?? []);
|
|
15860
15955
|
}, [guides]);
|
|
15861
|
-
|
|
15956
|
+
React132.useEffect(() => {
|
|
15862
15957
|
setTourNavigator(navigateTo);
|
|
15863
15958
|
return () => setTourNavigator(void 0);
|
|
15864
15959
|
}, []);
|
|
@@ -16031,7 +16126,7 @@ Escrita:
|
|
|
16031
16126
|
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.`
|
|
16032
16127
|
);
|
|
16033
16128
|
function HandbookAgentSurface() {
|
|
16034
|
-
const contribution =
|
|
16129
|
+
const contribution = React132.useMemo(
|
|
16035
16130
|
() => ({
|
|
16036
16131
|
id: "handbook",
|
|
16037
16132
|
pluginId: "handbook",
|
|
@@ -16142,18 +16237,18 @@ function NotebookPanel() {
|
|
|
16142
16237
|
const userId = useHandbookStore((s) => s.userId);
|
|
16143
16238
|
const write3 = useHandbookStore((s) => s.write);
|
|
16144
16239
|
const remove = useHandbookStore((s) => s.remove);
|
|
16145
|
-
const [filter, setFilter] =
|
|
16146
|
-
const [search, setSearch] =
|
|
16147
|
-
const [draft, setDraft] =
|
|
16148
|
-
const [preview, setPreview] =
|
|
16149
|
-
const [confirming, setConfirming] =
|
|
16150
|
-
const entries2 =
|
|
16240
|
+
const [filter, setFilter] = React132.useState("all");
|
|
16241
|
+
const [search, setSearch] = React132.useState("");
|
|
16242
|
+
const [draft, setDraft] = React132.useState(null);
|
|
16243
|
+
const [preview, setPreview] = React132.useState(false);
|
|
16244
|
+
const [confirming, setConfirming] = React132.useState(null);
|
|
16245
|
+
const entries2 = React132.useMemo(
|
|
16151
16246
|
() => (pages ?? []).map((p) => ({ page: p, entry: toEntry2(p) })),
|
|
16152
16247
|
[pages]
|
|
16153
16248
|
);
|
|
16154
|
-
const timer =
|
|
16155
|
-
const inFlight =
|
|
16156
|
-
const persist =
|
|
16249
|
+
const timer = React132.useRef(null);
|
|
16250
|
+
const inFlight = React132.useRef(false);
|
|
16251
|
+
const persist = React132.useCallback(async (d) => {
|
|
16157
16252
|
const title = titleFromBody(d.body);
|
|
16158
16253
|
if (!title && !d.body.trim()) return d.id;
|
|
16159
16254
|
const filed = d.folder !== null;
|
|
@@ -16175,7 +16270,7 @@ function NotebookPanel() {
|
|
|
16175
16270
|
});
|
|
16176
16271
|
return saved?.id ?? d.id;
|
|
16177
16272
|
}, [write3, userId]);
|
|
16178
|
-
const schedule =
|
|
16273
|
+
const schedule = React132.useCallback((next) => {
|
|
16179
16274
|
setDraft(next);
|
|
16180
16275
|
if (timer.current) clearTimeout(timer.current);
|
|
16181
16276
|
timer.current = setTimeout(() => {
|
|
@@ -16207,7 +16302,7 @@ function NotebookPanel() {
|
|
|
16207
16302
|
legacyId: null
|
|
16208
16303
|
});
|
|
16209
16304
|
};
|
|
16210
|
-
const folders =
|
|
16305
|
+
const folders = React132.useMemo(() => {
|
|
16211
16306
|
const set = /* @__PURE__ */ new Set();
|
|
16212
16307
|
for (const { page } of entries2) {
|
|
16213
16308
|
if (page.kind !== "doc" || !page.path) continue;
|
|
@@ -16599,10 +16694,10 @@ ${body}`
|
|
|
16599
16694
|
}
|
|
16600
16695
|
function NoteTodosSection({ noteId, noteTitle }) {
|
|
16601
16696
|
const adapter = useNotesTasksBridge((s) => s.adapter);
|
|
16602
|
-
const [todos, setTodos] =
|
|
16603
|
-
const [draft, setDraft] =
|
|
16604
|
-
const [busy, setBusy] =
|
|
16605
|
-
|
|
16697
|
+
const [todos, setTodos] = React132.useState([]);
|
|
16698
|
+
const [draft, setDraft] = React132.useState("");
|
|
16699
|
+
const [busy, setBusy] = React132.useState(false);
|
|
16700
|
+
React132.useEffect(() => {
|
|
16606
16701
|
if (!adapter) return;
|
|
16607
16702
|
let alive = true;
|
|
16608
16703
|
adapter.listTodos(noteId).then((rows) => {
|
|
@@ -16732,7 +16827,7 @@ function NotebookRailPanel() {
|
|
|
16732
16827
|
const pages = useHandbookStore((s) => s.pages);
|
|
16733
16828
|
const count = pages?.length ?? 0;
|
|
16734
16829
|
useRightRailPanel(
|
|
16735
|
-
|
|
16830
|
+
React132.useMemo(
|
|
16736
16831
|
() => ({
|
|
16737
16832
|
id: "notes",
|
|
16738
16833
|
label: tl("Notes", "Notas"),
|
|
@@ -16751,10 +16846,10 @@ function HandbookProvider() {
|
|
|
16751
16846
|
const userId = useAuthStore((s) => s.user?.id);
|
|
16752
16847
|
const load = useHandbookStore((s) => s.load);
|
|
16753
16848
|
const setUser = useHandbookStore((s) => s.setUser);
|
|
16754
|
-
|
|
16849
|
+
React132.useEffect(() => {
|
|
16755
16850
|
setUser(userId);
|
|
16756
16851
|
}, [userId, setUser]);
|
|
16757
|
-
|
|
16852
|
+
React132.useEffect(() => {
|
|
16758
16853
|
if (tenantId2) void load(tenantId2);
|
|
16759
16854
|
}, [tenantId2, load]);
|
|
16760
16855
|
useLocalNotesImport(tenantId2, userId);
|
|
@@ -16764,7 +16859,7 @@ function HandbookProvider() {
|
|
|
16764
16859
|
] });
|
|
16765
16860
|
}
|
|
16766
16861
|
function useLocalNotesImport(tenantId2, userId) {
|
|
16767
|
-
|
|
16862
|
+
React132.useEffect(() => {
|
|
16768
16863
|
if (!tenantId2 || !userId) return;
|
|
16769
16864
|
const source = `fayz.notes.${tenantId2}.${userId}`;
|
|
16770
16865
|
const flag = `fayz.notes.imported.${tenantId2}.${userId}`;
|
|
@@ -16812,7 +16907,7 @@ function useUnitBootstrap() {
|
|
|
16812
16907
|
const tenant = useTenantOptional();
|
|
16813
16908
|
const userId = useAuthStore((s) => s.user?.id);
|
|
16814
16909
|
const orgId = tenant?.org?.id;
|
|
16815
|
-
|
|
16910
|
+
React132.useEffect(() => {
|
|
16816
16911
|
if (!orgId) return;
|
|
16817
16912
|
const { loadedFor, load, reset } = useUnitStore.getState();
|
|
16818
16913
|
if (loadedFor && loadedFor !== orgId) reset();
|
|
@@ -16851,19 +16946,19 @@ function UnitMembersTab({ item }) {
|
|
|
16851
16946
|
const orgMembers = useOrganizationStore((s) => s.members);
|
|
16852
16947
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
16853
16948
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
16854
|
-
const [rows, setRows] =
|
|
16855
|
-
const [activity, setActivity] =
|
|
16856
|
-
const [adding, setAdding] =
|
|
16857
|
-
const [busy, setBusy] =
|
|
16858
|
-
const
|
|
16949
|
+
const [rows, setRows] = React132.useState(null);
|
|
16950
|
+
const [activity, setActivity] = React132.useState({});
|
|
16951
|
+
const [adding, setAdding] = React132.useState(false);
|
|
16952
|
+
const [busy, setBusy] = React132.useState(null);
|
|
16953
|
+
const reload2 = React132.useCallback(async () => {
|
|
16859
16954
|
if (!unitId) return;
|
|
16860
16955
|
setRows(await fetchUnitMembers(unitId));
|
|
16861
16956
|
}, [unitId]);
|
|
16862
16957
|
const version5 = useDataVersion(UNIT_ACCESS_CHANGED);
|
|
16863
|
-
|
|
16864
|
-
void
|
|
16865
|
-
}, [
|
|
16866
|
-
|
|
16958
|
+
React132.useEffect(() => {
|
|
16959
|
+
void reload2();
|
|
16960
|
+
}, [reload2, version5]);
|
|
16961
|
+
React132.useEffect(() => {
|
|
16867
16962
|
if (!orgId) return;
|
|
16868
16963
|
let alive = true;
|
|
16869
16964
|
void fetchMemberActivity(orgId).then((a) => {
|
|
@@ -16873,7 +16968,7 @@ function UnitMembersTab({ item }) {
|
|
|
16873
16968
|
alive = false;
|
|
16874
16969
|
};
|
|
16875
16970
|
}, [orgId]);
|
|
16876
|
-
const byUser =
|
|
16971
|
+
const byUser = React132.useMemo(() => {
|
|
16877
16972
|
const map = /* @__PURE__ */ new Map();
|
|
16878
16973
|
for (const m of orgMembers) {
|
|
16879
16974
|
map.set(m.userId, {
|
|
@@ -16885,7 +16980,7 @@ function UnitMembersTab({ item }) {
|
|
|
16885
16980
|
}
|
|
16886
16981
|
return map;
|
|
16887
16982
|
}, [orgMembers]);
|
|
16888
|
-
const available =
|
|
16983
|
+
const available = React132.useMemo(
|
|
16889
16984
|
() => orgMembers.filter((m) => !(rows ?? []).some((r) => r.userId === m.userId)),
|
|
16890
16985
|
[orgMembers, rows]
|
|
16891
16986
|
);
|
|
@@ -16893,7 +16988,7 @@ function UnitMembersTab({ item }) {
|
|
|
16893
16988
|
setBusy(userId);
|
|
16894
16989
|
try {
|
|
16895
16990
|
await fn();
|
|
16896
|
-
await
|
|
16991
|
+
await reload2();
|
|
16897
16992
|
} catch (err) {
|
|
16898
16993
|
toast.error(failure, { description: err?.message });
|
|
16899
16994
|
} finally {
|
|
@@ -17091,15 +17186,15 @@ function MemberAccessBody({
|
|
|
17091
17186
|
const units = useUnitStore((s) => s.units);
|
|
17092
17187
|
const byId = useUnitStore((s) => s.byId);
|
|
17093
17188
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
17094
|
-
const [bindings, setBindings] =
|
|
17095
|
-
const [loading, setLoading] =
|
|
17096
|
-
const [adding, setAdding] =
|
|
17097
|
-
const branches =
|
|
17098
|
-
const unbound =
|
|
17189
|
+
const [bindings, setBindings] = React132.useState([]);
|
|
17190
|
+
const [loading, setLoading] = React132.useState(false);
|
|
17191
|
+
const [adding, setAdding] = React132.useState(false);
|
|
17192
|
+
const branches = React132.useMemo(() => units.filter((u) => u.isActive !== false), [units]);
|
|
17193
|
+
const unbound = React132.useMemo(
|
|
17099
17194
|
() => branches.filter((u) => !bindings.some((b) => b.locationId === u.id)),
|
|
17100
17195
|
[branches, bindings]
|
|
17101
17196
|
);
|
|
17102
|
-
const
|
|
17197
|
+
const reload2 = React132.useCallback(async () => {
|
|
17103
17198
|
if (!userId) return;
|
|
17104
17199
|
setLoading(true);
|
|
17105
17200
|
try {
|
|
@@ -17109,13 +17204,13 @@ function MemberAccessBody({
|
|
|
17109
17204
|
}
|
|
17110
17205
|
}, [userId]);
|
|
17111
17206
|
const version5 = useDataVersion(UNIT_ACCESS_CHANGED);
|
|
17112
|
-
|
|
17113
|
-
void
|
|
17114
|
-
}, [
|
|
17207
|
+
React132.useEffect(() => {
|
|
17208
|
+
void reload2();
|
|
17209
|
+
}, [reload2, version5]);
|
|
17115
17210
|
async function add(unitId) {
|
|
17116
17211
|
try {
|
|
17117
17212
|
await bindUserToUnit(unitId, userId, null);
|
|
17118
|
-
await
|
|
17213
|
+
await reload2();
|
|
17119
17214
|
setAdding(false);
|
|
17120
17215
|
} catch (err) {
|
|
17121
17216
|
toast.error("N\xE3o deu para dar o acesso", { description: err?.message });
|
|
@@ -17124,7 +17219,7 @@ function MemberAccessBody({
|
|
|
17124
17219
|
async function setRole(unitId, role) {
|
|
17125
17220
|
try {
|
|
17126
17221
|
await bindUserToUnit(unitId, userId, role === NO_EXTRA_ROLE2 ? null : role);
|
|
17127
|
-
await
|
|
17222
|
+
await reload2();
|
|
17128
17223
|
} catch (err) {
|
|
17129
17224
|
toast.error("N\xE3o deu para mudar a fun\xE7\xE3o", { description: err?.message });
|
|
17130
17225
|
}
|
|
@@ -17132,7 +17227,7 @@ function MemberAccessBody({
|
|
|
17132
17227
|
async function remove(unitId) {
|
|
17133
17228
|
try {
|
|
17134
17229
|
await unbindUserFromUnit(unitId, userId);
|
|
17135
|
-
await
|
|
17230
|
+
await reload2();
|
|
17136
17231
|
} catch (err) {
|
|
17137
17232
|
toast.error("N\xE3o deu para tirar o acesso", { description: err?.message });
|
|
17138
17233
|
}
|
|
@@ -17846,14 +17941,14 @@ function minutesLeft(expiresAt) {
|
|
|
17846
17941
|
}
|
|
17847
17942
|
function ImpersonationBanner() {
|
|
17848
17943
|
const { t } = useTranslation$1();
|
|
17849
|
-
const [state] =
|
|
17850
|
-
const [left, setLeft] =
|
|
17851
|
-
const [leaving, setLeaving] =
|
|
17852
|
-
const leave =
|
|
17944
|
+
const [state] = React132__default.useState(readImpersonation);
|
|
17945
|
+
const [left, setLeft] = React132__default.useState(() => state ? minutesLeft(state.expiresAt) : 0);
|
|
17946
|
+
const [leaving, setLeaving] = React132__default.useState(false);
|
|
17947
|
+
const leave = React132__default.useCallback(() => {
|
|
17853
17948
|
setLeaving(true);
|
|
17854
17949
|
void stopImpersonation();
|
|
17855
17950
|
}, []);
|
|
17856
|
-
|
|
17951
|
+
React132__default.useEffect(() => {
|
|
17857
17952
|
if (!state) return;
|
|
17858
17953
|
document.documentElement.classList.add("fz-has-top-strip");
|
|
17859
17954
|
const timer = window.setInterval(() => {
|
|
@@ -17897,12 +17992,55 @@ function ImpersonationBanner() {
|
|
|
17897
17992
|
}
|
|
17898
17993
|
);
|
|
17899
17994
|
}
|
|
17995
|
+
function ConnectionBanner() {
|
|
17996
|
+
const { t } = useTranslation$1();
|
|
17997
|
+
const { online } = useConnectivity();
|
|
17998
|
+
const wasOffline = React132__default.useRef(false);
|
|
17999
|
+
React132__default.useEffect(() => {
|
|
18000
|
+
if (!online) {
|
|
18001
|
+
wasOffline.current = true;
|
|
18002
|
+
document.documentElement.classList.add("fz-has-top-strip");
|
|
18003
|
+
return () => {
|
|
18004
|
+
if (!readImpersonation()) document.documentElement.classList.remove("fz-has-top-strip");
|
|
18005
|
+
};
|
|
18006
|
+
}
|
|
18007
|
+
if (wasOffline.current) {
|
|
18008
|
+
wasOffline.current = false;
|
|
18009
|
+
toast.success(t("connection.restored"), { description: t("connection.restoredDetail"), id: "connection-restored" });
|
|
18010
|
+
}
|
|
18011
|
+
return void 0;
|
|
18012
|
+
}, [online, t]);
|
|
18013
|
+
if (online) return null;
|
|
18014
|
+
return /* @__PURE__ */ jsxs(
|
|
18015
|
+
"div",
|
|
18016
|
+
{
|
|
18017
|
+
role: "status",
|
|
18018
|
+
"aria-live": "polite",
|
|
18019
|
+
className: "flex h-8 items-center justify-center gap-2 bg-warning px-3 text-xs font-medium text-warning-foreground",
|
|
18020
|
+
"data-testid": "connection-banner",
|
|
18021
|
+
children: [
|
|
18022
|
+
/* @__PURE__ */ jsx(WifiOff, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": true }),
|
|
18023
|
+
/* @__PURE__ */ jsxs("span", { className: "truncate", children: [
|
|
18024
|
+
t("connection.offline"),
|
|
18025
|
+
/* @__PURE__ */ jsxs("span", { className: "hidden opacity-80 md:inline", children: [
|
|
18026
|
+
" ",
|
|
18027
|
+
t("connection.offlineDetail")
|
|
18028
|
+
] })
|
|
18029
|
+
] }),
|
|
18030
|
+
/* @__PURE__ */ jsxs("span", { className: "ml-1 hidden shrink-0 items-center gap-1 opacity-80 sm:inline-flex", children: [
|
|
18031
|
+
/* @__PURE__ */ jsx(Loader2, { className: "h-3 w-3 animate-spin", "aria-hidden": true }),
|
|
18032
|
+
t("connection.reconnecting")
|
|
18033
|
+
] })
|
|
18034
|
+
]
|
|
18035
|
+
}
|
|
18036
|
+
);
|
|
18037
|
+
}
|
|
17900
18038
|
function useWrongApp() {
|
|
17901
18039
|
const apps = useAppConfigStore((s) => s.config.apps);
|
|
17902
18040
|
const tenantId2 = useAppConfigStore((s) => s.tenantId);
|
|
17903
18041
|
const activeTenantId = useOrganizationStore((s) => s.currentOrg?.id ?? null);
|
|
17904
18042
|
const appId = resolveAppId();
|
|
17905
|
-
return
|
|
18043
|
+
return React132.useMemo(() => {
|
|
17906
18044
|
if (!appId || !activeTenantId || tenantId2 !== activeTenantId) return { app: null };
|
|
17907
18045
|
const list = (apps ?? []).filter((a) => !a.house);
|
|
17908
18046
|
if (!list.length) return { app: null };
|
|
@@ -18025,13 +18163,13 @@ function surveyTokenFromPath(pathname) {
|
|
|
18025
18163
|
return m ? decodeURIComponent(m[1]) : null;
|
|
18026
18164
|
}
|
|
18027
18165
|
function PublicSurveyPage({ token, appName }) {
|
|
18028
|
-
const [loaded2, setLoaded] =
|
|
18029
|
-
const [draft, setDraft] =
|
|
18030
|
-
const [name, setName] =
|
|
18031
|
-
const [sending, setSending] =
|
|
18032
|
-
const [sent, setSent] =
|
|
18033
|
-
const [failed, setFailed] =
|
|
18034
|
-
|
|
18166
|
+
const [loaded2, setLoaded] = React132__default.useState(null);
|
|
18167
|
+
const [draft, setDraft] = React132__default.useState({});
|
|
18168
|
+
const [name, setName] = React132__default.useState("");
|
|
18169
|
+
const [sending, setSending] = React132__default.useState(false);
|
|
18170
|
+
const [sent, setSent] = React132__default.useState(null);
|
|
18171
|
+
const [failed, setFailed] = React132__default.useState(null);
|
|
18172
|
+
React132__default.useEffect(() => {
|
|
18035
18173
|
let alive = true;
|
|
18036
18174
|
const client3 = getFayzSupabaseClientOptional();
|
|
18037
18175
|
if (!client3) {
|
|
@@ -18329,7 +18467,7 @@ function isServed2(route) {
|
|
|
18329
18467
|
function getPersonActions(kind) {
|
|
18330
18468
|
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));
|
|
18331
18469
|
}
|
|
18332
|
-
var RouteErrorBoundary = class extends
|
|
18470
|
+
var RouteErrorBoundary = class extends React132.Component {
|
|
18333
18471
|
constructor() {
|
|
18334
18472
|
super(...arguments);
|
|
18335
18473
|
this.state = { crashed: false, report: null };
|
|
@@ -18371,7 +18509,7 @@ var RouteErrorBoundary = class extends React130.Component {
|
|
|
18371
18509
|
}
|
|
18372
18510
|
};
|
|
18373
18511
|
function RouteErrorScreen({ report, tr, onBack, onRetry, backLabel }) {
|
|
18374
|
-
const [copied, setCopied] =
|
|
18512
|
+
const [copied, setCopied] = React132.useState(false);
|
|
18375
18513
|
const copyDetails = () => {
|
|
18376
18514
|
if (!report || typeof navigator === "undefined" || !navigator.clipboard) return;
|
|
18377
18515
|
const details = [
|
|
@@ -18476,9 +18614,9 @@ function UnitSwitching({ unitName, isAll, onDone }) {
|
|
|
18476
18614
|
const v = t(key);
|
|
18477
18615
|
return !v || v === key ? fallback : v;
|
|
18478
18616
|
};
|
|
18479
|
-
const doneRef =
|
|
18617
|
+
const doneRef = React132.useRef(onDone);
|
|
18480
18618
|
doneRef.current = onDone;
|
|
18481
|
-
|
|
18619
|
+
React132.useEffect(() => {
|
|
18482
18620
|
const id = window.setTimeout(() => doneRef.current(), HOLD_MS);
|
|
18483
18621
|
return () => window.clearTimeout(id);
|
|
18484
18622
|
}, []);
|
|
@@ -18535,11 +18673,11 @@ function UnitPickerDialog() {
|
|
|
18535
18673
|
const myUnitIds = useUnitStore((s) => s.myUnitIds);
|
|
18536
18674
|
const activeUnitId = useUnitStore((s) => s.activeUnitId);
|
|
18537
18675
|
const beginSwitch = useUnitSwitchingStore((s) => s.begin);
|
|
18538
|
-
const reachable =
|
|
18676
|
+
const reachable = React132.useMemo(
|
|
18539
18677
|
() => myUnitIds.length > 0 ? myUnitIds : units.filter((u) => u.kind !== "region").map((u) => u.id),
|
|
18540
18678
|
[myUnitIds, units]
|
|
18541
18679
|
);
|
|
18542
|
-
const groups =
|
|
18680
|
+
const groups = React132.useMemo(() => {
|
|
18543
18681
|
const out = [];
|
|
18544
18682
|
if (reachable.length > 1) {
|
|
18545
18683
|
out.push({ id: "_all", options: [{ id: ALL_UNITS, label: "Todas as unidades" }] });
|
|
@@ -18738,16 +18876,16 @@ function WorkspaceSetupFlow({
|
|
|
18738
18876
|
const user = useAuthStore((s) => s.user);
|
|
18739
18877
|
const { switchOrg } = useTenant();
|
|
18740
18878
|
const closeSetup = useWorkspaceSetupStore((s) => s.close);
|
|
18741
|
-
const uploadLogo =
|
|
18879
|
+
const uploadLogo = React132.useMemo(
|
|
18742
18880
|
() => user ? createLogoUploader(user.id) : void 0,
|
|
18743
18881
|
[user?.id]
|
|
18744
18882
|
);
|
|
18745
|
-
const country =
|
|
18883
|
+
const country = React132.useMemo(
|
|
18746
18884
|
() => currency === "BRL" || (locale ?? "").toLowerCase().startsWith("pt") ? "BR" : void 0,
|
|
18747
18885
|
[currency, locale]
|
|
18748
18886
|
);
|
|
18749
|
-
const stepsRef =
|
|
18750
|
-
const analyzeSite =
|
|
18887
|
+
const stepsRef = React132.useRef([]);
|
|
18888
|
+
const analyzeSite = React132.useMemo(
|
|
18751
18889
|
() => createSiteAnalyzer({
|
|
18752
18890
|
apiBaseUrl: resolveFayzApiBaseUrl(),
|
|
18753
18891
|
steps: () => stepsRef.current,
|
|
@@ -18755,7 +18893,7 @@ function WorkspaceSetupFlow({
|
|
|
18755
18893
|
}),
|
|
18756
18894
|
[locale]
|
|
18757
18895
|
);
|
|
18758
|
-
const steps =
|
|
18896
|
+
const steps = React132.useMemo(
|
|
18759
18897
|
() => buildWorkspaceSetupSteps({
|
|
18760
18898
|
verticalId,
|
|
18761
18899
|
uploadLogo,
|
|
@@ -18767,13 +18905,13 @@ function WorkspaceSetupFlow({
|
|
|
18767
18905
|
[verticalId, uploadLogo, media, country, analyzeSite]
|
|
18768
18906
|
);
|
|
18769
18907
|
stepsRef.current = steps;
|
|
18770
|
-
const initialValues2 =
|
|
18908
|
+
const initialValues2 = React132.useMemo(
|
|
18771
18909
|
// Seeding the contact email with the account's own is one field fewer to
|
|
18772
18910
|
// type, and it is right far more often than it is wrong.
|
|
18773
18911
|
() => user?.email ? { "workspace.email": user.email } : {},
|
|
18774
18912
|
[user?.email]
|
|
18775
18913
|
);
|
|
18776
|
-
const onSubmit =
|
|
18914
|
+
const onSubmit = React132.useCallback(
|
|
18777
18915
|
async (values) => {
|
|
18778
18916
|
if (!user) throw new Error(tl("You are signed out.", "Sua sess\xE3o terminou."));
|
|
18779
18917
|
const org = await submitWorkspaceSetup({
|
|
@@ -18890,16 +19028,16 @@ function GettingStartedWidget() {
|
|
|
18890
19028
|
const t = useTranslation();
|
|
18891
19029
|
const rows = useActivationStore((s) => s.rows);
|
|
18892
19030
|
const catalog = useActivationStore((s) => s.catalog);
|
|
18893
|
-
const steps =
|
|
19031
|
+
const steps = React132.useMemo(
|
|
18894
19032
|
() => selectSteps({ ...useActivationStore.getState(), rows, catalog }),
|
|
18895
19033
|
[rows, catalog]
|
|
18896
19034
|
);
|
|
18897
|
-
const onNavigate =
|
|
19035
|
+
const onNavigate = React132.useCallback((path) => {
|
|
18898
19036
|
const step = useActivationStore.getState().catalog.find((s) => s.route === path);
|
|
18899
19037
|
navigateTo(path);
|
|
18900
19038
|
if (step?.tour) useTourStore.getState().start(step.tour);
|
|
18901
19039
|
}, []);
|
|
18902
|
-
const onAskAgent =
|
|
19040
|
+
const onAskAgent = React132.useCallback((step) => {
|
|
18903
19041
|
void startGuidedRun(step.id);
|
|
18904
19042
|
}, []);
|
|
18905
19043
|
if (!rows || rows.length === 0) return null;
|
|
@@ -18924,16 +19062,16 @@ function ActivationChecklistCard({
|
|
|
18924
19062
|
}) {
|
|
18925
19063
|
const rows = useActivationStore((s) => s.rows);
|
|
18926
19064
|
const catalog = useActivationStore((s) => s.catalog);
|
|
18927
|
-
const steps =
|
|
19065
|
+
const steps = React132.useMemo(
|
|
18928
19066
|
() => selectSteps({ ...useActivationStore.getState(), rows, catalog }),
|
|
18929
19067
|
[rows, catalog]
|
|
18930
19068
|
);
|
|
18931
|
-
const onNavigate =
|
|
19069
|
+
const onNavigate = React132.useCallback((path) => {
|
|
18932
19070
|
const step = useActivationStore.getState().catalog.find((s) => s.route === path);
|
|
18933
19071
|
navigateTo(path);
|
|
18934
19072
|
if (step?.tour) useTourStore.getState().start(step.tour);
|
|
18935
19073
|
}, []);
|
|
18936
|
-
const onAskAgent =
|
|
19074
|
+
const onAskAgent = React132.useCallback((step) => {
|
|
18937
19075
|
void startGuidedRun(step.id);
|
|
18938
19076
|
}, []);
|
|
18939
19077
|
if (!rows || rows.length === 0) return null;
|
|
@@ -18967,12 +19105,12 @@ function rememberCompleted(storageKey2) {
|
|
|
18967
19105
|
}
|
|
18968
19106
|
}
|
|
18969
19107
|
function usePluginOnboardingGate(storageKey2, checkExistingData) {
|
|
18970
|
-
const checkRef =
|
|
19108
|
+
const checkRef = React132.useRef(checkExistingData);
|
|
18971
19109
|
checkRef.current = checkExistingData;
|
|
18972
|
-
const [status, setStatus] =
|
|
19110
|
+
const [status, setStatus] = React132.useState(
|
|
18973
19111
|
() => wasCompleted(storageKey2) ? "complete" : "checking"
|
|
18974
19112
|
);
|
|
18975
|
-
|
|
19113
|
+
React132.useEffect(() => {
|
|
18976
19114
|
if (status !== "checking") return;
|
|
18977
19115
|
let cancelled = false;
|
|
18978
19116
|
void checkRef.current().then((hasData) => {
|
|
@@ -18986,7 +19124,7 @@ function usePluginOnboardingGate(storageKey2, checkExistingData) {
|
|
|
18986
19124
|
cancelled = true;
|
|
18987
19125
|
};
|
|
18988
19126
|
}, [status, storageKey2]);
|
|
18989
|
-
const complete =
|
|
19127
|
+
const complete = React132.useCallback(() => {
|
|
18990
19128
|
rememberCompleted(storageKey2);
|
|
18991
19129
|
setStatus("complete");
|
|
18992
19130
|
}, [storageKey2]);
|
|
@@ -19006,9 +19144,9 @@ function PluginOnboardingGateSkeleton() {
|
|
|
19006
19144
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-72 rounded-card" })
|
|
19007
19145
|
] });
|
|
19008
19146
|
}
|
|
19009
|
-
var WidgetSurfaceContext =
|
|
19147
|
+
var WidgetSurfaceContext = React132.createContext("rail");
|
|
19010
19148
|
function useWidgetSurface() {
|
|
19011
|
-
return
|
|
19149
|
+
return React132.useContext(WidgetSurfaceContext);
|
|
19012
19150
|
}
|
|
19013
19151
|
function WidgetSlot({
|
|
19014
19152
|
zone,
|
|
@@ -19052,7 +19190,7 @@ function useNavContribution(id, entries2) {
|
|
|
19052
19190
|
const setContribution = useNavContributionsStore((s) => s.setContribution);
|
|
19053
19191
|
const clearContribution = useNavContributionsStore((s) => s.clearContribution);
|
|
19054
19192
|
const key = JSON.stringify(entries2);
|
|
19055
|
-
|
|
19193
|
+
React132.useEffect(() => {
|
|
19056
19194
|
setContribution(id, entries2);
|
|
19057
19195
|
return () => clearContribution(id);
|
|
19058
19196
|
}, [id, key]);
|
|
@@ -19122,7 +19260,7 @@ function useAppDirectory() {
|
|
|
19122
19260
|
const tenantId2 = useActiveTenantId();
|
|
19123
19261
|
const apps = useAppDirectoryStore((s) => s.apps);
|
|
19124
19262
|
const load = useAppDirectoryStore((s) => s.load);
|
|
19125
|
-
|
|
19263
|
+
React132.useEffect(() => {
|
|
19126
19264
|
if (tenantId2) void load(tenantId2, resolveAppId());
|
|
19127
19265
|
}, [tenantId2, load]);
|
|
19128
19266
|
return { apps };
|
|
@@ -19214,7 +19352,7 @@ var CSS2 = `
|
|
|
19214
19352
|
}
|
|
19215
19353
|
`;
|
|
19216
19354
|
function useWordmarkStyle() {
|
|
19217
|
-
|
|
19355
|
+
React132.useEffect(() => {
|
|
19218
19356
|
if (typeof document === "undefined") return;
|
|
19219
19357
|
const existing = document.getElementById(STYLE_ID2);
|
|
19220
19358
|
if (existing) {
|
|
@@ -19448,7 +19586,7 @@ var SWAP_CSS = `
|
|
|
19448
19586
|
}
|
|
19449
19587
|
`;
|
|
19450
19588
|
function useSwapStyle() {
|
|
19451
|
-
|
|
19589
|
+
React132.useEffect(() => {
|
|
19452
19590
|
if (typeof document === "undefined" || document.getElementById(SWAP_STYLE_ID)) return;
|
|
19453
19591
|
const el = document.createElement("style");
|
|
19454
19592
|
el.id = SWAP_STYLE_ID;
|
|
@@ -19457,9 +19595,9 @@ function useSwapStyle() {
|
|
|
19457
19595
|
}, []);
|
|
19458
19596
|
}
|
|
19459
19597
|
function AppSwitcherView({ apps, mark, logo, collapsed = false, label: label3, onSelect, brandedByTenant = false }) {
|
|
19460
|
-
const [hovered, setHovered] =
|
|
19461
|
-
const [open, setOpen] =
|
|
19462
|
-
const [pending2, setPending] =
|
|
19598
|
+
const [hovered, setHovered] = React132.useState(false);
|
|
19599
|
+
const [open, setOpen] = React132.useState(false);
|
|
19600
|
+
const [pending2, setPending] = React132.useState(null);
|
|
19463
19601
|
const active2 = hovered || open;
|
|
19464
19602
|
useSwapStyle();
|
|
19465
19603
|
const brand = /* @__PURE__ */ jsx(BrandFace, { mark, logo, collapsed });
|
|
@@ -19606,7 +19744,7 @@ function useContextualNav(nav) {
|
|
|
19606
19744
|
const setNav = useContextualNavStore((s) => s.setNav);
|
|
19607
19745
|
const clearNav = useContextualNavStore((s) => s.clearNav);
|
|
19608
19746
|
const key = nav ? JSON.stringify(nav) : null;
|
|
19609
|
-
|
|
19747
|
+
React132.useEffect(() => {
|
|
19610
19748
|
if (!nav) return;
|
|
19611
19749
|
setNav(nav);
|
|
19612
19750
|
return () => clearNav(nav.base);
|
|
@@ -19678,7 +19816,7 @@ async function findNearestUnit(units, reachable) {
|
|
|
19678
19816
|
}
|
|
19679
19817
|
var UNIT_SEARCH_THRESHOLD = 8;
|
|
19680
19818
|
function WorkspaceUnitSheet({ onClose, canCreate = true }) {
|
|
19681
|
-
const [level, setLevel] =
|
|
19819
|
+
const [level, setLevel] = React132.useState("root");
|
|
19682
19820
|
return /* @__PURE__ */ jsxs(
|
|
19683
19821
|
BottomSheet,
|
|
19684
19822
|
{
|
|
@@ -19741,9 +19879,9 @@ function WorkspaceLevel({ canCreate }) {
|
|
|
19741
19879
|
const closeSheet = useSheetClose();
|
|
19742
19880
|
const beginSwitch = useWorkspaceSwitchingStore((s) => s.begin);
|
|
19743
19881
|
const openSetup = useWorkspaceSetupStore((s) => s.open);
|
|
19744
|
-
const [query, setQuery] =
|
|
19882
|
+
const [query, setQuery] = React132.useState("");
|
|
19745
19883
|
const org = tenant?.org ?? null;
|
|
19746
|
-
const options =
|
|
19884
|
+
const options = React132.useMemo(() => {
|
|
19747
19885
|
const list = tenant?.userOrgs ?? [];
|
|
19748
19886
|
if (list.length) return list;
|
|
19749
19887
|
return org ? [{ orgId: org.id, orgName: org.name, orgSlug: org.slug, orgLogoUrl: org.logoUrl }] : [];
|
|
@@ -19752,7 +19890,7 @@ function WorkspaceLevel({ canCreate }) {
|
|
|
19752
19890
|
const v = t.t(key);
|
|
19753
19891
|
return !v || v === key ? fallback : v;
|
|
19754
19892
|
};
|
|
19755
|
-
const search =
|
|
19893
|
+
const search = React132.useMemo(
|
|
19756
19894
|
() => searchWorkspaces(options, query, org?.id),
|
|
19757
19895
|
[options, query, org?.id]
|
|
19758
19896
|
);
|
|
@@ -19804,8 +19942,8 @@ function WorkspaceLevel({ canCreate }) {
|
|
|
19804
19942
|
function UnitLevel() {
|
|
19805
19943
|
useUnitBootstrap();
|
|
19806
19944
|
const closeSheet = useSheetClose();
|
|
19807
|
-
const [locating, setLocating] =
|
|
19808
|
-
const [query, setQuery] =
|
|
19945
|
+
const [locating, setLocating] = React132.useState(false);
|
|
19946
|
+
const [query, setQuery] = React132.useState("");
|
|
19809
19947
|
const units = useUnitStore((s) => s.units);
|
|
19810
19948
|
const tree = useUnitStore((s) => s.tree);
|
|
19811
19949
|
const byId = useUnitStore((s) => s.byId);
|
|
@@ -19842,7 +19980,7 @@ function UnitLevel() {
|
|
|
19842
19980
|
const leaves = node.children.filter((c) => c.kind !== "region" && reachable.includes(c.id));
|
|
19843
19981
|
const regions = node.children.filter((c) => c.kind === "region");
|
|
19844
19982
|
if (leaves.length === 0 && regions.length === 0) return null;
|
|
19845
|
-
return /* @__PURE__ */ jsxs(
|
|
19983
|
+
return /* @__PURE__ */ jsxs(React132.Fragment, { children: [
|
|
19846
19984
|
/* @__PURE__ */ jsx("p", { className: "px-4 pb-1 pt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: node.name }),
|
|
19847
19985
|
leaves.length > 0 && /* @__PURE__ */ jsx(SheetCard, { children: leaves.map(leaf) }),
|
|
19848
19986
|
regions.map(group)
|
|
@@ -19912,7 +20050,7 @@ function UnitLevel() {
|
|
|
19912
20050
|
}
|
|
19913
20051
|
function WorkspaceUnitRow({ canCreate = true }) {
|
|
19914
20052
|
useUnitBootstrap();
|
|
19915
|
-
const [open, setOpen] =
|
|
20053
|
+
const [open, setOpen] = React132.useState(false);
|
|
19916
20054
|
const tenant = useTenantOptional();
|
|
19917
20055
|
const org = tenant?.org ?? null;
|
|
19918
20056
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
@@ -20099,10 +20237,10 @@ function SeuSiteWidget({ fallback, onEdit }) {
|
|
|
20099
20237
|
const load = useFayzProjectsStore((s) => s.load);
|
|
20100
20238
|
const loadedFor = useFayzProjectsStore((s) => s.loadedFor);
|
|
20101
20239
|
const collapsed = useLayoutStore((s) => s.sidebarCollapsed);
|
|
20102
|
-
const [selectedId, setSelectedId] =
|
|
20103
|
-
const [hovered, setHovered] =
|
|
20104
|
-
const [primed, setPrimed] =
|
|
20105
|
-
const closeTimer =
|
|
20240
|
+
const [selectedId, setSelectedId] = React132.useState(null);
|
|
20241
|
+
const [hovered, setHovered] = React132.useState(false);
|
|
20242
|
+
const [primed, setPrimed] = React132.useState(false);
|
|
20243
|
+
const closeTimer = React132.useRef(null);
|
|
20106
20244
|
const cancelClose = () => {
|
|
20107
20245
|
if (closeTimer.current) {
|
|
20108
20246
|
clearTimeout(closeTimer.current);
|
|
@@ -20118,8 +20256,8 @@ function SeuSiteWidget({ fallback, onEdit }) {
|
|
|
20118
20256
|
cancelClose();
|
|
20119
20257
|
closeTimer.current = setTimeout(() => setHovered(false), 140);
|
|
20120
20258
|
};
|
|
20121
|
-
|
|
20122
|
-
|
|
20259
|
+
React132.useEffect(() => () => cancelClose(), []);
|
|
20260
|
+
React132.useEffect(() => {
|
|
20123
20261
|
if (loadedFor !== (currentOrgId ?? null)) void load(currentOrgId);
|
|
20124
20262
|
}, [currentOrgId, loadedFor, load]);
|
|
20125
20263
|
const active2 = projects.find((p) => p.id === selectedId) ?? defaultProjectOf(projects) ?? synthFromFallback(fallback);
|
|
@@ -20230,10 +20368,10 @@ function SitePreview({
|
|
|
20230
20368
|
onEdit,
|
|
20231
20369
|
tr
|
|
20232
20370
|
}) {
|
|
20233
|
-
const [nonce, setNonce] =
|
|
20234
|
-
const [loading, setLoading] =
|
|
20371
|
+
const [nonce, setNonce] = React132.useState(0);
|
|
20372
|
+
const [loading, setLoading] = React132.useState(true);
|
|
20235
20373
|
const url = previewSourceOf(project);
|
|
20236
|
-
|
|
20374
|
+
React132.useEffect(() => {
|
|
20237
20375
|
setLoading(true);
|
|
20238
20376
|
}, [nonce, url]);
|
|
20239
20377
|
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";
|
|
@@ -20343,10 +20481,10 @@ function RightRail({ frame = true, attached = true }) {
|
|
|
20343
20481
|
const pageOpen = useRightRailStore((s) => s.pageOpen);
|
|
20344
20482
|
const setPageSlot = useRightRailStore((s) => s.setPageSlot);
|
|
20345
20483
|
const setWidth = useRightRailStore((s) => s.setWidth);
|
|
20346
|
-
const rootRef =
|
|
20347
|
-
const [actionsSlot, setActionsSlot] =
|
|
20348
|
-
const [leadingSlot, setLeadingSlot] =
|
|
20349
|
-
|
|
20484
|
+
const rootRef = React132.useRef(null);
|
|
20485
|
+
const [actionsSlot, setActionsSlot] = React132.useState(null);
|
|
20486
|
+
const [leadingSlot, setLeadingSlot] = React132.useState(null);
|
|
20487
|
+
React132.useEffect(() => {
|
|
20350
20488
|
if (!open) return;
|
|
20351
20489
|
const el = rootRef.current;
|
|
20352
20490
|
if (!el) return;
|
|
@@ -20368,8 +20506,8 @@ function RightRail({ frame = true, attached = true }) {
|
|
|
20368
20506
|
el.removeEventListener("transitionend", publish);
|
|
20369
20507
|
};
|
|
20370
20508
|
}, [open, setWidth]);
|
|
20371
|
-
const [narrow, setNarrow] =
|
|
20372
|
-
|
|
20509
|
+
const [narrow, setNarrow] = React132.useState(false);
|
|
20510
|
+
React132.useEffect(() => {
|
|
20373
20511
|
if (!open) return;
|
|
20374
20512
|
const el = rootRef.current;
|
|
20375
20513
|
if (!el) return;
|
|
@@ -20732,9 +20870,9 @@ var TYPE_COLORS = {
|
|
|
20732
20870
|
fix: "text-success"
|
|
20733
20871
|
};
|
|
20734
20872
|
function ChangelogFeed({ changelogUrl, className }) {
|
|
20735
|
-
const [entries2, setEntries] =
|
|
20736
|
-
const [loading, setLoading] =
|
|
20737
|
-
|
|
20873
|
+
const [entries2, setEntries] = React132.useState([]);
|
|
20874
|
+
const [loading, setLoading] = React132.useState(false);
|
|
20875
|
+
React132.useEffect(() => {
|
|
20738
20876
|
if (!changelogUrl) return;
|
|
20739
20877
|
setLoading(true);
|
|
20740
20878
|
fetch(changelogUrl).then((r) => r.json()).then((data) => setEntries(data)).catch(() => setEntries([])).finally(() => setLoading(false));
|
|
@@ -20794,7 +20932,7 @@ function NotificationInbox({
|
|
|
20794
20932
|
changelogUrl,
|
|
20795
20933
|
className
|
|
20796
20934
|
}) {
|
|
20797
|
-
const [activeTab, setActiveTab] =
|
|
20935
|
+
const [activeTab, setActiveTab] = React132.useState("inbox");
|
|
20798
20936
|
const unreadCount = notifications.filter((n) => !n.read).length;
|
|
20799
20937
|
const inboxNotifications = notifications.filter((n) => n.category !== "changelog");
|
|
20800
20938
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex w-80 flex-col", className), children: [
|
|
@@ -20891,11 +21029,11 @@ function NotificationInbox({
|
|
|
20891
21029
|
}
|
|
20892
21030
|
function BrandAgentSurface() {
|
|
20893
21031
|
const org = useOrganizationStore((s) => s.currentOrg);
|
|
20894
|
-
const brand =
|
|
21032
|
+
const brand = React132__default.useMemo(
|
|
20895
21033
|
() => normalizeBrand(org?.settings?.branding, { name: org?.name, logoUrl: org?.logoUrl }),
|
|
20896
21034
|
[org?.settings, org?.name, org?.logoUrl]
|
|
20897
21035
|
);
|
|
20898
|
-
const surface =
|
|
21036
|
+
const surface = React132__default.useMemo(() => ({
|
|
20899
21037
|
id: "core.brand",
|
|
20900
21038
|
describe: () => ({
|
|
20901
21039
|
title: "Marca da casa",
|
|
@@ -20908,15 +21046,15 @@ function BrandAgentSurface() {
|
|
|
20908
21046
|
return null;
|
|
20909
21047
|
}
|
|
20910
21048
|
function ConnectConsentPage({ appName, logo }) {
|
|
20911
|
-
const [state, setState] =
|
|
20912
|
-
const [tenantId2, setTenantId] =
|
|
20913
|
-
const request =
|
|
21049
|
+
const [state, setState] = React132__default.useState({ status: "loading" });
|
|
21050
|
+
const [tenantId2, setTenantId] = React132__default.useState("");
|
|
21051
|
+
const request = React132__default.useMemo(
|
|
20914
21052
|
() => new URLSearchParams(window.location.search).get("request") ?? "",
|
|
20915
21053
|
[]
|
|
20916
21054
|
);
|
|
20917
|
-
const connection =
|
|
21055
|
+
const connection = React132__default.useMemo(() => resolveFayzAgentConnection(), []);
|
|
20918
21056
|
const product = appName ?? document.title ?? "este app";
|
|
20919
|
-
const authorizedFetch =
|
|
21057
|
+
const authorizedFetch = React132__default.useCallback(
|
|
20920
21058
|
async (path, init) => {
|
|
20921
21059
|
if (!connection) throw new Error("Este app n\xE3o est\xE1 ligado a um projeto Fayz.");
|
|
20922
21060
|
const supabase = getFayzSupabaseClientOptional();
|
|
@@ -20940,7 +21078,7 @@ function ConnectConsentPage({ appName, logo }) {
|
|
|
20940
21078
|
},
|
|
20941
21079
|
[connection]
|
|
20942
21080
|
);
|
|
20943
|
-
|
|
21081
|
+
React132__default.useEffect(() => {
|
|
20944
21082
|
let cancelled = false;
|
|
20945
21083
|
(async () => {
|
|
20946
21084
|
if (!request) {
|
|
@@ -21184,7 +21322,7 @@ function Row2({ label: label3, value }) {
|
|
|
21184
21322
|
function PageActions({ actions, className }) {
|
|
21185
21323
|
const access = useAccessOptional();
|
|
21186
21324
|
const openUpgrade = useUpgradeModalStore((s) => s.open);
|
|
21187
|
-
const resolved =
|
|
21325
|
+
const resolved = React132__default.useMemo(
|
|
21188
21326
|
() => actions.map((a) => {
|
|
21189
21327
|
const { permission, limitKey, onSelect, ...rest } = a;
|
|
21190
21328
|
let hidden = false;
|
|
@@ -21214,25 +21352,25 @@ function AddConnectorPanel({
|
|
|
21214
21352
|
onSelect
|
|
21215
21353
|
}) {
|
|
21216
21354
|
const { t } = useTranslation$1();
|
|
21217
|
-
const [query, setQuery] =
|
|
21355
|
+
const [query, setQuery] = React132__default.useState("");
|
|
21218
21356
|
const modules = useInstalledModuleIds();
|
|
21219
21357
|
const catalog = useConnectorCatalog();
|
|
21220
21358
|
const scoped = !!categories?.length;
|
|
21221
|
-
const addable =
|
|
21359
|
+
const addable = React132__default.useMemo(
|
|
21222
21360
|
() => inCategories(addableConnectors(connectors ?? []), categories),
|
|
21223
21361
|
[connectors, categories]
|
|
21224
21362
|
);
|
|
21225
|
-
const shelf =
|
|
21363
|
+
const shelf = React132__default.useMemo(() => {
|
|
21226
21364
|
if (connectors === null) return [];
|
|
21227
21365
|
return inCategories(
|
|
21228
21366
|
shelfIntegrations({ present: connectors, installedModules: modules, catalog: catalog ?? [] }),
|
|
21229
21367
|
categories
|
|
21230
21368
|
);
|
|
21231
21369
|
}, [connectors, modules, catalog, categories]);
|
|
21232
|
-
const filtered =
|
|
21233
|
-
const filteredShelf =
|
|
21234
|
-
const soon =
|
|
21235
|
-
const elsewhere =
|
|
21370
|
+
const filtered = React132__default.useMemo(() => filterConnectors(addable, "all", query), [addable, query]);
|
|
21371
|
+
const filteredShelf = React132__default.useMemo(() => filterAvailable(shelf, query), [shelf, query]);
|
|
21372
|
+
const soon = React132__default.useMemo(() => comingSoonHere(filteredShelf), [filteredShelf]);
|
|
21373
|
+
const elsewhere = React132__default.useMemo(() => withAnotherModule(filteredShelf), [filteredShelf]);
|
|
21236
21374
|
const searchable = addable.length + shelf.length > 6;
|
|
21237
21375
|
return /* @__PURE__ */ jsx(Modal, { open, onOpenChange, children: /* @__PURE__ */ jsxs(ModalContent, { size: "2xl", children: [
|
|
21238
21376
|
/* @__PURE__ */ jsxs(ModalHeader, { children: [
|
|
@@ -21390,23 +21528,23 @@ function AddConnectorButton({ onClick }) {
|
|
|
21390
21528
|
}
|
|
21391
21529
|
function ConnectorsTab() {
|
|
21392
21530
|
const { t } = useTranslation$1();
|
|
21393
|
-
const { connectors, error, reload, revokeGrant, agentAvailable, tenantReady } = useConnectors();
|
|
21394
|
-
const [adding, setAdding] =
|
|
21395
|
-
const [selected, setSelected] =
|
|
21396
|
-
const [filter, setFilter] =
|
|
21397
|
-
const [failure, setFailure] =
|
|
21398
|
-
const [revoking, setRevoking] =
|
|
21531
|
+
const { connectors, error, reload: reload2, revokeGrant, agentAvailable, tenantReady } = useConnectors();
|
|
21532
|
+
const [adding, setAdding] = React132__default.useState(false);
|
|
21533
|
+
const [selected, setSelected] = React132__default.useState(null);
|
|
21534
|
+
const [filter, setFilter] = React132__default.useState("all");
|
|
21535
|
+
const [failure, setFailure] = React132__default.useState(null);
|
|
21536
|
+
const [revoking, setRevoking] = React132__default.useState(null);
|
|
21399
21537
|
const assistantAvailable = useConnectorsPanelAvailable();
|
|
21400
|
-
const openJourney =
|
|
21538
|
+
const openJourney = React132__default.useCallback(
|
|
21401
21539
|
(connector) => {
|
|
21402
21540
|
if (assistantAvailable) openConnectorsPanel(connector);
|
|
21403
21541
|
else setSelected(connector);
|
|
21404
21542
|
},
|
|
21405
21543
|
[assistantAvailable]
|
|
21406
21544
|
);
|
|
21407
|
-
const visible =
|
|
21408
|
-
const groups =
|
|
21409
|
-
|
|
21545
|
+
const visible = React132__default.useMemo(() => filterConnectors(connectors ?? [], filter), [connectors, filter]);
|
|
21546
|
+
const groups = React132__default.useMemo(() => groupConnectors(visible), [visible]);
|
|
21547
|
+
React132__default.useEffect(() => {
|
|
21410
21548
|
if (!selected || !connectors) return;
|
|
21411
21549
|
const fresh = connectors.find((c) => c.id === selected.id);
|
|
21412
21550
|
if (fresh && fresh !== selected) setSelected(fresh);
|
|
@@ -21441,7 +21579,7 @@ function ConnectorsTab() {
|
|
|
21441
21579
|
(connectors?.length ?? 0) > 4 && /* @__PURE__ */ jsx(Filters, { value: filter, onChange: setFilter }),
|
|
21442
21580
|
connectors === null && /* @__PURE__ */ jsx(ConnectionsSkeleton, {}),
|
|
21443
21581
|
connectors !== null && visible.length === 0 && /* @__PURE__ */ jsx(Empty2, { title: t("connectors.emptyTitle"), body: t("connectors.emptyBody") }),
|
|
21444
|
-
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(
|
|
21582
|
+
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(React132__default.Fragment, { children: [
|
|
21445
21583
|
groups.length > 1 && /* @__PURE__ */ jsx(
|
|
21446
21584
|
"li",
|
|
21447
21585
|
{
|
|
@@ -21458,7 +21596,7 @@ function ConnectorsTab() {
|
|
|
21458
21596
|
connector: selected,
|
|
21459
21597
|
open: !!selected,
|
|
21460
21598
|
onOpenChange: (open) => !open && setSelected(null),
|
|
21461
|
-
onChanged:
|
|
21599
|
+
onChanged: reload2,
|
|
21462
21600
|
onRevoke: (connector) => setRevoking(connector)
|
|
21463
21601
|
}
|
|
21464
21602
|
),
|
|
@@ -21579,7 +21717,7 @@ function oauthFailureMessage(t, result) {
|
|
|
21579
21717
|
function useConnectorOAuthReturn() {
|
|
21580
21718
|
const { t } = useTranslation$1();
|
|
21581
21719
|
const runtime = usePluginRuntimeOptional();
|
|
21582
|
-
|
|
21720
|
+
React132__default.useEffect(() => {
|
|
21583
21721
|
if (typeof window === "undefined") return;
|
|
21584
21722
|
const result = readConnectorOAuthReturn(window.location.search);
|
|
21585
21723
|
if (!result) return;
|
|
@@ -21614,8 +21752,8 @@ function ConnectorDeliveries({
|
|
|
21614
21752
|
limit = 10
|
|
21615
21753
|
}) {
|
|
21616
21754
|
const { t } = useTranslation$1();
|
|
21617
|
-
const [rows, setRows] =
|
|
21618
|
-
|
|
21755
|
+
const [rows, setRows] = React132__default.useState(null);
|
|
21756
|
+
React132__default.useEffect(() => {
|
|
21619
21757
|
let cancelled = false;
|
|
21620
21758
|
void load({ limit }).then((r) => {
|
|
21621
21759
|
if (!cancelled) setRows(r);
|
|
@@ -21689,11 +21827,11 @@ var CURRENCIES = [
|
|
|
21689
21827
|
function CompanySettings({ tenant, onSave }) {
|
|
21690
21828
|
const { t } = useTranslation$1();
|
|
21691
21829
|
const { locale: uiLocale, setLocale: setUiLocale } = useLocaleStore();
|
|
21692
|
-
const [name, setName] =
|
|
21693
|
-
const [timezone, setTimezone] =
|
|
21694
|
-
const [currency, setCurrency] =
|
|
21695
|
-
const [saving, setSaving] =
|
|
21696
|
-
|
|
21830
|
+
const [name, setName] = React132.useState(tenant?.name ?? "");
|
|
21831
|
+
const [timezone, setTimezone] = React132.useState(tenant?.settings?.timezone ?? "UTC");
|
|
21832
|
+
const [currency, setCurrency] = React132.useState(tenant?.settings?.currency ?? "USD");
|
|
21833
|
+
const [saving, setSaving] = React132.useState(false);
|
|
21834
|
+
React132.useEffect(() => {
|
|
21697
21835
|
if (tenant) {
|
|
21698
21836
|
setName(tenant.name);
|
|
21699
21837
|
setTimezone(tenant.settings?.timezone ?? "UTC");
|
|
@@ -21785,15 +21923,15 @@ function UnitModeCard() {
|
|
|
21785
21923
|
const units = useUnitStore((s) => s.units);
|
|
21786
21924
|
const setMode = useUnitStore((s) => s.setMode);
|
|
21787
21925
|
const load = useUnitStore((s) => s.load);
|
|
21788
|
-
const [unbound, setUnbound] =
|
|
21789
|
-
const [bindEveryone, setBindEveryone] =
|
|
21790
|
-
const [pending2, setPending] =
|
|
21791
|
-
const [saving, setSaving] =
|
|
21792
|
-
const headquarters =
|
|
21926
|
+
const [unbound, setUnbound] = React132.useState(null);
|
|
21927
|
+
const [bindEveryone, setBindEveryone] = React132.useState(true);
|
|
21928
|
+
const [pending2, setPending] = React132.useState(null);
|
|
21929
|
+
const [saving, setSaving] = React132.useState(false);
|
|
21930
|
+
const headquarters = React132.useMemo(
|
|
21793
21931
|
() => units.find((u) => u.isHeadquarters && u.kind !== "region") ?? units.find((u) => u.kind !== "region"),
|
|
21794
21932
|
[units]
|
|
21795
21933
|
);
|
|
21796
|
-
|
|
21934
|
+
React132.useEffect(() => {
|
|
21797
21935
|
if (!org?.id || unitMode) return;
|
|
21798
21936
|
let alive = true;
|
|
21799
21937
|
void countUnboundMembers(org.id).then((n) => {
|
|
@@ -21957,10 +22095,10 @@ function getInitials(name) {
|
|
|
21957
22095
|
}
|
|
21958
22096
|
function UserProfile({ user, onSave, onAvatarChange }) {
|
|
21959
22097
|
const { t } = useTranslation$1();
|
|
21960
|
-
const [fullName, setFullName] =
|
|
21961
|
-
const [saving, setSaving] =
|
|
21962
|
-
const fileInputRef =
|
|
21963
|
-
|
|
22098
|
+
const [fullName, setFullName] = React132.useState(user?.fullName ?? "");
|
|
22099
|
+
const [saving, setSaving] = React132.useState(false);
|
|
22100
|
+
const fileInputRef = React132.useRef(null);
|
|
22101
|
+
React132.useEffect(() => {
|
|
21964
22102
|
if (user) {
|
|
21965
22103
|
setFullName(user.fullName);
|
|
21966
22104
|
}
|
|
@@ -22100,8 +22238,8 @@ async function fetchMyPersonId(tenantId2, userId) {
|
|
|
22100
22238
|
function useMyPersonId(enabled = true) {
|
|
22101
22239
|
const orgId = useOrganizationStore((s) => s.currentOrg?.id);
|
|
22102
22240
|
const userId = useAuthStore((s) => s.user?.id);
|
|
22103
|
-
const [personId, setPersonId] =
|
|
22104
|
-
|
|
22241
|
+
const [personId, setPersonId] = React132.useState(void 0);
|
|
22242
|
+
React132.useEffect(() => {
|
|
22105
22243
|
if (!enabled || !orgId || !userId) return;
|
|
22106
22244
|
let alive = true;
|
|
22107
22245
|
void dedup(`self:person:${orgId}:${userId}`, () => fetchMyPersonId(orgId, userId)).then((id) => {
|
|
@@ -22161,18 +22299,18 @@ function MyWorkspaceCard() {
|
|
|
22161
22299
|
const myUnitIds = useUnitStore((s) => s.myUnitIds);
|
|
22162
22300
|
const activeUnitId = useUnitStore((s) => s.activeUnitId);
|
|
22163
22301
|
const entryReason = useUnitStore((s) => s.entryReason);
|
|
22164
|
-
const [person, setPerson] =
|
|
22165
|
-
const [candidate, setCandidate] =
|
|
22166
|
-
const [linking, setLinking] =
|
|
22302
|
+
const [person, setPerson] = React132.useState(void 0);
|
|
22303
|
+
const [candidate, setCandidate] = React132.useState(null);
|
|
22304
|
+
const [linking, setLinking] = React132.useState(false);
|
|
22167
22305
|
const orgId = currentOrg?.id;
|
|
22168
22306
|
const userId = user?.id;
|
|
22169
|
-
const load =
|
|
22307
|
+
const load = React132.useCallback(async () => {
|
|
22170
22308
|
if (!orgId || !userId) return;
|
|
22171
22309
|
const linked = await fetchMyPersonRecord(orgId, userId);
|
|
22172
22310
|
setPerson(linked);
|
|
22173
22311
|
setCandidate(linked ? null : await findMyPersonCandidate(orgId, user?.email, staffKinds));
|
|
22174
22312
|
}, [orgId, userId, user?.email, staffKinds]);
|
|
22175
|
-
|
|
22313
|
+
React132.useEffect(() => {
|
|
22176
22314
|
void load();
|
|
22177
22315
|
}, [load]);
|
|
22178
22316
|
if (!currentOrg) return null;
|
|
@@ -22266,10 +22404,10 @@ var useStore = create((set) => ({
|
|
|
22266
22404
|
function useHeaderAction(zone, action) {
|
|
22267
22405
|
const register = useStore((s) => s.register);
|
|
22268
22406
|
const unregister = useStore((s) => s.unregister);
|
|
22269
|
-
const latest =
|
|
22407
|
+
const latest = React132.useRef(action);
|
|
22270
22408
|
latest.current = action;
|
|
22271
22409
|
const id = action?.id;
|
|
22272
|
-
|
|
22410
|
+
React132.useEffect(() => {
|
|
22273
22411
|
if (!zone || !id) return;
|
|
22274
22412
|
const current2 = latest.current;
|
|
22275
22413
|
if (current2) register(zone, { ...current2, onSelect: () => latest.current?.onSelect() });
|
|
@@ -22278,7 +22416,7 @@ function useHeaderAction(zone, action) {
|
|
|
22278
22416
|
}
|
|
22279
22417
|
function useHeaderActions(zone) {
|
|
22280
22418
|
const byZone = useStore((s) => s.byZone);
|
|
22281
|
-
return
|
|
22419
|
+
return React132.useMemo(() => Object.values(byZone[zone] ?? {}), [byZone, zone]);
|
|
22282
22420
|
}
|
|
22283
22421
|
function useUserLabel(userId) {
|
|
22284
22422
|
const members = useOrganizationStore((s) => s.members);
|
|
@@ -23285,12 +23423,12 @@ function CrudRecordModal({
|
|
|
23285
23423
|
essentialFirst,
|
|
23286
23424
|
notice
|
|
23287
23425
|
}) {
|
|
23288
|
-
const [record, setRecord] =
|
|
23289
|
-
const [loading, setLoading] =
|
|
23290
|
-
const [saving, setSaving] =
|
|
23291
|
-
const [error, setError] =
|
|
23292
|
-
const formId =
|
|
23293
|
-
|
|
23426
|
+
const [record, setRecord] = React132.useState(null);
|
|
23427
|
+
const [loading, setLoading] = React132.useState(false);
|
|
23428
|
+
const [saving, setSaving] = React132.useState(false);
|
|
23429
|
+
const [error, setError] = React132.useState(null);
|
|
23430
|
+
const formId = React132.useId();
|
|
23431
|
+
React132.useEffect(() => {
|
|
23294
23432
|
if (!open) return;
|
|
23295
23433
|
setError(null);
|
|
23296
23434
|
if (mode === "create" || !load) {
|
|
@@ -23468,10 +23606,10 @@ function resolveRelation(relation, row) {
|
|
|
23468
23606
|
}
|
|
23469
23607
|
return { ...relation, filter: { ...relation.filter ?? {}, ...extra } };
|
|
23470
23608
|
}
|
|
23471
|
-
var PendingChildrenContext =
|
|
23609
|
+
var PendingChildrenContext = React132.createContext(null);
|
|
23472
23610
|
function usePendingChildren() {
|
|
23473
|
-
const pending2 =
|
|
23474
|
-
const provider2 =
|
|
23611
|
+
const pending2 = React132.useRef(/* @__PURE__ */ new Set());
|
|
23612
|
+
const provider2 = React132.useMemo(() => ({
|
|
23475
23613
|
register: (f) => {
|
|
23476
23614
|
pending2.current.add(f);
|
|
23477
23615
|
return () => {
|
|
@@ -23479,7 +23617,7 @@ function usePendingChildren() {
|
|
|
23479
23617
|
};
|
|
23480
23618
|
}
|
|
23481
23619
|
}), []);
|
|
23482
|
-
const flush =
|
|
23620
|
+
const flush = React132.useCallback(async (parentId) => {
|
|
23483
23621
|
for (const f of [...pending2.current]) await f(parentId);
|
|
23484
23622
|
}, []);
|
|
23485
23623
|
return { provider: provider2, flush };
|
|
@@ -23495,7 +23633,7 @@ function money(value) {
|
|
|
23495
23633
|
}
|
|
23496
23634
|
}
|
|
23497
23635
|
function GridRelationCell({ field, value, row, onChange }) {
|
|
23498
|
-
const relation =
|
|
23636
|
+
const relation = React132.useMemo(() => resolveRelation(field.relation, row), [field.relation, row]);
|
|
23499
23637
|
const { labelFor: labelFor2 } = useRelationOptions(relation);
|
|
23500
23638
|
const label3 = value ? labelFor2(value) : "";
|
|
23501
23639
|
return /* @__PURE__ */ jsx(
|
|
@@ -23526,11 +23664,11 @@ function columnOf(entity, key) {
|
|
|
23526
23664
|
}
|
|
23527
23665
|
function RelatedSection({ parentId, related, compact }) {
|
|
23528
23666
|
const orfa = !parentId;
|
|
23529
|
-
const pendentes =
|
|
23667
|
+
const pendentes = React132.useContext(PendingChildrenContext);
|
|
23530
23668
|
const fkColumn = columnOf(related.entity, related.foreignKey);
|
|
23531
23669
|
const label3 = related.label ?? related.entity.namePlural ?? related.entity.name;
|
|
23532
23670
|
const Icon = related.icon ? ICON_MAP[related.icon] ?? null : null;
|
|
23533
|
-
const child =
|
|
23671
|
+
const child = React132.useMemo(() => ({
|
|
23534
23672
|
...related.entity,
|
|
23535
23673
|
fields: related.entity.fields.filter((f) => f.key !== related.foreignKey),
|
|
23536
23674
|
data: related.entity.data ? {
|
|
@@ -23539,13 +23677,13 @@ function RelatedSection({ parentId, related, compact }) {
|
|
|
23539
23677
|
defaults: { ...related.entity.data.defaults ?? {}, [fkColumn]: parentId }
|
|
23540
23678
|
} : void 0
|
|
23541
23679
|
}), [related, parentId, fkColumn]);
|
|
23542
|
-
const provider2 =
|
|
23543
|
-
const [rows, setRows] =
|
|
23544
|
-
const [loading, setLoading] =
|
|
23545
|
-
const [error, setError] =
|
|
23546
|
-
const [adding, setAdding] =
|
|
23547
|
-
const [draft, setDraft] =
|
|
23548
|
-
const load =
|
|
23680
|
+
const provider2 = React132.useMemo(() => resolveDataProvider(child, [], { cache: false }), [child]);
|
|
23681
|
+
const [rows, setRows] = React132.useState([]);
|
|
23682
|
+
const [loading, setLoading] = React132.useState(true);
|
|
23683
|
+
const [error, setError] = React132.useState(null);
|
|
23684
|
+
const [adding, setAdding] = React132.useState(false);
|
|
23685
|
+
const [draft, setDraft] = React132.useState(null);
|
|
23686
|
+
const load = React132.useCallback(async () => {
|
|
23549
23687
|
if (orfa) {
|
|
23550
23688
|
setLoading(false);
|
|
23551
23689
|
return;
|
|
@@ -23561,12 +23699,12 @@ function RelatedSection({ parentId, related, compact }) {
|
|
|
23561
23699
|
setLoading(false);
|
|
23562
23700
|
}
|
|
23563
23701
|
}, [provider2, orfa]);
|
|
23564
|
-
|
|
23702
|
+
React132.useEffect(() => {
|
|
23565
23703
|
void load();
|
|
23566
23704
|
}, [load]);
|
|
23567
|
-
const guardadas =
|
|
23705
|
+
const guardadas = React132.useRef([]);
|
|
23568
23706
|
guardadas.current = rows;
|
|
23569
|
-
|
|
23707
|
+
React132.useEffect(() => {
|
|
23570
23708
|
if (!orfa || !pendentes) return;
|
|
23571
23709
|
return pendentes.register(async (novoPai) => {
|
|
23572
23710
|
if (!guardadas.current.length) return;
|
|
@@ -23590,7 +23728,7 @@ function RelatedSection({ parentId, related, compact }) {
|
|
|
23590
23728
|
}
|
|
23591
23729
|
const shown = child.fields.filter((f) => f.showInTable !== false);
|
|
23592
23730
|
const groupKey = related.duplicable ? child.fields.find((f) => f.type === "relation")?.key : void 0;
|
|
23593
|
-
const [lastEdit, setLastEdit] =
|
|
23731
|
+
const [lastEdit, setLastEdit] = React132.useState(null);
|
|
23594
23732
|
function siblingsToSync(row, key) {
|
|
23595
23733
|
if (!groupKey || key === groupKey || row[groupKey] == null) return [];
|
|
23596
23734
|
return rows.filter((r) => r.id !== row.id && r[groupKey] === row[groupKey] && r[key] !== row[key]);
|
|
@@ -23621,7 +23759,7 @@ function RelatedSection({ parentId, related, compact }) {
|
|
|
23621
23759
|
if (orfa) return;
|
|
23622
23760
|
queueWrite(id, mudanca, antes);
|
|
23623
23761
|
}
|
|
23624
|
-
const escritas =
|
|
23762
|
+
const escritas = React132.useRef(/* @__PURE__ */ new Map());
|
|
23625
23763
|
function queueWrite(id, mudanca, antes) {
|
|
23626
23764
|
const atual = escritas.current.get(id);
|
|
23627
23765
|
const entry = atual ?? { mudanca: {}, antes, fila: Promise.resolve() };
|
|
@@ -23650,7 +23788,7 @@ function RelatedSection({ parentId, related, compact }) {
|
|
|
23650
23788
|
if (e && e.fila === fila && !e.timer) escritas.current.delete(id);
|
|
23651
23789
|
});
|
|
23652
23790
|
}
|
|
23653
|
-
|
|
23791
|
+
React132.useEffect(() => () => {
|
|
23654
23792
|
for (const [id, e] of escritas.current) {
|
|
23655
23793
|
if (e.timer) {
|
|
23656
23794
|
clearTimeout(e.timer);
|
|
@@ -23659,7 +23797,7 @@ function RelatedSection({ parentId, related, compact }) {
|
|
|
23659
23797
|
}
|
|
23660
23798
|
}, []);
|
|
23661
23799
|
const required = child.fields.filter((f) => f.required);
|
|
23662
|
-
const criando =
|
|
23800
|
+
const criando = React132.useRef(false);
|
|
23663
23801
|
async function commitDraft(key, next, price) {
|
|
23664
23802
|
const completo = { ...next, ...heranca(key, price, next) };
|
|
23665
23803
|
setDraft(completo);
|
|
@@ -24492,7 +24630,7 @@ function SubjectFormLayout({ fields, allFields, fieldGroups, values, onChange, r
|
|
|
24492
24630
|
const IconComponent = getLucideIcon(entityIcon ?? "Heart") ?? Heart;
|
|
24493
24631
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
24494
24632
|
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, { className: "pt-5", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-5", children: [
|
|
24495
|
-
/* @__PURE__ */ jsx("div", { className: "flex h-20 w-20 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary", children:
|
|
24633
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-20 w-20 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary", children: React132__default.createElement(IconComponent, { className: "h-8 w-8" }) }),
|
|
24496
24634
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-4", children: [
|
|
24497
24635
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4", children: [
|
|
24498
24636
|
nameField && /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-1.5", children: [
|
|
@@ -24974,7 +25112,7 @@ function getDefaultValues(fields) {
|
|
|
24974
25112
|
}
|
|
24975
25113
|
return values;
|
|
24976
25114
|
}
|
|
24977
|
-
var SetFieldValueContext =
|
|
25115
|
+
var SetFieldValueContext = React132__default.createContext(void 0);
|
|
24978
25116
|
function renderField(field, value, onChange, allValues = {}, selectPlaceholder, setValue) {
|
|
24979
25117
|
const baseClass = "flex h-9 w-full rounded-input border border-input bg-background px-3 py-1.5 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50";
|
|
24980
25118
|
switch (field.type) {
|
|
@@ -25221,14 +25359,14 @@ function ImageSlot({
|
|
|
25221
25359
|
onDraftFile
|
|
25222
25360
|
}) {
|
|
25223
25361
|
const t = useTranslation();
|
|
25224
|
-
const inputRef =
|
|
25225
|
-
const [url, setUrl] =
|
|
25226
|
-
const [busy, setBusy] =
|
|
25227
|
-
const [error, setError] =
|
|
25228
|
-
const draftUrlRef =
|
|
25362
|
+
const inputRef = React132__default.useRef(null);
|
|
25363
|
+
const [url, setUrl] = React132__default.useState(() => image.get(row));
|
|
25364
|
+
const [busy, setBusy] = React132__default.useState(false);
|
|
25365
|
+
const [error, setError] = React132__default.useState(null);
|
|
25366
|
+
const draftUrlRef = React132__default.useRef(null);
|
|
25229
25367
|
const currentUrl = image.get(row);
|
|
25230
25368
|
const draftFile = image.draftField ? row[image.draftField] : void 0;
|
|
25231
|
-
|
|
25369
|
+
React132__default.useEffect(() => {
|
|
25232
25370
|
if (draftFile) return;
|
|
25233
25371
|
if (draftUrlRef.current) {
|
|
25234
25372
|
URL.revokeObjectURL(draftUrlRef.current);
|
|
@@ -25236,7 +25374,7 @@ function ImageSlot({
|
|
|
25236
25374
|
}
|
|
25237
25375
|
setUrl(currentUrl);
|
|
25238
25376
|
}, [currentUrl, draftFile]);
|
|
25239
|
-
|
|
25377
|
+
React132__default.useEffect(() => () => {
|
|
25240
25378
|
if (draftUrlRef.current) URL.revokeObjectURL(draftUrlRef.current);
|
|
25241
25379
|
}, []);
|
|
25242
25380
|
const acceptsDraft = !canEdit && Boolean(image.draftField && onDraftFile);
|
|
@@ -25386,7 +25524,7 @@ function CrudFormPageBody({ entityDef, mode, initialData, onSubmit, onSaved, onC
|
|
|
25386
25524
|
const [values, setValues] = useState(computeInit);
|
|
25387
25525
|
const [saving, setSaving] = useState(false);
|
|
25388
25526
|
const [invalidKeys, setInvalidKeys] = useState(EMPTY_KEYS);
|
|
25389
|
-
const initialRef =
|
|
25527
|
+
const initialRef = React132__default.useRef(JSON.stringify(values));
|
|
25390
25528
|
useEffect(() => {
|
|
25391
25529
|
const init = computeInit();
|
|
25392
25530
|
setValues(init);
|
|
@@ -25446,7 +25584,7 @@ function CrudFormPageBody({ entityDef, mode, initialData, onSubmit, onSaved, onC
|
|
|
25446
25584
|
if (submitRef) submitRef.current = () => {
|
|
25447
25585
|
void submit();
|
|
25448
25586
|
};
|
|
25449
|
-
|
|
25587
|
+
React132__default.useEffect(() => () => {
|
|
25450
25588
|
if (submitRef) submitRef.current = null;
|
|
25451
25589
|
}, [submitRef]);
|
|
25452
25590
|
const dirty = JSON.stringify(values) !== initialRef.current;
|
|
@@ -26015,16 +26153,16 @@ function useUnitFilter(options = {}) {
|
|
|
26015
26153
|
const beginSwitch = useUnitSwitchingStore((s) => s.begin);
|
|
26016
26154
|
const can = usePermissionOptional();
|
|
26017
26155
|
const canManageUnits = can("units", "manage");
|
|
26018
|
-
const reachable =
|
|
26019
|
-
const [local2, setLocal] =
|
|
26020
|
-
|
|
26156
|
+
const reachable = React132.useMemo(() => unitFilterOptions(units, myUnitIds), [units, myUnitIds]);
|
|
26157
|
+
const [local2, setLocal] = React132.useState(activeUnitId);
|
|
26158
|
+
React132.useEffect(() => {
|
|
26021
26159
|
setLocal(activeUnitId);
|
|
26022
26160
|
}, [activeUnitId]);
|
|
26023
26161
|
const raw = scope === "global" ? activeUnitId : local2;
|
|
26024
26162
|
const value = standableUnit(raw, reachable);
|
|
26025
26163
|
const filterLabel = label(t, "units.filterLabel", "Unidade");
|
|
26026
26164
|
const allLabel = label(t, "units.filterAll", "Todas as minhas unidades");
|
|
26027
|
-
const setValue =
|
|
26165
|
+
const setValue = React132.useCallback((next) => {
|
|
26028
26166
|
if (scope === "global") {
|
|
26029
26167
|
if (next === activeUnitId) return;
|
|
26030
26168
|
beginSwitch({ unitId: next, unitName: next ? byId[next]?.name ?? "" : allLabel });
|
|
@@ -26033,7 +26171,7 @@ function useUnitFilter(options = {}) {
|
|
|
26033
26171
|
setLocal(next);
|
|
26034
26172
|
}, [scope, activeUnitId, beginSwitch, byId, allLabel]);
|
|
26035
26173
|
const visible = unitFilterVisible(unitMode, reachable);
|
|
26036
|
-
const def =
|
|
26174
|
+
const def = React132.useMemo(() => visible ? {
|
|
26037
26175
|
id: "unit",
|
|
26038
26176
|
label: filterLabel,
|
|
26039
26177
|
icon: Building2,
|
|
@@ -26114,6 +26252,7 @@ function CrudListView({
|
|
|
26114
26252
|
// que está visível — o dropdown de ordenar ao lado da busca lista todos
|
|
26115
26253
|
// os campos e diz a direção com todas as letras.
|
|
26116
26254
|
enableSorting: false,
|
|
26255
|
+
meta: { truncate: true },
|
|
26117
26256
|
cell: ({ row }) => {
|
|
26118
26257
|
const value = row.original[col.key];
|
|
26119
26258
|
const rendered = col.render(value, row.original);
|
|
@@ -26175,7 +26314,7 @@ function CrudListView({
|
|
|
26175
26314
|
if (onImport) {
|
|
26176
26315
|
createRoutes.push({ id: "import", label: t("crud.import.action"), description: t("crud.import.hint"), icon: "Upload", action: onImport });
|
|
26177
26316
|
}
|
|
26178
|
-
const createActions =
|
|
26317
|
+
const createActions = React132__default.useMemo(() => {
|
|
26179
26318
|
const out = createRoutes.map((qa, i) => ({
|
|
26180
26319
|
id: qa.id,
|
|
26181
26320
|
label: qa.label,
|
|
@@ -26588,9 +26727,9 @@ function buildCrudSurfaceContribution(read3) {
|
|
|
26588
26727
|
};
|
|
26589
26728
|
}
|
|
26590
26729
|
function CrudAgentSurface(props) {
|
|
26591
|
-
const ref =
|
|
26730
|
+
const ref = React132.useRef(props);
|
|
26592
26731
|
ref.current = props;
|
|
26593
|
-
const contribution =
|
|
26732
|
+
const contribution = React132.useMemo(
|
|
26594
26733
|
() => buildCrudSurfaceContribution(() => ref.current),
|
|
26595
26734
|
[]
|
|
26596
26735
|
);
|
|
@@ -26643,7 +26782,7 @@ function useFieldRules(entityKey) {
|
|
|
26643
26782
|
};
|
|
26644
26783
|
}, [entityKey, fieldRules]);
|
|
26645
26784
|
}
|
|
26646
|
-
var ImportWizard2 =
|
|
26785
|
+
var ImportWizard2 = React132__default.lazy(
|
|
26647
26786
|
() => import('./ImportWizard-7UFB2PPF.js').then((m) => ({ default: m.ImportWizard }))
|
|
26648
26787
|
);
|
|
26649
26788
|
var PAGE_SIZE = 50;
|
|
@@ -26705,6 +26844,7 @@ function useCrudColumns(entityDef, options) {
|
|
|
26705
26844
|
// coluna transformava a linha de títulos numa fileira de botões e ainda
|
|
26706
26845
|
// só alcançava as colunas visíveis. Ver o dropdown em CrudListView.
|
|
26707
26846
|
enableSorting: false,
|
|
26847
|
+
meta: { truncate: true },
|
|
26708
26848
|
cell: ({ row }) => {
|
|
26709
26849
|
const value = row.original[col.key];
|
|
26710
26850
|
const rendered = col.render(value, row.original);
|
|
@@ -26859,7 +26999,7 @@ function CrudPage({ entityDef: rawEntityDef, useStore: useStore2, basePath, disp
|
|
|
26859
26999
|
toast.success(t("crud.list.duplicated", { entity: entityDef.name }));
|
|
26860
27000
|
setCrudHash(normalizedBasePath, created.id, "edit");
|
|
26861
27001
|
} catch (err) {
|
|
26862
|
-
toast.error(
|
|
27002
|
+
toast.error(describeError(err));
|
|
26863
27003
|
}
|
|
26864
27004
|
}, [entityDef, store, t, normalizedBasePath]);
|
|
26865
27005
|
const tanColumns = useCrudColumns(entityDef, {
|
|
@@ -27164,7 +27304,7 @@ function CrudPage({ entityDef: rawEntityDef, useStore: useStore2, basePath, disp
|
|
|
27164
27304
|
console.error("[crud] deactivate failed", err);
|
|
27165
27305
|
toast.error(t("crud.list.deleteFailed", {
|
|
27166
27306
|
entity: entityDef.name.toLowerCase(),
|
|
27167
|
-
reason:
|
|
27307
|
+
reason: describeError(err)
|
|
27168
27308
|
}));
|
|
27169
27309
|
} finally {
|
|
27170
27310
|
navigateToList();
|
|
@@ -27177,7 +27317,7 @@ function CrudPage({ entityDef: rawEntityDef, useStore: useStore2, basePath, disp
|
|
|
27177
27317
|
console.error("[crud] delete failed", err);
|
|
27178
27318
|
toast.error(t("crud.list.deleteFailed", {
|
|
27179
27319
|
entity: entityDef.name.toLowerCase(),
|
|
27180
|
-
reason:
|
|
27320
|
+
reason: describeError(err)
|
|
27181
27321
|
}));
|
|
27182
27322
|
} finally {
|
|
27183
27323
|
navigateToList();
|
|
@@ -27215,7 +27355,7 @@ function CrudPage({ entityDef: rawEntityDef, useStore: useStore2, basePath, disp
|
|
|
27215
27355
|
mode: softDelete ? "deactivate" : "delete"
|
|
27216
27356
|
}
|
|
27217
27357
|
),
|
|
27218
|
-
/* @__PURE__ */ jsx(
|
|
27358
|
+
/* @__PURE__ */ jsx(React132__default.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
|
|
27219
27359
|
ImportWizard2,
|
|
27220
27360
|
{
|
|
27221
27361
|
open: importOpen,
|
|
@@ -27556,7 +27696,7 @@ function columnOf2(entity, key) {
|
|
|
27556
27696
|
function RelatedListTab({ item, related, parentTabId }) {
|
|
27557
27697
|
const parentId = item?.id;
|
|
27558
27698
|
const pathname = useHashPath();
|
|
27559
|
-
const Page =
|
|
27699
|
+
const Page = React132.useMemo(() => {
|
|
27560
27700
|
if (!parentId) return null;
|
|
27561
27701
|
const child = related.entity;
|
|
27562
27702
|
const fkColumn = columnOf2(child, related.foreignKey);
|
|
@@ -27596,8 +27736,8 @@ function nestedBasePath(pathname, parentTabId, childId) {
|
|
|
27596
27736
|
}
|
|
27597
27737
|
function useHashPath() {
|
|
27598
27738
|
const read3 = () => typeof window === "undefined" ? "/" : window.location.hash.slice(1) || "/";
|
|
27599
|
-
const [path, setPath] =
|
|
27600
|
-
|
|
27739
|
+
const [path, setPath] = React132.useState(read3);
|
|
27740
|
+
React132.useEffect(() => {
|
|
27601
27741
|
const handler = () => setPath(read3());
|
|
27602
27742
|
window.addEventListener("hashchange", handler);
|
|
27603
27743
|
return () => window.removeEventListener("hashchange", handler);
|
|
@@ -27677,7 +27817,7 @@ function RoleSummary({ roleId }) {
|
|
|
27677
27817
|
const profile = usePermissionsStore((s) => s.profiles.find((p) => p.id === roleId));
|
|
27678
27818
|
const features = usePermissionsStore((s) => s.features);
|
|
27679
27819
|
const canEditRoles = useSystemPermission()("manage_permissions");
|
|
27680
|
-
const groups =
|
|
27820
|
+
const groups = React132.useMemo(() => {
|
|
27681
27821
|
const map = /* @__PURE__ */ new Map();
|
|
27682
27822
|
for (const feature of features) {
|
|
27683
27823
|
const group = feature.group ?? t("crud.archetype.access.generalGroup");
|
|
@@ -27730,33 +27870,33 @@ function AccessTab({ item }) {
|
|
|
27730
27870
|
const hasSystemPermission = useSystemPermission();
|
|
27731
27871
|
const canManageTeam = hasSystemPermission("manage_team");
|
|
27732
27872
|
const guardSeats = useLimitGuard("users");
|
|
27733
|
-
const [access, setAccess] =
|
|
27734
|
-
const [email, setEmail] =
|
|
27735
|
-
const [roleId, setRoleId] =
|
|
27736
|
-
const [busy, setBusy] =
|
|
27737
|
-
const [confirmRemove, setConfirmRemove] =
|
|
27873
|
+
const [access, setAccess] = React132.useState(void 0);
|
|
27874
|
+
const [email, setEmail] = React132.useState(person?.email ?? "");
|
|
27875
|
+
const [roleId, setRoleId] = React132.useState("");
|
|
27876
|
+
const [busy, setBusy] = React132.useState(false);
|
|
27877
|
+
const [confirmRemove, setConfirmRemove] = React132.useState(false);
|
|
27738
27878
|
const suggestedRoleId = person?.metadata?.access?.suggested_role_id;
|
|
27739
|
-
|
|
27879
|
+
React132.useEffect(() => {
|
|
27740
27880
|
if (roleId || !profiles.length) return;
|
|
27741
27881
|
const sugerido = suggestedRoleId ? profiles.find((p) => p.id === suggestedRoleId) : void 0;
|
|
27742
27882
|
setRoleId(sugerido ? sugerido.id : profiles[1]?.id ?? profiles[0].id);
|
|
27743
27883
|
}, [profiles, roleId, suggestedRoleId]);
|
|
27744
|
-
|
|
27884
|
+
React132.useEffect(() => {
|
|
27745
27885
|
setEmail(person?.email ?? "");
|
|
27746
27886
|
}, [person?.email]);
|
|
27747
|
-
const
|
|
27887
|
+
const reload2 = React132.useCallback(async () => {
|
|
27748
27888
|
if (!personId) return;
|
|
27749
27889
|
setAccess(await fetchPersonAccess(personId));
|
|
27750
27890
|
}, [personId]);
|
|
27751
|
-
|
|
27752
|
-
void
|
|
27753
|
-
}, [
|
|
27754
|
-
|
|
27891
|
+
React132.useEffect(() => {
|
|
27892
|
+
void reload2();
|
|
27893
|
+
}, [reload2]);
|
|
27894
|
+
React132.useEffect(() => {
|
|
27755
27895
|
if (!adapter || !currentOrg || invites.length > 0) return;
|
|
27756
27896
|
adapter.listInvites(currentOrg.id).then(setInvites).catch(() => {
|
|
27757
27897
|
});
|
|
27758
27898
|
}, [adapter, currentOrg?.id]);
|
|
27759
|
-
const pendingInvite =
|
|
27899
|
+
const pendingInvite = React132.useMemo(() => {
|
|
27760
27900
|
const target = (person?.email ?? "").trim().toLowerCase();
|
|
27761
27901
|
if (!target) return void 0;
|
|
27762
27902
|
return invites.find((i) => i.status === "pending" && i.email.toLowerCase() === target);
|
|
@@ -27793,7 +27933,7 @@ function AccessTab({ item }) {
|
|
|
27793
27933
|
setBusy(true);
|
|
27794
27934
|
try {
|
|
27795
27935
|
await adapter.updateMemberProfile(currentOrg.id, access.memberId, nextRole);
|
|
27796
|
-
await
|
|
27936
|
+
await reload2();
|
|
27797
27937
|
} catch (err) {
|
|
27798
27938
|
toast.error(t("crud.archetype.access.roleFailed"), { description: err?.message });
|
|
27799
27939
|
} finally {
|
|
@@ -27805,7 +27945,7 @@ function AccessTab({ item }) {
|
|
|
27805
27945
|
setBusy(true);
|
|
27806
27946
|
try {
|
|
27807
27947
|
await adapter.removeMember(currentOrg.id, access.memberId);
|
|
27808
|
-
await
|
|
27948
|
+
await reload2();
|
|
27809
27949
|
invalidateLimit("users");
|
|
27810
27950
|
toast.success(t("crud.archetype.access.removed"));
|
|
27811
27951
|
} catch (err) {
|
|
@@ -27971,11 +28111,11 @@ function PersonUnitsTab({ item }) {
|
|
|
27971
28111
|
const units = useUnitStore((s) => s.units);
|
|
27972
28112
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
27973
28113
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
27974
|
-
const [userId, setUserId] =
|
|
27975
|
-
const [bindings, setBindings] =
|
|
27976
|
-
const [busy, setBusy] =
|
|
28114
|
+
const [userId, setUserId] = React132.useState(void 0);
|
|
28115
|
+
const [bindings, setBindings] = React132.useState({});
|
|
28116
|
+
const [busy, setBusy] = React132.useState(null);
|
|
27977
28117
|
const bindingsVersion = useDataVersion(UNIT_ACCESS_CHANGED);
|
|
27978
|
-
|
|
28118
|
+
React132.useEffect(() => {
|
|
27979
28119
|
if (!personId) return;
|
|
27980
28120
|
let alive = true;
|
|
27981
28121
|
void fetchUserIdForPerson(personId).then((uid2) => {
|
|
@@ -27985,20 +28125,20 @@ function PersonUnitsTab({ item }) {
|
|
|
27985
28125
|
alive = false;
|
|
27986
28126
|
};
|
|
27987
28127
|
}, [personId]);
|
|
27988
|
-
const
|
|
28128
|
+
const reload2 = React132.useCallback(async (uid2) => {
|
|
27989
28129
|
const rows = await fetchMemberUnits(uid2);
|
|
27990
28130
|
setBindings(Object.fromEntries(rows.map((r) => [r.locationId, r.role])));
|
|
27991
28131
|
}, []);
|
|
27992
|
-
|
|
27993
|
-
if (userId) void
|
|
27994
|
-
}, [userId,
|
|
28132
|
+
React132.useEffect(() => {
|
|
28133
|
+
if (userId) void reload2(userId);
|
|
28134
|
+
}, [userId, reload2, bindingsVersion]);
|
|
27995
28135
|
async function toggle(unitId, on) {
|
|
27996
28136
|
if (!userId) return;
|
|
27997
28137
|
setBusy(unitId);
|
|
27998
28138
|
try {
|
|
27999
28139
|
if (on) await bindUserToUnit(unitId, userId, null);
|
|
28000
28140
|
else await unbindUserFromUnit(unitId, userId);
|
|
28001
|
-
await
|
|
28141
|
+
await reload2(userId);
|
|
28002
28142
|
} catch (err) {
|
|
28003
28143
|
toast.error(on ? "N\xE3o deu para dar o acesso" : "N\xE3o deu para tirar o acesso", { description: err?.message });
|
|
28004
28144
|
} finally {
|
|
@@ -28010,7 +28150,7 @@ function PersonUnitsTab({ item }) {
|
|
|
28010
28150
|
setBusy(unitId);
|
|
28011
28151
|
try {
|
|
28012
28152
|
await bindUserToUnit(unitId, userId, role === NO_EXTRA_ROLE3 ? null : role);
|
|
28013
|
-
await
|
|
28153
|
+
await reload2(userId);
|
|
28014
28154
|
} catch (err) {
|
|
28015
28155
|
toast.error("N\xE3o deu para mudar a fun\xE7\xE3o", { description: err?.message });
|
|
28016
28156
|
} finally {
|
|
@@ -28087,13 +28227,13 @@ function PersonUnitsTab({ item }) {
|
|
|
28087
28227
|
function PersonAvailabilityTab({ item }) {
|
|
28088
28228
|
const person = item;
|
|
28089
28229
|
const personId = person?.id;
|
|
28090
|
-
const [units, setUnits] =
|
|
28091
|
-
const [selected, setSelected] =
|
|
28092
|
-
const [loading, setLoading] =
|
|
28093
|
-
const [busy, setBusy] =
|
|
28094
|
-
const [availabilityReady, setAvailabilityReady] =
|
|
28230
|
+
const [units, setUnits] = React132.useState([]);
|
|
28231
|
+
const [selected, setSelected] = React132.useState(/* @__PURE__ */ new Set());
|
|
28232
|
+
const [loading, setLoading] = React132.useState(true);
|
|
28233
|
+
const [busy, setBusy] = React132.useState(false);
|
|
28234
|
+
const [availabilityReady, setAvailabilityReady] = React132.useState(true);
|
|
28095
28235
|
const db2 = () => getSupabaseClientOptional();
|
|
28096
|
-
const load =
|
|
28236
|
+
const load = React132.useCallback(async () => {
|
|
28097
28237
|
const client3 = db2();
|
|
28098
28238
|
if (!client3 || !personId) {
|
|
28099
28239
|
setLoading(false);
|
|
@@ -28122,7 +28262,7 @@ function PersonAvailabilityTab({ item }) {
|
|
|
28122
28262
|
setLoading(false);
|
|
28123
28263
|
}
|
|
28124
28264
|
}, [personId]);
|
|
28125
|
-
|
|
28265
|
+
React132.useEffect(() => {
|
|
28126
28266
|
void load();
|
|
28127
28267
|
}, [load]);
|
|
28128
28268
|
async function makeOrganizationWide() {
|
|
@@ -28200,10 +28340,10 @@ function PersonAvailabilityTab({ item }) {
|
|
|
28200
28340
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Sem nenhuma sele\xE7\xE3o, o cadastro \xE9 da organiza\xE7\xE3o e aparece em todas as unidades. Com sele\xE7\xF5es, aparece somente nas unidades marcadas." })
|
|
28201
28341
|
] }) });
|
|
28202
28342
|
}
|
|
28203
|
-
var ScheduleEditor2 =
|
|
28343
|
+
var ScheduleEditor2 = React132__default.lazy(
|
|
28204
28344
|
() => import('./ScheduleEditor-ZEG6PG3Z.js').then((m) => ({ default: m.ScheduleEditor }))
|
|
28205
28345
|
);
|
|
28206
|
-
var PersonTimeline2 =
|
|
28346
|
+
var PersonTimeline2 = React132__default.lazy(
|
|
28207
28347
|
() => import('./timeline-LECYQ4IA.js').then((m) => ({ default: m.PersonTimeline }))
|
|
28208
28348
|
);
|
|
28209
28349
|
function ComingSoon({ icon: Icon, title, description }) {
|
|
@@ -28227,7 +28367,7 @@ function ActivityTab({ item, recordPath }) {
|
|
|
28227
28367
|
}
|
|
28228
28368
|
);
|
|
28229
28369
|
}
|
|
28230
|
-
return /* @__PURE__ */ jsx(
|
|
28370
|
+
return /* @__PURE__ */ jsx(React132__default.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(PersonTimeline2, { personId: item.id, recordPath }) });
|
|
28231
28371
|
}
|
|
28232
28372
|
function DocumentsTab({ item }) {
|
|
28233
28373
|
const t = useTranslation();
|
|
@@ -28339,7 +28479,7 @@ function ScheduleTab({ item }) {
|
|
|
28339
28479
|
return (
|
|
28340
28480
|
// O interruptor "Aparece na agenda" agora vem DENTRO do editor: era a
|
|
28341
28481
|
// única coisa que esta porta mostrava e a da agenda não.
|
|
28342
|
-
/* @__PURE__ */ jsx(
|
|
28482
|
+
/* @__PURE__ */ jsx(React132__default.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(ScheduleEditor2, { assigneeId: item.id }) })
|
|
28343
28483
|
);
|
|
28344
28484
|
}
|
|
28345
28485
|
var PERSON_DETAIL_TABS = [
|
|
@@ -28826,7 +28966,7 @@ function InlineEditor({
|
|
|
28826
28966
|
}) {
|
|
28827
28967
|
const [draft, setDraft] = useState(value ?? "");
|
|
28828
28968
|
const [saving, setSaving] = useState(false);
|
|
28829
|
-
const inputRef =
|
|
28969
|
+
const inputRef = React132__default.useRef(null);
|
|
28830
28970
|
useEffect(() => {
|
|
28831
28971
|
inputRef.current?.focus();
|
|
28832
28972
|
if (inputRef.current instanceof HTMLInputElement) inputRef.current.select();
|
|
@@ -29197,9 +29337,9 @@ function CrudDetailPage({
|
|
|
29197
29337
|
const t = useTranslation();
|
|
29198
29338
|
const [pending2, setPending] = useState({});
|
|
29199
29339
|
const [savingDraft, setSavingDraft] = useState(false);
|
|
29200
|
-
const pendingKeys =
|
|
29340
|
+
const pendingKeys = React132__default.useMemo(() => new Set(Object.keys(pending2)), [pending2]);
|
|
29201
29341
|
const dirty = pendingKeys.size > 0;
|
|
29202
|
-
const view =
|
|
29342
|
+
const view = React132__default.useMemo(
|
|
29203
29343
|
() => dirty ? { ...item, ...pending2 } : item,
|
|
29204
29344
|
[item, pending2, dirty]
|
|
29205
29345
|
);
|
|
@@ -29249,7 +29389,7 @@ function CrudDetailPage({
|
|
|
29249
29389
|
const isMyRecord = Boolean(myPersonId) && myPersonId === item.id;
|
|
29250
29390
|
const nameEditable = Boolean(onFieldSave || onFieldsSave) && Boolean(displayFieldDef) && isInlineEditable(displayFieldDef);
|
|
29251
29391
|
const [editingName, setEditingName] = useState(false);
|
|
29252
|
-
const imageInputRef =
|
|
29392
|
+
const imageInputRef = React132__default.useRef(null);
|
|
29253
29393
|
const runtime = usePluginRuntimeOptional();
|
|
29254
29394
|
const archetypeTabs = getArchetypeTabs(entityDef.layout, entityDef.data?.archetypeKind);
|
|
29255
29395
|
const relatedTabs = (entityDef.relatedLists ?? []).map((related) => ({
|
|
@@ -29259,7 +29399,7 @@ function CrudDetailPage({
|
|
|
29259
29399
|
component: (props) => /* @__PURE__ */ jsx(RelatedListTab, { ...props, related })
|
|
29260
29400
|
}));
|
|
29261
29401
|
const unitMode = useUnitMode();
|
|
29262
|
-
const fieldGroupTabs =
|
|
29402
|
+
const fieldGroupTabs = React132__default.useMemo(() => {
|
|
29263
29403
|
const groups = entityDef.fieldGroups ?? [];
|
|
29264
29404
|
if (!groups.some((g) => g.tab) || !item) return [];
|
|
29265
29405
|
const applicable = new Set(visibleDetailFields(entityDef, item).map((f) => f.group));
|
|
@@ -29342,7 +29482,7 @@ function CrudDetailPage({
|
|
|
29342
29482
|
window.history.replaceState(null, "", `#${segments.length ? `${base}/${segments.join("/")}` : base}`);
|
|
29343
29483
|
}, [basePath, item.id, selectedTab, embedded]);
|
|
29344
29484
|
const parentLabel = usePresetLabel(basePath, namePlural);
|
|
29345
|
-
const headerNode =
|
|
29485
|
+
const headerNode = React132__default.useMemo(
|
|
29346
29486
|
() => embedded ? null : /* @__PURE__ */ jsx(SubpageHeader, { title: displayValue, parentLabel, onBack }),
|
|
29347
29487
|
[embedded, displayValue, parentLabel, onBack]
|
|
29348
29488
|
);
|
|
@@ -29474,7 +29614,7 @@ function CrudDetailPage({
|
|
|
29474
29614
|
})
|
|
29475
29615
|
] }),
|
|
29476
29616
|
/* @__PURE__ */ jsxs(TabsContent, { value: "overview", className: embedded ? "mt-2" : "mt-4", children: [
|
|
29477
|
-
entityDef.overviewComponent ?
|
|
29617
|
+
entityDef.overviewComponent ? React132__default.createElement(entityDef.overviewComponent, { item, entityDef }) : /* @__PURE__ */ jsx(
|
|
29478
29618
|
OverviewTab,
|
|
29479
29619
|
{
|
|
29480
29620
|
entityDef,
|
|
@@ -29493,7 +29633,7 @@ function CrudDetailPage({
|
|
|
29493
29633
|
// `tabPath` only to the tab the URL is actually addressing —
|
|
29494
29634
|
// handing it to every tab would have the documents tab trying to
|
|
29495
29635
|
// open a recording id when the user switches across.
|
|
29496
|
-
|
|
29636
|
+
React132__default.createElement(tab.component, {
|
|
29497
29637
|
item,
|
|
29498
29638
|
entityDef,
|
|
29499
29639
|
// A rota DESTE registro. Uma aba que lista eventos precisa
|
|
@@ -29534,8 +29674,8 @@ function MyRecordPanel() {
|
|
|
29534
29674
|
const userId = useAuthStore((s) => s.user?.id);
|
|
29535
29675
|
const members = useOrganizationStore((s) => s.members);
|
|
29536
29676
|
const myRole = members.find((m) => m.userId === userId)?.profileName;
|
|
29537
|
-
const [state, setState] =
|
|
29538
|
-
const load =
|
|
29677
|
+
const [state, setState] = React132.useState({ status: "loading" });
|
|
29678
|
+
const load = React132.useCallback(async () => {
|
|
29539
29679
|
if (!orgId || !userId) return;
|
|
29540
29680
|
const person = await dedup(`self:record:${orgId}:${userId}`, () => fetchMyPersonRecord(orgId, userId));
|
|
29541
29681
|
if (!person) return setState({ status: "none" });
|
|
@@ -29552,10 +29692,10 @@ function MyRecordPanel() {
|
|
|
29552
29692
|
setState({ status: "none" });
|
|
29553
29693
|
}
|
|
29554
29694
|
}, [orgId, userId]);
|
|
29555
|
-
|
|
29695
|
+
React132.useEffect(() => {
|
|
29556
29696
|
void load();
|
|
29557
29697
|
}, [load]);
|
|
29558
|
-
const changePhoto =
|
|
29698
|
+
const changePhoto = React132.useCallback(async (file) => {
|
|
29559
29699
|
if (state.status !== "ready") return;
|
|
29560
29700
|
const supabase = getFayzSupabaseClientOptional();
|
|
29561
29701
|
if (!supabase) return;
|
|
@@ -29611,8 +29751,8 @@ function ConnectedUserProfile() {
|
|
|
29611
29751
|
const myPersonId = useMyPersonId();
|
|
29612
29752
|
const hasRecord = Boolean(myPersonId);
|
|
29613
29753
|
const setUser = useAuthStore((s) => s.setUser);
|
|
29614
|
-
const [profile, setProfile] =
|
|
29615
|
-
|
|
29754
|
+
const [profile, setProfile] = React132.useState(null);
|
|
29755
|
+
React132.useEffect(() => {
|
|
29616
29756
|
const supabase = getFayzSupabaseClientOptional();
|
|
29617
29757
|
if (!user || !supabase) return;
|
|
29618
29758
|
let cancelled = false;
|
|
@@ -29723,9 +29863,9 @@ function SecuritySettings({
|
|
|
29723
29863
|
onTenantSecurityChange
|
|
29724
29864
|
}) {
|
|
29725
29865
|
const { t } = useTranslation$1();
|
|
29726
|
-
const [resetting, setResetting] =
|
|
29727
|
-
const [resetSent, setResetSent] =
|
|
29728
|
-
const [savingTenant, setSavingTenant] =
|
|
29866
|
+
const [resetting, setResetting] = React132.useState(false);
|
|
29867
|
+
const [resetSent, setResetSent] = React132.useState(false);
|
|
29868
|
+
const [savingTenant, setSavingTenant] = React132.useState(false);
|
|
29729
29869
|
const handleResetPassword = async () => {
|
|
29730
29870
|
if (!onResetPassword) return;
|
|
29731
29871
|
setResetting(true);
|
|
@@ -29899,8 +30039,8 @@ function FileUploadField({
|
|
|
29899
30039
|
hint
|
|
29900
30040
|
}) {
|
|
29901
30041
|
const { t } = useTranslation$1();
|
|
29902
|
-
const inputRef =
|
|
29903
|
-
const [preview, setPreview] =
|
|
30042
|
+
const inputRef = React132.useRef(null);
|
|
30043
|
+
const [preview, setPreview] = React132.useState(null);
|
|
29904
30044
|
const handleChange = (e) => {
|
|
29905
30045
|
const file = e.target.files?.[0];
|
|
29906
30046
|
if (file) {
|
|
@@ -30122,13 +30262,13 @@ function SkinGate({ children }) {
|
|
|
30122
30262
|
}
|
|
30123
30263
|
function BrandingSettings({ brand, onSave }) {
|
|
30124
30264
|
const { t } = useTranslation$1();
|
|
30125
|
-
const [section, setSection] =
|
|
30126
|
-
const [saved, setSaved] =
|
|
30127
|
-
const [draft, setDraft] =
|
|
30128
|
-
const [logoFile, setLogoFile] =
|
|
30129
|
-
const [faviconFile, setFaviconFile] =
|
|
30130
|
-
const [saving, setSaving] =
|
|
30131
|
-
|
|
30265
|
+
const [section, setSection] = React132.useState("identity");
|
|
30266
|
+
const [saved, setSaved] = React132.useState(brand ?? EMPTY_BRAND);
|
|
30267
|
+
const [draft, setDraft] = React132.useState(brand ?? EMPTY_BRAND);
|
|
30268
|
+
const [logoFile, setLogoFile] = React132.useState(null);
|
|
30269
|
+
const [faviconFile, setFaviconFile] = React132.useState(null);
|
|
30270
|
+
const [saving, setSaving] = React132.useState(false);
|
|
30271
|
+
React132.useEffect(() => {
|
|
30132
30272
|
if (brand) {
|
|
30133
30273
|
setSaved(brand);
|
|
30134
30274
|
setDraft(brand);
|
|
@@ -30502,11 +30642,11 @@ function ConnectedBrandingSettings() {
|
|
|
30502
30642
|
toast.error("N\xE3o foi poss\xEDvel salvar a marca", { description: err?.message });
|
|
30503
30643
|
}
|
|
30504
30644
|
};
|
|
30505
|
-
const [brand, setBrand] =
|
|
30645
|
+
const [brand, setBrand] = React132.useState(() => normalizeBrand(
|
|
30506
30646
|
(currentOrg?.settings ?? {}).branding,
|
|
30507
30647
|
{ name: currentOrg?.name, logoUrl: currentOrg?.logoUrl }
|
|
30508
30648
|
));
|
|
30509
|
-
|
|
30649
|
+
React132.useEffect(() => {
|
|
30510
30650
|
let alive = true;
|
|
30511
30651
|
void (async () => {
|
|
30512
30652
|
try {
|
|
@@ -30627,12 +30767,12 @@ function ProjectsSettings() {
|
|
|
30627
30767
|
const projects = useFayzProjectsStore((s) => s.projects);
|
|
30628
30768
|
const load = useFayzProjectsStore((s) => s.load);
|
|
30629
30769
|
const refresh = useFayzProjectsStore((s) => s.refresh);
|
|
30630
|
-
const [linking, setLinking] =
|
|
30770
|
+
const [linking, setLinking] = React132.useState(false);
|
|
30631
30771
|
const connected = isPlatformConnected();
|
|
30632
|
-
|
|
30772
|
+
React132.useEffect(() => {
|
|
30633
30773
|
void load(currentOrgId);
|
|
30634
30774
|
}, [currentOrgId, load]);
|
|
30635
|
-
|
|
30775
|
+
React132.useEffect(() => {
|
|
30636
30776
|
if (!connected || projects.length === 0) return;
|
|
30637
30777
|
let cancelled = false;
|
|
30638
30778
|
void (async () => {
|
|
@@ -30704,7 +30844,7 @@ function SiteRow({
|
|
|
30704
30844
|
showDefaultAction,
|
|
30705
30845
|
onChanged
|
|
30706
30846
|
}) {
|
|
30707
|
-
const [busy, setBusy] =
|
|
30847
|
+
const [busy, setBusy] = React132.useState(false);
|
|
30708
30848
|
const editorUrl = editorUrlOf(project);
|
|
30709
30849
|
const run = async (action) => {
|
|
30710
30850
|
setBusy(true);
|
|
@@ -30775,7 +30915,7 @@ function SiteRow({
|
|
|
30775
30915
|
] });
|
|
30776
30916
|
}
|
|
30777
30917
|
function LinkSiteModal({ onClose, onLinked }) {
|
|
30778
|
-
const [mode, setMode] =
|
|
30918
|
+
const [mode, setMode] = React132.useState("import");
|
|
30779
30919
|
return /* @__PURE__ */ jsx(Modal, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs(ModalContent, { size: "lg", children: [
|
|
30780
30920
|
/* @__PURE__ */ jsxs(ModalHeader, { children: [
|
|
30781
30921
|
/* @__PURE__ */ jsx(ModalTitle, { children: "Vincular um site" }),
|
|
@@ -30811,11 +30951,11 @@ function ModeTab({
|
|
|
30811
30951
|
}
|
|
30812
30952
|
function ImportPane({ onLinked }) {
|
|
30813
30953
|
const linked = useFayzProjectsStore((s) => s.projects);
|
|
30814
|
-
const [search, setSearch] =
|
|
30815
|
-
const [remote, setRemote] =
|
|
30816
|
-
const [error, setError] =
|
|
30817
|
-
const [linkingId, setLinkingId] =
|
|
30818
|
-
|
|
30954
|
+
const [search, setSearch] = React132.useState("");
|
|
30955
|
+
const [remote, setRemote] = React132.useState(null);
|
|
30956
|
+
const [error, setError] = React132.useState(null);
|
|
30957
|
+
const [linkingId, setLinkingId] = React132.useState(null);
|
|
30958
|
+
React132.useEffect(() => {
|
|
30819
30959
|
let cancelled = false;
|
|
30820
30960
|
setError(null);
|
|
30821
30961
|
const timer = setTimeout(() => {
|
|
@@ -30850,7 +30990,7 @@ function ImportPane({ onLinked }) {
|
|
|
30850
30990
|
});
|
|
30851
30991
|
onLinked();
|
|
30852
30992
|
} catch (cause) {
|
|
30853
|
-
setError(cause
|
|
30993
|
+
setError(describeError(cause, "N\xE3o foi poss\xEDvel vincular"));
|
|
30854
30994
|
setLinkingId(null);
|
|
30855
30995
|
}
|
|
30856
30996
|
};
|
|
@@ -30897,9 +31037,9 @@ function ImportPane({ onLinked }) {
|
|
|
30897
31037
|
}
|
|
30898
31038
|
function CreatePane({ onLinked, onCancel }) {
|
|
30899
31039
|
const linked = useFayzProjectsStore((s) => s.projects);
|
|
30900
|
-
const [prompt, setPrompt] =
|
|
30901
|
-
const [busy, setBusy] =
|
|
30902
|
-
const [error, setError] =
|
|
31040
|
+
const [prompt, setPrompt] = React132.useState("");
|
|
31041
|
+
const [busy, setBusy] = React132.useState(false);
|
|
31042
|
+
const [error, setError] = React132.useState(null);
|
|
30903
31043
|
const tooShort = prompt.trim().length < PROMPT_MIN_CHARS;
|
|
30904
31044
|
const submit = async () => {
|
|
30905
31045
|
setBusy(true);
|
|
@@ -30919,7 +31059,7 @@ function CreatePane({ onLinked, onCancel }) {
|
|
|
30919
31059
|
});
|
|
30920
31060
|
onLinked();
|
|
30921
31061
|
} catch (cause) {
|
|
30922
|
-
setError(cause
|
|
31062
|
+
setError(describeError(cause, "N\xE3o foi poss\xEDvel criar o site"));
|
|
30923
31063
|
setBusy(false);
|
|
30924
31064
|
}
|
|
30925
31065
|
};
|
|
@@ -31088,10 +31228,10 @@ function ModuleCatalogSections({
|
|
|
31088
31228
|
onToggle,
|
|
31089
31229
|
busy
|
|
31090
31230
|
}) {
|
|
31091
|
-
const [query, setQuery] =
|
|
31231
|
+
const [query, setQuery] = React132.useState("");
|
|
31092
31232
|
const total = categories.reduce((n, c) => n + c.rows.length, 0);
|
|
31093
31233
|
const searchable = total > 6;
|
|
31094
|
-
const filtered =
|
|
31234
|
+
const filtered = React132.useMemo(() => filterCategories(categories, query), [categories, query]);
|
|
31095
31235
|
if (categories.length === 0) {
|
|
31096
31236
|
return /* @__PURE__ */ jsxs("div", { className: "py-8 text-center", children: [
|
|
31097
31237
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: "Nada a adicionar" }),
|
|
@@ -31133,7 +31273,7 @@ function CategorySection({
|
|
|
31133
31273
|
onToggle,
|
|
31134
31274
|
busy
|
|
31135
31275
|
}) {
|
|
31136
|
-
const [open, setOpen] =
|
|
31276
|
+
const [open, setOpen] = React132.useState(category.mine);
|
|
31137
31277
|
const expanded = open || forceOpen;
|
|
31138
31278
|
const Chevron = expanded ? ChevronDown : ChevronRight;
|
|
31139
31279
|
return /* @__PURE__ */ jsxs("section", { children: [
|
|
@@ -31264,8 +31404,8 @@ function buildCategories(catalog, rows) {
|
|
|
31264
31404
|
}
|
|
31265
31405
|
function useModuleCatalog() {
|
|
31266
31406
|
const tenantId2 = useOrganizationStore((s) => s.currentOrg?.id ?? null);
|
|
31267
|
-
const [catalog, setCatalog] =
|
|
31268
|
-
|
|
31407
|
+
const [catalog, setCatalog] = React132.useState([]);
|
|
31408
|
+
React132.useEffect(() => {
|
|
31269
31409
|
const supabase = getSupabaseClientOptional$1();
|
|
31270
31410
|
if (!supabase) return;
|
|
31271
31411
|
let alive = true;
|
|
@@ -31282,7 +31422,7 @@ function useModuleCatalog() {
|
|
|
31282
31422
|
function ModulesPreview() {
|
|
31283
31423
|
const runtime = usePluginRuntime();
|
|
31284
31424
|
const preset = useAppPreset();
|
|
31285
|
-
const rows =
|
|
31425
|
+
const rows = React132.useMemo(() => {
|
|
31286
31426
|
const flat = runtime.navigation.filter((entry) => entry.section !== "settings").map((entry) => toRailRow(entry, preset.labels));
|
|
31287
31427
|
return applyRailPreset(flat, preset.rail, preset.hide, preset.whole);
|
|
31288
31428
|
}, [runtime.navigation, preset.rail, preset.hide, preset.whole, preset.labels]);
|
|
@@ -31326,15 +31466,15 @@ function PreviewRow({ row, depth = 0 }) {
|
|
|
31326
31466
|
function ModulesSettings({ hidden = [], onToggle, permits, busy, catalog = [] }) {
|
|
31327
31467
|
const runtime = usePluginRuntime();
|
|
31328
31468
|
const offered = useOfferedPlugins();
|
|
31329
|
-
const [adding, setAdding] =
|
|
31330
|
-
const rows =
|
|
31469
|
+
const [adding, setAdding] = React132.useState(false);
|
|
31470
|
+
const rows = React132.useMemo(() => {
|
|
31331
31471
|
const known = catalog.length ? new Set(catalog.flatMap((app) => app.modules)) : new Set(offered);
|
|
31332
31472
|
const inCatalogue = known.size ? runtime.plugins.filter((p) => known.has(p.id) || p.isActive) : runtime.plugins;
|
|
31333
31473
|
return buildRows(inCatalogue, new Set(hidden), permits);
|
|
31334
31474
|
}, [runtime.plugins, hidden, permits, offered, catalog]);
|
|
31335
31475
|
const on = rows.filter((r) => r.plugin.isActive);
|
|
31336
|
-
const off =
|
|
31337
|
-
const categories =
|
|
31476
|
+
const off = React132.useMemo(() => rows.filter((r) => !r.plugin.isActive), [rows]);
|
|
31477
|
+
const categories = React132.useMemo(() => buildCategories(catalog, off), [catalog, off]);
|
|
31338
31478
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-8", children: [
|
|
31339
31479
|
/* @__PURE__ */ jsx(PageHeaderActions, { children: /* @__PURE__ */ jsxs(Button, { size: "sm", className: "shrink-0 gap-1.5", onClick: () => setAdding(true), children: [
|
|
31340
31480
|
/* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
|
|
@@ -31554,8 +31694,8 @@ function ConnectedModulesSettings({ hidden = SHELL_PLUGINS }) {
|
|
|
31554
31694
|
const access = useAccessOptional();
|
|
31555
31695
|
const catalog = useModuleCatalog();
|
|
31556
31696
|
const tenantId2 = useOrganizationStore((s) => s.currentOrg?.id ?? null);
|
|
31557
|
-
const [busy, setBusy] =
|
|
31558
|
-
const onToggle =
|
|
31697
|
+
const [busy, setBusy] = React132.useState(false);
|
|
31698
|
+
const onToggle = React132.useCallback(
|
|
31559
31699
|
async (plugin, status, facet) => {
|
|
31560
31700
|
const supabase = getSupabaseClientOptional$1();
|
|
31561
31701
|
if (!supabase) return;
|
|
@@ -31581,7 +31721,7 @@ function ConnectedModulesSettings({ hidden = SHELL_PLUGINS }) {
|
|
|
31581
31721
|
},
|
|
31582
31722
|
[refresh, tenantId2]
|
|
31583
31723
|
);
|
|
31584
|
-
const permits =
|
|
31724
|
+
const permits = React132.useCallback(
|
|
31585
31725
|
(plugin) => access ? access.can(plugin, "read").allowed || access.entitled(plugin) : true,
|
|
31586
31726
|
[access]
|
|
31587
31727
|
);
|
|
@@ -31592,7 +31732,7 @@ function useCoreSettingsTabs({
|
|
|
31592
31732
|
showBranding = true
|
|
31593
31733
|
} = {}) {
|
|
31594
31734
|
const { t } = useTranslation$1();
|
|
31595
|
-
return
|
|
31735
|
+
return React132.useMemo(() => [
|
|
31596
31736
|
...showCompany ? [{ id: "general", label: t("settings.general"), icon: /* @__PURE__ */ jsx(Building2, { className: "h-4 w-4" }), iconName: "Building2", component: /* @__PURE__ */ jsx(ConnectedCompanySettings, {}) }] : [],
|
|
31597
31737
|
{ id: "profile", label: t("settings.profile"), icon: /* @__PURE__ */ jsx(User, { className: "h-4 w-4" }), iconName: "User", component: /* @__PURE__ */ jsx(ConnectedUserProfile, {}) },
|
|
31598
31738
|
{ id: "security", label: t("settings.security"), icon: /* @__PURE__ */ jsx(Shield, { className: "h-4 w-4" }), iconName: "Shield", component: /* @__PURE__ */ jsx(ConnectedSecuritySettings, {}) },
|
|
@@ -31637,10 +31777,10 @@ function SettingsPage({
|
|
|
31637
31777
|
}
|
|
31638
31778
|
return null;
|
|
31639
31779
|
}
|
|
31640
|
-
const [activeTab, setActiveTab] =
|
|
31780
|
+
const [activeTab, setActiveTab] = React132.useState(() => {
|
|
31641
31781
|
return getTabFromHash() ?? defaultTab ?? null;
|
|
31642
31782
|
});
|
|
31643
|
-
|
|
31783
|
+
React132.useEffect(() => {
|
|
31644
31784
|
const handler = () => {
|
|
31645
31785
|
const tab = getTabFromHash();
|
|
31646
31786
|
if (tab) setActiveTab(tab);
|
|
@@ -31667,8 +31807,8 @@ function SettingsPage({
|
|
|
31667
31807
|
setActiveTab(null);
|
|
31668
31808
|
window.location.hash = "/settings";
|
|
31669
31809
|
};
|
|
31670
|
-
const [query, setQuery] =
|
|
31671
|
-
const sections =
|
|
31810
|
+
const [query, setQuery] = React132.useState("");
|
|
31811
|
+
const sections = React132.useMemo(() => {
|
|
31672
31812
|
const q = query.trim().toLowerCase();
|
|
31673
31813
|
const out = [];
|
|
31674
31814
|
for (const tab of resolvedTabs) {
|
|
@@ -31753,14 +31893,14 @@ function InviteMemberDialog({ open, onOpenChange, defaultEmail }) {
|
|
|
31753
31893
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
31754
31894
|
const setInvites = useInviteStore((s) => s.setInvites);
|
|
31755
31895
|
const { user } = useAuthStore();
|
|
31756
|
-
const [emails, setEmails] =
|
|
31757
|
-
const [profileId, setProfileId] =
|
|
31758
|
-
const [sending, setSending] =
|
|
31759
|
-
const [sent, setSent] =
|
|
31760
|
-
|
|
31896
|
+
const [emails, setEmails] = React132.useState([defaultEmail ?? ""]);
|
|
31897
|
+
const [profileId, setProfileId] = React132.useState(profiles[1]?.id ?? profiles[0]?.id ?? "");
|
|
31898
|
+
const [sending, setSending] = React132.useState(false);
|
|
31899
|
+
const [sent, setSent] = React132.useState(false);
|
|
31900
|
+
React132.useEffect(() => {
|
|
31761
31901
|
if (open) setEmails([defaultEmail ?? ""]);
|
|
31762
31902
|
}, [open, defaultEmail]);
|
|
31763
|
-
|
|
31903
|
+
React132.useEffect(() => {
|
|
31764
31904
|
if (!profileId && profiles.length) setProfileId(profiles[1]?.id ?? profiles[0].id);
|
|
31765
31905
|
}, [profiles, profileId]);
|
|
31766
31906
|
const addEmail = () => setEmails((prev) => [...prev, ""]);
|
|
@@ -31864,7 +32004,7 @@ function UnitSwitcher({ collapsed = false, className }) {
|
|
|
31864
32004
|
const myUnitIds = useUnitStore((s) => s.myUnitIds);
|
|
31865
32005
|
const activeUnitId = useUnitStore((s) => s.activeUnitId);
|
|
31866
32006
|
const beginSwitch = useUnitSwitchingStore((s) => s.begin);
|
|
31867
|
-
const [query, setQuery] =
|
|
32007
|
+
const [query, setQuery] = React132.useState("");
|
|
31868
32008
|
const singular = label2(t, "unit.singular", "unidade");
|
|
31869
32009
|
const plural = label2(t, "unit.plural", "unidades");
|
|
31870
32010
|
if (!unitMode) return null;
|
|
@@ -31889,13 +32029,13 @@ function UnitSwitcher({ collapsed = false, className }) {
|
|
|
31889
32029
|
}
|
|
31890
32030
|
const renderNode = (node, depth) => {
|
|
31891
32031
|
if (node.kind === "region") {
|
|
31892
|
-
return /* @__PURE__ */ jsxs(
|
|
32032
|
+
return /* @__PURE__ */ jsxs(React132.Fragment, { children: [
|
|
31893
32033
|
/* @__PURE__ */ jsx(DropdownLabel, { className: "px-2 pt-2 text-[10px] uppercase tracking-wide text-muted-foreground", children: node.name }),
|
|
31894
32034
|
node.children.map((child) => renderNode(child, depth + 1))
|
|
31895
32035
|
] }, node.id);
|
|
31896
32036
|
}
|
|
31897
32037
|
if (!reachable.includes(node.id)) return null;
|
|
31898
|
-
return /* @__PURE__ */ jsxs(
|
|
32038
|
+
return /* @__PURE__ */ jsxs(React132.Fragment, { children: [
|
|
31899
32039
|
/* @__PURE__ */ jsxs(
|
|
31900
32040
|
DropdownItem,
|
|
31901
32041
|
{
|
|
@@ -31978,7 +32118,7 @@ function UnitSwitcher({ collapsed = false, className }) {
|
|
|
31978
32118
|
var MENU_LIST_CAP = 5;
|
|
31979
32119
|
function UnitMenuSection() {
|
|
31980
32120
|
useUnitBootstrap();
|
|
31981
|
-
const [locating, setLocating] =
|
|
32121
|
+
const [locating, setLocating] = React132.useState(false);
|
|
31982
32122
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
31983
32123
|
const units = useUnitStore((s) => s.units);
|
|
31984
32124
|
const tree = useUnitStore((s) => s.tree);
|
|
@@ -32029,13 +32169,13 @@ function UnitMenuSection() {
|
|
|
32029
32169
|
if (node.kind === "region") {
|
|
32030
32170
|
const visibleChildren = node.children.filter((c) => c.kind === "region" || reachable.includes(c.id));
|
|
32031
32171
|
if (visibleChildren.length === 0) return null;
|
|
32032
|
-
return /* @__PURE__ */ jsxs(
|
|
32172
|
+
return /* @__PURE__ */ jsxs(React132.Fragment, { children: [
|
|
32033
32173
|
/* @__PURE__ */ jsx(DropdownLabel, { className: "px-2 pt-2 text-[10px] uppercase tracking-wide text-muted-foreground", children: node.name }),
|
|
32034
32174
|
visibleChildren.map((child) => renderNode(child, depth + 1))
|
|
32035
32175
|
] }, node.id);
|
|
32036
32176
|
}
|
|
32037
32177
|
if (!reachable.includes(node.id)) return null;
|
|
32038
|
-
return /* @__PURE__ */ jsxs(
|
|
32178
|
+
return /* @__PURE__ */ jsxs(React132.Fragment, { children: [
|
|
32039
32179
|
/* @__PURE__ */ jsxs(
|
|
32040
32180
|
DropdownItem,
|
|
32041
32181
|
{
|
|
@@ -32154,7 +32294,7 @@ var UNIT_DETAIL_TABS = [
|
|
|
32154
32294
|
{ id: "activity", label: "Activity", hidden: true }
|
|
32155
32295
|
];
|
|
32156
32296
|
function SuggestInput({ column, value, onChange, placeholder }) {
|
|
32157
|
-
const search =
|
|
32297
|
+
const search = React132__default.useCallback(async (query) => {
|
|
32158
32298
|
const supabase = getSupabaseClientOptional();
|
|
32159
32299
|
if (!supabase) return [];
|
|
32160
32300
|
const { data } = await supabase.from("v_units").select(column).not(column, "is", null).limit(500);
|
|
@@ -32431,9 +32571,9 @@ function MemberUnitsCell({
|
|
|
32431
32571
|
const byId = useUnitStore((s) => s.byId);
|
|
32432
32572
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
32433
32573
|
const openUnit = useUnitPanel((s) => s.openUnit);
|
|
32434
|
-
const [unitIds, setUnitIds] =
|
|
32574
|
+
const [unitIds, setUnitIds] = React132.useState(null);
|
|
32435
32575
|
const version5 = useDataVersion(UNIT_ACCESS_CHANGED);
|
|
32436
|
-
|
|
32576
|
+
React132.useEffect(() => {
|
|
32437
32577
|
if (!userId) {
|
|
32438
32578
|
setUnitIds([]);
|
|
32439
32579
|
return;
|
|
@@ -32479,10 +32619,10 @@ function MemberUnitsCell({
|
|
|
32479
32619
|
}
|
|
32480
32620
|
function ImpersonateDialog({ tenantId: tenantId2, target, onClose }) {
|
|
32481
32621
|
const { t } = useTranslation$1();
|
|
32482
|
-
const [reason, setReason] =
|
|
32483
|
-
const [busy, setBusy] =
|
|
32484
|
-
const [error, setError] =
|
|
32485
|
-
|
|
32622
|
+
const [reason, setReason] = React132.useState("");
|
|
32623
|
+
const [busy, setBusy] = React132.useState(false);
|
|
32624
|
+
const [error, setError] = React132.useState(null);
|
|
32625
|
+
React132.useEffect(() => {
|
|
32486
32626
|
if (target) {
|
|
32487
32627
|
setReason("");
|
|
32488
32628
|
setError(null);
|
|
@@ -32542,10 +32682,10 @@ function TeamTab() {
|
|
|
32542
32682
|
const { user } = useAuthStore();
|
|
32543
32683
|
const hasSystemPermission = useSystemPermission();
|
|
32544
32684
|
const personMode = teamPersonKinds.length > 0 && typeof adapter?.listTeam === "function";
|
|
32545
|
-
const [team, setTeam] =
|
|
32546
|
-
const [inviteOpen, setInviteOpen] =
|
|
32685
|
+
const [team, setTeam] = React132.useState(null);
|
|
32686
|
+
const [inviteOpen, setInviteOpen] = React132.useState(false);
|
|
32547
32687
|
const guardSeats = useLimitGuard("users");
|
|
32548
|
-
const [inviteEmail, setInviteEmail] =
|
|
32688
|
+
const [inviteEmail, setInviteEmail] = React132.useState(void 0);
|
|
32549
32689
|
const handleOpenInvite = async (row) => {
|
|
32550
32690
|
if (row && !row.email && row.personId && entityRouteHasDetail("person", row.kind)) {
|
|
32551
32691
|
openEntity(row.personId, "person", row.kind, "access");
|
|
@@ -32555,7 +32695,7 @@ function TeamTab() {
|
|
|
32555
32695
|
setInviteEmail(row?.email || void 0);
|
|
32556
32696
|
setInviteOpen(true);
|
|
32557
32697
|
};
|
|
32558
|
-
const reloadTeam =
|
|
32698
|
+
const reloadTeam = React132.useCallback(async () => {
|
|
32559
32699
|
if (!adapter || !currentOrg) return;
|
|
32560
32700
|
if (personMode && adapter.listTeam) {
|
|
32561
32701
|
setTeam(await adapter.listTeam(currentOrg.id, teamPersonKinds));
|
|
@@ -32563,12 +32703,12 @@ function TeamTab() {
|
|
|
32563
32703
|
setMembers(await adapter.listMembers(currentOrg.id));
|
|
32564
32704
|
}
|
|
32565
32705
|
}, [adapter, currentOrg?.id, personMode, teamPersonKinds, setMembers]);
|
|
32566
|
-
|
|
32706
|
+
React132.useEffect(() => {
|
|
32567
32707
|
if (personMode && adapter?.listTeam && currentOrg) {
|
|
32568
32708
|
dedup("team:people:" + currentOrg.id, () => adapter.listTeam(currentOrg.id, teamPersonKinds)).then(setTeam).catch(() => setTeam([]));
|
|
32569
32709
|
}
|
|
32570
32710
|
}, [personMode, adapter, currentOrg?.id, teamPersonKinds.join(",")]);
|
|
32571
|
-
|
|
32711
|
+
React132.useEffect(() => {
|
|
32572
32712
|
if (adapter && currentOrg) {
|
|
32573
32713
|
dedup("team:invites:" + currentOrg.id, () => adapter.listInvites(currentOrg.id)).then(setInvites).catch(() => {
|
|
32574
32714
|
});
|
|
@@ -32649,8 +32789,8 @@ function TeamTab() {
|
|
|
32649
32789
|
};
|
|
32650
32790
|
const { t } = useTranslation$1();
|
|
32651
32791
|
const canManageTeam = hasSystemPermission("manage_team");
|
|
32652
|
-
const [viewAs, setViewAs] =
|
|
32653
|
-
const inviteActions =
|
|
32792
|
+
const [viewAs, setViewAs] = React132.useState(null);
|
|
32793
|
+
const inviteActions = React132.useMemo(() => [{
|
|
32654
32794
|
id: "invite",
|
|
32655
32795
|
label: t("organization.team.invite"),
|
|
32656
32796
|
icon: UserPlus,
|
|
@@ -32846,13 +32986,13 @@ var SYSTEM_PERMISSIONS2 = [
|
|
|
32846
32986
|
];
|
|
32847
32987
|
function PermissionMatrixEditor({ features, profile, onSave, onCancel, saving, isNew, parentLabel }) {
|
|
32848
32988
|
const { t } = useTranslation$1();
|
|
32849
|
-
const [name, setName] =
|
|
32850
|
-
const [description, setDescription] =
|
|
32851
|
-
const [systemPerms, setSystemPerms] =
|
|
32852
|
-
const [grants, setGrants] =
|
|
32853
|
-
const [collapsed, setCollapsed] =
|
|
32854
|
-
const [search, setSearch] =
|
|
32855
|
-
const initial =
|
|
32989
|
+
const [name, setName] = React132.useState(profile?.name ?? "");
|
|
32990
|
+
const [description, setDescription] = React132.useState(profile?.description ?? "");
|
|
32991
|
+
const [systemPerms, setSystemPerms] = React132.useState(profile?.systemPermissions ?? []);
|
|
32992
|
+
const [grants, setGrants] = React132.useState(profile?.grants ?? {});
|
|
32993
|
+
const [collapsed, setCollapsed] = React132.useState(/* @__PURE__ */ new Set());
|
|
32994
|
+
const [search, setSearch] = React132.useState("");
|
|
32995
|
+
const initial = React132.useRef({
|
|
32856
32996
|
name: profile?.name ?? "",
|
|
32857
32997
|
description: profile?.description ?? "",
|
|
32858
32998
|
systemPerms: JSON.stringify(profile?.systemPermissions ?? []),
|
|
@@ -32889,7 +33029,7 @@ function PermissionMatrixEditor({ features, profile, onSave, onCancel, saving, i
|
|
|
32889
33029
|
onDiscard: onCancel,
|
|
32890
33030
|
saveLabel: isNew ? t("organization.permissions.createProfile") : t("organization.permissions.updateProfile")
|
|
32891
33031
|
});
|
|
32892
|
-
const groups =
|
|
33032
|
+
const groups = React132.useMemo(() => {
|
|
32893
33033
|
const filtered = search ? features.filter((f) => f.label.toLowerCase().includes(search.toLowerCase())) : features;
|
|
32894
33034
|
const map = /* @__PURE__ */ new Map();
|
|
32895
33035
|
for (const f of filtered) {
|
|
@@ -32958,7 +33098,7 @@ function PermissionMatrixEditor({ features, profile, onSave, onCancel, saving, i
|
|
|
32958
33098
|
}
|
|
32959
33099
|
) }) })
|
|
32960
33100
|
] }, sp.id)),
|
|
32961
|
-
Array.from(groups.entries()).map(([groupName, groupFeatures]) => /* @__PURE__ */ jsxs(
|
|
33101
|
+
Array.from(groups.entries()).map(([groupName, groupFeatures]) => /* @__PURE__ */ jsxs(React132.Fragment, { children: [
|
|
32962
33102
|
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 5, className: "p-2 px-3", children: /* @__PURE__ */ jsxs(
|
|
32963
33103
|
"button",
|
|
32964
33104
|
{
|
|
@@ -33030,12 +33170,12 @@ function PermissionProfilesTab() {
|
|
|
33030
33170
|
const startImpersonation2 = usePermissionsStore((s) => s.startImpersonation);
|
|
33031
33171
|
const canPreview = (realProfile?.systemPermissions ?? []).includes("manage_permissions") ?? false;
|
|
33032
33172
|
const { t } = useTranslation$1();
|
|
33033
|
-
const [editingProfile, setEditingProfile] =
|
|
33034
|
-
const [creating, setCreating] =
|
|
33035
|
-
const [duplicateSource, setDuplicateSource] =
|
|
33036
|
-
const [saving, setSaving] =
|
|
33037
|
-
const [error, setError] =
|
|
33038
|
-
const [deleting, setDeleting] =
|
|
33173
|
+
const [editingProfile, setEditingProfile] = React132.useState(null);
|
|
33174
|
+
const [creating, setCreating] = React132.useState(false);
|
|
33175
|
+
const [duplicateSource, setDuplicateSource] = React132.useState(null);
|
|
33176
|
+
const [saving, setSaving] = React132.useState(false);
|
|
33177
|
+
const [error, setError] = React132.useState(null);
|
|
33178
|
+
const [deleting, setDeleting] = React132.useState(null);
|
|
33039
33179
|
const handleDuplicate = (profile) => {
|
|
33040
33180
|
setEditingProfile(null);
|
|
33041
33181
|
setCreating(false);
|
|
@@ -33045,9 +33185,9 @@ function PermissionProfilesTab() {
|
|
|
33045
33185
|
isSystem: false
|
|
33046
33186
|
});
|
|
33047
33187
|
};
|
|
33048
|
-
const surfaceRef =
|
|
33188
|
+
const surfaceRef = React132.useRef({ features, profiles, adapter, currentOrg, setProfiles });
|
|
33049
33189
|
surfaceRef.current = { features, profiles, adapter, currentOrg, setProfiles };
|
|
33050
|
-
const agentSurface =
|
|
33190
|
+
const agentSurface = React132.useMemo(() => ({
|
|
33051
33191
|
id: "org.permissions",
|
|
33052
33192
|
instructions: PERMISSIONS_INSTRUCTIONS,
|
|
33053
33193
|
describe: () => {
|
|
@@ -33101,7 +33241,7 @@ function PermissionProfilesTab() {
|
|
|
33101
33241
|
}]
|
|
33102
33242
|
}), []);
|
|
33103
33243
|
useAgentSurface(agentSurface);
|
|
33104
|
-
const createActions =
|
|
33244
|
+
const createActions = React132.useMemo(() => [
|
|
33105
33245
|
{
|
|
33106
33246
|
id: "new",
|
|
33107
33247
|
label: t("organization.permissions.createProfile"),
|
|
@@ -33130,7 +33270,7 @@ function PermissionProfilesTab() {
|
|
|
33130
33270
|
})
|
|
33131
33271
|
}
|
|
33132
33272
|
], [t]);
|
|
33133
|
-
const memberCountByProfile =
|
|
33273
|
+
const memberCountByProfile = React132.useMemo(() => {
|
|
33134
33274
|
const counts = {};
|
|
33135
33275
|
for (const m of members) {
|
|
33136
33276
|
counts[m.profileId] = (counts[m.profileId] ?? 0) + 1;
|
|
@@ -33435,7 +33575,7 @@ function FieldRulesSettings({ entities, rules: initialRules, onSave }) {
|
|
|
33435
33575
|
const [saving, setSaving] = useState(false);
|
|
33436
33576
|
const [search, setSearch] = useState("");
|
|
33437
33577
|
const [showMore, setShowMore] = useState(false);
|
|
33438
|
-
|
|
33578
|
+
React132.useEffect(() => {
|
|
33439
33579
|
setDraft(initialRules);
|
|
33440
33580
|
}, [initialRules]);
|
|
33441
33581
|
const isDirty = useMemo(
|
|
@@ -33844,19 +33984,19 @@ function SoftLimitWidget() {
|
|
|
33844
33984
|
function LimitProbe({ limitKey }) {
|
|
33845
33985
|
const info = useLimit(limitKey);
|
|
33846
33986
|
const report = useSoftLimitStore((s) => s.report);
|
|
33847
|
-
|
|
33987
|
+
React132.useEffect(() => {
|
|
33848
33988
|
report(limitKey, info);
|
|
33849
33989
|
}, [limitKey, info, report]);
|
|
33850
33990
|
return null;
|
|
33851
33991
|
}
|
|
33852
33992
|
function SoftLimitProbes({ keys }) {
|
|
33853
|
-
const monitored =
|
|
33993
|
+
const monitored = React132.useMemo(() => Array.from(new Set(keys)), [keys]);
|
|
33854
33994
|
return /* @__PURE__ */ jsx(Fragment, { children: monitored.map((k) => /* @__PURE__ */ jsx(LimitProbe, { limitKey: k }, k)) });
|
|
33855
33995
|
}
|
|
33856
|
-
var CommandPalette =
|
|
33996
|
+
var CommandPalette = React132.lazy(
|
|
33857
33997
|
() => import('./CommandPalette-B5PMQFDG.js').then((m) => ({ default: m.CommandPalette }))
|
|
33858
33998
|
);
|
|
33859
|
-
var SubscriptionPage =
|
|
33999
|
+
var SubscriptionPage = React132.lazy(
|
|
33860
34000
|
() => import('./SubscriptionPage-VXZ37WZZ.js').then((m) => ({ default: m.SubscriptionPage }))
|
|
33861
34001
|
);
|
|
33862
34002
|
function WorkspaceSwitcher({
|
|
@@ -33906,8 +34046,8 @@ function WorkspaceSwitcher({
|
|
|
33906
34046
|
const v = t(key);
|
|
33907
34047
|
return !v || v === key ? fallback : v;
|
|
33908
34048
|
};
|
|
33909
|
-
const [query, setQuery] =
|
|
33910
|
-
const search =
|
|
34049
|
+
const [query, setQuery] = React132.useState("");
|
|
34050
|
+
const search = React132.useMemo(
|
|
33911
34051
|
() => searchWorkspaces(
|
|
33912
34052
|
options,
|
|
33913
34053
|
query,
|
|
@@ -34221,9 +34361,9 @@ function PluginHeaderControls() {
|
|
|
34221
34361
|
}
|
|
34222
34362
|
function AdminNotifications() {
|
|
34223
34363
|
const { notifications, unreadCount, fetchNotifications, markAsRead, markAllAsRead } = useNotifications();
|
|
34224
|
-
const [open, setOpen] =
|
|
34225
|
-
const fetchedRef =
|
|
34226
|
-
|
|
34364
|
+
const [open, setOpen] = React132.useState(false);
|
|
34365
|
+
const fetchedRef = React132.useRef(false);
|
|
34366
|
+
React132.useEffect(() => {
|
|
34227
34367
|
if (fetchedRef.current) return;
|
|
34228
34368
|
fetchedRef.current = true;
|
|
34229
34369
|
void fetchNotifications();
|
|
@@ -34369,7 +34509,7 @@ function buildSettingsTabs(pluginTabs, can, hasSystem, t, showOrgSettings, hasBi
|
|
|
34369
34509
|
// sidebar ICON_MAP, which made the settings rail fall back to Home.
|
|
34370
34510
|
icon: /* @__PURE__ */ jsx(CreditCard, { className: "h-4 w-4" }),
|
|
34371
34511
|
iconName: "CreditCard",
|
|
34372
|
-
component: /* @__PURE__ */ jsx(
|
|
34512
|
+
component: /* @__PURE__ */ jsx(React132.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(SubscriptionPage, {}) })
|
|
34373
34513
|
});
|
|
34374
34514
|
}
|
|
34375
34515
|
if (showOrgSettings) {
|
|
@@ -34397,9 +34537,9 @@ function buildSettingsTabs(pluginTabs, can, hasSystem, t, showOrgSettings, hasBi
|
|
|
34397
34537
|
settingsTabs.push({
|
|
34398
34538
|
id: tab.id,
|
|
34399
34539
|
label: translated === labelKey ? tab.label : translated,
|
|
34400
|
-
icon:
|
|
34540
|
+
icon: React132.createElement(IconComp, { className: "h-4 w-4" }),
|
|
34401
34541
|
iconName,
|
|
34402
|
-
component:
|
|
34542
|
+
component: React132.createElement(tab.component),
|
|
34403
34543
|
// Flag plugin-contributed tabs so SettingsPage draws the core/plugins divider.
|
|
34404
34544
|
isPlugin: true,
|
|
34405
34545
|
group: tab.group,
|
|
@@ -34451,12 +34591,21 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34451
34591
|
profileKnown: !activeTenantId || profileKnownFor === activeTenantId
|
|
34452
34592
|
});
|
|
34453
34593
|
const navError = configError ?? tenantCtx?.loadError ?? null;
|
|
34454
|
-
const onNavRetry =
|
|
34594
|
+
const onNavRetry = React132.useCallback(() => {
|
|
34455
34595
|
if (tenantCtx?.loadError) tenantCtx.retryOrgs();
|
|
34456
34596
|
else window.location.reload();
|
|
34457
34597
|
}, [tenantCtx]);
|
|
34598
|
+
const { online } = useConnectivity();
|
|
34599
|
+
const navOffline = !!navError && (!online || toDataError(navError).kind === "offline");
|
|
34600
|
+
const lastGoodRail = React132.useRef(null);
|
|
34601
|
+
React132.useEffect(() => {
|
|
34602
|
+
if (!navError) return void 0;
|
|
34603
|
+
const retry = () => onNavRetry();
|
|
34604
|
+
window.addEventListener(RECONNECTED_EVENT, retry);
|
|
34605
|
+
return () => window.removeEventListener(RECONNECTED_EVENT, retry);
|
|
34606
|
+
}, [navError, onNavRetry]);
|
|
34458
34607
|
const currentProfile = usePermissionsStore((s) => s.currentProfile);
|
|
34459
|
-
const hasSystem =
|
|
34608
|
+
const hasSystem = React132.useCallback(
|
|
34460
34609
|
(perm) => {
|
|
34461
34610
|
if (!currentProfile) return false;
|
|
34462
34611
|
if (currentProfile.id === "owner" || currentProfile.name?.toLowerCase() === "owner") return true;
|
|
@@ -34470,9 +34619,10 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34470
34619
|
};
|
|
34471
34620
|
const path = useAdminPath();
|
|
34472
34621
|
const { user, signOut } = useAuth();
|
|
34473
|
-
|
|
34474
|
-
|
|
34622
|
+
React132.useEffect(() => installGlobalErrorHandlers(), []);
|
|
34623
|
+
React132.useEffect(() => registerErrorReporter((report) => {
|
|
34475
34624
|
if (report.source !== "data") return;
|
|
34625
|
+
if (report.offline || !getConnectivity().online) return;
|
|
34476
34626
|
const alvo = report.extra?.operation;
|
|
34477
34627
|
toast.error(
|
|
34478
34628
|
typeof alvo === "string" && alvo ? `N\xE3o foi poss\xEDvel carregar ${alvo}` : "N\xE3o foi poss\xEDvel carregar esta informa\xE7\xE3o",
|
|
@@ -34489,15 +34639,15 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34489
34639
|
const hasChatPanel = useRightRailStore((s) => s.panels.some((pn) => pn.id === "chat"));
|
|
34490
34640
|
const rightRail = railHasPanels ? /* @__PURE__ */ jsx(RightRail, { frame: contentFrame, attached: layout !== "topbar" }) : null;
|
|
34491
34641
|
const setRailMounted = useRightRailStore((s) => s.setMounted);
|
|
34492
|
-
|
|
34642
|
+
React132.useEffect(() => {
|
|
34493
34643
|
setRailMounted(true);
|
|
34494
34644
|
return () => setRailMounted(false);
|
|
34495
34645
|
}, [setRailMounted]);
|
|
34496
34646
|
useConnectorOAuthReturn();
|
|
34497
34647
|
const railWidthLive = useRightRailStore((s) => s.width);
|
|
34498
34648
|
const setSidebarCollapsed = useLayoutStore((s) => s.setSidebarCollapsed);
|
|
34499
|
-
const railAutoCollapsedRef =
|
|
34500
|
-
|
|
34649
|
+
const railAutoCollapsedRef = React132.useRef(false);
|
|
34650
|
+
React132.useEffect(() => {
|
|
34501
34651
|
if (layout !== "sidebar") return;
|
|
34502
34652
|
const SIDEBAR_EXPANDED = 224;
|
|
34503
34653
|
const MIN_CONTENT = 620;
|
|
@@ -34519,22 +34669,22 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34519
34669
|
window.addEventListener("resize", apply);
|
|
34520
34670
|
return () => window.removeEventListener("resize", apply);
|
|
34521
34671
|
}, [railOpen, railWidthLive, layout, setSidebarCollapsed]);
|
|
34522
|
-
const [railWidth] =
|
|
34672
|
+
const [railWidth] = React132.useState(() => readRightRailWidth());
|
|
34523
34673
|
const billingPlans = useBillingStore((s) => s.plans);
|
|
34524
34674
|
const hasBilling = billingPlans.length > 0;
|
|
34525
34675
|
const orgPlan = useTenantOptional()?.org?.plan;
|
|
34526
|
-
const planBadge =
|
|
34676
|
+
const planBadge = React132.useMemo(
|
|
34527
34677
|
() => hasBilling ? resolvePlanBadge(orgPlan, billingPlans) : null,
|
|
34528
34678
|
[hasBilling, orgPlan, billingPlans]
|
|
34529
34679
|
);
|
|
34530
|
-
const softLimitKeys =
|
|
34680
|
+
const softLimitKeys = React132.useMemo(() => {
|
|
34531
34681
|
const plan = billingPlans.find((p) => p.id === (orgPlan || "free"));
|
|
34532
34682
|
return Object.keys(getPlanEntitlements(plan)?.limits ?? {});
|
|
34533
34683
|
}, [billingPlans, orgPlan]);
|
|
34534
34684
|
const overshoots = useOvershoots();
|
|
34535
34685
|
const navContributions = useNavContributionsStore((s) => s.contributions);
|
|
34536
34686
|
const appConfigNav = useAppConfigStore((state) => state.config.nav);
|
|
34537
|
-
const navigation =
|
|
34687
|
+
const navigation = React132.useMemo(() => {
|
|
34538
34688
|
const contributed = Object.values(navContributions).flat();
|
|
34539
34689
|
const flat = dedupeByRoute(
|
|
34540
34690
|
[...runtime.navigation, ...contributed].map((entry) => ({
|
|
@@ -34605,7 +34755,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34605
34755
|
}).filter((item) => item !== null).sort(compareNavigation);
|
|
34606
34756
|
return applyRailPreset(gated, presetRail, presetHide, presetWhole);
|
|
34607
34757
|
}, [runtime.navigation, runtime.routes, navContributions, pages, access, navWaiting, presetRail, presetHide, presetWhole, presetLabels]);
|
|
34608
|
-
const composedNavigation =
|
|
34758
|
+
const composedNavigation = React132.useMemo(() => {
|
|
34609
34759
|
if (!appConfigNav.length) return navigation;
|
|
34610
34760
|
const keyed = navigation.map((item) => ({ ...item, key: item.route }));
|
|
34611
34761
|
return applyNavComposition(keyed, appConfigNav).map((item) => {
|
|
@@ -34621,13 +34771,13 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34621
34771
|
};
|
|
34622
34772
|
});
|
|
34623
34773
|
}, [navigation, appConfigNav]);
|
|
34624
|
-
const resolvedBottomNav =
|
|
34774
|
+
const resolvedBottomNav = React132.useMemo(
|
|
34625
34775
|
() => deriveBottomNav(navigation, bottomNav, { assistant: hasChatPanel }),
|
|
34626
34776
|
[navigation, bottomNav, hasChatPanel]
|
|
34627
34777
|
);
|
|
34628
34778
|
const commandPaletteOpen = useLayoutStore((s) => s.commandPaletteOpen);
|
|
34629
34779
|
const setCommandPaletteOpen = useLayoutStore((s) => s.setCommandPaletteOpen);
|
|
34630
|
-
const commandItems =
|
|
34780
|
+
const commandItems = React132.useMemo(() => {
|
|
34631
34781
|
const navGroup = tr("layout.commandPalette.navigation", "Navigation");
|
|
34632
34782
|
const items = [];
|
|
34633
34783
|
for (const nav of navigation) {
|
|
@@ -34639,7 +34789,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34639
34789
|
return items;
|
|
34640
34790
|
}, [navigation]);
|
|
34641
34791
|
const globalSearch = useGlobalSearch();
|
|
34642
|
-
const routes =
|
|
34792
|
+
const routes = React132.useMemo(() => {
|
|
34643
34793
|
const list = [];
|
|
34644
34794
|
const entityRouteMap = /* @__PURE__ */ new Map();
|
|
34645
34795
|
for (const r of runtime.routes) {
|
|
@@ -34662,14 +34812,14 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34662
34812
|
setEntityRouteMap(entityRouteMap);
|
|
34663
34813
|
return list.sort((a, b) => routeScore(b.path) - routeScore(a.path));
|
|
34664
34814
|
}, [runtime.routes, pages, showSettings]);
|
|
34665
|
-
const match =
|
|
34815
|
+
const match = React132.useMemo(() => {
|
|
34666
34816
|
for (const r of routes) {
|
|
34667
34817
|
const params = matchRoute(r.path, path);
|
|
34668
34818
|
if (params) return { route: r, params };
|
|
34669
34819
|
}
|
|
34670
34820
|
return null;
|
|
34671
34821
|
}, [routes, path]);
|
|
34672
|
-
|
|
34822
|
+
React132.useEffect(() => {
|
|
34673
34823
|
if (!match && (path === "/" || path === "") && navigation.length > 0) {
|
|
34674
34824
|
navigateTo(navigation[0].route);
|
|
34675
34825
|
}
|
|
@@ -34677,11 +34827,11 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34677
34827
|
const ActiveComponent = match?.route.Component;
|
|
34678
34828
|
const activeParams = match?.params ?? {};
|
|
34679
34829
|
const routeKey = (match?.route.path ?? path).replace(/\/\*$/, "");
|
|
34680
|
-
const settingsTabs =
|
|
34830
|
+
const settingsTabs = React132.useMemo(
|
|
34681
34831
|
() => buildSettingsTabs(runtime.settingsTabs, can, hasSystem, t, showOrgSettings, hasBilling),
|
|
34682
34832
|
[runtime.settingsTabs, can, hasSystem, t, showOrgSettings, hasBilling]
|
|
34683
34833
|
);
|
|
34684
|
-
const profileRoute =
|
|
34834
|
+
const profileRoute = React132.useMemo(() => {
|
|
34685
34835
|
const explicit = routes.find((r) => r.path === "/perfil" || r.path === "/profile");
|
|
34686
34836
|
if (explicit) return explicit.path;
|
|
34687
34837
|
return showSettings ? "/settings/profile" : null;
|
|
@@ -34690,8 +34840,8 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34690
34840
|
const onBilling = hasBilling && showSettings ? () => navigateTo("/settings/subscription") : void 0;
|
|
34691
34841
|
const coreSettingsTabs = useCoreSettingsTabs({ showCompany: showBranding, showBranding });
|
|
34692
34842
|
const catalog = useModuleCatalog();
|
|
34693
|
-
const verticalByPlugin =
|
|
34694
|
-
const allSettingsTabs =
|
|
34843
|
+
const verticalByPlugin = React132.useMemo(() => pluginVerticalIndex(catalog), [catalog]);
|
|
34844
|
+
const allSettingsTabs = React132.useMemo(
|
|
34695
34845
|
() => {
|
|
34696
34846
|
const hidden = new Set(hiddenSettingsTabs ?? []);
|
|
34697
34847
|
const visible = [...coreSettingsTabs, ...settingsTabs].filter((tab) => !hidden.has(tab.id));
|
|
@@ -34714,7 +34864,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34714
34864
|
[coreSettingsTabs, settingsTabs, hiddenSettingsTabs, settingsGroups, verticalByPlugin]
|
|
34715
34865
|
);
|
|
34716
34866
|
usePublishSettingsTabs(allSettingsTabs.map((tab) => tab.id));
|
|
34717
|
-
const navWithSettings =
|
|
34867
|
+
const navWithSettings = React132.useMemo(() => {
|
|
34718
34868
|
if (!showSettings || allSettingsTabs.length === 0) return composedNavigation;
|
|
34719
34869
|
if (composedNavigation.some((item) => item.route === "/settings")) return composedNavigation;
|
|
34720
34870
|
return [...composedNavigation, {
|
|
@@ -34732,7 +34882,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34732
34882
|
const moduleRail = !inSettings && layout === "sidebar" && contextualNav && (path === contextualNav.base || path.startsWith(contextualNav.base + "/")) ? contextualNav : null;
|
|
34733
34883
|
const settingsPathActive = showSettings && (path === "/settings" || path.startsWith("/settings/"));
|
|
34734
34884
|
const activeSettingsTab = settingsPathActive ? path === "/settings" ? null : path.slice("/settings/".length).split("/")[0] : void 0;
|
|
34735
|
-
const settingsTabDef =
|
|
34885
|
+
const settingsTabDef = React132.useMemo(() => {
|
|
34736
34886
|
if (!showSettings || !path.startsWith("/settings/")) return void 0;
|
|
34737
34887
|
const id = path.slice("/settings/".length).split("/")[0];
|
|
34738
34888
|
return allSettingsTabs.find((tab) => tab.id === id);
|
|
@@ -34740,11 +34890,11 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34740
34890
|
const shellUser = user ? { fullName: user.fullName ?? user.email, email: user.email, avatarUrl: user.avatarUrl } : void 0;
|
|
34741
34891
|
const moduleVariant = moduleNav ?? (layout === "sidebar" ? "tabs" : "rail");
|
|
34742
34892
|
const setRailAvailable = useContextualNavStore((s) => s.setRailAvailable);
|
|
34743
|
-
|
|
34893
|
+
React132.useEffect(() => {
|
|
34744
34894
|
setRailAvailable(layout === "sidebar" && moduleVariant !== "rail");
|
|
34745
34895
|
}, [layout, moduleVariant, setRailAvailable]);
|
|
34746
34896
|
const moduleViewLabel = useModuleViewLabel();
|
|
34747
|
-
const activePageTitle =
|
|
34897
|
+
const activePageTitle = React132.useMemo(() => {
|
|
34748
34898
|
if (settingsTabDef) return settingsTabDef.label;
|
|
34749
34899
|
if (path === "/settings" || path.startsWith("/settings/")) return tr("common.settings", "Settings");
|
|
34750
34900
|
if (moduleViewLabel) return moduleViewLabel;
|
|
@@ -34759,7 +34909,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34759
34909
|
if (hiddenHit?.label) return hiddenHit.label;
|
|
34760
34910
|
return candidates.find((n) => n.route === "/")?.label ?? "";
|
|
34761
34911
|
}, [navigation, pages, path, tr, match, settingsTabDef, moduleViewLabel]);
|
|
34762
|
-
const parentBack =
|
|
34912
|
+
const parentBack = React132.useMemo(() => {
|
|
34763
34913
|
if (settingsTabDef) {
|
|
34764
34914
|
const first = allSettingsTabs[0]?.id;
|
|
34765
34915
|
return {
|
|
@@ -34802,9 +34952,9 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34802
34952
|
]
|
|
34803
34953
|
}
|
|
34804
34954
|
);
|
|
34805
|
-
const [railQuery, setRailQuery] =
|
|
34955
|
+
const [railQuery, setRailQuery] = React132.useState("");
|
|
34806
34956
|
const railBase = moduleRail?.base ?? null;
|
|
34807
|
-
|
|
34957
|
+
React132.useEffect(() => {
|
|
34808
34958
|
setRailQuery("");
|
|
34809
34959
|
}, [railBase]);
|
|
34810
34960
|
const railSearch = (placeholder) => /* @__PURE__ */ jsxs("div", { className: "relative px-0.5 pt-1", children: [
|
|
@@ -34835,10 +34985,16 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34835
34985
|
moduleRail.searchPlaceholder ? railSearch(moduleRail.searchPlaceholder) : null
|
|
34836
34986
|
] })
|
|
34837
34987
|
} : null;
|
|
34838
|
-
const
|
|
34839
|
-
|
|
34988
|
+
const liveRail = contextualRail?.navigation ?? navWithSettings;
|
|
34989
|
+
if (!navError && liveRail.length > 0) lastGoodRail.current = liveRail;
|
|
34990
|
+
const keptRail = navOffline ? lastGoodRail.current : null;
|
|
34991
|
+
const railRows = keptRail ?? liveRail;
|
|
34992
|
+
const railWaiting = !keptRail && (navWaiting || railRows.length === 0);
|
|
34993
|
+
const shownNavError = keptRail ? null : navOffline ? t("connection.menuOffline") : navError;
|
|
34840
34994
|
return /* @__PURE__ */ jsxs(ModuleLayoutProvider, { variant: moduleVariant, children: [
|
|
34841
34995
|
/* @__PURE__ */ jsx(ImpersonationBanner, {}),
|
|
34996
|
+
/* @__PURE__ */ jsx(ConnectionBanner, {}),
|
|
34997
|
+
/* @__PURE__ */ jsx(ShellMountedMarker, {}),
|
|
34842
34998
|
/* @__PURE__ */ jsxs(
|
|
34843
34999
|
AppShell,
|
|
34844
35000
|
{
|
|
@@ -34847,8 +35003,8 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
34847
35003
|
navigation: railRows,
|
|
34848
35004
|
appNavigation: navWithSettings,
|
|
34849
35005
|
navLoading: railWaiting,
|
|
34850
|
-
navError,
|
|
34851
|
-
navErrorLabel: t("shell.navError") || "N\xE3o foi poss\xEDvel carregar o menu",
|
|
35006
|
+
navError: shownNavError,
|
|
35007
|
+
navErrorLabel: navOffline ? t("connection.offline") : t("shell.navError") || "N\xE3o foi poss\xEDvel carregar o menu",
|
|
34852
35008
|
navRetryLabel: t("common.retry") || "Tentar de novo",
|
|
34853
35009
|
onNavRetry,
|
|
34854
35010
|
sidebarSectionLabels: contextualRail?.sectionLabels,
|
|
@@ -35009,7 +35165,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
35009
35165
|
]
|
|
35010
35166
|
}
|
|
35011
35167
|
),
|
|
35012
|
-
/* @__PURE__ */ jsx(
|
|
35168
|
+
/* @__PURE__ */ jsx(React132.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
|
|
35013
35169
|
CommandPalette,
|
|
35014
35170
|
{
|
|
35015
35171
|
commands: commandItems,
|
|
@@ -35277,7 +35433,7 @@ function buildI18nConfig(config) {
|
|
|
35277
35433
|
function BillingInitializer({ config }) {
|
|
35278
35434
|
const setPlans = useBillingStore((s) => s.setPlans);
|
|
35279
35435
|
const setCheckout = useBillingStore((s) => s.setCheckout);
|
|
35280
|
-
|
|
35436
|
+
React132.useEffect(() => {
|
|
35281
35437
|
if (config.billing?.plans) setPlans(config.billing.plans.map(normalizeBillingPlan));
|
|
35282
35438
|
setCheckout(config.billing?.onCheckout ?? null);
|
|
35283
35439
|
}, [config.billing, setPlans, setCheckout]);
|
|
@@ -35396,13 +35552,13 @@ function ThemeInitializer({ config }) {
|
|
|
35396
35552
|
const rawBranding = useOrganizationStore((s) => s.currentOrg?.settings?.branding);
|
|
35397
35553
|
const access = useAccessOptional();
|
|
35398
35554
|
const wearsOwnSkin = access.entitled("branding.theme");
|
|
35399
|
-
const brandTokens =
|
|
35555
|
+
const brandTokens = React132.useMemo(
|
|
35400
35556
|
() => wearsOwnSkin ? normalizeBrand(rawBranding).tokens : EMPTY_BRAND.tokens,
|
|
35401
35557
|
[rawBranding, wearsOwnSkin]
|
|
35402
35558
|
);
|
|
35403
35559
|
const brandKey = JSON.stringify(brandTokens);
|
|
35404
35560
|
const appTheme = useAppTheme();
|
|
35405
|
-
|
|
35561
|
+
React132.useEffect(() => {
|
|
35406
35562
|
const tokens = JSON.parse(brandKey);
|
|
35407
35563
|
const brand = tokens.color?.primary ? hexToHslTriplet(tokens.color.primary) : null;
|
|
35408
35564
|
const base = appTheme ?? config.theme;
|
|
@@ -35420,20 +35576,20 @@ function ThemeInitializer({ config }) {
|
|
|
35420
35576
|
return null;
|
|
35421
35577
|
}
|
|
35422
35578
|
function PersistentCacheInitializer() {
|
|
35423
|
-
|
|
35579
|
+
React132.useEffect(() => {
|
|
35424
35580
|
attachPersistentCache();
|
|
35425
35581
|
void getPersistentCache()?.hydrate();
|
|
35426
35582
|
}, []);
|
|
35427
35583
|
return null;
|
|
35428
35584
|
}
|
|
35429
35585
|
function FayzEventBridgeInitializer({ config }) {
|
|
35430
|
-
|
|
35586
|
+
React132.useEffect(() => startFayzEventBridge(config.chat?.agent), [config.chat?.agent]);
|
|
35431
35587
|
return null;
|
|
35432
35588
|
}
|
|
35433
35589
|
function TeamInitializer({ config }) {
|
|
35434
35590
|
const setTeamPersonKinds = useOrganizationStore((s) => s.setTeamPersonKinds);
|
|
35435
35591
|
const kinds = config.team?.personKinds;
|
|
35436
|
-
|
|
35592
|
+
React132.useEffect(() => {
|
|
35437
35593
|
setTeamPersonKinds(kinds ?? []);
|
|
35438
35594
|
}, [setTeamPersonKinds, kinds]);
|
|
35439
35595
|
return null;
|
|
@@ -35450,7 +35606,7 @@ function ChatRailPanel({ config }) {
|
|
|
35450
35606
|
const agent = config.chat?.agent;
|
|
35451
35607
|
const voice = config.chat?.voice;
|
|
35452
35608
|
const whatsapp = config.chat?.whatsapp;
|
|
35453
|
-
const Component2 =
|
|
35609
|
+
const Component2 = React132.useMemo(() => {
|
|
35454
35610
|
const Panel = () => /* @__PURE__ */ jsx(
|
|
35455
35611
|
ChatConversation,
|
|
35456
35612
|
{
|
|
@@ -35467,8 +35623,8 @@ function ChatRailPanel({ config }) {
|
|
|
35467
35623
|
const conversations = useChatStore((s) => s.conversations);
|
|
35468
35624
|
const setConversations = useChatStore((s) => s.setConversations);
|
|
35469
35625
|
const user = useAuthStore((s) => s.user);
|
|
35470
|
-
const connection =
|
|
35471
|
-
|
|
35626
|
+
const connection = React132.useMemo(() => resolveFayzAgentConnection(agent), [agent]);
|
|
35627
|
+
React132.useEffect(() => {
|
|
35472
35628
|
if (!connection) return;
|
|
35473
35629
|
getFayzAgentClient(connection).listConversations(user?.id).then(setConversations).catch(() => {
|
|
35474
35630
|
});
|
|
@@ -35477,7 +35633,7 @@ function ChatRailPanel({ config }) {
|
|
|
35477
35633
|
useAssistantInviteStore((s) => s.invite?.id === ASK_AI_HANDOFF_ID);
|
|
35478
35634
|
const activeAgent = useAgent();
|
|
35479
35635
|
const persona = activeAgent?.name ?? invitePersona;
|
|
35480
|
-
const icon =
|
|
35636
|
+
const icon = React132.useMemo(
|
|
35481
35637
|
() => activeAgent ? function AgentTabIcon() {
|
|
35482
35638
|
return /* @__PURE__ */ jsx(
|
|
35483
35639
|
AgentAvatar,
|
|
@@ -35492,7 +35648,7 @@ function ChatRailPanel({ config }) {
|
|
|
35492
35648
|
[activeAgent]
|
|
35493
35649
|
);
|
|
35494
35650
|
useRightRailPanel(
|
|
35495
|
-
|
|
35651
|
+
React132.useMemo(
|
|
35496
35652
|
() => ({
|
|
35497
35653
|
id: "chat",
|
|
35498
35654
|
// "Chat" nomeia o CANO, não o que está do outro lado — e era a única
|
|
@@ -35508,22 +35664,22 @@ function ChatRailPanel({ config }) {
|
|
|
35508
35664
|
[Component2, conversations.length, persona, icon, activeAgent, t]
|
|
35509
35665
|
)
|
|
35510
35666
|
);
|
|
35511
|
-
|
|
35667
|
+
React132.useEffect(() => {
|
|
35512
35668
|
if (chatOpen) openPanel("chat");
|
|
35513
35669
|
}, [chatOpen, openPanel]);
|
|
35514
|
-
|
|
35670
|
+
React132.useEffect(() => {
|
|
35515
35671
|
if (!(railOpen && railActive === "chat")) setChatOpen(false);
|
|
35516
35672
|
}, [railOpen, railActive, setChatOpen]);
|
|
35517
35673
|
return null;
|
|
35518
35674
|
}
|
|
35519
35675
|
function AdminProviders({ config, children }) {
|
|
35520
35676
|
const currentOrg = useOrganizationStore((s) => s.currentOrg);
|
|
35521
|
-
const hasFayzAgent =
|
|
35677
|
+
const hasFayzAgent = React132.useMemo(
|
|
35522
35678
|
() => !!resolveFayzAgentConnection(config.chat?.agent),
|
|
35523
35679
|
[config.chat?.agent]
|
|
35524
35680
|
);
|
|
35525
35681
|
const assistantEnabled = config.chat?.enabled !== false && (!!config.chat || hasFayzAgent);
|
|
35526
|
-
|
|
35682
|
+
React132.useEffect(() => {
|
|
35527
35683
|
if (!config.chat || config.chat.enabled === false || config.chat.apiEndpoint || hasFayzAgent) return;
|
|
35528
35684
|
const gap = describeFayzAgentGap(config.chat.agent);
|
|
35529
35685
|
if (!gap) return;
|
|
@@ -35535,7 +35691,7 @@ function AdminProviders({ config, children }) {
|
|
|
35535
35691
|
const surface = config.chat?.surface ?? "dock";
|
|
35536
35692
|
const onConsentScreen = typeof window !== "undefined" && window.location.pathname.replace(/\/+$/, "").endsWith("/connect");
|
|
35537
35693
|
const showFab = assistantEnabled && surface === "dock" && !onConsentScreen;
|
|
35538
|
-
const resolved =
|
|
35694
|
+
const resolved = React132.useMemo(() => {
|
|
35539
35695
|
if (config.supabaseUrl && config.supabaseAnonKey) {
|
|
35540
35696
|
createFayzSupabaseClient(config.supabaseUrl, config.supabaseAnonKey);
|
|
35541
35697
|
}
|
|
@@ -35553,7 +35709,7 @@ function AdminProviders({ config, children }) {
|
|
|
35553
35709
|
const { bindings, ready: configReady } = useAppConfig();
|
|
35554
35710
|
const offeredPlugins = useOfferedPlugins();
|
|
35555
35711
|
const path = useAdminPath();
|
|
35556
|
-
const runtime =
|
|
35712
|
+
const runtime = React132.useMemo(
|
|
35557
35713
|
() => resolvePluginRuntime({
|
|
35558
35714
|
plugins: resolved.plugins,
|
|
35559
35715
|
// Só as ligações DESTA conta. Na janela da troca o config em mãos ainda
|
|
@@ -35593,7 +35749,7 @@ function AdminProviders({ config, children }) {
|
|
|
35593
35749
|
}),
|
|
35594
35750
|
[resolved.plugins, bindings, offeredPlugins, configReady, path, config.layout, currentOrg]
|
|
35595
35751
|
);
|
|
35596
|
-
|
|
35752
|
+
React132.useEffect(() => {
|
|
35597
35753
|
if (!import.meta.env?.DEV || !currentOrg) return;
|
|
35598
35754
|
const registered = new Set(resolved.plugins.map((p) => p.id));
|
|
35599
35755
|
const bound = new Set(bindings.map((b) => b.pluginId));
|
|
@@ -35649,7 +35805,7 @@ AdminProviders.displayName = "AdminProviders";
|
|
|
35649
35805
|
function createFayzApp(config) {
|
|
35650
35806
|
const authShellProps = getAuthShellProps(config.auth);
|
|
35651
35807
|
function FayzApp({ children }) {
|
|
35652
|
-
return /* @__PURE__ */ jsx(AdminProviders, { config, children: children ?? /* @__PURE__ */ jsx(FayzAppShell, { config, authShellProps }) });
|
|
35808
|
+
return /* @__PURE__ */ jsx(AppErrorBoundary, { children: /* @__PURE__ */ jsx(OfflineBootGuard, { children: /* @__PURE__ */ jsx(AdminProviders, { config, children: children ?? /* @__PURE__ */ jsx(FayzAppShell, { config, authShellProps }) }) }) });
|
|
35653
35809
|
}
|
|
35654
35810
|
FayzApp.displayName = `FayzApp(${config.name})`;
|
|
35655
35811
|
return FayzApp;
|
|
@@ -35947,8 +36103,8 @@ function manifestToFayzConfig(manifest, surfaceName) {
|
|
|
35947
36103
|
};
|
|
35948
36104
|
}
|
|
35949
36105
|
function AdminScaffold({ manifest, surface }) {
|
|
35950
|
-
const config =
|
|
35951
|
-
const authShellProps =
|
|
36106
|
+
const config = React132.useMemo(() => manifestToFayzConfig(manifest, surface), [manifest, surface]);
|
|
36107
|
+
const authShellProps = React132.useMemo(() => getAuthShellProps(config.auth), [config.auth]);
|
|
35952
36108
|
return /* @__PURE__ */ jsx(AdminProviders, { config, children: /* @__PURE__ */ jsx(ScaffoldShell, { config, authShellProps }) });
|
|
35953
36109
|
}
|
|
35954
36110
|
function ScaffoldShell({
|
|
@@ -36386,9 +36542,9 @@ function LookupCreateInline({
|
|
|
36386
36542
|
className
|
|
36387
36543
|
}) {
|
|
36388
36544
|
const t = useTranslation();
|
|
36389
|
-
const [saving, setSaving] =
|
|
36390
|
-
const [error, setError] =
|
|
36391
|
-
const submitForm =
|
|
36545
|
+
const [saving, setSaving] = React132.useState(false);
|
|
36546
|
+
const [error, setError] = React132.useState(null);
|
|
36547
|
+
const submitForm = React132.useRef(null);
|
|
36392
36548
|
async function submit(data) {
|
|
36393
36549
|
setSaving(true);
|
|
36394
36550
|
setError(null);
|
|
@@ -36465,20 +36621,20 @@ function LookupCreateInline({
|
|
|
36465
36621
|
);
|
|
36466
36622
|
}
|
|
36467
36623
|
function useLookupCreate(lookup, onCreated, options = {}) {
|
|
36468
|
-
const [draftName, setDraftName] =
|
|
36624
|
+
const [draftName, setDraftName] = React132.useState(null);
|
|
36469
36625
|
const can = usePermissionOptional();
|
|
36470
36626
|
const entityDef = lookup?.entityDef;
|
|
36471
36627
|
const feature = entityDef?.permission?.feature;
|
|
36472
36628
|
const allowed = !feature || can(feature, "create");
|
|
36473
36629
|
const canCreate = !!lookup?.create && allowed;
|
|
36474
36630
|
const canEdit = !!entityDef && !!lookup?.load && !!lookup?.update && (!feature || can(feature, "edit"));
|
|
36475
|
-
const [editingId, setEditingId] =
|
|
36476
|
-
const onEdit =
|
|
36477
|
-
const createByName =
|
|
36631
|
+
const [editingId, setEditingId] = React132.useState(null);
|
|
36632
|
+
const onEdit = React132.useMemo(() => canEdit ? (id) => setEditingId(id) : void 0, [canEdit]);
|
|
36633
|
+
const createByName = React132.useCallback(async (name) => {
|
|
36478
36634
|
if (!lookup?.create) return;
|
|
36479
36635
|
onCreated(await lookup.create({ name }));
|
|
36480
36636
|
}, [lookup, onCreated]);
|
|
36481
|
-
const onCreate =
|
|
36637
|
+
const onCreate = React132.useMemo(() => {
|
|
36482
36638
|
if (!canCreate) return void 0;
|
|
36483
36639
|
if (!entityDef) return (name) => {
|
|
36484
36640
|
void createByName(name);
|
|
@@ -36587,8 +36743,8 @@ function OrderFormItemRow({
|
|
|
36587
36743
|
const rawKindLabel = itemTypes.find((tp) => tp.value === itemKind)?.label ?? itemKind;
|
|
36588
36744
|
const kindLabel = !itemKind || itemKind === "other" ? null : rawKindLabel;
|
|
36589
36745
|
const hasAdjustments = (discount ?? 0) > 0 || (surcharge ?? 0) > 0;
|
|
36590
|
-
const [showAdjustments, setShowAdjustments] =
|
|
36591
|
-
const [openExtras, setOpenExtras] =
|
|
36746
|
+
const [showAdjustments, setShowAdjustments] = React132.useState(hasAdjustments);
|
|
36747
|
+
const [openExtras, setOpenExtras] = React132.useState(
|
|
36592
36748
|
() => (extraFieldGroups ?? []).filter((g) => g.filled).map((g) => g.id)
|
|
36593
36749
|
);
|
|
36594
36750
|
const lookup = entityLookups[itemKind];
|
|
@@ -36858,9 +37014,9 @@ function OrderFormItemRow({
|
|
|
36858
37014
|
}
|
|
36859
37015
|
OrderFormItemRow.displayName = "OrderFormItemRow";
|
|
36860
37016
|
function CodeLookupField({ byCode, resolvedLabel, clearLabel, onResolved, onClear }) {
|
|
36861
|
-
const [code, setCode] =
|
|
36862
|
-
const [busy, setBusy] =
|
|
36863
|
-
const [error, setError] =
|
|
37017
|
+
const [code, setCode] = React132.useState("");
|
|
37018
|
+
const [busy, setBusy] = React132.useState(false);
|
|
37019
|
+
const [error, setError] = React132.useState(null);
|
|
36864
37020
|
async function submit() {
|
|
36865
37021
|
if (!code.trim() || busy) return;
|
|
36866
37022
|
setBusy(true);
|
|
@@ -36869,7 +37025,7 @@ function CodeLookupField({ byCode, resolvedLabel, clearLabel, onResolved, onClea
|
|
|
36869
37025
|
onResolved(await byCode.resolve(code));
|
|
36870
37026
|
setCode("");
|
|
36871
37027
|
} catch (e) {
|
|
36872
|
-
setError(
|
|
37028
|
+
setError(describeError(e));
|
|
36873
37029
|
} finally {
|
|
36874
37030
|
setBusy(false);
|
|
36875
37031
|
}
|
|
@@ -37081,13 +37237,13 @@ function OrderFormSkeleton({ parentLabel, onBack } = {}) {
|
|
|
37081
37237
|
] });
|
|
37082
37238
|
}
|
|
37083
37239
|
function useCatalogedItemTypes(itemTypes, lookups) {
|
|
37084
|
-
const countable =
|
|
37240
|
+
const countable = React132.useMemo(
|
|
37085
37241
|
() => itemTypes.filter((tp) => typeof lookups[tp.value]?.count === "function").map((tp) => tp.value),
|
|
37086
37242
|
[itemTypes, lookups]
|
|
37087
37243
|
);
|
|
37088
|
-
const [empty, setEmpty] =
|
|
37244
|
+
const [empty, setEmpty] = React132.useState([]);
|
|
37089
37245
|
const key = countable.join(",");
|
|
37090
|
-
|
|
37246
|
+
React132.useEffect(() => {
|
|
37091
37247
|
if (!countable.length) {
|
|
37092
37248
|
setEmpty([]);
|
|
37093
37249
|
return;
|
|
@@ -37106,7 +37262,7 @@ function useCatalogedItemTypes(itemTypes, lookups) {
|
|
|
37106
37262
|
cancelled = true;
|
|
37107
37263
|
};
|
|
37108
37264
|
}, [key, lookups]);
|
|
37109
|
-
return
|
|
37265
|
+
return React132.useMemo(
|
|
37110
37266
|
() => empty.length ? itemTypes.filter((tp) => !empty.includes(tp.value)) : itemTypes,
|
|
37111
37267
|
[itemTypes, empty]
|
|
37112
37268
|
);
|
|
@@ -37378,7 +37534,7 @@ function OrderCreateScreen({
|
|
|
37378
37534
|
errorActions,
|
|
37379
37535
|
saveBar
|
|
37380
37536
|
}) {
|
|
37381
|
-
const subtotal =
|
|
37537
|
+
const subtotal = React132.useMemo(
|
|
37382
37538
|
() => lines.reduce((sum, line) => sum + line.unitPrice * line.quantity, 0),
|
|
37383
37539
|
[lines]
|
|
37384
37540
|
);
|
|
@@ -37529,7 +37685,7 @@ function mergeLines(current2, incoming) {
|
|
|
37529
37685
|
return merged;
|
|
37530
37686
|
}
|
|
37531
37687
|
function ItemPicker({ search, onPick }) {
|
|
37532
|
-
const [open, setOpen] =
|
|
37688
|
+
const [open, setOpen] = React132.useState(false);
|
|
37533
37689
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
37534
37690
|
/* @__PURE__ */ jsxs(
|
|
37535
37691
|
"button",
|
|
@@ -37607,9 +37763,9 @@ function KanbanBoard({
|
|
|
37607
37763
|
toolbarActions
|
|
37608
37764
|
}) {
|
|
37609
37765
|
const collapsible = !!onToggleColumn;
|
|
37610
|
-
const frameRef =
|
|
37611
|
-
const [hoveredCol, setHoveredCol] =
|
|
37612
|
-
const centerFocused =
|
|
37766
|
+
const frameRef = React132.useRef(null);
|
|
37767
|
+
const [hoveredCol, setHoveredCol] = React132.useState(null);
|
|
37768
|
+
const centerFocused = React132.useCallback((event) => {
|
|
37613
37769
|
const frame = frameRef.current;
|
|
37614
37770
|
const column = event.target?.closest("[data-kanban-column]");
|
|
37615
37771
|
if (!frame || !column || frame.scrollWidth <= frame.clientWidth) return;
|
|
@@ -37618,14 +37774,14 @@ function KanbanBoard({
|
|
|
37618
37774
|
const delta = columnBox.left + columnBox.width / 2 - (frameBox.left + frameBox.width / 2);
|
|
37619
37775
|
if (Math.abs(delta) > 1) frame.scrollBy({ left: delta, behavior: "smooth" });
|
|
37620
37776
|
}, []);
|
|
37621
|
-
const autoScroll =
|
|
37622
|
-
const scrollStep =
|
|
37623
|
-
const stopAutoScroll =
|
|
37777
|
+
const autoScroll = React132.useRef(null);
|
|
37778
|
+
const scrollStep = React132.useRef(0);
|
|
37779
|
+
const stopAutoScroll = React132.useCallback(() => {
|
|
37624
37780
|
if (autoScroll.current !== null) cancelAnimationFrame(autoScroll.current);
|
|
37625
37781
|
autoScroll.current = null;
|
|
37626
37782
|
scrollStep.current = 0;
|
|
37627
37783
|
}, []);
|
|
37628
|
-
const tickAutoScroll =
|
|
37784
|
+
const tickAutoScroll = React132.useCallback(() => {
|
|
37629
37785
|
const frame = frameRef.current;
|
|
37630
37786
|
if (!frame || scrollStep.current === 0) {
|
|
37631
37787
|
stopAutoScroll();
|
|
@@ -37639,7 +37795,7 @@ function KanbanBoard({
|
|
|
37639
37795
|
}
|
|
37640
37796
|
autoScroll.current = requestAnimationFrame(tickAutoScroll);
|
|
37641
37797
|
}, [stopAutoScroll]);
|
|
37642
|
-
const onFrameDragOver =
|
|
37798
|
+
const onFrameDragOver = React132.useCallback((event) => {
|
|
37643
37799
|
const frame = frameRef.current;
|
|
37644
37800
|
if (!frame || frame.scrollWidth <= frame.clientWidth) return;
|
|
37645
37801
|
const box = frame.getBoundingClientRect();
|
|
@@ -37657,12 +37813,12 @@ function KanbanBoard({
|
|
|
37657
37813
|
}
|
|
37658
37814
|
if (autoScroll.current === null) autoScroll.current = requestAnimationFrame(tickAutoScroll);
|
|
37659
37815
|
}, [stopAutoScroll, tickAutoScroll]);
|
|
37660
|
-
const onFrameDragLeave =
|
|
37816
|
+
const onFrameDragLeave = React132.useCallback((event) => {
|
|
37661
37817
|
const indo = event.relatedTarget;
|
|
37662
37818
|
if (indo && event.currentTarget.contains(indo)) return;
|
|
37663
37819
|
stopAutoScroll();
|
|
37664
37820
|
}, [stopAutoScroll]);
|
|
37665
|
-
|
|
37821
|
+
React132.useEffect(() => stopAutoScroll, [stopAutoScroll]);
|
|
37666
37822
|
const hasToolbar = !!onSearchChange || !!onRefresh || !!toolbarActions;
|
|
37667
37823
|
const board = /* @__PURE__ */ jsx(
|
|
37668
37824
|
"div",
|
|
@@ -37770,10 +37926,10 @@ function BoardFrame({
|
|
|
37770
37926
|
toolbarActions,
|
|
37771
37927
|
className = ""
|
|
37772
37928
|
}) {
|
|
37773
|
-
const [open, setOpen] =
|
|
37774
|
-
const inputRef =
|
|
37929
|
+
const [open, setOpen] = React132.useState(false);
|
|
37930
|
+
const inputRef = React132.useRef(null);
|
|
37775
37931
|
const expanded = open || !!search;
|
|
37776
|
-
|
|
37932
|
+
React132.useEffect(() => {
|
|
37777
37933
|
if (open) inputRef.current?.focus();
|
|
37778
37934
|
}, [open]);
|
|
37779
37935
|
function collapse() {
|
|
@@ -37852,14 +38008,14 @@ function OrderBoardView({
|
|
|
37852
38008
|
rowId,
|
|
37853
38009
|
selectedRowId
|
|
37854
38010
|
}) {
|
|
37855
|
-
const getId =
|
|
38011
|
+
const getId = React132.useCallback(
|
|
37856
38012
|
(row) => rowId ? rowId(row) : String(row.id ?? ""),
|
|
37857
38013
|
[rowId]
|
|
37858
38014
|
);
|
|
37859
|
-
const [lastClicked, setLastClicked] =
|
|
37860
|
-
const [advancing, setAdvancing] =
|
|
38015
|
+
const [lastClicked, setLastClicked] = React132.useState(null);
|
|
38016
|
+
const [advancing, setAdvancing] = React132.useState({});
|
|
37861
38017
|
const selected = selectedRowId !== void 0 ? selectedRowId : lastClicked;
|
|
37862
|
-
const grouped =
|
|
38018
|
+
const grouped = React132.useMemo(() => {
|
|
37863
38019
|
const map = /* @__PURE__ */ new Map();
|
|
37864
38020
|
for (const col of board.columns) map.set(col.id, []);
|
|
37865
38021
|
for (const row of rows) {
|
|
@@ -37983,24 +38139,24 @@ function OrderListView({
|
|
|
37983
38139
|
boards,
|
|
37984
38140
|
viewKey
|
|
37985
38141
|
}) {
|
|
37986
|
-
const [search, setSearch] =
|
|
37987
|
-
const [page, setPage] =
|
|
37988
|
-
const [rawSelection, setRawSelection] =
|
|
37989
|
-
const offered =
|
|
38142
|
+
const [search, setSearch] = React132.useState("");
|
|
38143
|
+
const [page, setPage] = React132.useState(1);
|
|
38144
|
+
const [rawSelection, setRawSelection] = React132.useState([]);
|
|
38145
|
+
const offered = React132.useMemo(
|
|
37990
38146
|
() => views && views.length > 0 ? views : ["list"],
|
|
37991
38147
|
[views]
|
|
37992
38148
|
);
|
|
37993
|
-
const customFor =
|
|
38149
|
+
const customFor = React132.useCallback(
|
|
37994
38150
|
(id) => boards?.[id]?.render ?? null,
|
|
37995
38151
|
[boards]
|
|
37996
38152
|
);
|
|
37997
|
-
const boardFor =
|
|
38153
|
+
const boardFor = React132.useCallback(
|
|
37998
38154
|
(id) => (id === "board" ? board : boards?.[id]?.config) ?? null,
|
|
37999
38155
|
[board, boards]
|
|
38000
38156
|
);
|
|
38001
38157
|
const canBoard = offered.length > 1 && offered.some((id) => id !== "list" && (!!boardFor(id) || !!customFor(id)));
|
|
38002
38158
|
const storageKey2 = viewKey ? `fayz.orderView.${viewKey}` : null;
|
|
38003
|
-
const [view, setView] =
|
|
38159
|
+
const [view, setView] = React132.useState(() => {
|
|
38004
38160
|
const fallback = offered.includes(defaultView) ? defaultView : offered[0];
|
|
38005
38161
|
if (!storageKey2) return fallback;
|
|
38006
38162
|
try {
|
|
@@ -38010,7 +38166,7 @@ function OrderListView({
|
|
|
38010
38166
|
return fallback;
|
|
38011
38167
|
}
|
|
38012
38168
|
});
|
|
38013
|
-
const viewTabs =
|
|
38169
|
+
const viewTabs = React132.useMemo(
|
|
38014
38170
|
() => offered.map((option) => ({
|
|
38015
38171
|
value: option,
|
|
38016
38172
|
label: option === "list" ? "Lista" : boards?.[option]?.label ?? "Quadro",
|
|
@@ -38018,7 +38174,7 @@ function OrderListView({
|
|
|
38018
38174
|
})),
|
|
38019
38175
|
[offered, boards]
|
|
38020
38176
|
);
|
|
38021
|
-
const chooseView =
|
|
38177
|
+
const chooseView = React132.useCallback((next) => {
|
|
38022
38178
|
setView(next);
|
|
38023
38179
|
if (!storageKey2) return;
|
|
38024
38180
|
try {
|
|
@@ -38036,7 +38192,7 @@ function OrderListView({
|
|
|
38036
38192
|
const activeBoard = view === "list" ? null : boardFor(view);
|
|
38037
38193
|
const activeCustom = view === "list" ? null : customFor(view);
|
|
38038
38194
|
const showingBoard = !!activeBoard || !!activeCustom;
|
|
38039
|
-
const cols =
|
|
38195
|
+
const cols = React132.useMemo(
|
|
38040
38196
|
() => columns.map((c) => ({
|
|
38041
38197
|
id: c.key,
|
|
38042
38198
|
header: () => /* @__PURE__ */ jsx("div", { className: c.align === "right" ? "text-right" : "", children: c.header }),
|
|
@@ -38044,25 +38200,25 @@ function OrderListView({
|
|
|
38044
38200
|
})),
|
|
38045
38201
|
[columns]
|
|
38046
38202
|
);
|
|
38047
|
-
const filtered =
|
|
38203
|
+
const filtered = React132.useMemo(() => {
|
|
38048
38204
|
const term = search.trim().toLowerCase();
|
|
38049
38205
|
if (!term || !searchText) return rows;
|
|
38050
38206
|
return rows.filter((row) => searchText(row).toLowerCase().includes(term));
|
|
38051
38207
|
}, [rows, search, searchText]);
|
|
38052
|
-
|
|
38208
|
+
React132.useEffect(() => {
|
|
38053
38209
|
setPage(1);
|
|
38054
38210
|
}, [search]);
|
|
38055
38211
|
const paged = pageSize > 0 ? filtered.slice((page - 1) * pageSize, page * pageSize) : filtered;
|
|
38056
|
-
const getId =
|
|
38212
|
+
const getId = React132.useCallback(
|
|
38057
38213
|
(row) => rowId ? rowId(row) : String(row.id ?? ""),
|
|
38058
38214
|
[rowId]
|
|
38059
38215
|
);
|
|
38060
|
-
const pageIds =
|
|
38061
|
-
const selectedIds =
|
|
38216
|
+
const pageIds = React132.useMemo(() => paged.map(getId), [paged, getId]);
|
|
38217
|
+
const selectedIds = React132.useMemo(
|
|
38062
38218
|
() => rawSelection.filter((id) => pageIds.includes(id)),
|
|
38063
38219
|
[rawSelection, pageIds]
|
|
38064
38220
|
);
|
|
38065
|
-
const selectedRows =
|
|
38221
|
+
const selectedRows = React132.useMemo(
|
|
38066
38222
|
() => paged.filter((row) => selectedIds.includes(getId(row))),
|
|
38067
38223
|
[paged, selectedIds, getId]
|
|
38068
38224
|
);
|
|
@@ -38212,13 +38368,13 @@ function PaymentStatusBadge({
|
|
|
38212
38368
|
receiveLabel = "Receber",
|
|
38213
38369
|
onOpenDetails
|
|
38214
38370
|
}) {
|
|
38215
|
-
const [open, setOpen] =
|
|
38216
|
-
const [lines, setLines] =
|
|
38217
|
-
const timer =
|
|
38218
|
-
|
|
38371
|
+
const [open, setOpen] = React132__default.useState(false);
|
|
38372
|
+
const [lines, setLines] = React132__default.useState(null);
|
|
38373
|
+
const timer = React132__default.useRef(null);
|
|
38374
|
+
React132__default.useEffect(() => {
|
|
38219
38375
|
setLines(null);
|
|
38220
38376
|
}, [status, paidAmount]);
|
|
38221
|
-
const load =
|
|
38377
|
+
const load = React132__default.useCallback(() => {
|
|
38222
38378
|
if (lines || !onLoadDetails) return;
|
|
38223
38379
|
void onLoadDetails().then(setLines).catch(() => setLines([]));
|
|
38224
38380
|
}, [lines, onLoadDetails]);
|
|
@@ -38353,13 +38509,13 @@ function invalidateOrdersPaymentStatus(orderId) {
|
|
|
38353
38509
|
else cache2.clear();
|
|
38354
38510
|
}
|
|
38355
38511
|
function useOrdersPaymentStatus(orderIds) {
|
|
38356
|
-
const key =
|
|
38512
|
+
const key = React132.useMemo(
|
|
38357
38513
|
() => Array.from(new Set(orderIds.filter(Boolean))).sort().join(","),
|
|
38358
38514
|
[orderIds]
|
|
38359
38515
|
);
|
|
38360
|
-
const [byOrder, setByOrder] =
|
|
38361
|
-
const [loading, setLoading] =
|
|
38362
|
-
const load =
|
|
38516
|
+
const [byOrder, setByOrder] = React132.useState(() => /* @__PURE__ */ new Map());
|
|
38517
|
+
const [loading, setLoading] = React132.useState(false);
|
|
38518
|
+
const load = React132.useCallback(async (force = false) => {
|
|
38363
38519
|
const ids = key ? key.split(",") : [];
|
|
38364
38520
|
if (ids.length === 0) {
|
|
38365
38521
|
setByOrder(/* @__PURE__ */ new Map());
|
|
@@ -38390,7 +38546,7 @@ function useOrdersPaymentStatus(orderIds) {
|
|
|
38390
38546
|
}
|
|
38391
38547
|
setByOrder(new Map(ids.map((id) => [id, cache2.get(id)]).filter(([, v]) => Boolean(v))));
|
|
38392
38548
|
}, [key]);
|
|
38393
|
-
|
|
38549
|
+
React132.useEffect(() => {
|
|
38394
38550
|
void load();
|
|
38395
38551
|
}, [load]);
|
|
38396
38552
|
return { byOrder, loading, reload: () => load(true) };
|
|
@@ -38457,12 +38613,12 @@ function money2(value, currency) {
|
|
|
38457
38613
|
return value.toLocaleString("pt-BR", { style: "currency", currency: currency || "BRL" });
|
|
38458
38614
|
}
|
|
38459
38615
|
function useOrderDetail(orderId) {
|
|
38460
|
-
const [order, setOrder] =
|
|
38461
|
-
const [loading, setLoading] =
|
|
38462
|
-
const [error, setError] =
|
|
38463
|
-
const [nonce, setNonce] =
|
|
38464
|
-
const
|
|
38465
|
-
|
|
38616
|
+
const [order, setOrder] = React132.useState(null);
|
|
38617
|
+
const [loading, setLoading] = React132.useState(false);
|
|
38618
|
+
const [error, setError] = React132.useState(null);
|
|
38619
|
+
const [nonce, setNonce] = React132.useState(0);
|
|
38620
|
+
const reload2 = React132.useCallback(() => setNonce((n) => n + 1), []);
|
|
38621
|
+
React132.useEffect(() => {
|
|
38466
38622
|
if (!orderId) {
|
|
38467
38623
|
setOrder(null);
|
|
38468
38624
|
setError(null);
|
|
@@ -38525,7 +38681,7 @@ function useOrderDetail(orderId) {
|
|
|
38525
38681
|
cancelled = true;
|
|
38526
38682
|
};
|
|
38527
38683
|
}, [orderId, nonce]);
|
|
38528
|
-
return { order, loading, error, reload };
|
|
38684
|
+
return { order, loading, error, reload: reload2 };
|
|
38529
38685
|
}
|
|
38530
38686
|
var statusWord = (v) => v ? ORDER_STATUS_LABELS[v] ?? v : void 0;
|
|
38531
38687
|
var kindWord = (v) => v ? ORDER_KIND_LABELS[v] ?? v : void 0;
|
|
@@ -38577,17 +38733,17 @@ function OrderDetailRail({
|
|
|
38577
38733
|
kindLabel,
|
|
38578
38734
|
channelLabel
|
|
38579
38735
|
}) {
|
|
38580
|
-
const { order, loading, error, reload } = useOrderDetail(orderId);
|
|
38736
|
+
const { order, loading, error, reload: reload2 } = useOrderDetail(orderId);
|
|
38581
38737
|
const { byOrder: paymentByOrder } = useOrdersPaymentStatus([orderId]);
|
|
38582
|
-
const [running, setRunning] =
|
|
38583
|
-
const [pending2, setPending] =
|
|
38738
|
+
const [running, setRunning] = React132.useState(null);
|
|
38739
|
+
const [pending2, setPending] = React132.useState(null);
|
|
38584
38740
|
const perform = async (action) => {
|
|
38585
38741
|
if (!order) return;
|
|
38586
38742
|
setRunning(action.id);
|
|
38587
38743
|
try {
|
|
38588
38744
|
await action.onSelect(order);
|
|
38589
38745
|
onActionDone?.();
|
|
38590
|
-
if (action.keepOpen)
|
|
38746
|
+
if (action.keepOpen) reload2();
|
|
38591
38747
|
else onClose();
|
|
38592
38748
|
} finally {
|
|
38593
38749
|
setRunning(null);
|
|
@@ -38643,7 +38799,7 @@ function OrderDetailRail({
|
|
|
38643
38799
|
/* @__PURE__ */ jsx("p", { className: "pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/60", children: "Observa\xE7\xF5es" }),
|
|
38644
38800
|
/* @__PURE__ */ jsx("p", { className: "text-sm", children: order.notes })
|
|
38645
38801
|
] }),
|
|
38646
|
-
children?.(order,
|
|
38802
|
+
children?.(order, reload2),
|
|
38647
38803
|
/* @__PURE__ */ jsx("div", { className: "mt-auto border-t border-border/40 px-4 py-2.5", children: /* @__PURE__ */ jsxs("dl", { className: "grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-sm", children: [
|
|
38648
38804
|
/* @__PURE__ */ jsx(Row3, { label: "Subtotal", value: money2(order.subtotal, order.currency) }),
|
|
38649
38805
|
order.discount > 0 && /* @__PURE__ */ jsx(Row3, { label: "Desconto", value: `\u2212 ${money2(order.discount, order.currency)}` }),
|
|
@@ -38738,11 +38894,11 @@ function receivableTone(value) {
|
|
|
38738
38894
|
return "warning";
|
|
38739
38895
|
}
|
|
38740
38896
|
function useOrderReceivable(orderId) {
|
|
38741
|
-
const [receivable, setReceivable] =
|
|
38897
|
+
const [receivable, setReceivable] = React132.useState(
|
|
38742
38898
|
() => orderId ? cache3.get(orderId) ?? null : null
|
|
38743
38899
|
);
|
|
38744
|
-
const [loading, setLoading] =
|
|
38745
|
-
const
|
|
38900
|
+
const [loading, setLoading] = React132.useState(() => Boolean(orderId) && !cache3.has(orderId));
|
|
38901
|
+
const reload2 = React132.useCallback(async (force = false) => {
|
|
38746
38902
|
if (!orderId) return;
|
|
38747
38903
|
const db2 = getSupabaseClientOptional();
|
|
38748
38904
|
if (!db2) {
|
|
@@ -38765,10 +38921,10 @@ function useOrderReceivable(orderId) {
|
|
|
38765
38921
|
setReceivable(next);
|
|
38766
38922
|
setLoading(false);
|
|
38767
38923
|
}, [orderId]);
|
|
38768
|
-
|
|
38769
|
-
void
|
|
38770
|
-
}, [
|
|
38771
|
-
return { receivable, loading, reload };
|
|
38924
|
+
React132.useEffect(() => {
|
|
38925
|
+
void reload2();
|
|
38926
|
+
}, [reload2]);
|
|
38927
|
+
return { receivable, loading, reload: reload2 };
|
|
38772
38928
|
}
|
|
38773
38929
|
function toOrderDetailReceivable(receivable, money4, options = {}) {
|
|
38774
38930
|
if (!receivable) return null;
|
|
@@ -38918,15 +39074,15 @@ function linesOf(order) {
|
|
|
38918
39074
|
}
|
|
38919
39075
|
function useOrderEditor(orderId) {
|
|
38920
39076
|
const { order, loading, error } = useOrderDetail(orderId);
|
|
38921
|
-
const [lines, setLines] =
|
|
38922
|
-
const [saving, setSaving] =
|
|
38923
|
-
const originalRef =
|
|
38924
|
-
|
|
39077
|
+
const [lines, setLines] = React132.useState([]);
|
|
39078
|
+
const [saving, setSaving] = React132.useState(false);
|
|
39079
|
+
const originalRef = React132.useRef([]);
|
|
39080
|
+
React132.useEffect(() => {
|
|
38925
39081
|
const seeded = linesOf(order);
|
|
38926
39082
|
originalRef.current = seeded;
|
|
38927
39083
|
setLines(seeded);
|
|
38928
39084
|
}, [order]);
|
|
38929
|
-
const dirty =
|
|
39085
|
+
const dirty = React132.useMemo(() => {
|
|
38930
39086
|
const before = originalRef.current;
|
|
38931
39087
|
if (before.length !== lines.length) return true;
|
|
38932
39088
|
return lines.some((line, i) => {
|
|
@@ -38934,7 +39090,7 @@ function useOrderEditor(orderId) {
|
|
|
38934
39090
|
return !was || was.key !== line.key || was.quantity !== line.quantity || was.unitPrice !== line.unitPrice;
|
|
38935
39091
|
});
|
|
38936
39092
|
}, [lines]);
|
|
38937
|
-
const save =
|
|
39093
|
+
const save = React132.useCallback(async () => {
|
|
38938
39094
|
if (!orderId || !order) return { ok: false, error: "Pedido n\xE3o carregado" };
|
|
38939
39095
|
const db2 = getSupabaseClientOptional();
|
|
38940
39096
|
if (!db2) return { ok: false, error: "Sem conex\xE3o" };
|
|
@@ -39091,19 +39247,19 @@ function createClientOrdersProvider() {
|
|
|
39091
39247
|
}
|
|
39092
39248
|
function createPlaceholder(title, description) {
|
|
39093
39249
|
return function PlaceholderPage() {
|
|
39094
|
-
return
|
|
39250
|
+
return React132__default.createElement(
|
|
39095
39251
|
"div",
|
|
39096
39252
|
{ className: "mx-auto max-w-4xl" },
|
|
39097
|
-
|
|
39098
|
-
description ?
|
|
39099
|
-
|
|
39253
|
+
React132__default.createElement("h1", { className: "text-3xl font-bold text-foreground" }, title),
|
|
39254
|
+
description ? React132__default.createElement("p", { className: "mt-1 text-muted-foreground" }, description) : null,
|
|
39255
|
+
React132__default.createElement(
|
|
39100
39256
|
"div",
|
|
39101
39257
|
{ className: "mt-8 flex items-center justify-center rounded-card border border-dashed border-border bg-card p-16" },
|
|
39102
|
-
|
|
39258
|
+
React132__default.createElement(
|
|
39103
39259
|
"div",
|
|
39104
39260
|
{ className: "text-center" },
|
|
39105
|
-
|
|
39106
|
-
|
|
39261
|
+
React132__default.createElement("p", { className: "text-lg font-medium text-muted-foreground" }, "Coming Soon"),
|
|
39262
|
+
React132__default.createElement(
|
|
39107
39263
|
"p",
|
|
39108
39264
|
{ className: "mt-1 text-sm text-muted-foreground/70" },
|
|
39109
39265
|
"This module is being built as a plugin."
|
|
@@ -39184,7 +39340,7 @@ function ModuleActionBar({
|
|
|
39184
39340
|
trailing
|
|
39185
39341
|
}) {
|
|
39186
39342
|
const t = useTranslation();
|
|
39187
|
-
const actions =
|
|
39343
|
+
const actions = React132__default.useMemo(() => {
|
|
39188
39344
|
const out = (quickActions ?? []).map((qa, i) => ({
|
|
39189
39345
|
id: qa.id,
|
|
39190
39346
|
label: qa.label,
|
|
@@ -39216,9 +39372,9 @@ function ModuleActionBar({
|
|
|
39216
39372
|
] });
|
|
39217
39373
|
}
|
|
39218
39374
|
function createPluginContext(displayName) {
|
|
39219
|
-
const ConfigContext =
|
|
39220
|
-
const ProviderContext =
|
|
39221
|
-
const StoreContext =
|
|
39375
|
+
const ConfigContext = React132__default.createContext(null);
|
|
39376
|
+
const ProviderContext = React132__default.createContext(null);
|
|
39377
|
+
const StoreContext = React132__default.createContext(null);
|
|
39222
39378
|
const ContextProvider = ({
|
|
39223
39379
|
config,
|
|
39224
39380
|
provider: provider2,
|
|
@@ -39227,17 +39383,17 @@ function createPluginContext(displayName) {
|
|
|
39227
39383
|
}) => /* @__PURE__ */ jsx(ConfigContext.Provider, { value: config, children: /* @__PURE__ */ jsx(ProviderContext.Provider, { value: provider2, children: /* @__PURE__ */ jsx(StoreContext.Provider, { value: store, children }) }) });
|
|
39228
39384
|
ContextProvider.displayName = `${displayName}ContextProvider`;
|
|
39229
39385
|
function useConfig() {
|
|
39230
|
-
const ctx =
|
|
39386
|
+
const ctx = React132__default.useContext(ConfigContext);
|
|
39231
39387
|
if (!ctx) throw new Error(`useConfig must be used within ${displayName}`);
|
|
39232
39388
|
return ctx;
|
|
39233
39389
|
}
|
|
39234
39390
|
function useProvider() {
|
|
39235
|
-
const ctx =
|
|
39391
|
+
const ctx = React132__default.useContext(ProviderContext);
|
|
39236
39392
|
if (!ctx) throw new Error(`useProvider must be used within ${displayName}`);
|
|
39237
39393
|
return ctx;
|
|
39238
39394
|
}
|
|
39239
39395
|
function useStore2(selector) {
|
|
39240
|
-
const store =
|
|
39396
|
+
const store = React132__default.useContext(StoreContext);
|
|
39241
39397
|
if (!store) throw new Error(`useStore must be used within ${displayName}`);
|
|
39242
39398
|
return useStore$1(store, selector);
|
|
39243
39399
|
}
|
|
@@ -39294,7 +39450,7 @@ function PluginRegistryManager({ registries, routeBase, className }) {
|
|
|
39294
39450
|
return registries[0]?.id ?? "";
|
|
39295
39451
|
};
|
|
39296
39452
|
const [activeTab, setActiveTab] = useState(getTabFromHash);
|
|
39297
|
-
|
|
39453
|
+
React132__default.useEffect(() => {
|
|
39298
39454
|
if (!routeBase) return;
|
|
39299
39455
|
const handler = () => setActiveTab(getTabFromHash());
|
|
39300
39456
|
window.addEventListener("hashchange", handler);
|
|
@@ -39505,7 +39661,7 @@ function PersonLink2({ personId, name, avatarUrl, lookup, kind, profileHref, tab
|
|
|
39505
39661
|
const email = data?.email;
|
|
39506
39662
|
const phone = data?.phone;
|
|
39507
39663
|
const resolvedKind = kind ?? data?.kind ?? person?.group;
|
|
39508
|
-
const actions =
|
|
39664
|
+
const actions = React132__default.useMemo(
|
|
39509
39665
|
() => personId ? getPersonActions(resolvedKind) : [],
|
|
39510
39666
|
[personId, resolvedKind]
|
|
39511
39667
|
);
|
|
@@ -39958,7 +40114,7 @@ function useRememberedList(options) {
|
|
|
39958
40114
|
const entry = lists.get(key);
|
|
39959
40115
|
const [rows, setRows] = useState(() => entry.rows);
|
|
39960
40116
|
const [error, setError] = useState("");
|
|
39961
|
-
const
|
|
40117
|
+
const reload2 = useCallback(async () => {
|
|
39962
40118
|
const e = lists.get(key);
|
|
39963
40119
|
e.stale = false;
|
|
39964
40120
|
e.dirty.clear();
|
|
@@ -39975,14 +40131,14 @@ function useRememberedList(options) {
|
|
|
39975
40131
|
}, [key]);
|
|
39976
40132
|
const settle = useCallback(async () => {
|
|
39977
40133
|
const e = lists.get(key);
|
|
39978
|
-
if (e.stale || !e.rows) return
|
|
40134
|
+
if (e.stale || !e.rows) return reload2();
|
|
39979
40135
|
if (e.dirty.size === 0) return;
|
|
39980
40136
|
const { loadOne, rowFor } = opts.current;
|
|
39981
40137
|
const current2 = e.rows;
|
|
39982
40138
|
const ids = [...e.dirty];
|
|
39983
40139
|
e.dirty.clear();
|
|
39984
40140
|
const targets = ids.map((id) => rowFor ? rowFor(current2, id) : current2.find((r) => r.id === id));
|
|
39985
|
-
if (!loadOne || targets.some((t) => !t)) return
|
|
40141
|
+
if (!loadOne || targets.some((t) => !t)) return reload2();
|
|
39986
40142
|
try {
|
|
39987
40143
|
const unique = [...new Set(targets.map((t) => t.id))];
|
|
39988
40144
|
const fresh = new Map(await Promise.all(unique.map(async (id) => [id, await loadOne(id)])));
|
|
@@ -39990,9 +40146,9 @@ function useRememberedList(options) {
|
|
|
39990
40146
|
e.rows = next;
|
|
39991
40147
|
setRows(next);
|
|
39992
40148
|
} catch {
|
|
39993
|
-
return
|
|
40149
|
+
return reload2();
|
|
39994
40150
|
}
|
|
39995
|
-
}, [key,
|
|
40151
|
+
}, [key, reload2]);
|
|
39996
40152
|
useEffect(() => {
|
|
39997
40153
|
const e = lists.get(key);
|
|
39998
40154
|
e.tables = opts.current.tables;
|
|
@@ -40005,7 +40161,7 @@ function useRememberedList(options) {
|
|
|
40005
40161
|
if (e.wake) e.wake = void 0;
|
|
40006
40162
|
};
|
|
40007
40163
|
}, [key, settle]);
|
|
40008
|
-
return { rows, error, reload };
|
|
40164
|
+
return { rows, error, reload: reload2 };
|
|
40009
40165
|
}
|
|
40010
40166
|
var STORAGE_PREFIX2 = "saas:prefs:";
|
|
40011
40167
|
function readStore(pluginId, defaults) {
|
|
@@ -40330,10 +40486,10 @@ function useTeachMe(def) {
|
|
|
40330
40486
|
return useFeatureHelp(def).teach;
|
|
40331
40487
|
}
|
|
40332
40488
|
function useFeatureHelp(def) {
|
|
40333
|
-
const ref =
|
|
40489
|
+
const ref = React132.useRef(def);
|
|
40334
40490
|
ref.current = def;
|
|
40335
40491
|
const id = `teach.${def.feature}`;
|
|
40336
|
-
const contribution =
|
|
40492
|
+
const contribution = React132.useMemo(
|
|
40337
40493
|
() => ({
|
|
40338
40494
|
id,
|
|
40339
40495
|
pluginId: "teach-me",
|
|
@@ -40367,7 +40523,7 @@ function useFeatureHelp(def) {
|
|
|
40367
40523
|
[id]
|
|
40368
40524
|
);
|
|
40369
40525
|
useAgentSurface(contribution);
|
|
40370
|
-
return
|
|
40526
|
+
return React132.useMemo(
|
|
40371
40527
|
() => ({
|
|
40372
40528
|
help: () => helpWith(ref.current),
|
|
40373
40529
|
teach: () => teachMe(ref.current),
|
|
@@ -40531,23 +40687,23 @@ function getRailPage(id) {
|
|
|
40531
40687
|
}
|
|
40532
40688
|
function ConnectorsHub({ hostPluginId }) {
|
|
40533
40689
|
const { t } = useTranslation$1();
|
|
40534
|
-
const { connectors, reload } = useConnectors({ includeGrants: false });
|
|
40690
|
+
const { connectors, reload: reload2 } = useConnectors({ includeGrants: false });
|
|
40535
40691
|
const assistantAvailable = useConnectorsPanelAvailable();
|
|
40536
|
-
const [selected, setSelected] =
|
|
40537
|
-
const [adding, setAdding] =
|
|
40538
|
-
const hosted =
|
|
40692
|
+
const [selected, setSelected] = React132__default.useState(null);
|
|
40693
|
+
const [adding, setAdding] = React132__default.useState(false);
|
|
40694
|
+
const hosted = React132__default.useMemo(
|
|
40539
40695
|
() => (connectors ?? []).filter((c) => c.hostPluginId === hostPluginId),
|
|
40540
40696
|
[connectors, hostPluginId]
|
|
40541
40697
|
);
|
|
40542
|
-
const categories =
|
|
40698
|
+
const categories = React132__default.useMemo(
|
|
40543
40699
|
() => [...new Set(hosted.map((c) => c.category).filter((c) => !!c))],
|
|
40544
40700
|
[hosted]
|
|
40545
40701
|
);
|
|
40546
|
-
const scoped =
|
|
40702
|
+
const scoped = React132__default.useMemo(() => {
|
|
40547
40703
|
const siblings = inCategories(connectors ?? [], categories).filter((c) => c.hostPluginId !== hostPluginId);
|
|
40548
40704
|
return [...hosted, ...siblings];
|
|
40549
40705
|
}, [connectors, hosted, categories, hostPluginId]);
|
|
40550
|
-
|
|
40706
|
+
React132__default.useEffect(() => {
|
|
40551
40707
|
if (!selected || !connectors) return;
|
|
40552
40708
|
const fresh = connectors.find((c) => c.id === selected.id);
|
|
40553
40709
|
if (fresh && fresh !== selected) setSelected(fresh);
|
|
@@ -40613,7 +40769,7 @@ function ConnectorsHub({ hostPluginId }) {
|
|
|
40613
40769
|
connector: selected,
|
|
40614
40770
|
open: !!selected,
|
|
40615
40771
|
onOpenChange: (open) => !open && setSelected(null),
|
|
40616
|
-
onChanged:
|
|
40772
|
+
onChanged: reload2
|
|
40617
40773
|
}
|
|
40618
40774
|
)
|
|
40619
40775
|
] });
|
|
@@ -40723,7 +40879,7 @@ function PluginSettingsPanel({ title, generalSettings, registries, customTabs, r
|
|
|
40723
40879
|
return tabs[0]?.id ?? "";
|
|
40724
40880
|
}
|
|
40725
40881
|
const [activeTab, setActiveTab] = useState(getActiveFromHash);
|
|
40726
|
-
|
|
40882
|
+
React132__default.useEffect(() => {
|
|
40727
40883
|
const handler = () => setActiveTab(getActiveFromHash());
|
|
40728
40884
|
window.addEventListener("hashchange", handler);
|
|
40729
40885
|
return () => window.removeEventListener("hashchange", handler);
|