@fayz-ai/admin 0.58.0 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/shared/ConnectionIndicator.d.ts +10 -0
- package/dist/components/shared/ConnectionIndicator.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +666 -526
- package/dist/index.js.map +1 -1
- package/dist/lib/connection.d.ts +6 -0
- package/dist/lib/connection.d.ts.map +1 -0
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -17,10 +17,10 @@ import { useUnitStore, useTenantOptional, fetchMemberUnits, UNIT_ACCESS_CHANGED,
|
|
|
17
17
|
export { ORG_CACHE_TTL_MS, OrgMark, OrgProvider, activePluginIds, clearOrgSnapshot, createMockOrgAdapter, createSupabaseOrgAdapter, dedup, hasPlugin, orgInitials, readOrgSnapshot, useAppConfigStore, useOrgAdapter, useOrgAdapterOptional, useTenant, useTenantOptional, useUnitStore } from './chunk-ZB3XIZIK.js';
|
|
18
18
|
import { usePermissionOptional, usePermissionsStore, PermissionsProvider } from './chunk-UQ2NTFQC.js';
|
|
19
19
|
export { PermissionsProvider, useHasPermission, usePermission, usePermissionOptional, usePermissions, usePermissionsStore } from './chunk-UQ2NTFQC.js';
|
|
20
|
-
import { cn, getFayzSupabaseClientOptional, getSupabaseClientOptional as getSupabaseClientOptional$1, useOrganizationStore, createFayzSupabaseClient, setServiceUrl, getFayzSupabaseClient } from './chunk-P6XUDT2P.js';
|
|
20
|
+
import { cn, getFayzSupabaseClientOptional, getSupabaseClientOptional as getSupabaseClientOptional$1, useOrganizationStore, createFayzSupabaseClient, setServiceUrl, serviceBaseUrl, getFayzSupabaseClient } from './chunk-P6XUDT2P.js';
|
|
21
21
|
export { createFayzSupabaseClient, getFayzSupabaseClient, getFayzSupabaseClientOptional, getPersistedOrgId, serviceBaseUrl, useOrganizationStore } from './chunk-P6XUDT2P.js';
|
|
22
22
|
import * as React142 from 'react';
|
|
23
|
-
import React142__default, { createContext, useMemo, useState, useRef, useCallback, useEffect, useContext, createElement } from 'react';
|
|
23
|
+
import React142__default, { createContext, useMemo, useState, useRef, useCallback, useEffect, useSyncExternalStore, useContext, createElement } from 'react';
|
|
24
24
|
import { Button, Input, SearchSelect, toast, usePageTrailParent, navigateToCrumb, PageHeader, ConfirmDialog, RowActions, useRowSelection, getLucideIcon, ListFilterBar, Dropdown, DropdownTrigger, Hint, cn as cn$1, DropdownContent, DropdownLabel, DropdownItem, DropdownSeparator, RefreshButton, PageHeaderActions, PageTabs, StatTiles, Card, BulkActionBar, DataTable, Modal, ModalContent, ModalHeader, ModalTitle, ModalDescription, ModalFooter, Badge, PersonAvatar, PageActionBar, Switch, ICON_MAP, Sheet, SheetContent, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, InfoHint, SheetBody, useIsWide, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, useTourStore, setTourNavigator, TourSpotlight, PracticeOverlay, Textarea, Wizard, SidebarOnboarding, OnboardingWidget, Skeleton, useLayoutStore, ChoiceSelect, usePublishPageInfo, ModalTask, Checkbox, ModalPortal, ModalOverlay, ModalBody, useSaveBar, useBackHandler, SubpageHeader, Tabs, Markdown, PhoneLink, TabsContent, CardContent, HeaderTabs, usePageTrail, PageHeaderOutlet, ToastProvider, NavTransitionProvider, ListView, Thumbnail, CurrencyInput, TabsList, TabsTrigger, SearchField, ChevronPager, Popover, PopoverTrigger, PopoverContent, useModuleLayout, normalizePhone, SearchCombobox, AppShellSkeleton, usePracticeStore, ViewTabs, setPrintBrand, useModuleViewLabel, ModuleLayoutProvider, AppShell, PageTransition, PickerDialog, MarkdownEditor, PhoneField, isCreateRoute, PageSubNav, MobileScrim, createFayzTheme, PageTrail, Avatar, AvatarImage, AvatarFallback, CardTitle, CardDescription, DropdownSub, DropdownSubTrigger, DropdownSubContent, DropdownRadioGroup, DropdownRadioItem, BottomSheet, SegmentedControl, CardHeader, CardFooter, Separator, SheetCard, SheetRow, useSheetClose } from '@fayz-ai/ui';
|
|
25
25
|
export { createFayzTheme, fayzThemePresets } from '@fayz-ai/ui';
|
|
26
26
|
import * as LucideIcons from 'lucide-react';
|
|
@@ -180,10 +180,10 @@ function decideWorkspaceSetup(input) {
|
|
|
180
180
|
const firstRun = !!input.orgsKnown && !input.loading && input.orgCount === 0 && !input.hasOrg;
|
|
181
181
|
return { active: firstRun, deciding: false, source: "signup", exitable: false };
|
|
182
182
|
}
|
|
183
|
-
var useWorkspaceSetupStore = create((
|
|
183
|
+
var useWorkspaceSetupStore = create((set2) => ({
|
|
184
184
|
requested: null,
|
|
185
|
-
open: (source = "switcher") =>
|
|
186
|
-
close: () =>
|
|
185
|
+
open: (source = "switcher") => set2({ requested: source }),
|
|
186
|
+
close: () => set2({ requested: null })
|
|
187
187
|
}));
|
|
188
188
|
|
|
189
189
|
// src/onboarding/useWorkspaceSetupGate.ts
|
|
@@ -1689,29 +1689,29 @@ function readVoiceRepliesPref() {
|
|
|
1689
1689
|
return false;
|
|
1690
1690
|
}
|
|
1691
1691
|
}
|
|
1692
|
-
var useChatStore = create((
|
|
1692
|
+
var useChatStore = create((set2, get) => ({
|
|
1693
1693
|
messages: [],
|
|
1694
1694
|
isOpen: false,
|
|
1695
1695
|
isStreaming: false,
|
|
1696
1696
|
conversationId: null,
|
|
1697
1697
|
// Fechar o painel encerra o handoff junto: uma dica sobrevivente devolveria
|
|
1698
1698
|
// "Ex.: receita por mesa" a quem abriu o assistente para outra coisa.
|
|
1699
|
-
setOpen: (open) =>
|
|
1700
|
-
toggleOpen: () =>
|
|
1699
|
+
setOpen: (open) => set2(open ? { isOpen: true } : { isOpen: false, composerHint: null, composerFocusRequested: false }),
|
|
1700
|
+
toggleOpen: () => set2((s) => ({ isOpen: !s.isOpen })),
|
|
1701
1701
|
// Stamped with whoever is on duty, here rather than at each call site: every
|
|
1702
1702
|
// message in the transcript needs a face, and a caller that forgets leaves an
|
|
1703
1703
|
// anonymous bubble in the middle of a conversation with a named colleague.
|
|
1704
|
-
addMessage: (message2) =>
|
|
1704
|
+
addMessage: (message2) => set2((s) => ({
|
|
1705
1705
|
messages: [...s.messages, s.threadRole && !message2.agentKey ? { ...message2, agentKey: s.threadRole } : message2]
|
|
1706
1706
|
})),
|
|
1707
|
-
setMessageContent: (id, content) =>
|
|
1707
|
+
setMessageContent: (id, content) => set2((s) => {
|
|
1708
1708
|
const i = s.messages.findIndex((m) => m.id === id);
|
|
1709
1709
|
if (i < 0) return s;
|
|
1710
1710
|
const msgs = [...s.messages];
|
|
1711
1711
|
msgs[i] = { ...msgs[i], content: sanitizeAssistantText(content) };
|
|
1712
1712
|
return { messages: msgs };
|
|
1713
1713
|
}),
|
|
1714
|
-
updateLastAssistant: (content) =>
|
|
1714
|
+
updateLastAssistant: (content) => set2((s) => {
|
|
1715
1715
|
const msgs = [...s.messages];
|
|
1716
1716
|
const lastIdx = msgs.length - 1;
|
|
1717
1717
|
if (lastIdx >= 0 && msgs[lastIdx].role === "assistant") {
|
|
@@ -1719,11 +1719,11 @@ var useChatStore = create((set, get) => ({
|
|
|
1719
1719
|
}
|
|
1720
1720
|
return { messages: msgs };
|
|
1721
1721
|
}),
|
|
1722
|
-
setStreaming: (isStreaming) =>
|
|
1722
|
+
setStreaming: (isStreaming) => set2({ isStreaming }),
|
|
1723
1723
|
setConversationId: (conversationId) => {
|
|
1724
1724
|
const role = get().threadRole;
|
|
1725
1725
|
if (conversationId && role) tagConversation(conversationId, role);
|
|
1726
|
-
|
|
1726
|
+
set2({ conversationId });
|
|
1727
1727
|
},
|
|
1728
1728
|
threadRole: null,
|
|
1729
1729
|
threads: {},
|
|
@@ -1743,7 +1743,7 @@ var useChatStore = create((set, get) => ({
|
|
|
1743
1743
|
conversationId: s.conversationId ?? parked.conversationId
|
|
1744
1744
|
} : parked;
|
|
1745
1745
|
delete threads[role];
|
|
1746
|
-
|
|
1746
|
+
set2({
|
|
1747
1747
|
threads,
|
|
1748
1748
|
threadRole: role,
|
|
1749
1749
|
messages: seed ? [...target.messages, seed] : target.messages,
|
|
@@ -1761,7 +1761,7 @@ var useChatStore = create((set, get) => ({
|
|
|
1761
1761
|
resetLoadedTools();
|
|
1762
1762
|
clearAttachmentRegistry();
|
|
1763
1763
|
clearTurnReportFiles();
|
|
1764
|
-
|
|
1764
|
+
set2({
|
|
1765
1765
|
messages: [],
|
|
1766
1766
|
isStreaming: false,
|
|
1767
1767
|
conversationId: null,
|
|
@@ -1779,21 +1779,21 @@ var useChatStore = create((set, get) => ({
|
|
|
1779
1779
|
requestConfirmation: (action) => {
|
|
1780
1780
|
const destructive = action.destructive ?? isDestructiveTool(action.toolName);
|
|
1781
1781
|
if (!action.noAutoApproval && isAutoApproved(action.toolName, action.scope)) {
|
|
1782
|
-
|
|
1782
|
+
set2((s) => ({
|
|
1783
1783
|
autoApprovedTools: s.autoApprovedTools.includes(action.toolName) ? s.autoApprovedTools : [...s.autoApprovedTools, action.toolName]
|
|
1784
1784
|
}));
|
|
1785
1785
|
return Promise.resolve({ approved: true });
|
|
1786
1786
|
}
|
|
1787
1787
|
return new Promise((resolve) => {
|
|
1788
1788
|
pendingQueue = [...pendingQueue, { action: { ...action, destructive }, resolve }];
|
|
1789
|
-
|
|
1789
|
+
set2(headState());
|
|
1790
1790
|
});
|
|
1791
1791
|
},
|
|
1792
1792
|
resolvePendingAction: (approved, values) => {
|
|
1793
1793
|
const [head, ...rest] = pendingQueue;
|
|
1794
1794
|
if (!head) return;
|
|
1795
1795
|
pendingQueue = rest;
|
|
1796
|
-
|
|
1796
|
+
set2(headState());
|
|
1797
1797
|
head.resolve({ approved, values });
|
|
1798
1798
|
},
|
|
1799
1799
|
resolveAllPending: (approved) => {
|
|
@@ -1806,7 +1806,7 @@ var useChatStore = create((set, get) => ({
|
|
|
1806
1806
|
(entry.action.toolName === toolName ? matched : kept).push(entry);
|
|
1807
1807
|
}
|
|
1808
1808
|
pendingQueue = kept;
|
|
1809
|
-
|
|
1809
|
+
set2(headState());
|
|
1810
1810
|
for (const entry of matched) entry.resolve({ approved });
|
|
1811
1811
|
},
|
|
1812
1812
|
voiceReplies: readVoiceRepliesPref(),
|
|
@@ -1815,10 +1815,10 @@ var useChatStore = create((set, get) => ({
|
|
|
1815
1815
|
localStorage?.setItem(VOICE_REPLIES_KEY, enabled ? "1" : "0");
|
|
1816
1816
|
} catch {
|
|
1817
1817
|
}
|
|
1818
|
-
|
|
1818
|
+
set2({ voiceReplies: enabled });
|
|
1819
1819
|
},
|
|
1820
1820
|
draft: "",
|
|
1821
|
-
setDraft: (draft) =>
|
|
1821
|
+
setDraft: (draft) => set2({ draft }),
|
|
1822
1822
|
attachments: [],
|
|
1823
1823
|
addAttachments: async (files) => {
|
|
1824
1824
|
const room = MAX_ATTACHMENTS - get().attachments.length;
|
|
@@ -1839,8 +1839,8 @@ var useChatStore = create((set, get) => ({
|
|
|
1839
1839
|
}
|
|
1840
1840
|
}));
|
|
1841
1841
|
if (!staged.length) return;
|
|
1842
|
-
|
|
1843
|
-
const settle = (id, patch) =>
|
|
1842
|
+
set2((s) => ({ attachments: [...s.attachments, ...staged.map((e) => e.attachment)] }));
|
|
1843
|
+
const settle = (id, patch) => set2((s) => ({
|
|
1844
1844
|
attachments: s.attachments.map((a) => a.id === id ? { ...a, ...patch } : a)
|
|
1845
1845
|
}));
|
|
1846
1846
|
await Promise.all(
|
|
@@ -1857,14 +1857,14 @@ var useChatStore = create((set, get) => ({
|
|
|
1857
1857
|
removeAttachment: (id) => {
|
|
1858
1858
|
releaseAttachment(id);
|
|
1859
1859
|
revokePreview(get().attachments.find((a) => a.id === id)?.previewUrl);
|
|
1860
|
-
|
|
1860
|
+
set2((s) => ({ attachments: s.attachments.filter((a) => a.id !== id) }));
|
|
1861
1861
|
},
|
|
1862
1862
|
clearAttachments: () => {
|
|
1863
1863
|
for (const attachment of get().attachments) {
|
|
1864
1864
|
releaseAttachment(attachment.id);
|
|
1865
1865
|
revokePreview(attachment.previewUrl);
|
|
1866
1866
|
}
|
|
1867
|
-
|
|
1867
|
+
set2({ attachments: [] });
|
|
1868
1868
|
},
|
|
1869
1869
|
// Sending clears the CHIPS, never the registry. The file is what the rest of
|
|
1870
1870
|
// the conversation is about: released here, "ta certo isso ai" two turns later
|
|
@@ -1874,16 +1874,16 @@ var useChatStore = create((set, get) => ({
|
|
|
1874
1874
|
const staged = get().attachments;
|
|
1875
1875
|
if (!staged.length) return [];
|
|
1876
1876
|
const digests = staged.flatMap((a) => a.status === "ready" && a.digest ? [a.digest] : []);
|
|
1877
|
-
|
|
1877
|
+
set2({ attachments: [] });
|
|
1878
1878
|
return digests;
|
|
1879
1879
|
},
|
|
1880
1880
|
composerMedia: null,
|
|
1881
|
-
attachMedia: (composerMedia) =>
|
|
1882
|
-
clearComposerMedia: () =>
|
|
1881
|
+
attachMedia: (composerMedia) => set2({ composerMedia }),
|
|
1882
|
+
clearComposerMedia: () => set2({ composerMedia: null }),
|
|
1883
1883
|
uploadRequest: null,
|
|
1884
1884
|
requestUpload: (request) => {
|
|
1885
1885
|
const id = `upload-${Date.now()}`;
|
|
1886
|
-
|
|
1886
|
+
set2({ uploadRequest: { ...request, id, status: "waiting", files: [] }, isOpen: true });
|
|
1887
1887
|
return id;
|
|
1888
1888
|
},
|
|
1889
1889
|
addUploadFiles: (files) => {
|
|
@@ -1895,29 +1895,29 @@ var useChatStore = create((set, get) => ({
|
|
|
1895
1895
|
}));
|
|
1896
1896
|
const kept = request.multiple ? [...request.files, ...staged] : staged;
|
|
1897
1897
|
if (!request.multiple) for (const previous of request.files) revokePreview(previous.previewUrl);
|
|
1898
|
-
|
|
1898
|
+
set2({ uploadRequest: { ...request, files: kept } });
|
|
1899
1899
|
},
|
|
1900
1900
|
removeUploadFile: (index) => {
|
|
1901
1901
|
const request = get().uploadRequest;
|
|
1902
1902
|
if (!request) return;
|
|
1903
1903
|
revokePreview(request.files[index]?.previewUrl);
|
|
1904
|
-
|
|
1904
|
+
set2({ uploadRequest: { ...request, files: request.files.filter((_, i) => i !== index) } });
|
|
1905
1905
|
},
|
|
1906
1906
|
submitUpload: async () => {
|
|
1907
1907
|
const request = get().uploadRequest;
|
|
1908
1908
|
if (!request || request.files.length === 0) return;
|
|
1909
|
-
|
|
1909
|
+
set2({ uploadRequest: { ...request, status: "working" } });
|
|
1910
1910
|
try {
|
|
1911
1911
|
await request.onFiles(request.files.map((staged) => staged.file));
|
|
1912
1912
|
} finally {
|
|
1913
1913
|
for (const staged of request.files) revokePreview(staged.previewUrl);
|
|
1914
|
-
if (get().uploadRequest?.id === request.id)
|
|
1914
|
+
if (get().uploadRequest?.id === request.id) set2({ uploadRequest: null });
|
|
1915
1915
|
}
|
|
1916
1916
|
},
|
|
1917
1917
|
clearUploadRequest: () => {
|
|
1918
1918
|
const request = get().uploadRequest;
|
|
1919
1919
|
if (request) for (const staged of request.files) revokePreview(staged.previewUrl);
|
|
1920
|
-
|
|
1920
|
+
set2({ uploadRequest: null });
|
|
1921
1921
|
},
|
|
1922
1922
|
receiveFiles: (files) => {
|
|
1923
1923
|
if (files.length === 0) return;
|
|
@@ -1935,31 +1935,31 @@ var useChatStore = create((set, get) => ({
|
|
|
1935
1935
|
},
|
|
1936
1936
|
queuedPrompt: null,
|
|
1937
1937
|
queuedFilesToRead: null,
|
|
1938
|
-
queuePrompt: (queuedPrompt, filesToRead) =>
|
|
1938
|
+
queuePrompt: (queuedPrompt, filesToRead) => set2({ queuedPrompt, queuedFilesToRead: filesToRead?.length ? filesToRead : null, isOpen: true }),
|
|
1939
1939
|
consumeQueuedFilesToRead: () => {
|
|
1940
1940
|
const files = get().queuedFilesToRead;
|
|
1941
|
-
if (files)
|
|
1941
|
+
if (files) set2({ queuedFilesToRead: null });
|
|
1942
1942
|
return files;
|
|
1943
1943
|
},
|
|
1944
1944
|
composerHint: null,
|
|
1945
|
-
setComposerHint: (composerHint) =>
|
|
1945
|
+
setComposerHint: (composerHint) => set2({ composerHint }),
|
|
1946
1946
|
composerFocusRequested: false,
|
|
1947
|
-
requestComposerFocus: () =>
|
|
1948
|
-
consumeComposerFocus: () =>
|
|
1947
|
+
requestComposerFocus: () => set2({ composerFocusRequested: true }),
|
|
1948
|
+
consumeComposerFocus: () => set2({ composerFocusRequested: false }),
|
|
1949
1949
|
consumeQueuedPrompt: () => {
|
|
1950
1950
|
const prompt = get().queuedPrompt;
|
|
1951
|
-
if (prompt)
|
|
1951
|
+
if (prompt) set2({ queuedPrompt: null });
|
|
1952
1952
|
return prompt;
|
|
1953
1953
|
},
|
|
1954
1954
|
// Open to begin with; collapsing sticks for the session.
|
|
1955
1955
|
suggestionsOpen: true,
|
|
1956
|
-
setSuggestionsOpen: (suggestionsOpen) =>
|
|
1956
|
+
setSuggestionsOpen: (suggestionsOpen) => set2({ suggestionsOpen }),
|
|
1957
1957
|
voiceStartRequested: false,
|
|
1958
|
-
requestVoiceStart: () =>
|
|
1959
|
-
consumeVoiceStart: () =>
|
|
1958
|
+
requestVoiceStart: () => set2({ isOpen: true, voiceStartRequested: true }),
|
|
1959
|
+
consumeVoiceStart: () => set2({ voiceStartRequested: false }),
|
|
1960
1960
|
activeTools: [],
|
|
1961
|
-
setActiveTools: (activeTools) =>
|
|
1962
|
-
appendToolCallsToLastAssistant: (calls) =>
|
|
1961
|
+
setActiveTools: (activeTools) => set2({ activeTools }),
|
|
1962
|
+
appendToolCallsToLastAssistant: (calls) => set2((s) => {
|
|
1963
1963
|
if (!calls.length) return s;
|
|
1964
1964
|
const msgs = [...s.messages];
|
|
1965
1965
|
const lastIdx = msgs.length - 1;
|
|
@@ -1968,7 +1968,7 @@ var useChatStore = create((set, get) => ({
|
|
|
1968
1968
|
}
|
|
1969
1969
|
return { messages: msgs };
|
|
1970
1970
|
}),
|
|
1971
|
-
appendLinksToLastAssistant: (links) =>
|
|
1971
|
+
appendLinksToLastAssistant: (links) => set2((s) => {
|
|
1972
1972
|
if (!links.length) return s;
|
|
1973
1973
|
const msgs = [...s.messages];
|
|
1974
1974
|
const lastIdx = msgs.length - 1;
|
|
@@ -1979,7 +1979,7 @@ var useChatStore = create((set, get) => ({
|
|
|
1979
1979
|
}
|
|
1980
1980
|
return { messages: msgs };
|
|
1981
1981
|
}),
|
|
1982
|
-
appendCardsToLastAssistant: (cards) =>
|
|
1982
|
+
appendCardsToLastAssistant: (cards) => set2((s) => {
|
|
1983
1983
|
if (!cards.length) return s;
|
|
1984
1984
|
const msgs = [...s.messages];
|
|
1985
1985
|
const lastIdx = msgs.length - 1;
|
|
@@ -1992,10 +1992,10 @@ var useChatStore = create((set, get) => ({
|
|
|
1992
1992
|
}),
|
|
1993
1993
|
conversations: [],
|
|
1994
1994
|
conversationsLoaded: false,
|
|
1995
|
-
setConversations: (conversations) =>
|
|
1995
|
+
setConversations: (conversations) => set2({ conversations, conversationsLoaded: true }),
|
|
1996
1996
|
setMessages: (messages) => {
|
|
1997
1997
|
clearAttachmentRegistry();
|
|
1998
|
-
|
|
1998
|
+
set2({ messages, attachments: [] });
|
|
1999
1999
|
}
|
|
2000
2000
|
}));
|
|
2001
2001
|
|
|
@@ -2109,39 +2109,39 @@ var ACTIVITY_INTENT_ICON = {
|
|
|
2109
2109
|
discard: Trash2,
|
|
2110
2110
|
generate: Sparkles
|
|
2111
2111
|
};
|
|
2112
|
-
var useRightRailStore = create((
|
|
2112
|
+
var useRightRailStore = create((set2) => ({
|
|
2113
2113
|
mounted: false,
|
|
2114
|
-
setMounted: (mounted) =>
|
|
2114
|
+
setMounted: (mounted) => set2({ mounted }),
|
|
2115
2115
|
open: false,
|
|
2116
2116
|
active: null,
|
|
2117
2117
|
panels: [],
|
|
2118
2118
|
// Switching or closing drops any internal page: the drill belongs to the
|
|
2119
2119
|
// panel that opened it, and its title outliving it would head the wrong one.
|
|
2120
|
-
openPanel: (id) =>
|
|
2120
|
+
openPanel: (id) => set2({ open: true, active: id, drill: null, pageOpen: false, pageDrill: null }),
|
|
2121
2121
|
reselects: 0,
|
|
2122
2122
|
reselectId: null,
|
|
2123
|
-
reselect: (id) =>
|
|
2124
|
-
close: () =>
|
|
2125
|
-
togglePanel: (id) =>
|
|
2123
|
+
reselect: (id) => set2((s) => ({ reselects: s.reselects + 1, reselectId: id })),
|
|
2124
|
+
close: () => set2({ open: false, drill: null, pageOpen: false, pageDrill: null }),
|
|
2125
|
+
togglePanel: (id) => set2(
|
|
2126
2126
|
(s) => s.open && s.active === id && !s.pageOpen ? { open: false, drill: null, pageOpen: false, pageDrill: null } : { open: true, active: id, drill: null, pageOpen: false, pageDrill: null }
|
|
2127
2127
|
),
|
|
2128
|
-
registerPanel: (panel) =>
|
|
2128
|
+
registerPanel: (panel) => set2((s) => {
|
|
2129
2129
|
const rest = s.panels.filter((p) => p.id !== panel.id);
|
|
2130
2130
|
const panels = [...rest, panel].sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
|
|
2131
2131
|
return { panels, active: s.active ?? panel.id };
|
|
2132
2132
|
}),
|
|
2133
|
-
unregisterPanel: (id) =>
|
|
2133
|
+
unregisterPanel: (id) => set2((s) => {
|
|
2134
2134
|
const panels = s.panels.filter((p) => p.id !== id);
|
|
2135
2135
|
const active2 = s.active === id ? panels[0]?.id ?? null : s.active;
|
|
2136
2136
|
return { panels, active: active2, open: active2 ? s.open : false };
|
|
2137
2137
|
}),
|
|
2138
|
-
updateBadge: (id, badge) =>
|
|
2138
|
+
updateBadge: (id, badge) => set2((s) => {
|
|
2139
2139
|
const current3 = s.panels.find((p) => p.id === id);
|
|
2140
2140
|
if (!current3) return s;
|
|
2141
2141
|
if (current3.badge?.count === badge?.count && current3.badge?.tone === badge?.tone) return s;
|
|
2142
2142
|
return { panels: s.panels.map((p) => p.id === id ? { ...p, badge } : p) };
|
|
2143
2143
|
}),
|
|
2144
|
-
updateMeta: (id, meta) =>
|
|
2144
|
+
updateMeta: (id, meta) => set2((s) => {
|
|
2145
2145
|
const current3 = s.panels.find((p) => p.id === id);
|
|
2146
2146
|
if (!current3) return s;
|
|
2147
2147
|
const pick2 = (key) => key in meta ? meta[key] : current3[key];
|
|
@@ -2157,18 +2157,18 @@ var useRightRailStore = create((set) => ({
|
|
|
2157
2157
|
return { panels: s.panels.map((p) => p.id === id ? next : p) };
|
|
2158
2158
|
}),
|
|
2159
2159
|
width: readRightRailWidth(),
|
|
2160
|
-
setWidth: (width) =>
|
|
2160
|
+
setWidth: (width) => set2({ width }),
|
|
2161
2161
|
drill: null,
|
|
2162
|
-
setDrill: (drill) =>
|
|
2162
|
+
setDrill: (drill) => set2({ drill }),
|
|
2163
2163
|
pageDrill: null,
|
|
2164
|
-
setPageDrill: (pageDrill) =>
|
|
2164
|
+
setPageDrill: (pageDrill) => set2({ pageDrill }),
|
|
2165
2165
|
menu: [],
|
|
2166
|
-
setMenu: (menu) =>
|
|
2166
|
+
setMenu: (menu) => set2({ menu }),
|
|
2167
2167
|
pageSlot: null,
|
|
2168
|
-
setPageSlot: (pageSlot) =>
|
|
2168
|
+
setPageSlot: (pageSlot) => set2({ pageSlot }),
|
|
2169
2169
|
pageOpen: false,
|
|
2170
|
-
showPage: () =>
|
|
2171
|
-
closePage: () =>
|
|
2170
|
+
showPage: () => set2({ open: true, pageOpen: true }),
|
|
2171
|
+
closePage: () => set2({ open: false, pageOpen: false, drill: null, pageDrill: null })
|
|
2172
2172
|
}));
|
|
2173
2173
|
function useRightRailPanel(panel) {
|
|
2174
2174
|
const register = useRightRailStore((s) => s.registerPanel);
|
|
@@ -2311,7 +2311,7 @@ function rememberDismissal(id) {
|
|
|
2311
2311
|
if (!store) return;
|
|
2312
2312
|
store.setItem(KEY_DISMISSED, JSON.stringify([.../* @__PURE__ */ new Set([...dismissedIds(), id])]));
|
|
2313
2313
|
}
|
|
2314
|
-
var useAssistantInviteStore = create((
|
|
2314
|
+
var useAssistantInviteStore = create((set2, get) => ({
|
|
2315
2315
|
invite: null,
|
|
2316
2316
|
stage: "dock",
|
|
2317
2317
|
dockBox: null,
|
|
@@ -2320,7 +2320,7 @@ var useAssistantInviteStore = create((set, get) => ({
|
|
|
2320
2320
|
if (!invite) {
|
|
2321
2321
|
if (id && get().invite?.id !== id) return;
|
|
2322
2322
|
const { invite: going, dockBox } = get();
|
|
2323
|
-
|
|
2323
|
+
set2({
|
|
2324
2324
|
invite: null,
|
|
2325
2325
|
stage: "dock",
|
|
2326
2326
|
dockBox: null,
|
|
@@ -2330,24 +2330,24 @@ var useAssistantInviteStore = create((set, get) => ({
|
|
|
2330
2330
|
}
|
|
2331
2331
|
if (invite.role) loadArea(invite.role);
|
|
2332
2332
|
const hero = invite.auto !== false && !dismissedIds().includes(invite.id);
|
|
2333
|
-
|
|
2333
|
+
set2({ invite, stage: hero ? "hero" : "dock", leaving: null });
|
|
2334
2334
|
},
|
|
2335
2335
|
setDockBox: (box) => {
|
|
2336
2336
|
const current3 = get().dockBox;
|
|
2337
2337
|
if (current3?.left === box?.left && current3?.width === box?.width) return;
|
|
2338
|
-
|
|
2338
|
+
set2({ dockBox: box });
|
|
2339
2339
|
},
|
|
2340
|
-
endLeave: () =>
|
|
2340
|
+
endLeave: () => set2({ leaving: null }),
|
|
2341
2341
|
dismiss: () => {
|
|
2342
2342
|
const { invite } = get();
|
|
2343
2343
|
if (invite) rememberDismissal(invite.id);
|
|
2344
|
-
|
|
2344
|
+
set2({ stage: "dock" });
|
|
2345
2345
|
}
|
|
2346
2346
|
}));
|
|
2347
|
-
var useAgentStore = create((
|
|
2347
|
+
var useAgentStore = create((set2) => ({
|
|
2348
2348
|
agent: null,
|
|
2349
2349
|
resolved: false,
|
|
2350
|
-
setAgent: (agent, resolved = true) =>
|
|
2350
|
+
setAgent: (agent, resolved = true) => set2({ agent, resolved })
|
|
2351
2351
|
}));
|
|
2352
2352
|
function soleAgent(staff) {
|
|
2353
2353
|
if (!staff?.length) return null;
|
|
@@ -2425,16 +2425,16 @@ function useAgentResolved() {
|
|
|
2425
2425
|
return useAgentStore((s) => s.resolved);
|
|
2426
2426
|
}
|
|
2427
2427
|
var useActiveAgent = useAgent;
|
|
2428
|
-
var useMascotFlightStore = create((
|
|
2428
|
+
var useMascotFlightStore = create((set2) => ({
|
|
2429
2429
|
corner: null,
|
|
2430
|
-
setCorner: (corner) =>
|
|
2430
|
+
setCorner: (corner) => set2({ corner }),
|
|
2431
2431
|
seat: null,
|
|
2432
|
-
setSeat: (seat) =>
|
|
2432
|
+
setSeat: (seat) => set2({ seat }),
|
|
2433
2433
|
floor: null,
|
|
2434
|
-
setFloor: (floor) =>
|
|
2434
|
+
setFloor: (floor) => set2({ floor }),
|
|
2435
2435
|
flight: null,
|
|
2436
|
-
launch: (from, to) =>
|
|
2437
|
-
land: () =>
|
|
2436
|
+
launch: (from, to) => set2({ flight: { from, to } }),
|
|
2437
|
+
land: () => set2({ flight: null })
|
|
2438
2438
|
}));
|
|
2439
2439
|
function flightBoxOf(el) {
|
|
2440
2440
|
const rect = el?.getBoundingClientRect();
|
|
@@ -2456,37 +2456,37 @@ function MascotFlight({ Face }) {
|
|
|
2456
2456
|
const flight = useMascotFlightStore((s) => s.flight);
|
|
2457
2457
|
const ref = React142.useRef(null);
|
|
2458
2458
|
React142.useEffect(
|
|
2459
|
-
() => useRightRailStore.subscribe((
|
|
2460
|
-
if (prev.open && !
|
|
2459
|
+
() => useRightRailStore.subscribe((state2, prev) => {
|
|
2460
|
+
if (prev.open && !state2.open) launchMascot(useMascotFlightStore.getState().seat, "corner");
|
|
2461
2461
|
}),
|
|
2462
2462
|
[]
|
|
2463
2463
|
);
|
|
2464
2464
|
React142.useLayoutEffect(() => {
|
|
2465
2465
|
if (!flight) return;
|
|
2466
2466
|
const { from, to } = flight;
|
|
2467
|
-
const
|
|
2467
|
+
const start2 = performance.now();
|
|
2468
2468
|
let frame = 0;
|
|
2469
|
-
const
|
|
2469
|
+
const tick2 = (now) => {
|
|
2470
2470
|
const el = ref.current;
|
|
2471
|
-
const
|
|
2472
|
-
const target = flightBoxOf(to === "seat" ?
|
|
2473
|
-
if (!el || !target && now -
|
|
2474
|
-
|
|
2471
|
+
const state2 = useMascotFlightStore.getState();
|
|
2472
|
+
const target = flightBoxOf(to === "seat" ? state2.seat : state2.corner);
|
|
2473
|
+
if (!el || !target && now - start2 > NO_TARGET_MS) {
|
|
2474
|
+
state2.land();
|
|
2475
2475
|
return;
|
|
2476
2476
|
}
|
|
2477
|
-
const progress = Math.min(1, (now -
|
|
2477
|
+
const progress = Math.min(1, (now - start2) / FLIGHT_MS);
|
|
2478
2478
|
const t = ease(progress);
|
|
2479
2479
|
const end = target ?? from;
|
|
2480
2480
|
const scale = lerp(from.width, end.width, t) / from.width;
|
|
2481
2481
|
const x = lerp(from.left, end.left, t);
|
|
2482
2482
|
const y = lerp(from.top, end.top, t) - Math.sin(Math.PI * t) * LIFT;
|
|
2483
2483
|
el.style.transform = `translate3d(${x}px, ${y}px, 0) scale(${scale})`;
|
|
2484
|
-
const below = Math.max(0, y + from.height * scale - (
|
|
2484
|
+
const below = Math.max(0, y + from.height * scale - (state2.floor ?? window.innerHeight));
|
|
2485
2485
|
el.style.clipPath = below > 0 ? `inset(0 0 ${below / scale}px 0)` : "";
|
|
2486
|
-
if (progress < 1) frame = requestAnimationFrame(
|
|
2487
|
-
else
|
|
2486
|
+
if (progress < 1) frame = requestAnimationFrame(tick2);
|
|
2487
|
+
else state2.land();
|
|
2488
2488
|
};
|
|
2489
|
-
|
|
2489
|
+
tick2(start2);
|
|
2490
2490
|
return () => cancelAnimationFrame(frame);
|
|
2491
2491
|
}, [flight]);
|
|
2492
2492
|
if (!flight || typeof document === "undefined") return null;
|
|
@@ -2886,8 +2886,8 @@ function MorphBackPill() {
|
|
|
2886
2886
|
endLeave();
|
|
2887
2887
|
return;
|
|
2888
2888
|
}
|
|
2889
|
-
const
|
|
2890
|
-
return () => clearTimeout(
|
|
2889
|
+
const timer2 = setTimeout(endLeave, MORPH_MS + 40);
|
|
2890
|
+
return () => clearTimeout(timer2);
|
|
2891
2891
|
}, [endLeave]);
|
|
2892
2892
|
if (!leaving || typeof document === "undefined") return null;
|
|
2893
2893
|
const morph = morphStyles(leaving.box, railOpen, railWidth);
|
|
@@ -3074,9 +3074,9 @@ function revealPage(delayMs = 1200) {
|
|
|
3074
3074
|
window.setTimeout(close, delayMs);
|
|
3075
3075
|
return;
|
|
3076
3076
|
}
|
|
3077
|
-
const
|
|
3078
|
-
if (prev.isStreaming && !
|
|
3079
|
-
|
|
3077
|
+
const stop2 = useChatStore.subscribe((state2, prev) => {
|
|
3078
|
+
if (prev.isStreaming && !state2.isStreaming) {
|
|
3079
|
+
stop2();
|
|
3080
3080
|
window.setTimeout(close, delayMs);
|
|
3081
3081
|
}
|
|
3082
3082
|
});
|
|
@@ -5099,8 +5099,8 @@ function sortConnectors(list) {
|
|
|
5099
5099
|
return a.name.localeCompare(b.name);
|
|
5100
5100
|
});
|
|
5101
5101
|
}
|
|
5102
|
-
function isLive(
|
|
5103
|
-
return
|
|
5102
|
+
function isLive(state2) {
|
|
5103
|
+
return state2 === "connected" || state2 === "needs_setup";
|
|
5104
5104
|
}
|
|
5105
5105
|
function orUndefined(list) {
|
|
5106
5106
|
return list.length > 0 ? list : void 0;
|
|
@@ -5198,8 +5198,8 @@ function connectorRoute(connector) {
|
|
|
5198
5198
|
}
|
|
5199
5199
|
|
|
5200
5200
|
// src/components/connect/connector-search.ts
|
|
5201
|
-
function isConnectorState(
|
|
5202
|
-
switch (
|
|
5201
|
+
function isConnectorState(state2) {
|
|
5202
|
+
switch (state2) {
|
|
5203
5203
|
case "connected":
|
|
5204
5204
|
case "needs_setup":
|
|
5205
5205
|
case "ready":
|
|
@@ -5515,14 +5515,14 @@ function extractConnectorCards(content) {
|
|
|
5515
5515
|
const row = raw;
|
|
5516
5516
|
const slug3 = typeof row.slug === "string" ? row.slug : "";
|
|
5517
5517
|
const name = typeof row.name === "string" ? row.name : "";
|
|
5518
|
-
const
|
|
5518
|
+
const state2 = row.state;
|
|
5519
5519
|
if (!slug3 || !name) continue;
|
|
5520
|
-
if (!isSuggestionState(
|
|
5520
|
+
if (!isSuggestionState(state2)) continue;
|
|
5521
5521
|
cards.push({
|
|
5522
5522
|
kind: "connector",
|
|
5523
5523
|
slug: slug3,
|
|
5524
5524
|
name,
|
|
5525
|
-
state,
|
|
5525
|
+
state: state2,
|
|
5526
5526
|
...typeof row.id === "string" ? { id: row.id } : {},
|
|
5527
5527
|
...typeof row.description === "string" ? { description: row.description } : {},
|
|
5528
5528
|
...typeof row.category === "string" ? { category: row.category } : {},
|
|
@@ -5530,7 +5530,7 @@ function extractConnectorCards(content) {
|
|
|
5530
5530
|
...typeof row.logoUrl === "string" ? { logoUrl: row.logoUrl } : {},
|
|
5531
5531
|
...typeof row.module === "string" ? { moduleId: row.module } : {},
|
|
5532
5532
|
// A destination only exists where the executor said one does.
|
|
5533
|
-
...typeof row.route === "string" && hasDestination({ state }) ? { route: row.route } : {}
|
|
5533
|
+
...typeof row.route === "string" && hasDestination({ state: state2 }) ? { route: row.route } : {}
|
|
5534
5534
|
});
|
|
5535
5535
|
if (cards.length >= MAX_CARDS) break;
|
|
5536
5536
|
}
|
|
@@ -6627,21 +6627,21 @@ function businessProfileBlock(profile) {
|
|
|
6627
6627
|
].filter(Boolean).join("\n");
|
|
6628
6628
|
}
|
|
6629
6629
|
var pending = null;
|
|
6630
|
-
var useBusinessProfileStore = create((
|
|
6630
|
+
var useBusinessProfileStore = create((set2, get) => ({
|
|
6631
6631
|
profile: null,
|
|
6632
6632
|
loaded: false,
|
|
6633
6633
|
load: async (tenantId2, businessName) => {
|
|
6634
6634
|
const current3 = get().profile;
|
|
6635
6635
|
if (current3?.tenantId === tenantId2) {
|
|
6636
6636
|
if (businessName && businessName !== current3.businessName) {
|
|
6637
|
-
|
|
6637
|
+
set2({ profile: { ...current3, businessName } });
|
|
6638
6638
|
}
|
|
6639
6639
|
return;
|
|
6640
6640
|
}
|
|
6641
6641
|
if (pending?.tenantId === tenantId2) return pending.promise;
|
|
6642
6642
|
const promise = (async () => {
|
|
6643
6643
|
const stored = await readSetupAnswers(tenantId2);
|
|
6644
|
-
|
|
6644
|
+
set2({
|
|
6645
6645
|
loaded: true,
|
|
6646
6646
|
profile: stored ? buildBusinessProfile({
|
|
6647
6647
|
tenantId: tenantId2,
|
|
@@ -6658,7 +6658,7 @@ var useBusinessProfileStore = create((set, get) => ({
|
|
|
6658
6658
|
},
|
|
6659
6659
|
clear: () => {
|
|
6660
6660
|
pending = null;
|
|
6661
|
-
|
|
6661
|
+
set2({ profile: null, loaded: false });
|
|
6662
6662
|
}
|
|
6663
6663
|
}));
|
|
6664
6664
|
function currentBusinessProfileBlock() {
|
|
@@ -6827,9 +6827,9 @@ function speak(text3, options = { locale: "pt-BR" }) {
|
|
|
6827
6827
|
// src/hooks/useChat.ts
|
|
6828
6828
|
var MAX_TOOL_ROUNDS = 5;
|
|
6829
6829
|
function speakLastReply() {
|
|
6830
|
-
const
|
|
6831
|
-
if (!
|
|
6832
|
-
const last =
|
|
6830
|
+
const state2 = useChatStore.getState();
|
|
6831
|
+
if (!state2.voiceReplies) return;
|
|
6832
|
+
const last = state2.messages[state2.messages.length - 1];
|
|
6833
6833
|
if (last?.role !== "assistant" || !last.content) return;
|
|
6834
6834
|
speak(spokenForm(last.content), {
|
|
6835
6835
|
locale: typeof navigator !== "undefined" ? navigator.language || "pt-BR" : "pt-BR"
|
|
@@ -7439,8 +7439,8 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7439
7439
|
const agentResolved = useAgentResolved();
|
|
7440
7440
|
const [waitedOut, setWaitedOut] = React142.useState(false);
|
|
7441
7441
|
React142.useEffect(() => {
|
|
7442
|
-
const
|
|
7443
|
-
return () => window.clearTimeout(
|
|
7442
|
+
const timer2 = window.setTimeout(() => setWaitedOut(true), AGENT_WAIT_MS);
|
|
7443
|
+
return () => window.clearTimeout(timer2);
|
|
7444
7444
|
}, []);
|
|
7445
7445
|
const castKnown = agentResolved || waitedOut;
|
|
7446
7446
|
React142.useEffect(() => {
|
|
@@ -7554,8 +7554,8 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7554
7554
|
return;
|
|
7555
7555
|
}
|
|
7556
7556
|
setEntrance("playing");
|
|
7557
|
-
const
|
|
7558
|
-
return () => clearTimeout(
|
|
7557
|
+
const timer2 = setTimeout(() => setEntrance("done"), 1600);
|
|
7558
|
+
return () => clearTimeout(timer2);
|
|
7559
7559
|
}, [currentOrg, castKnown]);
|
|
7560
7560
|
const [poppingBack, setPoppingBack] = React142.useState(false);
|
|
7561
7561
|
const wasMorphing = React142.useRef(false);
|
|
@@ -7564,8 +7564,8 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
|
|
|
7564
7564
|
wasMorphing.current = morphingBack;
|
|
7565
7565
|
if (!was || morphingBack || prefersReducedMotion2()) return;
|
|
7566
7566
|
setPoppingBack(true);
|
|
7567
|
-
const
|
|
7568
|
-
return () => clearTimeout(
|
|
7567
|
+
const timer2 = setTimeout(() => setPoppingBack(false), 620);
|
|
7568
|
+
return () => clearTimeout(timer2);
|
|
7569
7569
|
}, [morphingBack]);
|
|
7570
7570
|
const entering = (entrance === "playing" || poppingBack) && !expanded;
|
|
7571
7571
|
if (!currentOrg || !castKnown) return null;
|
|
@@ -8272,7 +8272,7 @@ function TourCoachCard() {
|
|
|
8272
8272
|
const index = useTourStore((s) => s.index);
|
|
8273
8273
|
const lastTour = useTourStore((s) => s.lastTour);
|
|
8274
8274
|
const lastOutcome = useTourStore((s) => s.lastOutcome);
|
|
8275
|
-
const
|
|
8275
|
+
const stop2 = useTourStore((s) => s.stop);
|
|
8276
8276
|
const restart = useTourStore((s) => s.restart);
|
|
8277
8277
|
const [dismissedId, setDismissedId] = React142.useState(null);
|
|
8278
8278
|
const pTitle = usePracticeStore((s) => s.title);
|
|
@@ -8295,24 +8295,24 @@ function TourCoachCard() {
|
|
|
8295
8295
|
}
|
|
8296
8296
|
);
|
|
8297
8297
|
}
|
|
8298
|
-
const
|
|
8298
|
+
const running2 = !!tour;
|
|
8299
8299
|
const shown = tour ?? lastTour;
|
|
8300
8300
|
if (!shown) return null;
|
|
8301
|
-
if (!
|
|
8302
|
-
if (!
|
|
8301
|
+
if (!running2 && shown.id === dismissedId) return null;
|
|
8302
|
+
if (!running2 && shown.practice?.length && lastOutcome?.tourId === shown.id) return null;
|
|
8303
8303
|
const total = shown.stops.length;
|
|
8304
|
-
const completed = !
|
|
8305
|
-
const doneThrough =
|
|
8304
|
+
const completed = !running2 && lastOutcome?.tourId === shown.id && lastOutcome.completed;
|
|
8305
|
+
const doneThrough = running2 ? index : completed ? total : lastOutcome?.tourId === shown.id ? index : 0;
|
|
8306
8306
|
return /* @__PURE__ */ jsx(
|
|
8307
8307
|
CoachCard,
|
|
8308
8308
|
{
|
|
8309
|
-
icon: completed ? /* @__PURE__ */ jsx(PartyPopper, { className: "h-3.5 w-3.5 shrink-0 text-primary" }) :
|
|
8309
|
+
icon: completed ? /* @__PURE__ */ jsx(PartyPopper, { className: "h-3.5 w-3.5 shrink-0 text-primary" }) : running2 ? LiveDot : /* @__PURE__ */ jsx(Compass, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
8310
8310
|
title: shown.title ?? tl("Guided tour", "Tour guiado"),
|
|
8311
8311
|
subtitle: completed ? tl("Done \u2014 nice work!", "Conclu\xEDdo \u2014 mandou bem!") : `${Math.min(doneThrough, total)}/${total} ${tl("steps", "passos")}`,
|
|
8312
8312
|
items: shown.stops.map((s, i) => ({
|
|
8313
8313
|
label: s.title,
|
|
8314
8314
|
done: i < doneThrough,
|
|
8315
|
-
current:
|
|
8315
|
+
current: running2 && i === index
|
|
8316
8316
|
})),
|
|
8317
8317
|
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8318
8318
|
/* @__PURE__ */ jsx(
|
|
@@ -8333,8 +8333,8 @@ function TourCoachCard() {
|
|
|
8333
8333
|
variant: "bare",
|
|
8334
8334
|
size: "bare",
|
|
8335
8335
|
type: "button",
|
|
8336
|
-
onClick: () =>
|
|
8337
|
-
title:
|
|
8336
|
+
onClick: () => running2 ? stop2(false) : setDismissedId(shown.id),
|
|
8337
|
+
title: running2 ? tl("End tour", "Encerrar tour") : tl("Dismiss", "Dispensar"),
|
|
8338
8338
|
className: "rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
8339
8339
|
children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
|
|
8340
8340
|
}
|
|
@@ -8347,7 +8347,7 @@ function AssistantRecordingView({ activity }) {
|
|
|
8347
8347
|
const { t } = useTranslation$1();
|
|
8348
8348
|
const pending2 = activity.state === "pending";
|
|
8349
8349
|
const live = activity.state === "running" || activity.state === "paused";
|
|
8350
|
-
const
|
|
8350
|
+
const running2 = activity.state === "running";
|
|
8351
8351
|
const actions = activity.actions ?? [];
|
|
8352
8352
|
const [acknowledged, setAcknowledged] = React142.useState(false);
|
|
8353
8353
|
React142.useEffect(() => setAcknowledged(false), [activity.id, activity.state]);
|
|
@@ -8363,7 +8363,7 @@ function AssistantRecordingView({ activity }) {
|
|
|
8363
8363
|
live ? "bg-destructive/10 text-destructive" : "bg-primary/10 text-primary"
|
|
8364
8364
|
),
|
|
8365
8365
|
children: [
|
|
8366
|
-
|
|
8366
|
+
running2 && /* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-ping rounded-full bg-destructive/25 motion-reduce:animate-none" }),
|
|
8367
8367
|
activity.kind === "recording" ? /* @__PURE__ */ jsx(Mic, { className: "relative h-7 w-7" }) : /* @__PURE__ */ jsx(Sparkles, { className: "relative h-7 w-7" })
|
|
8368
8368
|
]
|
|
8369
8369
|
}
|
|
@@ -8371,7 +8371,7 @@ function AssistantRecordingView({ activity }) {
|
|
|
8371
8371
|
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
8372
8372
|
activity.elapsedMs !== void 0 && /* @__PURE__ */ jsx("p", { className: "text-3xl font-semibold tabular-nums tracking-tight text-foreground", children: formatActivityElapsed(activity.elapsedMs) }),
|
|
8373
8373
|
/* @__PURE__ */ jsx("p", { className: cn(pending2 ? "text-base font-medium text-foreground" : "text-sm text-muted-foreground"), children: activity.label }),
|
|
8374
|
-
/* @__PURE__ */ jsx("p", { className: "text-[13px] text-muted-foreground/70", children: pending2 ? t("chat.recording.pending") : live ?
|
|
8374
|
+
/* @__PURE__ */ jsx("p", { className: "text-[13px] text-muted-foreground/70", children: pending2 ? t("chat.recording.pending") : live ? running2 ? t("chat.recording.running") : t("chat.recording.paused") : t("chat.recording.finished") })
|
|
8375
8375
|
] }),
|
|
8376
8376
|
pending2 && activity.confirm && /* @__PURE__ */ jsxs("div", { className: "w-full max-w-[19rem] space-y-3 text-left", children: [
|
|
8377
8377
|
/* @__PURE__ */ jsxs(
|
|
@@ -8524,9 +8524,9 @@ var STATE_VARIANT = {
|
|
|
8524
8524
|
needs_setup: "warning",
|
|
8525
8525
|
ready: "outline"
|
|
8526
8526
|
};
|
|
8527
|
-
function StateChip({ state, className }) {
|
|
8527
|
+
function StateChip({ state: state2, className }) {
|
|
8528
8528
|
const { t } = useTranslation$1();
|
|
8529
|
-
return /* @__PURE__ */ jsx(Badge, { variant: STATE_VARIANT[
|
|
8529
|
+
return /* @__PURE__ */ jsx(Badge, { variant: STATE_VARIANT[state2], className, children: t(`connectors.state.${state2}`) });
|
|
8530
8530
|
}
|
|
8531
8531
|
function ConnectorRow({
|
|
8532
8532
|
connector,
|
|
@@ -8789,7 +8789,7 @@ function ConnectorSyncActions({
|
|
|
8789
8789
|
actions,
|
|
8790
8790
|
onRan
|
|
8791
8791
|
}) {
|
|
8792
|
-
const [
|
|
8792
|
+
const [running2, setRunning] = React142__default.useState(null);
|
|
8793
8793
|
const [open, setOpen] = React142__default.useState(null);
|
|
8794
8794
|
const [pending2, setPending] = React142__default.useState(null);
|
|
8795
8795
|
const [hidden, setHidden] = React142__default.useState(() => /* @__PURE__ */ new Set());
|
|
@@ -8841,7 +8841,7 @@ function ConnectorSyncActions({
|
|
|
8841
8841
|
return /* @__PURE__ */ jsx(Screen, { onClose: () => setOpen(null), onRan });
|
|
8842
8842
|
}
|
|
8843
8843
|
if (!resolved || visible.length === 0) return null;
|
|
8844
|
-
function
|
|
8844
|
+
function start2(action) {
|
|
8845
8845
|
if (action.Component) {
|
|
8846
8846
|
setOpen(action);
|
|
8847
8847
|
return;
|
|
@@ -8859,10 +8859,10 @@ function ConnectorSyncActions({
|
|
|
8859
8859
|
ActionRow,
|
|
8860
8860
|
{
|
|
8861
8861
|
action: primary,
|
|
8862
|
-
busy:
|
|
8863
|
-
blocked:
|
|
8862
|
+
busy: running2 === primary.key,
|
|
8863
|
+
blocked: running2 !== null,
|
|
8864
8864
|
pending: queued[primary.key] ?? null,
|
|
8865
|
-
onStart:
|
|
8865
|
+
onStart: start2,
|
|
8866
8866
|
emphasis: true
|
|
8867
8867
|
}
|
|
8868
8868
|
),
|
|
@@ -8887,10 +8887,10 @@ function ConnectorSyncActions({
|
|
|
8887
8887
|
ActionRow,
|
|
8888
8888
|
{
|
|
8889
8889
|
action,
|
|
8890
|
-
busy:
|
|
8891
|
-
blocked:
|
|
8890
|
+
busy: running2 === action.key,
|
|
8891
|
+
blocked: running2 !== null,
|
|
8892
8892
|
pending: queued[action.key] ?? null,
|
|
8893
|
-
onStart:
|
|
8893
|
+
onStart: start2
|
|
8894
8894
|
}
|
|
8895
8895
|
) }, action.key)) })
|
|
8896
8896
|
] }),
|
|
@@ -9028,11 +9028,11 @@ var RUN_ICON = {
|
|
|
9028
9028
|
};
|
|
9029
9029
|
function ConnectorRuns({
|
|
9030
9030
|
connector,
|
|
9031
|
-
state
|
|
9031
|
+
state: state2
|
|
9032
9032
|
}) {
|
|
9033
9033
|
const { t } = useTranslation$1();
|
|
9034
9034
|
const def = connector.definition;
|
|
9035
|
-
const { runs, loading, reload: reload2 } =
|
|
9035
|
+
const { runs, loading, reload: reload2 } = state2;
|
|
9036
9036
|
const firstLoad = def?.firstLoad;
|
|
9037
9037
|
const backfilling = !!firstLoad && runs.some((r) => r.status === "running");
|
|
9038
9038
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
@@ -9299,7 +9299,7 @@ function ConnectorSettingsPanel({
|
|
|
9299
9299
|
if (settings.length === 0 || !def?.saveSettings) return null;
|
|
9300
9300
|
const invalid = settings.filter((s) => !matchesPattern(s, values[s.key]));
|
|
9301
9301
|
missingRequiredSettings(settings, values);
|
|
9302
|
-
function
|
|
9302
|
+
function set2(key, value) {
|
|
9303
9303
|
setValues((current3) => ({ ...current3, [key]: value }));
|
|
9304
9304
|
setDirty(true);
|
|
9305
9305
|
}
|
|
@@ -9328,7 +9328,7 @@ function ConnectorSettingsPanel({
|
|
|
9328
9328
|
setting,
|
|
9329
9329
|
value: values[setting.key],
|
|
9330
9330
|
disabled: !loaded2,
|
|
9331
|
-
onChange:
|
|
9331
|
+
onChange: set2
|
|
9332
9332
|
},
|
|
9333
9333
|
setting.key
|
|
9334
9334
|
))
|
|
@@ -9954,12 +9954,12 @@ function GrantRevoke({
|
|
|
9954
9954
|
}
|
|
9955
9955
|
);
|
|
9956
9956
|
}
|
|
9957
|
-
var useConnectorsSurface = create((
|
|
9957
|
+
var useConnectorsSurface = create((set2) => ({
|
|
9958
9958
|
selected: null,
|
|
9959
9959
|
pending: false,
|
|
9960
|
-
select: (selected) =>
|
|
9961
|
-
open: (selected) =>
|
|
9962
|
-
consume: () =>
|
|
9960
|
+
select: (selected) => set2({ selected }),
|
|
9961
|
+
open: (selected) => set2({ selected, pending: true }),
|
|
9962
|
+
consume: () => set2({ pending: false })
|
|
9963
9963
|
}));
|
|
9964
9964
|
function openConnectorsPanel(connector) {
|
|
9965
9965
|
useConnectorsSurface.getState().open(connector?.id ?? null);
|
|
@@ -10128,7 +10128,7 @@ function useDictation({
|
|
|
10128
10128
|
onInterim
|
|
10129
10129
|
}) {
|
|
10130
10130
|
const resolvedLocale = locale ?? (typeof navigator !== "undefined" ? navigator.language || "pt-BR" : "pt-BR");
|
|
10131
|
-
const [
|
|
10131
|
+
const [state2, setState] = React142.useState("idle");
|
|
10132
10132
|
const [error, setError] = React142.useState(null);
|
|
10133
10133
|
const sessionRef = React142.useRef(null);
|
|
10134
10134
|
const callbacks = React142.useRef({ onTranscript, onInterim });
|
|
@@ -10141,7 +10141,7 @@ function useDictation({
|
|
|
10141
10141
|
sessionRef.current = null;
|
|
10142
10142
|
setState("idle");
|
|
10143
10143
|
}, []);
|
|
10144
|
-
const
|
|
10144
|
+
const start2 = React142.useCallback(() => {
|
|
10145
10145
|
if (sessionRef.current || !supported) return;
|
|
10146
10146
|
stopSpeaking();
|
|
10147
10147
|
setError(null);
|
|
@@ -10162,7 +10162,7 @@ function useDictation({
|
|
|
10162
10162
|
}
|
|
10163
10163
|
);
|
|
10164
10164
|
}, [finish, resolvedLocale, supported, transcribeEndpoint]);
|
|
10165
|
-
const
|
|
10165
|
+
const stop2 = React142.useCallback(() => {
|
|
10166
10166
|
if (!sessionRef.current) return;
|
|
10167
10167
|
if (transcribeEndpoint) setState("transcribing");
|
|
10168
10168
|
sessionRef.current.stop();
|
|
@@ -10174,11 +10174,11 @@ function useDictation({
|
|
|
10174
10174
|
setError(null);
|
|
10175
10175
|
}, []);
|
|
10176
10176
|
const toggle = React142.useCallback(() => {
|
|
10177
|
-
if (
|
|
10178
|
-
else
|
|
10179
|
-
}, [
|
|
10177
|
+
if (state2 === "listening" || state2 === "transcribing") stop2();
|
|
10178
|
+
else start2();
|
|
10179
|
+
}, [state2, start2, stop2]);
|
|
10180
10180
|
React142.useEffect(() => () => sessionRef.current?.cancel(), []);
|
|
10181
|
-
return { supported, state, error, start, stop, cancel, toggle, clearError: () => setError(null) };
|
|
10181
|
+
return { supported, state: state2, error, start: start2, stop: stop2, cancel, toggle, clearError: () => setError(null) };
|
|
10182
10182
|
}
|
|
10183
10183
|
function useMicLevels(active2, bandCount = 28, externalStream) {
|
|
10184
10184
|
const levelsRef = React142.useRef(new Float32Array(bandCount));
|
|
@@ -10214,7 +10214,7 @@ function useMicLevels(active2, bandCount = 28, externalStream) {
|
|
|
10214
10214
|
const usableBins = Math.floor(analyser.frequencyBinCount * 0.55);
|
|
10215
10215
|
const perBand = Math.max(1, Math.floor(usableBins / bandCount));
|
|
10216
10216
|
setAvailable(true);
|
|
10217
|
-
const
|
|
10217
|
+
const tick2 = () => {
|
|
10218
10218
|
if (cancelled) return;
|
|
10219
10219
|
analyser.getByteFrequencyData(spectrum);
|
|
10220
10220
|
for (let band = 0; band < bandCount; band++) {
|
|
@@ -10225,9 +10225,9 @@ function useMicLevels(active2, bandCount = 28, externalStream) {
|
|
|
10225
10225
|
const previous = levelsRef.current[band];
|
|
10226
10226
|
levelsRef.current[band] = value > previous ? value : previous * 0.82 + value * 0.18;
|
|
10227
10227
|
}
|
|
10228
|
-
frame = requestAnimationFrame(
|
|
10228
|
+
frame = requestAnimationFrame(tick2);
|
|
10229
10229
|
};
|
|
10230
|
-
frame = requestAnimationFrame(
|
|
10230
|
+
frame = requestAnimationFrame(tick2);
|
|
10231
10231
|
}).catch(() => {
|
|
10232
10232
|
if (!cancelled) setAvailable(false);
|
|
10233
10233
|
});
|
|
@@ -10543,7 +10543,7 @@ function ChatComposer({
|
|
|
10543
10543
|
if (!focusRequested) return;
|
|
10544
10544
|
let frames = 0;
|
|
10545
10545
|
let raf = 0;
|
|
10546
|
-
const
|
|
10546
|
+
const tick2 = () => {
|
|
10547
10547
|
const el = textareaRef.current;
|
|
10548
10548
|
if (el && document.activeElement !== el) el.focus({ preventScroll: true });
|
|
10549
10549
|
frames += 1;
|
|
@@ -10551,9 +10551,9 @@ function ChatComposer({
|
|
|
10551
10551
|
consumeComposerFocus();
|
|
10552
10552
|
return;
|
|
10553
10553
|
}
|
|
10554
|
-
raf = requestAnimationFrame(
|
|
10554
|
+
raf = requestAnimationFrame(tick2);
|
|
10555
10555
|
};
|
|
10556
|
-
raf = requestAnimationFrame(
|
|
10556
|
+
raf = requestAnimationFrame(tick2);
|
|
10557
10557
|
return () => cancelAnimationFrame(raf);
|
|
10558
10558
|
}, [focusRequested, consumeComposerFocus]);
|
|
10559
10559
|
React142.useEffect(() => {
|
|
@@ -11065,7 +11065,7 @@ function ChatMarkdown({ content }) {
|
|
|
11065
11065
|
if (listStart) {
|
|
11066
11066
|
const baseIndent = listStart[1].length;
|
|
11067
11067
|
const ordered = /^\d/.test(listStart[2]);
|
|
11068
|
-
const
|
|
11068
|
+
const start2 = ordered ? parseInt(listStart[2], 10) : void 0;
|
|
11069
11069
|
const items = [];
|
|
11070
11070
|
while (i < lines.length) {
|
|
11071
11071
|
const m = LIST_RE.exec(lines[i]);
|
|
@@ -11099,7 +11099,7 @@ function ChatMarkdown({ content }) {
|
|
|
11099
11099
|
}
|
|
11100
11100
|
const listClass = "my-1 space-y-0.5 pl-4 first:mt-0 last:mb-0";
|
|
11101
11101
|
blocks.push(
|
|
11102
|
-
ordered ? /* @__PURE__ */ jsx("ol", { start, className: `${listClass} list-decimal`, children: items }, key++) : /* @__PURE__ */ jsx("ul", { className: `${listClass} list-disc`, children: items }, key++)
|
|
11102
|
+
ordered ? /* @__PURE__ */ jsx("ol", { start: start2, className: `${listClass} list-decimal`, children: items }, key++) : /* @__PURE__ */ jsx("ul", { className: `${listClass} list-disc`, children: items }, key++)
|
|
11103
11103
|
);
|
|
11104
11104
|
continue;
|
|
11105
11105
|
}
|
|
@@ -11956,7 +11956,7 @@ function TypedText({
|
|
|
11956
11956
|
text: text3,
|
|
11957
11957
|
className,
|
|
11958
11958
|
as: Tag3 = "p",
|
|
11959
|
-
start = true,
|
|
11959
|
+
start: start2 = true,
|
|
11960
11960
|
startDelay = 0,
|
|
11961
11961
|
onDone
|
|
11962
11962
|
}) {
|
|
@@ -11965,7 +11965,7 @@ function TypedText({
|
|
|
11965
11965
|
const done = React142.useRef(onDone);
|
|
11966
11966
|
done.current = onDone;
|
|
11967
11967
|
React142.useEffect(() => {
|
|
11968
|
-
if (!
|
|
11968
|
+
if (!start2) {
|
|
11969
11969
|
setCount(0);
|
|
11970
11970
|
return;
|
|
11971
11971
|
}
|
|
@@ -11977,21 +11977,21 @@ function TypedText({
|
|
|
11977
11977
|
setCount(0);
|
|
11978
11978
|
const step = Math.min(MAX_CHAR_MS, Math.max(MIN_CHAR_MS, Math.round(TYPE_MS / text3.length)));
|
|
11979
11979
|
let i = 0;
|
|
11980
|
-
let
|
|
11981
|
-
const first = setTimeout(function
|
|
11980
|
+
let timer2;
|
|
11981
|
+
const first = setTimeout(function tick2() {
|
|
11982
11982
|
i += 1;
|
|
11983
11983
|
setCount(i);
|
|
11984
11984
|
if (i >= text3.length) {
|
|
11985
11985
|
done.current?.();
|
|
11986
11986
|
return;
|
|
11987
11987
|
}
|
|
11988
|
-
|
|
11988
|
+
timer2 = setTimeout(tick2, step);
|
|
11989
11989
|
}, startDelay);
|
|
11990
11990
|
return () => {
|
|
11991
11991
|
clearTimeout(first);
|
|
11992
|
-
clearTimeout(
|
|
11992
|
+
clearTimeout(timer2);
|
|
11993
11993
|
};
|
|
11994
|
-
}, [text3, reduced,
|
|
11994
|
+
}, [text3, reduced, start2, startDelay]);
|
|
11995
11995
|
return /* @__PURE__ */ jsxs(Tag3, { className: cn("grid", className), children: [
|
|
11996
11996
|
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "invisible", style: { gridArea: "1 / 1" }, children: text3 }),
|
|
11997
11997
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: text3 }),
|
|
@@ -11999,7 +11999,7 @@ function TypedText({
|
|
|
11999
11999
|
] });
|
|
12000
12000
|
}
|
|
12001
12001
|
function RevealSequence({
|
|
12002
|
-
start,
|
|
12002
|
+
start: start2,
|
|
12003
12003
|
gapMs = 110,
|
|
12004
12004
|
children
|
|
12005
12005
|
}) {
|
|
@@ -12007,7 +12007,7 @@ function RevealSequence({
|
|
|
12007
12007
|
const items = React142.Children.toArray(children);
|
|
12008
12008
|
const [shown, setShown] = React142.useState(0);
|
|
12009
12009
|
React142.useEffect(() => {
|
|
12010
|
-
if (!
|
|
12010
|
+
if (!start2) {
|
|
12011
12011
|
setShown(0);
|
|
12012
12012
|
return;
|
|
12013
12013
|
}
|
|
@@ -12023,7 +12023,7 @@ function RevealSequence({
|
|
|
12023
12023
|
if (i >= items.length) clearInterval(id);
|
|
12024
12024
|
}, gapMs);
|
|
12025
12025
|
return () => clearInterval(id);
|
|
12026
|
-
}, [
|
|
12026
|
+
}, [start2, reduced, items.length, gapMs]);
|
|
12027
12027
|
return /* @__PURE__ */ jsx(Fragment, { children: items.map((child, i) => /* @__PURE__ */ jsx(
|
|
12028
12028
|
"div",
|
|
12029
12029
|
{
|
|
@@ -12756,14 +12756,14 @@ var initialState = {
|
|
|
12756
12756
|
initialized: false,
|
|
12757
12757
|
pendingEmailVerification: false
|
|
12758
12758
|
};
|
|
12759
|
-
var useAuthStore7 = create((
|
|
12759
|
+
var useAuthStore7 = create((set2) => ({
|
|
12760
12760
|
...initialState,
|
|
12761
|
-
setUser: (user) =>
|
|
12762
|
-
setSession: (session3) =>
|
|
12763
|
-
setLoading: (loading) =>
|
|
12764
|
-
setInitialized: (initialized) =>
|
|
12765
|
-
setPendingEmailVerification: (pendingEmailVerification) =>
|
|
12766
|
-
reset: () =>
|
|
12761
|
+
setUser: (user) => set2({ user }),
|
|
12762
|
+
setSession: (session3) => set2({ session: session3, user: session3?.user ?? null, pendingEmailVerification: false }),
|
|
12763
|
+
setLoading: (loading) => set2({ loading }),
|
|
12764
|
+
setInitialized: (initialized) => set2({ initialized }),
|
|
12765
|
+
setPendingEmailVerification: (pendingEmailVerification) => set2({ pendingEmailVerification }),
|
|
12766
|
+
reset: () => set2(initialState)
|
|
12767
12767
|
}));
|
|
12768
12768
|
var STORAGE_KEY = "saas-core:locale";
|
|
12769
12769
|
function readPersistedLocale() {
|
|
@@ -12776,18 +12776,18 @@ function readPersistedLocale() {
|
|
|
12776
12776
|
function getPersistedLocale() {
|
|
12777
12777
|
return readPersistedLocale() ?? "en";
|
|
12778
12778
|
}
|
|
12779
|
-
var useLocaleStore = create((
|
|
12779
|
+
var useLocaleStore = create((set2) => ({
|
|
12780
12780
|
locale: getPersistedLocale(),
|
|
12781
12781
|
setLocale: (locale) => {
|
|
12782
12782
|
try {
|
|
12783
12783
|
localStorage.setItem(STORAGE_KEY, locale);
|
|
12784
12784
|
} catch {
|
|
12785
12785
|
}
|
|
12786
|
-
|
|
12786
|
+
set2({ locale });
|
|
12787
12787
|
},
|
|
12788
12788
|
hydrateDefault: (locale) => {
|
|
12789
12789
|
if (readPersistedLocale()) return;
|
|
12790
|
-
|
|
12790
|
+
set2({ locale });
|
|
12791
12791
|
}
|
|
12792
12792
|
}));
|
|
12793
12793
|
function useDelegateToAssistant() {
|
|
@@ -12860,12 +12860,12 @@ function TasksRailPanel() {
|
|
|
12860
12860
|
);
|
|
12861
12861
|
return null;
|
|
12862
12862
|
}
|
|
12863
|
-
var useSettingsTabsStore = create((
|
|
12863
|
+
var useSettingsTabsStore = create((set2, get) => ({
|
|
12864
12864
|
ids: [],
|
|
12865
12865
|
setIds: (ids) => {
|
|
12866
12866
|
const current3 = get().ids;
|
|
12867
12867
|
if (current3.length === ids.length && current3.every((id, i) => id === ids[i])) return;
|
|
12868
|
-
|
|
12868
|
+
set2({ ids });
|
|
12869
12869
|
}
|
|
12870
12870
|
}));
|
|
12871
12871
|
function usePublishSettingsTabs(ids) {
|
|
@@ -13109,27 +13109,27 @@ async function completeOnboardingTask(tenantId2, sourceKey) {
|
|
|
13109
13109
|
}
|
|
13110
13110
|
|
|
13111
13111
|
// src/onboarding/activation.store.ts
|
|
13112
|
-
var useActivationStore = create((
|
|
13112
|
+
var useActivationStore = create((set2, get) => ({
|
|
13113
13113
|
rows: null,
|
|
13114
13114
|
catalog: [],
|
|
13115
13115
|
loading: false,
|
|
13116
13116
|
guided: false,
|
|
13117
|
-
setCatalog: (catalog) =>
|
|
13118
|
-
setGuided: (guided) =>
|
|
13117
|
+
setCatalog: (catalog) => set2({ catalog }),
|
|
13118
|
+
setGuided: (guided) => set2({ guided }),
|
|
13119
13119
|
load: async (tenantId2) => {
|
|
13120
13120
|
if (!tenantId2) return;
|
|
13121
|
-
if (get().tenantId !== tenantId2)
|
|
13122
|
-
|
|
13121
|
+
if (get().tenantId !== tenantId2) set2({ tenantId: tenantId2, rows: null });
|
|
13122
|
+
set2({ loading: true });
|
|
13123
13123
|
const rows = await listOnboardingTasks(tenantId2);
|
|
13124
13124
|
if (get().tenantId !== tenantId2) return;
|
|
13125
|
-
|
|
13125
|
+
set2({ rows, loading: false });
|
|
13126
13126
|
},
|
|
13127
13127
|
complete: async (key, by = "user") => {
|
|
13128
13128
|
const { tenantId: tenantId2, rows, catalog, onStepCompleted } = get();
|
|
13129
13129
|
if (!tenantId2 || !rows) return;
|
|
13130
13130
|
const row = rows.find((r) => r.sourceKey === key);
|
|
13131
13131
|
if (!row || row.status === "done" || row.status === "cancelled") return;
|
|
13132
|
-
|
|
13132
|
+
set2({
|
|
13133
13133
|
rows: rows.map(
|
|
13134
13134
|
(r) => r.sourceKey === key ? { ...r, status: "done", completedAt: (/* @__PURE__ */ new Date()).toISOString() } : r
|
|
13135
13135
|
)
|
|
@@ -13139,17 +13139,17 @@ var useActivationStore = create((set, get) => ({
|
|
|
13139
13139
|
if (step) onStepCompleted?.(step, by);
|
|
13140
13140
|
}
|
|
13141
13141
|
}));
|
|
13142
|
-
function selectSteps(
|
|
13143
|
-
if (!
|
|
13144
|
-
return mergeOnboardingSteps(
|
|
13142
|
+
function selectSteps(state2) {
|
|
13143
|
+
if (!state2.rows) return [];
|
|
13144
|
+
return mergeOnboardingSteps(state2.catalog, state2.rows, {
|
|
13145
13145
|
onComplete: (key) => void useActivationStore.getState().complete(key, "sensor")
|
|
13146
13146
|
});
|
|
13147
13147
|
}
|
|
13148
|
-
function openStepKeys(
|
|
13148
|
+
function openStepKeys(state2) {
|
|
13149
13149
|
const closed = new Set(
|
|
13150
|
-
(
|
|
13150
|
+
(state2.rows ?? []).filter((r) => r.status === "done" || r.status === "cancelled").map((r) => r.sourceKey)
|
|
13151
13151
|
);
|
|
13152
|
-
return new Set(
|
|
13152
|
+
return new Set(state2.catalog.map((s) => s.key).filter((k) => !closed.has(k)));
|
|
13153
13153
|
}
|
|
13154
13154
|
function planScript(moves, tourId) {
|
|
13155
13155
|
const acts = [];
|
|
@@ -13235,9 +13235,9 @@ function typeInto(id, text3) {
|
|
|
13235
13235
|
const frames = Math.max(1, Math.round(total / TYPING_FRAME_MS));
|
|
13236
13236
|
const perFrame = Math.max(1, Math.ceil(words2.length / frames));
|
|
13237
13237
|
let cursor = 0;
|
|
13238
|
-
let
|
|
13238
|
+
let timer2;
|
|
13239
13239
|
const finish = () => {
|
|
13240
|
-
if (
|
|
13240
|
+
if (timer2) clearTimeout(timer2);
|
|
13241
13241
|
typers.delete(finish);
|
|
13242
13242
|
useChatStore.getState().setMessageContent(id, text3);
|
|
13243
13243
|
};
|
|
@@ -13245,10 +13245,10 @@ function typeInto(id, text3) {
|
|
|
13245
13245
|
cursor += perFrame;
|
|
13246
13246
|
if (cursor >= words2.length) return finish();
|
|
13247
13247
|
useChatStore.getState().setMessageContent(id, words2.slice(0, cursor).join(""));
|
|
13248
|
-
|
|
13248
|
+
timer2 = setTimeout(step, TYPING_FRAME_MS);
|
|
13249
13249
|
};
|
|
13250
13250
|
typers.add(finish);
|
|
13251
|
-
|
|
13251
|
+
timer2 = setTimeout(step, TYPING_LEAD_MS);
|
|
13252
13252
|
}
|
|
13253
13253
|
var typers = /* @__PURE__ */ new Set();
|
|
13254
13254
|
function flushTyping() {
|
|
@@ -13304,27 +13304,27 @@ async function runStepScript(step, options) {
|
|
|
13304
13304
|
|
|
13305
13305
|
// src/onboarding/guided.ts
|
|
13306
13306
|
async function ensureChecklist() {
|
|
13307
|
-
const
|
|
13308
|
-
if (!
|
|
13309
|
-
const seeded = new Set((
|
|
13310
|
-
const missing =
|
|
13307
|
+
const state2 = useActivationStore.getState();
|
|
13308
|
+
if (!state2.tenantId || state2.catalog.length === 0) return;
|
|
13309
|
+
const seeded = new Set((state2.rows ?? []).map((r) => r.sourceKey));
|
|
13310
|
+
const missing = state2.catalog.filter((s) => !seeded.has(s.key));
|
|
13311
13311
|
if (missing.length === 0) return;
|
|
13312
13312
|
const user = useAuthStore.getState().user;
|
|
13313
13313
|
if (!user) return;
|
|
13314
13314
|
const ok = await seedOnboardingTasks({
|
|
13315
|
-
tenantId:
|
|
13315
|
+
tenantId: state2.tenantId,
|
|
13316
13316
|
userId: user.id,
|
|
13317
13317
|
userName: user.fullName || user.email,
|
|
13318
13318
|
items: missing
|
|
13319
13319
|
});
|
|
13320
|
-
if (ok) await useActivationStore.getState().load(
|
|
13320
|
+
if (ok) await useActivationStore.getState().load(state2.tenantId);
|
|
13321
13321
|
}
|
|
13322
13322
|
async function startGuidedRun(stepKey) {
|
|
13323
13323
|
useActivationStore.getState().setGuided(true);
|
|
13324
13324
|
await ensureChecklist();
|
|
13325
|
-
const
|
|
13326
|
-
const open = openStepKeys(
|
|
13327
|
-
const step =
|
|
13325
|
+
const state2 = useActivationStore.getState();
|
|
13326
|
+
const open = openStepKeys(state2);
|
|
13327
|
+
const step = state2.catalog.find((s) => stepKey ? s.key === stepKey : open.has(s.key));
|
|
13328
13328
|
await runStep(step);
|
|
13329
13329
|
}
|
|
13330
13330
|
async function runStep(step) {
|
|
@@ -13665,9 +13665,9 @@ function ActivationAgentSurface({ programs }) {
|
|
|
13665
13665
|
id: "onboarding.activation",
|
|
13666
13666
|
pluginId: "onboarding",
|
|
13667
13667
|
describe: () => {
|
|
13668
|
-
const
|
|
13669
|
-
const open = openStepKeys(
|
|
13670
|
-
const steps =
|
|
13668
|
+
const state2 = useActivationStore.getState();
|
|
13669
|
+
const open = openStepKeys(state2);
|
|
13670
|
+
const steps = state2.catalog.map((s) => ({
|
|
13671
13671
|
key: s.key,
|
|
13672
13672
|
title: s.title,
|
|
13673
13673
|
why: s.description,
|
|
@@ -13676,17 +13676,17 @@ function ActivationAgentSurface({ programs }) {
|
|
|
13676
13676
|
route: s.route,
|
|
13677
13677
|
hint: s.agentHint
|
|
13678
13678
|
}));
|
|
13679
|
-
const next =
|
|
13679
|
+
const next = state2.catalog.find((s) => open.has(s.key));
|
|
13680
13680
|
return {
|
|
13681
13681
|
title: tl("Workspace setup", "Implanta\xE7\xE3o da \xE1rea de trabalho"),
|
|
13682
13682
|
state: {
|
|
13683
13683
|
// Rows, not catalog: the catalog is what this app COULD ask for,
|
|
13684
13684
|
// the rows are what this workspace was actually given.
|
|
13685
|
-
checklistExists: (
|
|
13685
|
+
checklistExists: (state2.rows?.length ?? 0) > 0,
|
|
13686
13686
|
progress: `${steps.length - open.size}/${steps.length}`,
|
|
13687
13687
|
// On during the first run: it is what says "walk them through it and
|
|
13688
13688
|
// wait", rather than answering questions as they come.
|
|
13689
|
-
guided:
|
|
13689
|
+
guided: state2.guided,
|
|
13690
13690
|
nextStep: next ? {
|
|
13691
13691
|
key: next.key,
|
|
13692
13692
|
title: next.title,
|
|
@@ -13703,10 +13703,10 @@ function ActivationAgentSurface({ programs }) {
|
|
|
13703
13703
|
// Only while there is something left to do — an instructions block that
|
|
13704
13704
|
// outlives the onboarding turns every later conversation into a nag.
|
|
13705
13705
|
get instructions() {
|
|
13706
|
-
const
|
|
13707
|
-
if (!
|
|
13708
|
-
if (
|
|
13709
|
-
const open = openStepKeys(
|
|
13706
|
+
const state2 = useActivationStore.getState();
|
|
13707
|
+
if (!state2.rows) return void 0;
|
|
13708
|
+
if (state2.rows.length === 0) return NO_CHECKLIST_INSTRUCTIONS;
|
|
13709
|
+
const open = openStepKeys(state2);
|
|
13710
13710
|
if (open.size === 0) return void 0;
|
|
13711
13711
|
return [COACH_INSTRUCTIONS, ...programInstructions(programsRef.current, open)].join("\n\n");
|
|
13712
13712
|
},
|
|
@@ -13724,10 +13724,10 @@ function ActivationAgentSurface({ programs }) {
|
|
|
13724
13724
|
{
|
|
13725
13725
|
tool: TOOLS[1],
|
|
13726
13726
|
execute: () => {
|
|
13727
|
-
const
|
|
13728
|
-
const open = openStepKeys(
|
|
13727
|
+
const state2 = useActivationStore.getState();
|
|
13728
|
+
const open = openStepKeys(state2);
|
|
13729
13729
|
return {
|
|
13730
|
-
steps:
|
|
13730
|
+
steps: state2.catalog.map((s) => ({
|
|
13731
13731
|
key: s.key,
|
|
13732
13732
|
title: s.title,
|
|
13733
13733
|
module: s.programTitle,
|
|
@@ -13784,12 +13784,12 @@ function ActivationAgentSurface({ programs }) {
|
|
|
13784
13784
|
execute: async (args) => {
|
|
13785
13785
|
const key = typeof args["key"] === "string" ? args["key"] : void 0;
|
|
13786
13786
|
await startGuidedRun(key);
|
|
13787
|
-
const
|
|
13788
|
-
const open = openStepKeys(
|
|
13789
|
-
const next =
|
|
13787
|
+
const state2 = useActivationStore.getState();
|
|
13788
|
+
const open = openStepKeys(state2);
|
|
13789
|
+
const next = state2.catalog.find((s) => open.has(s.key));
|
|
13790
13790
|
return {
|
|
13791
13791
|
started: true,
|
|
13792
|
-
steps:
|
|
13792
|
+
steps: state2.catalog.length,
|
|
13793
13793
|
remaining: open.size,
|
|
13794
13794
|
currentStep: next ? { key: next.key, title: next.title, route: next.route } : null
|
|
13795
13795
|
};
|
|
@@ -14098,16 +14098,16 @@ function SetupAgentSurface() {
|
|
|
14098
14098
|
var DEBOUNCE_MS = 1200;
|
|
14099
14099
|
function useActivationWatch() {
|
|
14100
14100
|
React142.useEffect(() => {
|
|
14101
|
-
let
|
|
14102
|
-
let
|
|
14101
|
+
let timer2 = null;
|
|
14102
|
+
let running2 = false;
|
|
14103
14103
|
const sweep = async () => {
|
|
14104
|
-
if (
|
|
14105
|
-
const
|
|
14106
|
-
if (!
|
|
14107
|
-
const open = openStepKeys(
|
|
14108
|
-
const probes =
|
|
14104
|
+
if (running2) return;
|
|
14105
|
+
const state2 = useActivationStore.getState();
|
|
14106
|
+
if (!state2.tenantId || !state2.rows) return;
|
|
14107
|
+
const open = openStepKeys(state2);
|
|
14108
|
+
const probes = state2.catalog.filter((s) => open.has(s.key) && s.check);
|
|
14109
14109
|
if (probes.length === 0) return;
|
|
14110
|
-
|
|
14110
|
+
running2 = true;
|
|
14111
14111
|
try {
|
|
14112
14112
|
for (const step of probes) {
|
|
14113
14113
|
let done = false;
|
|
@@ -14122,34 +14122,34 @@ function useActivationWatch() {
|
|
|
14122
14122
|
await fresh.complete(step.key, "sensor");
|
|
14123
14123
|
}
|
|
14124
14124
|
} finally {
|
|
14125
|
-
|
|
14125
|
+
running2 = false;
|
|
14126
14126
|
}
|
|
14127
14127
|
};
|
|
14128
14128
|
const off = registerEventSink(() => {
|
|
14129
|
-
if (
|
|
14130
|
-
|
|
14129
|
+
if (timer2) clearTimeout(timer2);
|
|
14130
|
+
timer2 = setTimeout(() => {
|
|
14131
14131
|
void sweep();
|
|
14132
14132
|
}, DEBOUNCE_MS);
|
|
14133
14133
|
});
|
|
14134
14134
|
return () => {
|
|
14135
|
-
if (
|
|
14135
|
+
if (timer2) clearTimeout(timer2);
|
|
14136
14136
|
off();
|
|
14137
14137
|
};
|
|
14138
14138
|
}, []);
|
|
14139
14139
|
React142.useEffect(() => {
|
|
14140
14140
|
useActivationStore.setState({
|
|
14141
14141
|
onStepCompleted: (step, by) => {
|
|
14142
|
-
const
|
|
14143
|
-
if (!
|
|
14142
|
+
const state2 = useActivationStore.getState();
|
|
14143
|
+
if (!state2.guided) return;
|
|
14144
14144
|
if (by === "agent") return;
|
|
14145
|
-
const open = openStepKeys(
|
|
14145
|
+
const open = openStepKeys(state2);
|
|
14146
14146
|
celebrate(step, open.size);
|
|
14147
14147
|
if (open.size === 0) {
|
|
14148
14148
|
useActivationStore.setState({ guided: false });
|
|
14149
14149
|
clearRun();
|
|
14150
14150
|
return;
|
|
14151
14151
|
}
|
|
14152
|
-
void runStep(
|
|
14152
|
+
void runStep(state2.catalog.find((s) => open.has(s.key)));
|
|
14153
14153
|
}
|
|
14154
14154
|
});
|
|
14155
14155
|
return () => {
|
|
@@ -14741,8 +14741,8 @@ function pause(ms) {
|
|
|
14741
14741
|
async function runWelcome(input = {}) {
|
|
14742
14742
|
const wait = input.wait ?? pause;
|
|
14743
14743
|
const token = beginRun("onboarding.welcome");
|
|
14744
|
-
const
|
|
14745
|
-
const open = openStepKeys(
|
|
14744
|
+
const state2 = useActivationStore.getState();
|
|
14745
|
+
const open = openStepKeys(state2);
|
|
14746
14746
|
const profile = useBusinessProfileStore.getState().profile;
|
|
14747
14747
|
const business = input.businessName || profile?.businessName;
|
|
14748
14748
|
const vertical = input.verticalId || profile?.verticalId;
|
|
@@ -14775,8 +14775,8 @@ async function runWelcome(input = {}) {
|
|
|
14775
14775
|
useTourStore.getState().start(tour);
|
|
14776
14776
|
}
|
|
14777
14777
|
function whenTourEnds(tourId, then) {
|
|
14778
|
-
const unsubscribe = useTourStore.subscribe((
|
|
14779
|
-
if (
|
|
14778
|
+
const unsubscribe = useTourStore.subscribe((state2) => {
|
|
14779
|
+
if (state2.tour || state2.lastOutcome?.tourId !== tourId) return;
|
|
14780
14780
|
unsubscribe();
|
|
14781
14781
|
then();
|
|
14782
14782
|
});
|
|
@@ -14858,7 +14858,7 @@ function ActivationProvider() {
|
|
|
14858
14858
|
return;
|
|
14859
14859
|
}
|
|
14860
14860
|
if (!pending2) return;
|
|
14861
|
-
const
|
|
14861
|
+
const timer2 = window.setTimeout(() => {
|
|
14862
14862
|
useActivationStore.getState().setGuided(true);
|
|
14863
14863
|
void runWelcome({
|
|
14864
14864
|
userName: useAuthStore.getState().user?.fullName || useAuthStore.getState().user?.email,
|
|
@@ -14866,7 +14866,7 @@ function ActivationProvider() {
|
|
|
14866
14866
|
verticalId
|
|
14867
14867
|
});
|
|
14868
14868
|
}, 1200);
|
|
14869
|
-
return () => window.clearTimeout(
|
|
14869
|
+
return () => window.clearTimeout(timer2);
|
|
14870
14870
|
}, [tenantId2]);
|
|
14871
14871
|
const guides = runtime?.setupGuides;
|
|
14872
14872
|
React142.useEffect(() => {
|
|
@@ -14899,17 +14899,17 @@ function ActivationProvider() {
|
|
|
14899
14899
|
/* @__PURE__ */ jsx(PracticeOverlay, {})
|
|
14900
14900
|
] });
|
|
14901
14901
|
}
|
|
14902
|
-
var useHandbookStore = create((
|
|
14902
|
+
var useHandbookStore = create((set2, get) => ({
|
|
14903
14903
|
pages: null,
|
|
14904
14904
|
loading: false,
|
|
14905
|
-
setUser: (userId) =>
|
|
14905
|
+
setUser: (userId) => set2({ userId }),
|
|
14906
14906
|
load: async (tenantId2) => {
|
|
14907
14907
|
if (!tenantId2) return;
|
|
14908
|
-
if (get().tenantId !== tenantId2)
|
|
14909
|
-
|
|
14908
|
+
if (get().tenantId !== tenantId2) set2({ tenantId: tenantId2, pages: null });
|
|
14909
|
+
set2({ loading: true });
|
|
14910
14910
|
const pages = await listHandbook(tenantId2);
|
|
14911
14911
|
if (get().tenantId !== tenantId2) return;
|
|
14912
|
-
|
|
14912
|
+
set2({ pages, loading: false });
|
|
14913
14913
|
},
|
|
14914
14914
|
entries: () => toEntries(get().pages ?? []),
|
|
14915
14915
|
find: (id) => (get().pages ?? []).find((p) => p.id === id),
|
|
@@ -14937,7 +14937,7 @@ var useHandbookStore = create((set, get) => ({
|
|
|
14937
14937
|
remove: async (target) => {
|
|
14938
14938
|
const { tenantId: tenantId2 } = get();
|
|
14939
14939
|
if (!tenantId2) return;
|
|
14940
|
-
|
|
14940
|
+
set2((s) => ({
|
|
14941
14941
|
pages: (s.pages ?? []).filter((p) => target.id ? p.id !== target.id : p.path !== target.path)
|
|
14942
14942
|
}));
|
|
14943
14943
|
await deleteHandbookPage(tenantId2, target);
|
|
@@ -15126,9 +15126,9 @@ function HandbookAgentSurface() {
|
|
|
15126
15126
|
useAgentSurface(contribution);
|
|
15127
15127
|
return null;
|
|
15128
15128
|
}
|
|
15129
|
-
var useNotesTasksBridge = create((
|
|
15129
|
+
var useNotesTasksBridge = create((set2) => ({
|
|
15130
15130
|
adapter: null,
|
|
15131
|
-
setAdapter: (adapter) =>
|
|
15131
|
+
setAdapter: (adapter) => set2({ adapter })
|
|
15132
15132
|
}));
|
|
15133
15133
|
function registerNotesTasksAdapter(adapter) {
|
|
15134
15134
|
useNotesTasksBridge.getState().setAdapter(adapter);
|
|
@@ -15165,8 +15165,8 @@ function NotebookPanel() {
|
|
|
15165
15165
|
() => (pages ?? []).map((p) => ({ page: p, entry: toEntry2(p) })),
|
|
15166
15166
|
[pages]
|
|
15167
15167
|
);
|
|
15168
|
-
const
|
|
15169
|
-
const
|
|
15168
|
+
const timer2 = React142.useRef(null);
|
|
15169
|
+
const inFlight2 = React142.useRef(false);
|
|
15170
15170
|
const persist = React142.useCallback(async (d) => {
|
|
15171
15171
|
const title = titleFromBody(d.body);
|
|
15172
15172
|
if (!title && !d.body.trim()) return d.id;
|
|
@@ -15189,21 +15189,21 @@ function NotebookPanel() {
|
|
|
15189
15189
|
});
|
|
15190
15190
|
return saved?.id ?? d.id;
|
|
15191
15191
|
}, [write4, userId]);
|
|
15192
|
-
const
|
|
15192
|
+
const schedule2 = React142.useCallback((next) => {
|
|
15193
15193
|
setDraft(next);
|
|
15194
|
-
if (
|
|
15195
|
-
|
|
15196
|
-
if (
|
|
15197
|
-
|
|
15194
|
+
if (timer2.current) clearTimeout(timer2.current);
|
|
15195
|
+
timer2.current = setTimeout(() => {
|
|
15196
|
+
if (inFlight2.current) return;
|
|
15197
|
+
inFlight2.current = true;
|
|
15198
15198
|
void persist(next).then((id) => {
|
|
15199
15199
|
if (id) setDraft((d) => d && !d.id ? { ...d, id } : d);
|
|
15200
15200
|
}).finally(() => {
|
|
15201
|
-
|
|
15201
|
+
inFlight2.current = false;
|
|
15202
15202
|
});
|
|
15203
15203
|
}, SAVE_DEBOUNCE_MS);
|
|
15204
15204
|
}, [persist]);
|
|
15205
15205
|
const closeEditor = async () => {
|
|
15206
|
-
if (
|
|
15206
|
+
if (timer2.current) clearTimeout(timer2.current);
|
|
15207
15207
|
if (draft) await persist(draft);
|
|
15208
15208
|
setDraft(null);
|
|
15209
15209
|
setPreview(false);
|
|
@@ -15222,13 +15222,13 @@ function NotebookPanel() {
|
|
|
15222
15222
|
});
|
|
15223
15223
|
};
|
|
15224
15224
|
const folders = React142.useMemo(() => {
|
|
15225
|
-
const
|
|
15225
|
+
const set2 = /* @__PURE__ */ new Set();
|
|
15226
15226
|
for (const { page } of entries2) {
|
|
15227
15227
|
if (page.kind !== "doc" || !page.path) continue;
|
|
15228
15228
|
const parent = page.path.split("/").slice(0, -1).join("/");
|
|
15229
|
-
if (parent)
|
|
15229
|
+
if (parent) set2.add(parent);
|
|
15230
15230
|
}
|
|
15231
|
-
return [...
|
|
15231
|
+
return [...set2].sort();
|
|
15232
15232
|
}, [entries2]);
|
|
15233
15233
|
if (draft) {
|
|
15234
15234
|
return /* @__PURE__ */ jsx(
|
|
@@ -15237,11 +15237,11 @@ function NotebookPanel() {
|
|
|
15237
15237
|
draft,
|
|
15238
15238
|
preview,
|
|
15239
15239
|
folders,
|
|
15240
|
-
onChange:
|
|
15240
|
+
onChange: schedule2,
|
|
15241
15241
|
onTogglePreview: () => setPreview((p) => !p),
|
|
15242
15242
|
onBack: () => void closeEditor(),
|
|
15243
15243
|
onDelete: async () => {
|
|
15244
|
-
if (
|
|
15244
|
+
if (timer2.current) clearTimeout(timer2.current);
|
|
15245
15245
|
if (draft.id) await remove({ id: draft.id });
|
|
15246
15246
|
setDraft(null);
|
|
15247
15247
|
}
|
|
@@ -16067,10 +16067,10 @@ function UnitMembersTab({ item }) {
|
|
|
16067
16067
|
] })
|
|
16068
16068
|
] });
|
|
16069
16069
|
}
|
|
16070
|
-
var useUnitPanel = create((
|
|
16070
|
+
var useUnitPanel = create((set2) => ({
|
|
16071
16071
|
unitId: null,
|
|
16072
|
-
openUnit: (id) =>
|
|
16073
|
-
close: () =>
|
|
16072
|
+
openUnit: (id) => set2({ unitId: id }),
|
|
16073
|
+
close: () => set2({ unitId: null })
|
|
16074
16074
|
}));
|
|
16075
16075
|
function UnitRailPage() {
|
|
16076
16076
|
const unitId = useUnitPanel((s) => s.unitId);
|
|
@@ -16124,10 +16124,10 @@ function UnitRailPage() {
|
|
|
16124
16124
|
] }) });
|
|
16125
16125
|
}
|
|
16126
16126
|
var NO_EXTRA_ROLE2 = "__none__";
|
|
16127
|
-
var useMemberAccessPanel = create((
|
|
16127
|
+
var useMemberAccessPanel = create((set2) => ({
|
|
16128
16128
|
member: null,
|
|
16129
|
-
openMember: (member) =>
|
|
16130
|
-
close: () =>
|
|
16129
|
+
openMember: (member) => set2({ member }),
|
|
16130
|
+
close: () => set2({ member: null })
|
|
16131
16131
|
}));
|
|
16132
16132
|
function MemberAccessRailPage() {
|
|
16133
16133
|
const member = useMemberAccessPanel((s) => s.member);
|
|
@@ -16821,13 +16821,13 @@ function createThemeStore() {
|
|
|
16821
16821
|
if (typeof window !== "undefined" && window[STORE_KEY]) {
|
|
16822
16822
|
return window[STORE_KEY];
|
|
16823
16823
|
}
|
|
16824
|
-
const store = create((
|
|
16824
|
+
const store = create((set2, get) => ({
|
|
16825
16825
|
mode: getSavedMode(),
|
|
16826
16826
|
resolvedMode: "light",
|
|
16827
16827
|
overrides: null,
|
|
16828
16828
|
setMode: (mode) => {
|
|
16829
16829
|
const resolved = resolveMode(mode);
|
|
16830
|
-
|
|
16830
|
+
set2({ mode, resolvedMode: resolved });
|
|
16831
16831
|
if (typeof window !== "undefined") {
|
|
16832
16832
|
localStorage.setItem(STORAGE_KEY2, mode);
|
|
16833
16833
|
}
|
|
@@ -16846,7 +16846,7 @@ function createThemeStore() {
|
|
|
16846
16846
|
}
|
|
16847
16847
|
},
|
|
16848
16848
|
setOverrides: (overrides) => {
|
|
16849
|
-
|
|
16849
|
+
set2({ overrides });
|
|
16850
16850
|
const { resolvedMode } = get();
|
|
16851
16851
|
const baseTheme = resolvedMode === "dark" ? darkTheme : lightTheme;
|
|
16852
16852
|
const theme = buildTheme(baseTheme, overrides);
|
|
@@ -16912,46 +16912,46 @@ async function startImpersonation(input) {
|
|
|
16912
16912
|
reloadTo("#/");
|
|
16913
16913
|
}
|
|
16914
16914
|
async function stopImpersonation() {
|
|
16915
|
-
const
|
|
16916
|
-
if (!
|
|
16915
|
+
const state2 = readImpersonation();
|
|
16916
|
+
if (!state2) return;
|
|
16917
16917
|
const supabase = getFayzSupabaseClient();
|
|
16918
16918
|
try {
|
|
16919
16919
|
await supabase.auth.signOut({ scope: "local" });
|
|
16920
16920
|
} catch {
|
|
16921
16921
|
}
|
|
16922
16922
|
writeImpersonation(null);
|
|
16923
|
-
const { error } = await supabase.auth.setSession(
|
|
16924
|
-
markWorkspaceSwitch(
|
|
16925
|
-
reloadTo(error ? "#/login" :
|
|
16923
|
+
const { error } = await supabase.auth.setSession(state2.origin);
|
|
16924
|
+
markWorkspaceSwitch(state2.tenantId);
|
|
16925
|
+
reloadTo(error ? "#/login" : state2.returnTo ?? "#/settings/team");
|
|
16926
16926
|
}
|
|
16927
16927
|
function minutesLeft(expiresAt) {
|
|
16928
16928
|
return Math.max(0, Math.ceil((expiresAt - Date.now()) / 6e4));
|
|
16929
16929
|
}
|
|
16930
16930
|
function ImpersonationBanner() {
|
|
16931
16931
|
const { t } = useTranslation$1();
|
|
16932
|
-
const [
|
|
16933
|
-
const [left, setLeft] = React142__default.useState(() =>
|
|
16932
|
+
const [state2] = React142__default.useState(readImpersonation);
|
|
16933
|
+
const [left, setLeft] = React142__default.useState(() => state2 ? minutesLeft(state2.expiresAt) : 0);
|
|
16934
16934
|
const [leaving, setLeaving] = React142__default.useState(false);
|
|
16935
16935
|
const leave = React142__default.useCallback(() => {
|
|
16936
16936
|
setLeaving(true);
|
|
16937
16937
|
void stopImpersonation();
|
|
16938
16938
|
}, []);
|
|
16939
16939
|
React142__default.useEffect(() => {
|
|
16940
|
-
if (!
|
|
16940
|
+
if (!state2) return;
|
|
16941
16941
|
document.documentElement.classList.add("fz-has-top-strip");
|
|
16942
|
-
const
|
|
16943
|
-
const next = minutesLeft(
|
|
16942
|
+
const timer2 = window.setInterval(() => {
|
|
16943
|
+
const next = minutesLeft(state2.expiresAt);
|
|
16944
16944
|
setLeft(next);
|
|
16945
16945
|
if (next === 0) leave();
|
|
16946
16946
|
}, 15e3);
|
|
16947
|
-
if (minutesLeft(
|
|
16947
|
+
if (minutesLeft(state2.expiresAt) === 0) leave();
|
|
16948
16948
|
return () => {
|
|
16949
|
-
window.clearInterval(
|
|
16949
|
+
window.clearInterval(timer2);
|
|
16950
16950
|
document.documentElement.classList.remove("fz-has-top-strip");
|
|
16951
16951
|
};
|
|
16952
|
-
}, [
|
|
16953
|
-
if (!
|
|
16954
|
-
const who =
|
|
16952
|
+
}, [state2, leave]);
|
|
16953
|
+
if (!state2) return null;
|
|
16954
|
+
const who = state2.target.role ? `${state2.target.name} (${state2.target.role})` : state2.target.name;
|
|
16955
16955
|
return /* @__PURE__ */ jsxs(
|
|
16956
16956
|
"div",
|
|
16957
16957
|
{
|
|
@@ -17199,7 +17199,7 @@ function PublicSurveyPage({ token, appName }) {
|
|
|
17199
17199
|
}
|
|
17200
17200
|
setSent(data?.thank_you_message ?? "");
|
|
17201
17201
|
}
|
|
17202
|
-
function
|
|
17202
|
+
function set2(qid, patch) {
|
|
17203
17203
|
setDraft((prev) => ({ ...prev, [qid]: { ...prev[qid], ...patch } }));
|
|
17204
17204
|
}
|
|
17205
17205
|
return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-muted/30 px-4 py-8", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-lg space-y-4", children: [
|
|
@@ -17228,12 +17228,12 @@ function PublicSurveyPage({ token, appName }) {
|
|
|
17228
17228
|
q.text,
|
|
17229
17229
|
q.required && /* @__PURE__ */ jsx("span", { className: "ml-1 text-destructive", "aria-hidden": "true", children: "*" })
|
|
17230
17230
|
] }),
|
|
17231
|
-
/* @__PURE__ */ jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsx(Scale, { type: q.question_type, value: draft[q.id]?.rating, onPick: (rating) =>
|
|
17231
|
+
/* @__PURE__ */ jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsx(Scale, { type: q.question_type, value: draft[q.id]?.rating, onPick: (rating) => set2(q.id, { rating }) }) }),
|
|
17232
17232
|
q.allow_comment !== "none" && /* @__PURE__ */ jsx(
|
|
17233
17233
|
Textarea,
|
|
17234
17234
|
{
|
|
17235
17235
|
value: draft[q.id]?.comment ?? "",
|
|
17236
|
-
onChange: (e) =>
|
|
17236
|
+
onChange: (e) => set2(q.id, { comment: e.target.value }),
|
|
17237
17237
|
placeholder: q.allow_comment === "required" ? "Conte o que aconteceu (obrigat\xF3rio)" : "Quer contar mais? (opcional)",
|
|
17238
17238
|
rows: 2,
|
|
17239
17239
|
wrapperClassName: "mt-3",
|
|
@@ -17601,9 +17601,9 @@ function deriveBottomNav(navigation, config, opts = {}) {
|
|
|
17601
17601
|
if (Array.isArray(config) && config.length > 0 && typeof config[0] !== "string") {
|
|
17602
17602
|
return config;
|
|
17603
17603
|
}
|
|
17604
|
-
const
|
|
17605
|
-
const byRoute = new Map(
|
|
17606
|
-
const picked = Array.isArray(config) ? config.map((r) => byRoute.get(r)).filter((n) => !!n) :
|
|
17604
|
+
const reachable2 = navigation.filter((n) => n.route);
|
|
17605
|
+
const byRoute = new Map(reachable2.map((n) => [n.route, n]));
|
|
17606
|
+
const picked = Array.isArray(config) ? config.map((r) => byRoute.get(r)).filter((n) => !!n) : reachable2.slice(0, DESTINATION_SLOTS);
|
|
17607
17607
|
const items = picked.slice(0, DESTINATION_SLOTS).map((n) => ({
|
|
17608
17608
|
kind: "route",
|
|
17609
17609
|
// Nav labels are written for a rail that is 208px wide; a tab is a fifth of
|
|
@@ -17636,13 +17636,13 @@ function isNavWaiting(input) {
|
|
|
17636
17636
|
if (input.activeTenantId && !input.profileKnown) return true;
|
|
17637
17637
|
return !input.configReady;
|
|
17638
17638
|
}
|
|
17639
|
-
var useUnitSwitchingStore = create((
|
|
17639
|
+
var useUnitSwitchingStore = create((set2) => ({
|
|
17640
17640
|
target: null,
|
|
17641
17641
|
begin: (target) => {
|
|
17642
17642
|
useUnitStore.getState().setActive(target.unitId, "manual");
|
|
17643
|
-
|
|
17643
|
+
set2({ target });
|
|
17644
17644
|
},
|
|
17645
|
-
cancel: () =>
|
|
17645
|
+
cancel: () => set2({ target: null })
|
|
17646
17646
|
}));
|
|
17647
17647
|
var HOLD_MS = 900;
|
|
17648
17648
|
function UnitSwitching({ unitName, isAll, onDone }) {
|
|
@@ -17692,9 +17692,9 @@ function UnitSwitchingHost() {
|
|
|
17692
17692
|
}
|
|
17693
17693
|
);
|
|
17694
17694
|
}
|
|
17695
|
-
var useUnitPickerStore = create((
|
|
17695
|
+
var useUnitPickerStore = create((set2) => ({
|
|
17696
17696
|
open: false,
|
|
17697
|
-
setOpen: (open) =>
|
|
17697
|
+
setOpen: (open) => set2({ open })
|
|
17698
17698
|
}));
|
|
17699
17699
|
function openUnitPicker() {
|
|
17700
17700
|
useUnitPickerStore.getState().setOpen(true);
|
|
@@ -17710,18 +17710,18 @@ function UnitPickerDialog() {
|
|
|
17710
17710
|
const myUnitIds = useUnitStore((s) => s.myUnitIds);
|
|
17711
17711
|
const activeUnitId = useUnitStore((s) => s.activeUnitId);
|
|
17712
17712
|
const beginSwitch = useUnitSwitchingStore((s) => s.begin);
|
|
17713
|
-
const
|
|
17713
|
+
const reachable2 = React142.useMemo(
|
|
17714
17714
|
() => myUnitIds.length > 0 ? myUnitIds : units.filter((u) => u.kind !== "region").map((u) => u.id),
|
|
17715
17715
|
[myUnitIds, units]
|
|
17716
17716
|
);
|
|
17717
17717
|
const groups = React142.useMemo(() => {
|
|
17718
17718
|
const out = [];
|
|
17719
|
-
if (
|
|
17719
|
+
if (reachable2.length > 1) {
|
|
17720
17720
|
out.push({ id: "_all", options: [{ id: ALL_UNITS, label: "Todas as unidades" }] });
|
|
17721
17721
|
}
|
|
17722
17722
|
const collect = (nodes, bucket) => {
|
|
17723
17723
|
for (const n of nodes) {
|
|
17724
|
-
if (n.kind !== "region" &&
|
|
17724
|
+
if (n.kind !== "region" && reachable2.includes(n.id)) {
|
|
17725
17725
|
bucket.push({
|
|
17726
17726
|
id: n.id,
|
|
17727
17727
|
label: n.name,
|
|
@@ -17745,7 +17745,7 @@ function UnitPickerDialog() {
|
|
|
17745
17745
|
}
|
|
17746
17746
|
}
|
|
17747
17747
|
return out;
|
|
17748
|
-
}, [tree,
|
|
17748
|
+
}, [tree, reachable2]);
|
|
17749
17749
|
if (!unitMode) return null;
|
|
17750
17750
|
return /* @__PURE__ */ jsx(
|
|
17751
17751
|
PickerDialog,
|
|
@@ -18220,10 +18220,10 @@ function WidgetSlot({
|
|
|
18220
18220
|
);
|
|
18221
18221
|
}) });
|
|
18222
18222
|
}
|
|
18223
|
-
var useNavContributionsStore = create((
|
|
18223
|
+
var useNavContributionsStore = create((set2) => ({
|
|
18224
18224
|
contributions: {},
|
|
18225
|
-
setContribution: (id, entries2) =>
|
|
18226
|
-
clearContribution: (id) =>
|
|
18225
|
+
setContribution: (id, entries2) => set2((s) => ({ contributions: { ...s.contributions, [id]: entries2 } })),
|
|
18226
|
+
clearContribution: (id) => set2((s) => {
|
|
18227
18227
|
if (!(id in s.contributions)) return s;
|
|
18228
18228
|
const next = { ...s.contributions };
|
|
18229
18229
|
delete next[id];
|
|
@@ -18273,27 +18273,27 @@ function normalize(apps, currentAppId, overrides = resolveAppUrlOverrides()) {
|
|
|
18273
18273
|
tenantId: typeof app.tenant_id === "string" ? app.tenant_id : null
|
|
18274
18274
|
}));
|
|
18275
18275
|
}
|
|
18276
|
-
var useAppDirectoryStore = create((
|
|
18276
|
+
var useAppDirectoryStore = create((set2, get) => ({
|
|
18277
18277
|
apps: null,
|
|
18278
18278
|
status: "idle",
|
|
18279
18279
|
tenantId: null,
|
|
18280
18280
|
load: async (tenantId2, currentAppId, deps) => {
|
|
18281
|
-
const
|
|
18282
|
-
if (
|
|
18281
|
+
const state2 = get();
|
|
18282
|
+
if (state2.status !== "idle" && state2.tenantId === tenantId2) return;
|
|
18283
18283
|
const client3 = deps?.client === void 0 ? getFayzSupabaseClientOptional() : deps.client;
|
|
18284
18284
|
if (!client3) {
|
|
18285
|
-
|
|
18285
|
+
set2({ status: "done", tenantId: tenantId2 });
|
|
18286
18286
|
return;
|
|
18287
18287
|
}
|
|
18288
|
-
|
|
18288
|
+
set2({ status: "loading", tenantId: tenantId2 });
|
|
18289
18289
|
try {
|
|
18290
18290
|
const config = await fetchAppConfig(client3, { tenantId: tenantId2 });
|
|
18291
|
-
|
|
18291
|
+
set2({ apps: normalize(config.apps, currentAppId), status: "done", tenantId: tenantId2 });
|
|
18292
18292
|
} catch {
|
|
18293
|
-
|
|
18293
|
+
set2({ status: "done", tenantId: tenantId2 });
|
|
18294
18294
|
}
|
|
18295
18295
|
},
|
|
18296
|
-
reset: () =>
|
|
18296
|
+
reset: () => set2({ apps: null, status: "idle", tenantId: null })
|
|
18297
18297
|
}));
|
|
18298
18298
|
function resetAppDirectory() {
|
|
18299
18299
|
useAppDirectoryStore.getState().reset();
|
|
@@ -18771,17 +18771,17 @@ var SUPPORTED_LOCALES = [
|
|
|
18771
18771
|
{ code: "en", label: "English", flag: "\u{1F1FA}\u{1F1F8}" },
|
|
18772
18772
|
{ code: "pt-BR", label: "Portugu\xEAs (BR)", flag: "\u{1F1E7}\u{1F1F7}" }
|
|
18773
18773
|
];
|
|
18774
|
-
var useContextualNavStore = create((
|
|
18774
|
+
var useContextualNavStore = create((set2) => ({
|
|
18775
18775
|
nav: null,
|
|
18776
|
-
setNav: (nav) =>
|
|
18776
|
+
setNav: (nav) => set2({ nav }),
|
|
18777
18777
|
clearNav: (base) => (
|
|
18778
18778
|
// Only the owner clears. Two modules mounting/unmounting across a route
|
|
18779
18779
|
// change can interleave, and a blind reset would wipe the rail the NEW one
|
|
18780
18780
|
// just registered.
|
|
18781
|
-
|
|
18781
|
+
set2((s) => s.nav?.base === base ? { nav: null } : s)
|
|
18782
18782
|
),
|
|
18783
18783
|
railAvailable: null,
|
|
18784
|
-
setRailAvailable: (railAvailable) =>
|
|
18784
|
+
setRailAvailable: (railAvailable) => set2((s) => s.railAvailable === railAvailable ? s : { railAvailable })
|
|
18785
18785
|
}));
|
|
18786
18786
|
function useShellRailAvailable() {
|
|
18787
18787
|
return useContextualNavStore((s) => s.railAvailable);
|
|
@@ -18807,16 +18807,16 @@ function distanceKm(aLat, aLon, bLat, bLon) {
|
|
|
18807
18807
|
const h = Math.sin(dLat / 2) ** 2 + Math.cos(toRad(aLat)) * Math.cos(toRad(bLat)) * Math.sin(dLon / 2) ** 2;
|
|
18808
18808
|
return 2 * R * Math.asin(Math.min(1, Math.sqrt(h)));
|
|
18809
18809
|
}
|
|
18810
|
-
function canOfferNearest(units,
|
|
18810
|
+
function canOfferNearest(units, reachable2) {
|
|
18811
18811
|
if (typeof navigator === "undefined" || !navigator.geolocation) return false;
|
|
18812
18812
|
const withCoords = units.filter(
|
|
18813
|
-
(u) =>
|
|
18813
|
+
(u) => reachable2.includes(u.id) && u.latitude != null && u.longitude != null
|
|
18814
18814
|
);
|
|
18815
18815
|
return withCoords.length > 1;
|
|
18816
18816
|
}
|
|
18817
|
-
async function findNearestUnit(units,
|
|
18817
|
+
async function findNearestUnit(units, reachable2) {
|
|
18818
18818
|
const candidates = units.filter(
|
|
18819
|
-
(u) =>
|
|
18819
|
+
(u) => reachable2.includes(u.id) && u.latitude != null && u.longitude != null
|
|
18820
18820
|
);
|
|
18821
18821
|
if (candidates.length === 0) return void 0;
|
|
18822
18822
|
if (typeof navigator === "undefined" || !navigator.geolocation) return void 0;
|
|
@@ -18827,15 +18827,15 @@ async function findNearestUnit(units, reachable) {
|
|
|
18827
18827
|
settled = true;
|
|
18828
18828
|
resolve(p);
|
|
18829
18829
|
};
|
|
18830
|
-
const
|
|
18830
|
+
const timer2 = setTimeout(() => done(void 0), TIMEOUT_MS2);
|
|
18831
18831
|
try {
|
|
18832
18832
|
navigator.geolocation.getCurrentPosition(
|
|
18833
18833
|
(p) => {
|
|
18834
|
-
clearTimeout(
|
|
18834
|
+
clearTimeout(timer2);
|
|
18835
18835
|
done(p);
|
|
18836
18836
|
},
|
|
18837
18837
|
() => {
|
|
18838
|
-
clearTimeout(
|
|
18838
|
+
clearTimeout(timer2);
|
|
18839
18839
|
done(void 0);
|
|
18840
18840
|
},
|
|
18841
18841
|
// Precisão grosseira de propósito: a pergunta é em qual bairro, e o modo
|
|
@@ -18843,7 +18843,7 @@ async function findNearestUnit(units, reachable) {
|
|
|
18843
18843
|
{ enableHighAccuracy: false, timeout: TIMEOUT_MS2, maximumAge: 5 * 60 * 1e3 }
|
|
18844
18844
|
);
|
|
18845
18845
|
} catch {
|
|
18846
|
-
clearTimeout(
|
|
18846
|
+
clearTimeout(timer2);
|
|
18847
18847
|
done(void 0);
|
|
18848
18848
|
}
|
|
18849
18849
|
});
|
|
@@ -18888,9 +18888,9 @@ function RootLevel({ onPick }) {
|
|
|
18888
18888
|
const units = useUnitStore((s) => s.units);
|
|
18889
18889
|
const myUnitIds = useUnitStore((s) => s.myUnitIds);
|
|
18890
18890
|
const activeUnitId = useUnitStore((s) => s.activeUnitId);
|
|
18891
|
-
const
|
|
18891
|
+
const reachable2 = myUnitIds.length > 0 ? myUnitIds : units.filter((u) => u.kind !== "region").map((u) => u.id);
|
|
18892
18892
|
const current3 = activeUnitId ? byId[activeUnitId] : void 0;
|
|
18893
|
-
const unitLabel = current3?.name ?? (
|
|
18893
|
+
const unitLabel = current3?.name ?? (reachable2.length > 1 ? "Todas as unidades" : byId[reachable2[0]]?.name ?? "");
|
|
18894
18894
|
const workspaceCount = tenant?.userOrgs?.length ?? 0;
|
|
18895
18895
|
return /* @__PURE__ */ jsxs(SheetCard, { children: [
|
|
18896
18896
|
/* @__PURE__ */ jsx(
|
|
@@ -18905,13 +18905,13 @@ function RootLevel({ onPick }) {
|
|
|
18905
18905
|
title: org?.name
|
|
18906
18906
|
}
|
|
18907
18907
|
),
|
|
18908
|
-
unitMode &&
|
|
18908
|
+
unitMode && reachable2.length > 1 && /* @__PURE__ */ jsx(
|
|
18909
18909
|
SheetRow,
|
|
18910
18910
|
{
|
|
18911
18911
|
icon: current3 ? /* @__PURE__ */ jsx(Building2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Layers, { className: "h-4 w-4" }),
|
|
18912
18912
|
label: unitLabel || "Todas as unidades",
|
|
18913
18913
|
sublabel: "Unidade",
|
|
18914
|
-
hint:
|
|
18914
|
+
hint: reachable2.length,
|
|
18915
18915
|
chevron: true,
|
|
18916
18916
|
onClick: () => onPick("units"),
|
|
18917
18917
|
title: unitLabel
|
|
@@ -18997,7 +18997,7 @@ function UnitLevel() {
|
|
|
18997
18997
|
const activeUnitId = useUnitStore((s) => s.activeUnitId);
|
|
18998
18998
|
const needsChoice = useUnitStore((s) => s.needsChoice);
|
|
18999
18999
|
const beginSwitch = useUnitSwitchingStore((s) => s.begin);
|
|
19000
|
-
const
|
|
19000
|
+
const reachable2 = myUnitIds.length > 0 ? myUnitIds : units.filter((u) => u.kind !== "region").map((u) => u.id);
|
|
19001
19001
|
const pick2 = (unitId, unitName) => {
|
|
19002
19002
|
if (unitId === (activeUnitId ?? void 0)) {
|
|
19003
19003
|
closeSheet();
|
|
@@ -19006,9 +19006,9 @@ function UnitLevel() {
|
|
|
19006
19006
|
beginSwitch({ unitId, unitName });
|
|
19007
19007
|
};
|
|
19008
19008
|
const term = query.trim().toLowerCase();
|
|
19009
|
-
const hits = term ? units.filter((u) => u.kind !== "region" &&
|
|
19009
|
+
const hits = term ? units.filter((u) => u.kind !== "region" && reachable2.includes(u.id) && u.name.toLowerCase().includes(term)) : [];
|
|
19010
19010
|
const leaf = (node) => {
|
|
19011
|
-
if (!
|
|
19011
|
+
if (!reachable2.includes(node.id)) return null;
|
|
19012
19012
|
return /* @__PURE__ */ jsx(
|
|
19013
19013
|
SheetRow,
|
|
19014
19014
|
{
|
|
@@ -19023,7 +19023,7 @@ function UnitLevel() {
|
|
|
19023
19023
|
};
|
|
19024
19024
|
const group = (node) => {
|
|
19025
19025
|
if (node.kind !== "region") return null;
|
|
19026
|
-
const leaves = node.children.filter((c) => c.kind !== "region" &&
|
|
19026
|
+
const leaves = node.children.filter((c) => c.kind !== "region" && reachable2.includes(c.id));
|
|
19027
19027
|
const regions = node.children.filter((c) => c.kind === "region");
|
|
19028
19028
|
if (leaves.length === 0 && regions.length === 0) return null;
|
|
19029
19029
|
return /* @__PURE__ */ jsxs(React142.Fragment, { children: [
|
|
@@ -19033,7 +19033,7 @@ function UnitLevel() {
|
|
|
19033
19033
|
] }, node.id);
|
|
19034
19034
|
};
|
|
19035
19035
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19036
|
-
|
|
19036
|
+
reachable2.length > UNIT_SEARCH_THRESHOLD && /* @__PURE__ */ jsxs("div", { className: "relative mb-3", children: [
|
|
19037
19037
|
/* @__PURE__ */ jsx(Search, { "aria-hidden": true, className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
19038
19038
|
/* @__PURE__ */ jsx(
|
|
19039
19039
|
Input,
|
|
@@ -19058,7 +19058,7 @@ function UnitLevel() {
|
|
|
19058
19058
|
u.id
|
|
19059
19059
|
)) }) : /* @__PURE__ */ jsx("p", { className: "py-8 text-center text-sm text-muted-foreground", children: "Nenhuma unidade com esse nome." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19060
19060
|
/* @__PURE__ */ jsxs(SheetCard, { children: [
|
|
19061
|
-
|
|
19061
|
+
reachable2.length > 1 && /* @__PURE__ */ jsx(
|
|
19062
19062
|
SheetRow,
|
|
19063
19063
|
{
|
|
19064
19064
|
icon: /* @__PURE__ */ jsx(Layers, { className: "h-4 w-4" }),
|
|
@@ -19068,7 +19068,7 @@ function UnitLevel() {
|
|
|
19068
19068
|
onClick: () => pick2(void 0, "Todas as unidades")
|
|
19069
19069
|
}
|
|
19070
19070
|
),
|
|
19071
|
-
needsChoice && canOfferNearest(units,
|
|
19071
|
+
needsChoice && canOfferNearest(units, reachable2) && /* @__PURE__ */ jsx(
|
|
19072
19072
|
SheetRow,
|
|
19073
19073
|
{
|
|
19074
19074
|
icon: locating ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(LocateFixed, { className: "h-4 w-4" }),
|
|
@@ -19076,7 +19076,7 @@ function UnitLevel() {
|
|
|
19076
19076
|
disabled: locating,
|
|
19077
19077
|
onClick: async () => {
|
|
19078
19078
|
setLocating(true);
|
|
19079
|
-
const nearest = await findNearestUnit(units,
|
|
19079
|
+
const nearest = await findNearestUnit(units, reachable2);
|
|
19080
19080
|
setLocating(false);
|
|
19081
19081
|
if (nearest) beginSwitch({ unitId: nearest.unitId, unitName: byId[nearest.unitId]?.name ?? "" });
|
|
19082
19082
|
}
|
|
@@ -19084,7 +19084,7 @@ function UnitLevel() {
|
|
|
19084
19084
|
)
|
|
19085
19085
|
] }),
|
|
19086
19086
|
/* @__PURE__ */ jsx("div", { className: "mt-1", children: (() => {
|
|
19087
|
-
const loose = tree.filter((n) => n.kind !== "region" &&
|
|
19087
|
+
const loose = tree.filter((n) => n.kind !== "region" && reachable2.includes(n.id));
|
|
19088
19088
|
const regions = tree.filter((n) => n.kind === "region");
|
|
19089
19089
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19090
19090
|
loose.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx(SheetCard, { children: loose.map(leaf) }) }),
|
|
@@ -19105,9 +19105,9 @@ function WorkspaceUnitRow({ canCreate = true }) {
|
|
|
19105
19105
|
const myUnitIds = useUnitStore((s) => s.myUnitIds);
|
|
19106
19106
|
const activeUnitId = useUnitStore((s) => s.activeUnitId);
|
|
19107
19107
|
if (!tenant || !org) return null;
|
|
19108
|
-
const
|
|
19108
|
+
const reachable2 = myUnitIds.length > 0 ? myUnitIds : units.filter((u) => u.kind !== "region").map((u) => u.id);
|
|
19109
19109
|
const current3 = activeUnitId ? byId[activeUnitId] : void 0;
|
|
19110
|
-
const unitLabel = unitMode &&
|
|
19110
|
+
const unitLabel = unitMode && reachable2.length ? current3?.name ?? (reachable2.length > 1 ? "Todas as unidades" : byId[reachable2[0]]?.name ?? "") : "";
|
|
19111
19111
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19112
19112
|
/* @__PURE__ */ jsxs(
|
|
19113
19113
|
Button,
|
|
@@ -19211,27 +19211,27 @@ async function clearDefault(keepId) {
|
|
|
19211
19211
|
}
|
|
19212
19212
|
|
|
19213
19213
|
// src/projects/store.ts
|
|
19214
|
-
var useFayzProjectsStore = create((
|
|
19214
|
+
var useFayzProjectsStore = create((set2, get) => ({
|
|
19215
19215
|
projects: [],
|
|
19216
19216
|
loading: false,
|
|
19217
19217
|
loadedFor: null,
|
|
19218
19218
|
load: async (tenantId2) => {
|
|
19219
19219
|
if (!getSupabaseClientOptional()) {
|
|
19220
|
-
|
|
19220
|
+
set2({ projects: [], loading: false, loadedFor: tenantId2 ?? null });
|
|
19221
19221
|
return;
|
|
19222
19222
|
}
|
|
19223
|
-
|
|
19223
|
+
set2({ loading: true });
|
|
19224
19224
|
try {
|
|
19225
19225
|
const projects = await listFayzProjects();
|
|
19226
|
-
|
|
19226
|
+
set2({ projects, loading: false, loadedFor: tenantId2 ?? null });
|
|
19227
19227
|
} catch {
|
|
19228
|
-
|
|
19228
|
+
set2({ projects: [], loading: false, loadedFor: tenantId2 ?? null });
|
|
19229
19229
|
}
|
|
19230
19230
|
},
|
|
19231
19231
|
refresh: async () => {
|
|
19232
19232
|
try {
|
|
19233
19233
|
const projects = await listFayzProjects();
|
|
19234
|
-
|
|
19234
|
+
set2({ projects });
|
|
19235
19235
|
} catch {
|
|
19236
19236
|
}
|
|
19237
19237
|
}
|
|
@@ -19964,18 +19964,18 @@ var initialState2 = {
|
|
|
19964
19964
|
unreadCount: 0,
|
|
19965
19965
|
loading: false
|
|
19966
19966
|
};
|
|
19967
|
-
var useNotificationStore = create((
|
|
19967
|
+
var useNotificationStore = create((set2) => ({
|
|
19968
19968
|
...initialState2,
|
|
19969
|
-
setNotifications: (notifications) =>
|
|
19969
|
+
setNotifications: (notifications) => set2({
|
|
19970
19970
|
notifications,
|
|
19971
19971
|
unreadCount: notifications.filter((n) => !n.read).length
|
|
19972
19972
|
}),
|
|
19973
|
-
addNotification: (notification) =>
|
|
19974
|
-
notifications: [notification, ...
|
|
19975
|
-
unreadCount:
|
|
19973
|
+
addNotification: (notification) => set2((state2) => ({
|
|
19974
|
+
notifications: [notification, ...state2.notifications],
|
|
19975
|
+
unreadCount: state2.unreadCount + (notification.read ? 0 : 1)
|
|
19976
19976
|
})),
|
|
19977
|
-
markRead: (id) =>
|
|
19978
|
-
const notifications =
|
|
19977
|
+
markRead: (id) => set2((state2) => {
|
|
19978
|
+
const notifications = state2.notifications.map(
|
|
19979
19979
|
(n) => n.id === id ? { ...n, read: true } : n
|
|
19980
19980
|
);
|
|
19981
19981
|
return {
|
|
@@ -19983,12 +19983,12 @@ var useNotificationStore = create((set) => ({
|
|
|
19983
19983
|
unreadCount: notifications.filter((n) => !n.read).length
|
|
19984
19984
|
};
|
|
19985
19985
|
}),
|
|
19986
|
-
markAllRead: () =>
|
|
19987
|
-
notifications:
|
|
19986
|
+
markAllRead: () => set2((state2) => ({
|
|
19987
|
+
notifications: state2.notifications.map((n) => ({ ...n, read: true })),
|
|
19988
19988
|
unreadCount: 0
|
|
19989
19989
|
})),
|
|
19990
|
-
setLoading: (loading) =>
|
|
19991
|
-
reset: () =>
|
|
19990
|
+
setLoading: (loading) => set2({ loading }),
|
|
19991
|
+
reset: () => set2(initialState2)
|
|
19992
19992
|
}));
|
|
19993
19993
|
|
|
19994
19994
|
// src/hooks/useNotifications.ts
|
|
@@ -20108,20 +20108,20 @@ function subscribeBell(tenantId2, listener) {
|
|
|
20108
20108
|
};
|
|
20109
20109
|
let entry = byTenant.get(tenantId2);
|
|
20110
20110
|
if (!entry) {
|
|
20111
|
-
const
|
|
20111
|
+
const listeners11 = /* @__PURE__ */ new Set();
|
|
20112
20112
|
const channel = supabase.channel(bellTopic(tenantId2)).on("broadcast", { event: "notification" }, (msg) => {
|
|
20113
20113
|
const ring = {
|
|
20114
20114
|
type: typeof msg?.payload?.type === "string" ? msg.payload.type : void 0,
|
|
20115
20115
|
subjectId: typeof msg?.payload?.subjectId === "string" ? msg.payload.subjectId : void 0
|
|
20116
20116
|
};
|
|
20117
|
-
for (const fn of [...
|
|
20117
|
+
for (const fn of [...listeners11]) {
|
|
20118
20118
|
try {
|
|
20119
20119
|
fn(ring);
|
|
20120
20120
|
} catch {
|
|
20121
20121
|
}
|
|
20122
20122
|
}
|
|
20123
20123
|
}).subscribe();
|
|
20124
|
-
entry = { channel, listeners:
|
|
20124
|
+
entry = { channel, listeners: listeners11 };
|
|
20125
20125
|
byTenant.set(tenantId2, entry);
|
|
20126
20126
|
}
|
|
20127
20127
|
entry.listeners.add(listener);
|
|
@@ -20408,7 +20408,7 @@ function BrandAgentSurface() {
|
|
|
20408
20408
|
return null;
|
|
20409
20409
|
}
|
|
20410
20410
|
function ConnectConsentPage({ appName, logo }) {
|
|
20411
|
-
const [
|
|
20411
|
+
const [state2, setState] = React142__default.useState({ status: "loading" });
|
|
20412
20412
|
const [tenantId2, setTenantId] = React142__default.useState("");
|
|
20413
20413
|
const request = React142__default.useMemo(
|
|
20414
20414
|
() => new URLSearchParams(window.location.search).get("request") ?? "",
|
|
@@ -20468,7 +20468,7 @@ function ConnectConsentPage({ appName, logo }) {
|
|
|
20468
20468
|
}, [request, authorizedFetch]);
|
|
20469
20469
|
async function approve() {
|
|
20470
20470
|
if (!tenantId2) return;
|
|
20471
|
-
const previous =
|
|
20471
|
+
const previous = state2;
|
|
20472
20472
|
setState({ status: "approving" });
|
|
20473
20473
|
try {
|
|
20474
20474
|
const response = await authorizedFetch("/consent", {
|
|
@@ -20490,10 +20490,10 @@ function ConnectConsentPage({ appName, logo }) {
|
|
|
20490
20490
|
window.history.length > 1 ? window.history.back() : window.location.href = "/";
|
|
20491
20491
|
}
|
|
20492
20492
|
return /* @__PURE__ */ jsx("div", { className: "flex min-h-screen items-center justify-center bg-sidebar p-4", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full max-w-md rounded-2xl border border-border/50 bg-card p-8 shadow-2xl", children: [
|
|
20493
|
-
|
|
20494
|
-
|
|
20493
|
+
state2.status === "loading" && /* @__PURE__ */ jsx(ConsentSkeleton, {}),
|
|
20494
|
+
state2.status === "error" && /* @__PURE__ */ jsxs("div", { className: "py-6 text-center", children: [
|
|
20495
20495
|
/* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold text-foreground", children: "N\xE3o deu para autorizar" }),
|
|
20496
|
-
/* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-muted-foreground", children:
|
|
20496
|
+
/* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: state2.message }),
|
|
20497
20497
|
/* @__PURE__ */ jsx(
|
|
20498
20498
|
Button,
|
|
20499
20499
|
{
|
|
@@ -20505,17 +20505,17 @@ function ConnectConsentPage({ appName, logo }) {
|
|
|
20505
20505
|
}
|
|
20506
20506
|
)
|
|
20507
20507
|
] }),
|
|
20508
|
-
(
|
|
20508
|
+
(state2.status === "ready" || state2.status === "approving") && /* @__PURE__ */ jsx(
|
|
20509
20509
|
ConsentBody,
|
|
20510
20510
|
{
|
|
20511
|
-
payload:
|
|
20511
|
+
payload: state2.status === "ready" ? state2.payload : void 0,
|
|
20512
20512
|
product,
|
|
20513
20513
|
logo,
|
|
20514
20514
|
tenantId: tenantId2,
|
|
20515
20515
|
onTenantChange: setTenantId,
|
|
20516
20516
|
onApprove: approve,
|
|
20517
20517
|
onCancel: cancel,
|
|
20518
|
-
busy:
|
|
20518
|
+
busy: state2.status === "approving"
|
|
20519
20519
|
}
|
|
20520
20520
|
)
|
|
20521
20521
|
] }) });
|
|
@@ -21493,7 +21493,7 @@ function useSettingKeys(keys, unitId = null) {
|
|
|
21493
21493
|
).catch((e) => setError(message(e))).finally(() => setSaving(false));
|
|
21494
21494
|
}, DEBOUNCE_MS2);
|
|
21495
21495
|
}, [client3, unitId]);
|
|
21496
|
-
const
|
|
21496
|
+
const set2 = React142.useCallback((key, value) => {
|
|
21497
21497
|
setValues((cur) => ({ ...cur, [key]: value }));
|
|
21498
21498
|
if (!unitId) setHouse((cur) => ({ ...cur, [key]: value }));
|
|
21499
21499
|
announce({ key, value, unitId });
|
|
@@ -21508,7 +21508,7 @@ function useSettingKeys(keys, unitId = null) {
|
|
|
21508
21508
|
(key) => !!unitId && !same(values[key], house[key]),
|
|
21509
21509
|
[unitId, values, house]
|
|
21510
21510
|
);
|
|
21511
|
-
return { values, house, isOverridden, set, reset, loading, saving, error, loadError, supported };
|
|
21511
|
+
return { values, house, isOverridden, set: set2, reset, loading, saving, error, loadError, supported };
|
|
21512
21512
|
}
|
|
21513
21513
|
var CHANNEL_LABEL = { whatsapp: "WhatsApp", email: "E-mail", sms: "SMS", push: "Push", webchat: "Chat" };
|
|
21514
21514
|
function MessageTemplateRow({ label: label3, eventKey, channel = "whatsapp", pending: pending2 }) {
|
|
@@ -21576,7 +21576,7 @@ function useSettingsUnitScope() {
|
|
|
21576
21576
|
}
|
|
21577
21577
|
function UnitScopePicker({ inline = false }) {
|
|
21578
21578
|
const units = useUnitStore((s) => s.units);
|
|
21579
|
-
const { unitId, available, set } = useSettingsUnitScope();
|
|
21579
|
+
const { unitId, available, set: set2 } = useSettingsUnitScope();
|
|
21580
21580
|
const wide = useIsWide();
|
|
21581
21581
|
if (!available) return null;
|
|
21582
21582
|
const picker = /* @__PURE__ */ jsx(
|
|
@@ -21587,7 +21587,7 @@ function UnitScopePicker({ inline = false }) {
|
|
|
21587
21587
|
className: wide && !inline ? "w-56" : "h-11 w-full",
|
|
21588
21588
|
allLabel: tl("Whole network (default)", "Toda a rede (padr\xE3o)"),
|
|
21589
21589
|
value: unitId ?? void 0,
|
|
21590
|
-
onChange: (v) =>
|
|
21590
|
+
onChange: (v) => set2(v ?? null),
|
|
21591
21591
|
options: units.map((u) => ({ value: u.id, label: u.name }))
|
|
21592
21592
|
}
|
|
21593
21593
|
);
|
|
@@ -22174,10 +22174,10 @@ function MyWorkspaceCard() {
|
|
|
22174
22174
|
] })
|
|
22175
22175
|
] });
|
|
22176
22176
|
}
|
|
22177
|
-
var useStore = create((
|
|
22177
|
+
var useStore = create((set2) => ({
|
|
22178
22178
|
byZone: {},
|
|
22179
|
-
register: (zone, action) =>
|
|
22180
|
-
unregister: (zone, id) =>
|
|
22179
|
+
register: (zone, action) => set2((s) => ({ byZone: { ...s.byZone, [zone]: { ...s.byZone[zone] ?? {}, [action.id]: action } } })),
|
|
22180
|
+
unregister: (zone, id) => set2((s) => {
|
|
22181
22181
|
const inZone = { ...s.byZone[zone] ?? {} };
|
|
22182
22182
|
delete inZone[id];
|
|
22183
22183
|
return { byZone: { ...s.byZone, [zone]: inZone } };
|
|
@@ -22475,7 +22475,7 @@ function AddressFormModal({
|
|
|
22475
22475
|
setGeocodeState(editing && editing.latitude != null && editing.longitude != null ? "resolved" : "idle");
|
|
22476
22476
|
lastLookup.current = editing ? formatPostalCode(editing.postal_code) : "";
|
|
22477
22477
|
}, [open, editing]);
|
|
22478
|
-
const
|
|
22478
|
+
const set2 = (key, value) => {
|
|
22479
22479
|
const locatesAddress = ["postal_code", "street", "number", "district", "city", "state"].includes(key);
|
|
22480
22480
|
if (locatesAddress) setGeocodeState("idle");
|
|
22481
22481
|
setForm((prev) => ({
|
|
@@ -22516,7 +22516,7 @@ function AddressFormModal({
|
|
|
22516
22516
|
}, []);
|
|
22517
22517
|
const onPostalChange = (raw) => {
|
|
22518
22518
|
const masked = formatPostalCode(raw);
|
|
22519
|
-
|
|
22519
|
+
set2("postal_code", masked);
|
|
22520
22520
|
if (cepState !== "idle") setCepState("idle");
|
|
22521
22521
|
if (isValidPostalCode(masked)) void lookupCep(masked);
|
|
22522
22522
|
else lastLookup.current = "";
|
|
@@ -22633,11 +22633,11 @@ function AddressFormModal({
|
|
|
22633
22633
|
{
|
|
22634
22634
|
id: "address-label",
|
|
22635
22635
|
value: form.label,
|
|
22636
|
-
onChange: (e) =>
|
|
22636
|
+
onChange: (e) => set2("label", e.target.value),
|
|
22637
22637
|
placeholder: t("crud.archetype.addresses.labelPlaceholder")
|
|
22638
22638
|
}
|
|
22639
22639
|
) }),
|
|
22640
|
-
/* @__PURE__ */ jsx(Field2, { id: "kind", span: 1, label: t("crud.archetype.addresses.field.kind"), children: /* @__PURE__ */ jsxs(Select, { value: form.kind, onValueChange: (v) =>
|
|
22640
|
+
/* @__PURE__ */ jsx(Field2, { id: "kind", span: 1, label: t("crud.archetype.addresses.field.kind"), children: /* @__PURE__ */ jsxs(Select, { value: form.kind, onValueChange: (v) => set2("kind", v), children: [
|
|
22641
22641
|
/* @__PURE__ */ jsx(SelectTrigger, { id: "address-kind", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
22642
22642
|
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
22643
22643
|
/* @__PURE__ */ jsx(SelectItem, { value: "both", children: t("crud.archetype.addresses.kind.both") }),
|
|
@@ -22672,25 +22672,25 @@ function AddressFormModal({
|
|
|
22672
22672
|
id: "address-number",
|
|
22673
22673
|
ref: numberRef,
|
|
22674
22674
|
value: form.number,
|
|
22675
|
-
onChange: (e) =>
|
|
22675
|
+
onChange: (e) => set2("number", e.target.value)
|
|
22676
22676
|
}
|
|
22677
22677
|
) }),
|
|
22678
|
-
/* @__PURE__ */ jsx(Field2, { id: "street", span: 2, required: true, label: t("crud.archetype.addresses.field.street"), children: /* @__PURE__ */ jsx(Input, { id: "address-street", value: form.street, onChange: (e) =>
|
|
22679
|
-
/* @__PURE__ */ jsx(Field2, { id: "complement", span: 2, label: t("crud.archetype.addresses.field.complement"), children: /* @__PURE__ */ jsx(Input, { id: "address-complement", value: form.complement, onChange: (e) =>
|
|
22680
|
-
/* @__PURE__ */ jsx(Field2, { id: "district", span: 2, label: t("crud.archetype.addresses.field.district"), children: /* @__PURE__ */ jsx(Input, { id: "address-district", value: form.district, onChange: (e) =>
|
|
22681
|
-
/* @__PURE__ */ jsx(Field2, { id: "city", span: 1, required: true, label: t("crud.archetype.addresses.field.city"), children: /* @__PURE__ */ jsx(Input, { id: "address-city", value: form.city, onChange: (e) =>
|
|
22678
|
+
/* @__PURE__ */ jsx(Field2, { id: "street", span: 2, required: true, label: t("crud.archetype.addresses.field.street"), children: /* @__PURE__ */ jsx(Input, { id: "address-street", value: form.street, onChange: (e) => set2("street", e.target.value) }) }),
|
|
22679
|
+
/* @__PURE__ */ jsx(Field2, { id: "complement", span: 2, label: t("crud.archetype.addresses.field.complement"), children: /* @__PURE__ */ jsx(Input, { id: "address-complement", value: form.complement, onChange: (e) => set2("complement", e.target.value) }) }),
|
|
22680
|
+
/* @__PURE__ */ jsx(Field2, { id: "district", span: 2, label: t("crud.archetype.addresses.field.district"), children: /* @__PURE__ */ jsx(Input, { id: "address-district", value: form.district, onChange: (e) => set2("district", e.target.value) }) }),
|
|
22681
|
+
/* @__PURE__ */ jsx(Field2, { id: "city", span: 1, required: true, label: t("crud.archetype.addresses.field.city"), children: /* @__PURE__ */ jsx(Input, { id: "address-city", value: form.city, onChange: (e) => set2("city", e.target.value) }) }),
|
|
22682
22682
|
/* @__PURE__ */ jsx(Field2, { id: "state", span: 1, label: t("crud.archetype.addresses.field.state"), children: /* @__PURE__ */ jsx(
|
|
22683
22683
|
Input,
|
|
22684
22684
|
{
|
|
22685
22685
|
id: "address-state",
|
|
22686
22686
|
value: form.state,
|
|
22687
|
-
onChange: (e) =>
|
|
22687
|
+
onChange: (e) => set2("state", e.target.value),
|
|
22688
22688
|
maxLength: 2,
|
|
22689
22689
|
placeholder: "UF"
|
|
22690
22690
|
}
|
|
22691
22691
|
) }),
|
|
22692
|
-
/* @__PURE__ */ jsx(Field2, { id: "recipient", span: 1, label: t("crud.archetype.addresses.field.recipient"), children: /* @__PURE__ */ jsx(Input, { id: "address-recipient", value: form.recipient, onChange: (e) =>
|
|
22693
|
-
/* @__PURE__ */ jsx(Field2, { id: "phone", span: 1, label: t("crud.archetype.addresses.field.phone"), children: /* @__PURE__ */ jsx(Input, { id: "address-phone", value: form.phone, onChange: (e) =>
|
|
22692
|
+
/* @__PURE__ */ jsx(Field2, { id: "recipient", span: 1, label: t("crud.archetype.addresses.field.recipient"), children: /* @__PURE__ */ jsx(Input, { id: "address-recipient", value: form.recipient, onChange: (e) => set2("recipient", e.target.value) }) }),
|
|
22693
|
+
/* @__PURE__ */ jsx(Field2, { id: "phone", span: 1, label: t("crud.archetype.addresses.field.phone"), children: /* @__PURE__ */ jsx(Input, { id: "address-phone", value: form.phone, onChange: (e) => set2("phone", e.target.value) }) }),
|
|
22694
22694
|
ownerType === "unit" ? /* @__PURE__ */ jsx("div", { className: "col-span-2 rounded-lg border border-border/70 bg-muted/20 p-3", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
22695
22695
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
22696
22696
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Coordenadas da unidade" }),
|
|
@@ -22723,7 +22723,7 @@ function AddressFormModal({
|
|
|
22723
22723
|
)
|
|
22724
22724
|
] }) }) : null,
|
|
22725
22725
|
!single && /* @__PURE__ */ jsxs("label", { className: "col-span-2 flex items-center gap-2 text-sm", children: [
|
|
22726
|
-
/* @__PURE__ */ jsx(Checkbox, { checked: form.is_default, onChange: (checked) =>
|
|
22726
|
+
/* @__PURE__ */ jsx(Checkbox, { checked: form.is_default, onChange: (checked) => set2("is_default", checked) }),
|
|
22727
22727
|
t("crud.archetype.addresses.setDefault")
|
|
22728
22728
|
] })
|
|
22729
22729
|
] })
|
|
@@ -22969,7 +22969,7 @@ function PayeeAccountsSection({
|
|
|
22969
22969
|
useEffect(() => {
|
|
22970
22970
|
void load2();
|
|
22971
22971
|
}, [load2]);
|
|
22972
|
-
const
|
|
22972
|
+
const set2 = (key, value) => setForm((prev) => ({ ...prev, [key]: value }));
|
|
22973
22973
|
const canSave = !!blank(form.accountNumber ?? null) || !!blank(form.pixKey ?? null);
|
|
22974
22974
|
const handleSave = async () => {
|
|
22975
22975
|
const client3 = db2();
|
|
@@ -23128,7 +23128,7 @@ function PayeeAccountsSection({
|
|
|
23128
23128
|
}
|
|
23129
23129
|
),
|
|
23130
23130
|
/* @__PURE__ */ jsxs("label", { className: "mt-3 flex items-center gap-2 text-sm", children: [
|
|
23131
|
-
/* @__PURE__ */ jsx(Checkbox, { checked: form.is_default, onChange: (checked) =>
|
|
23131
|
+
/* @__PURE__ */ jsx(Checkbox, { checked: form.is_default, onChange: (checked) => set2("is_default", checked) }),
|
|
23132
23132
|
t("crud.archetype.payeeAccounts.setDefault")
|
|
23133
23133
|
] }),
|
|
23134
23134
|
!canSave && /* @__PURE__ */ jsx("p", { className: "mt-2 text-[11px] text-destructive", children: t("crud.bank.incomplete") })
|
|
@@ -24680,7 +24680,7 @@ function AddressField({
|
|
|
24680
24680
|
}) {
|
|
24681
24681
|
const t = useTranslation();
|
|
24682
24682
|
const v = value ?? {};
|
|
24683
|
-
const
|
|
24683
|
+
const set2 = (key, next) => onChange({ ...v, [key]: next });
|
|
24684
24684
|
const [cepState, setCepState] = useState("idle");
|
|
24685
24685
|
const lastLookup = useRef("");
|
|
24686
24686
|
const numberRef = useRef(null);
|
|
@@ -24710,7 +24710,7 @@ function AddressField({
|
|
|
24710
24710
|
}, [onChange, v]);
|
|
24711
24711
|
const onPostal = (raw) => {
|
|
24712
24712
|
const masked = formatPostalCode(raw);
|
|
24713
|
-
|
|
24713
|
+
set2("postalCode", masked);
|
|
24714
24714
|
if (cepState !== "idle") setCepState("idle");
|
|
24715
24715
|
if (isValidPostalCode(masked)) void lookup(masked);
|
|
24716
24716
|
else lastLookup.current = "";
|
|
@@ -24723,7 +24723,7 @@ function AddressField({
|
|
|
24723
24723
|
{
|
|
24724
24724
|
ref: key === "number" ? numberRef : void 0,
|
|
24725
24725
|
value: v[key] ?? "",
|
|
24726
|
-
onChange: (e) =>
|
|
24726
|
+
onChange: (e) => set2(key, e.target.value)
|
|
24727
24727
|
}
|
|
24728
24728
|
)
|
|
24729
24729
|
] });
|
|
@@ -26157,10 +26157,10 @@ function borrowIntro(intro, placeholder) {
|
|
|
26157
26157
|
store.setInvite(def);
|
|
26158
26158
|
}
|
|
26159
26159
|
function releaseOnClose() {
|
|
26160
|
-
const
|
|
26161
|
-
if (previous.isOpen && !
|
|
26160
|
+
const stop2 = useChatStore.subscribe((state2, previous) => {
|
|
26161
|
+
if (previous.isOpen && !state2.isOpen) {
|
|
26162
26162
|
releaseIntro?.();
|
|
26163
|
-
|
|
26163
|
+
stop2();
|
|
26164
26164
|
}
|
|
26165
26165
|
});
|
|
26166
26166
|
}
|
|
@@ -26266,13 +26266,13 @@ function useUnitFilter(options = {}) {
|
|
|
26266
26266
|
const beginSwitch = useUnitSwitchingStore((s) => s.begin);
|
|
26267
26267
|
const can = usePermissionOptional();
|
|
26268
26268
|
const canManageUnits = can("units", "manage");
|
|
26269
|
-
const
|
|
26269
|
+
const reachable2 = React142.useMemo(() => unitFilterOptions(units, myUnitIds), [units, myUnitIds]);
|
|
26270
26270
|
const [local2, setLocal] = React142.useState(activeUnitId);
|
|
26271
26271
|
React142.useEffect(() => {
|
|
26272
26272
|
setLocal(activeUnitId);
|
|
26273
26273
|
}, [activeUnitId]);
|
|
26274
26274
|
const raw = scope2 === "global" ? activeUnitId : local2;
|
|
26275
|
-
const value = standableUnit(raw,
|
|
26275
|
+
const value = standableUnit(raw, reachable2);
|
|
26276
26276
|
const filterLabel = label(t, "units.filterLabel", "Unidade");
|
|
26277
26277
|
const allLabel = label(t, "units.filterAll", "Todas as minhas unidades");
|
|
26278
26278
|
const setValue = React142.useCallback((next) => {
|
|
@@ -26283,13 +26283,13 @@ function useUnitFilter(options = {}) {
|
|
|
26283
26283
|
}
|
|
26284
26284
|
setLocal(next);
|
|
26285
26285
|
}, [scope2, activeUnitId, beginSwitch, byId, allLabel]);
|
|
26286
|
-
const visible = unitFilterVisible(unitMode,
|
|
26286
|
+
const visible = unitFilterVisible(unitMode, reachable2);
|
|
26287
26287
|
const def = React142.useMemo(() => visible ? {
|
|
26288
26288
|
id: "unit",
|
|
26289
26289
|
label: filterLabel,
|
|
26290
26290
|
icon: Building2,
|
|
26291
26291
|
allLabel,
|
|
26292
|
-
options:
|
|
26292
|
+
options: reachable2.map((u) => ({ value: u.id, label: u.name })),
|
|
26293
26293
|
value,
|
|
26294
26294
|
onChange: setValue,
|
|
26295
26295
|
// Unit names are typed, not scrolled for — search even for a short list.
|
|
@@ -26298,8 +26298,8 @@ function useUnitFilter(options = {}) {
|
|
|
26298
26298
|
manage: canManageUnits ? { label: label(t, "units.manage", "Gerenciar unidades"), onSelect: () => {
|
|
26299
26299
|
window.location.hash = "#/settings/locations";
|
|
26300
26300
|
} } : void 0
|
|
26301
|
-
} : null, [visible, filterLabel, allLabel,
|
|
26302
|
-
return { visible, value: visible ? value : unitMode ? activeUnitId : void 0, setValue, options:
|
|
26301
|
+
} : null, [visible, filterLabel, allLabel, reachable2, value, setValue, canManageUnits, t]);
|
|
26302
|
+
return { visible, value: visible ? value : unitMode ? activeUnitId : void 0, setValue, options: reachable2, label: filterLabel, allLabel, def };
|
|
26303
26303
|
}
|
|
26304
26304
|
var ALL_TAB = "__all__";
|
|
26305
26305
|
function getEntityIcon(name) {
|
|
@@ -26893,9 +26893,9 @@ function applyFieldRules(fields, rules) {
|
|
|
26893
26893
|
function fieldRuleReference(entityKey) {
|
|
26894
26894
|
return entityKey.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
26895
26895
|
}
|
|
26896
|
-
function stateToOverride(
|
|
26897
|
-
if (
|
|
26898
|
-
if (
|
|
26896
|
+
function stateToOverride(state2) {
|
|
26897
|
+
if (state2 === "required") return { required: true, showInForm: true };
|
|
26898
|
+
if (state2 === "hidden") return { showInForm: false, showInTable: false, showInDetail: false };
|
|
26899
26899
|
return { showInForm: true };
|
|
26900
26900
|
}
|
|
26901
26901
|
function rulesToOverrides(db2) {
|
|
@@ -26926,7 +26926,7 @@ async function listFieldRules(tenantId2, unitId = null) {
|
|
|
26926
26926
|
if (error) throw error;
|
|
26927
26927
|
return data ?? [];
|
|
26928
26928
|
}
|
|
26929
|
-
async function setFieldRule(tenantId2, rule,
|
|
26929
|
+
async function setFieldRule(tenantId2, rule, state2, unitId = null) {
|
|
26930
26930
|
const c = client2();
|
|
26931
26931
|
if (!c) throw new Error("No backend mounted");
|
|
26932
26932
|
let q = c.from("field_rules").select("id").eq("tenant_id", tenantId2);
|
|
@@ -26936,7 +26936,7 @@ async function setFieldRule(tenantId2, rule, state, unitId = null) {
|
|
|
26936
26936
|
const found = await q.maybeSingle();
|
|
26937
26937
|
if (found.error) throw found.error;
|
|
26938
26938
|
const id = found.data?.id;
|
|
26939
|
-
const res =
|
|
26939
|
+
const res = state2 === null ? id ? await c.from("field_rules").delete().eq("id", id) : { error: null } : id ? await c.from("field_rules").update({ state: state2 }).eq("id", id) : await c.from("field_rules").insert({ tenant_id: tenantId2, unit_id: unitId, ...rule, state: state2 });
|
|
26940
26940
|
if (res.error) throw res.error;
|
|
26941
26941
|
}
|
|
26942
26942
|
|
|
@@ -27664,7 +27664,7 @@ function createCrudStore(dataProvider, entity) {
|
|
|
27664
27664
|
lastQueryKey = "";
|
|
27665
27665
|
lastSettledAt = 0;
|
|
27666
27666
|
}
|
|
27667
|
-
return create((
|
|
27667
|
+
return create((set2, get) => ({
|
|
27668
27668
|
items: null,
|
|
27669
27669
|
total: 0,
|
|
27670
27670
|
totalIsEstimate: false,
|
|
@@ -27682,11 +27682,11 @@ function createCrudStore(dataProvider, entity) {
|
|
|
27682
27682
|
return;
|
|
27683
27683
|
}
|
|
27684
27684
|
lastQueryKey = currentKey;
|
|
27685
|
-
|
|
27685
|
+
set2({ loading: true });
|
|
27686
27686
|
const promise = (async () => {
|
|
27687
27687
|
try {
|
|
27688
27688
|
const result = await dataProvider.list(get().query);
|
|
27689
|
-
|
|
27689
|
+
set2({
|
|
27690
27690
|
items: result.data,
|
|
27691
27691
|
total: result.total,
|
|
27692
27692
|
totalIsEstimate: result.totalIsEstimate ?? false,
|
|
@@ -27695,7 +27695,7 @@ function createCrudStore(dataProvider, entity) {
|
|
|
27695
27695
|
fromCache: Boolean(result.cached || result.stale)
|
|
27696
27696
|
});
|
|
27697
27697
|
} catch (err) {
|
|
27698
|
-
|
|
27698
|
+
set2({
|
|
27699
27699
|
items: get().items ?? [],
|
|
27700
27700
|
loading: false,
|
|
27701
27701
|
error: errorMessage(err),
|
|
@@ -27757,7 +27757,7 @@ function createCrudStore(dataProvider, entity) {
|
|
|
27757
27757
|
const removed = get().items?.find((item) => item.id === id);
|
|
27758
27758
|
await dataProvider.remove(id);
|
|
27759
27759
|
emit4("deleted", { record_id: id, record_name: displayName(removed) });
|
|
27760
|
-
|
|
27760
|
+
set2((s) => ({
|
|
27761
27761
|
items: s.items ? s.items.filter((item) => item.id !== id) : s.items,
|
|
27762
27762
|
total: Math.max(0, s.total - 1)
|
|
27763
27763
|
}));
|
|
@@ -27798,7 +27798,7 @@ function createCrudStore(dataProvider, entity) {
|
|
|
27798
27798
|
}
|
|
27799
27799
|
if (deleted.length > 0) {
|
|
27800
27800
|
const dropped = new Set(deleted);
|
|
27801
|
-
|
|
27801
|
+
set2((s) => ({
|
|
27802
27802
|
items: s.items ? s.items.filter((item) => !dropped.has(item.id)) : s.items,
|
|
27803
27803
|
total: Math.max(0, s.total - deleted.length)
|
|
27804
27804
|
}));
|
|
@@ -27808,7 +27808,7 @@ function createCrudStore(dataProvider, entity) {
|
|
|
27808
27808
|
return result;
|
|
27809
27809
|
},
|
|
27810
27810
|
setQuery(partial) {
|
|
27811
|
-
|
|
27811
|
+
set2((s) => ({ query: { ...s.query, ...partial } }));
|
|
27812
27812
|
queueMicrotask(() => get().fetch());
|
|
27813
27813
|
},
|
|
27814
27814
|
getById(id) {
|
|
@@ -27820,7 +27820,7 @@ function createCrudStore(dataProvider, entity) {
|
|
|
27820
27820
|
try {
|
|
27821
27821
|
const result = await dataProvider.list({ page: 1, pageSize: 1, filters: { id } });
|
|
27822
27822
|
const row = result.data?.[0];
|
|
27823
|
-
if (row)
|
|
27823
|
+
if (row) set2((s) => ({ items: [...s.items ?? [], row] }));
|
|
27824
27824
|
return row;
|
|
27825
27825
|
} catch {
|
|
27826
27826
|
return void 0;
|
|
@@ -28265,12 +28265,12 @@ function usePersonTabCounts(personId) {
|
|
|
28265
28265
|
}, [personId, nonce]);
|
|
28266
28266
|
return counts;
|
|
28267
28267
|
}
|
|
28268
|
-
var useInviteStore = create((
|
|
28268
|
+
var useInviteStore = create((set2) => ({
|
|
28269
28269
|
invites: [],
|
|
28270
28270
|
loading: false,
|
|
28271
|
-
setInvites: (invites) =>
|
|
28272
|
-
setLoading: (loading) =>
|
|
28273
|
-
reset: () =>
|
|
28271
|
+
setInvites: (invites) => set2({ invites }),
|
|
28272
|
+
setLoading: (loading) => set2({ loading }),
|
|
28273
|
+
reset: () => set2({ invites: [], loading: false })
|
|
28274
28274
|
}));
|
|
28275
28275
|
var ACTIONS2 = ["read", "create", "edit", "delete"];
|
|
28276
28276
|
var SYSTEM_PERMISSIONS = [
|
|
@@ -29886,7 +29886,7 @@ function MyRecordPanel() {
|
|
|
29886
29886
|
const userId = useAuthStore((s) => s.user?.id);
|
|
29887
29887
|
const members = useOrganizationStore((s) => s.members);
|
|
29888
29888
|
const myRole = members.find((m) => m.userId === userId)?.profileName;
|
|
29889
|
-
const [
|
|
29889
|
+
const [state2, setState] = React142.useState({ status: "loading" });
|
|
29890
29890
|
const load2 = React142.useCallback(async () => {
|
|
29891
29891
|
if (!orgId || !userId) return;
|
|
29892
29892
|
const person = await dedup(`self:record:${orgId}:${userId}`, () => fetchMyPersonRecord(orgId, userId));
|
|
@@ -29908,7 +29908,7 @@ function MyRecordPanel() {
|
|
|
29908
29908
|
void load2();
|
|
29909
29909
|
}, [load2]);
|
|
29910
29910
|
const changePhoto = React142.useCallback(async (file) => {
|
|
29911
|
-
if (
|
|
29911
|
+
if (state2.status !== "ready") return;
|
|
29912
29912
|
const supabase = getFayzSupabaseClientOptional();
|
|
29913
29913
|
if (!supabase) return;
|
|
29914
29914
|
const { data: auth } = await supabase.auth.getUser();
|
|
@@ -29925,22 +29925,22 @@ function MyRecordPanel() {
|
|
|
29925
29925
|
await supabase.from("profiles").upsert({ id, avatar_url: url }, { onConflict: "id" });
|
|
29926
29926
|
await supabase.auth.updateUser({ data: { avatar_url: url } });
|
|
29927
29927
|
useAuthStore.getState().setUser({ ...useAuthStore.getState().user, avatarUrl: url });
|
|
29928
|
-
const imageField =
|
|
29928
|
+
const imageField = state2.entityDef.imageField;
|
|
29929
29929
|
if (imageField) {
|
|
29930
|
-
const provider = resolveDataProvider(
|
|
29931
|
-
const updated = await provider.update(
|
|
29932
|
-
setState({ ...
|
|
29930
|
+
const provider = resolveDataProvider(state2.entityDef);
|
|
29931
|
+
const updated = await provider.update(state2.item.id, { [imageField]: url });
|
|
29932
|
+
setState({ ...state2, item: { ...state2.item, ...updated } });
|
|
29933
29933
|
}
|
|
29934
29934
|
toast.success("Foto atualizada");
|
|
29935
|
-
}, [
|
|
29936
|
-
if (
|
|
29937
|
-
if (
|
|
29935
|
+
}, [state2]);
|
|
29936
|
+
if (state2.status === "loading") return /* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full" });
|
|
29937
|
+
if (state2.status === "none") return null;
|
|
29938
29938
|
return /* @__PURE__ */ jsx(
|
|
29939
29939
|
CrudDetailPage,
|
|
29940
29940
|
{
|
|
29941
|
-
entityDef:
|
|
29942
|
-
item:
|
|
29943
|
-
namePlural:
|
|
29941
|
+
entityDef: state2.entityDef,
|
|
29942
|
+
item: state2.item,
|
|
29943
|
+
namePlural: state2.entityDef.namePlural ?? state2.entityDef.name,
|
|
29944
29944
|
basePath: "",
|
|
29945
29945
|
embedded: true,
|
|
29946
29946
|
onBack: () => {
|
|
@@ -29948,10 +29948,10 @@ function MyRecordPanel() {
|
|
|
29948
29948
|
badges: myRole ? /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "shrink-0", children: myRole }) : null,
|
|
29949
29949
|
onImageChange: changePhoto,
|
|
29950
29950
|
onFieldSave: async (key, value) => {
|
|
29951
|
-
const provider = resolveDataProvider(
|
|
29952
|
-
const updated = await provider.update(
|
|
29953
|
-
setState({ ...
|
|
29954
|
-
if (key === (
|
|
29951
|
+
const provider = resolveDataProvider(state2.entityDef);
|
|
29952
|
+
const updated = await provider.update(state2.item.id, { [key]: value });
|
|
29953
|
+
setState({ ...state2, item: { ...state2.item, ...updated } });
|
|
29954
|
+
if (key === (state2.entityDef.displayField ?? "name") && typeof value === "string") {
|
|
29955
29955
|
await syncLoginName(value);
|
|
29956
29956
|
}
|
|
29957
29957
|
}
|
|
@@ -31146,7 +31146,7 @@ function ImportPane({ onLinked }) {
|
|
|
31146
31146
|
React142.useEffect(() => {
|
|
31147
31147
|
let cancelled = false;
|
|
31148
31148
|
setError(null);
|
|
31149
|
-
const
|
|
31149
|
+
const timer2 = setTimeout(() => {
|
|
31150
31150
|
void (async () => {
|
|
31151
31151
|
try {
|
|
31152
31152
|
const list = await listPlatformProjects({ search: search || void 0 });
|
|
@@ -31161,7 +31161,7 @@ function ImportPane({ onLinked }) {
|
|
|
31161
31161
|
}, search ? 300 : 0);
|
|
31162
31162
|
return () => {
|
|
31163
31163
|
cancelled = true;
|
|
31164
|
-
clearTimeout(
|
|
31164
|
+
clearTimeout(timer2);
|
|
31165
31165
|
};
|
|
31166
31166
|
}, [search]);
|
|
31167
31167
|
const alreadyLinked = new Set(linked.map((p) => p.fayzProjectId).filter(Boolean));
|
|
@@ -32460,16 +32460,16 @@ function UnitSwitcher({ collapsed = false, className }) {
|
|
|
32460
32460
|
if (loading) {
|
|
32461
32461
|
return collapsed ? /* @__PURE__ */ jsx(Skeleton, { className: "mx-auto h-5 w-5 rounded bg-sidebar-accent" }) : /* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-28 rounded-button bg-sidebar-accent" });
|
|
32462
32462
|
}
|
|
32463
|
-
const
|
|
32463
|
+
const reachable2 = myUnitIds.length > 0 ? myUnitIds : units.filter((u) => u.kind !== "region").map((u) => u.id);
|
|
32464
32464
|
const current3 = activeUnitId ? byId[activeUnitId] : void 0;
|
|
32465
32465
|
const allLabel = `${label2(t, "units.all", "Todas as")} ${plural}`;
|
|
32466
32466
|
const currentLabel = current3?.name ?? allLabel;
|
|
32467
|
-
const searchable =
|
|
32467
|
+
const searchable = reachable2.length > 8;
|
|
32468
32468
|
const term = query.trim().toLowerCase();
|
|
32469
|
-
const matches2 = term ? units.filter((u) => u.kind !== "region" &&
|
|
32470
|
-
if (
|
|
32471
|
-
if (
|
|
32472
|
-
const only = byId[
|
|
32469
|
+
const matches2 = term ? units.filter((u) => u.kind !== "region" && reachable2.includes(u.id) && u.name.toLowerCase().includes(term)) : [];
|
|
32470
|
+
if (reachable2.length === 0) return null;
|
|
32471
|
+
if (reachable2.length === 1) {
|
|
32472
|
+
const only = byId[reachable2[0]];
|
|
32473
32473
|
if (!only) return null;
|
|
32474
32474
|
return collapsed ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-0.5", title: only.name, children: /* @__PURE__ */ jsx(Building2, { className: "h-3.5 w-3.5 text-sidebar-muted" }) }) : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 px-1.5 py-0.5", title: only.name, children: [
|
|
32475
32475
|
/* @__PURE__ */ jsx(Building2, { className: "h-3.5 w-3.5 shrink-0 text-sidebar-muted" }),
|
|
@@ -32483,7 +32483,7 @@ function UnitSwitcher({ collapsed = false, className }) {
|
|
|
32483
32483
|
node.children.map((child) => renderNode(child, depth + 1))
|
|
32484
32484
|
] }, node.id);
|
|
32485
32485
|
}
|
|
32486
|
-
if (!
|
|
32486
|
+
if (!reachable2.includes(node.id)) return null;
|
|
32487
32487
|
return /* @__PURE__ */ jsxs(React142.Fragment, { children: [
|
|
32488
32488
|
/* @__PURE__ */ jsxs(
|
|
32489
32489
|
DropdownItem,
|
|
@@ -32579,11 +32579,11 @@ function UnitMenuSection() {
|
|
|
32579
32579
|
const needsChoice = useUnitStore((s) => s.needsChoice);
|
|
32580
32580
|
const beginSwitch = useUnitSwitchingStore((s) => s.begin);
|
|
32581
32581
|
if (!unitMode) return null;
|
|
32582
|
-
const
|
|
32583
|
-
if (
|
|
32582
|
+
const reachable2 = myUnitIds.length > 0 ? myUnitIds : units.filter((u) => u.kind !== "region").map((u) => u.id);
|
|
32583
|
+
if (reachable2.length === 0) return null;
|
|
32584
32584
|
const current3 = activeUnitId ? byId[activeUnitId] : void 0;
|
|
32585
32585
|
const currentLabel = current3?.name ?? "Todas as unidades";
|
|
32586
|
-
const nearestItem = needsChoice && canOfferNearest(units,
|
|
32586
|
+
const nearestItem = needsChoice && canOfferNearest(units, reachable2) && // O último recurso, e o único que pede alguma coisa. A entrada já tentou o
|
|
32587
32587
|
// hábito desta máquina, o desta pessoa e a aritmética de "só existe uma".
|
|
32588
32588
|
/* @__PURE__ */ jsxs(
|
|
32589
32589
|
DropdownItem,
|
|
@@ -32592,7 +32592,7 @@ function UnitMenuSection() {
|
|
|
32592
32592
|
onClick: async (e) => {
|
|
32593
32593
|
e.preventDefault();
|
|
32594
32594
|
setLocating(true);
|
|
32595
|
-
const nearest = await findNearestUnit(units,
|
|
32595
|
+
const nearest = await findNearestUnit(units, reachable2);
|
|
32596
32596
|
setLocating(false);
|
|
32597
32597
|
if (nearest) beginSwitch({ unitId: nearest.unitId, unitName: byId[nearest.unitId]?.name ?? "" });
|
|
32598
32598
|
},
|
|
@@ -32603,14 +32603,14 @@ function UnitMenuSection() {
|
|
|
32603
32603
|
]
|
|
32604
32604
|
}
|
|
32605
32605
|
);
|
|
32606
|
-
if (
|
|
32606
|
+
if (reachable2.length > MENU_LIST_CAP) {
|
|
32607
32607
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
32608
32608
|
/* @__PURE__ */ jsx(DropdownSeparator, {}),
|
|
32609
32609
|
/* @__PURE__ */ jsx(DropdownLabel, { children: "Unidades" }),
|
|
32610
32610
|
/* @__PURE__ */ jsxs(DropdownItem, { onClick: () => openUnitPicker(), className: "flex items-center gap-2", title: currentLabel, children: [
|
|
32611
32611
|
current3 ? /* @__PURE__ */ jsx(Building2, { className: "h-4 w-4 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ jsx(Layers, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
32612
32612
|
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate font-medium", children: currentLabel }),
|
|
32613
|
-
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-[10px] tabular-nums text-muted-foreground", children:
|
|
32613
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-[10px] tabular-nums text-muted-foreground", children: reachable2.length }),
|
|
32614
32614
|
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })
|
|
32615
32615
|
] }),
|
|
32616
32616
|
nearestItem
|
|
@@ -32618,14 +32618,14 @@ function UnitMenuSection() {
|
|
|
32618
32618
|
}
|
|
32619
32619
|
const renderNode = (node, depth) => {
|
|
32620
32620
|
if (node.kind === "region") {
|
|
32621
|
-
const visibleChildren = node.children.filter((c) => c.kind === "region" ||
|
|
32621
|
+
const visibleChildren = node.children.filter((c) => c.kind === "region" || reachable2.includes(c.id));
|
|
32622
32622
|
if (visibleChildren.length === 0) return null;
|
|
32623
32623
|
return /* @__PURE__ */ jsxs(React142.Fragment, { children: [
|
|
32624
32624
|
/* @__PURE__ */ jsx(DropdownLabel, { className: "px-2 pt-2 text-[10px] uppercase tracking-wide text-muted-foreground", children: node.name }),
|
|
32625
32625
|
visibleChildren.map((child) => renderNode(child, depth + 1))
|
|
32626
32626
|
] }, node.id);
|
|
32627
32627
|
}
|
|
32628
|
-
if (!
|
|
32628
|
+
if (!reachable2.includes(node.id)) return null;
|
|
32629
32629
|
return /* @__PURE__ */ jsxs(React142.Fragment, { children: [
|
|
32630
32630
|
/* @__PURE__ */ jsxs(
|
|
32631
32631
|
DropdownItem,
|
|
@@ -32646,7 +32646,7 @@ function UnitMenuSection() {
|
|
|
32646
32646
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
32647
32647
|
/* @__PURE__ */ jsx(DropdownSeparator, {}),
|
|
32648
32648
|
/* @__PURE__ */ jsx(DropdownLabel, { children: "Unidades" }),
|
|
32649
|
-
|
|
32649
|
+
reachable2.length > 1 && /* @__PURE__ */ jsxs(DropdownItem, { onClick: () => beginSwitch({ unitId: void 0, unitName: "Todas as unidades" }), className: "flex items-center gap-2", children: [
|
|
32650
32650
|
/* @__PURE__ */ jsx(Layers, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
32651
32651
|
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: "Todas as unidades" }),
|
|
32652
32652
|
!activeUnitId && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 shrink-0" })
|
|
@@ -32666,10 +32666,10 @@ function UnitIndicator({
|
|
|
32666
32666
|
const units = useUnitStore((s) => s.units);
|
|
32667
32667
|
const activeUnitId = useUnitStore((s) => s.activeUnitId);
|
|
32668
32668
|
if (!unitMode) return null;
|
|
32669
|
-
const
|
|
32670
|
-
if (
|
|
32669
|
+
const reachable2 = myUnitIds.length > 0 ? myUnitIds : units.filter((u) => u.kind !== "region").map((u) => u.id);
|
|
32670
|
+
if (reachable2.length === 0) return null;
|
|
32671
32671
|
const current3 = activeUnitId ? byId[activeUnitId] : void 0;
|
|
32672
|
-
const text3 = current3?.name ?? (
|
|
32672
|
+
const text3 = current3?.name ?? (reachable2.length > 1 ? "Todas as unidades" : byId[reachable2[0]]?.name ?? "");
|
|
32673
32673
|
if (!text3) return null;
|
|
32674
32674
|
if (collapsed) {
|
|
32675
32675
|
return /* @__PURE__ */ jsx("div", { className: "flex justify-center pt-0.5", title: text3, children: /* @__PURE__ */ jsx(Building2, { className: "h-3 w-3 text-sidebar-muted" }) });
|
|
@@ -33993,9 +33993,9 @@ function FieldRulesEditor({ mode, entityKey: fixedEntity }) {
|
|
|
33993
33993
|
"Quais campos cada formul\xE1rio oculta, exibe ou exige, para todo mundo."
|
|
33994
33994
|
));
|
|
33995
33995
|
if (!tenantId2 || rows === null) return /* @__PURE__ */ jsx(Skeleton, { className: "h-64 w-full rounded-card" });
|
|
33996
|
-
const write4 = async (rule,
|
|
33996
|
+
const write4 = async (rule, state2) => {
|
|
33997
33997
|
try {
|
|
33998
|
-
await setFieldRule(tenantId2, rule,
|
|
33998
|
+
await setFieldRule(tenantId2, rule, state2, unitId);
|
|
33999
33999
|
reload2();
|
|
34000
34000
|
} catch (e) {
|
|
34001
34001
|
toast.error(tl("Not saved", "N\xE3o salvou"), { description: e?.message });
|
|
@@ -34515,26 +34515,26 @@ function UpgradeModal() {
|
|
|
34515
34515
|
}, children: current3 !== null && /* @__PURE__ */ jsx(UpgradeModalBody, { limitKey: current3.limitKey, feature: current3.feature }) });
|
|
34516
34516
|
}
|
|
34517
34517
|
var SNOOZE_PREFIX = "fayz:soft-limit-snooze:";
|
|
34518
|
-
var useSoftLimitStore = create((
|
|
34518
|
+
var useSoftLimitStore = create((set2) => ({
|
|
34519
34519
|
over: {},
|
|
34520
34520
|
snoozed: {},
|
|
34521
|
-
report: (key, info) =>
|
|
34522
|
-
if (info.loading || info.unlimited) return
|
|
34521
|
+
report: (key, info) => set2((state2) => {
|
|
34522
|
+
if (info.loading || info.unlimited) return state2;
|
|
34523
34523
|
if (info.used > info.max) {
|
|
34524
|
-
const current3 =
|
|
34525
|
-
if (current3?.used === info.used && current3?.max === info.max) return
|
|
34526
|
-
return { over: { ...
|
|
34524
|
+
const current3 = state2.over[key];
|
|
34525
|
+
if (current3?.used === info.used && current3?.max === info.max) return state2;
|
|
34526
|
+
return { over: { ...state2.over, [key]: { key, used: info.used, max: info.max } } };
|
|
34527
34527
|
}
|
|
34528
|
-
if (info.used === 0) return
|
|
34529
|
-
if (!
|
|
34530
|
-
return { over: { ...
|
|
34528
|
+
if (info.used === 0) return state2;
|
|
34529
|
+
if (!state2.over[key]) return state2;
|
|
34530
|
+
return { over: { ...state2.over, [key]: void 0 } };
|
|
34531
34531
|
}),
|
|
34532
|
-
snooze: (key) =>
|
|
34532
|
+
snooze: (key) => set2((state2) => {
|
|
34533
34533
|
try {
|
|
34534
34534
|
globalThis.sessionStorage?.setItem(SNOOZE_PREFIX + key, "1");
|
|
34535
34535
|
} catch {
|
|
34536
34536
|
}
|
|
34537
|
-
return { snoozed: { ...
|
|
34537
|
+
return { snoozed: { ...state2.snoozed, [key]: true } };
|
|
34538
34538
|
})
|
|
34539
34539
|
}));
|
|
34540
34540
|
function useOvershoots() {
|
|
@@ -35361,10 +35361,10 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
35361
35361
|
const presetHide = appPreset.hide;
|
|
35362
35362
|
const presetWhole = appPreset.whole;
|
|
35363
35363
|
const presetLabels = appPreset.labels;
|
|
35364
|
-
const configTenantId = useAppConfigStore((
|
|
35365
|
-
const configInitializing = useAppConfigStore((
|
|
35366
|
-
const configError = useAppConfigStore((
|
|
35367
|
-
const activeTenantId = useOrganizationStore((
|
|
35364
|
+
const configTenantId = useAppConfigStore((state2) => state2.tenantId);
|
|
35365
|
+
const configInitializing = useAppConfigStore((state2) => state2.initializing);
|
|
35366
|
+
const configError = useAppConfigStore((state2) => state2.error);
|
|
35367
|
+
const activeTenantId = useOrganizationStore((state2) => state2.currentOrg?.id ?? null);
|
|
35368
35368
|
const configReady = !activeTenantId || configTenantId === activeTenantId && !configInitializing;
|
|
35369
35369
|
const tenantCtx = useTenantOptional();
|
|
35370
35370
|
const profileKnownFor = usePermissionsStore((s) => s.profileKnownFor);
|
|
@@ -35469,7 +35469,7 @@ function AdminShellInner({ appName, brandedByTenant = false, layout = "sidebar",
|
|
|
35469
35469
|
}, [billingPlans, orgPlan]);
|
|
35470
35470
|
const overshoots = useOvershoots();
|
|
35471
35471
|
const navContributions = useNavContributionsStore((s) => s.contributions);
|
|
35472
|
-
const appConfigNav = useAppConfigStore((
|
|
35472
|
+
const appConfigNav = useAppConfigStore((state2) => state2.config.nav);
|
|
35473
35473
|
const navigation = React142.useMemo(() => {
|
|
35474
35474
|
const contributed = Object.values(navContributions).flat();
|
|
35475
35475
|
const flat = dedupeByRoute(
|
|
@@ -36010,7 +36010,7 @@ function AdminShell(props) {
|
|
|
36010
36010
|
const loading = t("common.loading");
|
|
36011
36011
|
const bootSkeleton = /* @__PURE__ */ jsx(AppShellSkeleton, { label: !loading || loading === "common.loading" ? "Loading..." : loading });
|
|
36012
36012
|
const wrongApp = useWrongApp();
|
|
36013
|
-
const currentOrgName = useOrganizationStore((
|
|
36013
|
+
const currentOrgName = useOrganizationStore((state2) => state2.currentOrg?.name ?? null);
|
|
36014
36014
|
const passwordSetup = usePasswordSetupGate();
|
|
36015
36015
|
if (wrongApp.app && currentOrgName) {
|
|
36016
36016
|
return /* @__PURE__ */ jsx(
|
|
@@ -36124,12 +36124,12 @@ function resolveTenantShell(config, settings, preset) {
|
|
|
36124
36124
|
};
|
|
36125
36125
|
}
|
|
36126
36126
|
function useTenantShell(config) {
|
|
36127
|
-
const settings = useAppConfigStore((
|
|
36127
|
+
const settings = useAppConfigStore((state2) => state2.config.settings);
|
|
36128
36128
|
const preset = useAppPreset();
|
|
36129
36129
|
return useMemo(() => resolveTenantShell(config, settings, preset), [config, settings, preset]);
|
|
36130
36130
|
}
|
|
36131
36131
|
function useTenantBrandLogo() {
|
|
36132
|
-
const branding = useAppConfigStore((
|
|
36132
|
+
const branding = useAppConfigStore((state2) => state2.config.branding);
|
|
36133
36133
|
return useMemo(() => {
|
|
36134
36134
|
const brand = branding ?? {};
|
|
36135
36135
|
const identity = brand.identity ?? {};
|
|
@@ -36980,6 +36980,146 @@ function registerAdminScaffold() {
|
|
|
36980
36980
|
adminScaffoldRegistered = true;
|
|
36981
36981
|
registerScaffold("admin", AdminScaffold, { source: "sdk", label: "Admin" });
|
|
36982
36982
|
}
|
|
36983
|
+
var HEALTHY_MS = 2e4;
|
|
36984
|
+
var FAILING_MS = 5e3;
|
|
36985
|
+
var TIMEOUT_MS3 = 8e3;
|
|
36986
|
+
var state = "checking";
|
|
36987
|
+
var listeners10 = /* @__PURE__ */ new Set();
|
|
36988
|
+
var timer = null;
|
|
36989
|
+
var running = false;
|
|
36990
|
+
var inFlight = false;
|
|
36991
|
+
function set(next) {
|
|
36992
|
+
if (next === state) return;
|
|
36993
|
+
state = next;
|
|
36994
|
+
for (const l of listeners10) l();
|
|
36995
|
+
}
|
|
36996
|
+
async function reachable(url, headers) {
|
|
36997
|
+
const ctl = new AbortController();
|
|
36998
|
+
const t = setTimeout(() => ctl.abort(), TIMEOUT_MS3);
|
|
36999
|
+
try {
|
|
37000
|
+
const res = await fetch(url, { headers, cache: "no-store", signal: ctl.signal });
|
|
37001
|
+
return res.status < 500;
|
|
37002
|
+
} catch {
|
|
37003
|
+
return false;
|
|
37004
|
+
} finally {
|
|
37005
|
+
clearTimeout(t);
|
|
37006
|
+
}
|
|
37007
|
+
}
|
|
37008
|
+
async function probeBackend() {
|
|
37009
|
+
if (typeof navigator !== "undefined" && navigator.onLine === false) return "offline";
|
|
37010
|
+
const client3 = getSupabaseClientOptional$1();
|
|
37011
|
+
if (client3?.supabaseUrl) {
|
|
37012
|
+
const url = String(client3.supabaseUrl).replace(/\/+$/u, "");
|
|
37013
|
+
const ok = await reachable(`${url}/auth/v1/health`, client3.supabaseKey ? { apikey: client3.supabaseKey } : void 0);
|
|
37014
|
+
if (!ok) return typeof navigator !== "undefined" && navigator.onLine === false ? "offline" : "server-down";
|
|
37015
|
+
}
|
|
37016
|
+
const service = serviceBaseUrl();
|
|
37017
|
+
if (service && !await reachable(`${service}/v1/service/routes`)) return "degraded";
|
|
37018
|
+
return "online";
|
|
37019
|
+
}
|
|
37020
|
+
function schedule(ms) {
|
|
37021
|
+
if (timer) clearTimeout(timer);
|
|
37022
|
+
timer = running ? setTimeout(() => {
|
|
37023
|
+
void tick();
|
|
37024
|
+
}, ms) : null;
|
|
37025
|
+
}
|
|
37026
|
+
async function tick() {
|
|
37027
|
+
if (!running || inFlight) return;
|
|
37028
|
+
if (typeof document !== "undefined" && document.visibilityState === "hidden") {
|
|
37029
|
+
schedule(HEALTHY_MS);
|
|
37030
|
+
return;
|
|
37031
|
+
}
|
|
37032
|
+
inFlight = true;
|
|
37033
|
+
try {
|
|
37034
|
+
const next = await probeBackend();
|
|
37035
|
+
set(next);
|
|
37036
|
+
schedule(next === "online" ? HEALTHY_MS : FAILING_MS);
|
|
37037
|
+
} finally {
|
|
37038
|
+
inFlight = false;
|
|
37039
|
+
}
|
|
37040
|
+
}
|
|
37041
|
+
var onOffline = () => {
|
|
37042
|
+
set("offline");
|
|
37043
|
+
schedule(FAILING_MS);
|
|
37044
|
+
};
|
|
37045
|
+
var onWake = () => {
|
|
37046
|
+
if (document.visibilityState !== "hidden") void tick();
|
|
37047
|
+
};
|
|
37048
|
+
function start() {
|
|
37049
|
+
if (running || typeof window === "undefined") return;
|
|
37050
|
+
running = true;
|
|
37051
|
+
window.addEventListener("online", onWake);
|
|
37052
|
+
window.addEventListener("offline", onOffline);
|
|
37053
|
+
document.addEventListener("visibilitychange", onWake);
|
|
37054
|
+
void tick();
|
|
37055
|
+
}
|
|
37056
|
+
function stop() {
|
|
37057
|
+
running = false;
|
|
37058
|
+
if (timer) clearTimeout(timer);
|
|
37059
|
+
timer = null;
|
|
37060
|
+
if (typeof window === "undefined") return;
|
|
37061
|
+
window.removeEventListener("online", onWake);
|
|
37062
|
+
window.removeEventListener("offline", onOffline);
|
|
37063
|
+
document.removeEventListener("visibilitychange", onWake);
|
|
37064
|
+
}
|
|
37065
|
+
function subscribe3(listener) {
|
|
37066
|
+
listeners10.add(listener);
|
|
37067
|
+
if (listeners10.size === 1) start();
|
|
37068
|
+
return () => {
|
|
37069
|
+
listeners10.delete(listener);
|
|
37070
|
+
if (listeners10.size === 0) stop();
|
|
37071
|
+
};
|
|
37072
|
+
}
|
|
37073
|
+
function useBackendConnection() {
|
|
37074
|
+
return useSyncExternalStore(subscribe3, () => state, () => "checking");
|
|
37075
|
+
}
|
|
37076
|
+
var LABEL = {
|
|
37077
|
+
online: "Conectado",
|
|
37078
|
+
degraded: "Integra\xE7\xF5es sem resposta",
|
|
37079
|
+
"server-down": "Sem conex\xE3o com o servidor",
|
|
37080
|
+
offline: "Offline",
|
|
37081
|
+
checking: "Verificando conex\xE3o\u2026"
|
|
37082
|
+
};
|
|
37083
|
+
var DETAIL = {
|
|
37084
|
+
online: "O sistema est\xE1 respondendo.",
|
|
37085
|
+
degraded: "As vendas s\xE3o gravadas; iFood, pagamentos online e avisos podem atrasar.",
|
|
37086
|
+
"server-down": "O servidor n\xE3o responde. O que voc\xEA lan\xE7ar agora pode n\xE3o ser salvo.",
|
|
37087
|
+
offline: "Este aparelho est\xE1 sem internet.",
|
|
37088
|
+
checking: "Testando a conex\xE3o com o servidor."
|
|
37089
|
+
};
|
|
37090
|
+
var DOT = {
|
|
37091
|
+
online: "bg-emerald-400",
|
|
37092
|
+
degraded: "bg-amber-400",
|
|
37093
|
+
"server-down": "bg-red-500",
|
|
37094
|
+
offline: "bg-red-500",
|
|
37095
|
+
checking: "bg-white/40"
|
|
37096
|
+
};
|
|
37097
|
+
function ConnectionIndicator({ className }) {
|
|
37098
|
+
const state2 = useBackendConnection();
|
|
37099
|
+
const [peek, setPeek] = React142__default.useState(false);
|
|
37100
|
+
const showLabel = peek || state2 !== "online" && state2 !== "checking";
|
|
37101
|
+
return /* @__PURE__ */ jsxs(
|
|
37102
|
+
"button",
|
|
37103
|
+
{
|
|
37104
|
+
type: "button",
|
|
37105
|
+
onClick: () => setPeek((p) => !p),
|
|
37106
|
+
onBlur: () => setPeek(false),
|
|
37107
|
+
title: `${LABEL[state2]} \u2014 ${DETAIL[state2]}`,
|
|
37108
|
+
"aria-label": `${LABEL[state2]}. ${DETAIL[state2]}`,
|
|
37109
|
+
"data-testid": "connection-indicator",
|
|
37110
|
+
"data-state": state2,
|
|
37111
|
+
className: [
|
|
37112
|
+
"pointer-events-auto flex h-10 items-center gap-2 rounded-full bg-black/40 px-3 text-xs font-medium text-white/85 backdrop-blur",
|
|
37113
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60",
|
|
37114
|
+
className ?? ""
|
|
37115
|
+
].join(" "),
|
|
37116
|
+
children: [
|
|
37117
|
+
/* @__PURE__ */ jsx("span", { className: `h-2.5 w-2.5 shrink-0 rounded-full ${DOT[state2]} ${state2 === "server-down" || state2 === "offline" ? "animate-pulse" : ""}`, "aria-hidden": true }),
|
|
37118
|
+
showLabel && /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: LABEL[state2] })
|
|
37119
|
+
]
|
|
37120
|
+
}
|
|
37121
|
+
);
|
|
37122
|
+
}
|
|
36983
37123
|
|
|
36984
37124
|
// src/lib/entity-registry.ts
|
|
36985
37125
|
function deriveEntityKey7(entityDef) {
|
|
@@ -38263,14 +38403,14 @@ function RecordPickerModal({
|
|
|
38263
38403
|
onFilterChange.current?.(null);
|
|
38264
38404
|
return;
|
|
38265
38405
|
}
|
|
38266
|
-
const
|
|
38267
|
-
return () => clearTimeout(
|
|
38406
|
+
const timer2 = setTimeout(() => input.current?.focus(), 30);
|
|
38407
|
+
return () => clearTimeout(timer2);
|
|
38268
38408
|
}, [open]);
|
|
38269
38409
|
useEffect(() => {
|
|
38270
38410
|
if (!open) return;
|
|
38271
38411
|
let cancelled = false;
|
|
38272
38412
|
setLoading(true);
|
|
38273
|
-
const
|
|
38413
|
+
const timer2 = setTimeout(() => {
|
|
38274
38414
|
search(term.trim()).then((found) => {
|
|
38275
38415
|
if (!cancelled) setItems(found);
|
|
38276
38416
|
}).catch(() => {
|
|
@@ -38281,7 +38421,7 @@ function RecordPickerModal({
|
|
|
38281
38421
|
}, term ? 220 : 0);
|
|
38282
38422
|
return () => {
|
|
38283
38423
|
cancelled = true;
|
|
38284
|
-
clearTimeout(
|
|
38424
|
+
clearTimeout(timer2);
|
|
38285
38425
|
};
|
|
38286
38426
|
}, [term, open, search]);
|
|
38287
38427
|
const pickedKeys = useMemo(() => new Set(picked.map((p) => p.key)), [picked]);
|
|
@@ -39348,7 +39488,7 @@ function PaymentStatusBadge({
|
|
|
39348
39488
|
}) {
|
|
39349
39489
|
const [open, setOpen] = React142__default.useState(false);
|
|
39350
39490
|
const [lines, setLines] = React142__default.useState(null);
|
|
39351
|
-
const
|
|
39491
|
+
const timer2 = React142__default.useRef(null);
|
|
39352
39492
|
React142__default.useEffect(() => {
|
|
39353
39493
|
setLines(null);
|
|
39354
39494
|
}, [status, paidAmount]);
|
|
@@ -39367,15 +39507,15 @@ function PaymentStatusBadge({
|
|
|
39367
39507
|
type: "button",
|
|
39368
39508
|
onClick,
|
|
39369
39509
|
onMouseEnter: onLoadDetails ? () => {
|
|
39370
|
-
|
|
39510
|
+
timer2.current = setTimeout(() => {
|
|
39371
39511
|
setOpen(true);
|
|
39372
39512
|
load2();
|
|
39373
39513
|
}, 500);
|
|
39374
39514
|
} : void 0,
|
|
39375
39515
|
onMouseLeave: onLoadDetails ? () => {
|
|
39376
|
-
if (
|
|
39377
|
-
clearTimeout(
|
|
39378
|
-
|
|
39516
|
+
if (timer2.current) {
|
|
39517
|
+
clearTimeout(timer2.current);
|
|
39518
|
+
timer2.current = null;
|
|
39379
39519
|
}
|
|
39380
39520
|
} : void 0,
|
|
39381
39521
|
className: `inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium transition-colors ${cfg.bg} ${cfg.text} ${onClick ? "cursor-pointer hover:opacity-80" : "cursor-default"}`,
|
|
@@ -39732,7 +39872,7 @@ function OrderDetailRail({
|
|
|
39732
39872
|
}) {
|
|
39733
39873
|
const { order, loading, error, reload: reload2 } = useOrderDetail(orderId);
|
|
39734
39874
|
const { byOrder: paymentByOrder } = useOrdersPaymentStatus([orderId]);
|
|
39735
|
-
const [
|
|
39875
|
+
const [running2, setRunning] = React142.useState(null);
|
|
39736
39876
|
const [pending2, setPending] = React142.useState(null);
|
|
39737
39877
|
const perform = async (action) => {
|
|
39738
39878
|
if (!order) return;
|
|
@@ -39815,8 +39955,8 @@ function OrderDetailRail({
|
|
|
39815
39955
|
) })
|
|
39816
39956
|
] }) }),
|
|
39817
39957
|
(verbs.length > 0 || fullPageHref) && /* @__PURE__ */ jsxs("div", { className: "space-y-2 border-t border-border/40 px-4 py-3", children: [
|
|
39818
|
-
verbs.filter((a) => a.variant === "default").map((action) => /* @__PURE__ */ jsx(RailAction, { action, running, onRun: run }, action.id)),
|
|
39819
|
-
verbs.filter((a) => a.variant !== "default" && a.variant !== "destructive").map((action) => /* @__PURE__ */ jsx(RailAction, { action, running, onRun: run }, action.id)),
|
|
39958
|
+
verbs.filter((a) => a.variant === "default").map((action) => /* @__PURE__ */ jsx(RailAction, { action, running: running2, onRun: run }, action.id)),
|
|
39959
|
+
verbs.filter((a) => a.variant !== "default" && a.variant !== "destructive").map((action) => /* @__PURE__ */ jsx(RailAction, { action, running: running2, onRun: run }, action.id)),
|
|
39820
39960
|
fullPageHref && /* @__PURE__ */ jsx(
|
|
39821
39961
|
Button,
|
|
39822
39962
|
{
|
|
@@ -39826,7 +39966,7 @@ function OrderDetailRail({
|
|
|
39826
39966
|
children: "Ver pedido completo"
|
|
39827
39967
|
}
|
|
39828
39968
|
),
|
|
39829
|
-
verbs.filter((a) => a.variant === "destructive").map((action) => /* @__PURE__ */ jsx(RailAction, { action, running, onRun: run }, action.id))
|
|
39969
|
+
verbs.filter((a) => a.variant === "destructive").map((action) => /* @__PURE__ */ jsx(RailAction, { action, running: running2, onRun: run }, action.id))
|
|
39830
39970
|
] }),
|
|
39831
39971
|
order.createdAt && /* @__PURE__ */ jsxs("p", { className: "border-t border-border/40 px-4 py-1.5 text-[10px] text-muted-foreground/60", children: [
|
|
39832
39972
|
"Criado em ",
|
|
@@ -39843,7 +39983,7 @@ function OrderDetailRail({
|
|
|
39843
39983
|
variant: pending2?.variant === "destructive" ? "destructive" : "default",
|
|
39844
39984
|
confirmLabel: pending2?.label,
|
|
39845
39985
|
cancelLabel: "Voltar",
|
|
39846
|
-
loading:
|
|
39986
|
+
loading: running2 !== null,
|
|
39847
39987
|
onConfirm: () => {
|
|
39848
39988
|
if (pending2) void perform(pending2);
|
|
39849
39989
|
},
|
|
@@ -39854,15 +39994,15 @@ function OrderDetailRail({
|
|
|
39854
39994
|
}
|
|
39855
39995
|
);
|
|
39856
39996
|
}
|
|
39857
|
-
function RailAction({ action, running, onRun }) {
|
|
39997
|
+
function RailAction({ action, running: running2, onRun }) {
|
|
39858
39998
|
return /* @__PURE__ */ jsx(
|
|
39859
39999
|
Button,
|
|
39860
40000
|
{
|
|
39861
40001
|
variant: action.variant ?? "outline",
|
|
39862
40002
|
className: "w-full",
|
|
39863
|
-
disabled: action.disabled ||
|
|
40003
|
+
disabled: action.disabled || running2 !== null,
|
|
39864
40004
|
onClick: () => onRun(action),
|
|
39865
|
-
children:
|
|
40005
|
+
children: running2 === action.id ? "Aguarde\u2026" : action.label
|
|
39866
40006
|
}
|
|
39867
40007
|
);
|
|
39868
40008
|
}
|
|
@@ -41097,7 +41237,7 @@ function ContactPicker({
|
|
|
41097
41237
|
}
|
|
41098
41238
|
setSearching(true);
|
|
41099
41239
|
let cancelled = false;
|
|
41100
|
-
const
|
|
41240
|
+
const timer2 = setTimeout(async () => {
|
|
41101
41241
|
try {
|
|
41102
41242
|
const results = await resolvedLookup.search(search);
|
|
41103
41243
|
if (cancelled) return;
|
|
@@ -41109,7 +41249,7 @@ function ContactPicker({
|
|
|
41109
41249
|
}, 250);
|
|
41110
41250
|
return () => {
|
|
41111
41251
|
cancelled = true;
|
|
41112
|
-
clearTimeout(
|
|
41252
|
+
clearTimeout(timer2);
|
|
41113
41253
|
};
|
|
41114
41254
|
}, [search, value?.id, creating, resolvedLookup, activeTenantId]);
|
|
41115
41255
|
function handleSearchChange(next) {
|
|
@@ -41391,11 +41531,11 @@ function writeStore(pluginId, data) {
|
|
|
41391
41531
|
}
|
|
41392
41532
|
}
|
|
41393
41533
|
function usePluginPrefs(pluginId, defaults) {
|
|
41394
|
-
const [
|
|
41534
|
+
const [state2, setState] = useState(() => readStore(pluginId, defaults));
|
|
41395
41535
|
const get = useCallback((key) => {
|
|
41396
|
-
return
|
|
41397
|
-
}, [
|
|
41398
|
-
const
|
|
41536
|
+
return state2[key];
|
|
41537
|
+
}, [state2]);
|
|
41538
|
+
const set2 = useCallback((key, value) => {
|
|
41399
41539
|
setState((prev) => {
|
|
41400
41540
|
const next = { ...prev, [key]: value };
|
|
41401
41541
|
writeStore(pluginId, next);
|
|
@@ -41409,12 +41549,12 @@ function usePluginPrefs(pluginId, defaults) {
|
|
|
41409
41549
|
return next;
|
|
41410
41550
|
});
|
|
41411
41551
|
}, [pluginId]);
|
|
41412
|
-
const getAll = useCallback(() =>
|
|
41552
|
+
const getAll = useCallback(() => state2, [state2]);
|
|
41413
41553
|
const reset = useCallback(() => {
|
|
41414
41554
|
setState({ ...defaults });
|
|
41415
41555
|
writeStore(pluginId, defaults);
|
|
41416
41556
|
}, [pluginId, defaults]);
|
|
41417
|
-
return useMemo(() => ({ get, set, update, getAll, reset }), [get,
|
|
41557
|
+
return useMemo(() => ({ get, set: set2, update, getAll, reset }), [get, set2, update, getAll, reset]);
|
|
41418
41558
|
}
|
|
41419
41559
|
function readForPlugin(settings, pluginId, defaults) {
|
|
41420
41560
|
const root = settings && typeof settings === "object" ? settings : {};
|
|
@@ -41447,7 +41587,7 @@ function useTenantPluginSettings(pluginId, defaults) {
|
|
|
41447
41587
|
},
|
|
41448
41588
|
[adapter, setCurrentOrg]
|
|
41449
41589
|
);
|
|
41450
|
-
const
|
|
41590
|
+
const set2 = useCallback(
|
|
41451
41591
|
(key, value) => {
|
|
41452
41592
|
const org = useOrganizationStore.getState().currentOrg;
|
|
41453
41593
|
if (!adapter || !org) {
|
|
@@ -41473,8 +41613,8 @@ function useTenantPluginSettings(pluginId, defaults) {
|
|
|
41473
41613
|
[isTenantScoped, stored, localPrefs]
|
|
41474
41614
|
);
|
|
41475
41615
|
return useMemo(
|
|
41476
|
-
() => ({ get, set, getAll, isTenantScoped }),
|
|
41477
|
-
[get,
|
|
41616
|
+
() => ({ get, set: set2, getAll, isTenantScoped }),
|
|
41617
|
+
[get, set2, getAll, isTenantScoped]
|
|
41478
41618
|
);
|
|
41479
41619
|
}
|
|
41480
41620
|
|
|
@@ -41538,15 +41678,15 @@ function describeAiError(error) {
|
|
|
41538
41678
|
}
|
|
41539
41679
|
return error instanceof Error ? error.message : String(error);
|
|
41540
41680
|
}
|
|
41541
|
-
var useTeachMeStore = create((
|
|
41681
|
+
var useTeachMeStore = create((set2) => ({
|
|
41542
41682
|
active: null,
|
|
41543
41683
|
mode: "help",
|
|
41544
|
-
start: (feature, mode) =>
|
|
41545
|
-
stop: () =>
|
|
41684
|
+
start: (feature, mode) => set2({ active: feature, mode }),
|
|
41685
|
+
stop: () => set2({ active: null })
|
|
41546
41686
|
}));
|
|
41547
41687
|
function stopOnClose() {
|
|
41548
|
-
const off = useChatStore.subscribe((
|
|
41549
|
-
if (previous.isOpen && !
|
|
41688
|
+
const off = useChatStore.subscribe((state2, previous) => {
|
|
41689
|
+
if (previous.isOpen && !state2.isOpen) {
|
|
41550
41690
|
useTeachMeStore.getState().stop();
|
|
41551
41691
|
off();
|
|
41552
41692
|
}
|
|
@@ -41706,7 +41846,7 @@ function useFeatureHelp(def) {
|
|
|
41706
41846
|
pluginId: "teach-me",
|
|
41707
41847
|
describe: () => {
|
|
41708
41848
|
const { active: active2, mode } = useTeachMeStore.getState();
|
|
41709
|
-
const
|
|
41849
|
+
const running2 = active2 === ref.current.feature;
|
|
41710
41850
|
return {
|
|
41711
41851
|
title: ref.current.title,
|
|
41712
41852
|
state: {
|
|
@@ -41715,9 +41855,9 @@ function useFeatureHelp(def) {
|
|
|
41715
41855
|
// Named so the model can tell "this screen HAS a guide" from "a
|
|
41716
41856
|
// lesson is running" — the first is true all the time.
|
|
41717
41857
|
hasSetupGuide: !!getSetupGuide(ref.current.feature),
|
|
41718
|
-
helping:
|
|
41719
|
-
teaching:
|
|
41720
|
-
settingUp:
|
|
41858
|
+
helping: running2 && mode === "help",
|
|
41859
|
+
teaching: running2 && mode === "teach",
|
|
41860
|
+
settingUp: running2 && mode === "setup"
|
|
41721
41861
|
}
|
|
41722
41862
|
};
|
|
41723
41863
|
},
|
|
@@ -41908,6 +42048,6 @@ var renderApp = (...args) => {
|
|
|
41908
42048
|
return renderApp$1(...args);
|
|
41909
42049
|
};
|
|
41910
42050
|
|
|
41911
|
-
export { ALWAYS_ON_TOOLS, ActivationChecklistCard, ActivationProvider, AddConnectorButton, AddConnectorPanel, AddressFormModal, 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, CurrencyScope, DeleteConfirmDialog, DetailTabHeader, EntitlementGate, EntityLink, GetStarted, GettingStartedWidget, NotebookPanel as HandbookPanel, HandbookProvider, NotebookRailPanel as HandbookRailPanel, InlineEditor, InlineField, KanbanBoard, LimitGate, LookupCreateInline, MemberAccessRailPage, MessageTemplateRow, ModuleActionBar, MultiSelectRow, NOTE_LABEL_PREFIX, NotebookPanel, NotebookRailPanel, ORDER_CHANNEL_LABELS, ORDER_DETAIL_ZONES, ORDER_KIND_LABELS, ORDER_STAGES, ORDER_STAGE_COLORS, ORDER_STAGE_LABELS, ORDER_STATUS_LABELS, OTHER_CONNECTOR, OrderAmount, OrderBoardView, OrderCreateScreen, OrderDeliveryBlock, OrderDetailBlock, OrderDetailPage, OrderDetailRail, OrderDetailRow, OrderDetailSkeleton, OrderDetailView, OrderFormAddItemStep, OrderDetailBlock as OrderFormBlock, OrderFormItemRow, OrderFormItemsCard, OrderFormSkeleton, OrderFormView, OrderListView, OrderPaymentChip, PAYMENT_STATUS_CONFIG, PAYMENT_STATUS_LABEL, PageActions, PaymentStatusBadge, PendingSettingBadge, PermissionGate, PersonLink2 as PersonLink, PlatformError, PluginOnboardingGateSkeleton, PluginRegistryManager, PluginSettingsPanel, ProjectsSettings, QUESTION_PACKS, QuickActionsButton, RECEIVABLE_LABEL, RecordMetaFooter, RecordPickerModal, RegistryCrudView, RelatedListTab, RightRailActions, RightRailLeading, RightRailPage, RouteErrorBoundary, RouteErrorScreen, SelectRow, SettingsForm, SettingsGroup, SettingsTabs, SetupAgentSurface, SetupMeLink, SeuSiteWidget, StateChip, TagChip, TagsField, TasksPanel, TasksRailPanel, TeachMeLink, TextRow, ToggleRow, UNIT_DETAIL_ZONES, UnitScopePicker, UnitSwitcher, UnitsSettingsPage, UpgradePrompt, WORKSPACE_SETUP_FLOW_ID, WORKSPACE_SETUP_FLOW_VERSION, WORKSPACE_SETUP_ROUTE, WidgetSlot, WorkspaceSetupFlow, WorkspaceSetupGate, WorkspaceSwitcher, appendHandbookPage, applyFieldRules, askAI, attendanceSettingsParent, beautyPack, bellTopic, brandMark, buildBusinessProfile, buildHandbookTree, buildWorkspaceSetupSteps, businessProfileBlock, categoryLabel, checkAccess, checkSlugAvailable, claimTasksSurface, clearDocumentOpeners, clearPersonActions, connectorOptions, connectorRoute, connectorRows, createClientOrdersProvider, createCrudPage, createFayzApp, createFayzProject, createLogoUploader, createCrudPage as createNativeCrudPage, createOneShotAsk, createPlaceholder, createPlatformProject, createPluginContext, createViewRouter, currentBusinessProfileBlock, defaultProjectOf, defineSaas, defineSettingsTab, deleteFayzProject, deriveAgentContract, deriveEntityKey7 as deriveEntityKey, describeAiError, describeAiGap, describeFayzAgentGap, duplicateWrite, ensureChecklist, exportToCSV, filterConnectors, foodPack, formatActivityElapsed, formatCurrency, formatFieldValue, formatSetupGuide, getAccessSnapshot, getActiveAgent, getAgent, getCrudNavTabs, getDefaultFayzProject, getFayzAgentClient, getGenerationStatus, getHost, getPersonActions, getPersonPath, getPreview, getQuestionPack, getRailPage, getSetupGuide, getSetupGuideForStep, getTabCountProviders, guardLimit, hasAIToolHandler, helpWith, humanizeWriteError, inferVerticalId, invalidateOrderReceivable, invalidateOrdersPaymentStatus, invalidateRelationOptions, invalidateTabCounts, isChimeEnabled, isPlatformConnected, listFayzProjects, listHandbook, listPlatformProjects, listSetupGuides, loadArea, loadTools, loadedToolNames, mergeLines, needsCredentialSink, nextOrderStatuses, normalizePath, notifySystem, onFirstGesture, openAssistant, openAssistantAs, openConnectorsPanel, orderChannelColumn, orderIsEditable, orderKindColumn, orderStage, orderStatusTone, orientationTour, parseViewId, playChime, publishAssistantActivity, readAttachmentBytes, readHandbookPage, readSetupAnswers, receivableTone, recordOnboardingResponse, registerAIToolHandler, registerAdminScaffold, registerAssistantLauncher, registerCrudNavTabs, registerDocumentOpener, registerEntityPath, registerNotesTasksAdapter, registerPersonActions, registerRailPage, registerSetupGuides, registerTabCountProvider, registrySettingsParent, renderApp, renderHandbookOutline, requestChatUpload, requestNotificationPermission, requestProjectChange, resetLoadedTools, resolveDocumentOpener, resolveDocumentOpenerFor, resolveFayzAgentConnection, resolveSetupMode, resolveVerticalId, retailPack, revealPage, runWelcome, searchHandbook, searchSetupGuides, setChimeEnabled, setPendingSettingBadges, setServedRoutes, setSettingsUnitScope, setUpWithMe, shrinkForVision, slugify, soleAgent, splitConnectorValues, startGuidedRun, startPreview, stopPreview, submitConnection, submitWorkspaceSetup, subscribeBell, summariseSetupGuides, takeTurnReportFiles, tasksSurfaceOwner, teachMe, toInlineFile, toOrderDetailReceivable, unregisterAIToolHandler, unregisterAssistantLauncher, unregisterTabCountProvider, updateFayzProject, useActivationStore, useActiveAgent, useAgent, useAgentStore, useAgentSurface, useAssistantActivity, useAssistantInviteStore, useAssistantLaunchers, useBusinessProfileStore, useCatalogedItemTypes, useChatStore, useConnectors, useConnectorsPanelAvailable, useContextualNav, useContextualNavStore, useCurrency, useCurrencyScope, useDelegateToAssistant, useFayzProjectsStore, useFeatureHelp, useFieldRules, useHandbookStore, useHasRightRail, useHeaderAction, useHeaderActions, useHouseCurrency, useLaunchersForRole, useLookupCreate, useMemberAccessPanel, useModuleNavAccess, useModuleNavigation, useNavContribution, useNavContributionsStore, useNotesTasksBridge, useOrderDetail, useOrderEditor, useOrderFulfillments, useOrderKindTransitions, useOrderReceivable, useOrdersPaymentStatus, usePersistedState, usePersonTabCounts, usePluginOnboardingGate, usePluginPrefs, usePublishAssistantActivity, useRegisterAssistantLauncher, useRememberedList, useRightRailDrill, useRightRailHosted, useRightRailMenu, useRightRailPanel, useRightRailStore, useScrollMemory, useSettingKeys, useSettingsTabsStore, useSettingsUnitScope, useShellRailAvailable, useTeachMe, useTenantPluginSettings, useUnitBootstrap, useUnitFilter, useWidgetSurface, useWorkspaceSetupBusy, useWorkspaceSetupGate, useWorkspaceSetupStore, validateSetupGuides, withdrawAssistantActivity, writeHandbookPage };
|
|
42051
|
+
export { ALWAYS_ON_TOOLS, ActivationChecklistCard, ActivationProvider, AddConnectorButton, AddConnectorPanel, AddressFormModal, AdminProviders, AdminScaffold, AdminShell, AskAIButton, AskAIMenuItem, AssistantInvite, BoardFrame, ChatConversation, ClientOrdersTab, ConnectConsentPage, ConnectionIndicator, ConnectorDeliveries, ConnectorDetail, ConnectorMark, ConnectorRow, ConnectorSyncActions, ConnectorsHub, ConnectorsTab, ContactPicker, CredentialSinkMissingError, CrudCardGrid, CrudDetailPage, CrudDetailSkeleton, CrudFormPage, CrudFormSkeleton, CrudListView, CrudPage, CrudRecordModal, CurrencyScope, DeleteConfirmDialog, DetailTabHeader, EntitlementGate, EntityLink, GetStarted, GettingStartedWidget, NotebookPanel as HandbookPanel, HandbookProvider, NotebookRailPanel as HandbookRailPanel, InlineEditor, InlineField, KanbanBoard, LimitGate, LookupCreateInline, MemberAccessRailPage, MessageTemplateRow, ModuleActionBar, MultiSelectRow, NOTE_LABEL_PREFIX, NotebookPanel, NotebookRailPanel, ORDER_CHANNEL_LABELS, ORDER_DETAIL_ZONES, ORDER_KIND_LABELS, ORDER_STAGES, ORDER_STAGE_COLORS, ORDER_STAGE_LABELS, ORDER_STATUS_LABELS, OTHER_CONNECTOR, OrderAmount, OrderBoardView, OrderCreateScreen, OrderDeliveryBlock, OrderDetailBlock, OrderDetailPage, OrderDetailRail, OrderDetailRow, OrderDetailSkeleton, OrderDetailView, OrderFormAddItemStep, OrderDetailBlock as OrderFormBlock, OrderFormItemRow, OrderFormItemsCard, OrderFormSkeleton, OrderFormView, OrderListView, OrderPaymentChip, PAYMENT_STATUS_CONFIG, PAYMENT_STATUS_LABEL, PageActions, PaymentStatusBadge, PendingSettingBadge, PermissionGate, PersonLink2 as PersonLink, PlatformError, PluginOnboardingGateSkeleton, PluginRegistryManager, PluginSettingsPanel, ProjectsSettings, QUESTION_PACKS, QuickActionsButton, RECEIVABLE_LABEL, RecordMetaFooter, RecordPickerModal, RegistryCrudView, RelatedListTab, RightRailActions, RightRailLeading, RightRailPage, RouteErrorBoundary, RouteErrorScreen, SelectRow, SettingsForm, SettingsGroup, SettingsTabs, SetupAgentSurface, SetupMeLink, SeuSiteWidget, StateChip, TagChip, TagsField, TasksPanel, TasksRailPanel, TeachMeLink, TextRow, ToggleRow, UNIT_DETAIL_ZONES, UnitScopePicker, UnitSwitcher, UnitsSettingsPage, UpgradePrompt, WORKSPACE_SETUP_FLOW_ID, WORKSPACE_SETUP_FLOW_VERSION, WORKSPACE_SETUP_ROUTE, WidgetSlot, WorkspaceSetupFlow, WorkspaceSetupGate, WorkspaceSwitcher, appendHandbookPage, applyFieldRules, askAI, attendanceSettingsParent, beautyPack, bellTopic, brandMark, buildBusinessProfile, buildHandbookTree, buildWorkspaceSetupSteps, businessProfileBlock, categoryLabel, checkAccess, checkSlugAvailable, claimTasksSurface, clearDocumentOpeners, clearPersonActions, connectorOptions, connectorRoute, connectorRows, createClientOrdersProvider, createCrudPage, createFayzApp, createFayzProject, createLogoUploader, createCrudPage as createNativeCrudPage, createOneShotAsk, createPlaceholder, createPlatformProject, createPluginContext, createViewRouter, currentBusinessProfileBlock, defaultProjectOf, defineSaas, defineSettingsTab, deleteFayzProject, deriveAgentContract, deriveEntityKey7 as deriveEntityKey, describeAiError, describeAiGap, describeFayzAgentGap, duplicateWrite, ensureChecklist, exportToCSV, filterConnectors, foodPack, formatActivityElapsed, formatCurrency, formatFieldValue, formatSetupGuide, getAccessSnapshot, getActiveAgent, getAgent, getCrudNavTabs, getDefaultFayzProject, getFayzAgentClient, getGenerationStatus, getHost, getPersonActions, getPersonPath, getPreview, getQuestionPack, getRailPage, getSetupGuide, getSetupGuideForStep, getTabCountProviders, guardLimit, hasAIToolHandler, helpWith, humanizeWriteError, inferVerticalId, invalidateOrderReceivable, invalidateOrdersPaymentStatus, invalidateRelationOptions, invalidateTabCounts, isChimeEnabled, isPlatformConnected, listFayzProjects, listHandbook, listPlatformProjects, listSetupGuides, loadArea, loadTools, loadedToolNames, mergeLines, needsCredentialSink, nextOrderStatuses, normalizePath, notifySystem, onFirstGesture, openAssistant, openAssistantAs, openConnectorsPanel, orderChannelColumn, orderIsEditable, orderKindColumn, orderStage, orderStatusTone, orientationTour, parseViewId, playChime, probeBackend, publishAssistantActivity, readAttachmentBytes, readHandbookPage, readSetupAnswers, receivableTone, recordOnboardingResponse, registerAIToolHandler, registerAdminScaffold, registerAssistantLauncher, registerCrudNavTabs, registerDocumentOpener, registerEntityPath, registerNotesTasksAdapter, registerPersonActions, registerRailPage, registerSetupGuides, registerTabCountProvider, registrySettingsParent, renderApp, renderHandbookOutline, requestChatUpload, requestNotificationPermission, requestProjectChange, resetLoadedTools, resolveDocumentOpener, resolveDocumentOpenerFor, resolveFayzAgentConnection, resolveSetupMode, resolveVerticalId, retailPack, revealPage, runWelcome, searchHandbook, searchSetupGuides, setChimeEnabled, setPendingSettingBadges, setServedRoutes, setSettingsUnitScope, setUpWithMe, shrinkForVision, slugify, soleAgent, splitConnectorValues, startGuidedRun, startPreview, stopPreview, submitConnection, submitWorkspaceSetup, subscribeBell, summariseSetupGuides, takeTurnReportFiles, tasksSurfaceOwner, teachMe, toInlineFile, toOrderDetailReceivable, unregisterAIToolHandler, unregisterAssistantLauncher, unregisterTabCountProvider, updateFayzProject, useActivationStore, useActiveAgent, useAgent, useAgentStore, useAgentSurface, useAssistantActivity, useAssistantInviteStore, useAssistantLaunchers, useBackendConnection, useBusinessProfileStore, useCatalogedItemTypes, useChatStore, useConnectors, useConnectorsPanelAvailable, useContextualNav, useContextualNavStore, useCurrency, useCurrencyScope, useDelegateToAssistant, useFayzProjectsStore, useFeatureHelp, useFieldRules, useHandbookStore, useHasRightRail, useHeaderAction, useHeaderActions, useHouseCurrency, useLaunchersForRole, useLookupCreate, useMemberAccessPanel, useModuleNavAccess, useModuleNavigation, useNavContribution, useNavContributionsStore, useNotesTasksBridge, useOrderDetail, useOrderEditor, useOrderFulfillments, useOrderKindTransitions, useOrderReceivable, useOrdersPaymentStatus, usePersistedState, usePersonTabCounts, usePluginOnboardingGate, usePluginPrefs, usePublishAssistantActivity, useRegisterAssistantLauncher, useRememberedList, useRightRailDrill, useRightRailHosted, useRightRailMenu, useRightRailPanel, useRightRailStore, useScrollMemory, useSettingKeys, useSettingsTabsStore, useSettingsUnitScope, useShellRailAvailable, useTeachMe, useTenantPluginSettings, useUnitBootstrap, useUnitFilter, useWidgetSurface, useWorkspaceSetupBusy, useWorkspaceSetupGate, useWorkspaceSetupStore, validateSetupGuides, withdrawAssistantActivity, writeHandbookPage };
|
|
41912
42052
|
//# sourceMappingURL=index.js.map
|
|
41913
42053
|
//# sourceMappingURL=index.js.map
|