@fayz-ai/admin 0.30.0 → 0.30.2
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/ImportWizard-7UFB2PPF.js +3 -0
- package/dist/{ImportWizard-CISHGNQC.js.map → ImportWizard-7UFB2PPF.js.map} +1 -1
- package/dist/app/admin-app.d.ts.map +1 -1
- package/dist/{chunk-UMRN6427.js → chunk-46UABOOC.js} +12 -37
- package/dist/chunk-46UABOOC.js.map +1 -0
- package/dist/components/notifications/UpdateReady.d.ts +8 -0
- package/dist/components/notifications/UpdateReady.d.ts.map +1 -0
- package/dist/crud/ImportWizard.d.ts.map +1 -1
- package/dist/crud/archetypes/OrderDetailView.d.ts +1 -1
- package/dist/crud/archetypes/OrderDetailView.d.ts.map +1 -1
- package/dist/crud/archetypes/PersonDetailTabs.d.ts +10 -0
- package/dist/crud/archetypes/PersonDetailTabs.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +961 -693
- package/dist/index.js.map +1 -1
- package/dist/onboarding/index.d.ts +2 -0
- package/dist/onboarding/index.d.ts.map +1 -1
- package/dist/onboarding/usePluginOnboardingGate.d.ts +14 -0
- package/dist/onboarding/usePluginOnboardingGate.d.ts.map +1 -0
- package/dist/units/PersonAvailabilityTab.d.ts +13 -0
- package/dist/units/PersonAvailabilityTab.d.ts.map +1 -0
- package/package.json +5 -5
- package/dist/ImportWizard-CISHGNQC.js +0 -3
- package/dist/chunk-UMRN6427.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { resolveEntityRoute, openEntity, entityRouteHasDetail, resolveEntityAnch
|
|
|
8
8
|
export { openEntity, resolveEntityAnchor, resolveEntityHref, resolveEntityRoute } from './chunk-P5UIGQFY.js';
|
|
9
9
|
import { useAdminPath, navigateTo, normalizeAdminPath, routeScore, matchRoute } from './chunk-VX3WJLKK.js';
|
|
10
10
|
export { navigateTo as adminNavigateTo, useAdminPath } from './chunk-VX3WJLKK.js';
|
|
11
|
-
export { ImportWizard } from './chunk-
|
|
11
|
+
export { ImportWizard } from './chunk-46UABOOC.js';
|
|
12
12
|
import { createArchetypeLookup, getPersonLookup } from './chunk-3SREEFHN.js';
|
|
13
13
|
export { ScheduleDateExceptions, ScheduleEditor, ScheduleGridPanel, createArchetypeLookup, deleteSchedule, getPersonBookable, getPersonLookup, getScheduleBlockConfig, getSchedules, mergeBlockSettings, parseBlockSettings, registerPersonLookup, replaceWeeklySchedules, saveSchedule, setPersonBookable, setScheduleBlockConfig, subscribeScheduleBlockConfig } from './chunk-3SREEFHN.js';
|
|
14
14
|
import { getFayzSupabaseClientOptional, getSupabaseClientOptional as getSupabaseClientOptional$1, useAppConfigStore, activePluginIds, hasPlugin, WorkspaceChooserGate, WorkspaceSwitchingHost, createFayzSupabaseClient, resolveAppId, createSupabaseOrgAdapter, createMockOrgAdapter, OrgMark, useWorkspaceSwitchingStore, searchWorkspaces, getFayzSupabaseClient } from './chunk-ZUM3Y7VB.js';
|
|
@@ -19,21 +19,21 @@ import { usePermissionOptional, usePermissionsStore, PermissionsProvider } from
|
|
|
19
19
|
export { PermissionsProvider, useHasPermission, usePermission, usePermissionOptional, usePermissions, usePermissionsStore } from './chunk-UQ2NTFQC.js';
|
|
20
20
|
import { cn, useOrganizationStore } from './chunk-W5IBKM3K.js';
|
|
21
21
|
export { getPersistedOrgId, useOrganizationStore } from './chunk-W5IBKM3K.js';
|
|
22
|
-
import * as
|
|
23
|
-
import
|
|
22
|
+
import * as React122 from 'react';
|
|
23
|
+
import React122__default, { createContext, useMemo, useState, useRef, useCallback, useEffect, useLayoutEffect, createElement, useContext } from 'react';
|
|
24
24
|
import { createDebug, resetActiveUnit, setUnitMode, setActiveUnitId, setScopedResources, tl, fetchAppConfig, getSupabaseClientOptional, createSafeDataProvider, isKnownMissing, rememberIfMissing, deriveEntityKey, registerEntity, getActiveTenantId, resolveDataProvider, bulkRemove, emitDomainEvent, entityEventKey, errorMessage, useTranslation, useDataChanged, emitDataChanged, exportCSV, formatDateTime as formatDateTime$1, formatDate as formatDate$1, formatCurrency as formatCurrency$1, bulkCreate, matchesRange, isConnectorCategory, usePluginRuntimeOptional, useDataVersion, reportAppError, getWidgetsForZone, resolvePluginComponent, invalidateAppConfig, toTenantPluginBindings, setCurrentLocale, resolveLocale, resolvePluginRuntime, PluginRuntimeProvider, I18nProvider, getAllEntities, resolveIntegrationSurface, defineApp, registerScaffold, useActiveTenantId, useConnectorsForPlugin, renderApp as renderApp$1, parseRangeFilter, isFilterObject, connectionKey, useManifest, registerEventSink, usePluginRuntime, installGlobalErrorHandlers, registerErrorReporter, applyNavComposition, mergeTranslations, coreTranslations, attachPersistentCache, getPersistentCache, createMockProvider, listConnections, connectorPlanes, connectorPermissions, connectorEntities, preferredPlane, connectorDirection, countByTenant, getCurrentLocale, searchEverything, getComponent, getPluginFactory, connectorSettings, groupedPermissions, invocationPlane, missingRequiredSettings, isSettingSet, getEntityByKey, connectorSubscribesTo, eventKeyMatches, formatPostalCode, isValidPostalCode, lookupPostalCode } from '@fayz-ai/core';
|
|
25
25
|
export { ConnectorRuntimeTokenUnavailableError, createSafeDataProvider, formatDate, formatDateTime, getActiveLocale, getActiveTenantId, getConnectorRuntimeTokenSource, getCurrentLocale, getSupabaseClientOptional, preloadLocale, resolveBackendEnv, setConnectorRuntimeTokenSource, setCurrentLocale, tl, useActiveTenantId } from '@fayz-ai/core';
|
|
26
26
|
import { usePasswordSetupGate, SetPasswordPage, AuthGate, AuthProvider, createAuthRuntime } from '@fayz-ai/plugin-auth';
|
|
27
27
|
export { LoginPage } from '@fayz-ai/plugin-auth';
|
|
28
|
-
import { toast, usePageTrailParent, navigateToCrumb, Button, PageHeader, ConfirmDialog, 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, PageActionBar, ICON_MAP, Sheet, SheetContent, SheetBody, useIsWide, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, Checkbox, useTourStore, setTourNavigator, TourSpotlight, PracticeOverlay, Input, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Wizard, SidebarOnboarding, OnboardingWidget,
|
|
28
|
+
import { toast, usePageTrailParent, navigateToCrumb, Button, PageHeader, ConfirmDialog, 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, PageActionBar, ICON_MAP, Sheet, SheetContent, SheetBody, useIsWide, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, Checkbox, useTourStore, setTourNavigator, TourSpotlight, PracticeOverlay, Input, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Wizard, SidebarOnboarding, OnboardingWidget, Skeleton, useLayoutStore, useSaveBar, useBackHandler, SubpageHeader, Separator, Tabs, TabsList, TabsTrigger, TabsContent, CardContent, ModalBody, ToastProvider, NavTransitionProvider, ListView, Thumbnail, ModalPortal, ModalOverlay, SearchSelect, CurrencyInput, SearchField, ChevronPager, Popover, PopoverTrigger, PopoverContent, useModuleLayout, PhoneLink, normalizePhone, SearchCombobox, HeaderTabs, usePageTrail, AppShellSkeleton, usePracticeStore, Switch, ModuleLayoutProvider, AppShell, PageTransition, PickerDialog, MarkdownEditor, PhoneField, isCreateRoute, PageRail, RailNavItem, createFayzTheme, Avatar, AvatarImage, AvatarFallback, Markdown, PageTrail, RowActions, CardTitle, CardDescription, DropdownSub, DropdownSubTrigger, DropdownSubContent, DropdownRadioGroup, DropdownRadioItem, BottomSheet, CardHeader, CardFooter, SegmentedControl, SheetCard, SheetRow, useSheetClose, ModalTask } from '@fayz-ai/ui';
|
|
29
29
|
export { createFayzTheme, fayzThemePresets } from '@fayz-ai/ui';
|
|
30
30
|
import { useAuthStore, useAuth, buildAppHandoffUrl } from '@fayz-ai/auth';
|
|
31
31
|
export { useAuth } from '@fayz-ai/auth';
|
|
32
32
|
import { create, useStore as useStore$1 } from 'zustand';
|
|
33
33
|
import * as LucideIcons3 from 'lucide-react';
|
|
34
|
-
import { Trash2, Upload, Search, ArrowDown, ArrowUp, ArrowUpDown, Check, Download, ChevronLeft, ChevronRight, AlertTriangle, Pencil, Inbox, Package, Sparkles, Plug, DollarSign, Clock, X, WandSparkles, Loader2, ArrowDownToLine, ArrowUpFromLine, CheckCircle2, Crown, ArrowRight, History, SquarePen, Settings2, Mic, User, Plus, Minus, ListChecks, ChevronDown, ArrowLeft, Calendar, ClipboardList, CheckSquare, BookOpen, Lock, PinOff, Pin, Eye, Users, StickyNote, CheckSquare2, Square, Building2, RotateCcw, Copy, Globe, LayoutTemplate, Store, ChevronsUpDown, ExternalLink, PenSquare, RefreshCw, XCircle, Camera, Edit, Star, Link2Off, Layers, ShoppingBag, MoreHorizontal, ChevronUp, List, LayoutGrid, CircleDollarSign, Receipt, Settings, Mail, MessageCircle, Cake, HelpCircle, Wrench, TableProperties, ShieldCheck, MessageSquare, Paperclip, Infinity, CheckCheck, PartyPopper, Compass, Play, MapPin, ArrowUpRight, Pause, CalendarDays, CircleCheckBig, UserX, Ban, CircleAlert, CircleEllipsis, FileText, CircleDashed, Power, ArrowRightLeft, File as File$1, FileImage, FileSpreadsheet, AlertCircle, CreditCard, SlidersHorizontal, Puzzle, Shield, Palette, Blocks, ShieldAlert, UserCog, LogOut, Bell, ImagePlus, Database, Radio, Zap, Save, UserPlus, Contact, UserMinus, Send, Sun, Moon, Monitor, Languages, Info, LocateFixed, Link2, KeyRound, Bug, Heart, Briefcase, BarChart3, Tag, Truck } from 'lucide-react';
|
|
35
|
-
import { createPortal } from 'react-dom';
|
|
34
|
+
import { Trash2, Upload, Search, ArrowDown, ArrowUp, ArrowUpDown, Check, Download, ChevronLeft, ChevronRight, AlertTriangle, Pencil, Inbox, Package, Sparkles, Plug, DollarSign, Clock, X, WandSparkles, Loader2, ArrowDownToLine, ArrowUpFromLine, CheckCircle2, Crown, ArrowRight, History, SquarePen, Settings2, Mic, User, Plus, Minus, ListChecks, ChevronDown, ArrowLeft, Calendar, ClipboardList, CheckSquare, BookOpen, Lock, PinOff, Pin, Eye, Users, StickyNote, CheckSquare2, Square, Building2, RotateCcw, Copy, Globe, LayoutTemplate, Store, ChevronsUpDown, ExternalLink, PenSquare, RefreshCw, XCircle, Camera, Edit, Star, Link2Off, Layers, ShoppingBag, MoreHorizontal, ChevronUp, List, LayoutGrid, CircleDollarSign, Receipt, Settings, Mail, MessageCircle, Cake, HelpCircle, Wrench, TableProperties, ShieldCheck, MessageSquare, Paperclip, Infinity, CheckCheck, PartyPopper, Compass, Play, ArrowUpCircle, MapPin, ArrowUpRight, Pause, CalendarDays, CircleCheckBig, UserX, Ban, CircleAlert, CircleEllipsis, FileText, CircleDashed, Power, ArrowRightLeft, File as File$1, FileImage, FileSpreadsheet, AlertCircle, CreditCard, SlidersHorizontal, Puzzle, Shield, Palette, Blocks, ShieldAlert, UserCog, LogOut, Bell, ImagePlus, Database, Radio, Zap, Save, UserPlus, Contact, UserMinus, Send, Sun, Moon, Monitor, Languages, Info, LocateFixed, Link2, KeyRound, Bug, Heart, Briefcase, BarChart3, Tag, Truck, Globe2 } from 'lucide-react';
|
|
36
35
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
36
|
+
import { createPortal } from 'react-dom';
|
|
37
37
|
import { profileHasSystemPermission, mergeLimitDeclarations } from '@fayz-ai/core/access';
|
|
38
38
|
import { createFayzAgentClient } from '@fayz-ai/sdk/agent';
|
|
39
39
|
import { getConnectorCredentialSink, fayzPlatformOrigin, ConnectorOAuthStarterMissingError } from '@fayz-ai/sdk';
|
|
@@ -76,7 +76,7 @@ function useWorkspaceSetupGate(enabled) {
|
|
|
76
76
|
const close = useWorkspaceSetupStore((s) => s.close);
|
|
77
77
|
const path = useAdminPath();
|
|
78
78
|
const onRoute = path === WORKSPACE_SETUP_ROUTE;
|
|
79
|
-
const exitDeliberate =
|
|
79
|
+
const exitDeliberate = React122.useCallback(() => {
|
|
80
80
|
close();
|
|
81
81
|
if (onRoute) navigateTo("/");
|
|
82
82
|
}, [close, onRoute]);
|
|
@@ -182,6 +182,56 @@ function brandInstructions(brand) {
|
|
|
182
182
|
}
|
|
183
183
|
return lines.length > 0 ? lines.join(" ") : void 0;
|
|
184
184
|
}
|
|
185
|
+
var UPDATE_EVENT = "fayz:update-ready";
|
|
186
|
+
function UpdateReady() {
|
|
187
|
+
const { t } = useTranslation$1();
|
|
188
|
+
const [pronta, setPronta] = React122__default.useState(false);
|
|
189
|
+
const [dispensada, setDispensada] = React122__default.useState(false);
|
|
190
|
+
const [aplicando, setAplicando] = React122__default.useState(false);
|
|
191
|
+
React122__default.useEffect(() => {
|
|
192
|
+
const aviso = () => setPronta(true);
|
|
193
|
+
window.addEventListener(UPDATE_EVENT, aviso);
|
|
194
|
+
return () => window.removeEventListener(UPDATE_EVENT, aviso);
|
|
195
|
+
}, []);
|
|
196
|
+
if (!pronta || dispensada) return null;
|
|
197
|
+
return /* @__PURE__ */ jsx(
|
|
198
|
+
"div",
|
|
199
|
+
{
|
|
200
|
+
role: "status",
|
|
201
|
+
"aria-live": "polite",
|
|
202
|
+
className: "fixed bottom-4 left-1/2 z-50 -translate-x-1/2 px-4 sm:left-auto sm:right-4 sm:translate-x-0",
|
|
203
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 rounded-card border bg-card px-4 py-3 shadow-lg", children: [
|
|
204
|
+
/* @__PURE__ */ jsx(ArrowUpCircle, { className: "h-4 w-4 shrink-0 text-primary", "aria-hidden": true }),
|
|
205
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
206
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: t("app.update.title") }),
|
|
207
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("app.update.body") })
|
|
208
|
+
] }),
|
|
209
|
+
/* @__PURE__ */ jsx(
|
|
210
|
+
"button",
|
|
211
|
+
{
|
|
212
|
+
type: "button",
|
|
213
|
+
disabled: aplicando,
|
|
214
|
+
onClick: () => {
|
|
215
|
+
setAplicando(true);
|
|
216
|
+
window.fayzApplyUpdate?.();
|
|
217
|
+
},
|
|
218
|
+
className: "shrink-0 rounded-button bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:opacity-60",
|
|
219
|
+
children: aplicando ? t("app.update.applying") : t("app.update.action")
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
/* @__PURE__ */ jsx(
|
|
223
|
+
"button",
|
|
224
|
+
{
|
|
225
|
+
type: "button",
|
|
226
|
+
onClick: () => setDispensada(true),
|
|
227
|
+
className: "shrink-0 rounded-button px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground",
|
|
228
|
+
children: t("app.update.later")
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
] })
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}
|
|
185
235
|
var STORAGE_PREFIX = "fayz.agent.auto-approve.v1";
|
|
186
236
|
var DESTRUCTIVE = /(delete|destroy|remove|cancel|archive|refund|void)/i;
|
|
187
237
|
function isDestructiveTool(toolName) {
|
|
@@ -1889,7 +1939,7 @@ function getServerVersion() {
|
|
|
1889
1939
|
return 0;
|
|
1890
1940
|
}
|
|
1891
1941
|
function useAssistantActivity() {
|
|
1892
|
-
|
|
1942
|
+
React122.useSyncExternalStore(subscribe, getVersion, getServerVersion);
|
|
1893
1943
|
return pickActivity(activities);
|
|
1894
1944
|
}
|
|
1895
1945
|
var STATE_RANK = {
|
|
@@ -1905,22 +1955,22 @@ function pickActivity(list) {
|
|
|
1905
1955
|
return pool.find((a) => a.kind === "recording") ?? pool[0];
|
|
1906
1956
|
}
|
|
1907
1957
|
function useAssistantLaunchers() {
|
|
1908
|
-
|
|
1958
|
+
React122.useSyncExternalStore(subscribe, getVersion, getServerVersion);
|
|
1909
1959
|
return launchers;
|
|
1910
1960
|
}
|
|
1911
1961
|
function useLaunchersForRole(role) {
|
|
1912
1962
|
const all = useAssistantLaunchers();
|
|
1913
|
-
return
|
|
1963
|
+
return React122.useMemo(() => all.filter((l) => !l.role || l.role === role), [all, role]);
|
|
1914
1964
|
}
|
|
1915
1965
|
function usePublishAssistantActivity(activity) {
|
|
1916
1966
|
const id = activity?.id;
|
|
1917
1967
|
const key = activity ? `${activity.id}|${activity.kind}|${activity.label}|${activity.state}|${activity.elapsedMs ?? ""}|${(activity.actions ?? []).map((a) => a.intent).join(",")}|${activity.confirm?.acknowledge ?? ""}` : null;
|
|
1918
|
-
const ref =
|
|
1968
|
+
const ref = React122.useRef(activity);
|
|
1919
1969
|
ref.current = activity;
|
|
1920
|
-
|
|
1970
|
+
React122.useEffect(() => {
|
|
1921
1971
|
if (ref.current) publishAssistantActivity(ref.current);
|
|
1922
1972
|
}, [key]);
|
|
1923
|
-
|
|
1973
|
+
React122.useEffect(() => {
|
|
1924
1974
|
if (!id) return;
|
|
1925
1975
|
return () => withdrawAssistantActivity(id);
|
|
1926
1976
|
}, [id]);
|
|
@@ -1928,12 +1978,12 @@ function usePublishAssistantActivity(activity) {
|
|
|
1928
1978
|
function useRegisterAssistantLauncher(launcher) {
|
|
1929
1979
|
const id = launcher?.id;
|
|
1930
1980
|
const key = launcher ? `${launcher.id}|${launcher.label}|${launcher.disabled ? "1" : "0"}|${launcher.role ?? ""}` : null;
|
|
1931
|
-
const ref =
|
|
1981
|
+
const ref = React122.useRef(launcher);
|
|
1932
1982
|
ref.current = launcher;
|
|
1933
|
-
|
|
1983
|
+
React122.useEffect(() => {
|
|
1934
1984
|
if (ref.current) registerAssistantLauncher(ref.current);
|
|
1935
1985
|
}, [key]);
|
|
1936
|
-
|
|
1986
|
+
React122.useEffect(() => {
|
|
1937
1987
|
if (!id) return;
|
|
1938
1988
|
return () => unregisterAssistantLauncher(id);
|
|
1939
1989
|
}, [id]);
|
|
@@ -2031,42 +2081,42 @@ function useRightRailPanel(panel) {
|
|
|
2031
2081
|
const sublabel = panel?.sublabel;
|
|
2032
2082
|
const badgeCount = panel?.badge?.count;
|
|
2033
2083
|
const badgeTone = panel?.badge?.tone;
|
|
2034
|
-
const initial =
|
|
2035
|
-
|
|
2084
|
+
const initial = React122.useRef({ label: label2, icon });
|
|
2085
|
+
React122.useEffect(() => {
|
|
2036
2086
|
if (!id || !Component2) return;
|
|
2037
2087
|
register({ id, label: initial.current.label ?? id, order, Component: Component2, icon: initial.current.icon });
|
|
2038
2088
|
return () => unregister(id);
|
|
2039
2089
|
}, [id, order, Component2, register, unregister]);
|
|
2040
|
-
|
|
2090
|
+
React122.useEffect(() => {
|
|
2041
2091
|
if (!id) return;
|
|
2042
2092
|
updateMeta(id, { label: label2, icon, iconBare, trailing, sublabel });
|
|
2043
2093
|
}, [id, label2, icon, iconBare, trailing, sublabel, updateMeta]);
|
|
2044
|
-
|
|
2094
|
+
React122.useEffect(() => {
|
|
2045
2095
|
if (!id) return;
|
|
2046
2096
|
updateBadge(id, badgeCount !== void 0 ? { count: badgeCount, tone: badgeTone } : void 0);
|
|
2047
2097
|
}, [id, badgeCount, badgeTone, updateBadge]);
|
|
2048
2098
|
}
|
|
2049
|
-
var RightRailActionsSlotContext =
|
|
2099
|
+
var RightRailActionsSlotContext = React122.createContext(null);
|
|
2050
2100
|
var RightRailActionsSlotProvider = RightRailActionsSlotContext.Provider;
|
|
2051
2101
|
function RightRailActions({ children }) {
|
|
2052
|
-
const slot =
|
|
2102
|
+
const slot = React122.useContext(RightRailActionsSlotContext);
|
|
2053
2103
|
if (slot) return createPortal(children, slot);
|
|
2054
2104
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end gap-0.5 px-2 pt-1.5", children });
|
|
2055
2105
|
}
|
|
2056
|
-
var RightRailLeadingSlotContext =
|
|
2106
|
+
var RightRailLeadingSlotContext = React122.createContext(null);
|
|
2057
2107
|
var RightRailLeadingSlotProvider = RightRailLeadingSlotContext.Provider;
|
|
2058
2108
|
function RightRailLeading({ children }) {
|
|
2059
|
-
const slot =
|
|
2109
|
+
const slot = React122.useContext(RightRailLeadingSlotContext);
|
|
2060
2110
|
if (slot) return createPortal(children, slot);
|
|
2061
2111
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5 px-2 pt-1.5", children });
|
|
2062
2112
|
}
|
|
2063
2113
|
function useRightRailReselect(id, handler) {
|
|
2064
2114
|
const reselects = useRightRailStore((s) => s.reselects);
|
|
2065
2115
|
const reselectId = useRightRailStore((s) => s.reselectId);
|
|
2066
|
-
const ref =
|
|
2116
|
+
const ref = React122.useRef(handler);
|
|
2067
2117
|
ref.current = handler;
|
|
2068
|
-
const seen =
|
|
2069
|
-
|
|
2118
|
+
const seen = React122.useRef(reselects);
|
|
2119
|
+
React122.useEffect(() => {
|
|
2070
2120
|
if (reselects === seen.current) return;
|
|
2071
2121
|
seen.current = reselects;
|
|
2072
2122
|
if (reselectId === id) ref.current();
|
|
@@ -2083,9 +2133,9 @@ function useRightRailDrill(drill) {
|
|
|
2083
2133
|
const avatarName = drill?.avatar?.name;
|
|
2084
2134
|
const avatarSrc = drill?.avatar?.src;
|
|
2085
2135
|
const avatarFace = drill?.avatar?.Face;
|
|
2086
|
-
const backRef =
|
|
2136
|
+
const backRef = React122.useRef(drill?.back);
|
|
2087
2137
|
backRef.current = drill?.back;
|
|
2088
|
-
|
|
2138
|
+
React122.useEffect(() => {
|
|
2089
2139
|
if (!title) return;
|
|
2090
2140
|
setDrill({
|
|
2091
2141
|
title,
|
|
@@ -2200,7 +2250,7 @@ function buildPersonaGuidance() {
|
|
|
2200
2250
|
}
|
|
2201
2251
|
function useRegisterStaff(staff) {
|
|
2202
2252
|
const setAgent = useAgentStore((s) => s.setAgent);
|
|
2203
|
-
|
|
2253
|
+
React122__default.useEffect(() => {
|
|
2204
2254
|
if (staff && staff.length > 1) {
|
|
2205
2255
|
console.warn(
|
|
2206
2256
|
`[fayz] chat.staff lists ${staff.length} agents; an app has one. Using "${soleAgent(staff)?.name}" and ignoring the rest \u2014 see chat.agent.`
|
|
@@ -2233,7 +2283,7 @@ function AssistantInvite({ className, ...def }) {
|
|
|
2233
2283
|
const { id, persona, headline, pitch, description, placeholder, auto } = def;
|
|
2234
2284
|
const suggestions = def.suggestions;
|
|
2235
2285
|
const suggestionKey = JSON.stringify(suggestions ?? []);
|
|
2236
|
-
|
|
2286
|
+
React122.useEffect(() => {
|
|
2237
2287
|
if (!hasAssistant) return;
|
|
2238
2288
|
setInvite({
|
|
2239
2289
|
id,
|
|
@@ -2247,11 +2297,11 @@ function AssistantInvite({ className, ...def }) {
|
|
|
2247
2297
|
});
|
|
2248
2298
|
return () => setInvite(null, id);
|
|
2249
2299
|
}, [hasAssistant, id, persona, headline, pitch, description, placeholder, auto, suggestionKey, setInvite]);
|
|
2250
|
-
const anchorRef =
|
|
2251
|
-
const [box, setBox] =
|
|
2300
|
+
const anchorRef = React122.useRef(null);
|
|
2301
|
+
const [box, setBox] = React122.useState(null);
|
|
2252
2302
|
const docked = stage === "dock" && !railOpen && hasAssistant;
|
|
2253
2303
|
const showing = hasAssistant && (stage === "hero" || docked);
|
|
2254
|
-
|
|
2304
|
+
React122.useEffect(() => {
|
|
2255
2305
|
if (!showing) return;
|
|
2256
2306
|
const el = anchorRef.current;
|
|
2257
2307
|
if (!el) return;
|
|
@@ -2272,7 +2322,7 @@ function AssistantInvite({ className, ...def }) {
|
|
|
2272
2322
|
}, [showing]);
|
|
2273
2323
|
const setDockBox = useAssistantInviteStore((s) => s.setDockBox);
|
|
2274
2324
|
const wide = useWideViewport();
|
|
2275
|
-
|
|
2325
|
+
React122.useEffect(() => {
|
|
2276
2326
|
if (!docked || !wide || !box) {
|
|
2277
2327
|
setDockBox(null);
|
|
2278
2328
|
return;
|
|
@@ -2286,7 +2336,7 @@ function AssistantInvite({ className, ...def }) {
|
|
|
2286
2336
|
function useAsk() {
|
|
2287
2337
|
const queuePrompt = useChatStore((s) => s.queuePrompt);
|
|
2288
2338
|
const dismiss = useAssistantInviteStore((s) => s.dismiss);
|
|
2289
|
-
return
|
|
2339
|
+
return React122.useCallback(
|
|
2290
2340
|
(text2) => {
|
|
2291
2341
|
const trimmed = text2.trim();
|
|
2292
2342
|
if (!trimmed) return;
|
|
@@ -2304,9 +2354,9 @@ function InviteHero({
|
|
|
2304
2354
|
const { t } = useTranslation$1();
|
|
2305
2355
|
const user = useAuthStore((s) => s.user);
|
|
2306
2356
|
const ask = useAsk();
|
|
2307
|
-
const [draft, setDraft] =
|
|
2357
|
+
const [draft, setDraft] = React122.useState("");
|
|
2308
2358
|
const name = (user?.fullName || user?.email || "").split(/[\s@]/)[0];
|
|
2309
|
-
|
|
2359
|
+
React122.useEffect(() => {
|
|
2310
2360
|
const onKey = (event) => {
|
|
2311
2361
|
if (event.key === "Escape") onDismiss();
|
|
2312
2362
|
};
|
|
@@ -2368,8 +2418,8 @@ function InviteHero({
|
|
|
2368
2418
|
);
|
|
2369
2419
|
}
|
|
2370
2420
|
function useMorphIn(skip = false) {
|
|
2371
|
-
const [entered, setEntered] =
|
|
2372
|
-
|
|
2421
|
+
const [entered, setEntered] = React122.useState(() => skip || prefersReducedMotion());
|
|
2422
|
+
React122.useEffect(() => {
|
|
2373
2423
|
if (entered) return;
|
|
2374
2424
|
let second = 0;
|
|
2375
2425
|
const first = requestAnimationFrame(() => {
|
|
@@ -2388,10 +2438,10 @@ function prefersReducedMotion() {
|
|
|
2388
2438
|
var lastDockExit = null;
|
|
2389
2439
|
var RESUME_WINDOW_MS = 700;
|
|
2390
2440
|
function useWideViewport() {
|
|
2391
|
-
const [wide, setWide] =
|
|
2441
|
+
const [wide, setWide] = React122.useState(
|
|
2392
2442
|
() => typeof window !== "undefined" && !!window.matchMedia?.("(min-width: 768px)").matches
|
|
2393
2443
|
);
|
|
2394
|
-
|
|
2444
|
+
React122.useEffect(() => {
|
|
2395
2445
|
const query = window.matchMedia?.("(min-width: 768px)");
|
|
2396
2446
|
if (!query) return;
|
|
2397
2447
|
const sync = () => setWide(query.matches);
|
|
@@ -2422,21 +2472,21 @@ function InviteDock({ def, left, maxWidth }) {
|
|
|
2422
2472
|
const setOpen = useChatStore((s) => s.setOpen);
|
|
2423
2473
|
const railOpen = useRightRailStore((s) => s.open);
|
|
2424
2474
|
const railWidth = useRightRailStore((s) => s.width);
|
|
2425
|
-
const [draft, setDraft] =
|
|
2426
|
-
const resumed =
|
|
2475
|
+
const [draft, setDraft] = React122.useState("");
|
|
2476
|
+
const resumed = React122.useRef(
|
|
2427
2477
|
!!lastDockExit && lastDockExit.id === def.id && Date.now() - lastDockExit.at < RESUME_WINDOW_MS
|
|
2428
2478
|
).current;
|
|
2429
|
-
|
|
2479
|
+
React122.useEffect(() => () => {
|
|
2430
2480
|
lastDockExit = { id: def.id, at: Date.now() };
|
|
2431
2481
|
}, [def.id]);
|
|
2432
2482
|
const entered = useMorphIn(resumed);
|
|
2433
2483
|
const width = Math.min(maxWidth, DOCK_MAX_WIDTH);
|
|
2434
|
-
const mountGeo =
|
|
2484
|
+
const mountGeo = React122.useRef({ left, width }).current;
|
|
2435
2485
|
const morph = morphStyles({ left: mountGeo.left, width: mountGeo.width }, railOpen, railWidth);
|
|
2436
|
-
const [settled, setSettled] =
|
|
2486
|
+
const [settled, setSettled] = React122.useState(resumed);
|
|
2437
2487
|
const geoLeft = settled ? left : mountGeo.left;
|
|
2438
2488
|
const geoWidth = settled ? width : mountGeo.width;
|
|
2439
|
-
|
|
2489
|
+
React122.useEffect(() => {
|
|
2440
2490
|
if (!entered || settled) return;
|
|
2441
2491
|
const id = setTimeout(() => setSettled(true), MORPH_MS + 60);
|
|
2442
2492
|
return () => clearTimeout(id);
|
|
@@ -2582,7 +2632,7 @@ function MorphBackPill() {
|
|
|
2582
2632
|
const railWidth = useRightRailStore((s) => s.width);
|
|
2583
2633
|
const { t } = useTranslation$1();
|
|
2584
2634
|
const collapsed = useMorphIn();
|
|
2585
|
-
|
|
2635
|
+
React122.useEffect(() => {
|
|
2586
2636
|
if (prefersReducedMotion()) {
|
|
2587
2637
|
endLeave();
|
|
2588
2638
|
return;
|
|
@@ -4496,12 +4546,12 @@ function detectActivePluginId(runtime) {
|
|
|
4496
4546
|
function useAITools() {
|
|
4497
4547
|
const runtime = usePluginRuntimeOptional();
|
|
4498
4548
|
const access = useAccessOptional();
|
|
4499
|
-
const surfaceVersion =
|
|
4549
|
+
const surfaceVersion = React122.useSyncExternalStore(subscribeSurfaces, getSurfaceVersion, getSurfaceVersion);
|
|
4500
4550
|
const features = usePermissionsStore((s) => s.features);
|
|
4501
4551
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
4502
4552
|
const hasSystem = useSystemPermission();
|
|
4503
4553
|
const canManagePermissions = hasSystem("manage_permissions");
|
|
4504
|
-
return
|
|
4554
|
+
return React122.useMemo(() => {
|
|
4505
4555
|
const hasPermission = runtime?.context.hasPermission;
|
|
4506
4556
|
const can = access.can;
|
|
4507
4557
|
const verticalId = runtime?.context.tenant?.verticalId;
|
|
@@ -5509,8 +5559,8 @@ function loadCatalog() {
|
|
|
5509
5559
|
return catalogPromise;
|
|
5510
5560
|
}
|
|
5511
5561
|
function useConnectorCatalog() {
|
|
5512
|
-
const [catalog, setCatalog] =
|
|
5513
|
-
|
|
5562
|
+
const [catalog, setCatalog] = React122__default.useState(null);
|
|
5563
|
+
React122__default.useEffect(() => {
|
|
5514
5564
|
let cancelled = false;
|
|
5515
5565
|
void loadCatalog().then((list) => {
|
|
5516
5566
|
if (!cancelled) setCatalog(list);
|
|
@@ -5534,7 +5584,7 @@ function refreshConnectors() {
|
|
|
5534
5584
|
_revisionListeners.forEach((listener) => listener());
|
|
5535
5585
|
}
|
|
5536
5586
|
function useConnectorsRevision() {
|
|
5537
|
-
return
|
|
5587
|
+
return React122__default.useSyncExternalStore(
|
|
5538
5588
|
(listener) => {
|
|
5539
5589
|
_revisionListeners.add(listener);
|
|
5540
5590
|
return () => _revisionListeners.delete(listener);
|
|
@@ -5553,11 +5603,11 @@ function loadGrants(key, fetcher) {
|
|
|
5553
5603
|
}
|
|
5554
5604
|
function useInstalledModuleIds() {
|
|
5555
5605
|
const runtime = usePluginRuntimeOptional();
|
|
5556
|
-
return
|
|
5606
|
+
return React122__default.useMemo(() => (runtime?.plugins ?? []).map((p) => p.id), [runtime]);
|
|
5557
5607
|
}
|
|
5558
5608
|
function useInstalledDefinitions(hostPluginId) {
|
|
5559
5609
|
const runtime = usePluginRuntimeOptional();
|
|
5560
|
-
return
|
|
5610
|
+
return React122__default.useMemo(() => {
|
|
5561
5611
|
const byHost = runtime?.connectorsByHost;
|
|
5562
5612
|
if (!byHost) return [];
|
|
5563
5613
|
if (hostPluginId) return byHost.get(hostPluginId) ?? [];
|
|
@@ -5570,12 +5620,12 @@ function useConnectors(options = {}) {
|
|
|
5570
5620
|
const catalog = useConnectorCatalog();
|
|
5571
5621
|
const tenant = useTenantOptional();
|
|
5572
5622
|
const tenantId2 = tenant?.org?.id;
|
|
5573
|
-
const connection =
|
|
5574
|
-
const [installed, setInstalled] =
|
|
5575
|
-
const [grants, setGrants] =
|
|
5576
|
-
const [error, setError] =
|
|
5623
|
+
const connection = React122__default.useMemo(() => resolveFayzAgentConnection(), []);
|
|
5624
|
+
const [installed, setInstalled] = React122__default.useState(null);
|
|
5625
|
+
const [grants, setGrants] = React122__default.useState(null);
|
|
5626
|
+
const [error, setError] = React122__default.useState(null);
|
|
5577
5627
|
const nonce = useConnectorsRevision();
|
|
5578
|
-
const call2 =
|
|
5628
|
+
const call2 = React122__default.useCallback(
|
|
5579
5629
|
async (path, init) => {
|
|
5580
5630
|
if (!connection) throw new Error("Este app n\xE3o est\xE1 ligado a um projeto Fayz.");
|
|
5581
5631
|
const supabase = getFayzSupabaseClientOptional();
|
|
@@ -5595,7 +5645,7 @@ function useConnectors(options = {}) {
|
|
|
5595
5645
|
},
|
|
5596
5646
|
[connection]
|
|
5597
5647
|
);
|
|
5598
|
-
|
|
5648
|
+
React122__default.useEffect(() => {
|
|
5599
5649
|
let cancelled = false;
|
|
5600
5650
|
void loadConnectorStatuses(definitions, tenantId2).then((list) => {
|
|
5601
5651
|
if (!cancelled) setInstalled(list);
|
|
@@ -5604,7 +5654,7 @@ function useConnectors(options = {}) {
|
|
|
5604
5654
|
cancelled = true;
|
|
5605
5655
|
};
|
|
5606
5656
|
}, [definitions, tenantId2, nonce]);
|
|
5607
|
-
|
|
5657
|
+
React122__default.useEffect(() => {
|
|
5608
5658
|
if (!includeGrants || !connection || !tenantId2) {
|
|
5609
5659
|
setGrants(includeGrants ? null : []);
|
|
5610
5660
|
return;
|
|
@@ -5628,7 +5678,7 @@ function useConnectors(options = {}) {
|
|
|
5628
5678
|
cancelled = true;
|
|
5629
5679
|
};
|
|
5630
5680
|
}, [call2, tenantId2, includeGrants, connection, nonce]);
|
|
5631
|
-
const revokeGrant =
|
|
5681
|
+
const revokeGrant = React122__default.useCallback(
|
|
5632
5682
|
async (connector) => {
|
|
5633
5683
|
const response = await call2(`/${connector.id}`, { method: "DELETE" });
|
|
5634
5684
|
if (!response.ok) {
|
|
@@ -5641,7 +5691,7 @@ function useConnectors(options = {}) {
|
|
|
5641
5691
|
[call2]
|
|
5642
5692
|
);
|
|
5643
5693
|
const waitingGrants = includeGrants && !!connection && !!tenantId2 && grants === null;
|
|
5644
|
-
const connectors =
|
|
5694
|
+
const connectors = React122__default.useMemo(() => {
|
|
5645
5695
|
if (installed === null || waitingGrants) return null;
|
|
5646
5696
|
return buildConnectorList({
|
|
5647
5697
|
installed,
|
|
@@ -5882,9 +5932,9 @@ function ConnectorMark({
|
|
|
5882
5932
|
connector,
|
|
5883
5933
|
size = "md"
|
|
5884
5934
|
}) {
|
|
5885
|
-
const candidates =
|
|
5886
|
-
const [attempt, setAttempt] =
|
|
5887
|
-
|
|
5935
|
+
const candidates = React122__default.useMemo(() => markCandidates(connector), [connector.logoUrl, connector.name]);
|
|
5936
|
+
const [attempt, setAttempt] = React122__default.useState(0);
|
|
5937
|
+
React122__default.useEffect(() => setAttempt(0), [connector.id]);
|
|
5888
5938
|
const box = size === "sm" ? "h-9 w-9" : "h-10 w-10";
|
|
5889
5939
|
const glyph = size === "sm" ? "h-4 w-4" : "h-5 w-5";
|
|
5890
5940
|
if (connector.builtIn) {
|
|
@@ -7513,9 +7563,9 @@ function prefersReducedMotion2() {
|
|
|
7513
7563
|
return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
7514
7564
|
}
|
|
7515
7565
|
function TypewriterText({ text: text2, speed = 26, onDone }) {
|
|
7516
|
-
const [displayed, setDisplayed] =
|
|
7517
|
-
const indexRef =
|
|
7518
|
-
|
|
7566
|
+
const [displayed, setDisplayed] = React122.useState("");
|
|
7567
|
+
const indexRef = React122.useRef(0);
|
|
7568
|
+
React122.useEffect(() => {
|
|
7519
7569
|
if (prefersReducedMotion2()) {
|
|
7520
7570
|
setDisplayed(text2);
|
|
7521
7571
|
onDone?.();
|
|
@@ -7592,15 +7642,15 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7592
7642
|
const { contextualSuggestions } = useAITools();
|
|
7593
7643
|
const { sendMessage } = useChat({ apiEndpoint, systemPrompt, agent });
|
|
7594
7644
|
const { t } = useTranslation$1();
|
|
7595
|
-
const [phase, setPhase] =
|
|
7596
|
-
const [activeSuggestion, setActiveSuggestion] =
|
|
7597
|
-
const timersRef =
|
|
7598
|
-
const prevSuggestionRef =
|
|
7599
|
-
const [greeting, setGreeting] =
|
|
7600
|
-
const greetTimerRef =
|
|
7601
|
-
|
|
7645
|
+
const [phase, setPhase] = React122.useState("idle");
|
|
7646
|
+
const [activeSuggestion, setActiveSuggestion] = React122.useState(null);
|
|
7647
|
+
const timersRef = React122.useRef([]);
|
|
7648
|
+
const prevSuggestionRef = React122.useRef(null);
|
|
7649
|
+
const [greeting, setGreeting] = React122.useState(false);
|
|
7650
|
+
const greetTimerRef = React122.useRef(0);
|
|
7651
|
+
React122.useEffect(() => () => window.clearTimeout(greetTimerRef.current), []);
|
|
7602
7652
|
const hasFace = !!host?.AvatarComponent;
|
|
7603
|
-
|
|
7653
|
+
React122.useEffect(ensureStyles, []);
|
|
7604
7654
|
const clearTimers = () => {
|
|
7605
7655
|
timersRef.current.forEach(clearTimeout);
|
|
7606
7656
|
timersRef.current = [];
|
|
@@ -7613,10 +7663,10 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7613
7663
|
const invited = useAssistantInviteStore((s) => !!s.invite && s.stage === "dock");
|
|
7614
7664
|
const dockOnScreen = useAssistantInviteStore((s) => !!s.dockBox);
|
|
7615
7665
|
const morphingBack = useAssistantInviteStore((s) => !!s.leaving);
|
|
7616
|
-
const [wide, setWide] =
|
|
7666
|
+
const [wide, setWide] = React122.useState(
|
|
7617
7667
|
() => typeof window !== "undefined" && !!window.matchMedia?.("(min-width: 768px)").matches
|
|
7618
7668
|
);
|
|
7619
|
-
|
|
7669
|
+
React122.useEffect(() => {
|
|
7620
7670
|
const query = window.matchMedia?.("(min-width: 768px)");
|
|
7621
7671
|
if (!query) return;
|
|
7622
7672
|
const sync = () => setWide(query.matches);
|
|
@@ -7625,7 +7675,7 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7625
7675
|
return () => query.removeEventListener("change", sync);
|
|
7626
7676
|
}, []);
|
|
7627
7677
|
const teaserAllowed = !hasMessages && !activity && !invited && !teaserDismissed() && teaserShownCount() < TEASER_MAX_PER_SESSION;
|
|
7628
|
-
|
|
7678
|
+
React122.useEffect(() => {
|
|
7629
7679
|
if (expanded || !topSuggestion || !topLabel || !teaserAllowed || teaserSeen().includes(topLabel)) {
|
|
7630
7680
|
if (phase !== "idle") {
|
|
7631
7681
|
clearTimers();
|
|
@@ -7656,14 +7706,14 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7656
7706
|
}, 9e3);
|
|
7657
7707
|
return clearTimers;
|
|
7658
7708
|
}, [topLabel, expanded, teaserAllowed]);
|
|
7659
|
-
|
|
7709
|
+
React122.useEffect(() => {
|
|
7660
7710
|
if (expanded && phase !== "idle") {
|
|
7661
7711
|
clearTimers();
|
|
7662
7712
|
setPhase("idle");
|
|
7663
7713
|
}
|
|
7664
7714
|
}, [expanded]);
|
|
7665
|
-
const [entrance, setEntrance] =
|
|
7666
|
-
|
|
7715
|
+
const [entrance, setEntrance] = React122.useState("pending");
|
|
7716
|
+
React122.useEffect(() => {
|
|
7667
7717
|
if (!currentOrg || entrance !== "pending") return;
|
|
7668
7718
|
if (prefersReducedMotion2()) {
|
|
7669
7719
|
setEntrance("done");
|
|
@@ -7673,9 +7723,9 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7673
7723
|
const timer = setTimeout(() => setEntrance("done"), 1600);
|
|
7674
7724
|
return () => clearTimeout(timer);
|
|
7675
7725
|
}, [currentOrg, entrance]);
|
|
7676
|
-
const [poppingBack, setPoppingBack] =
|
|
7677
|
-
const wasMorphing =
|
|
7678
|
-
|
|
7726
|
+
const [poppingBack, setPoppingBack] = React122.useState(false);
|
|
7727
|
+
const wasMorphing = React122.useRef(false);
|
|
7728
|
+
React122.useEffect(() => {
|
|
7679
7729
|
const was = wasMorphing.current;
|
|
7680
7730
|
wasMorphing.current = morphingBack;
|
|
7681
7731
|
if (!was || morphingBack || prefersReducedMotion2()) return;
|
|
@@ -7973,7 +8023,7 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7973
8023
|
var MAX_SUGGESTIONS = 5;
|
|
7974
8024
|
function ChatSuggestions({ suggestions, onSelect, onDismiss, compact }) {
|
|
7975
8025
|
const { t } = useTranslation$1();
|
|
7976
|
-
const [open, setOpen] =
|
|
8026
|
+
const [open, setOpen] = React122.useState(true);
|
|
7977
8027
|
const visible = suggestions.slice(0, compact ? 3 : MAX_SUGGESTIONS);
|
|
7978
8028
|
if (!visible.length) return null;
|
|
7979
8029
|
return /* @__PURE__ */ jsxs(
|
|
@@ -8052,8 +8102,8 @@ function SuggestionRow({
|
|
|
8052
8102
|
detail,
|
|
8053
8103
|
onSelect
|
|
8054
8104
|
}) {
|
|
8055
|
-
const labelRef =
|
|
8056
|
-
const [showDetail, setShowDetail] =
|
|
8105
|
+
const labelRef = React122.useRef(null);
|
|
8106
|
+
const [showDetail, setShowDetail] = React122.useState(false);
|
|
8057
8107
|
const evaluate = () => {
|
|
8058
8108
|
const el = labelRef.current;
|
|
8059
8109
|
const clipped = !!el && el.scrollWidth > el.clientWidth + 1;
|
|
@@ -8147,8 +8197,8 @@ function ChatToolsPanel({ toolGroups, onClose }) {
|
|
|
8147
8197
|
}
|
|
8148
8198
|
function AutoApprovalsSection() {
|
|
8149
8199
|
const { t } = useTranslation$1();
|
|
8150
|
-
const [rules, setRules] =
|
|
8151
|
-
|
|
8200
|
+
const [rules, setRules] = React122.useState(() => listAutoApprovals());
|
|
8201
|
+
React122.useEffect(() => subscribeAutoApprovals(() => setRules(listAutoApprovals())), []);
|
|
8152
8202
|
if (!rules.length) return null;
|
|
8153
8203
|
return /* @__PURE__ */ jsxs("div", { className: "border-b border-border/40 px-3 py-2.5", children: [
|
|
8154
8204
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 px-1 pb-1.5", children: [
|
|
@@ -8201,14 +8251,14 @@ function bucketOf(iso) {
|
|
|
8201
8251
|
var ORDER = ["today", "yesterday", "week", "older"];
|
|
8202
8252
|
function ChatHistory({ conversations, activeId, onSelect }) {
|
|
8203
8253
|
const { t } = useTranslation$1();
|
|
8204
|
-
const [query, setQuery] =
|
|
8254
|
+
const [query, setQuery] = React122.useState("");
|
|
8205
8255
|
const mine = conversations;
|
|
8206
|
-
const filtered =
|
|
8256
|
+
const filtered = React122.useMemo(() => {
|
|
8207
8257
|
const needle = query.trim().toLowerCase();
|
|
8208
8258
|
if (!needle) return mine;
|
|
8209
8259
|
return mine.filter((c) => (c.title ?? "").toLowerCase().includes(needle));
|
|
8210
8260
|
}, [mine, query]);
|
|
8211
|
-
const groups =
|
|
8261
|
+
const groups = React122.useMemo(() => {
|
|
8212
8262
|
const map = /* @__PURE__ */ new Map();
|
|
8213
8263
|
for (const conversation of filtered) {
|
|
8214
8264
|
const bucket = bucketOf(conversation.updatedAt);
|
|
@@ -8335,7 +8385,7 @@ function TourCoachCard() {
|
|
|
8335
8385
|
const lastOutcome = useTourStore((s) => s.lastOutcome);
|
|
8336
8386
|
const stop = useTourStore((s) => s.stop);
|
|
8337
8387
|
const restart = useTourStore((s) => s.restart);
|
|
8338
|
-
const [dismissedId, setDismissedId] =
|
|
8388
|
+
const [dismissedId, setDismissedId] = React122.useState(null);
|
|
8339
8389
|
const pTitle = usePracticeStore((s) => s.title);
|
|
8340
8390
|
const pSteps = usePracticeStore((s) => s.steps);
|
|
8341
8391
|
const pDone = usePracticeStore((s) => s.done);
|
|
@@ -8406,8 +8456,8 @@ function AssistantRecordingView({ activity }) {
|
|
|
8406
8456
|
const live = activity.state === "running" || activity.state === "paused";
|
|
8407
8457
|
const running = activity.state === "running";
|
|
8408
8458
|
const actions = activity.actions ?? [];
|
|
8409
|
-
const [acknowledged, setAcknowledged] =
|
|
8410
|
-
|
|
8459
|
+
const [acknowledged, setAcknowledged] = React122.useState(false);
|
|
8460
|
+
React122.useEffect(() => setAcknowledged(false), [activity.id, activity.state]);
|
|
8411
8461
|
const withheld = pending2 && !!activity.confirm && !acknowledged;
|
|
8412
8462
|
const primary = actions.filter((a) => a.intent !== "discard");
|
|
8413
8463
|
const discard = actions.find((a) => a.intent === "discard");
|
|
@@ -8623,10 +8673,10 @@ function RightRailPage({
|
|
|
8623
8673
|
const closePage = useRightRailStore((s) => s.closePage);
|
|
8624
8674
|
const active2 = hosted && open;
|
|
8625
8675
|
const pageOpen = useRightRailStore((s) => s.pageOpen);
|
|
8626
|
-
const onCloseRef =
|
|
8676
|
+
const onCloseRef = React122.useRef(onClose);
|
|
8627
8677
|
onCloseRef.current = onClose;
|
|
8628
|
-
const claimed =
|
|
8629
|
-
|
|
8678
|
+
const claimed = React122.useRef(false);
|
|
8679
|
+
React122.useEffect(() => {
|
|
8630
8680
|
if (!active2) return;
|
|
8631
8681
|
showPage();
|
|
8632
8682
|
claimed.current = true;
|
|
@@ -8635,7 +8685,7 @@ function RightRailPage({
|
|
|
8635
8685
|
closePage();
|
|
8636
8686
|
};
|
|
8637
8687
|
}, [active2, showPage, closePage]);
|
|
8638
|
-
|
|
8688
|
+
React122.useEffect(() => {
|
|
8639
8689
|
if (!claimed.current) return;
|
|
8640
8690
|
if (!useRightRailStore.getState().pageOpen) onCloseRef.current();
|
|
8641
8691
|
}, [pageOpen]);
|
|
@@ -8838,15 +8888,15 @@ function ConnectorSyncActions({
|
|
|
8838
8888
|
actions,
|
|
8839
8889
|
onRan
|
|
8840
8890
|
}) {
|
|
8841
|
-
const [running, setRunning] =
|
|
8842
|
-
const [open, setOpen] =
|
|
8843
|
-
const [pending2, setPending] =
|
|
8844
|
-
const [hidden, setHidden] =
|
|
8845
|
-
const [queued, setQueued] =
|
|
8846
|
-
const [nonce, setNonce] =
|
|
8847
|
-
const [expanded, setExpanded] =
|
|
8848
|
-
const [resolved, setResolved] =
|
|
8849
|
-
|
|
8891
|
+
const [running, setRunning] = React122__default.useState(null);
|
|
8892
|
+
const [open, setOpen] = React122__default.useState(null);
|
|
8893
|
+
const [pending2, setPending] = React122__default.useState(null);
|
|
8894
|
+
const [hidden, setHidden] = React122__default.useState(() => /* @__PURE__ */ new Set());
|
|
8895
|
+
const [queued, setQueued] = React122__default.useState({});
|
|
8896
|
+
const [nonce, setNonce] = React122__default.useState(0);
|
|
8897
|
+
const [expanded, setExpanded] = React122__default.useState(false);
|
|
8898
|
+
const [resolved, setResolved] = React122__default.useState(false);
|
|
8899
|
+
React122__default.useEffect(() => {
|
|
8850
8900
|
let cancelled = false;
|
|
8851
8901
|
setResolved(false);
|
|
8852
8902
|
void Promise.all(
|
|
@@ -9031,10 +9081,10 @@ function formatRelative(iso, t) {
|
|
|
9031
9081
|
}
|
|
9032
9082
|
function useConnectorRuns(connector) {
|
|
9033
9083
|
const listRuns = connector.definition?.listRuns;
|
|
9034
|
-
const [runs, setRuns] =
|
|
9035
|
-
const [loading, setLoading] =
|
|
9036
|
-
const [nonce, setNonce] =
|
|
9037
|
-
|
|
9084
|
+
const [runs, setRuns] = React122__default.useState([]);
|
|
9085
|
+
const [loading, setLoading] = React122__default.useState(!!listRuns);
|
|
9086
|
+
const [nonce, setNonce] = React122__default.useState(0);
|
|
9087
|
+
React122__default.useEffect(() => {
|
|
9038
9088
|
if (!listRuns) {
|
|
9039
9089
|
setRuns([]);
|
|
9040
9090
|
setLoading(false);
|
|
@@ -9056,7 +9106,7 @@ function useConnectorRuns(connector) {
|
|
|
9056
9106
|
return {
|
|
9057
9107
|
runs,
|
|
9058
9108
|
loading,
|
|
9059
|
-
reload:
|
|
9109
|
+
reload: React122__default.useCallback(() => setNonce((n) => n + 1), []),
|
|
9060
9110
|
failing: isFailing(runs)
|
|
9061
9111
|
};
|
|
9062
9112
|
}
|
|
@@ -9156,7 +9206,7 @@ function RunFailure({ run }) {
|
|
|
9156
9206
|
),
|
|
9157
9207
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: t("connectors.runs.seeDetails") })
|
|
9158
9208
|
] }),
|
|
9159
|
-
facts.length > 0 && /* @__PURE__ */ jsx("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 border-t border-border px-2 py-2 text-[11px] leading-relaxed", children: facts.map(([label2, value]) => /* @__PURE__ */ jsxs(
|
|
9209
|
+
facts.length > 0 && /* @__PURE__ */ jsx("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 border-t border-border px-2 py-2 text-[11px] leading-relaxed", children: facts.map(([label2, value]) => /* @__PURE__ */ jsxs(React122__default.Fragment, { children: [
|
|
9160
9210
|
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: label2 }),
|
|
9161
9211
|
/* @__PURE__ */ jsx("dd", { className: "min-w-0 break-words font-mono text-foreground/80", children: value })
|
|
9162
9212
|
] }, label2)) }),
|
|
@@ -9325,13 +9375,13 @@ function ConnectorSettingsPanel({
|
|
|
9325
9375
|
const { t } = useTranslation$1();
|
|
9326
9376
|
const def = connector.definition;
|
|
9327
9377
|
const settings = def ? connectorSettings(def) : [];
|
|
9328
|
-
const [values, setValues] =
|
|
9378
|
+
const [values, setValues] = React122__default.useState(
|
|
9329
9379
|
() => initialValues(settings, {})
|
|
9330
9380
|
);
|
|
9331
|
-
const [loaded2, setLoaded] =
|
|
9332
|
-
const [saving, setSaving] =
|
|
9333
|
-
const [dirty, setDirty] =
|
|
9334
|
-
|
|
9381
|
+
const [loaded2, setLoaded] = React122__default.useState(false);
|
|
9382
|
+
const [saving, setSaving] = React122__default.useState(false);
|
|
9383
|
+
const [dirty, setDirty] = React122__default.useState(false);
|
|
9384
|
+
React122__default.useEffect(() => {
|
|
9335
9385
|
if (settings.length === 0 || !def?.getSettings) return;
|
|
9336
9386
|
let cancelled = false;
|
|
9337
9387
|
setLoaded(false);
|
|
@@ -9582,13 +9632,13 @@ function ConnectorInstall({
|
|
|
9582
9632
|
}) {
|
|
9583
9633
|
const { t } = useTranslation$1();
|
|
9584
9634
|
const def = connector.definition;
|
|
9585
|
-
const [plane, setPlane] =
|
|
9635
|
+
const [plane, setPlane] = React122__default.useState(
|
|
9586
9636
|
connector.planes.includes("agentic") ? "agentic" : connector.planes[0]
|
|
9587
9637
|
);
|
|
9588
|
-
const [values, setValues] =
|
|
9589
|
-
const secrets =
|
|
9590
|
-
const [busy, setBusy] =
|
|
9591
|
-
|
|
9638
|
+
const [values, setValues] = React122__default.useState({});
|
|
9639
|
+
const secrets = React122__default.useRef({});
|
|
9640
|
+
const [busy, setBusy] = React122__default.useState(null);
|
|
9641
|
+
React122__default.useEffect(() => {
|
|
9592
9642
|
setValues({});
|
|
9593
9643
|
secrets.current = {};
|
|
9594
9644
|
setBusy(null);
|
|
@@ -9629,15 +9679,15 @@ function ConnectorHome({
|
|
|
9629
9679
|
const needsSetup = connector.state === "needs_setup";
|
|
9630
9680
|
const settingsAvailable = hasOperatingSettings(connector);
|
|
9631
9681
|
const runsAvailable = hasRunHistory(connector);
|
|
9632
|
-
const [tab, setTab] =
|
|
9682
|
+
const [tab, setTab] = React122__default.useState(
|
|
9633
9683
|
needsSetup && settingsAvailable ? "settings" : "overview"
|
|
9634
9684
|
);
|
|
9635
|
-
const [busy, setBusy] =
|
|
9685
|
+
const [busy, setBusy] = React122__default.useState(null);
|
|
9636
9686
|
const run = useRunner(setBusy, onChanged);
|
|
9637
|
-
const [values, setValues] =
|
|
9638
|
-
const secrets =
|
|
9687
|
+
const [values, setValues] = React122__default.useState({});
|
|
9688
|
+
const secrets = React122__default.useRef({});
|
|
9639
9689
|
const runs = useConnectorRuns(connector);
|
|
9640
|
-
|
|
9690
|
+
React122__default.useEffect(() => {
|
|
9641
9691
|
setTab(needsSetup && settingsAvailable ? "settings" : "overview");
|
|
9642
9692
|
setBusy(null);
|
|
9643
9693
|
setValues({});
|
|
@@ -9727,7 +9777,7 @@ function ConnectorHome({
|
|
|
9727
9777
|
}
|
|
9728
9778
|
function useRunner(setBusy, onChanged) {
|
|
9729
9779
|
const { t } = useTranslation$1();
|
|
9730
|
-
return
|
|
9780
|
+
return React122__default.useCallback(
|
|
9731
9781
|
async (kind, fn, okMessage) => {
|
|
9732
9782
|
setBusy(kind);
|
|
9733
9783
|
try {
|
|
@@ -9843,7 +9893,7 @@ function ConnectPanel({
|
|
|
9843
9893
|
const sinkMissing = needsSink && !getConnectorCredentialSink();
|
|
9844
9894
|
const secretFieldCount = (def.fields ?? []).filter(isSecretField).length;
|
|
9845
9895
|
const hasStoredCredential = connector.state === "connected" || connector.state === "needs_setup";
|
|
9846
|
-
const [formKey, setFormKey] =
|
|
9896
|
+
const [formKey, setFormKey] = React122__default.useState(0);
|
|
9847
9897
|
if (def.authKind === "oauth") {
|
|
9848
9898
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
9849
9899
|
/* @__PURE__ */ jsx(Note, { children: t("connectors.authorize.oauthOnly") }),
|
|
@@ -9976,7 +10026,7 @@ function GrantRevoke({
|
|
|
9976
10026
|
onRevoke
|
|
9977
10027
|
}) {
|
|
9978
10028
|
const { t } = useTranslation$1();
|
|
9979
|
-
const [revoking, setRevoking] =
|
|
10029
|
+
const [revoking, setRevoking] = React122__default.useState(false);
|
|
9980
10030
|
if (connector.revocable === false) {
|
|
9981
10031
|
return /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("connectors.partOfApp") });
|
|
9982
10032
|
}
|
|
@@ -10015,14 +10065,14 @@ function ConnectorsPanel({ onClose }) {
|
|
|
10015
10065
|
const { connectors, reload, revokeGrant, agentAvailable, tenantReady } = useConnectors();
|
|
10016
10066
|
const selectedId = useConnectorsSurface((s) => s.selected);
|
|
10017
10067
|
const select = useConnectorsSurface((s) => s.select);
|
|
10018
|
-
const [query, setQuery] =
|
|
10019
|
-
const [failure, setFailure] =
|
|
10020
|
-
const [revoking, setRevoking] =
|
|
10021
|
-
const selected =
|
|
10068
|
+
const [query, setQuery] = React122__default.useState("");
|
|
10069
|
+
const [failure, setFailure] = React122__default.useState(null);
|
|
10070
|
+
const [revoking, setRevoking] = React122__default.useState(null);
|
|
10071
|
+
const selected = React122__default.useMemo(
|
|
10022
10072
|
() => (connectors ?? []).find((c) => c.id === selectedId) ?? null,
|
|
10023
10073
|
[connectors, selectedId]
|
|
10024
10074
|
);
|
|
10025
|
-
const filtered =
|
|
10075
|
+
const filtered = React122__default.useMemo(
|
|
10026
10076
|
() => filterConnectors(connectors ?? [], "outbound", query),
|
|
10027
10077
|
[connectors, query]
|
|
10028
10078
|
);
|
|
@@ -10033,9 +10083,9 @@ function ConnectorsPanel({ onClose }) {
|
|
|
10033
10083
|
back: onClose
|
|
10034
10084
|
} : null
|
|
10035
10085
|
);
|
|
10036
|
-
const closeRef =
|
|
10086
|
+
const closeRef = React122__default.useRef(onClose);
|
|
10037
10087
|
closeRef.current = onClose;
|
|
10038
|
-
|
|
10088
|
+
React122__default.useEffect(() => {
|
|
10039
10089
|
if (hosted && !selectedId) closeRef.current();
|
|
10040
10090
|
}, [hosted, selectedId]);
|
|
10041
10091
|
return /* @__PURE__ */ jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [
|
|
@@ -10163,20 +10213,20 @@ function useDictation({
|
|
|
10163
10213
|
onInterim
|
|
10164
10214
|
}) {
|
|
10165
10215
|
const resolvedLocale = locale ?? (typeof navigator !== "undefined" ? navigator.language || "pt-BR" : "pt-BR");
|
|
10166
|
-
const [state, setState] =
|
|
10167
|
-
const [error, setError] =
|
|
10168
|
-
const sessionRef =
|
|
10169
|
-
const callbacks =
|
|
10216
|
+
const [state, setState] = React122.useState("idle");
|
|
10217
|
+
const [error, setError] = React122.useState(null);
|
|
10218
|
+
const sessionRef = React122.useRef(null);
|
|
10219
|
+
const callbacks = React122.useRef({ onTranscript, onInterim });
|
|
10170
10220
|
callbacks.current = { onTranscript, onInterim };
|
|
10171
|
-
const supported =
|
|
10221
|
+
const supported = React122.useMemo(
|
|
10172
10222
|
() => isDictationSupported(!!transcribeEndpoint),
|
|
10173
10223
|
[transcribeEndpoint]
|
|
10174
10224
|
);
|
|
10175
|
-
const finish =
|
|
10225
|
+
const finish = React122.useCallback(() => {
|
|
10176
10226
|
sessionRef.current = null;
|
|
10177
10227
|
setState("idle");
|
|
10178
10228
|
}, []);
|
|
10179
|
-
const start =
|
|
10229
|
+
const start = React122.useCallback(() => {
|
|
10180
10230
|
if (sessionRef.current || !supported) return;
|
|
10181
10231
|
stopSpeaking();
|
|
10182
10232
|
setError(null);
|
|
@@ -10197,28 +10247,28 @@ function useDictation({
|
|
|
10197
10247
|
}
|
|
10198
10248
|
);
|
|
10199
10249
|
}, [finish, resolvedLocale, supported, transcribeEndpoint]);
|
|
10200
|
-
const stop =
|
|
10250
|
+
const stop = React122.useCallback(() => {
|
|
10201
10251
|
if (!sessionRef.current) return;
|
|
10202
10252
|
if (transcribeEndpoint) setState("transcribing");
|
|
10203
10253
|
sessionRef.current.stop();
|
|
10204
10254
|
}, [transcribeEndpoint]);
|
|
10205
|
-
const cancel =
|
|
10255
|
+
const cancel = React122.useCallback(() => {
|
|
10206
10256
|
sessionRef.current?.cancel();
|
|
10207
10257
|
sessionRef.current = null;
|
|
10208
10258
|
setState("idle");
|
|
10209
10259
|
setError(null);
|
|
10210
10260
|
}, []);
|
|
10211
|
-
const toggle =
|
|
10261
|
+
const toggle = React122.useCallback(() => {
|
|
10212
10262
|
if (state === "listening" || state === "transcribing") stop();
|
|
10213
10263
|
else start();
|
|
10214
10264
|
}, [state, start, stop]);
|
|
10215
|
-
|
|
10265
|
+
React122.useEffect(() => () => sessionRef.current?.cancel(), []);
|
|
10216
10266
|
return { supported, state, error, start, stop, cancel, toggle, clearError: () => setError(null) };
|
|
10217
10267
|
}
|
|
10218
10268
|
function useMicLevels(active2, bandCount = 28, externalStream) {
|
|
10219
|
-
const levelsRef =
|
|
10220
|
-
const [available, setAvailable] =
|
|
10221
|
-
|
|
10269
|
+
const levelsRef = React122.useRef(new Float32Array(bandCount));
|
|
10270
|
+
const [available, setAvailable] = React122.useState(false);
|
|
10271
|
+
React122.useEffect(() => {
|
|
10222
10272
|
if (!active2) {
|
|
10223
10273
|
levelsRef.current.fill(0);
|
|
10224
10274
|
setAvailable(false);
|
|
@@ -10287,8 +10337,8 @@ var KIND_ICON = {
|
|
|
10287
10337
|
binary: File$1
|
|
10288
10338
|
};
|
|
10289
10339
|
function useFileDrop(enabled, onFiles) {
|
|
10290
|
-
const [dragging, setDragging] =
|
|
10291
|
-
const depth =
|
|
10340
|
+
const [dragging, setDragging] = React122.useState(false);
|
|
10341
|
+
const depth = React122.useRef(0);
|
|
10292
10342
|
const carriesFiles = (event) => Array.from(event.dataTransfer?.types ?? []).includes("Files");
|
|
10293
10343
|
const reset = () => {
|
|
10294
10344
|
depth.current = 0;
|
|
@@ -10348,7 +10398,7 @@ function AttachmentChips({
|
|
|
10348
10398
|
onRemove
|
|
10349
10399
|
}) {
|
|
10350
10400
|
const { t } = useTranslation$1();
|
|
10351
|
-
const [openId, setOpenId] =
|
|
10401
|
+
const [openId, setOpenId] = React122.useState(null);
|
|
10352
10402
|
if (!attachments.length) return null;
|
|
10353
10403
|
const opened = attachments.find((a) => a.id === openId);
|
|
10354
10404
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -10489,8 +10539,8 @@ function ChatComposer({
|
|
|
10489
10539
|
autoFocus
|
|
10490
10540
|
}) {
|
|
10491
10541
|
const { t } = useTranslation$1();
|
|
10492
|
-
const [input, setInput] =
|
|
10493
|
-
const textareaRef =
|
|
10542
|
+
const [input, setInput] = React122.useState("");
|
|
10543
|
+
const textareaRef = React122.useRef(null);
|
|
10494
10544
|
const voiceStartRequested = useChatStore((s) => s.voiceStartRequested);
|
|
10495
10545
|
const consumeVoiceStart = useChatStore((s) => s.consumeVoiceStart);
|
|
10496
10546
|
const draft = useChatStore((s) => s.draft);
|
|
@@ -10503,13 +10553,13 @@ function ChatComposer({
|
|
|
10503
10553
|
const removeAttachment = useChatStore((s) => s.removeAttachment);
|
|
10504
10554
|
const composerMedia = useChatStore((s) => s.composerMedia);
|
|
10505
10555
|
const clearComposerMedia = useChatStore((s) => s.clearComposerMedia);
|
|
10506
|
-
const fileInputRef =
|
|
10556
|
+
const fileInputRef = React122.useRef(null);
|
|
10507
10557
|
const autoSend = voice?.autoSend === true;
|
|
10508
10558
|
const micEnabled = voice?.input !== false;
|
|
10509
10559
|
const canAttach = isConfigured && !blocked && !isStreaming;
|
|
10510
10560
|
const parsing = attachments.some((a) => a.status === "parsing");
|
|
10511
10561
|
const readyAttachments = attachments.filter((a) => a.status === "ready").length;
|
|
10512
|
-
const submit =
|
|
10562
|
+
const submit = React122.useCallback(
|
|
10513
10563
|
(text2) => {
|
|
10514
10564
|
const trimmed = text2.trim();
|
|
10515
10565
|
const media = useChatStore.getState().composerMedia;
|
|
@@ -10539,7 +10589,7 @@ function ChatComposer({
|
|
|
10539
10589
|
}
|
|
10540
10590
|
}
|
|
10541
10591
|
});
|
|
10542
|
-
|
|
10592
|
+
React122.useEffect(() => {
|
|
10543
10593
|
if (!autoFocus) return;
|
|
10544
10594
|
const id = requestAnimationFrame(() => textareaRef.current?.focus());
|
|
10545
10595
|
return () => cancelAnimationFrame(id);
|
|
@@ -10551,7 +10601,7 @@ function ChatComposer({
|
|
|
10551
10601
|
const WAVEFORM_BANDS = 56;
|
|
10552
10602
|
const activity = useAssistantActivity();
|
|
10553
10603
|
const sessionRecording = activity?.kind === "recording" && activity.state === "running";
|
|
10554
|
-
const sessionStream =
|
|
10604
|
+
const sessionStream = React122.useMemo(
|
|
10555
10605
|
() => sessionRecording ? activity?.stream?.() ?? null : null,
|
|
10556
10606
|
[sessionRecording, activity]
|
|
10557
10607
|
);
|
|
@@ -10563,12 +10613,12 @@ function ChatComposer({
|
|
|
10563
10613
|
);
|
|
10564
10614
|
const sessionPause = activity?.actions?.find((a) => a.intent === "pause" || a.intent === "resume");
|
|
10565
10615
|
const sessionOwnsMic = activity?.kind === "recording" && (activity.state === "running" || activity.state === "paused");
|
|
10566
|
-
|
|
10616
|
+
React122.useEffect(() => {
|
|
10567
10617
|
if (!voiceStartRequested) return;
|
|
10568
10618
|
consumeVoiceStart();
|
|
10569
10619
|
if (showMic) dictation.start();
|
|
10570
10620
|
}, [voiceStartRequested, showMic]);
|
|
10571
|
-
|
|
10621
|
+
React122.useEffect(() => {
|
|
10572
10622
|
if (!focusRequested) return;
|
|
10573
10623
|
let frames = 0;
|
|
10574
10624
|
let raf = 0;
|
|
@@ -10585,7 +10635,7 @@ function ChatComposer({
|
|
|
10585
10635
|
raf = requestAnimationFrame(tick);
|
|
10586
10636
|
return () => cancelAnimationFrame(raf);
|
|
10587
10637
|
}, [focusRequested, consumeComposerFocus]);
|
|
10588
|
-
|
|
10638
|
+
React122.useEffect(() => {
|
|
10589
10639
|
if (!draft) return;
|
|
10590
10640
|
setInput(draft);
|
|
10591
10641
|
setDraft("");
|
|
@@ -10595,7 +10645,7 @@ function ChatComposer({
|
|
|
10595
10645
|
el.setSelectionRange(draft.length, draft.length);
|
|
10596
10646
|
}
|
|
10597
10647
|
}, [draft, setDraft]);
|
|
10598
|
-
|
|
10648
|
+
React122.useLayoutEffect(() => {
|
|
10599
10649
|
const el = textareaRef.current;
|
|
10600
10650
|
if (!el) return;
|
|
10601
10651
|
const style = getComputedStyle(el);
|
|
@@ -10798,8 +10848,8 @@ function UploadRequestCard() {
|
|
|
10798
10848
|
const removeUploadFile = useChatStore((s) => s.removeUploadFile);
|
|
10799
10849
|
const submitUpload = useChatStore((s) => s.submitUpload);
|
|
10800
10850
|
const clearUploadRequest = useChatStore((s) => s.clearUploadRequest);
|
|
10801
|
-
const cameraRef =
|
|
10802
|
-
const browseRef =
|
|
10851
|
+
const cameraRef = React122.useRef(null);
|
|
10852
|
+
const browseRef = React122.useRef(null);
|
|
10803
10853
|
if (!request) return null;
|
|
10804
10854
|
const working = request.status === "working";
|
|
10805
10855
|
const accept = request.accept ?? "image/*";
|
|
@@ -10941,8 +10991,8 @@ function LiveWaveform({
|
|
|
10941
10991
|
compact,
|
|
10942
10992
|
tone = "primary"
|
|
10943
10993
|
}) {
|
|
10944
|
-
const barsRef =
|
|
10945
|
-
|
|
10994
|
+
const barsRef = React122.useRef([]);
|
|
10995
|
+
React122.useEffect(() => {
|
|
10946
10996
|
if (!live) return;
|
|
10947
10997
|
let frame = 0;
|
|
10948
10998
|
const draw = () => {
|
|
@@ -11091,7 +11141,7 @@ function ChatMarkdown({ content }) {
|
|
|
11091
11141
|
}
|
|
11092
11142
|
const sub = subOrdered ? /* @__PURE__ */ jsx("ol", { start: subStart, className: "mt-0.5 space-y-0.5 pl-4 list-decimal", children: subItems }, `sub${items.length}`) : /* @__PURE__ */ jsx("ul", { className: "mt-0.5 space-y-0.5 pl-4 list-disc", children: subItems }, `sub${items.length}`);
|
|
11093
11143
|
const prev = items.pop();
|
|
11094
|
-
if (prev &&
|
|
11144
|
+
if (prev && React122.isValidElement(prev)) {
|
|
11095
11145
|
items.push(
|
|
11096
11146
|
/* @__PURE__ */ jsxs("li", { children: [
|
|
11097
11147
|
prev.props.children,
|
|
@@ -11188,7 +11238,7 @@ var CARD_CTA = {
|
|
|
11188
11238
|
function useConnectorJourney(card) {
|
|
11189
11239
|
const panelAvailable = useConnectorsPanelAvailable();
|
|
11190
11240
|
useChatStore((s) => s.setOpen);
|
|
11191
|
-
return
|
|
11241
|
+
return React122.useCallback(() => {
|
|
11192
11242
|
if (panelAvailable && card.id) {
|
|
11193
11243
|
openConnectorsPanel({ id: card.id });
|
|
11194
11244
|
return;
|
|
@@ -11278,7 +11328,7 @@ function ConnectorSuggestionRow({ card }) {
|
|
|
11278
11328
|
] });
|
|
11279
11329
|
}
|
|
11280
11330
|
function ConnectorSuggestionGroup({ cards }) {
|
|
11281
|
-
const shelves =
|
|
11331
|
+
const shelves = React122.useMemo(() => shelveByCategory(cards), [cards]);
|
|
11282
11332
|
return /* @__PURE__ */ jsx("div", { className: "w-full max-w-[88%] overflow-hidden rounded-xl border border-border/60 bg-card/60 motion-safe:animate-zoom-in", children: shelves.map((shelf, shelfIndex) => /* @__PURE__ */ jsxs("div", { className: cn(shelfIndex > 0 && "border-t border-border/50"), children: [
|
|
11283
11333
|
shelf.label && /* @__PURE__ */ jsx("p", { className: "bg-background/40 px-2.5 py-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: shelf.label }),
|
|
11284
11334
|
/* @__PURE__ */ jsx("div", { className: "divide-y divide-border/40", children: shelf.items.map((card) => /* @__PURE__ */ jsx(ConnectorSuggestionRow, { card }, card.slug ?? card.id ?? card.name)) })
|
|
@@ -11288,8 +11338,8 @@ function ChoiceCard({ card }) {
|
|
|
11288
11338
|
const queuePrompt = useChatStore((s) => s.queuePrompt);
|
|
11289
11339
|
const isStreaming = useChatStore((s) => s.isStreaming);
|
|
11290
11340
|
const messages = useChatStore((s) => s.messages);
|
|
11291
|
-
const [optimistic, setOptimistic] =
|
|
11292
|
-
const answeredInThread =
|
|
11341
|
+
const [optimistic, setOptimistic] = React122.useState(null);
|
|
11342
|
+
const answeredInThread = React122.useMemo(
|
|
11293
11343
|
() => answeredOptionId(messages, card.options),
|
|
11294
11344
|
[messages, card.options]
|
|
11295
11345
|
);
|
|
@@ -11344,7 +11394,7 @@ function humanizeToolName(name) {
|
|
|
11344
11394
|
}
|
|
11345
11395
|
function ToolCallRow({ call: call2 }) {
|
|
11346
11396
|
const { t } = useTranslation$1();
|
|
11347
|
-
const [open, setOpen] =
|
|
11397
|
+
const [open, setOpen] = React122.useState(false);
|
|
11348
11398
|
const failed = call2.declined || /"error"\s*:/.test(call2.result ?? "");
|
|
11349
11399
|
return /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-xl border border-border/50 bg-muted/30", children: [
|
|
11350
11400
|
/* @__PURE__ */ jsxs(
|
|
@@ -11421,15 +11471,15 @@ function HandoffNotice({ notice }) {
|
|
|
11421
11471
|
}
|
|
11422
11472
|
function MessageBubble({ message, isPending }) {
|
|
11423
11473
|
const isUser = message.role === "user";
|
|
11424
|
-
const connectorCards =
|
|
11474
|
+
const connectorCards = React122.useMemo(
|
|
11425
11475
|
() => (message.cards ?? []).filter((card) => card.kind === "connector"),
|
|
11426
11476
|
[message.cards]
|
|
11427
11477
|
);
|
|
11428
|
-
const choiceCards =
|
|
11478
|
+
const choiceCards = React122.useMemo(
|
|
11429
11479
|
() => (message.cards ?? []).filter((card) => card.kind === "choice"),
|
|
11430
11480
|
[message.cards]
|
|
11431
11481
|
);
|
|
11432
|
-
const routedLinks =
|
|
11482
|
+
const routedLinks = React122.useMemo(
|
|
11433
11483
|
() => (message.links ?? []).filter(
|
|
11434
11484
|
(l) => !!l.path || !!resolveEntityRoute(l.archetype, l.kind, l.entityKey)
|
|
11435
11485
|
),
|
|
@@ -11520,9 +11570,9 @@ function ConfirmActionCard({
|
|
|
11520
11570
|
onResolveAll
|
|
11521
11571
|
}) {
|
|
11522
11572
|
const { t } = useTranslation$1();
|
|
11523
|
-
const schema =
|
|
11573
|
+
const schema = React122.useMemo(() => action.fields ?? [], [action.fields]);
|
|
11524
11574
|
const partial = action.partial === true;
|
|
11525
|
-
const seedValues =
|
|
11575
|
+
const seedValues = React122.useCallback(
|
|
11526
11576
|
(params) => {
|
|
11527
11577
|
if (partial) return { ...params };
|
|
11528
11578
|
const seeded = {};
|
|
@@ -11531,18 +11581,18 @@ function ConfirmActionCard({
|
|
|
11531
11581
|
},
|
|
11532
11582
|
[schema, partial]
|
|
11533
11583
|
);
|
|
11534
|
-
const [values, setValues] =
|
|
11535
|
-
const [showAll, setShowAll] =
|
|
11584
|
+
const [values, setValues] = React122.useState(() => seedValues(action.params));
|
|
11585
|
+
const [showAll, setShowAll] = React122.useState(false);
|
|
11536
11586
|
const batch = Math.max(0, sameToolQueued);
|
|
11537
|
-
|
|
11587
|
+
React122.useEffect(() => setValues(seedValues(action.params)), [action.params, seedValues]);
|
|
11538
11588
|
const isSet = (v) => v !== void 0 && v !== null && v !== "";
|
|
11539
|
-
const primaryKeys =
|
|
11589
|
+
const primaryKeys = React122.useMemo(() => {
|
|
11540
11590
|
const keys = Object.keys(action.params).filter((k) => isSet(action.params[k]));
|
|
11541
11591
|
if (partial) return keys;
|
|
11542
11592
|
for (const f of schema) if (f.required && !keys.includes(f.key)) keys.push(f.key);
|
|
11543
11593
|
return keys;
|
|
11544
11594
|
}, [action.params, schema, partial]);
|
|
11545
|
-
const extraKeys =
|
|
11595
|
+
const extraKeys = React122.useMemo(
|
|
11546
11596
|
() => schema.map((f) => f.key).filter((k) => !primaryKeys.includes(k) && k !== "id"),
|
|
11547
11597
|
[schema, primaryKeys]
|
|
11548
11598
|
);
|
|
@@ -11559,20 +11609,20 @@ function ConfirmActionCard({
|
|
|
11559
11609
|
const translatedTool = t(toolKey);
|
|
11560
11610
|
const heading = action.title ?? (translatedTool !== toolKey ? translatedTool : humanizeToolName(action.toolName));
|
|
11561
11611
|
const ruleLabel = action.scopeLabel ?? heading;
|
|
11562
|
-
const missingRequiredKeys =
|
|
11612
|
+
const missingRequiredKeys = React122.useMemo(
|
|
11563
11613
|
() => partial ? [] : schema.filter((f) => f.required && !isSet(values[f.key])).map((f) => f.key),
|
|
11564
11614
|
[schema, values, partial]
|
|
11565
11615
|
);
|
|
11566
11616
|
const canConfirm = missingRequiredKeys.length === 0;
|
|
11567
|
-
const submitted =
|
|
11617
|
+
const submitted = React122.useCallback(
|
|
11568
11618
|
() => partial ? Object.fromEntries(Object.entries(values).filter(([, v]) => isSet(v))) : values,
|
|
11569
11619
|
[partial, values]
|
|
11570
11620
|
);
|
|
11571
|
-
const approve =
|
|
11621
|
+
const approve = React122.useCallback(() => {
|
|
11572
11622
|
if (canConfirm) onResolve(true, submitted());
|
|
11573
11623
|
}, [canConfirm, onResolve, submitted]);
|
|
11574
|
-
const decline =
|
|
11575
|
-
const approveAlways =
|
|
11624
|
+
const decline = React122.useCallback(() => onResolve(false), [onResolve]);
|
|
11625
|
+
const approveAlways = React122.useCallback(() => {
|
|
11576
11626
|
if (!canConfirm) return;
|
|
11577
11627
|
grantAutoApproval({
|
|
11578
11628
|
toolName: action.toolName,
|
|
@@ -11582,7 +11632,7 @@ function ConfirmActionCard({
|
|
|
11582
11632
|
});
|
|
11583
11633
|
onResolve(true, submitted());
|
|
11584
11634
|
}, [canConfirm, action.toolName, action.scope, ruleLabel, destructive, onResolve, submitted]);
|
|
11585
|
-
|
|
11635
|
+
React122.useEffect(() => {
|
|
11586
11636
|
const handler = (event) => {
|
|
11587
11637
|
const target = event.target;
|
|
11588
11638
|
const typing = target?.tagName === "INPUT" || target?.tagName === "TEXTAREA" || target?.tagName === "SELECT";
|
|
@@ -11919,8 +11969,8 @@ var TYPE_MS = 620;
|
|
|
11919
11969
|
var MIN_CHAR_MS = 12;
|
|
11920
11970
|
var MAX_CHAR_MS = 34;
|
|
11921
11971
|
function usePrefersReducedMotion() {
|
|
11922
|
-
const [reduced, setReduced] =
|
|
11923
|
-
|
|
11972
|
+
const [reduced, setReduced] = React122.useState(false);
|
|
11973
|
+
React122.useEffect(() => {
|
|
11924
11974
|
if (typeof matchMedia !== "function") return;
|
|
11925
11975
|
const query = matchMedia("(prefers-reduced-motion: reduce)");
|
|
11926
11976
|
const sync = () => setReduced(query.matches);
|
|
@@ -11939,10 +11989,10 @@ function TypedText({
|
|
|
11939
11989
|
onDone
|
|
11940
11990
|
}) {
|
|
11941
11991
|
const reduced = usePrefersReducedMotion();
|
|
11942
|
-
const [count, setCount] =
|
|
11943
|
-
const done =
|
|
11992
|
+
const [count, setCount] = React122.useState(reduced ? text2.length : 0);
|
|
11993
|
+
const done = React122.useRef(onDone);
|
|
11944
11994
|
done.current = onDone;
|
|
11945
|
-
|
|
11995
|
+
React122.useEffect(() => {
|
|
11946
11996
|
if (!start) {
|
|
11947
11997
|
setCount(0);
|
|
11948
11998
|
return;
|
|
@@ -11982,9 +12032,9 @@ function RevealSequence({
|
|
|
11982
12032
|
children
|
|
11983
12033
|
}) {
|
|
11984
12034
|
const reduced = usePrefersReducedMotion();
|
|
11985
|
-
const items =
|
|
11986
|
-
const [shown, setShown] =
|
|
11987
|
-
|
|
12035
|
+
const items = React122.Children.toArray(children);
|
|
12036
|
+
const [shown, setShown] = React122.useState(0);
|
|
12037
|
+
React122.useEffect(() => {
|
|
11988
12038
|
if (!start) {
|
|
11989
12039
|
setShown(0);
|
|
11990
12040
|
return;
|
|
@@ -12046,7 +12096,7 @@ function UpgradePrompt({ feature, inline, className }) {
|
|
|
12046
12096
|
const currentPlan = plans.find((p) => p.id === currentPlanId);
|
|
12047
12097
|
const currentPrice = currentPlan?.price ?? 0;
|
|
12048
12098
|
const currentPlanName = currentPlan?.name ?? tr("billing.free", "Free");
|
|
12049
|
-
const featureName =
|
|
12099
|
+
const featureName = React122.useMemo(() => {
|
|
12050
12100
|
if (!feature) return null;
|
|
12051
12101
|
const label2 = features.find((f) => f.id === feature)?.label;
|
|
12052
12102
|
if (label2) return featureDisplayName(label2);
|
|
@@ -12054,7 +12104,7 @@ function UpgradePrompt({ feature, inline, className }) {
|
|
|
12054
12104
|
const named = t(key);
|
|
12055
12105
|
return named && named !== key ? named : featureDisplayName(feature);
|
|
12056
12106
|
}, [features, feature, t]);
|
|
12057
|
-
const unlockingPlans =
|
|
12107
|
+
const unlockingPlans = React122.useMemo(
|
|
12058
12108
|
() => plans.filter((p) => p.id !== currentPlanId && p.price > currentPrice && planUnlocks(p, feature)).sort((a, b) => a.price - b.price),
|
|
12059
12109
|
[plans, currentPlanId, currentPrice, feature]
|
|
12060
12110
|
);
|
|
@@ -12235,26 +12285,26 @@ function ChatConversation({
|
|
|
12235
12285
|
usable && !pendingAction && !isStreaming,
|
|
12236
12286
|
receiveFiles
|
|
12237
12287
|
);
|
|
12238
|
-
|
|
12239
|
-
const [view, setView] =
|
|
12288
|
+
React122.useEffect(ensureIntroStyles, []);
|
|
12289
|
+
const [view, setView] = React122.useState(
|
|
12240
12290
|
() => useChatStore.getState().messages.length > 0 ? "thread" : "list"
|
|
12241
12291
|
);
|
|
12242
|
-
const [drawer, setDrawer] =
|
|
12243
|
-
const [introStep, setIntroStep] =
|
|
12244
|
-
const [atBottom, setAtBottom] =
|
|
12245
|
-
const scrollRef =
|
|
12292
|
+
const [drawer, setDrawer] = React122.useState("none");
|
|
12293
|
+
const [introStep, setIntroStep] = React122.useState(0);
|
|
12294
|
+
const [atBottom, setAtBottom] = React122.useState(true);
|
|
12295
|
+
const scrollRef = React122.useRef(null);
|
|
12246
12296
|
const hasMessages = messages.length > 0;
|
|
12247
12297
|
const showThread = view === "thread" && hasMessages;
|
|
12248
12298
|
const totalTools = toolGroups.reduce((sum, g) => sum + g.tools.length, 0);
|
|
12249
|
-
const scrollToBottom =
|
|
12299
|
+
const scrollToBottom = React122.useCallback((behavior = "smooth") => {
|
|
12250
12300
|
const el = scrollRef.current;
|
|
12251
12301
|
if (!el) return;
|
|
12252
12302
|
el.scrollTo({ top: el.scrollHeight, behavior });
|
|
12253
12303
|
}, []);
|
|
12254
|
-
|
|
12304
|
+
React122.useEffect(() => {
|
|
12255
12305
|
if (atBottom) scrollToBottom();
|
|
12256
12306
|
}, [messages, activeTools, pendingAction, atBottom, scrollToBottom]);
|
|
12257
|
-
|
|
12307
|
+
React122.useEffect(() => {
|
|
12258
12308
|
loadConversations();
|
|
12259
12309
|
setSuggestionsOpen(useChatStore.getState().messages.length === 0);
|
|
12260
12310
|
return () => stopSpeaking();
|
|
@@ -12271,7 +12321,7 @@ function ChatConversation({
|
|
|
12271
12321
|
};
|
|
12272
12322
|
const queuedPrompt = useChatStore((s) => s.queuedPrompt);
|
|
12273
12323
|
const consumeQueuedPrompt = useChatStore((s) => s.consumeQueuedPrompt);
|
|
12274
|
-
|
|
12324
|
+
React122.useEffect(() => {
|
|
12275
12325
|
if (!queuedPrompt) return;
|
|
12276
12326
|
const prompt = consumeQueuedPrompt();
|
|
12277
12327
|
if (prompt && usable) send(prompt);
|
|
@@ -12303,7 +12353,7 @@ function ChatConversation({
|
|
|
12303
12353
|
);
|
|
12304
12354
|
const connectorsPending = useConnectorsSurface((s) => s.pending);
|
|
12305
12355
|
const consumeConnectorsRequest = useConnectorsSurface((s) => s.consume);
|
|
12306
|
-
|
|
12356
|
+
React122.useEffect(() => {
|
|
12307
12357
|
if (!connectorsPending) return;
|
|
12308
12358
|
setDrawer("connectors");
|
|
12309
12359
|
consumeConnectorsRequest();
|
|
@@ -12311,7 +12361,7 @@ function ChatConversation({
|
|
|
12311
12361
|
const greetingName = (user?.fullName || user?.email || "").split(/[\s@]/)[0];
|
|
12312
12362
|
const invite = useAssistantInviteStore((s) => s.invite);
|
|
12313
12363
|
const introKey = `${onDuty?.role ?? "solo"}:${invite?.id ?? ""}`;
|
|
12314
|
-
|
|
12364
|
+
React122.useEffect(() => setIntroStep(0), [introKey]);
|
|
12315
12365
|
const greeting = invite ? (invite.pitch ?? invite.headline).replace("{{name}}", greetingName) : onDuty?.greeting ? onDuty.greeting.replace("{{name}}", greetingName) : greetingName ? t("chat.greetingNamed", { name: greetingName }) : t("chat.greeting");
|
|
12316
12366
|
const greetingHint = invite?.description ?? onDuty?.goal ?? t("chat.greetingHint");
|
|
12317
12367
|
const openers = invite?.suggestions?.length ? invite.suggestions : onDuty?.suggestions?.length ? onDuty.suggestions : suggestions.length ? suggestions : [
|
|
@@ -12633,7 +12683,7 @@ function AgentAvatar({
|
|
|
12633
12683
|
size = "md",
|
|
12634
12684
|
className
|
|
12635
12685
|
}) {
|
|
12636
|
-
const [failed, setFailed] =
|
|
12686
|
+
const [failed, setFailed] = React122.useState(false);
|
|
12637
12687
|
const { box, text: text2, px } = SIZES[size];
|
|
12638
12688
|
if (Face) {
|
|
12639
12689
|
return /* @__PURE__ */ jsx(
|
|
@@ -13421,7 +13471,7 @@ function TaskStatusGroup({ status, tasks }) {
|
|
|
13421
13471
|
function useDelegateToAssistant() {
|
|
13422
13472
|
const queuePrompt = useChatStore((s) => s.queuePrompt);
|
|
13423
13473
|
const openPanel = useRightRailStore((s) => s.openPanel);
|
|
13424
|
-
return
|
|
13474
|
+
return React122.useCallback(
|
|
13425
13475
|
(prompt) => {
|
|
13426
13476
|
queuePrompt(prompt);
|
|
13427
13477
|
openPanel("chat");
|
|
@@ -13658,12 +13708,12 @@ function TasksPanel() {
|
|
|
13658
13708
|
const fetchTasks = useTasksStore((s) => s.fetchTasks);
|
|
13659
13709
|
const fetchLabels = useTasksStore((s) => s.fetchLabels);
|
|
13660
13710
|
const fetchSummary = useTasksStore((s) => s.fetchSummary);
|
|
13661
|
-
|
|
13711
|
+
React122__default.useEffect(() => {
|
|
13662
13712
|
void fetchTasks();
|
|
13663
13713
|
void fetchLabels();
|
|
13664
13714
|
void fetchSummary();
|
|
13665
13715
|
}, [fetchTasks, fetchLabels, fetchSummary]);
|
|
13666
|
-
const { onboarding, grouped } =
|
|
13716
|
+
const { onboarding, grouped } = React122__default.useMemo(() => {
|
|
13667
13717
|
const split = splitOnboardingTasks(tasks);
|
|
13668
13718
|
const map = /* @__PURE__ */ new Map();
|
|
13669
13719
|
for (const s of STATUS_ORDER) map.set(s, []);
|
|
@@ -13698,7 +13748,7 @@ function TasksPanel() {
|
|
|
13698
13748
|
function useTasksSummaryLine() {
|
|
13699
13749
|
const t = useTranslation();
|
|
13700
13750
|
const summary = useTasksStore((s) => s.summary);
|
|
13701
|
-
return
|
|
13751
|
+
return React122__default.useMemo(() => {
|
|
13702
13752
|
if (!summary) return "";
|
|
13703
13753
|
const parts = [];
|
|
13704
13754
|
if (summary.overdue > 0) parts.push(`${summary.overdue} ${t("tasks.summary.overdue")}`);
|
|
@@ -13723,16 +13773,16 @@ function TasksRailPanel() {
|
|
|
13723
13773
|
const fetchSummary = useTasksStore((s) => s.fetchSummary);
|
|
13724
13774
|
const setCurrentUserId = useTasksStore((s) => s.setCurrentUserId);
|
|
13725
13775
|
const userId = useAuthStore6((s) => s.user?.id);
|
|
13726
|
-
|
|
13776
|
+
React122__default.useEffect(() => {
|
|
13727
13777
|
void fetchSummary();
|
|
13728
13778
|
}, [fetchSummary]);
|
|
13729
|
-
|
|
13779
|
+
React122__default.useEffect(() => {
|
|
13730
13780
|
setCurrentUserId(userId ?? null);
|
|
13731
13781
|
}, [userId, setCurrentUserId]);
|
|
13732
13782
|
const openCount = summary ? summary.todo + summary.inProgress : 0;
|
|
13733
13783
|
const defer = tasksSurfaceOwner() === "plugin";
|
|
13734
13784
|
useRightRailPanel(
|
|
13735
|
-
|
|
13785
|
+
React122__default.useMemo(
|
|
13736
13786
|
() => defer ? null : {
|
|
13737
13787
|
id: "tasks",
|
|
13738
13788
|
label: t("tasks.drawer.title") || "Tasks",
|
|
@@ -13756,15 +13806,15 @@ var useSettingsTabsStore = create((set, get) => ({
|
|
|
13756
13806
|
}));
|
|
13757
13807
|
function usePublishSettingsTabs(ids) {
|
|
13758
13808
|
const key = ids.join(",");
|
|
13759
|
-
|
|
13809
|
+
React122.useEffect(() => {
|
|
13760
13810
|
useSettingsTabsStore.getState().setIds(key ? key.split(",") : []);
|
|
13761
13811
|
}, [key]);
|
|
13762
13812
|
}
|
|
13763
13813
|
function useAgentSurface(contribution) {
|
|
13764
|
-
const ref =
|
|
13814
|
+
const ref = React122.useRef(contribution);
|
|
13765
13815
|
ref.current = contribution;
|
|
13766
13816
|
const id = contribution.id;
|
|
13767
|
-
|
|
13817
|
+
React122.useEffect(() => {
|
|
13768
13818
|
registerSurface({ id, get: () => ref.current });
|
|
13769
13819
|
const names = (ref.current.tools ?? []).map((t) => t.tool.name);
|
|
13770
13820
|
for (const name of names) {
|
|
@@ -14544,9 +14594,9 @@ function featureMap() {
|
|
|
14544
14594
|
}));
|
|
14545
14595
|
}
|
|
14546
14596
|
function ActivationAgentSurface({ programs }) {
|
|
14547
|
-
const programsRef =
|
|
14597
|
+
const programsRef = React122.useRef(programs);
|
|
14548
14598
|
programsRef.current = programs;
|
|
14549
|
-
const contribution =
|
|
14599
|
+
const contribution = React122.useMemo(
|
|
14550
14600
|
() => ({
|
|
14551
14601
|
id: "onboarding.activation",
|
|
14552
14602
|
pluginId: "onboarding",
|
|
@@ -14867,7 +14917,7 @@ Quando a pessoa perguntar COMO fazer algo que tem guia em \`setupGuides\` ("como
|
|
|
14867
14917
|
- Termine dizendo o que isso destrava e oferecendo a pr\xF3xima, uma vez s\xF3.`
|
|
14868
14918
|
);
|
|
14869
14919
|
function SetupAgentSurface() {
|
|
14870
|
-
const contribution =
|
|
14920
|
+
const contribution = React122.useMemo(
|
|
14871
14921
|
() => ({
|
|
14872
14922
|
id: "setup.guides",
|
|
14873
14923
|
pluginId: "setup",
|
|
@@ -14983,7 +15033,7 @@ function SetupAgentSurface() {
|
|
|
14983
15033
|
}
|
|
14984
15034
|
var DEBOUNCE_MS = 1200;
|
|
14985
15035
|
function useActivationWatch() {
|
|
14986
|
-
|
|
15036
|
+
React122.useEffect(() => {
|
|
14987
15037
|
let timer = null;
|
|
14988
15038
|
let running = false;
|
|
14989
15039
|
const sweep = async () => {
|
|
@@ -15022,7 +15072,7 @@ function useActivationWatch() {
|
|
|
15022
15072
|
off();
|
|
15023
15073
|
};
|
|
15024
15074
|
}, []);
|
|
15025
|
-
|
|
15075
|
+
React122.useEffect(() => {
|
|
15026
15076
|
useActivationStore.setState({
|
|
15027
15077
|
onStepCompleted: (step, by) => {
|
|
15028
15078
|
const state = useActivationStore.getState();
|
|
@@ -15679,7 +15729,7 @@ function ActivationProvider() {
|
|
|
15679
15729
|
const programs = runtime?.onboardingPrograms ?? [];
|
|
15680
15730
|
const settingsIds = useSettingsTabsStore((s) => s.ids);
|
|
15681
15731
|
const routeKey = (runtime?.routes.length ?? 0) + ":" + settingsIds.join(",");
|
|
15682
|
-
const hasRoute =
|
|
15732
|
+
const hasRoute = React122.useMemo(() => {
|
|
15683
15733
|
const known = /* @__PURE__ */ new Set(["/", "/settings"]);
|
|
15684
15734
|
for (const route of runtime?.routes ?? []) known.add(route.path);
|
|
15685
15735
|
for (const id of settingsIds) known.add(`/settings/${id}`);
|
|
@@ -15687,14 +15737,14 @@ function ActivationProvider() {
|
|
|
15687
15737
|
}, [routeKey]);
|
|
15688
15738
|
const answers = useBusinessProfileStore((s) => s.profile?.answers);
|
|
15689
15739
|
const programKey = programs.map((p) => p.id).join(",");
|
|
15690
|
-
const catalog =
|
|
15740
|
+
const catalog = React122.useMemo(
|
|
15691
15741
|
() => buildActivationCatalog({ verticalId, programs, hasRoute, answers }),
|
|
15692
15742
|
[verticalId, programKey, hasRoute, answers]
|
|
15693
15743
|
);
|
|
15694
|
-
|
|
15744
|
+
React122.useEffect(() => {
|
|
15695
15745
|
setCatalog(catalog);
|
|
15696
15746
|
}, [catalog, setCatalog]);
|
|
15697
|
-
|
|
15747
|
+
React122.useEffect(() => {
|
|
15698
15748
|
if (!tenantId2) return;
|
|
15699
15749
|
let cancelled = false;
|
|
15700
15750
|
void (async () => {
|
|
@@ -15726,14 +15776,14 @@ function ActivationProvider() {
|
|
|
15726
15776
|
cancelled = true;
|
|
15727
15777
|
};
|
|
15728
15778
|
}, [tenantId2, catalog, answers, hasRoute, settingsIds, user?.id, load]);
|
|
15729
|
-
|
|
15779
|
+
React122.useEffect(() => {
|
|
15730
15780
|
if (!tenantId2) {
|
|
15731
15781
|
useBusinessProfileStore.getState().clear();
|
|
15732
15782
|
return;
|
|
15733
15783
|
}
|
|
15734
15784
|
void useBusinessProfileStore.getState().load(tenantId2, orgName);
|
|
15735
15785
|
}, [tenantId2, orgName]);
|
|
15736
|
-
|
|
15786
|
+
React122.useEffect(() => {
|
|
15737
15787
|
if (!tenantId2) return;
|
|
15738
15788
|
const key = `${GREETING_FLAG}:${tenantId2}`;
|
|
15739
15789
|
let pending2 = false;
|
|
@@ -15755,10 +15805,10 @@ function ActivationProvider() {
|
|
|
15755
15805
|
return () => window.clearTimeout(timer);
|
|
15756
15806
|
}, [tenantId2]);
|
|
15757
15807
|
const guides = runtime?.setupGuides;
|
|
15758
|
-
|
|
15808
|
+
React122.useEffect(() => {
|
|
15759
15809
|
setRuntimeSetupGuides(guides ?? []);
|
|
15760
15810
|
}, [guides]);
|
|
15761
|
-
|
|
15811
|
+
React122.useEffect(() => {
|
|
15762
15812
|
setTourNavigator(navigateTo);
|
|
15763
15813
|
return () => setTourNavigator(void 0);
|
|
15764
15814
|
}, []);
|
|
@@ -15931,7 +15981,7 @@ Escrita:
|
|
|
15931
15981
|
E quando a coisa precisa ser FEITA em vez de lembrada, \xE9 tarefa e n\xE3o p\xE1gina \u2014 crie com createRecord na entidade Task.`
|
|
15932
15982
|
);
|
|
15933
15983
|
function HandbookAgentSurface() {
|
|
15934
|
-
const contribution =
|
|
15984
|
+
const contribution = React122.useMemo(
|
|
15935
15985
|
() => ({
|
|
15936
15986
|
id: "handbook",
|
|
15937
15987
|
pluginId: "handbook",
|
|
@@ -16042,18 +16092,18 @@ function NotebookPanel() {
|
|
|
16042
16092
|
const userId = useHandbookStore((s) => s.userId);
|
|
16043
16093
|
const write3 = useHandbookStore((s) => s.write);
|
|
16044
16094
|
const remove = useHandbookStore((s) => s.remove);
|
|
16045
|
-
const [filter, setFilter] =
|
|
16046
|
-
const [search, setSearch] =
|
|
16047
|
-
const [draft, setDraft] =
|
|
16048
|
-
const [preview, setPreview] =
|
|
16049
|
-
const [confirming, setConfirming] =
|
|
16050
|
-
const entries2 =
|
|
16095
|
+
const [filter, setFilter] = React122.useState("all");
|
|
16096
|
+
const [search, setSearch] = React122.useState("");
|
|
16097
|
+
const [draft, setDraft] = React122.useState(null);
|
|
16098
|
+
const [preview, setPreview] = React122.useState(false);
|
|
16099
|
+
const [confirming, setConfirming] = React122.useState(null);
|
|
16100
|
+
const entries2 = React122.useMemo(
|
|
16051
16101
|
() => (pages ?? []).map((p) => ({ page: p, entry: toEntry2(p) })),
|
|
16052
16102
|
[pages]
|
|
16053
16103
|
);
|
|
16054
|
-
const timer =
|
|
16055
|
-
const inFlight =
|
|
16056
|
-
const persist =
|
|
16104
|
+
const timer = React122.useRef(null);
|
|
16105
|
+
const inFlight = React122.useRef(false);
|
|
16106
|
+
const persist = React122.useCallback(async (d) => {
|
|
16057
16107
|
const title = titleFromBody(d.body);
|
|
16058
16108
|
if (!title && !d.body.trim()) return d.id;
|
|
16059
16109
|
const filed = d.folder !== null;
|
|
@@ -16075,7 +16125,7 @@ function NotebookPanel() {
|
|
|
16075
16125
|
});
|
|
16076
16126
|
return saved?.id ?? d.id;
|
|
16077
16127
|
}, [write3, userId]);
|
|
16078
|
-
const schedule =
|
|
16128
|
+
const schedule = React122.useCallback((next) => {
|
|
16079
16129
|
setDraft(next);
|
|
16080
16130
|
if (timer.current) clearTimeout(timer.current);
|
|
16081
16131
|
timer.current = setTimeout(() => {
|
|
@@ -16107,7 +16157,7 @@ function NotebookPanel() {
|
|
|
16107
16157
|
legacyId: null
|
|
16108
16158
|
});
|
|
16109
16159
|
};
|
|
16110
|
-
const folders =
|
|
16160
|
+
const folders = React122.useMemo(() => {
|
|
16111
16161
|
const set = /* @__PURE__ */ new Set();
|
|
16112
16162
|
for (const { page } of entries2) {
|
|
16113
16163
|
if (page.kind !== "doc" || !page.path) continue;
|
|
@@ -16499,10 +16549,10 @@ ${body}`
|
|
|
16499
16549
|
}
|
|
16500
16550
|
function NoteTodosSection({ noteId, noteTitle }) {
|
|
16501
16551
|
const adapter = useNotesTasksBridge((s) => s.adapter);
|
|
16502
|
-
const [todos, setTodos] =
|
|
16503
|
-
const [draft, setDraft] =
|
|
16504
|
-
const [busy, setBusy] =
|
|
16505
|
-
|
|
16552
|
+
const [todos, setTodos] = React122.useState([]);
|
|
16553
|
+
const [draft, setDraft] = React122.useState("");
|
|
16554
|
+
const [busy, setBusy] = React122.useState(false);
|
|
16555
|
+
React122.useEffect(() => {
|
|
16506
16556
|
if (!adapter) return;
|
|
16507
16557
|
let alive = true;
|
|
16508
16558
|
adapter.listTodos(noteId).then((rows) => {
|
|
@@ -16632,7 +16682,7 @@ function NotebookRailPanel() {
|
|
|
16632
16682
|
const pages = useHandbookStore((s) => s.pages);
|
|
16633
16683
|
const count = pages?.length ?? 0;
|
|
16634
16684
|
useRightRailPanel(
|
|
16635
|
-
|
|
16685
|
+
React122.useMemo(
|
|
16636
16686
|
() => ({
|
|
16637
16687
|
id: "notes",
|
|
16638
16688
|
label: tl("Notes", "Notas"),
|
|
@@ -16651,10 +16701,10 @@ function HandbookProvider() {
|
|
|
16651
16701
|
const userId = useAuthStore((s) => s.user?.id);
|
|
16652
16702
|
const load = useHandbookStore((s) => s.load);
|
|
16653
16703
|
const setUser = useHandbookStore((s) => s.setUser);
|
|
16654
|
-
|
|
16704
|
+
React122.useEffect(() => {
|
|
16655
16705
|
setUser(userId);
|
|
16656
16706
|
}, [userId, setUser]);
|
|
16657
|
-
|
|
16707
|
+
React122.useEffect(() => {
|
|
16658
16708
|
if (tenantId2) void load(tenantId2);
|
|
16659
16709
|
}, [tenantId2, load]);
|
|
16660
16710
|
useLocalNotesImport(tenantId2, userId);
|
|
@@ -16664,7 +16714,7 @@ function HandbookProvider() {
|
|
|
16664
16714
|
] });
|
|
16665
16715
|
}
|
|
16666
16716
|
function useLocalNotesImport(tenantId2, userId) {
|
|
16667
|
-
|
|
16717
|
+
React122.useEffect(() => {
|
|
16668
16718
|
if (!tenantId2 || !userId) return;
|
|
16669
16719
|
const source = `fayz.notes.${tenantId2}.${userId}`;
|
|
16670
16720
|
const flag = `fayz.notes.imported.${tenantId2}.${userId}`;
|
|
@@ -16712,7 +16762,7 @@ function useUnitBootstrap() {
|
|
|
16712
16762
|
const tenant = useTenantOptional();
|
|
16713
16763
|
const userId = useAuthStore((s) => s.user?.id);
|
|
16714
16764
|
const orgId = tenant?.org?.id;
|
|
16715
|
-
|
|
16765
|
+
React122.useEffect(() => {
|
|
16716
16766
|
if (!orgId) return;
|
|
16717
16767
|
const { loadedFor, load, reset } = useUnitStore.getState();
|
|
16718
16768
|
if (loadedFor && loadedFor !== orgId) reset();
|
|
@@ -16751,19 +16801,19 @@ function UnitMembersTab({ item }) {
|
|
|
16751
16801
|
const orgMembers = useOrganizationStore((s) => s.members);
|
|
16752
16802
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
16753
16803
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
16754
|
-
const [rows, setRows] =
|
|
16755
|
-
const [activity, setActivity] =
|
|
16756
|
-
const [adding, setAdding] =
|
|
16757
|
-
const [busy, setBusy] =
|
|
16758
|
-
const reload =
|
|
16804
|
+
const [rows, setRows] = React122.useState(null);
|
|
16805
|
+
const [activity, setActivity] = React122.useState({});
|
|
16806
|
+
const [adding, setAdding] = React122.useState(false);
|
|
16807
|
+
const [busy, setBusy] = React122.useState(null);
|
|
16808
|
+
const reload = React122.useCallback(async () => {
|
|
16759
16809
|
if (!unitId) return;
|
|
16760
16810
|
setRows(await fetchUnitMembers(unitId));
|
|
16761
16811
|
}, [unitId]);
|
|
16762
16812
|
const version5 = useDataVersion(UNIT_ACCESS_CHANGED);
|
|
16763
|
-
|
|
16813
|
+
React122.useEffect(() => {
|
|
16764
16814
|
void reload();
|
|
16765
16815
|
}, [reload, version5]);
|
|
16766
|
-
|
|
16816
|
+
React122.useEffect(() => {
|
|
16767
16817
|
if (!orgId) return;
|
|
16768
16818
|
let alive = true;
|
|
16769
16819
|
void fetchMemberActivity(orgId).then((a) => {
|
|
@@ -16773,7 +16823,7 @@ function UnitMembersTab({ item }) {
|
|
|
16773
16823
|
alive = false;
|
|
16774
16824
|
};
|
|
16775
16825
|
}, [orgId]);
|
|
16776
|
-
const byUser =
|
|
16826
|
+
const byUser = React122.useMemo(() => {
|
|
16777
16827
|
const map = /* @__PURE__ */ new Map();
|
|
16778
16828
|
for (const m of orgMembers) {
|
|
16779
16829
|
map.set(m.userId, {
|
|
@@ -16785,7 +16835,7 @@ function UnitMembersTab({ item }) {
|
|
|
16785
16835
|
}
|
|
16786
16836
|
return map;
|
|
16787
16837
|
}, [orgMembers]);
|
|
16788
|
-
const available =
|
|
16838
|
+
const available = React122.useMemo(
|
|
16789
16839
|
() => orgMembers.filter((m) => !(rows ?? []).some((r) => r.userId === m.userId)),
|
|
16790
16840
|
[orgMembers, rows]
|
|
16791
16841
|
);
|
|
@@ -16991,15 +17041,15 @@ function MemberAccessBody({
|
|
|
16991
17041
|
const units = useUnitStore((s) => s.units);
|
|
16992
17042
|
const byId = useUnitStore((s) => s.byId);
|
|
16993
17043
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
16994
|
-
const [bindings, setBindings] =
|
|
16995
|
-
const [loading, setLoading] =
|
|
16996
|
-
const [adding, setAdding] =
|
|
16997
|
-
const branches =
|
|
16998
|
-
const unbound =
|
|
17044
|
+
const [bindings, setBindings] = React122.useState([]);
|
|
17045
|
+
const [loading, setLoading] = React122.useState(false);
|
|
17046
|
+
const [adding, setAdding] = React122.useState(false);
|
|
17047
|
+
const branches = React122.useMemo(() => units.filter((u) => u.isActive !== false), [units]);
|
|
17048
|
+
const unbound = React122.useMemo(
|
|
16999
17049
|
() => branches.filter((u) => !bindings.some((b) => b.locationId === u.id)),
|
|
17000
17050
|
[branches, bindings]
|
|
17001
17051
|
);
|
|
17002
|
-
const reload =
|
|
17052
|
+
const reload = React122.useCallback(async () => {
|
|
17003
17053
|
if (!userId) return;
|
|
17004
17054
|
setLoading(true);
|
|
17005
17055
|
try {
|
|
@@ -17009,7 +17059,7 @@ function MemberAccessBody({
|
|
|
17009
17059
|
}
|
|
17010
17060
|
}, [userId]);
|
|
17011
17061
|
const version5 = useDataVersion(UNIT_ACCESS_CHANGED);
|
|
17012
|
-
|
|
17062
|
+
React122.useEffect(() => {
|
|
17013
17063
|
void reload();
|
|
17014
17064
|
}, [reload, version5]);
|
|
17015
17065
|
async function add(unitId) {
|
|
@@ -17656,7 +17706,7 @@ function useWrongApp() {
|
|
|
17656
17706
|
const tenantId2 = useAppConfigStore((s) => s.tenantId);
|
|
17657
17707
|
const activeTenantId = useOrganizationStore((s) => s.currentOrg?.id ?? null);
|
|
17658
17708
|
const appId = resolveAppId();
|
|
17659
|
-
return
|
|
17709
|
+
return React122.useMemo(() => {
|
|
17660
17710
|
if (!appId || !activeTenantId || tenantId2 !== activeTenantId) return { app: null };
|
|
17661
17711
|
const list = (apps ?? []).filter((a) => !a.house);
|
|
17662
17712
|
if (!list.length) return { app: null };
|
|
@@ -17779,13 +17829,13 @@ function surveyTokenFromPath(pathname) {
|
|
|
17779
17829
|
return m ? decodeURIComponent(m[1]) : null;
|
|
17780
17830
|
}
|
|
17781
17831
|
function PublicSurveyPage({ token, appName }) {
|
|
17782
|
-
const [loaded2, setLoaded] =
|
|
17783
|
-
const [draft, setDraft] =
|
|
17784
|
-
const [name, setName] =
|
|
17785
|
-
const [sending, setSending] =
|
|
17786
|
-
const [sent, setSent] =
|
|
17787
|
-
const [failed, setFailed] =
|
|
17788
|
-
|
|
17832
|
+
const [loaded2, setLoaded] = React122__default.useState(null);
|
|
17833
|
+
const [draft, setDraft] = React122__default.useState({});
|
|
17834
|
+
const [name, setName] = React122__default.useState("");
|
|
17835
|
+
const [sending, setSending] = React122__default.useState(false);
|
|
17836
|
+
const [sent, setSent] = React122__default.useState(null);
|
|
17837
|
+
const [failed, setFailed] = React122__default.useState(null);
|
|
17838
|
+
React122__default.useEffect(() => {
|
|
17789
17839
|
let alive = true;
|
|
17790
17840
|
const client3 = getFayzSupabaseClientOptional();
|
|
17791
17841
|
if (!client3) {
|
|
@@ -18071,7 +18121,7 @@ function isServed2(route) {
|
|
|
18071
18121
|
function getPersonActions(kind) {
|
|
18072
18122
|
return ACTIONS.filter((a) => !a.kinds || (kind ? a.kinds.includes(kind) : false)).filter((a) => !a.requiresRoute || isServed2(a.requiresRoute)).sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
|
|
18073
18123
|
}
|
|
18074
|
-
var RouteErrorBoundary = class extends
|
|
18124
|
+
var RouteErrorBoundary = class extends React122.Component {
|
|
18075
18125
|
constructor() {
|
|
18076
18126
|
super(...arguments);
|
|
18077
18127
|
this.state = { crashed: false, report: null };
|
|
@@ -18113,7 +18163,7 @@ var RouteErrorBoundary = class extends React119.Component {
|
|
|
18113
18163
|
}
|
|
18114
18164
|
};
|
|
18115
18165
|
function RouteErrorScreen({ report, tr, onBack, onRetry, backLabel }) {
|
|
18116
|
-
const [copied, setCopied] =
|
|
18166
|
+
const [copied, setCopied] = React122.useState(false);
|
|
18117
18167
|
const copyDetails = () => {
|
|
18118
18168
|
if (!report || typeof navigator === "undefined" || !navigator.clipboard) return;
|
|
18119
18169
|
const details = [
|
|
@@ -18218,9 +18268,9 @@ function UnitSwitching({ unitName, isAll, onDone }) {
|
|
|
18218
18268
|
const v = t(key);
|
|
18219
18269
|
return !v || v === key ? fallback : v;
|
|
18220
18270
|
};
|
|
18221
|
-
const doneRef =
|
|
18271
|
+
const doneRef = React122.useRef(onDone);
|
|
18222
18272
|
doneRef.current = onDone;
|
|
18223
|
-
|
|
18273
|
+
React122.useEffect(() => {
|
|
18224
18274
|
const id = window.setTimeout(() => doneRef.current(), HOLD_MS);
|
|
18225
18275
|
return () => window.clearTimeout(id);
|
|
18226
18276
|
}, []);
|
|
@@ -18277,11 +18327,11 @@ function UnitPickerDialog() {
|
|
|
18277
18327
|
const myUnitIds = useUnitStore((s) => s.myUnitIds);
|
|
18278
18328
|
const activeUnitId = useUnitStore((s) => s.activeUnitId);
|
|
18279
18329
|
const beginSwitch = useUnitSwitchingStore((s) => s.begin);
|
|
18280
|
-
const reachable =
|
|
18330
|
+
const reachable = React122.useMemo(
|
|
18281
18331
|
() => myUnitIds.length > 0 ? myUnitIds : units.filter((u) => u.kind !== "region").map((u) => u.id),
|
|
18282
18332
|
[myUnitIds, units]
|
|
18283
18333
|
);
|
|
18284
|
-
const groups =
|
|
18334
|
+
const groups = React122.useMemo(() => {
|
|
18285
18335
|
const out = [];
|
|
18286
18336
|
if (reachable.length > 1) {
|
|
18287
18337
|
out.push({ id: "_all", options: [{ id: ALL_UNITS, label: "Todas as unidades" }] });
|
|
@@ -18480,16 +18530,16 @@ function WorkspaceSetupFlow({
|
|
|
18480
18530
|
const user = useAuthStore((s) => s.user);
|
|
18481
18531
|
const { switchOrg } = useTenant();
|
|
18482
18532
|
const closeSetup = useWorkspaceSetupStore((s) => s.close);
|
|
18483
|
-
const uploadLogo =
|
|
18533
|
+
const uploadLogo = React122.useMemo(
|
|
18484
18534
|
() => user ? createLogoUploader(user.id) : void 0,
|
|
18485
18535
|
[user?.id]
|
|
18486
18536
|
);
|
|
18487
|
-
const country =
|
|
18537
|
+
const country = React122.useMemo(
|
|
18488
18538
|
() => currency === "BRL" || (locale ?? "").toLowerCase().startsWith("pt") ? "BR" : void 0,
|
|
18489
18539
|
[currency, locale]
|
|
18490
18540
|
);
|
|
18491
|
-
const stepsRef =
|
|
18492
|
-
const analyzeSite =
|
|
18541
|
+
const stepsRef = React122.useRef([]);
|
|
18542
|
+
const analyzeSite = React122.useMemo(
|
|
18493
18543
|
() => createSiteAnalyzer({
|
|
18494
18544
|
apiBaseUrl: resolveFayzApiBaseUrl(),
|
|
18495
18545
|
steps: () => stepsRef.current,
|
|
@@ -18497,7 +18547,7 @@ function WorkspaceSetupFlow({
|
|
|
18497
18547
|
}),
|
|
18498
18548
|
[locale]
|
|
18499
18549
|
);
|
|
18500
|
-
const steps =
|
|
18550
|
+
const steps = React122.useMemo(
|
|
18501
18551
|
() => buildWorkspaceSetupSteps({
|
|
18502
18552
|
verticalId,
|
|
18503
18553
|
uploadLogo,
|
|
@@ -18509,13 +18559,13 @@ function WorkspaceSetupFlow({
|
|
|
18509
18559
|
[verticalId, uploadLogo, media, country, analyzeSite]
|
|
18510
18560
|
);
|
|
18511
18561
|
stepsRef.current = steps;
|
|
18512
|
-
const initialValues2 =
|
|
18562
|
+
const initialValues2 = React122.useMemo(
|
|
18513
18563
|
// Seeding the contact email with the account's own is one field fewer to
|
|
18514
18564
|
// type, and it is right far more often than it is wrong.
|
|
18515
18565
|
() => user?.email ? { "workspace.email": user.email } : {},
|
|
18516
18566
|
[user?.email]
|
|
18517
18567
|
);
|
|
18518
|
-
const onSubmit =
|
|
18568
|
+
const onSubmit = React122.useCallback(
|
|
18519
18569
|
async (values) => {
|
|
18520
18570
|
if (!user) throw new Error(tl("You are signed out.", "Sua sess\xE3o terminou."));
|
|
18521
18571
|
const org = await submitWorkspaceSetup({
|
|
@@ -18632,16 +18682,16 @@ function GettingStartedWidget() {
|
|
|
18632
18682
|
const t = useTranslation();
|
|
18633
18683
|
const rows = useActivationStore((s) => s.rows);
|
|
18634
18684
|
const catalog = useActivationStore((s) => s.catalog);
|
|
18635
|
-
const steps =
|
|
18685
|
+
const steps = React122.useMemo(
|
|
18636
18686
|
() => selectSteps({ ...useActivationStore.getState(), rows, catalog }),
|
|
18637
18687
|
[rows, catalog]
|
|
18638
18688
|
);
|
|
18639
|
-
const onNavigate =
|
|
18689
|
+
const onNavigate = React122.useCallback((path) => {
|
|
18640
18690
|
const step = useActivationStore.getState().catalog.find((s) => s.route === path);
|
|
18641
18691
|
navigateTo(path);
|
|
18642
18692
|
if (step?.tour) useTourStore.getState().start(step.tour);
|
|
18643
18693
|
}, []);
|
|
18644
|
-
const onAskAgent =
|
|
18694
|
+
const onAskAgent = React122.useCallback((step) => {
|
|
18645
18695
|
void startGuidedRun(step.id);
|
|
18646
18696
|
}, []);
|
|
18647
18697
|
if (!rows || rows.length === 0) return null;
|
|
@@ -18666,16 +18716,16 @@ function ActivationChecklistCard({
|
|
|
18666
18716
|
}) {
|
|
18667
18717
|
const rows = useActivationStore((s) => s.rows);
|
|
18668
18718
|
const catalog = useActivationStore((s) => s.catalog);
|
|
18669
|
-
const steps =
|
|
18719
|
+
const steps = React122.useMemo(
|
|
18670
18720
|
() => selectSteps({ ...useActivationStore.getState(), rows, catalog }),
|
|
18671
18721
|
[rows, catalog]
|
|
18672
18722
|
);
|
|
18673
|
-
const onNavigate =
|
|
18723
|
+
const onNavigate = React122.useCallback((path) => {
|
|
18674
18724
|
const step = useActivationStore.getState().catalog.find((s) => s.route === path);
|
|
18675
18725
|
navigateTo(path);
|
|
18676
18726
|
if (step?.tour) useTourStore.getState().start(step.tour);
|
|
18677
18727
|
}, []);
|
|
18678
|
-
const onAskAgent =
|
|
18728
|
+
const onAskAgent = React122.useCallback((step) => {
|
|
18679
18729
|
void startGuidedRun(step.id);
|
|
18680
18730
|
}, []);
|
|
18681
18731
|
if (!rows || rows.length === 0) return null;
|
|
@@ -18695,9 +18745,62 @@ function ActivationChecklistCard({
|
|
|
18695
18745
|
}
|
|
18696
18746
|
);
|
|
18697
18747
|
}
|
|
18698
|
-
|
|
18748
|
+
function wasCompleted(storageKey2) {
|
|
18749
|
+
try {
|
|
18750
|
+
return localStorage.getItem(storageKey2) === "true";
|
|
18751
|
+
} catch {
|
|
18752
|
+
return false;
|
|
18753
|
+
}
|
|
18754
|
+
}
|
|
18755
|
+
function rememberCompleted(storageKey2) {
|
|
18756
|
+
try {
|
|
18757
|
+
localStorage.setItem(storageKey2, "true");
|
|
18758
|
+
} catch {
|
|
18759
|
+
}
|
|
18760
|
+
}
|
|
18761
|
+
function usePluginOnboardingGate(storageKey2, checkExistingData) {
|
|
18762
|
+
const checkRef = React122.useRef(checkExistingData);
|
|
18763
|
+
checkRef.current = checkExistingData;
|
|
18764
|
+
const [status, setStatus] = React122.useState(
|
|
18765
|
+
() => wasCompleted(storageKey2) ? "complete" : "checking"
|
|
18766
|
+
);
|
|
18767
|
+
React122.useEffect(() => {
|
|
18768
|
+
if (status !== "checking") return;
|
|
18769
|
+
let cancelled = false;
|
|
18770
|
+
void checkRef.current().then((hasData) => {
|
|
18771
|
+
if (cancelled) return;
|
|
18772
|
+
if (hasData) rememberCompleted(storageKey2);
|
|
18773
|
+
setStatus(hasData ? "complete" : "needed");
|
|
18774
|
+
}).catch(() => {
|
|
18775
|
+
if (!cancelled) setStatus("complete");
|
|
18776
|
+
});
|
|
18777
|
+
return () => {
|
|
18778
|
+
cancelled = true;
|
|
18779
|
+
};
|
|
18780
|
+
}, [status, storageKey2]);
|
|
18781
|
+
const complete = React122.useCallback(() => {
|
|
18782
|
+
rememberCompleted(storageKey2);
|
|
18783
|
+
setStatus("complete");
|
|
18784
|
+
}, [storageKey2]);
|
|
18785
|
+
return { status, complete };
|
|
18786
|
+
}
|
|
18787
|
+
function PluginOnboardingGateSkeleton() {
|
|
18788
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4 p-4 sm:p-6", "aria-busy": "true", "aria-label": "Carregando m\xF3dulo", children: [
|
|
18789
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
18790
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-40" }),
|
|
18791
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-32 rounded-button" })
|
|
18792
|
+
] }),
|
|
18793
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-3", children: [
|
|
18794
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-24 rounded-card" }),
|
|
18795
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-24 rounded-card" }),
|
|
18796
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-24 rounded-card" })
|
|
18797
|
+
] }),
|
|
18798
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-72 rounded-card" })
|
|
18799
|
+
] });
|
|
18800
|
+
}
|
|
18801
|
+
var WidgetSurfaceContext = React122.createContext("rail");
|
|
18699
18802
|
function useWidgetSurface() {
|
|
18700
|
-
return
|
|
18803
|
+
return React122.useContext(WidgetSurfaceContext);
|
|
18701
18804
|
}
|
|
18702
18805
|
function WidgetSlot({
|
|
18703
18806
|
zone,
|
|
@@ -18741,7 +18844,7 @@ function useNavContribution(id, entries2) {
|
|
|
18741
18844
|
const setContribution = useNavContributionsStore((s) => s.setContribution);
|
|
18742
18845
|
const clearContribution = useNavContributionsStore((s) => s.clearContribution);
|
|
18743
18846
|
const key = JSON.stringify(entries2);
|
|
18744
|
-
|
|
18847
|
+
React122.useEffect(() => {
|
|
18745
18848
|
setContribution(id, entries2);
|
|
18746
18849
|
return () => clearContribution(id);
|
|
18747
18850
|
}, [id, key]);
|
|
@@ -18811,7 +18914,7 @@ function useAppDirectory() {
|
|
|
18811
18914
|
const tenantId2 = useActiveTenantId();
|
|
18812
18915
|
const apps = useAppDirectoryStore((s) => s.apps);
|
|
18813
18916
|
const load = useAppDirectoryStore((s) => s.load);
|
|
18814
|
-
|
|
18917
|
+
React122.useEffect(() => {
|
|
18815
18918
|
if (tenantId2) void load(tenantId2, resolveAppId());
|
|
18816
18919
|
}, [tenantId2, load]);
|
|
18817
18920
|
return { apps };
|
|
@@ -18903,7 +19006,7 @@ var CSS2 = `
|
|
|
18903
19006
|
}
|
|
18904
19007
|
`;
|
|
18905
19008
|
function useWordmarkStyle() {
|
|
18906
|
-
|
|
19009
|
+
React122.useEffect(() => {
|
|
18907
19010
|
if (typeof document === "undefined") return;
|
|
18908
19011
|
const existing = document.getElementById(STYLE_ID2);
|
|
18909
19012
|
if (existing) {
|
|
@@ -19137,7 +19240,7 @@ var SWAP_CSS = `
|
|
|
19137
19240
|
}
|
|
19138
19241
|
`;
|
|
19139
19242
|
function useSwapStyle() {
|
|
19140
|
-
|
|
19243
|
+
React122.useEffect(() => {
|
|
19141
19244
|
if (typeof document === "undefined" || document.getElementById(SWAP_STYLE_ID)) return;
|
|
19142
19245
|
const el = document.createElement("style");
|
|
19143
19246
|
el.id = SWAP_STYLE_ID;
|
|
@@ -19146,9 +19249,9 @@ function useSwapStyle() {
|
|
|
19146
19249
|
}, []);
|
|
19147
19250
|
}
|
|
19148
19251
|
function AppSwitcherView({ apps, mark, logo, collapsed = false, label: label2, onSelect, brandedByTenant = false }) {
|
|
19149
|
-
const [hovered, setHovered] =
|
|
19150
|
-
const [open, setOpen] =
|
|
19151
|
-
const [pending2, setPending] =
|
|
19252
|
+
const [hovered, setHovered] = React122.useState(false);
|
|
19253
|
+
const [open, setOpen] = React122.useState(false);
|
|
19254
|
+
const [pending2, setPending] = React122.useState(null);
|
|
19152
19255
|
const active2 = hovered || open;
|
|
19153
19256
|
useSwapStyle();
|
|
19154
19257
|
const brand = /* @__PURE__ */ jsx(BrandFace, { mark, logo, collapsed });
|
|
@@ -19295,7 +19398,7 @@ function useContextualNav(nav) {
|
|
|
19295
19398
|
const setNav = useContextualNavStore((s) => s.setNav);
|
|
19296
19399
|
const clearNav = useContextualNavStore((s) => s.clearNav);
|
|
19297
19400
|
const key = nav ? JSON.stringify(nav) : null;
|
|
19298
|
-
|
|
19401
|
+
React122.useEffect(() => {
|
|
19299
19402
|
if (!nav) return;
|
|
19300
19403
|
setNav(nav);
|
|
19301
19404
|
return () => clearNav(nav.base);
|
|
@@ -19367,7 +19470,7 @@ async function findNearestUnit(units, reachable) {
|
|
|
19367
19470
|
}
|
|
19368
19471
|
var UNIT_SEARCH_THRESHOLD = 8;
|
|
19369
19472
|
function WorkspaceUnitSheet({ onClose, canCreate = true }) {
|
|
19370
|
-
const [level, setLevel] =
|
|
19473
|
+
const [level, setLevel] = React122.useState("root");
|
|
19371
19474
|
return /* @__PURE__ */ jsxs(
|
|
19372
19475
|
BottomSheet,
|
|
19373
19476
|
{
|
|
@@ -19430,9 +19533,9 @@ function WorkspaceLevel({ canCreate }) {
|
|
|
19430
19533
|
const closeSheet = useSheetClose();
|
|
19431
19534
|
const beginSwitch = useWorkspaceSwitchingStore((s) => s.begin);
|
|
19432
19535
|
const openSetup = useWorkspaceSetupStore((s) => s.open);
|
|
19433
|
-
const [query, setQuery] =
|
|
19536
|
+
const [query, setQuery] = React122.useState("");
|
|
19434
19537
|
const org = tenant?.org ?? null;
|
|
19435
|
-
const options =
|
|
19538
|
+
const options = React122.useMemo(() => {
|
|
19436
19539
|
const list = tenant?.userOrgs ?? [];
|
|
19437
19540
|
if (list.length) return list;
|
|
19438
19541
|
return org ? [{ orgId: org.id, orgName: org.name, orgSlug: org.slug, orgLogoUrl: org.logoUrl }] : [];
|
|
@@ -19441,7 +19544,7 @@ function WorkspaceLevel({ canCreate }) {
|
|
|
19441
19544
|
const v = t.t(key);
|
|
19442
19545
|
return !v || v === key ? fallback : v;
|
|
19443
19546
|
};
|
|
19444
|
-
const search =
|
|
19547
|
+
const search = React122.useMemo(
|
|
19445
19548
|
() => searchWorkspaces(options, query, org?.id),
|
|
19446
19549
|
[options, query, org?.id]
|
|
19447
19550
|
);
|
|
@@ -19493,8 +19596,8 @@ function WorkspaceLevel({ canCreate }) {
|
|
|
19493
19596
|
function UnitLevel() {
|
|
19494
19597
|
useUnitBootstrap();
|
|
19495
19598
|
const closeSheet = useSheetClose();
|
|
19496
|
-
const [locating, setLocating] =
|
|
19497
|
-
const [query, setQuery] =
|
|
19599
|
+
const [locating, setLocating] = React122.useState(false);
|
|
19600
|
+
const [query, setQuery] = React122.useState("");
|
|
19498
19601
|
const units = useUnitStore((s) => s.units);
|
|
19499
19602
|
const tree = useUnitStore((s) => s.tree);
|
|
19500
19603
|
const byId = useUnitStore((s) => s.byId);
|
|
@@ -19531,7 +19634,7 @@ function UnitLevel() {
|
|
|
19531
19634
|
const leaves = node.children.filter((c) => c.kind !== "region" && reachable.includes(c.id));
|
|
19532
19635
|
const regions = node.children.filter((c) => c.kind === "region");
|
|
19533
19636
|
if (leaves.length === 0 && regions.length === 0) return null;
|
|
19534
|
-
return /* @__PURE__ */ jsxs(
|
|
19637
|
+
return /* @__PURE__ */ jsxs(React122.Fragment, { children: [
|
|
19535
19638
|
/* @__PURE__ */ jsx("p", { className: "px-4 pb-1 pt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: node.name }),
|
|
19536
19639
|
leaves.length > 0 && /* @__PURE__ */ jsx(SheetCard, { children: leaves.map(leaf) }),
|
|
19537
19640
|
regions.map(group)
|
|
@@ -19601,7 +19704,7 @@ function UnitLevel() {
|
|
|
19601
19704
|
}
|
|
19602
19705
|
function WorkspaceUnitRow({ canCreate = true }) {
|
|
19603
19706
|
useUnitBootstrap();
|
|
19604
|
-
const [open, setOpen] =
|
|
19707
|
+
const [open, setOpen] = React122.useState(false);
|
|
19605
19708
|
const tenant = useTenantOptional();
|
|
19606
19709
|
const org = tenant?.org ?? null;
|
|
19607
19710
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
@@ -19788,10 +19891,10 @@ function SeuSiteWidget({ fallback, onEdit }) {
|
|
|
19788
19891
|
const load = useFayzProjectsStore((s) => s.load);
|
|
19789
19892
|
const loadedFor = useFayzProjectsStore((s) => s.loadedFor);
|
|
19790
19893
|
const collapsed = useLayoutStore((s) => s.sidebarCollapsed);
|
|
19791
|
-
const [selectedId, setSelectedId] =
|
|
19792
|
-
const [hovered, setHovered] =
|
|
19793
|
-
const [primed, setPrimed] =
|
|
19794
|
-
const closeTimer =
|
|
19894
|
+
const [selectedId, setSelectedId] = React122.useState(null);
|
|
19895
|
+
const [hovered, setHovered] = React122.useState(false);
|
|
19896
|
+
const [primed, setPrimed] = React122.useState(false);
|
|
19897
|
+
const closeTimer = React122.useRef(null);
|
|
19795
19898
|
const cancelClose = () => {
|
|
19796
19899
|
if (closeTimer.current) {
|
|
19797
19900
|
clearTimeout(closeTimer.current);
|
|
@@ -19807,8 +19910,8 @@ function SeuSiteWidget({ fallback, onEdit }) {
|
|
|
19807
19910
|
cancelClose();
|
|
19808
19911
|
closeTimer.current = setTimeout(() => setHovered(false), 140);
|
|
19809
19912
|
};
|
|
19810
|
-
|
|
19811
|
-
|
|
19913
|
+
React122.useEffect(() => () => cancelClose(), []);
|
|
19914
|
+
React122.useEffect(() => {
|
|
19812
19915
|
if (loadedFor !== (currentOrgId ?? null)) void load(currentOrgId);
|
|
19813
19916
|
}, [currentOrgId, loadedFor, load]);
|
|
19814
19917
|
const active2 = projects.find((p) => p.id === selectedId) ?? defaultProjectOf(projects) ?? synthFromFallback(fallback);
|
|
@@ -19919,10 +20022,10 @@ function SitePreview({
|
|
|
19919
20022
|
onEdit,
|
|
19920
20023
|
tr
|
|
19921
20024
|
}) {
|
|
19922
|
-
const [nonce, setNonce] =
|
|
19923
|
-
const [loading, setLoading] =
|
|
20025
|
+
const [nonce, setNonce] = React122.useState(0);
|
|
20026
|
+
const [loading, setLoading] = React122.useState(true);
|
|
19924
20027
|
const url = previewSourceOf(project);
|
|
19925
|
-
|
|
20028
|
+
React122.useEffect(() => {
|
|
19926
20029
|
setLoading(true);
|
|
19927
20030
|
}, [nonce, url]);
|
|
19928
20031
|
const action = "flex items-center gap-1.5 rounded-button px-2 py-1 text-[11.5px] font-medium text-sidebar-foreground/80 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground disabled:cursor-not-allowed disabled:opacity-40";
|
|
@@ -20032,10 +20135,10 @@ function RightRail({ frame = true, attached = true }) {
|
|
|
20032
20135
|
const pageOpen = useRightRailStore((s) => s.pageOpen);
|
|
20033
20136
|
const setPageSlot = useRightRailStore((s) => s.setPageSlot);
|
|
20034
20137
|
const setWidth = useRightRailStore((s) => s.setWidth);
|
|
20035
|
-
const rootRef =
|
|
20036
|
-
const [actionsSlot, setActionsSlot] =
|
|
20037
|
-
const [leadingSlot, setLeadingSlot] =
|
|
20038
|
-
|
|
20138
|
+
const rootRef = React122.useRef(null);
|
|
20139
|
+
const [actionsSlot, setActionsSlot] = React122.useState(null);
|
|
20140
|
+
const [leadingSlot, setLeadingSlot] = React122.useState(null);
|
|
20141
|
+
React122.useEffect(() => {
|
|
20039
20142
|
if (!open) return;
|
|
20040
20143
|
const el = rootRef.current;
|
|
20041
20144
|
if (!el) return;
|
|
@@ -20057,8 +20160,8 @@ function RightRail({ frame = true, attached = true }) {
|
|
|
20057
20160
|
el.removeEventListener("transitionend", publish);
|
|
20058
20161
|
};
|
|
20059
20162
|
}, [open, setWidth]);
|
|
20060
|
-
const [narrow, setNarrow] =
|
|
20061
|
-
|
|
20163
|
+
const [narrow, setNarrow] = React122.useState(false);
|
|
20164
|
+
React122.useEffect(() => {
|
|
20062
20165
|
if (!open) return;
|
|
20063
20166
|
const el = rootRef.current;
|
|
20064
20167
|
if (!el) return;
|
|
@@ -20412,9 +20515,9 @@ var TYPE_COLORS = {
|
|
|
20412
20515
|
fix: "text-success"
|
|
20413
20516
|
};
|
|
20414
20517
|
function ChangelogFeed({ changelogUrl, className }) {
|
|
20415
|
-
const [entries2, setEntries] =
|
|
20416
|
-
const [loading, setLoading] =
|
|
20417
|
-
|
|
20518
|
+
const [entries2, setEntries] = React122.useState([]);
|
|
20519
|
+
const [loading, setLoading] = React122.useState(false);
|
|
20520
|
+
React122.useEffect(() => {
|
|
20418
20521
|
if (!changelogUrl) return;
|
|
20419
20522
|
setLoading(true);
|
|
20420
20523
|
fetch(changelogUrl).then((r) => r.json()).then((data) => setEntries(data)).catch(() => setEntries([])).finally(() => setLoading(false));
|
|
@@ -20474,7 +20577,7 @@ function NotificationInbox({
|
|
|
20474
20577
|
changelogUrl,
|
|
20475
20578
|
className
|
|
20476
20579
|
}) {
|
|
20477
|
-
const [activeTab, setActiveTab] =
|
|
20580
|
+
const [activeTab, setActiveTab] = React122.useState("inbox");
|
|
20478
20581
|
const unreadCount = notifications.filter((n) => !n.read).length;
|
|
20479
20582
|
const inboxNotifications = notifications.filter((n) => n.category !== "changelog");
|
|
20480
20583
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex w-80 flex-col", className), children: [
|
|
@@ -20571,11 +20674,11 @@ function NotificationInbox({
|
|
|
20571
20674
|
}
|
|
20572
20675
|
function BrandAgentSurface() {
|
|
20573
20676
|
const org = useOrganizationStore((s) => s.currentOrg);
|
|
20574
|
-
const brand =
|
|
20677
|
+
const brand = React122__default.useMemo(
|
|
20575
20678
|
() => normalizeBrand(org?.settings?.branding, { name: org?.name, logoUrl: org?.logoUrl }),
|
|
20576
20679
|
[org?.settings, org?.name, org?.logoUrl]
|
|
20577
20680
|
);
|
|
20578
|
-
const surface =
|
|
20681
|
+
const surface = React122__default.useMemo(() => ({
|
|
20579
20682
|
id: "core.brand",
|
|
20580
20683
|
describe: () => ({
|
|
20581
20684
|
title: "Marca da casa",
|
|
@@ -20588,15 +20691,15 @@ function BrandAgentSurface() {
|
|
|
20588
20691
|
return null;
|
|
20589
20692
|
}
|
|
20590
20693
|
function ConnectConsentPage({ appName, logo }) {
|
|
20591
|
-
const [state, setState] =
|
|
20592
|
-
const [tenantId2, setTenantId] =
|
|
20593
|
-
const request =
|
|
20694
|
+
const [state, setState] = React122__default.useState({ status: "loading" });
|
|
20695
|
+
const [tenantId2, setTenantId] = React122__default.useState("");
|
|
20696
|
+
const request = React122__default.useMemo(
|
|
20594
20697
|
() => new URLSearchParams(window.location.search).get("request") ?? "",
|
|
20595
20698
|
[]
|
|
20596
20699
|
);
|
|
20597
|
-
const connection =
|
|
20700
|
+
const connection = React122__default.useMemo(() => resolveFayzAgentConnection(), []);
|
|
20598
20701
|
const product = appName ?? document.title ?? "este app";
|
|
20599
|
-
const authorizedFetch =
|
|
20702
|
+
const authorizedFetch = React122__default.useCallback(
|
|
20600
20703
|
async (path, init) => {
|
|
20601
20704
|
if (!connection) throw new Error("Este app n\xE3o est\xE1 ligado a um projeto Fayz.");
|
|
20602
20705
|
const supabase = getFayzSupabaseClientOptional();
|
|
@@ -20620,7 +20723,7 @@ function ConnectConsentPage({ appName, logo }) {
|
|
|
20620
20723
|
},
|
|
20621
20724
|
[connection]
|
|
20622
20725
|
);
|
|
20623
|
-
|
|
20726
|
+
React122__default.useEffect(() => {
|
|
20624
20727
|
let cancelled = false;
|
|
20625
20728
|
(async () => {
|
|
20626
20729
|
if (!request) {
|
|
@@ -20864,7 +20967,7 @@ function Row2({ label: label2, value }) {
|
|
|
20864
20967
|
function PageActions({ actions, className }) {
|
|
20865
20968
|
const access = useAccessOptional();
|
|
20866
20969
|
const openUpgrade = useUpgradeModalStore((s) => s.open);
|
|
20867
|
-
const resolved =
|
|
20970
|
+
const resolved = React122__default.useMemo(
|
|
20868
20971
|
() => actions.map((a) => {
|
|
20869
20972
|
const { permission, limitKey, onSelect, ...rest } = a;
|
|
20870
20973
|
let hidden = false;
|
|
@@ -20894,25 +20997,25 @@ function AddConnectorPanel({
|
|
|
20894
20997
|
onSelect
|
|
20895
20998
|
}) {
|
|
20896
20999
|
const { t } = useTranslation$1();
|
|
20897
|
-
const [query, setQuery] =
|
|
21000
|
+
const [query, setQuery] = React122__default.useState("");
|
|
20898
21001
|
const modules = useInstalledModuleIds();
|
|
20899
21002
|
const catalog = useConnectorCatalog();
|
|
20900
21003
|
const scoped = !!categories?.length;
|
|
20901
|
-
const addable =
|
|
21004
|
+
const addable = React122__default.useMemo(
|
|
20902
21005
|
() => inCategories(addableConnectors(connectors ?? []), categories),
|
|
20903
21006
|
[connectors, categories]
|
|
20904
21007
|
);
|
|
20905
|
-
const shelf =
|
|
21008
|
+
const shelf = React122__default.useMemo(() => {
|
|
20906
21009
|
if (connectors === null) return [];
|
|
20907
21010
|
return inCategories(
|
|
20908
21011
|
shelfIntegrations({ present: connectors, installedModules: modules, catalog: catalog ?? [] }),
|
|
20909
21012
|
categories
|
|
20910
21013
|
);
|
|
20911
21014
|
}, [connectors, modules, catalog, categories]);
|
|
20912
|
-
const filtered =
|
|
20913
|
-
const filteredShelf =
|
|
20914
|
-
const soon =
|
|
20915
|
-
const elsewhere =
|
|
21015
|
+
const filtered = React122__default.useMemo(() => filterConnectors(addable, "all", query), [addable, query]);
|
|
21016
|
+
const filteredShelf = React122__default.useMemo(() => filterAvailable(shelf, query), [shelf, query]);
|
|
21017
|
+
const soon = React122__default.useMemo(() => comingSoonHere(filteredShelf), [filteredShelf]);
|
|
21018
|
+
const elsewhere = React122__default.useMemo(() => withAnotherModule(filteredShelf), [filteredShelf]);
|
|
20916
21019
|
const searchable = addable.length + shelf.length > 6;
|
|
20917
21020
|
return /* @__PURE__ */ jsx(Modal, { open, onOpenChange, children: /* @__PURE__ */ jsxs(ModalContent, { size: "2xl", children: [
|
|
20918
21021
|
/* @__PURE__ */ jsxs(ModalHeader, { children: [
|
|
@@ -21071,22 +21174,22 @@ function AddConnectorButton({ onClick }) {
|
|
|
21071
21174
|
function ConnectorsTab() {
|
|
21072
21175
|
const { t } = useTranslation$1();
|
|
21073
21176
|
const { connectors, error, reload, revokeGrant, agentAvailable, tenantReady } = useConnectors();
|
|
21074
|
-
const [adding, setAdding] =
|
|
21075
|
-
const [selected, setSelected] =
|
|
21076
|
-
const [filter, setFilter] =
|
|
21077
|
-
const [failure, setFailure] =
|
|
21078
|
-
const [revoking, setRevoking] =
|
|
21177
|
+
const [adding, setAdding] = React122__default.useState(false);
|
|
21178
|
+
const [selected, setSelected] = React122__default.useState(null);
|
|
21179
|
+
const [filter, setFilter] = React122__default.useState("all");
|
|
21180
|
+
const [failure, setFailure] = React122__default.useState(null);
|
|
21181
|
+
const [revoking, setRevoking] = React122__default.useState(null);
|
|
21079
21182
|
const assistantAvailable = useConnectorsPanelAvailable();
|
|
21080
|
-
const openJourney =
|
|
21183
|
+
const openJourney = React122__default.useCallback(
|
|
21081
21184
|
(connector) => {
|
|
21082
21185
|
if (assistantAvailable) openConnectorsPanel(connector);
|
|
21083
21186
|
else setSelected(connector);
|
|
21084
21187
|
},
|
|
21085
21188
|
[assistantAvailable]
|
|
21086
21189
|
);
|
|
21087
|
-
const visible =
|
|
21088
|
-
const groups =
|
|
21089
|
-
|
|
21190
|
+
const visible = React122__default.useMemo(() => filterConnectors(connectors ?? [], filter), [connectors, filter]);
|
|
21191
|
+
const groups = React122__default.useMemo(() => groupConnectors(visible), [visible]);
|
|
21192
|
+
React122__default.useEffect(() => {
|
|
21090
21193
|
if (!selected || !connectors) return;
|
|
21091
21194
|
const fresh = connectors.find((c) => c.id === selected.id);
|
|
21092
21195
|
if (fresh && fresh !== selected) setSelected(fresh);
|
|
@@ -21121,7 +21224,7 @@ function ConnectorsTab() {
|
|
|
21121
21224
|
(connectors?.length ?? 0) > 4 && /* @__PURE__ */ jsx(Filters, { value: filter, onChange: setFilter }),
|
|
21122
21225
|
connectors === null && /* @__PURE__ */ jsx(ConnectionsSkeleton, {}),
|
|
21123
21226
|
connectors !== null && visible.length === 0 && /* @__PURE__ */ jsx(Empty2, { title: t("connectors.emptyTitle"), body: t("connectors.emptyBody") }),
|
|
21124
|
-
visible.length > 0 && /* @__PURE__ */ jsx("ul", { className: "fayz-glass-surface divide-y divide-border overflow-hidden rounded-card border bg-card text-card-foreground shadow-sm", children: groups.map((group) => /* @__PURE__ */ jsxs(
|
|
21227
|
+
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(React122__default.Fragment, { children: [
|
|
21125
21228
|
groups.length > 1 && /* @__PURE__ */ jsx(
|
|
21126
21229
|
"li",
|
|
21127
21230
|
{
|
|
@@ -21259,7 +21362,7 @@ function oauthFailureMessage(t, result) {
|
|
|
21259
21362
|
function useConnectorOAuthReturn() {
|
|
21260
21363
|
const { t } = useTranslation$1();
|
|
21261
21364
|
const runtime = usePluginRuntimeOptional();
|
|
21262
|
-
|
|
21365
|
+
React122__default.useEffect(() => {
|
|
21263
21366
|
if (typeof window === "undefined") return;
|
|
21264
21367
|
const result = readConnectorOAuthReturn(window.location.search);
|
|
21265
21368
|
if (!result) return;
|
|
@@ -21294,8 +21397,8 @@ function ConnectorDeliveries({
|
|
|
21294
21397
|
limit = 10
|
|
21295
21398
|
}) {
|
|
21296
21399
|
const { t } = useTranslation$1();
|
|
21297
|
-
const [rows, setRows] =
|
|
21298
|
-
|
|
21400
|
+
const [rows, setRows] = React122__default.useState(null);
|
|
21401
|
+
React122__default.useEffect(() => {
|
|
21299
21402
|
let cancelled = false;
|
|
21300
21403
|
void load({ limit }).then((r) => {
|
|
21301
21404
|
if (!cancelled) setRows(r);
|
|
@@ -21369,11 +21472,11 @@ var CURRENCIES = [
|
|
|
21369
21472
|
function CompanySettings({ tenant, onSave }) {
|
|
21370
21473
|
const { t } = useTranslation$1();
|
|
21371
21474
|
const { locale: uiLocale, setLocale: setUiLocale } = useLocaleStore();
|
|
21372
|
-
const [name, setName] =
|
|
21373
|
-
const [timezone, setTimezone] =
|
|
21374
|
-
const [currency, setCurrency] =
|
|
21375
|
-
const [saving, setSaving] =
|
|
21376
|
-
|
|
21475
|
+
const [name, setName] = React122.useState(tenant?.name ?? "");
|
|
21476
|
+
const [timezone, setTimezone] = React122.useState(tenant?.settings?.timezone ?? "UTC");
|
|
21477
|
+
const [currency, setCurrency] = React122.useState(tenant?.settings?.currency ?? "USD");
|
|
21478
|
+
const [saving, setSaving] = React122.useState(false);
|
|
21479
|
+
React122.useEffect(() => {
|
|
21377
21480
|
if (tenant) {
|
|
21378
21481
|
setName(tenant.name);
|
|
21379
21482
|
setTimezone(tenant.settings?.timezone ?? "UTC");
|
|
@@ -21465,15 +21568,15 @@ function UnitModeCard() {
|
|
|
21465
21568
|
const units = useUnitStore((s) => s.units);
|
|
21466
21569
|
const setMode = useUnitStore((s) => s.setMode);
|
|
21467
21570
|
const load = useUnitStore((s) => s.load);
|
|
21468
|
-
const [unbound, setUnbound] =
|
|
21469
|
-
const [bindEveryone, setBindEveryone] =
|
|
21470
|
-
const [pending2, setPending] =
|
|
21471
|
-
const [saving, setSaving] =
|
|
21472
|
-
const headquarters =
|
|
21571
|
+
const [unbound, setUnbound] = React122.useState(null);
|
|
21572
|
+
const [bindEveryone, setBindEveryone] = React122.useState(true);
|
|
21573
|
+
const [pending2, setPending] = React122.useState(null);
|
|
21574
|
+
const [saving, setSaving] = React122.useState(false);
|
|
21575
|
+
const headquarters = React122.useMemo(
|
|
21473
21576
|
() => units.find((u) => u.isHeadquarters && u.kind !== "region") ?? units.find((u) => u.kind !== "region"),
|
|
21474
21577
|
[units]
|
|
21475
21578
|
);
|
|
21476
|
-
|
|
21579
|
+
React122.useEffect(() => {
|
|
21477
21580
|
if (!org?.id || unitMode) return;
|
|
21478
21581
|
let alive = true;
|
|
21479
21582
|
void countUnboundMembers(org.id).then((n) => {
|
|
@@ -21637,10 +21740,10 @@ function getInitials(name) {
|
|
|
21637
21740
|
}
|
|
21638
21741
|
function UserProfile({ user, onSave, onAvatarChange }) {
|
|
21639
21742
|
const { t } = useTranslation$1();
|
|
21640
|
-
const [fullName, setFullName] =
|
|
21641
|
-
const [saving, setSaving] =
|
|
21642
|
-
const fileInputRef =
|
|
21643
|
-
|
|
21743
|
+
const [fullName, setFullName] = React122.useState(user?.fullName ?? "");
|
|
21744
|
+
const [saving, setSaving] = React122.useState(false);
|
|
21745
|
+
const fileInputRef = React122.useRef(null);
|
|
21746
|
+
React122.useEffect(() => {
|
|
21644
21747
|
if (user) {
|
|
21645
21748
|
setFullName(user.fullName);
|
|
21646
21749
|
}
|
|
@@ -21780,8 +21883,8 @@ async function fetchMyPersonId(tenantId2, userId) {
|
|
|
21780
21883
|
function useMyPersonId(enabled = true) {
|
|
21781
21884
|
const orgId = useOrganizationStore((s) => s.currentOrg?.id);
|
|
21782
21885
|
const userId = useAuthStore((s) => s.user?.id);
|
|
21783
|
-
const [personId, setPersonId] =
|
|
21784
|
-
|
|
21886
|
+
const [personId, setPersonId] = React122.useState(void 0);
|
|
21887
|
+
React122.useEffect(() => {
|
|
21785
21888
|
if (!enabled || !orgId || !userId) return;
|
|
21786
21889
|
let alive = true;
|
|
21787
21890
|
void dedup(`self:person:${orgId}:${userId}`, () => fetchMyPersonId(orgId, userId)).then((id) => {
|
|
@@ -21841,18 +21944,18 @@ function MyWorkspaceCard() {
|
|
|
21841
21944
|
const myUnitIds = useUnitStore((s) => s.myUnitIds);
|
|
21842
21945
|
const activeUnitId = useUnitStore((s) => s.activeUnitId);
|
|
21843
21946
|
const entryReason = useUnitStore((s) => s.entryReason);
|
|
21844
|
-
const [person, setPerson] =
|
|
21845
|
-
const [candidate, setCandidate] =
|
|
21846
|
-
const [linking, setLinking] =
|
|
21947
|
+
const [person, setPerson] = React122.useState(void 0);
|
|
21948
|
+
const [candidate, setCandidate] = React122.useState(null);
|
|
21949
|
+
const [linking, setLinking] = React122.useState(false);
|
|
21847
21950
|
const orgId = currentOrg?.id;
|
|
21848
21951
|
const userId = user?.id;
|
|
21849
|
-
const load =
|
|
21952
|
+
const load = React122.useCallback(async () => {
|
|
21850
21953
|
if (!orgId || !userId) return;
|
|
21851
21954
|
const linked = await fetchMyPersonRecord(orgId, userId);
|
|
21852
21955
|
setPerson(linked);
|
|
21853
21956
|
setCandidate(linked ? null : await findMyPersonCandidate(orgId, user?.email, staffKinds));
|
|
21854
21957
|
}, [orgId, userId, user?.email, staffKinds]);
|
|
21855
|
-
|
|
21958
|
+
React122.useEffect(() => {
|
|
21856
21959
|
void load();
|
|
21857
21960
|
}, [load]);
|
|
21858
21961
|
if (!currentOrg) return null;
|
|
@@ -21946,10 +22049,10 @@ var useStore = create((set) => ({
|
|
|
21946
22049
|
function useHeaderAction(zone, action) {
|
|
21947
22050
|
const register = useStore((s) => s.register);
|
|
21948
22051
|
const unregister = useStore((s) => s.unregister);
|
|
21949
|
-
const latest =
|
|
22052
|
+
const latest = React122.useRef(action);
|
|
21950
22053
|
latest.current = action;
|
|
21951
22054
|
const id = action?.id;
|
|
21952
|
-
|
|
22055
|
+
React122.useEffect(() => {
|
|
21953
22056
|
if (!zone || !id) return;
|
|
21954
22057
|
const current2 = latest.current;
|
|
21955
22058
|
if (current2) register(zone, { ...current2, onSelect: () => latest.current?.onSelect() });
|
|
@@ -21958,7 +22061,7 @@ function useHeaderAction(zone, action) {
|
|
|
21958
22061
|
}
|
|
21959
22062
|
function useHeaderActions(zone) {
|
|
21960
22063
|
const byZone = useStore((s) => s.byZone);
|
|
21961
|
-
return
|
|
22064
|
+
return React122.useMemo(() => Object.values(byZone[zone] ?? {}), [byZone, zone]);
|
|
21962
22065
|
}
|
|
21963
22066
|
function useUserLabel(userId) {
|
|
21964
22067
|
const members = useOrganizationStore((s) => s.members);
|
|
@@ -22688,7 +22791,7 @@ function SubjectFormLayout({ fields, allFields, fieldGroups, values, onChange, r
|
|
|
22688
22791
|
const IconComponent = getLucideIcon(entityIcon ?? "Heart") ?? Heart;
|
|
22689
22792
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
22690
22793
|
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, { className: "pt-5", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-5", children: [
|
|
22691
|
-
/* @__PURE__ */ jsx("div", { className: "flex h-20 w-20 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary", children:
|
|
22794
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-20 w-20 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary", children: React122__default.createElement(IconComponent, { className: "h-8 w-8" }) }),
|
|
22692
22795
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-4", children: [
|
|
22693
22796
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4", children: [
|
|
22694
22797
|
nameField && /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-1.5", children: [
|
|
@@ -23147,14 +23250,14 @@ function ImageSlot({
|
|
|
23147
23250
|
onDraftFile
|
|
23148
23251
|
}) {
|
|
23149
23252
|
const t = useTranslation();
|
|
23150
|
-
const inputRef =
|
|
23151
|
-
const [url, setUrl] =
|
|
23152
|
-
const [busy, setBusy] =
|
|
23153
|
-
const [error, setError] =
|
|
23154
|
-
const draftUrlRef =
|
|
23253
|
+
const inputRef = React122__default.useRef(null);
|
|
23254
|
+
const [url, setUrl] = React122__default.useState(() => image.get(row));
|
|
23255
|
+
const [busy, setBusy] = React122__default.useState(false);
|
|
23256
|
+
const [error, setError] = React122__default.useState(null);
|
|
23257
|
+
const draftUrlRef = React122__default.useRef(null);
|
|
23155
23258
|
const currentUrl = image.get(row);
|
|
23156
23259
|
const draftFile = image.draftField ? row[image.draftField] : void 0;
|
|
23157
|
-
|
|
23260
|
+
React122__default.useEffect(() => {
|
|
23158
23261
|
if (draftFile) return;
|
|
23159
23262
|
if (draftUrlRef.current) {
|
|
23160
23263
|
URL.revokeObjectURL(draftUrlRef.current);
|
|
@@ -23162,7 +23265,7 @@ function ImageSlot({
|
|
|
23162
23265
|
}
|
|
23163
23266
|
setUrl(currentUrl);
|
|
23164
23267
|
}, [currentUrl, draftFile]);
|
|
23165
|
-
|
|
23268
|
+
React122__default.useEffect(() => () => {
|
|
23166
23269
|
if (draftUrlRef.current) URL.revokeObjectURL(draftUrlRef.current);
|
|
23167
23270
|
}, []);
|
|
23168
23271
|
const acceptsDraft = !canEdit && Boolean(image.draftField && onDraftFile);
|
|
@@ -23280,7 +23383,7 @@ function CrudFormPage({ entityDef, mode, initialData, onSubmit, onCancel, namePl
|
|
|
23280
23383
|
const [values, setValues] = useState(computeInit);
|
|
23281
23384
|
const [saving, setSaving] = useState(false);
|
|
23282
23385
|
const [invalidKeys, setInvalidKeys] = useState(EMPTY_KEYS);
|
|
23283
|
-
const initialRef =
|
|
23386
|
+
const initialRef = React122__default.useRef(JSON.stringify(values));
|
|
23284
23387
|
useEffect(() => {
|
|
23285
23388
|
const init = computeInit();
|
|
23286
23389
|
setValues(init);
|
|
@@ -23325,7 +23428,7 @@ function CrudFormPage({ entityDef, mode, initialData, onSubmit, onCancel, namePl
|
|
|
23325
23428
|
if (submitRef) submitRef.current = () => {
|
|
23326
23429
|
void submit();
|
|
23327
23430
|
};
|
|
23328
|
-
|
|
23431
|
+
React122__default.useEffect(() => () => {
|
|
23329
23432
|
if (submitRef) submitRef.current = null;
|
|
23330
23433
|
}, [submitRef]);
|
|
23331
23434
|
const dirty = JSON.stringify(values) !== initialRef.current;
|
|
@@ -23925,7 +24028,7 @@ function CrudListView({
|
|
|
23925
24028
|
if (onImport) {
|
|
23926
24029
|
createRoutes.push({ id: "import", label: t("crud.import.action"), description: t("crud.import.hint"), icon: "Upload", action: onImport });
|
|
23927
24030
|
}
|
|
23928
|
-
const createActions =
|
|
24031
|
+
const createActions = React122__default.useMemo(() => {
|
|
23929
24032
|
const out = createRoutes.map((qa, i) => ({
|
|
23930
24033
|
id: qa.id,
|
|
23931
24034
|
label: qa.label,
|
|
@@ -24329,9 +24432,9 @@ function buildCrudSurfaceContribution(read3) {
|
|
|
24329
24432
|
};
|
|
24330
24433
|
}
|
|
24331
24434
|
function CrudAgentSurface(props) {
|
|
24332
|
-
const ref =
|
|
24435
|
+
const ref = React122.useRef(props);
|
|
24333
24436
|
ref.current = props;
|
|
24334
|
-
const contribution =
|
|
24437
|
+
const contribution = React122.useMemo(
|
|
24335
24438
|
() => buildCrudSurfaceContribution(() => ref.current),
|
|
24336
24439
|
[]
|
|
24337
24440
|
);
|
|
@@ -24382,8 +24485,8 @@ function useFieldRules(entityKey) {
|
|
|
24382
24485
|
};
|
|
24383
24486
|
}, [entityKey, fieldRules]);
|
|
24384
24487
|
}
|
|
24385
|
-
var ImportWizard2 =
|
|
24386
|
-
() => import('./ImportWizard-
|
|
24488
|
+
var ImportWizard2 = React122__default.lazy(
|
|
24489
|
+
() => import('./ImportWizard-7UFB2PPF.js').then((m) => ({ default: m.ImportWizard }))
|
|
24387
24490
|
);
|
|
24388
24491
|
var PAGE_SIZE = 50;
|
|
24389
24492
|
function getRouteDepth(sub) {
|
|
@@ -24867,7 +24970,7 @@ function CrudPage({ entityDef: rawEntityDef, useStore: useStore2, basePath, disp
|
|
|
24867
24970
|
displayValue: deleteItem ? deleteItem[displayField] : void 0
|
|
24868
24971
|
}
|
|
24869
24972
|
),
|
|
24870
|
-
/* @__PURE__ */ jsx(
|
|
24973
|
+
/* @__PURE__ */ jsx(React122__default.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
|
|
24871
24974
|
ImportWizard2,
|
|
24872
24975
|
{
|
|
24873
24976
|
open: importOpen,
|
|
@@ -25173,7 +25276,7 @@ function columnOf(entity, key) {
|
|
|
25173
25276
|
function RelatedListTab({ item, related }) {
|
|
25174
25277
|
const parentId = item?.id;
|
|
25175
25278
|
const pathname = useHashPath();
|
|
25176
|
-
const Page =
|
|
25279
|
+
const Page = React122.useMemo(() => {
|
|
25177
25280
|
if (!parentId) return null;
|
|
25178
25281
|
const child = related.entity;
|
|
25179
25282
|
const fkColumn = columnOf(child, related.foreignKey);
|
|
@@ -25200,8 +25303,8 @@ function tabBasePath(pathname, tabId) {
|
|
|
25200
25303
|
}
|
|
25201
25304
|
function useHashPath() {
|
|
25202
25305
|
const read3 = () => typeof window === "undefined" ? "/" : window.location.hash.slice(1) || "/";
|
|
25203
|
-
const [path, setPath] =
|
|
25204
|
-
|
|
25306
|
+
const [path, setPath] = React122.useState(read3);
|
|
25307
|
+
React122.useEffect(() => {
|
|
25205
25308
|
const handler = () => setPath(read3());
|
|
25206
25309
|
window.addEventListener("hashchange", handler);
|
|
25207
25310
|
return () => window.removeEventListener("hashchange", handler);
|
|
@@ -25591,30 +25694,30 @@ function AccessTab({ item }) {
|
|
|
25591
25694
|
const hasSystemPermission = useSystemPermission();
|
|
25592
25695
|
const canManageTeam = hasSystemPermission("manage_team");
|
|
25593
25696
|
const guardSeats = useLimitGuard("users");
|
|
25594
|
-
const [access, setAccess] =
|
|
25595
|
-
const [email, setEmail] =
|
|
25596
|
-
const [roleId, setRoleId] =
|
|
25597
|
-
const [busy, setBusy] =
|
|
25598
|
-
const [confirmRemove, setConfirmRemove] =
|
|
25599
|
-
|
|
25697
|
+
const [access, setAccess] = React122.useState(void 0);
|
|
25698
|
+
const [email, setEmail] = React122.useState(person?.email ?? "");
|
|
25699
|
+
const [roleId, setRoleId] = React122.useState("");
|
|
25700
|
+
const [busy, setBusy] = React122.useState(false);
|
|
25701
|
+
const [confirmRemove, setConfirmRemove] = React122.useState(false);
|
|
25702
|
+
React122.useEffect(() => {
|
|
25600
25703
|
if (!roleId && profiles.length) setRoleId(profiles[1]?.id ?? profiles[0].id);
|
|
25601
25704
|
}, [profiles, roleId]);
|
|
25602
|
-
|
|
25705
|
+
React122.useEffect(() => {
|
|
25603
25706
|
setEmail(person?.email ?? "");
|
|
25604
25707
|
}, [person?.email]);
|
|
25605
|
-
const reload =
|
|
25708
|
+
const reload = React122.useCallback(async () => {
|
|
25606
25709
|
if (!personId) return;
|
|
25607
25710
|
setAccess(await fetchPersonAccess(personId));
|
|
25608
25711
|
}, [personId]);
|
|
25609
|
-
|
|
25712
|
+
React122.useEffect(() => {
|
|
25610
25713
|
void reload();
|
|
25611
25714
|
}, [reload]);
|
|
25612
|
-
|
|
25715
|
+
React122.useEffect(() => {
|
|
25613
25716
|
if (!adapter || !currentOrg || invites.length > 0) return;
|
|
25614
25717
|
adapter.listInvites(currentOrg.id).then(setInvites).catch(() => {
|
|
25615
25718
|
});
|
|
25616
25719
|
}, [adapter, currentOrg?.id]);
|
|
25617
|
-
const pendingInvite =
|
|
25720
|
+
const pendingInvite = React122.useMemo(() => {
|
|
25618
25721
|
const target = (person?.email ?? "").trim().toLowerCase();
|
|
25619
25722
|
if (!target) return void 0;
|
|
25620
25723
|
return invites.find((i) => i.status === "pending" && i.email.toLowerCase() === target);
|
|
@@ -25828,11 +25931,11 @@ function PersonUnitsTab({ item }) {
|
|
|
25828
25931
|
const units = useUnitStore((s) => s.units);
|
|
25829
25932
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
25830
25933
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
25831
|
-
const [userId, setUserId] =
|
|
25832
|
-
const [bindings, setBindings] =
|
|
25833
|
-
const [busy, setBusy] =
|
|
25934
|
+
const [userId, setUserId] = React122.useState(void 0);
|
|
25935
|
+
const [bindings, setBindings] = React122.useState({});
|
|
25936
|
+
const [busy, setBusy] = React122.useState(null);
|
|
25834
25937
|
const bindingsVersion = useDataVersion(UNIT_ACCESS_CHANGED);
|
|
25835
|
-
|
|
25938
|
+
React122.useEffect(() => {
|
|
25836
25939
|
if (!personId) return;
|
|
25837
25940
|
let alive = true;
|
|
25838
25941
|
void fetchUserIdForPerson(personId).then((uid2) => {
|
|
@@ -25842,11 +25945,11 @@ function PersonUnitsTab({ item }) {
|
|
|
25842
25945
|
alive = false;
|
|
25843
25946
|
};
|
|
25844
25947
|
}, [personId]);
|
|
25845
|
-
const reload =
|
|
25948
|
+
const reload = React122.useCallback(async (uid2) => {
|
|
25846
25949
|
const rows = await fetchMemberUnits(uid2);
|
|
25847
25950
|
setBindings(Object.fromEntries(rows.map((r) => [r.locationId, r.role])));
|
|
25848
25951
|
}, []);
|
|
25849
|
-
|
|
25952
|
+
React122.useEffect(() => {
|
|
25850
25953
|
if (userId) void reload(userId);
|
|
25851
25954
|
}, [userId, reload, bindingsVersion]);
|
|
25852
25955
|
async function toggle(unitId, on) {
|
|
@@ -25941,7 +26044,123 @@ function PersonUnitsTab({ item }) {
|
|
|
25941
26044
|
] })
|
|
25942
26045
|
] }) });
|
|
25943
26046
|
}
|
|
25944
|
-
|
|
26047
|
+
function PersonAvailabilityTab({ item }) {
|
|
26048
|
+
const person = item;
|
|
26049
|
+
const personId = person?.id;
|
|
26050
|
+
const [units, setUnits] = React122.useState([]);
|
|
26051
|
+
const [selected, setSelected] = React122.useState(/* @__PURE__ */ new Set());
|
|
26052
|
+
const [loading, setLoading] = React122.useState(true);
|
|
26053
|
+
const [busy, setBusy] = React122.useState(false);
|
|
26054
|
+
const [availabilityReady, setAvailabilityReady] = React122.useState(true);
|
|
26055
|
+
const db2 = () => getSupabaseClientOptional();
|
|
26056
|
+
const load = React122.useCallback(async () => {
|
|
26057
|
+
const client3 = db2();
|
|
26058
|
+
if (!client3 || !personId) {
|
|
26059
|
+
setLoading(false);
|
|
26060
|
+
return;
|
|
26061
|
+
}
|
|
26062
|
+
setLoading(true);
|
|
26063
|
+
try {
|
|
26064
|
+
const [{ data: unitRows, error: unitError }, { data: unitIds, error: grantError }] = await Promise.all([
|
|
26065
|
+
client3.from("v_units").select("id,name,city").eq("is_active", true).order("name"),
|
|
26066
|
+
client3.rpc("people_available_unit_ids", { p_person: personId })
|
|
26067
|
+
]);
|
|
26068
|
+
if (unitError) throw unitError;
|
|
26069
|
+
setUnits(unitRows ?? []);
|
|
26070
|
+
if (grantError) {
|
|
26071
|
+
const missingRpc = grantError.code === "PGRST202" || String(grantError.message ?? "").includes("people_available_unit_ids");
|
|
26072
|
+
if (!missingRpc) throw grantError;
|
|
26073
|
+
setSelected(/* @__PURE__ */ new Set());
|
|
26074
|
+
setAvailabilityReady(false);
|
|
26075
|
+
return;
|
|
26076
|
+
}
|
|
26077
|
+
setSelected(new Set((unitIds ?? []).map((unitId) => String(unitId))));
|
|
26078
|
+
setAvailabilityReady(true);
|
|
26079
|
+
} catch (error) {
|
|
26080
|
+
toast.error("N\xE3o foi poss\xEDvel carregar as unidades", { description: error?.message });
|
|
26081
|
+
} finally {
|
|
26082
|
+
setLoading(false);
|
|
26083
|
+
}
|
|
26084
|
+
}, [personId]);
|
|
26085
|
+
React122.useEffect(() => {
|
|
26086
|
+
void load();
|
|
26087
|
+
}, [load]);
|
|
26088
|
+
async function makeOrganizationWide() {
|
|
26089
|
+
const client3 = db2();
|
|
26090
|
+
if (!client3 || !personId || busy) return;
|
|
26091
|
+
setBusy(true);
|
|
26092
|
+
try {
|
|
26093
|
+
const { error } = await client3.rpc("people_set_available_units", {
|
|
26094
|
+
p_person: personId,
|
|
26095
|
+
p_unit_ids: []
|
|
26096
|
+
});
|
|
26097
|
+
if (error) throw error;
|
|
26098
|
+
setSelected(/* @__PURE__ */ new Set());
|
|
26099
|
+
toast.success("Dispon\xEDvel em todas as unidades.");
|
|
26100
|
+
} catch (error) {
|
|
26101
|
+
toast.error("N\xE3o foi poss\xEDvel atualizar as unidades", { description: error?.message });
|
|
26102
|
+
} finally {
|
|
26103
|
+
setBusy(false);
|
|
26104
|
+
}
|
|
26105
|
+
}
|
|
26106
|
+
async function toggle(unitId, enabled) {
|
|
26107
|
+
const client3 = db2();
|
|
26108
|
+
if (!client3 || !personId || busy) return;
|
|
26109
|
+
setBusy(true);
|
|
26110
|
+
try {
|
|
26111
|
+
const next = new Set(selected);
|
|
26112
|
+
if (enabled) next.add(unitId);
|
|
26113
|
+
else next.delete(unitId);
|
|
26114
|
+
const { error } = await client3.rpc("people_set_available_units", {
|
|
26115
|
+
p_person: personId,
|
|
26116
|
+
p_unit_ids: Array.from(next)
|
|
26117
|
+
});
|
|
26118
|
+
if (error) throw error;
|
|
26119
|
+
await load();
|
|
26120
|
+
toast.success("Unidades atualizadas.");
|
|
26121
|
+
} catch (error) {
|
|
26122
|
+
toast.error("N\xE3o foi poss\xEDvel atualizar as unidades", { description: error?.message });
|
|
26123
|
+
} finally {
|
|
26124
|
+
setBusy(false);
|
|
26125
|
+
}
|
|
26126
|
+
}
|
|
26127
|
+
if (loading) {
|
|
26128
|
+
return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-2 py-6", children: [
|
|
26129
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" }),
|
|
26130
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" })
|
|
26131
|
+
] }) });
|
|
26132
|
+
}
|
|
26133
|
+
const organizationWide = selected.size === 0;
|
|
26134
|
+
return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-4 py-6", children: [
|
|
26135
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
26136
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: organizationWide ? "default" : "outline", size: "sm", onClick: () => void makeOrganizationWide(), disabled: busy || !availabilityReady, children: [
|
|
26137
|
+
/* @__PURE__ */ jsx(Globe2, { className: "mr-2 h-4 w-4" }),
|
|
26138
|
+
" Todas as unidades"
|
|
26139
|
+
] }),
|
|
26140
|
+
/* @__PURE__ */ jsx("span", { className: "self-center text-xs text-muted-foreground", children: "Marque uma unidade abaixo para restringir este cadastro." })
|
|
26141
|
+
] }),
|
|
26142
|
+
!availabilityReady ? /* @__PURE__ */ jsx("p", { role: "status", className: "rounded-lg border border-warning/40 bg-warning/5 p-3 text-xs text-muted-foreground", children: "As unidades est\xE3o vis\xEDveis, mas a distribui\xE7\xE3o deste cadastro ficar\xE1 dispon\xEDvel ap\xF3s a atualiza\xE7\xE3o do banco." }) : null,
|
|
26143
|
+
person?.unitId ? /* @__PURE__ */ jsx("p", { className: "rounded-lg border border-warning/40 bg-warning/5 p-3 text-xs text-muted-foreground", children: "Este cadastro nasceu dentro de uma unidade. A unidade de origem continua prevalecendo sobre a distribui\xE7\xE3o da rede." }) : null,
|
|
26144
|
+
units.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Nenhuma unidade cadastrada." }) : /* @__PURE__ */ jsx("div", { className: "divide-y rounded-lg border", children: units.map((unit) => /* @__PURE__ */ jsxs("label", { className: "flex cursor-pointer items-center gap-3 px-3 py-2.5 hover:bg-muted/40", children: [
|
|
26145
|
+
/* @__PURE__ */ jsx(
|
|
26146
|
+
Checkbox,
|
|
26147
|
+
{
|
|
26148
|
+
checked: selected.has(unit.id),
|
|
26149
|
+
disabled: busy || !availabilityReady,
|
|
26150
|
+
onChange: (next) => void toggle(unit.id, next),
|
|
26151
|
+
"aria-label": unit.name
|
|
26152
|
+
}
|
|
26153
|
+
),
|
|
26154
|
+
/* @__PURE__ */ jsx(Building2, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
26155
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0", children: [
|
|
26156
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate text-sm font-medium", children: unit.name }),
|
|
26157
|
+
unit.city ? /* @__PURE__ */ jsx("span", { className: "block truncate text-xs text-muted-foreground", children: unit.city }) : null
|
|
26158
|
+
] })
|
|
26159
|
+
] }, unit.id)) }),
|
|
26160
|
+
/* @__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." })
|
|
26161
|
+
] }) });
|
|
26162
|
+
}
|
|
26163
|
+
var ScheduleEditor2 = React122__default.lazy(
|
|
25945
26164
|
() => import('./ScheduleEditor-QC6OYBUE.js').then((m) => ({ default: m.ScheduleEditor }))
|
|
25946
26165
|
);
|
|
25947
26166
|
function ComingSoon({ icon: Icon, title, description }) {
|
|
@@ -26010,6 +26229,25 @@ function FinancialTab({ item }) {
|
|
|
26010
26229
|
}
|
|
26011
26230
|
return null;
|
|
26012
26231
|
}
|
|
26232
|
+
function FinancialSettingsTab({ item }) {
|
|
26233
|
+
const runtime = usePluginRuntimeOptional();
|
|
26234
|
+
const widgets = runtime ? getWidgetsForZone(runtime, "person.detail.financial-settings") : [];
|
|
26235
|
+
if (widgets.length > 0 && item) {
|
|
26236
|
+
const w = widgets[0];
|
|
26237
|
+
const Widget = w.component;
|
|
26238
|
+
return /* @__PURE__ */ jsx(
|
|
26239
|
+
Widget,
|
|
26240
|
+
{
|
|
26241
|
+
item,
|
|
26242
|
+
config: w.config,
|
|
26243
|
+
runtime: runtime?.context,
|
|
26244
|
+
plugin: w.plugin,
|
|
26245
|
+
widget: w
|
|
26246
|
+
}
|
|
26247
|
+
);
|
|
26248
|
+
}
|
|
26249
|
+
return null;
|
|
26250
|
+
}
|
|
26013
26251
|
function AttendanceTab({ item }) {
|
|
26014
26252
|
const runtime = usePluginRuntimeOptional();
|
|
26015
26253
|
const widgets = runtime ? getWidgetsForZone(runtime, "person.detail.attendance") : [];
|
|
@@ -26045,7 +26283,7 @@ function ScheduleTab({ item }) {
|
|
|
26045
26283
|
return (
|
|
26046
26284
|
// O interruptor "Aparece na agenda" agora vem DENTRO do editor: era a
|
|
26047
26285
|
// única coisa que esta porta mostrava e a da agenda não.
|
|
26048
|
-
/* @__PURE__ */ jsx(
|
|
26286
|
+
/* @__PURE__ */ jsx(React122__default.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(ScheduleEditor2, { assigneeId: item.id }) })
|
|
26049
26287
|
);
|
|
26050
26288
|
}
|
|
26051
26289
|
var PERSON_DETAIL_TABS = [
|
|
@@ -26058,12 +26296,27 @@ var PERSON_DETAIL_TABS = [
|
|
|
26058
26296
|
// have units — she is a record IN one. The tab renders its own "no login yet"
|
|
26059
26297
|
// state, so it is safe to show for staff who never sign in.
|
|
26060
26298
|
{ id: "units", label: "Unidades", icon: "Building2", component: PersonUnitsTab, visibleFor: ["staff"] },
|
|
26299
|
+
{
|
|
26300
|
+
id: "record-units",
|
|
26301
|
+
label: "Unidades",
|
|
26302
|
+
icon: "Building2",
|
|
26303
|
+
component: PersonAvailabilityTab,
|
|
26304
|
+
visibleFor: ["customer", "supplier", "contact", "lead", "partner"]
|
|
26305
|
+
},
|
|
26061
26306
|
{ id: "schedule", label: "Schedule", icon: "CalendarDays", component: ScheduleTab, visibleFor: ["staff"] },
|
|
26062
26307
|
// Core table (public.addresses), so every app with a person record gets this:
|
|
26063
26308
|
// delivery addresses for a client, pickup point for a supplier, home address
|
|
26064
26309
|
// for staff. Not shop-specific.
|
|
26065
26310
|
{ id: "addresses", label: "Endere\xE7os", icon: "MapPin", component: AddressesTab },
|
|
26066
26311
|
{ id: "documents", label: "Documents", icon: "FileText", component: DocumentsTab },
|
|
26312
|
+
{
|
|
26313
|
+
id: "financial-settings",
|
|
26314
|
+
label: "Configura\xE7\xF5es",
|
|
26315
|
+
icon: "Settings",
|
|
26316
|
+
component: FinancialSettingsTab,
|
|
26317
|
+
visibleFor: ["supplier"],
|
|
26318
|
+
requiresWidgetZone: "person.detail.financial-settings"
|
|
26319
|
+
},
|
|
26067
26320
|
// Per-person financial statement — only shown when the financial plugin contributes
|
|
26068
26321
|
// its widget (see requiresWidgetZone). Clients = paid invoices; staff = commissions.
|
|
26069
26322
|
{ id: "financial", label: "Statement", icon: "DollarSign", component: FinancialTab, requiresWidgetZone: "person.detail.financial" },
|
|
@@ -26071,11 +26324,25 @@ var PERSON_DETAIL_TABS = [
|
|
|
26071
26324
|
// contador daquele dia congelado. Só aparece onde algum plugin sabe
|
|
26072
26325
|
// responder: sem prontuário instalado, a aba não existe (em vez de existir
|
|
26073
26326
|
// vazia, afirmando que a pessoa nunca foi atendida).
|
|
26074
|
-
{
|
|
26327
|
+
{
|
|
26328
|
+
id: "attendance",
|
|
26329
|
+
label: "Atendimentos",
|
|
26330
|
+
icon: "Stethoscope",
|
|
26331
|
+
component: AttendanceTab,
|
|
26332
|
+
visibleFor: ["customer"],
|
|
26333
|
+
requiresWidgetZone: "person.detail.attendance"
|
|
26334
|
+
},
|
|
26075
26335
|
// V1 keeps these two side by side, and the split is the point: Atendimentos
|
|
26076
26336
|
// is the day-by-day, Serviços is the running balance per procedure — how
|
|
26077
26337
|
// many sessions bought, how many done, how many left.
|
|
26078
|
-
{
|
|
26338
|
+
{
|
|
26339
|
+
id: "services",
|
|
26340
|
+
label: "Servi\xE7os",
|
|
26341
|
+
icon: "Layers",
|
|
26342
|
+
component: PersonServicesTab,
|
|
26343
|
+
visibleFor: ["customer"],
|
|
26344
|
+
requiresWidgetZone: "person.detail.services"
|
|
26345
|
+
},
|
|
26079
26346
|
{ id: "activity", label: "Activity", icon: "Clock", component: ActivityTab }
|
|
26080
26347
|
];
|
|
26081
26348
|
function ComingSoon2({ icon: Icon, title, description }) {
|
|
@@ -26442,7 +26709,7 @@ function InlineEditor({
|
|
|
26442
26709
|
}) {
|
|
26443
26710
|
const [draft, setDraft] = useState(value ?? "");
|
|
26444
26711
|
const [saving, setSaving] = useState(false);
|
|
26445
|
-
const inputRef =
|
|
26712
|
+
const inputRef = React122__default.useRef(null);
|
|
26446
26713
|
useEffect(() => {
|
|
26447
26714
|
inputRef.current?.focus();
|
|
26448
26715
|
if (inputRef.current instanceof HTMLInputElement) inputRef.current.select();
|
|
@@ -26720,7 +26987,7 @@ function CrudDetailPage({
|
|
|
26720
26987
|
const displayFieldDef = entityDef.fields.find((f) => f.key === displayField);
|
|
26721
26988
|
const nameEditable = Boolean(onFieldSave) && Boolean(displayFieldDef) && isInlineEditable(displayFieldDef);
|
|
26722
26989
|
const [editingName, setEditingName] = useState(false);
|
|
26723
|
-
const imageInputRef =
|
|
26990
|
+
const imageInputRef = React122__default.useRef(null);
|
|
26724
26991
|
const runtime = usePluginRuntimeOptional();
|
|
26725
26992
|
const archetypeTabs = getArchetypeTabs(entityDef.layout, entityDef.data?.archetypeKind);
|
|
26726
26993
|
const relatedTabs = (entityDef.relatedLists ?? []).map((related) => ({
|
|
@@ -26778,7 +27045,7 @@ function CrudDetailPage({
|
|
|
26778
27045
|
window.history.replaceState(null, "", `#${segments.length ? `${base}/${segments.join("/")}` : base}`);
|
|
26779
27046
|
}, [basePath, item.id, selectedTab, embedded]);
|
|
26780
27047
|
const parentLabel = usePresetLabel(basePath, namePlural);
|
|
26781
|
-
const headerNode =
|
|
27048
|
+
const headerNode = React122__default.useMemo(
|
|
26782
27049
|
() => embedded ? null : /* @__PURE__ */ jsx(SubpageHeader, { title: displayValue, parentLabel, onBack }),
|
|
26783
27050
|
[embedded, displayValue, parentLabel, onBack]
|
|
26784
27051
|
);
|
|
@@ -26906,12 +27173,12 @@ function CrudDetailPage({
|
|
|
26906
27173
|
] }, tab.id);
|
|
26907
27174
|
})
|
|
26908
27175
|
] }),
|
|
26909
|
-
/* @__PURE__ */ jsx(TabsContent, { value: "overview", className: embedded ? "mt-2" : "mt-4", children: entityDef.overviewComponent ?
|
|
27176
|
+
/* @__PURE__ */ jsx(TabsContent, { value: "overview", className: embedded ? "mt-2" : "mt-4", children: entityDef.overviewComponent ? React122__default.createElement(entityDef.overviewComponent, { item, entityDef }) : /* @__PURE__ */ jsx(OverviewTab, { entityDef, item, compact: embedded, onFieldSave }) }),
|
|
26910
27177
|
customTabs.map((tab) => /* @__PURE__ */ jsx(TabsContent, { value: tab.id, className: "mt-4", children: tab.component ? (
|
|
26911
27178
|
// `tabPath` only to the tab the URL is actually addressing —
|
|
26912
27179
|
// handing it to every tab would have the documents tab trying to
|
|
26913
27180
|
// open a recording id when the user switches across.
|
|
26914
|
-
|
|
27181
|
+
React122__default.createElement(tab.component, {
|
|
26915
27182
|
item,
|
|
26916
27183
|
entityDef,
|
|
26917
27184
|
...tab.id === selectedTab ? { tabPath, setTabPath } : {},
|
|
@@ -26943,8 +27210,8 @@ function MyRecordPanel() {
|
|
|
26943
27210
|
const userId = useAuthStore((s) => s.user?.id);
|
|
26944
27211
|
const members = useOrganizationStore((s) => s.members);
|
|
26945
27212
|
const myRole = members.find((m) => m.userId === userId)?.profileName;
|
|
26946
|
-
const [state, setState] =
|
|
26947
|
-
const load =
|
|
27213
|
+
const [state, setState] = React122.useState({ status: "loading" });
|
|
27214
|
+
const load = React122.useCallback(async () => {
|
|
26948
27215
|
if (!orgId || !userId) return;
|
|
26949
27216
|
const person = await dedup(`self:record:${orgId}:${userId}`, () => fetchMyPersonRecord(orgId, userId));
|
|
26950
27217
|
if (!person) return setState({ status: "none" });
|
|
@@ -26961,10 +27228,10 @@ function MyRecordPanel() {
|
|
|
26961
27228
|
setState({ status: "none" });
|
|
26962
27229
|
}
|
|
26963
27230
|
}, [orgId, userId]);
|
|
26964
|
-
|
|
27231
|
+
React122.useEffect(() => {
|
|
26965
27232
|
void load();
|
|
26966
27233
|
}, [load]);
|
|
26967
|
-
const changePhoto =
|
|
27234
|
+
const changePhoto = React122.useCallback(async (file) => {
|
|
26968
27235
|
if (state.status !== "ready") return;
|
|
26969
27236
|
const supabase = getFayzSupabaseClientOptional();
|
|
26970
27237
|
if (!supabase) return;
|
|
@@ -27020,8 +27287,8 @@ function ConnectedUserProfile() {
|
|
|
27020
27287
|
const myPersonId = useMyPersonId();
|
|
27021
27288
|
const hasRecord = Boolean(myPersonId);
|
|
27022
27289
|
const setUser = useAuthStore((s) => s.setUser);
|
|
27023
|
-
const [profile, setProfile] =
|
|
27024
|
-
|
|
27290
|
+
const [profile, setProfile] = React122.useState(null);
|
|
27291
|
+
React122.useEffect(() => {
|
|
27025
27292
|
const supabase = getFayzSupabaseClientOptional();
|
|
27026
27293
|
if (!user || !supabase) return;
|
|
27027
27294
|
let cancelled = false;
|
|
@@ -27132,9 +27399,9 @@ function SecuritySettings({
|
|
|
27132
27399
|
onTenantSecurityChange
|
|
27133
27400
|
}) {
|
|
27134
27401
|
const { t } = useTranslation$1();
|
|
27135
|
-
const [resetting, setResetting] =
|
|
27136
|
-
const [resetSent, setResetSent] =
|
|
27137
|
-
const [savingTenant, setSavingTenant] =
|
|
27402
|
+
const [resetting, setResetting] = React122.useState(false);
|
|
27403
|
+
const [resetSent, setResetSent] = React122.useState(false);
|
|
27404
|
+
const [savingTenant, setSavingTenant] = React122.useState(false);
|
|
27138
27405
|
const handleResetPassword = async () => {
|
|
27139
27406
|
if (!onResetPassword) return;
|
|
27140
27407
|
setResetting(true);
|
|
@@ -27308,8 +27575,8 @@ function FileUploadField({
|
|
|
27308
27575
|
hint
|
|
27309
27576
|
}) {
|
|
27310
27577
|
const { t } = useTranslation$1();
|
|
27311
|
-
const inputRef =
|
|
27312
|
-
const [preview, setPreview] =
|
|
27578
|
+
const inputRef = React122.useRef(null);
|
|
27579
|
+
const [preview, setPreview] = React122.useState(null);
|
|
27313
27580
|
const handleChange = (e) => {
|
|
27314
27581
|
const file = e.target.files?.[0];
|
|
27315
27582
|
if (file) {
|
|
@@ -27526,13 +27793,13 @@ function BrandPreview({ brand, t }) {
|
|
|
27526
27793
|
}
|
|
27527
27794
|
function BrandingSettings({ brand, onSave }) {
|
|
27528
27795
|
const { t } = useTranslation$1();
|
|
27529
|
-
const [section, setSection] =
|
|
27530
|
-
const [saved, setSaved] =
|
|
27531
|
-
const [draft, setDraft] =
|
|
27532
|
-
const [logoFile, setLogoFile] =
|
|
27533
|
-
const [faviconFile, setFaviconFile] =
|
|
27534
|
-
const [saving, setSaving] =
|
|
27535
|
-
|
|
27796
|
+
const [section, setSection] = React122.useState("identity");
|
|
27797
|
+
const [saved, setSaved] = React122.useState(brand ?? EMPTY_BRAND);
|
|
27798
|
+
const [draft, setDraft] = React122.useState(brand ?? EMPTY_BRAND);
|
|
27799
|
+
const [logoFile, setLogoFile] = React122.useState(null);
|
|
27800
|
+
const [faviconFile, setFaviconFile] = React122.useState(null);
|
|
27801
|
+
const [saving, setSaving] = React122.useState(false);
|
|
27802
|
+
React122.useEffect(() => {
|
|
27536
27803
|
if (brand) {
|
|
27537
27804
|
setSaved(brand);
|
|
27538
27805
|
setDraft(brand);
|
|
@@ -27906,11 +28173,11 @@ function ConnectedBrandingSettings() {
|
|
|
27906
28173
|
toast.error("N\xE3o foi poss\xEDvel salvar a marca", { description: err?.message });
|
|
27907
28174
|
}
|
|
27908
28175
|
};
|
|
27909
|
-
const [brand, setBrand] =
|
|
28176
|
+
const [brand, setBrand] = React122.useState(() => normalizeBrand(
|
|
27910
28177
|
(currentOrg?.settings ?? {}).branding,
|
|
27911
28178
|
{ name: currentOrg?.name, logoUrl: currentOrg?.logoUrl }
|
|
27912
28179
|
));
|
|
27913
|
-
|
|
28180
|
+
React122.useEffect(() => {
|
|
27914
28181
|
let alive = true;
|
|
27915
28182
|
void (async () => {
|
|
27916
28183
|
try {
|
|
@@ -28031,12 +28298,12 @@ function ProjectsSettings() {
|
|
|
28031
28298
|
const projects = useFayzProjectsStore((s) => s.projects);
|
|
28032
28299
|
const load = useFayzProjectsStore((s) => s.load);
|
|
28033
28300
|
const refresh = useFayzProjectsStore((s) => s.refresh);
|
|
28034
|
-
const [linking, setLinking] =
|
|
28301
|
+
const [linking, setLinking] = React122.useState(false);
|
|
28035
28302
|
const connected = isPlatformConnected();
|
|
28036
|
-
|
|
28303
|
+
React122.useEffect(() => {
|
|
28037
28304
|
void load(currentOrgId);
|
|
28038
28305
|
}, [currentOrgId, load]);
|
|
28039
|
-
|
|
28306
|
+
React122.useEffect(() => {
|
|
28040
28307
|
if (!connected || projects.length === 0) return;
|
|
28041
28308
|
let cancelled = false;
|
|
28042
28309
|
void (async () => {
|
|
@@ -28108,7 +28375,7 @@ function SiteRow({
|
|
|
28108
28375
|
showDefaultAction,
|
|
28109
28376
|
onChanged
|
|
28110
28377
|
}) {
|
|
28111
|
-
const [busy, setBusy] =
|
|
28378
|
+
const [busy, setBusy] = React122.useState(false);
|
|
28112
28379
|
const editorUrl = editorUrlOf(project);
|
|
28113
28380
|
const run = async (action) => {
|
|
28114
28381
|
setBusy(true);
|
|
@@ -28179,7 +28446,7 @@ function SiteRow({
|
|
|
28179
28446
|
] });
|
|
28180
28447
|
}
|
|
28181
28448
|
function LinkSiteModal({ onClose, onLinked }) {
|
|
28182
|
-
const [mode, setMode] =
|
|
28449
|
+
const [mode, setMode] = React122.useState("import");
|
|
28183
28450
|
return /* @__PURE__ */ jsx(Modal, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs(ModalContent, { size: "lg", children: [
|
|
28184
28451
|
/* @__PURE__ */ jsxs(ModalHeader, { children: [
|
|
28185
28452
|
/* @__PURE__ */ jsx(ModalTitle, { children: "Vincular um site" }),
|
|
@@ -28215,11 +28482,11 @@ function ModeTab({
|
|
|
28215
28482
|
}
|
|
28216
28483
|
function ImportPane({ onLinked }) {
|
|
28217
28484
|
const linked = useFayzProjectsStore((s) => s.projects);
|
|
28218
|
-
const [search, setSearch] =
|
|
28219
|
-
const [remote, setRemote] =
|
|
28220
|
-
const [error, setError] =
|
|
28221
|
-
const [linkingId, setLinkingId] =
|
|
28222
|
-
|
|
28485
|
+
const [search, setSearch] = React122.useState("");
|
|
28486
|
+
const [remote, setRemote] = React122.useState(null);
|
|
28487
|
+
const [error, setError] = React122.useState(null);
|
|
28488
|
+
const [linkingId, setLinkingId] = React122.useState(null);
|
|
28489
|
+
React122.useEffect(() => {
|
|
28223
28490
|
let cancelled = false;
|
|
28224
28491
|
setError(null);
|
|
28225
28492
|
const timer = setTimeout(() => {
|
|
@@ -28301,9 +28568,9 @@ function ImportPane({ onLinked }) {
|
|
|
28301
28568
|
}
|
|
28302
28569
|
function CreatePane({ onLinked, onCancel }) {
|
|
28303
28570
|
const linked = useFayzProjectsStore((s) => s.projects);
|
|
28304
|
-
const [prompt, setPrompt] =
|
|
28305
|
-
const [busy, setBusy] =
|
|
28306
|
-
const [error, setError] =
|
|
28571
|
+
const [prompt, setPrompt] = React122.useState("");
|
|
28572
|
+
const [busy, setBusy] = React122.useState(false);
|
|
28573
|
+
const [error, setError] = React122.useState(null);
|
|
28307
28574
|
const tooShort = prompt.trim().length < PROMPT_MIN_CHARS;
|
|
28308
28575
|
const submit = async () => {
|
|
28309
28576
|
setBusy(true);
|
|
@@ -28448,10 +28715,10 @@ function ModuleCatalogSections({
|
|
|
28448
28715
|
onToggle,
|
|
28449
28716
|
busy
|
|
28450
28717
|
}) {
|
|
28451
|
-
const [query, setQuery] =
|
|
28718
|
+
const [query, setQuery] = React122.useState("");
|
|
28452
28719
|
const total = categories.reduce((n, c) => n + c.rows.length, 0);
|
|
28453
28720
|
const searchable = total > 6;
|
|
28454
|
-
const filtered =
|
|
28721
|
+
const filtered = React122.useMemo(() => filterCategories(categories, query), [categories, query]);
|
|
28455
28722
|
if (categories.length === 0) {
|
|
28456
28723
|
return /* @__PURE__ */ jsxs("div", { className: "py-8 text-center", children: [
|
|
28457
28724
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: "Nada a adicionar" }),
|
|
@@ -28493,7 +28760,7 @@ function CategorySection({
|
|
|
28493
28760
|
onToggle,
|
|
28494
28761
|
busy
|
|
28495
28762
|
}) {
|
|
28496
|
-
const [open, setOpen] =
|
|
28763
|
+
const [open, setOpen] = React122.useState(category.mine);
|
|
28497
28764
|
const expanded = open || forceOpen;
|
|
28498
28765
|
const Chevron = expanded ? ChevronDown : ChevronRight;
|
|
28499
28766
|
return /* @__PURE__ */ jsxs("section", { children: [
|
|
@@ -28575,8 +28842,8 @@ function buildCategories(catalog, rows) {
|
|
|
28575
28842
|
}
|
|
28576
28843
|
function useModuleCatalog() {
|
|
28577
28844
|
const tenantId2 = useOrganizationStore((s) => s.currentOrg?.id ?? null);
|
|
28578
|
-
const [catalog, setCatalog] =
|
|
28579
|
-
|
|
28845
|
+
const [catalog, setCatalog] = React122.useState([]);
|
|
28846
|
+
React122.useEffect(() => {
|
|
28580
28847
|
const supabase = getSupabaseClientOptional$1();
|
|
28581
28848
|
if (!supabase) return;
|
|
28582
28849
|
let alive = true;
|
|
@@ -28593,15 +28860,15 @@ function useModuleCatalog() {
|
|
|
28593
28860
|
function ModulesSettings({ hidden = [], onToggle, permits, busy, catalog = [] }) {
|
|
28594
28861
|
const runtime = usePluginRuntime();
|
|
28595
28862
|
const offered = useOfferedPlugins();
|
|
28596
|
-
const [adding, setAdding] =
|
|
28597
|
-
const rows =
|
|
28863
|
+
const [adding, setAdding] = React122.useState(false);
|
|
28864
|
+
const rows = React122.useMemo(() => {
|
|
28598
28865
|
const known = catalog.length ? new Set(catalog.flatMap((app) => app.modules)) : new Set(offered);
|
|
28599
28866
|
const inCatalogue = known.size ? runtime.plugins.filter((p) => known.has(p.id) || p.isActive) : runtime.plugins;
|
|
28600
28867
|
return buildRows(inCatalogue, new Set(hidden), permits);
|
|
28601
28868
|
}, [runtime.plugins, hidden, permits, offered, catalog]);
|
|
28602
28869
|
const on = rows.filter((r) => r.plugin.isActive);
|
|
28603
|
-
const off =
|
|
28604
|
-
const categories =
|
|
28870
|
+
const off = React122.useMemo(() => rows.filter((r) => !r.plugin.isActive), [rows]);
|
|
28871
|
+
const categories = React122.useMemo(() => buildCategories(catalog, off), [catalog, off]);
|
|
28605
28872
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-8", children: [
|
|
28606
28873
|
/* @__PURE__ */ jsx(PageHeaderActions, { children: /* @__PURE__ */ jsxs(Button, { size: "sm", className: "shrink-0 gap-1.5", onClick: () => setAdding(true), children: [
|
|
28607
28874
|
/* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
|
|
@@ -28809,8 +29076,8 @@ function ConnectedModulesSettings({ hidden = SHELL_PLUGINS }) {
|
|
|
28809
29076
|
const access = useAccessOptional();
|
|
28810
29077
|
const catalog = useModuleCatalog();
|
|
28811
29078
|
const tenantId2 = useOrganizationStore((s) => s.currentOrg?.id ?? null);
|
|
28812
|
-
const [busy, setBusy] =
|
|
28813
|
-
const onToggle =
|
|
29079
|
+
const [busy, setBusy] = React122.useState(false);
|
|
29080
|
+
const onToggle = React122.useCallback(
|
|
28814
29081
|
async (plugin, status, facet) => {
|
|
28815
29082
|
const supabase = getSupabaseClientOptional$1();
|
|
28816
29083
|
if (!supabase) return;
|
|
@@ -28836,7 +29103,7 @@ function ConnectedModulesSettings({ hidden = SHELL_PLUGINS }) {
|
|
|
28836
29103
|
},
|
|
28837
29104
|
[refresh, tenantId2]
|
|
28838
29105
|
);
|
|
28839
|
-
const permits =
|
|
29106
|
+
const permits = React122.useCallback(
|
|
28840
29107
|
(plugin) => access ? access.can(plugin, "read").allowed || access.entitled(plugin) : true,
|
|
28841
29108
|
[access]
|
|
28842
29109
|
);
|
|
@@ -28847,7 +29114,7 @@ function useCoreSettingsTabs({
|
|
|
28847
29114
|
showBranding = true
|
|
28848
29115
|
} = {}) {
|
|
28849
29116
|
const { t } = useTranslation$1();
|
|
28850
|
-
return
|
|
29117
|
+
return React122.useMemo(() => [
|
|
28851
29118
|
...showCompany ? [{ id: "general", label: t("settings.general"), icon: /* @__PURE__ */ jsx(Building2, { className: "h-4 w-4" }), iconName: "Building2", component: /* @__PURE__ */ jsx(ConnectedCompanySettings, {}) }] : [],
|
|
28852
29119
|
{ id: "profile", label: t("settings.profile"), icon: /* @__PURE__ */ jsx(User, { className: "h-4 w-4" }), iconName: "User", component: /* @__PURE__ */ jsx(ConnectedUserProfile, {}) },
|
|
28853
29120
|
{ id: "security", label: t("settings.security"), icon: /* @__PURE__ */ jsx(Shield, { className: "h-4 w-4" }), iconName: "Shield", component: /* @__PURE__ */ jsx(ConnectedSecuritySettings, {}) },
|
|
@@ -28892,10 +29159,10 @@ function SettingsPage({
|
|
|
28892
29159
|
}
|
|
28893
29160
|
return null;
|
|
28894
29161
|
}
|
|
28895
|
-
const [activeTab, setActiveTab] =
|
|
29162
|
+
const [activeTab, setActiveTab] = React122.useState(() => {
|
|
28896
29163
|
return getTabFromHash() ?? defaultTab ?? null;
|
|
28897
29164
|
});
|
|
28898
|
-
|
|
29165
|
+
React122.useEffect(() => {
|
|
28899
29166
|
const handler = () => {
|
|
28900
29167
|
const tab = getTabFromHash();
|
|
28901
29168
|
if (tab) setActiveTab(tab);
|
|
@@ -28921,7 +29188,7 @@ function SettingsPage({
|
|
|
28921
29188
|
setActiveTab(null);
|
|
28922
29189
|
window.location.hash = "/settings";
|
|
28923
29190
|
};
|
|
28924
|
-
const sections =
|
|
29191
|
+
const sections = React122.useMemo(() => {
|
|
28925
29192
|
const out = [];
|
|
28926
29193
|
for (const tab of resolvedTabs) {
|
|
28927
29194
|
const heading = tab.isPlugin ? tab.group ?? t("common.plugins") : null;
|
|
@@ -29002,14 +29269,14 @@ function InviteMemberDialog({ open, onOpenChange, defaultEmail }) {
|
|
|
29002
29269
|
const profiles = usePermissionsStore((s) => s.profiles);
|
|
29003
29270
|
const setInvites = useInviteStore((s) => s.setInvites);
|
|
29004
29271
|
const { user } = useAuthStore();
|
|
29005
|
-
const [emails, setEmails] =
|
|
29006
|
-
const [profileId, setProfileId] =
|
|
29007
|
-
const [sending, setSending] =
|
|
29008
|
-
const [sent, setSent] =
|
|
29009
|
-
|
|
29272
|
+
const [emails, setEmails] = React122.useState([defaultEmail ?? ""]);
|
|
29273
|
+
const [profileId, setProfileId] = React122.useState(profiles[1]?.id ?? profiles[0]?.id ?? "");
|
|
29274
|
+
const [sending, setSending] = React122.useState(false);
|
|
29275
|
+
const [sent, setSent] = React122.useState(false);
|
|
29276
|
+
React122.useEffect(() => {
|
|
29010
29277
|
if (open) setEmails([defaultEmail ?? ""]);
|
|
29011
29278
|
}, [open, defaultEmail]);
|
|
29012
|
-
|
|
29279
|
+
React122.useEffect(() => {
|
|
29013
29280
|
if (!profileId && profiles.length) setProfileId(profiles[1]?.id ?? profiles[0].id);
|
|
29014
29281
|
}, [profiles, profileId]);
|
|
29015
29282
|
const addEmail = () => setEmails((prev) => [...prev, ""]);
|
|
@@ -29113,7 +29380,7 @@ function UnitSwitcher({ collapsed = false, className }) {
|
|
|
29113
29380
|
const myUnitIds = useUnitStore((s) => s.myUnitIds);
|
|
29114
29381
|
const activeUnitId = useUnitStore((s) => s.activeUnitId);
|
|
29115
29382
|
const beginSwitch = useUnitSwitchingStore((s) => s.begin);
|
|
29116
|
-
const [query, setQuery] =
|
|
29383
|
+
const [query, setQuery] = React122.useState("");
|
|
29117
29384
|
const singular = label(t, "unit.singular", "unidade");
|
|
29118
29385
|
const plural = label(t, "unit.plural", "unidades");
|
|
29119
29386
|
if (!unitMode) return null;
|
|
@@ -29138,13 +29405,13 @@ function UnitSwitcher({ collapsed = false, className }) {
|
|
|
29138
29405
|
}
|
|
29139
29406
|
const renderNode = (node, depth) => {
|
|
29140
29407
|
if (node.kind === "region") {
|
|
29141
|
-
return /* @__PURE__ */ jsxs(
|
|
29408
|
+
return /* @__PURE__ */ jsxs(React122.Fragment, { children: [
|
|
29142
29409
|
/* @__PURE__ */ jsx(DropdownLabel, { className: "px-2 pt-2 text-[10px] uppercase tracking-wide text-muted-foreground", children: node.name }),
|
|
29143
29410
|
node.children.map((child) => renderNode(child, depth + 1))
|
|
29144
29411
|
] }, node.id);
|
|
29145
29412
|
}
|
|
29146
29413
|
if (!reachable.includes(node.id)) return null;
|
|
29147
|
-
return /* @__PURE__ */ jsxs(
|
|
29414
|
+
return /* @__PURE__ */ jsxs(React122.Fragment, { children: [
|
|
29148
29415
|
/* @__PURE__ */ jsxs(
|
|
29149
29416
|
DropdownItem,
|
|
29150
29417
|
{
|
|
@@ -29227,7 +29494,7 @@ function UnitSwitcher({ collapsed = false, className }) {
|
|
|
29227
29494
|
var MENU_LIST_CAP = 5;
|
|
29228
29495
|
function UnitMenuSection() {
|
|
29229
29496
|
useUnitBootstrap();
|
|
29230
|
-
const [locating, setLocating] =
|
|
29497
|
+
const [locating, setLocating] = React122.useState(false);
|
|
29231
29498
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
29232
29499
|
const units = useUnitStore((s) => s.units);
|
|
29233
29500
|
const tree = useUnitStore((s) => s.tree);
|
|
@@ -29278,13 +29545,13 @@ function UnitMenuSection() {
|
|
|
29278
29545
|
if (node.kind === "region") {
|
|
29279
29546
|
const visibleChildren = node.children.filter((c) => c.kind === "region" || reachable.includes(c.id));
|
|
29280
29547
|
if (visibleChildren.length === 0) return null;
|
|
29281
|
-
return /* @__PURE__ */ jsxs(
|
|
29548
|
+
return /* @__PURE__ */ jsxs(React122.Fragment, { children: [
|
|
29282
29549
|
/* @__PURE__ */ jsx(DropdownLabel, { className: "px-2 pt-2 text-[10px] uppercase tracking-wide text-muted-foreground", children: node.name }),
|
|
29283
29550
|
visibleChildren.map((child) => renderNode(child, depth + 1))
|
|
29284
29551
|
] }, node.id);
|
|
29285
29552
|
}
|
|
29286
29553
|
if (!reachable.includes(node.id)) return null;
|
|
29287
|
-
return /* @__PURE__ */ jsxs(
|
|
29554
|
+
return /* @__PURE__ */ jsxs(React122.Fragment, { children: [
|
|
29288
29555
|
/* @__PURE__ */ jsxs(
|
|
29289
29556
|
DropdownItem,
|
|
29290
29557
|
{
|
|
@@ -29423,9 +29690,9 @@ function MemberUnitsCell({
|
|
|
29423
29690
|
const byId = useUnitStore((s) => s.byId);
|
|
29424
29691
|
const unitMode = useUnitStore((s) => s.unitMode);
|
|
29425
29692
|
const openUnit = useUnitPanel((s) => s.openUnit);
|
|
29426
|
-
const [unitIds, setUnitIds] =
|
|
29693
|
+
const [unitIds, setUnitIds] = React122.useState(null);
|
|
29427
29694
|
const version5 = useDataVersion(UNIT_ACCESS_CHANGED);
|
|
29428
|
-
|
|
29695
|
+
React122.useEffect(() => {
|
|
29429
29696
|
if (!userId) {
|
|
29430
29697
|
setUnitIds([]);
|
|
29431
29698
|
return;
|
|
@@ -29483,10 +29750,10 @@ function TeamTab() {
|
|
|
29483
29750
|
const { user } = useAuthStore();
|
|
29484
29751
|
const hasSystemPermission = useSystemPermission();
|
|
29485
29752
|
const personMode = teamPersonKinds.length > 0 && typeof adapter?.listTeam === "function";
|
|
29486
|
-
const [team, setTeam] =
|
|
29487
|
-
const [inviteOpen, setInviteOpen] =
|
|
29753
|
+
const [team, setTeam] = React122.useState(null);
|
|
29754
|
+
const [inviteOpen, setInviteOpen] = React122.useState(false);
|
|
29488
29755
|
const guardSeats = useLimitGuard("users");
|
|
29489
|
-
const [inviteEmail, setInviteEmail] =
|
|
29756
|
+
const [inviteEmail, setInviteEmail] = React122.useState(void 0);
|
|
29490
29757
|
const handleOpenInvite = async (row) => {
|
|
29491
29758
|
if (row && !row.email && row.personId && entityRouteHasDetail("person", row.kind)) {
|
|
29492
29759
|
openEntity(row.personId, "person", row.kind, "access");
|
|
@@ -29496,7 +29763,7 @@ function TeamTab() {
|
|
|
29496
29763
|
setInviteEmail(row?.email || void 0);
|
|
29497
29764
|
setInviteOpen(true);
|
|
29498
29765
|
};
|
|
29499
|
-
const reloadTeam =
|
|
29766
|
+
const reloadTeam = React122.useCallback(async () => {
|
|
29500
29767
|
if (!adapter || !currentOrg) return;
|
|
29501
29768
|
if (personMode && adapter.listTeam) {
|
|
29502
29769
|
setTeam(await adapter.listTeam(currentOrg.id, teamPersonKinds));
|
|
@@ -29504,12 +29771,12 @@ function TeamTab() {
|
|
|
29504
29771
|
setMembers(await adapter.listMembers(currentOrg.id));
|
|
29505
29772
|
}
|
|
29506
29773
|
}, [adapter, currentOrg?.id, personMode, teamPersonKinds, setMembers]);
|
|
29507
|
-
|
|
29774
|
+
React122.useEffect(() => {
|
|
29508
29775
|
if (personMode && adapter?.listTeam && currentOrg) {
|
|
29509
29776
|
dedup("team:people:" + currentOrg.id, () => adapter.listTeam(currentOrg.id, teamPersonKinds)).then(setTeam).catch(() => setTeam([]));
|
|
29510
29777
|
}
|
|
29511
29778
|
}, [personMode, adapter, currentOrg?.id, teamPersonKinds.join(",")]);
|
|
29512
|
-
|
|
29779
|
+
React122.useEffect(() => {
|
|
29513
29780
|
if (adapter && currentOrg) {
|
|
29514
29781
|
dedup("team:invites:" + currentOrg.id, () => adapter.listInvites(currentOrg.id)).then(setInvites).catch(() => {
|
|
29515
29782
|
});
|
|
@@ -29590,7 +29857,7 @@ function TeamTab() {
|
|
|
29590
29857
|
};
|
|
29591
29858
|
const { t } = useTranslation$1();
|
|
29592
29859
|
const canManageTeam = hasSystemPermission("manage_team");
|
|
29593
|
-
const inviteActions =
|
|
29860
|
+
const inviteActions = React122.useMemo(() => [{
|
|
29594
29861
|
id: "invite",
|
|
29595
29862
|
label: t("organization.team.invite"),
|
|
29596
29863
|
icon: UserPlus,
|
|
@@ -29777,13 +30044,13 @@ var SYSTEM_PERMISSIONS = [
|
|
|
29777
30044
|
];
|
|
29778
30045
|
function PermissionMatrixEditor({ features, profile, onSave, onCancel, saving, isNew, parentLabel }) {
|
|
29779
30046
|
const { t } = useTranslation$1();
|
|
29780
|
-
const [name, setName] =
|
|
29781
|
-
const [description, setDescription] =
|
|
29782
|
-
const [systemPerms, setSystemPerms] =
|
|
29783
|
-
const [grants, setGrants] =
|
|
29784
|
-
const [collapsed, setCollapsed] =
|
|
29785
|
-
const [search, setSearch] =
|
|
29786
|
-
const initial =
|
|
30047
|
+
const [name, setName] = React122.useState(profile?.name ?? "");
|
|
30048
|
+
const [description, setDescription] = React122.useState(profile?.description ?? "");
|
|
30049
|
+
const [systemPerms, setSystemPerms] = React122.useState(profile?.systemPermissions ?? []);
|
|
30050
|
+
const [grants, setGrants] = React122.useState(profile?.grants ?? {});
|
|
30051
|
+
const [collapsed, setCollapsed] = React122.useState(/* @__PURE__ */ new Set());
|
|
30052
|
+
const [search, setSearch] = React122.useState("");
|
|
30053
|
+
const initial = React122.useRef({
|
|
29787
30054
|
name: profile?.name ?? "",
|
|
29788
30055
|
description: profile?.description ?? "",
|
|
29789
30056
|
systemPerms: JSON.stringify(profile?.systemPermissions ?? []),
|
|
@@ -29820,7 +30087,7 @@ function PermissionMatrixEditor({ features, profile, onSave, onCancel, saving, i
|
|
|
29820
30087
|
onDiscard: onCancel,
|
|
29821
30088
|
saveLabel: isNew ? t("organization.permissions.createProfile") : t("organization.permissions.updateProfile")
|
|
29822
30089
|
});
|
|
29823
|
-
const groups =
|
|
30090
|
+
const groups = React122.useMemo(() => {
|
|
29824
30091
|
const filtered = search ? features.filter((f) => f.label.toLowerCase().includes(search.toLowerCase())) : features;
|
|
29825
30092
|
const map = /* @__PURE__ */ new Map();
|
|
29826
30093
|
for (const f of filtered) {
|
|
@@ -29889,7 +30156,7 @@ function PermissionMatrixEditor({ features, profile, onSave, onCancel, saving, i
|
|
|
29889
30156
|
}
|
|
29890
30157
|
) }) })
|
|
29891
30158
|
] }, sp.id)),
|
|
29892
|
-
Array.from(groups.entries()).map(([groupName, groupFeatures]) => /* @__PURE__ */ jsxs(
|
|
30159
|
+
Array.from(groups.entries()).map(([groupName, groupFeatures]) => /* @__PURE__ */ jsxs(React122.Fragment, { children: [
|
|
29893
30160
|
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 5, className: "p-2 px-3", children: /* @__PURE__ */ jsxs(
|
|
29894
30161
|
"button",
|
|
29895
30162
|
{
|
|
@@ -29961,12 +30228,12 @@ function PermissionProfilesTab() {
|
|
|
29961
30228
|
const startImpersonation = usePermissionsStore((s) => s.startImpersonation);
|
|
29962
30229
|
const canPreview = (realProfile?.systemPermissions ?? []).includes("manage_permissions") ?? false;
|
|
29963
30230
|
const { t } = useTranslation$1();
|
|
29964
|
-
const [editingProfile, setEditingProfile] =
|
|
29965
|
-
const [creating, setCreating] =
|
|
29966
|
-
const [duplicateSource, setDuplicateSource] =
|
|
29967
|
-
const [saving, setSaving] =
|
|
29968
|
-
const [error, setError] =
|
|
29969
|
-
const [deleting, setDeleting] =
|
|
30231
|
+
const [editingProfile, setEditingProfile] = React122.useState(null);
|
|
30232
|
+
const [creating, setCreating] = React122.useState(false);
|
|
30233
|
+
const [duplicateSource, setDuplicateSource] = React122.useState(null);
|
|
30234
|
+
const [saving, setSaving] = React122.useState(false);
|
|
30235
|
+
const [error, setError] = React122.useState(null);
|
|
30236
|
+
const [deleting, setDeleting] = React122.useState(null);
|
|
29970
30237
|
const handleDuplicate = (profile) => {
|
|
29971
30238
|
setEditingProfile(null);
|
|
29972
30239
|
setCreating(false);
|
|
@@ -29976,9 +30243,9 @@ function PermissionProfilesTab() {
|
|
|
29976
30243
|
isSystem: false
|
|
29977
30244
|
});
|
|
29978
30245
|
};
|
|
29979
|
-
const surfaceRef =
|
|
30246
|
+
const surfaceRef = React122.useRef({ features, profiles, adapter, currentOrg, setProfiles });
|
|
29980
30247
|
surfaceRef.current = { features, profiles, adapter, currentOrg, setProfiles };
|
|
29981
|
-
const agentSurface =
|
|
30248
|
+
const agentSurface = React122.useMemo(() => ({
|
|
29982
30249
|
id: "org.permissions",
|
|
29983
30250
|
instructions: PERMISSIONS_INSTRUCTIONS,
|
|
29984
30251
|
describe: () => {
|
|
@@ -30032,7 +30299,7 @@ function PermissionProfilesTab() {
|
|
|
30032
30299
|
}]
|
|
30033
30300
|
}), []);
|
|
30034
30301
|
useAgentSurface(agentSurface);
|
|
30035
|
-
const createActions =
|
|
30302
|
+
const createActions = React122.useMemo(() => [
|
|
30036
30303
|
{
|
|
30037
30304
|
id: "new",
|
|
30038
30305
|
label: t("organization.permissions.createProfile"),
|
|
@@ -30061,7 +30328,7 @@ function PermissionProfilesTab() {
|
|
|
30061
30328
|
})
|
|
30062
30329
|
}
|
|
30063
30330
|
], [t]);
|
|
30064
|
-
const memberCountByProfile =
|
|
30331
|
+
const memberCountByProfile = React122.useMemo(() => {
|
|
30065
30332
|
const counts = {};
|
|
30066
30333
|
for (const m of members) {
|
|
30067
30334
|
counts[m.profileId] = (counts[m.profileId] ?? 0) + 1;
|
|
@@ -30366,7 +30633,7 @@ function FieldRulesSettings({ entities, rules: initialRules, onSave }) {
|
|
|
30366
30633
|
const [saving, setSaving] = useState(false);
|
|
30367
30634
|
const [search, setSearch] = useState("");
|
|
30368
30635
|
const [showMore, setShowMore] = useState(false);
|
|
30369
|
-
|
|
30636
|
+
React122.useEffect(() => {
|
|
30370
30637
|
setDraft(initialRules);
|
|
30371
30638
|
}, [initialRules]);
|
|
30372
30639
|
const isDirty = useMemo(
|
|
@@ -30766,19 +31033,19 @@ function SoftLimitWidget() {
|
|
|
30766
31033
|
function LimitProbe({ limitKey }) {
|
|
30767
31034
|
const info = useLimit(limitKey);
|
|
30768
31035
|
const report = useSoftLimitStore((s) => s.report);
|
|
30769
|
-
|
|
31036
|
+
React122.useEffect(() => {
|
|
30770
31037
|
report(limitKey, info);
|
|
30771
31038
|
}, [limitKey, info, report]);
|
|
30772
31039
|
return null;
|
|
30773
31040
|
}
|
|
30774
31041
|
function SoftLimitProbes({ keys }) {
|
|
30775
|
-
const monitored =
|
|
31042
|
+
const monitored = React122.useMemo(() => Array.from(new Set(keys)), [keys]);
|
|
30776
31043
|
return /* @__PURE__ */ jsx(Fragment, { children: monitored.map((k) => /* @__PURE__ */ jsx(LimitProbe, { limitKey: k }, k)) });
|
|
30777
31044
|
}
|
|
30778
|
-
var CommandPalette =
|
|
31045
|
+
var CommandPalette = React122.lazy(
|
|
30779
31046
|
() => import('./CommandPalette-B5PMQFDG.js').then((m) => ({ default: m.CommandPalette }))
|
|
30780
31047
|
);
|
|
30781
|
-
var SubscriptionPage =
|
|
31048
|
+
var SubscriptionPage = React122.lazy(
|
|
30782
31049
|
() => import('./SubscriptionPage-TVAEOFNC.js').then((m) => ({ default: m.SubscriptionPage }))
|
|
30783
31050
|
);
|
|
30784
31051
|
function WorkspaceSwitcher({
|
|
@@ -30828,8 +31095,8 @@ function WorkspaceSwitcher({
|
|
|
30828
31095
|
const v = t(key);
|
|
30829
31096
|
return !v || v === key ? fallback : v;
|
|
30830
31097
|
};
|
|
30831
|
-
const [query, setQuery] =
|
|
30832
|
-
const search =
|
|
31098
|
+
const [query, setQuery] = React122.useState("");
|
|
31099
|
+
const search = React122.useMemo(
|
|
30833
31100
|
() => searchWorkspaces(
|
|
30834
31101
|
options,
|
|
30835
31102
|
query,
|
|
@@ -31143,9 +31410,9 @@ function PluginHeaderControls() {
|
|
|
31143
31410
|
}
|
|
31144
31411
|
function AdminNotifications() {
|
|
31145
31412
|
const { notifications, unreadCount, fetchNotifications, markAsRead, markAllAsRead } = useNotifications();
|
|
31146
|
-
const [open, setOpen] =
|
|
31147
|
-
const fetchedRef =
|
|
31148
|
-
|
|
31413
|
+
const [open, setOpen] = React122.useState(false);
|
|
31414
|
+
const fetchedRef = React122.useRef(false);
|
|
31415
|
+
React122.useEffect(() => {
|
|
31149
31416
|
if (fetchedRef.current) return;
|
|
31150
31417
|
fetchedRef.current = true;
|
|
31151
31418
|
void fetchNotifications();
|
|
@@ -31291,7 +31558,7 @@ function buildSettingsTabs(pluginTabs, can, hasSystem, t, showOrgSettings, hasBi
|
|
|
31291
31558
|
// sidebar ICON_MAP, which made the settings rail fall back to Home.
|
|
31292
31559
|
icon: /* @__PURE__ */ jsx(CreditCard, { className: "h-4 w-4" }),
|
|
31293
31560
|
iconName: "CreditCard",
|
|
31294
|
-
component: /* @__PURE__ */ jsx(
|
|
31561
|
+
component: /* @__PURE__ */ jsx(React122.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(SubscriptionPage, {}) })
|
|
31295
31562
|
});
|
|
31296
31563
|
}
|
|
31297
31564
|
if (showOrgSettings) {
|
|
@@ -31319,9 +31586,9 @@ function buildSettingsTabs(pluginTabs, can, hasSystem, t, showOrgSettings, hasBi
|
|
|
31319
31586
|
settingsTabs.push({
|
|
31320
31587
|
id: tab.id,
|
|
31321
31588
|
label: translated === labelKey ? tab.label : translated,
|
|
31322
|
-
icon:
|
|
31589
|
+
icon: React122.createElement(IconComp, { className: "h-4 w-4" }),
|
|
31323
31590
|
iconName,
|
|
31324
|
-
component:
|
|
31591
|
+
component: React122.createElement(tab.component),
|
|
31325
31592
|
// Flag plugin-contributed tabs so SettingsPage draws the core/plugins divider.
|
|
31326
31593
|
isPlugin: true,
|
|
31327
31594
|
group: tab.group
|
|
@@ -31369,12 +31636,12 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31369
31636
|
profileKnown: !activeTenantId || profileKnownFor === activeTenantId
|
|
31370
31637
|
});
|
|
31371
31638
|
const navError = configError ?? tenantCtx?.loadError ?? null;
|
|
31372
|
-
const onNavRetry =
|
|
31639
|
+
const onNavRetry = React122.useCallback(() => {
|
|
31373
31640
|
if (tenantCtx?.loadError) tenantCtx.retryOrgs();
|
|
31374
31641
|
else window.location.reload();
|
|
31375
31642
|
}, [tenantCtx]);
|
|
31376
31643
|
const currentProfile = usePermissionsStore((s) => s.currentProfile);
|
|
31377
|
-
const hasSystem =
|
|
31644
|
+
const hasSystem = React122.useCallback(
|
|
31378
31645
|
(perm) => {
|
|
31379
31646
|
if (!currentProfile) return false;
|
|
31380
31647
|
if (currentProfile.id === "owner" || currentProfile.name?.toLowerCase() === "owner") return true;
|
|
@@ -31388,8 +31655,8 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31388
31655
|
};
|
|
31389
31656
|
const path = useAdminPath();
|
|
31390
31657
|
const { user, signOut } = useAuth();
|
|
31391
|
-
|
|
31392
|
-
|
|
31658
|
+
React122.useEffect(() => installGlobalErrorHandlers(), []);
|
|
31659
|
+
React122.useEffect(() => registerErrorReporter((report) => {
|
|
31393
31660
|
if (report.source !== "data") return;
|
|
31394
31661
|
const alvo = report.extra?.operation;
|
|
31395
31662
|
toast.error(
|
|
@@ -31407,15 +31674,15 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31407
31674
|
const hasChatPanel = useRightRailStore((s) => s.panels.some((pn) => pn.id === "chat"));
|
|
31408
31675
|
const rightRail = railHasPanels ? /* @__PURE__ */ jsx(RightRail, { frame: contentFrame, attached: layout !== "topbar" }) : null;
|
|
31409
31676
|
const setRailMounted = useRightRailStore((s) => s.setMounted);
|
|
31410
|
-
|
|
31677
|
+
React122.useEffect(() => {
|
|
31411
31678
|
setRailMounted(true);
|
|
31412
31679
|
return () => setRailMounted(false);
|
|
31413
31680
|
}, [setRailMounted]);
|
|
31414
31681
|
useConnectorOAuthReturn();
|
|
31415
31682
|
const railWidthLive = useRightRailStore((s) => s.width);
|
|
31416
31683
|
const setSidebarCollapsed = useLayoutStore((s) => s.setSidebarCollapsed);
|
|
31417
|
-
const railAutoCollapsedRef =
|
|
31418
|
-
|
|
31684
|
+
const railAutoCollapsedRef = React122.useRef(false);
|
|
31685
|
+
React122.useEffect(() => {
|
|
31419
31686
|
if (layout !== "sidebar") return;
|
|
31420
31687
|
const SIDEBAR_EXPANDED = 224;
|
|
31421
31688
|
const MIN_CONTENT = 620;
|
|
@@ -31437,22 +31704,22 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31437
31704
|
window.addEventListener("resize", apply);
|
|
31438
31705
|
return () => window.removeEventListener("resize", apply);
|
|
31439
31706
|
}, [railOpen, railWidthLive, layout, setSidebarCollapsed]);
|
|
31440
|
-
const [railWidth] =
|
|
31707
|
+
const [railWidth] = React122.useState(() => readRightRailWidth());
|
|
31441
31708
|
const billingPlans = useBillingStore((s) => s.plans);
|
|
31442
31709
|
const hasBilling = billingPlans.length > 0;
|
|
31443
31710
|
const orgPlan = useTenantOptional()?.org?.plan;
|
|
31444
|
-
const planBadge =
|
|
31711
|
+
const planBadge = React122.useMemo(
|
|
31445
31712
|
() => hasBilling ? resolvePlanBadge(orgPlan, billingPlans) : null,
|
|
31446
31713
|
[hasBilling, orgPlan, billingPlans]
|
|
31447
31714
|
);
|
|
31448
|
-
const softLimitKeys =
|
|
31715
|
+
const softLimitKeys = React122.useMemo(() => {
|
|
31449
31716
|
const plan = billingPlans.find((p) => p.id === (orgPlan || "free"));
|
|
31450
31717
|
return Object.keys(getPlanEntitlements(plan)?.limits ?? {});
|
|
31451
31718
|
}, [billingPlans, orgPlan]);
|
|
31452
31719
|
const overshoots = useOvershoots();
|
|
31453
31720
|
const navContributions = useNavContributionsStore((s) => s.contributions);
|
|
31454
31721
|
const appConfigNav = useAppConfigStore((state) => state.config.nav);
|
|
31455
|
-
const navigation =
|
|
31722
|
+
const navigation = React122.useMemo(() => {
|
|
31456
31723
|
const contributed = Object.values(navContributions).flat();
|
|
31457
31724
|
const flat = dedupeByRoute(
|
|
31458
31725
|
[...runtime.navigation, ...contributed].map((entry) => ({
|
|
@@ -31523,7 +31790,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31523
31790
|
}).filter((item) => item !== null).sort(compareNavigation);
|
|
31524
31791
|
return applyRailPreset(gated, presetRail, presetHide, presetWhole);
|
|
31525
31792
|
}, [runtime.navigation, runtime.routes, navContributions, pages, access, navWaiting, presetRail, presetHide, presetWhole, presetLabels]);
|
|
31526
|
-
const composedNavigation =
|
|
31793
|
+
const composedNavigation = React122.useMemo(() => {
|
|
31527
31794
|
if (!appConfigNav.length) return navigation;
|
|
31528
31795
|
const keyed = navigation.map((item) => ({ ...item, key: item.route }));
|
|
31529
31796
|
return applyNavComposition(keyed, appConfigNav).map((item) => {
|
|
@@ -31539,13 +31806,13 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31539
31806
|
};
|
|
31540
31807
|
});
|
|
31541
31808
|
}, [navigation, appConfigNav]);
|
|
31542
|
-
const resolvedBottomNav =
|
|
31809
|
+
const resolvedBottomNav = React122.useMemo(
|
|
31543
31810
|
() => deriveBottomNav(navigation, bottomNav, { assistant: hasChatPanel }),
|
|
31544
31811
|
[navigation, bottomNav, hasChatPanel]
|
|
31545
31812
|
);
|
|
31546
31813
|
const commandPaletteOpen = useLayoutStore((s) => s.commandPaletteOpen);
|
|
31547
31814
|
const setCommandPaletteOpen = useLayoutStore((s) => s.setCommandPaletteOpen);
|
|
31548
|
-
const commandItems =
|
|
31815
|
+
const commandItems = React122.useMemo(() => {
|
|
31549
31816
|
const navGroup = tr("layout.commandPalette.navigation", "Navigation");
|
|
31550
31817
|
const items = [];
|
|
31551
31818
|
for (const nav of navigation) {
|
|
@@ -31557,7 +31824,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31557
31824
|
return items;
|
|
31558
31825
|
}, [navigation]);
|
|
31559
31826
|
const globalSearch = useGlobalSearch();
|
|
31560
|
-
const routes =
|
|
31827
|
+
const routes = React122.useMemo(() => {
|
|
31561
31828
|
const list = [];
|
|
31562
31829
|
const entityRouteMap = /* @__PURE__ */ new Map();
|
|
31563
31830
|
for (const r of runtime.routes) {
|
|
@@ -31580,14 +31847,14 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31580
31847
|
setEntityRouteMap(entityRouteMap);
|
|
31581
31848
|
return list.sort((a, b) => routeScore(b.path) - routeScore(a.path));
|
|
31582
31849
|
}, [runtime.routes, pages, showSettings]);
|
|
31583
|
-
const match =
|
|
31850
|
+
const match = React122.useMemo(() => {
|
|
31584
31851
|
for (const r of routes) {
|
|
31585
31852
|
const params = matchRoute(r.path, path);
|
|
31586
31853
|
if (params) return { route: r, params };
|
|
31587
31854
|
}
|
|
31588
31855
|
return null;
|
|
31589
31856
|
}, [routes, path]);
|
|
31590
|
-
|
|
31857
|
+
React122.useEffect(() => {
|
|
31591
31858
|
if (!match && (path === "/" || path === "") && navigation.length > 0) {
|
|
31592
31859
|
navigateTo(navigation[0].route);
|
|
31593
31860
|
}
|
|
@@ -31595,11 +31862,11 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31595
31862
|
const ActiveComponent = match?.route.Component;
|
|
31596
31863
|
const activeParams = match?.params ?? {};
|
|
31597
31864
|
const routeKey = (match?.route.path ?? path).replace(/\/\*$/, "");
|
|
31598
|
-
const settingsTabs =
|
|
31865
|
+
const settingsTabs = React122.useMemo(
|
|
31599
31866
|
() => buildSettingsTabs(runtime.settingsTabs, can, hasSystem, t, showOrgSettings, hasBilling),
|
|
31600
31867
|
[runtime.settingsTabs, can, hasSystem, t, showOrgSettings, hasBilling]
|
|
31601
31868
|
);
|
|
31602
|
-
const profileRoute =
|
|
31869
|
+
const profileRoute = React122.useMemo(() => {
|
|
31603
31870
|
const explicit = routes.find((r) => r.path === "/perfil" || r.path === "/profile");
|
|
31604
31871
|
if (explicit) return explicit.path;
|
|
31605
31872
|
return showSettings ? "/settings/profile" : null;
|
|
@@ -31607,7 +31874,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31607
31874
|
const onProfile = profileRoute ? () => navigateTo(profileRoute) : void 0;
|
|
31608
31875
|
const onBilling = hasBilling && showSettings ? () => navigateTo("/settings/subscription") : void 0;
|
|
31609
31876
|
const coreSettingsTabs = useCoreSettingsTabs({ showCompany: showBranding, showBranding });
|
|
31610
|
-
const allSettingsTabs =
|
|
31877
|
+
const allSettingsTabs = React122.useMemo(
|
|
31611
31878
|
() => {
|
|
31612
31879
|
const hidden = new Set(hiddenSettingsTabs ?? []);
|
|
31613
31880
|
const visible = [...coreSettingsTabs, ...settingsTabs].filter((tab) => !hidden.has(tab.id));
|
|
@@ -31623,12 +31890,12 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31623
31890
|
const moduleRail = !inSettings && layout === "sidebar" && contextualNav && (path === contextualNav.base || path.startsWith(contextualNav.base + "/")) ? contextualNav : null;
|
|
31624
31891
|
const settingsPathActive = showSettings && (path === "/settings" || path.startsWith("/settings/"));
|
|
31625
31892
|
const activeSettingsTab = settingsPathActive ? path === "/settings" ? null : path.slice("/settings/".length).split("/")[0] : void 0;
|
|
31626
|
-
const settingsTabDef =
|
|
31893
|
+
const settingsTabDef = React122.useMemo(() => {
|
|
31627
31894
|
if (!showSettings || !path.startsWith("/settings/")) return void 0;
|
|
31628
31895
|
const id = path.slice("/settings/".length).split("/")[0];
|
|
31629
31896
|
return allSettingsTabs.find((tab) => tab.id === id);
|
|
31630
31897
|
}, [showSettings, path, allSettingsTabs]);
|
|
31631
|
-
const settingsNavigation =
|
|
31898
|
+
const settingsNavigation = React122.useMemo(
|
|
31632
31899
|
() => allSettingsTabs.map((tab) => ({
|
|
31633
31900
|
id: `settings:${tab.id}`,
|
|
31634
31901
|
label: tab.label,
|
|
@@ -31646,10 +31913,10 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31646
31913
|
const shellUser = user ? { fullName: user.fullName ?? user.email, email: user.email, avatarUrl: user.avatarUrl } : void 0;
|
|
31647
31914
|
const moduleVariant = moduleNav ?? (layout === "sidebar" ? "tabs" : "rail");
|
|
31648
31915
|
const setRailAvailable = useContextualNavStore((s) => s.setRailAvailable);
|
|
31649
|
-
|
|
31916
|
+
React122.useEffect(() => {
|
|
31650
31917
|
setRailAvailable(layout === "sidebar" && moduleVariant !== "rail");
|
|
31651
31918
|
}, [layout, moduleVariant, setRailAvailable]);
|
|
31652
|
-
const activePageTitle =
|
|
31919
|
+
const activePageTitle = React122.useMemo(() => {
|
|
31653
31920
|
if (settingsTabDef) return settingsTabDef.label;
|
|
31654
31921
|
if (path === "/settings" || path.startsWith("/settings/")) return tr("common.settings", "Settings");
|
|
31655
31922
|
if (match?.route.title) return match.route.title;
|
|
@@ -31663,7 +31930,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31663
31930
|
if (hiddenHit?.label) return hiddenHit.label;
|
|
31664
31931
|
return candidates.find((n) => n.route === "/")?.label ?? "";
|
|
31665
31932
|
}, [navigation, pages, path, tr, match, settingsTabDef]);
|
|
31666
|
-
const parentBack =
|
|
31933
|
+
const parentBack = React122.useMemo(() => {
|
|
31667
31934
|
if (settingsTabDef) {
|
|
31668
31935
|
const first = allSettingsTabs[0]?.id;
|
|
31669
31936
|
return {
|
|
@@ -31701,9 +31968,9 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31701
31968
|
]
|
|
31702
31969
|
}
|
|
31703
31970
|
);
|
|
31704
|
-
const [railQuery, setRailQuery] =
|
|
31971
|
+
const [railQuery, setRailQuery] = React122.useState("");
|
|
31705
31972
|
const railBase = moduleRail?.base ?? null;
|
|
31706
|
-
|
|
31973
|
+
React122.useEffect(() => {
|
|
31707
31974
|
setRailQuery("");
|
|
31708
31975
|
}, [railBase]);
|
|
31709
31976
|
const railSearch = (placeholder) => /* @__PURE__ */ jsxs("div", { className: "relative px-0.5 pt-1", children: [
|
|
@@ -31916,7 +32183,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
31916
32183
|
]
|
|
31917
32184
|
}
|
|
31918
32185
|
),
|
|
31919
|
-
/* @__PURE__ */ jsx(
|
|
32186
|
+
/* @__PURE__ */ jsx(React122.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
|
|
31920
32187
|
CommandPalette,
|
|
31921
32188
|
{
|
|
31922
32189
|
commands: commandItems,
|
|
@@ -32183,7 +32450,7 @@ function buildI18nConfig(config) {
|
|
|
32183
32450
|
function BillingInitializer({ config }) {
|
|
32184
32451
|
const setPlans = useBillingStore((s) => s.setPlans);
|
|
32185
32452
|
const setCheckout = useBillingStore((s) => s.setCheckout);
|
|
32186
|
-
|
|
32453
|
+
React122.useEffect(() => {
|
|
32187
32454
|
if (config.billing?.plans) setPlans(config.billing.plans.map(normalizeBillingPlan));
|
|
32188
32455
|
setCheckout(config.billing?.onCheckout ?? null);
|
|
32189
32456
|
}, [config.billing, setPlans, setCheckout]);
|
|
@@ -32300,9 +32567,9 @@ function ThemeInitializer({ config }) {
|
|
|
32300
32567
|
const setOverrides = useThemeStore((s) => s.setOverrides);
|
|
32301
32568
|
const setMode = useThemeStore((s) => s.setMode);
|
|
32302
32569
|
const rawBranding = useOrganizationStore((s) => s.currentOrg?.settings?.branding);
|
|
32303
|
-
const brandTokens =
|
|
32570
|
+
const brandTokens = React122.useMemo(() => normalizeBrand(rawBranding).tokens, [rawBranding]);
|
|
32304
32571
|
const brandKey = JSON.stringify(brandTokens);
|
|
32305
|
-
|
|
32572
|
+
React122.useEffect(() => {
|
|
32306
32573
|
const tokens = JSON.parse(brandKey);
|
|
32307
32574
|
const brand = tokens.color?.primary ? hexToHslTriplet(tokens.color.primary) : null;
|
|
32308
32575
|
if (config.theme) {
|
|
@@ -32319,20 +32586,20 @@ function ThemeInitializer({ config }) {
|
|
|
32319
32586
|
return null;
|
|
32320
32587
|
}
|
|
32321
32588
|
function PersistentCacheInitializer() {
|
|
32322
|
-
|
|
32589
|
+
React122.useEffect(() => {
|
|
32323
32590
|
attachPersistentCache();
|
|
32324
32591
|
void getPersistentCache()?.hydrate();
|
|
32325
32592
|
}, []);
|
|
32326
32593
|
return null;
|
|
32327
32594
|
}
|
|
32328
32595
|
function FayzEventBridgeInitializer({ config }) {
|
|
32329
|
-
|
|
32596
|
+
React122.useEffect(() => startFayzEventBridge(config.chat?.agent), [config.chat?.agent]);
|
|
32330
32597
|
return null;
|
|
32331
32598
|
}
|
|
32332
32599
|
function TeamInitializer({ config }) {
|
|
32333
32600
|
const setTeamPersonKinds = useOrganizationStore((s) => s.setTeamPersonKinds);
|
|
32334
32601
|
const kinds = config.team?.personKinds;
|
|
32335
|
-
|
|
32602
|
+
React122.useEffect(() => {
|
|
32336
32603
|
setTeamPersonKinds(kinds ?? []);
|
|
32337
32604
|
}, [setTeamPersonKinds, kinds]);
|
|
32338
32605
|
return null;
|
|
@@ -32348,7 +32615,7 @@ function ChatRailPanel({ config }) {
|
|
|
32348
32615
|
const agent = config.chat?.agent;
|
|
32349
32616
|
const voice = config.chat?.voice;
|
|
32350
32617
|
const whatsapp = config.chat?.whatsapp;
|
|
32351
|
-
const Component2 =
|
|
32618
|
+
const Component2 = React122.useMemo(() => {
|
|
32352
32619
|
const Panel = () => /* @__PURE__ */ jsx(
|
|
32353
32620
|
ChatConversation,
|
|
32354
32621
|
{
|
|
@@ -32365,8 +32632,8 @@ function ChatRailPanel({ config }) {
|
|
|
32365
32632
|
const conversations = useChatStore((s) => s.conversations);
|
|
32366
32633
|
const setConversations = useChatStore((s) => s.setConversations);
|
|
32367
32634
|
const user = useAuthStore((s) => s.user);
|
|
32368
|
-
const connection =
|
|
32369
|
-
|
|
32635
|
+
const connection = React122.useMemo(() => resolveFayzAgentConnection(agent), [agent]);
|
|
32636
|
+
React122.useEffect(() => {
|
|
32370
32637
|
if (!connection) return;
|
|
32371
32638
|
getFayzAgentClient(connection).listConversations(user?.id).then(setConversations).catch(() => {
|
|
32372
32639
|
});
|
|
@@ -32375,7 +32642,7 @@ function ChatRailPanel({ config }) {
|
|
|
32375
32642
|
useAssistantInviteStore((s) => s.invite?.id === ASK_AI_HANDOFF_ID);
|
|
32376
32643
|
const activeAgent = useAgent();
|
|
32377
32644
|
const persona = activeAgent?.name ?? invitePersona;
|
|
32378
|
-
const icon =
|
|
32645
|
+
const icon = React122.useMemo(
|
|
32379
32646
|
() => activeAgent ? function AgentTabIcon() {
|
|
32380
32647
|
return /* @__PURE__ */ jsx(
|
|
32381
32648
|
AgentAvatar,
|
|
@@ -32390,7 +32657,7 @@ function ChatRailPanel({ config }) {
|
|
|
32390
32657
|
[activeAgent]
|
|
32391
32658
|
);
|
|
32392
32659
|
useRightRailPanel(
|
|
32393
|
-
|
|
32660
|
+
React122.useMemo(
|
|
32394
32661
|
() => ({
|
|
32395
32662
|
id: "chat",
|
|
32396
32663
|
label: persona ?? "Chat",
|
|
@@ -32404,17 +32671,17 @@ function ChatRailPanel({ config }) {
|
|
|
32404
32671
|
[Component2, conversations.length, persona, icon, activeAgent]
|
|
32405
32672
|
)
|
|
32406
32673
|
);
|
|
32407
|
-
|
|
32674
|
+
React122.useEffect(() => {
|
|
32408
32675
|
if (chatOpen) openPanel("chat");
|
|
32409
32676
|
}, [chatOpen, openPanel]);
|
|
32410
|
-
|
|
32677
|
+
React122.useEffect(() => {
|
|
32411
32678
|
if (!(railOpen && railActive === "chat")) setChatOpen(false);
|
|
32412
32679
|
}, [railOpen, railActive, setChatOpen]);
|
|
32413
32680
|
return null;
|
|
32414
32681
|
}
|
|
32415
32682
|
function AdminProviders({ config, children }) {
|
|
32416
32683
|
const currentOrg = useOrganizationStore((s) => s.currentOrg);
|
|
32417
|
-
const hasFayzAgent =
|
|
32684
|
+
const hasFayzAgent = React122.useMemo(
|
|
32418
32685
|
() => !!resolveFayzAgentConnection(config.chat?.agent),
|
|
32419
32686
|
[config.chat?.agent]
|
|
32420
32687
|
);
|
|
@@ -32423,7 +32690,7 @@ function AdminProviders({ config, children }) {
|
|
|
32423
32690
|
const surface = config.chat?.surface ?? "dock";
|
|
32424
32691
|
const onConsentScreen = typeof window !== "undefined" && window.location.pathname.replace(/\/+$/, "").endsWith("/connect");
|
|
32425
32692
|
const showFab = assistantEnabled && surface === "dock" && !onConsentScreen;
|
|
32426
|
-
const resolved =
|
|
32693
|
+
const resolved = React122.useMemo(() => {
|
|
32427
32694
|
if (config.supabaseUrl && config.supabaseAnonKey) {
|
|
32428
32695
|
createFayzSupabaseClient(config.supabaseUrl, config.supabaseAnonKey);
|
|
32429
32696
|
}
|
|
@@ -32441,7 +32708,7 @@ function AdminProviders({ config, children }) {
|
|
|
32441
32708
|
const { bindings, ready: configReady } = useAppConfig();
|
|
32442
32709
|
const offeredPlugins = useOfferedPlugins();
|
|
32443
32710
|
const path = useAdminPath();
|
|
32444
|
-
const runtime =
|
|
32711
|
+
const runtime = React122.useMemo(
|
|
32445
32712
|
() => resolvePluginRuntime({
|
|
32446
32713
|
plugins: resolved.plugins,
|
|
32447
32714
|
// Só as ligações DESTA conta. Na janela da troca o config em mãos ainda
|
|
@@ -32481,7 +32748,7 @@ function AdminProviders({ config, children }) {
|
|
|
32481
32748
|
}),
|
|
32482
32749
|
[resolved.plugins, bindings, offeredPlugins, configReady, path, config.layout, currentOrg]
|
|
32483
32750
|
);
|
|
32484
|
-
|
|
32751
|
+
React122.useEffect(() => {
|
|
32485
32752
|
if (!import.meta.env?.DEV || !currentOrg) return;
|
|
32486
32753
|
const registered = new Set(resolved.plugins.map((p) => p.id));
|
|
32487
32754
|
const bound = new Set(bindings.map((b) => b.pluginId));
|
|
@@ -32506,6 +32773,7 @@ function AdminProviders({ config, children }) {
|
|
|
32506
32773
|
/* @__PURE__ */ jsx(BillingInitializer, { config }),
|
|
32507
32774
|
/* @__PURE__ */ jsx(FayzEventBridgeInitializer, { config }),
|
|
32508
32775
|
/* @__PURE__ */ jsx(ToastProvider, {}),
|
|
32776
|
+
/* @__PURE__ */ jsx(UpdateReady, {}),
|
|
32509
32777
|
assistantEnabled && surface === "dock" && /* @__PURE__ */ jsx(ChatRailPanel, { config }),
|
|
32510
32778
|
/* @__PURE__ */ jsx(TasksRailPanel, {}),
|
|
32511
32779
|
/* @__PURE__ */ jsx(ActivationProvider, {}),
|
|
@@ -32832,8 +33100,8 @@ function manifestToFayzConfig(manifest, surfaceName) {
|
|
|
32832
33100
|
};
|
|
32833
33101
|
}
|
|
32834
33102
|
function AdminScaffold({ manifest, surface }) {
|
|
32835
|
-
const config =
|
|
32836
|
-
const authShellProps =
|
|
33103
|
+
const config = React122.useMemo(() => manifestToFayzConfig(manifest, surface), [manifest, surface]);
|
|
33104
|
+
const authShellProps = React122.useMemo(() => getAuthShellProps(config.auth), [config.auth]);
|
|
32837
33105
|
return /* @__PURE__ */ jsx(AdminProviders, { config, children: /* @__PURE__ */ jsx(ScaffoldShell, { config, authShellProps }) });
|
|
32838
33106
|
}
|
|
32839
33107
|
function ScaffoldShell({
|
|
@@ -33072,8 +33340,8 @@ function Badge24({ badge, className = "" }) {
|
|
|
33072
33340
|
}
|
|
33073
33341
|
function OrderDetailBlock({ title, hint, children }) {
|
|
33074
33342
|
return /* @__PURE__ */ jsxs("div", { className: "rounded-card border bg-card p-4", children: [
|
|
33075
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-2", children: [
|
|
33076
|
-
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: title }),
|
|
33343
|
+
(title || hint) && /* @__PURE__ */ jsxs("div", { className: "mb-2", children: [
|
|
33344
|
+
title && /* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: title }),
|
|
33077
33345
|
hint && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: hint })
|
|
33078
33346
|
] }),
|
|
33079
33347
|
children
|
|
@@ -33274,12 +33542,12 @@ function CrudRecordModal({
|
|
|
33274
33542
|
essentialFirst,
|
|
33275
33543
|
notice
|
|
33276
33544
|
}) {
|
|
33277
|
-
const [record, setRecord] =
|
|
33278
|
-
const [loading, setLoading] =
|
|
33279
|
-
const [saving, setSaving] =
|
|
33280
|
-
const [error, setError] =
|
|
33281
|
-
const formId =
|
|
33282
|
-
|
|
33545
|
+
const [record, setRecord] = React122.useState(null);
|
|
33546
|
+
const [loading, setLoading] = React122.useState(false);
|
|
33547
|
+
const [saving, setSaving] = React122.useState(false);
|
|
33548
|
+
const [error, setError] = React122.useState(null);
|
|
33549
|
+
const formId = React122.useId();
|
|
33550
|
+
React122.useEffect(() => {
|
|
33283
33551
|
if (!open) return;
|
|
33284
33552
|
setError(null);
|
|
33285
33553
|
if (mode === "create" || !load) {
|
|
@@ -33355,9 +33623,9 @@ function LookupCreateInline({
|
|
|
33355
33623
|
className
|
|
33356
33624
|
}) {
|
|
33357
33625
|
const t = useTranslation();
|
|
33358
|
-
const [saving, setSaving] =
|
|
33359
|
-
const [error, setError] =
|
|
33360
|
-
const submitForm =
|
|
33626
|
+
const [saving, setSaving] = React122.useState(false);
|
|
33627
|
+
const [error, setError] = React122.useState(null);
|
|
33628
|
+
const submitForm = React122.useRef(null);
|
|
33361
33629
|
async function submit(data) {
|
|
33362
33630
|
setSaving(true);
|
|
33363
33631
|
setError(null);
|
|
@@ -33434,17 +33702,17 @@ function LookupCreateInline({
|
|
|
33434
33702
|
);
|
|
33435
33703
|
}
|
|
33436
33704
|
function useLookupCreate(lookup, onCreated, options = {}) {
|
|
33437
|
-
const [draftName, setDraftName] =
|
|
33705
|
+
const [draftName, setDraftName] = React122.useState(null);
|
|
33438
33706
|
const can = usePermissionOptional();
|
|
33439
33707
|
const entityDef = lookup?.entityDef;
|
|
33440
33708
|
const feature = entityDef?.permission?.feature;
|
|
33441
33709
|
const allowed = !feature || can(feature, "create");
|
|
33442
33710
|
const canCreate = !!lookup?.create && allowed;
|
|
33443
|
-
const createByName =
|
|
33711
|
+
const createByName = React122.useCallback(async (name) => {
|
|
33444
33712
|
if (!lookup?.create) return;
|
|
33445
33713
|
onCreated(await lookup.create({ name }));
|
|
33446
33714
|
}, [lookup, onCreated]);
|
|
33447
|
-
const onCreate =
|
|
33715
|
+
const onCreate = React122.useMemo(() => {
|
|
33448
33716
|
if (!canCreate) return void 0;
|
|
33449
33717
|
if (!entityDef) return (name) => {
|
|
33450
33718
|
void createByName(name);
|
|
@@ -33532,8 +33800,8 @@ function OrderFormItemRow({
|
|
|
33532
33800
|
const rawKindLabel = itemTypes.find((tp) => tp.value === itemKind)?.label ?? itemKind;
|
|
33533
33801
|
const kindLabel = !itemKind || itemKind === "other" ? null : rawKindLabel;
|
|
33534
33802
|
const hasAdjustments = (discount ?? 0) > 0 || (surcharge ?? 0) > 0;
|
|
33535
|
-
const [showAdjustments, setShowAdjustments] =
|
|
33536
|
-
const [openExtras, setOpenExtras] =
|
|
33803
|
+
const [showAdjustments, setShowAdjustments] = React122.useState(hasAdjustments);
|
|
33804
|
+
const [openExtras, setOpenExtras] = React122.useState(
|
|
33537
33805
|
() => (extraFieldGroups ?? []).filter((g) => g.filled).map((g) => g.id)
|
|
33538
33806
|
);
|
|
33539
33807
|
const lookup = entityLookups[itemKind];
|
|
@@ -34177,7 +34445,7 @@ function OrderCreateScreen({
|
|
|
34177
34445
|
errorActions,
|
|
34178
34446
|
saveBar
|
|
34179
34447
|
}) {
|
|
34180
|
-
const subtotal =
|
|
34448
|
+
const subtotal = React122.useMemo(
|
|
34181
34449
|
() => lines.reduce((sum, line) => sum + line.unitPrice * line.quantity, 0),
|
|
34182
34450
|
[lines]
|
|
34183
34451
|
);
|
|
@@ -34328,7 +34596,7 @@ function mergeLines(current2, incoming) {
|
|
|
34328
34596
|
return merged;
|
|
34329
34597
|
}
|
|
34330
34598
|
function ItemPicker({ search, onPick }) {
|
|
34331
|
-
const [open, setOpen] =
|
|
34599
|
+
const [open, setOpen] = React122.useState(false);
|
|
34332
34600
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34333
34601
|
/* @__PURE__ */ jsxs(
|
|
34334
34602
|
"button",
|
|
@@ -34406,9 +34674,9 @@ function KanbanBoard({
|
|
|
34406
34674
|
toolbarActions
|
|
34407
34675
|
}) {
|
|
34408
34676
|
const collapsible = !!onToggleColumn;
|
|
34409
|
-
const frameRef =
|
|
34410
|
-
const [hoveredCol, setHoveredCol] =
|
|
34411
|
-
const centerFocused =
|
|
34677
|
+
const frameRef = React122.useRef(null);
|
|
34678
|
+
const [hoveredCol, setHoveredCol] = React122.useState(null);
|
|
34679
|
+
const centerFocused = React122.useCallback((event) => {
|
|
34412
34680
|
const frame = frameRef.current;
|
|
34413
34681
|
const column = event.target?.closest("[data-kanban-column]");
|
|
34414
34682
|
if (!frame || !column || frame.scrollWidth <= frame.clientWidth) return;
|
|
@@ -34520,10 +34788,10 @@ function BoardFrame({
|
|
|
34520
34788
|
toolbarActions,
|
|
34521
34789
|
className = ""
|
|
34522
34790
|
}) {
|
|
34523
|
-
const [open, setOpen] =
|
|
34524
|
-
const inputRef =
|
|
34791
|
+
const [open, setOpen] = React122.useState(false);
|
|
34792
|
+
const inputRef = React122.useRef(null);
|
|
34525
34793
|
const expanded = open || !!search;
|
|
34526
|
-
|
|
34794
|
+
React122.useEffect(() => {
|
|
34527
34795
|
if (open) inputRef.current?.focus();
|
|
34528
34796
|
}, [open]);
|
|
34529
34797
|
function collapse() {
|
|
@@ -34602,14 +34870,14 @@ function OrderBoardView({
|
|
|
34602
34870
|
rowId,
|
|
34603
34871
|
selectedRowId
|
|
34604
34872
|
}) {
|
|
34605
|
-
const getId =
|
|
34873
|
+
const getId = React122.useCallback(
|
|
34606
34874
|
(row) => rowId ? rowId(row) : String(row.id ?? ""),
|
|
34607
34875
|
[rowId]
|
|
34608
34876
|
);
|
|
34609
|
-
const [lastClicked, setLastClicked] =
|
|
34610
|
-
const [advancing, setAdvancing] =
|
|
34877
|
+
const [lastClicked, setLastClicked] = React122.useState(null);
|
|
34878
|
+
const [advancing, setAdvancing] = React122.useState({});
|
|
34611
34879
|
const selected = selectedRowId !== void 0 ? selectedRowId : lastClicked;
|
|
34612
|
-
const grouped =
|
|
34880
|
+
const grouped = React122.useMemo(() => {
|
|
34613
34881
|
const map = /* @__PURE__ */ new Map();
|
|
34614
34882
|
for (const col of board.columns) map.set(col.id, []);
|
|
34615
34883
|
for (const row of rows) {
|
|
@@ -34733,24 +35001,24 @@ function OrderListView({
|
|
|
34733
35001
|
boards,
|
|
34734
35002
|
viewKey
|
|
34735
35003
|
}) {
|
|
34736
|
-
const [search, setSearch] =
|
|
34737
|
-
const [page, setPage] =
|
|
34738
|
-
const [rawSelection, setRawSelection] =
|
|
34739
|
-
const offered =
|
|
35004
|
+
const [search, setSearch] = React122.useState("");
|
|
35005
|
+
const [page, setPage] = React122.useState(1);
|
|
35006
|
+
const [rawSelection, setRawSelection] = React122.useState([]);
|
|
35007
|
+
const offered = React122.useMemo(
|
|
34740
35008
|
() => views && views.length > 0 ? views : ["list"],
|
|
34741
35009
|
[views]
|
|
34742
35010
|
);
|
|
34743
|
-
const customFor =
|
|
35011
|
+
const customFor = React122.useCallback(
|
|
34744
35012
|
(id) => boards?.[id]?.render ?? null,
|
|
34745
35013
|
[boards]
|
|
34746
35014
|
);
|
|
34747
|
-
const boardFor =
|
|
35015
|
+
const boardFor = React122.useCallback(
|
|
34748
35016
|
(id) => (id === "board" ? board : boards?.[id]?.config) ?? null,
|
|
34749
35017
|
[board, boards]
|
|
34750
35018
|
);
|
|
34751
35019
|
const canBoard = offered.length > 1 && offered.some((id) => id !== "list" && (!!boardFor(id) || !!customFor(id)));
|
|
34752
35020
|
const storageKey2 = viewKey ? `fayz.orderView.${viewKey}` : null;
|
|
34753
|
-
const [view, setView] =
|
|
35021
|
+
const [view, setView] = React122.useState(() => {
|
|
34754
35022
|
const fallback = offered.includes(defaultView) ? defaultView : offered[0];
|
|
34755
35023
|
if (!storageKey2) return fallback;
|
|
34756
35024
|
try {
|
|
@@ -34760,7 +35028,7 @@ function OrderListView({
|
|
|
34760
35028
|
return fallback;
|
|
34761
35029
|
}
|
|
34762
35030
|
});
|
|
34763
|
-
const viewTabs =
|
|
35031
|
+
const viewTabs = React122.useMemo(
|
|
34764
35032
|
() => offered.map((option) => ({
|
|
34765
35033
|
value: option,
|
|
34766
35034
|
label: option === "list" ? "Lista" : boards?.[option]?.label ?? "Quadro",
|
|
@@ -34768,7 +35036,7 @@ function OrderListView({
|
|
|
34768
35036
|
})),
|
|
34769
35037
|
[offered, boards]
|
|
34770
35038
|
);
|
|
34771
|
-
const chooseView =
|
|
35039
|
+
const chooseView = React122.useCallback((next) => {
|
|
34772
35040
|
setView(next);
|
|
34773
35041
|
if (!storageKey2) return;
|
|
34774
35042
|
try {
|
|
@@ -34786,7 +35054,7 @@ function OrderListView({
|
|
|
34786
35054
|
const activeBoard = view === "list" ? null : boardFor(view);
|
|
34787
35055
|
const activeCustom = view === "list" ? null : customFor(view);
|
|
34788
35056
|
const showingBoard = !!activeBoard || !!activeCustom;
|
|
34789
|
-
const cols =
|
|
35057
|
+
const cols = React122.useMemo(
|
|
34790
35058
|
() => columns.map((c) => ({
|
|
34791
35059
|
id: c.key,
|
|
34792
35060
|
header: () => /* @__PURE__ */ jsx("div", { className: c.align === "right" ? "text-right" : "", children: c.header }),
|
|
@@ -34794,25 +35062,25 @@ function OrderListView({
|
|
|
34794
35062
|
})),
|
|
34795
35063
|
[columns]
|
|
34796
35064
|
);
|
|
34797
|
-
const filtered =
|
|
35065
|
+
const filtered = React122.useMemo(() => {
|
|
34798
35066
|
const term = search.trim().toLowerCase();
|
|
34799
35067
|
if (!term || !searchText) return rows;
|
|
34800
35068
|
return rows.filter((row) => searchText(row).toLowerCase().includes(term));
|
|
34801
35069
|
}, [rows, search, searchText]);
|
|
34802
|
-
|
|
35070
|
+
React122.useEffect(() => {
|
|
34803
35071
|
setPage(1);
|
|
34804
35072
|
}, [search]);
|
|
34805
35073
|
const paged = pageSize > 0 ? filtered.slice((page - 1) * pageSize, page * pageSize) : filtered;
|
|
34806
|
-
const getId =
|
|
35074
|
+
const getId = React122.useCallback(
|
|
34807
35075
|
(row) => rowId ? rowId(row) : String(row.id ?? ""),
|
|
34808
35076
|
[rowId]
|
|
34809
35077
|
);
|
|
34810
|
-
const pageIds =
|
|
34811
|
-
const selectedIds =
|
|
35078
|
+
const pageIds = React122.useMemo(() => paged.map(getId), [paged, getId]);
|
|
35079
|
+
const selectedIds = React122.useMemo(
|
|
34812
35080
|
() => rawSelection.filter((id) => pageIds.includes(id)),
|
|
34813
35081
|
[rawSelection, pageIds]
|
|
34814
35082
|
);
|
|
34815
|
-
const selectedRows =
|
|
35083
|
+
const selectedRows = React122.useMemo(
|
|
34816
35084
|
() => paged.filter((row) => selectedIds.includes(getId(row))),
|
|
34817
35085
|
[paged, selectedIds, getId]
|
|
34818
35086
|
);
|
|
@@ -34962,13 +35230,13 @@ function PaymentStatusBadge({
|
|
|
34962
35230
|
receiveLabel = "Receber",
|
|
34963
35231
|
onOpenDetails
|
|
34964
35232
|
}) {
|
|
34965
|
-
const [open, setOpen] =
|
|
34966
|
-
const [lines, setLines] =
|
|
34967
|
-
const timer =
|
|
34968
|
-
|
|
35233
|
+
const [open, setOpen] = React122__default.useState(false);
|
|
35234
|
+
const [lines, setLines] = React122__default.useState(null);
|
|
35235
|
+
const timer = React122__default.useRef(null);
|
|
35236
|
+
React122__default.useEffect(() => {
|
|
34969
35237
|
setLines(null);
|
|
34970
35238
|
}, [status, paidAmount]);
|
|
34971
|
-
const load =
|
|
35239
|
+
const load = React122__default.useCallback(() => {
|
|
34972
35240
|
if (lines || !onLoadDetails) return;
|
|
34973
35241
|
void onLoadDetails().then(setLines).catch(() => setLines([]));
|
|
34974
35242
|
}, [lines, onLoadDetails]);
|
|
@@ -35103,13 +35371,13 @@ function invalidateOrdersPaymentStatus(orderId) {
|
|
|
35103
35371
|
else cache2.clear();
|
|
35104
35372
|
}
|
|
35105
35373
|
function useOrdersPaymentStatus(orderIds) {
|
|
35106
|
-
const key =
|
|
35374
|
+
const key = React122.useMemo(
|
|
35107
35375
|
() => Array.from(new Set(orderIds.filter(Boolean))).sort().join(","),
|
|
35108
35376
|
[orderIds]
|
|
35109
35377
|
);
|
|
35110
|
-
const [byOrder, setByOrder] =
|
|
35111
|
-
const [loading, setLoading] =
|
|
35112
|
-
const load =
|
|
35378
|
+
const [byOrder, setByOrder] = React122.useState(() => /* @__PURE__ */ new Map());
|
|
35379
|
+
const [loading, setLoading] = React122.useState(false);
|
|
35380
|
+
const load = React122.useCallback(async (force = false) => {
|
|
35113
35381
|
const ids = key ? key.split(",") : [];
|
|
35114
35382
|
if (ids.length === 0) {
|
|
35115
35383
|
setByOrder(/* @__PURE__ */ new Map());
|
|
@@ -35140,7 +35408,7 @@ function useOrdersPaymentStatus(orderIds) {
|
|
|
35140
35408
|
}
|
|
35141
35409
|
setByOrder(new Map(ids.map((id) => [id, cache2.get(id)]).filter(([, v]) => Boolean(v))));
|
|
35142
35410
|
}, [key]);
|
|
35143
|
-
|
|
35411
|
+
React122.useEffect(() => {
|
|
35144
35412
|
void load();
|
|
35145
35413
|
}, [load]);
|
|
35146
35414
|
return { byOrder, loading, reload: () => load(true) };
|
|
@@ -35207,12 +35475,12 @@ function money(value, currency) {
|
|
|
35207
35475
|
return value.toLocaleString("pt-BR", { style: "currency", currency: currency || "BRL" });
|
|
35208
35476
|
}
|
|
35209
35477
|
function useOrderDetail(orderId) {
|
|
35210
|
-
const [order, setOrder] =
|
|
35211
|
-
const [loading, setLoading] =
|
|
35212
|
-
const [error, setError] =
|
|
35213
|
-
const [nonce, setNonce] =
|
|
35214
|
-
const reload =
|
|
35215
|
-
|
|
35478
|
+
const [order, setOrder] = React122.useState(null);
|
|
35479
|
+
const [loading, setLoading] = React122.useState(false);
|
|
35480
|
+
const [error, setError] = React122.useState(null);
|
|
35481
|
+
const [nonce, setNonce] = React122.useState(0);
|
|
35482
|
+
const reload = React122.useCallback(() => setNonce((n) => n + 1), []);
|
|
35483
|
+
React122.useEffect(() => {
|
|
35216
35484
|
if (!orderId) {
|
|
35217
35485
|
setOrder(null);
|
|
35218
35486
|
setError(null);
|
|
@@ -35329,8 +35597,8 @@ function OrderDetailRail({
|
|
|
35329
35597
|
}) {
|
|
35330
35598
|
const { order, loading, error, reload } = useOrderDetail(orderId);
|
|
35331
35599
|
const { byOrder: paymentByOrder } = useOrdersPaymentStatus([orderId]);
|
|
35332
|
-
const [running, setRunning] =
|
|
35333
|
-
const [pending2, setPending] =
|
|
35600
|
+
const [running, setRunning] = React122.useState(null);
|
|
35601
|
+
const [pending2, setPending] = React122.useState(null);
|
|
35334
35602
|
const perform = async (action) => {
|
|
35335
35603
|
if (!order) return;
|
|
35336
35604
|
setRunning(action.id);
|
|
@@ -35488,11 +35756,11 @@ function receivableTone(value) {
|
|
|
35488
35756
|
return "warning";
|
|
35489
35757
|
}
|
|
35490
35758
|
function useOrderReceivable(orderId) {
|
|
35491
|
-
const [receivable, setReceivable] =
|
|
35759
|
+
const [receivable, setReceivable] = React122.useState(
|
|
35492
35760
|
() => orderId ? cache3.get(orderId) ?? null : null
|
|
35493
35761
|
);
|
|
35494
|
-
const [loading, setLoading] =
|
|
35495
|
-
const reload =
|
|
35762
|
+
const [loading, setLoading] = React122.useState(() => Boolean(orderId) && !cache3.has(orderId));
|
|
35763
|
+
const reload = React122.useCallback(async (force = false) => {
|
|
35496
35764
|
if (!orderId) return;
|
|
35497
35765
|
const db2 = getSupabaseClientOptional();
|
|
35498
35766
|
if (!db2) {
|
|
@@ -35515,7 +35783,7 @@ function useOrderReceivable(orderId) {
|
|
|
35515
35783
|
setReceivable(next);
|
|
35516
35784
|
setLoading(false);
|
|
35517
35785
|
}, [orderId]);
|
|
35518
|
-
|
|
35786
|
+
React122.useEffect(() => {
|
|
35519
35787
|
void reload();
|
|
35520
35788
|
}, [reload]);
|
|
35521
35789
|
return { receivable, loading, reload };
|
|
@@ -35668,15 +35936,15 @@ function linesOf(order) {
|
|
|
35668
35936
|
}
|
|
35669
35937
|
function useOrderEditor(orderId) {
|
|
35670
35938
|
const { order, loading, error } = useOrderDetail(orderId);
|
|
35671
|
-
const [lines, setLines] =
|
|
35672
|
-
const [saving, setSaving] =
|
|
35673
|
-
const originalRef =
|
|
35674
|
-
|
|
35939
|
+
const [lines, setLines] = React122.useState([]);
|
|
35940
|
+
const [saving, setSaving] = React122.useState(false);
|
|
35941
|
+
const originalRef = React122.useRef([]);
|
|
35942
|
+
React122.useEffect(() => {
|
|
35675
35943
|
const seeded = linesOf(order);
|
|
35676
35944
|
originalRef.current = seeded;
|
|
35677
35945
|
setLines(seeded);
|
|
35678
35946
|
}, [order]);
|
|
35679
|
-
const dirty =
|
|
35947
|
+
const dirty = React122.useMemo(() => {
|
|
35680
35948
|
const before = originalRef.current;
|
|
35681
35949
|
if (before.length !== lines.length) return true;
|
|
35682
35950
|
return lines.some((line, i) => {
|
|
@@ -35684,7 +35952,7 @@ function useOrderEditor(orderId) {
|
|
|
35684
35952
|
return !was || was.key !== line.key || was.quantity !== line.quantity || was.unitPrice !== line.unitPrice;
|
|
35685
35953
|
});
|
|
35686
35954
|
}, [lines]);
|
|
35687
|
-
const save =
|
|
35955
|
+
const save = React122.useCallback(async () => {
|
|
35688
35956
|
if (!orderId || !order) return { ok: false, error: "Pedido n\xE3o carregado" };
|
|
35689
35957
|
const db2 = getSupabaseClientOptional();
|
|
35690
35958
|
if (!db2) return { ok: false, error: "Sem conex\xE3o" };
|
|
@@ -36014,11 +36282,11 @@ function PersonTimeline({
|
|
|
36014
36282
|
pageSize,
|
|
36015
36283
|
activeSourceIds
|
|
36016
36284
|
});
|
|
36017
|
-
const toneBySource =
|
|
36285
|
+
const toneBySource = React122__default.useMemo(
|
|
36018
36286
|
() => new Map(sources2.map((s) => [s.id, s.tone ?? "neutral"])),
|
|
36019
36287
|
[sources2]
|
|
36020
36288
|
);
|
|
36021
|
-
const hrefFor =
|
|
36289
|
+
const hrefFor = React122__default.useCallback(
|
|
36022
36290
|
(item) => {
|
|
36023
36291
|
if (item.href) return item.href;
|
|
36024
36292
|
if (!recordPath || !item.targetTab) return void 0;
|
|
@@ -36061,19 +36329,19 @@ function PersonTimeline({
|
|
|
36061
36329
|
}
|
|
36062
36330
|
function createPlaceholder(title, description) {
|
|
36063
36331
|
return function PlaceholderPage() {
|
|
36064
|
-
return
|
|
36332
|
+
return React122__default.createElement(
|
|
36065
36333
|
"div",
|
|
36066
36334
|
{ className: "mx-auto max-w-4xl" },
|
|
36067
|
-
|
|
36068
|
-
description ?
|
|
36069
|
-
|
|
36335
|
+
React122__default.createElement("h1", { className: "text-3xl font-bold text-foreground" }, title),
|
|
36336
|
+
description ? React122__default.createElement("p", { className: "mt-1 text-muted-foreground" }, description) : null,
|
|
36337
|
+
React122__default.createElement(
|
|
36070
36338
|
"div",
|
|
36071
36339
|
{ className: "mt-8 flex items-center justify-center rounded-card border border-dashed border-border bg-card p-16" },
|
|
36072
|
-
|
|
36340
|
+
React122__default.createElement(
|
|
36073
36341
|
"div",
|
|
36074
36342
|
{ className: "text-center" },
|
|
36075
|
-
|
|
36076
|
-
|
|
36343
|
+
React122__default.createElement("p", { className: "text-lg font-medium text-muted-foreground" }, "Coming Soon"),
|
|
36344
|
+
React122__default.createElement(
|
|
36077
36345
|
"p",
|
|
36078
36346
|
{ className: "mt-1 text-sm text-muted-foreground/70" },
|
|
36079
36347
|
"This module is being built as a plugin."
|
|
@@ -36154,7 +36422,7 @@ function ModuleActionBar({
|
|
|
36154
36422
|
trailing
|
|
36155
36423
|
}) {
|
|
36156
36424
|
const t = useTranslation();
|
|
36157
|
-
const actions =
|
|
36425
|
+
const actions = React122__default.useMemo(() => {
|
|
36158
36426
|
const out = (quickActions ?? []).map((qa, i) => ({
|
|
36159
36427
|
id: qa.id,
|
|
36160
36428
|
label: qa.label,
|
|
@@ -36186,9 +36454,9 @@ function ModuleActionBar({
|
|
|
36186
36454
|
] });
|
|
36187
36455
|
}
|
|
36188
36456
|
function createPluginContext(displayName) {
|
|
36189
|
-
const ConfigContext =
|
|
36190
|
-
const ProviderContext =
|
|
36191
|
-
const StoreContext =
|
|
36457
|
+
const ConfigContext = React122__default.createContext(null);
|
|
36458
|
+
const ProviderContext = React122__default.createContext(null);
|
|
36459
|
+
const StoreContext = React122__default.createContext(null);
|
|
36192
36460
|
const ContextProvider = ({
|
|
36193
36461
|
config,
|
|
36194
36462
|
provider: provider2,
|
|
@@ -36197,17 +36465,17 @@ function createPluginContext(displayName) {
|
|
|
36197
36465
|
}) => /* @__PURE__ */ jsx(ConfigContext.Provider, { value: config, children: /* @__PURE__ */ jsx(ProviderContext.Provider, { value: provider2, children: /* @__PURE__ */ jsx(StoreContext.Provider, { value: store, children }) }) });
|
|
36198
36466
|
ContextProvider.displayName = `${displayName}ContextProvider`;
|
|
36199
36467
|
function useConfig() {
|
|
36200
|
-
const ctx =
|
|
36468
|
+
const ctx = React122__default.useContext(ConfigContext);
|
|
36201
36469
|
if (!ctx) throw new Error(`useConfig must be used within ${displayName}`);
|
|
36202
36470
|
return ctx;
|
|
36203
36471
|
}
|
|
36204
36472
|
function useProvider() {
|
|
36205
|
-
const ctx =
|
|
36473
|
+
const ctx = React122__default.useContext(ProviderContext);
|
|
36206
36474
|
if (!ctx) throw new Error(`useProvider must be used within ${displayName}`);
|
|
36207
36475
|
return ctx;
|
|
36208
36476
|
}
|
|
36209
36477
|
function useStore2(selector) {
|
|
36210
|
-
const store =
|
|
36478
|
+
const store = React122__default.useContext(StoreContext);
|
|
36211
36479
|
if (!store) throw new Error(`useStore must be used within ${displayName}`);
|
|
36212
36480
|
return useStore$1(store, selector);
|
|
36213
36481
|
}
|
|
@@ -36264,7 +36532,7 @@ function PluginRegistryManager({ registries, routeBase, className }) {
|
|
|
36264
36532
|
return registries[0]?.id ?? "";
|
|
36265
36533
|
};
|
|
36266
36534
|
const [activeTab, setActiveTab] = useState(getTabFromHash);
|
|
36267
|
-
|
|
36535
|
+
React122__default.useEffect(() => {
|
|
36268
36536
|
if (!routeBase) return;
|
|
36269
36537
|
const handler = () => setActiveTab(getTabFromHash());
|
|
36270
36538
|
window.addEventListener("hashchange", handler);
|
|
@@ -36475,7 +36743,7 @@ function PersonLink2({ personId, name, lookup, kind, profileHref, tab, size = "d
|
|
|
36475
36743
|
const email = data?.email;
|
|
36476
36744
|
const phone = data?.phone;
|
|
36477
36745
|
const resolvedKind = kind ?? data?.kind ?? person?.group;
|
|
36478
|
-
const actions =
|
|
36746
|
+
const actions = React122__default.useMemo(
|
|
36479
36747
|
() => personId ? getPersonActions(resolvedKind) : [],
|
|
36480
36748
|
[personId, resolvedKind]
|
|
36481
36749
|
);
|
|
@@ -37170,10 +37438,10 @@ function useTeachMe(def) {
|
|
|
37170
37438
|
return useFeatureHelp(def).teach;
|
|
37171
37439
|
}
|
|
37172
37440
|
function useFeatureHelp(def) {
|
|
37173
|
-
const ref =
|
|
37441
|
+
const ref = React122.useRef(def);
|
|
37174
37442
|
ref.current = def;
|
|
37175
37443
|
const id = `teach.${def.feature}`;
|
|
37176
|
-
const contribution =
|
|
37444
|
+
const contribution = React122.useMemo(
|
|
37177
37445
|
() => ({
|
|
37178
37446
|
id,
|
|
37179
37447
|
pluginId: "teach-me",
|
|
@@ -37207,7 +37475,7 @@ function useFeatureHelp(def) {
|
|
|
37207
37475
|
[id]
|
|
37208
37476
|
);
|
|
37209
37477
|
useAgentSurface(contribution);
|
|
37210
|
-
return
|
|
37478
|
+
return React122.useMemo(
|
|
37211
37479
|
() => ({
|
|
37212
37480
|
help: () => helpWith(ref.current),
|
|
37213
37481
|
teach: () => teachMe(ref.current),
|
|
@@ -37373,21 +37641,21 @@ function ConnectorsHub({ hostPluginId }) {
|
|
|
37373
37641
|
const { t } = useTranslation$1();
|
|
37374
37642
|
const { connectors, reload } = useConnectors({ includeGrants: false });
|
|
37375
37643
|
const assistantAvailable = useConnectorsPanelAvailable();
|
|
37376
|
-
const [selected, setSelected] =
|
|
37377
|
-
const [adding, setAdding] =
|
|
37378
|
-
const hosted =
|
|
37644
|
+
const [selected, setSelected] = React122__default.useState(null);
|
|
37645
|
+
const [adding, setAdding] = React122__default.useState(false);
|
|
37646
|
+
const hosted = React122__default.useMemo(
|
|
37379
37647
|
() => (connectors ?? []).filter((c) => c.hostPluginId === hostPluginId),
|
|
37380
37648
|
[connectors, hostPluginId]
|
|
37381
37649
|
);
|
|
37382
|
-
const categories =
|
|
37650
|
+
const categories = React122__default.useMemo(
|
|
37383
37651
|
() => [...new Set(hosted.map((c) => c.category).filter((c) => !!c))],
|
|
37384
37652
|
[hosted]
|
|
37385
37653
|
);
|
|
37386
|
-
const scoped =
|
|
37654
|
+
const scoped = React122__default.useMemo(() => {
|
|
37387
37655
|
const siblings = inCategories(connectors ?? [], categories).filter((c) => c.hostPluginId !== hostPluginId);
|
|
37388
37656
|
return [...hosted, ...siblings];
|
|
37389
37657
|
}, [connectors, hosted, categories, hostPluginId]);
|
|
37390
|
-
|
|
37658
|
+
React122__default.useEffect(() => {
|
|
37391
37659
|
if (!selected || !connectors) return;
|
|
37392
37660
|
const fresh = connectors.find((c) => c.id === selected.id);
|
|
37393
37661
|
if (fresh && fresh !== selected) setSelected(fresh);
|
|
@@ -37522,7 +37790,7 @@ function PropertiesTab({ registries, routeBase, regLabel }) {
|
|
|
37522
37790
|
return registries[0]?.id ?? "";
|
|
37523
37791
|
}
|
|
37524
37792
|
const [active2, setActive] = useState(getActive);
|
|
37525
|
-
|
|
37793
|
+
React122__default.useEffect(() => {
|
|
37526
37794
|
const handler = () => setActive(getActive());
|
|
37527
37795
|
window.addEventListener("hashchange", handler);
|
|
37528
37796
|
return () => window.removeEventListener("hashchange", handler);
|
|
@@ -37597,7 +37865,7 @@ function PluginSettingsPanel({ title, generalSettings, registries, customTabs, r
|
|
|
37597
37865
|
return tabs[0]?.id ?? "";
|
|
37598
37866
|
}
|
|
37599
37867
|
const [activeTab, setActiveTab] = useState(getActiveFromHash);
|
|
37600
|
-
|
|
37868
|
+
React122__default.useEffect(() => {
|
|
37601
37869
|
const handler = () => setActiveTab(getActiveFromHash());
|
|
37602
37870
|
window.addEventListener("hashchange", handler);
|
|
37603
37871
|
return () => window.removeEventListener("hashchange", handler);
|
|
@@ -37624,6 +37892,6 @@ var renderApp = (...args) => {
|
|
|
37624
37892
|
return renderApp$1(...args);
|
|
37625
37893
|
};
|
|
37626
37894
|
|
|
37627
|
-
export { ALWAYS_ON_TOOLS, ActivationChecklistCard, ActivationProvider, AddConnectorButton, AddConnectorPanel, AdminProviders, AdminScaffold, AdminShell, AskAIButton, AskAIMenuItem, AssistantInvite, BoardFrame, ChatConversation, ClientOrdersTab, ConnectConsentPage, ConnectorDeliveries, ConnectorDetail, ConnectorMark, ConnectorRow, ConnectorSyncActions, ConnectorsHub, ConnectorsTab, ContactPicker, CredentialSinkMissingError, CrudCardGrid, CrudDetailPage, CrudDetailSkeleton, CrudFormPage, CrudFormSkeleton, CrudListView, CrudPage, CrudRecordModal, DeleteConfirmDialog, DetailTabHeader, EntitlementGate, EntityLink, GetStarted, GettingStartedWidget, NotebookPanel as HandbookPanel, HandbookProvider, NotebookRailPanel as HandbookRailPanel, KanbanBoard, LimitGate, LookupCreateInline, MemberAccessRailPage, ModuleActionBar, MultiSelectRow, NOTE_LABEL_PREFIX, NotebookPanel, NotebookRailPanel, ONBOARDING_TASK_SOURCE, ORDER_CHANNEL_LABELS, ORDER_KIND_LABELS, OTHER_CONNECTOR, OrderAmount, OrderBoardView, OrderCreateScreen, OrderDetailBlock, OrderDetailPage, OrderDetailRail, OrderDetailRow, OrderDetailSkeleton, OrderDetailView, OrderFormAddItemStep, OrderDetailBlock as OrderFormBlock, OrderFormItemRow, OrderFormItemsCard, OrderFormSkeleton, OrderFormView, OrderListView, OrderPaymentChip, PAYMENT_STATUS_CONFIG, PAYMENT_STATUS_LABEL, PageActions, PaymentStatusBadge, PermissionGate, PersonLink2 as PersonLink, PersonTimeline, PlatformError, PluginRegistryManager, PluginSettingsPanel, ProjectsSettings, QUESTION_PACKS, QuickActionsButton, RECEIVABLE_LABEL, RecordPickerModal, RegistryCrudView2 as RegistryCrudView, RightRailActions, RightRailLeading, RightRailPage, RouteErrorBoundary, RouteErrorScreen, SelectRow, SettingsGroup, SettingsTabs, SetupAgentSurface, SetupMeLink, SeuSiteWidget, StateChip, TASK_PRIORITIES, TASK_STATUSES, TaskCard, TaskDetail, TaskGroup, TaskLabelBadge, TaskLabelBadges, TaskPriorityBadge, TaskQuickAdd, TaskSourceBadge, TaskStatusGroup, TasksFilterBar, TasksPanel, TasksRailPanel, TeachMeLink, TextRow, ToggleRow, UnitSwitcher, UnitsSettingsPage, UpgradePrompt, WORKSPACE_SETUP_FLOW_ID, WORKSPACE_SETUP_FLOW_VERSION, WORKSPACE_SETUP_ROUTE, WidgetSlot, WorkspaceSetupFlow, WorkspaceSetupGate, appendHandbookPage, askAI, beautyPack, brandMark, buildBusinessProfile, buildHandbookTree, buildWorkspaceSetupSteps, businessProfileBlock, categoryLabel, checkSlugAvailable, claimTasksSurface, clearPersonActions, connectorOptions, connectorRoute, connectorRows, createClientOrdersProvider, createCrudPage, createFayzApp, createFayzProject, createLogoUploader, createMockTasksProvider, createCrudPage as createNativeCrudPage, createPlaceholder, createPlatformProject, createPluginContext, createSupabaseTasksProvider, createViewRouter, currentBusinessProfileBlock, dedup, defaultProjectOf, defineSaas, deleteFayzProject, deriveAgentContract, duplicateWrite, ensureChecklist, exportToCSV, filterConnectors, foodPack, formatActivityElapsed, formatCurrency4 as formatCurrency, formatSetupGuide, getActiveAgent, getAgent, getDefaultFayzProject, getFayzAgentClient, getGenerationStatus, getHost, getPersonActions, getPersonPath, getPreview, getQuestionPack, getRailPage, getSetupGuide, getSetupGuideForStep, getTasksProvider, getTimelineSources, helpWith, humanizeWriteError, inferVerticalId, invalidateOrderReceivable, invalidateOrdersPaymentStatus, invalidateRelationOptions, isPlatformConnected, listFayzProjects, listHandbook, listPlatformProjects, listSetupGuides, loadArea, loadTools, loadedToolNames, mergeLines, needsCredentialSink, normalizePath, openAssistant, openAssistantAs, openConnectorsPanel, orderChannelColumn, orderIsEditable, orderKindColumn, orientationTour, parseViewId, publishAssistantActivity, readAttachmentBytes, readHandbookPage, readSetupAnswers, receivableTone, recordOnboardingResponse, registerAdminScaffold, registerAssistantLauncher, registerEntityPath, registerNotesTasksAdapter, registerPersonActions, registerRailPage, registerSetupGuides, registerTimelineSource, renderApp, renderHandbookOutline, requestChatUpload, requestProjectChange, resetLoadedTools, resolveFayzAgentConnection, resolveSetupMode, resolveVerticalId, retailPack, revealPage, runWelcome, searchHandbook, searchSetupGuides, setServedRoutes, setTasksProvider, setUpWithMe, slugify, soleAgent, splitConnectorValues, splitOnboardingTasks, startGuidedRun, startPreview, stopPreview, submitConnection, submitWorkspaceSetup, summariseSetupGuides, taskEntityDef, tasksSurfaceOwner, teachMe, toInlineFile, toOrderDetailReceivable, unregisterAssistantLauncher, unregisterTimelineSource, updateFayzProject, useActivationStore, useActiveAgent, useAgent, useAgentStore, useAgentSurface, useAppConfig, useAssistantActivity, useAssistantInviteStore, useAssistantLaunchers, useBusinessProfileStore, useChatStore, useConnectors, useConnectorsPanelAvailable, useContextualNav, useContextualNavStore, useDelegateToAssistant, useFayzProjectsStore, useFeatureHelp, useFieldRules, useHandbookStore, useHasRightRail, useHeaderAction, useHeaderActions, useLaunchersForRole, useLookupCreate, useMemberAccessPanel, useModuleNavigation, useNavContribution, useNavContributionsStore, useNotesTasksBridge, useOrderDetail, useOrderEditor, useOrderReceivable, useOrdersPaymentStatus, usePersistedState, usePersonTimeline, usePluginPrefs, usePresetLabel, usePublishAssistantActivity, useRegisterAssistantLauncher, useRightRailDrill, useRightRailHosted, useRightRailPanel, useRightRailStore, useScrollMemory, useSettingsTabsStore, useShellRailAvailable, useTasksStore, useTasksSummaryLine, useTeachMe, useTenantPluginSettings, useUnitBootstrap, useUnitStore, useWidgetSurface, useWorkspaceSetupBusy, useWorkspaceSetupGate, useWorkspaceSetupStore, validateSetupGuides, withdrawAssistantActivity, writeHandbookPage };
|
|
37895
|
+
export { ALWAYS_ON_TOOLS, ActivationChecklistCard, ActivationProvider, AddConnectorButton, AddConnectorPanel, AdminProviders, AdminScaffold, AdminShell, AskAIButton, AskAIMenuItem, AssistantInvite, BoardFrame, ChatConversation, ClientOrdersTab, ConnectConsentPage, ConnectorDeliveries, ConnectorDetail, ConnectorMark, ConnectorRow, ConnectorSyncActions, ConnectorsHub, ConnectorsTab, ContactPicker, CredentialSinkMissingError, CrudCardGrid, CrudDetailPage, CrudDetailSkeleton, CrudFormPage, CrudFormSkeleton, CrudListView, CrudPage, CrudRecordModal, DeleteConfirmDialog, DetailTabHeader, EntitlementGate, EntityLink, GetStarted, GettingStartedWidget, NotebookPanel as HandbookPanel, HandbookProvider, NotebookRailPanel as HandbookRailPanel, KanbanBoard, LimitGate, LookupCreateInline, MemberAccessRailPage, ModuleActionBar, MultiSelectRow, NOTE_LABEL_PREFIX, NotebookPanel, NotebookRailPanel, ONBOARDING_TASK_SOURCE, ORDER_CHANNEL_LABELS, ORDER_KIND_LABELS, OTHER_CONNECTOR, OrderAmount, OrderBoardView, OrderCreateScreen, OrderDetailBlock, OrderDetailPage, OrderDetailRail, OrderDetailRow, OrderDetailSkeleton, OrderDetailView, OrderFormAddItemStep, OrderDetailBlock as OrderFormBlock, OrderFormItemRow, OrderFormItemsCard, OrderFormSkeleton, OrderFormView, OrderListView, OrderPaymentChip, PAYMENT_STATUS_CONFIG, PAYMENT_STATUS_LABEL, PageActions, PaymentStatusBadge, PermissionGate, PersonLink2 as PersonLink, PersonTimeline, PlatformError, PluginOnboardingGateSkeleton, PluginRegistryManager, PluginSettingsPanel, ProjectsSettings, QUESTION_PACKS, QuickActionsButton, RECEIVABLE_LABEL, RecordPickerModal, RegistryCrudView2 as RegistryCrudView, RightRailActions, RightRailLeading, RightRailPage, RouteErrorBoundary, RouteErrorScreen, SelectRow, SettingsGroup, SettingsTabs, SetupAgentSurface, SetupMeLink, SeuSiteWidget, StateChip, TASK_PRIORITIES, TASK_STATUSES, TaskCard, TaskDetail, TaskGroup, TaskLabelBadge, TaskLabelBadges, TaskPriorityBadge, TaskQuickAdd, TaskSourceBadge, TaskStatusGroup, TasksFilterBar, TasksPanel, TasksRailPanel, TeachMeLink, TextRow, ToggleRow, UnitSwitcher, UnitsSettingsPage, UpgradePrompt, WORKSPACE_SETUP_FLOW_ID, WORKSPACE_SETUP_FLOW_VERSION, WORKSPACE_SETUP_ROUTE, WidgetSlot, WorkspaceSetupFlow, WorkspaceSetupGate, appendHandbookPage, askAI, beautyPack, brandMark, buildBusinessProfile, buildHandbookTree, buildWorkspaceSetupSteps, businessProfileBlock, categoryLabel, checkSlugAvailable, claimTasksSurface, clearPersonActions, connectorOptions, connectorRoute, connectorRows, createClientOrdersProvider, createCrudPage, createFayzApp, createFayzProject, createLogoUploader, createMockTasksProvider, createCrudPage as createNativeCrudPage, createPlaceholder, createPlatformProject, createPluginContext, createSupabaseTasksProvider, createViewRouter, currentBusinessProfileBlock, dedup, defaultProjectOf, defineSaas, deleteFayzProject, deriveAgentContract, duplicateWrite, ensureChecklist, exportToCSV, filterConnectors, foodPack, formatActivityElapsed, formatCurrency4 as formatCurrency, formatSetupGuide, getActiveAgent, getAgent, getDefaultFayzProject, getFayzAgentClient, getGenerationStatus, getHost, getPersonActions, getPersonPath, getPreview, getQuestionPack, getRailPage, getSetupGuide, getSetupGuideForStep, getTasksProvider, getTimelineSources, helpWith, humanizeWriteError, inferVerticalId, invalidateOrderReceivable, invalidateOrdersPaymentStatus, invalidateRelationOptions, isPlatformConnected, listFayzProjects, listHandbook, listPlatformProjects, listSetupGuides, loadArea, loadTools, loadedToolNames, mergeLines, needsCredentialSink, normalizePath, openAssistant, openAssistantAs, openConnectorsPanel, orderChannelColumn, orderIsEditable, orderKindColumn, orientationTour, parseViewId, publishAssistantActivity, readAttachmentBytes, readHandbookPage, readSetupAnswers, receivableTone, recordOnboardingResponse, registerAdminScaffold, registerAssistantLauncher, registerEntityPath, registerNotesTasksAdapter, registerPersonActions, registerRailPage, registerSetupGuides, registerTimelineSource, renderApp, renderHandbookOutline, requestChatUpload, requestProjectChange, resetLoadedTools, resolveFayzAgentConnection, resolveSetupMode, resolveVerticalId, retailPack, revealPage, runWelcome, searchHandbook, searchSetupGuides, setServedRoutes, setTasksProvider, setUpWithMe, slugify, soleAgent, splitConnectorValues, splitOnboardingTasks, startGuidedRun, startPreview, stopPreview, submitConnection, submitWorkspaceSetup, summariseSetupGuides, taskEntityDef, tasksSurfaceOwner, teachMe, toInlineFile, toOrderDetailReceivable, unregisterAssistantLauncher, unregisterTimelineSource, updateFayzProject, useActivationStore, useActiveAgent, useAgent, useAgentStore, useAgentSurface, useAppConfig, useAssistantActivity, useAssistantInviteStore, useAssistantLaunchers, useBusinessProfileStore, useChatStore, useConnectors, useConnectorsPanelAvailable, useContextualNav, useContextualNavStore, useDelegateToAssistant, useFayzProjectsStore, useFeatureHelp, useFieldRules, useHandbookStore, useHasRightRail, useHeaderAction, useHeaderActions, useLaunchersForRole, useLookupCreate, useMemberAccessPanel, useModuleNavigation, useNavContribution, useNavContributionsStore, useNotesTasksBridge, useOrderDetail, useOrderEditor, useOrderReceivable, useOrdersPaymentStatus, usePersistedState, usePersonTimeline, usePluginOnboardingGate, usePluginPrefs, usePresetLabel, usePublishAssistantActivity, useRegisterAssistantLauncher, useRightRailDrill, useRightRailHosted, useRightRailPanel, useRightRailStore, useScrollMemory, useSettingsTabsStore, useShellRailAvailable, useTasksStore, useTasksSummaryLine, useTeachMe, useTenantPluginSettings, useUnitBootstrap, useUnitStore, useWidgetSurface, useWorkspaceSetupBusy, useWorkspaceSetupGate, useWorkspaceSetupStore, validateSetupGuides, withdrawAssistantActivity, writeHandbookPage };
|
|
37628
37896
|
//# sourceMappingURL=index.js.map
|
|
37629
37897
|
//# sourceMappingURL=index.js.map
|