@fayz-ai/admin 0.62.0 → 0.63.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.
Files changed (169) hide show
  1. package/dist/{CommandPalette-B5PMQFDG.js → CommandPalette-XDJJ5E3O.js} +3 -3
  2. package/dist/{CommandPalette-B5PMQFDG.js.map → CommandPalette-XDJJ5E3O.js.map} +1 -1
  3. package/dist/ConnectedBrandingSettings-43ZM3HCI.js +680 -0
  4. package/dist/ConnectedBrandingSettings-43ZM3HCI.js.map +1 -0
  5. package/dist/ConnectedCompanySettings-I4MALI2Q.js +197 -0
  6. package/dist/ConnectedCompanySettings-I4MALI2Q.js.map +1 -0
  7. package/dist/ConnectedModulesSettings-A2VJ5BMJ.js +563 -0
  8. package/dist/ConnectedModulesSettings-A2VJ5BMJ.js.map +1 -0
  9. package/dist/ConnectedSecuritySettings-25AHA4HJ.js +189 -0
  10. package/dist/ConnectedSecuritySettings-25AHA4HJ.js.map +1 -0
  11. package/dist/ConnectedUserProfile-E7USJRUE.js +424 -0
  12. package/dist/ConnectedUserProfile-E7USJRUE.js.map +1 -0
  13. package/dist/FieldRulesEditor-YGIPKI5T.js +129 -0
  14. package/dist/FieldRulesEditor-YGIPKI5T.js.map +1 -0
  15. package/dist/GettingStartedWidget-HMIJ3Y24.js +12 -0
  16. package/dist/GettingStartedWidget-HMIJ3Y24.js.map +1 -0
  17. package/dist/PermissionProfilesTab-3ZPRCHMZ.js +548 -0
  18. package/dist/PermissionProfilesTab-3ZPRCHMZ.js.map +1 -0
  19. package/dist/PersonTimeline-HQZT527S.js +3 -0
  20. package/dist/{PersonTimeline-X7JTPUWJ.js.map → PersonTimeline-HQZT527S.js.map} +1 -1
  21. package/dist/ProjectsSettings-7O2F27MD.js +5 -0
  22. package/dist/ProjectsSettings-7O2F27MD.js.map +1 -0
  23. package/dist/ScheduleEditor-54ELWR45.js +8 -0
  24. package/dist/{ScheduleEditor-L2UJXKMY.js.map → ScheduleEditor-54ELWR45.js.map} +1 -1
  25. package/dist/SeuSiteWidget-QLSUVC63.js +6 -0
  26. package/dist/SeuSiteWidget-QLSUVC63.js.map +1 -0
  27. package/dist/SubscriptionPage-5GE5HFJK.js +17 -0
  28. package/dist/{SubscriptionPage-IDVEFLZ5.js.map → SubscriptionPage-5GE5HFJK.js.map} +1 -1
  29. package/dist/TeamTab-6RAULFLW.js +502 -0
  30. package/dist/TeamTab-6RAULFLW.js.map +1 -0
  31. package/dist/TrialWidget-Z6CLUCU3.js +7 -0
  32. package/dist/TrialWidget-Z6CLUCU3.js.map +1 -0
  33. package/dist/app/AdminShell.d.ts.map +1 -1
  34. package/dist/app/admin-app.d.ts.map +1 -1
  35. package/dist/app/config.d.ts +14 -0
  36. package/dist/app/config.d.ts.map +1 -1
  37. package/dist/app/routing.d.ts +6 -0
  38. package/dist/app/routing.d.ts.map +1 -1
  39. package/dist/app/scaffold.d.ts.map +1 -1
  40. package/dist/billing/index.js +9 -4
  41. package/dist/chunk-2H46WDG5.js +53 -0
  42. package/dist/chunk-2H46WDG5.js.map +1 -0
  43. package/dist/chunk-3HLX7YB2.js +94 -0
  44. package/dist/chunk-3HLX7YB2.js.map +1 -0
  45. package/dist/chunk-3OUD4XBK.js +3 -0
  46. package/dist/chunk-3OUD4XBK.js.map +1 -0
  47. package/dist/{chunk-IXSY4GPK.js → chunk-5D5QLMOQ.js} +5 -3
  48. package/dist/chunk-5D5QLMOQ.js.map +1 -0
  49. package/dist/chunk-5WR62X2R.js +1081 -0
  50. package/dist/chunk-5WR62X2R.js.map +1 -0
  51. package/dist/{chunk-KPYRTOCK.js → chunk-6CQFGMEO.js} +4 -140
  52. package/dist/chunk-6CQFGMEO.js.map +1 -0
  53. package/dist/chunk-6MMSYC2I.js +116 -0
  54. package/dist/chunk-6MMSYC2I.js.map +1 -0
  55. package/dist/chunk-6QFOE3UD.js +1466 -0
  56. package/dist/chunk-6QFOE3UD.js.map +1 -0
  57. package/dist/chunk-6UUFVQ2E.js +283 -0
  58. package/dist/chunk-6UUFVQ2E.js.map +1 -0
  59. package/dist/chunk-7WNLL3F6.js +7889 -0
  60. package/dist/chunk-7WNLL3F6.js.map +1 -0
  61. package/dist/chunk-A74IHAQE.js +439 -0
  62. package/dist/chunk-A74IHAQE.js.map +1 -0
  63. package/dist/{chunk-JOBRLBIQ.js → chunk-AFA6IO23.js} +4 -3
  64. package/dist/chunk-AFA6IO23.js.map +1 -0
  65. package/dist/{chunk-P5UIGQFY.js → chunk-ALCSIN3Z.js} +5 -5
  66. package/dist/chunk-ALCSIN3Z.js.map +1 -0
  67. package/dist/chunk-AWM4AMBS.js +39 -0
  68. package/dist/chunk-AWM4AMBS.js.map +1 -0
  69. package/dist/{chunk-OQARLKZN.js → chunk-BG5Z6KLN.js} +6 -18
  70. package/dist/chunk-BG5Z6KLN.js.map +1 -0
  71. package/dist/chunk-DPNFZONC.js +19 -0
  72. package/dist/chunk-DPNFZONC.js.map +1 -0
  73. package/dist/chunk-DRCV643L.js +193 -0
  74. package/dist/chunk-DRCV643L.js.map +1 -0
  75. package/dist/chunk-E6DF3VR6.js +206 -0
  76. package/dist/chunk-E6DF3VR6.js.map +1 -0
  77. package/dist/chunk-ENHCVGXZ.js +120 -0
  78. package/dist/chunk-ENHCVGXZ.js.map +1 -0
  79. package/dist/chunk-FK6RHGI7.js +56 -0
  80. package/dist/chunk-FK6RHGI7.js.map +1 -0
  81. package/dist/chunk-G5HNA5QK.js +233 -0
  82. package/dist/chunk-G5HNA5QK.js.map +1 -0
  83. package/dist/chunk-HCFO4Z6A.js +53 -0
  84. package/dist/chunk-HCFO4Z6A.js.map +1 -0
  85. package/dist/chunk-JFIU6NQP.js +51 -0
  86. package/dist/chunk-JFIU6NQP.js.map +1 -0
  87. package/dist/chunk-JRZJBMOY.js +3 -0
  88. package/dist/chunk-JRZJBMOY.js.map +1 -0
  89. package/dist/{chunk-3YP7KW47.js → chunk-JVVOL4BB.js} +41 -512
  90. package/dist/chunk-JVVOL4BB.js.map +1 -0
  91. package/dist/chunk-KAQ3UIAA.js +415 -0
  92. package/dist/chunk-KAQ3UIAA.js.map +1 -0
  93. package/dist/{chunk-P6XUDT2P.js → chunk-KJELMULA.js} +4 -51
  94. package/dist/chunk-KJELMULA.js.map +1 -0
  95. package/dist/chunk-KLO7DKXX.js +1651 -0
  96. package/dist/chunk-KLO7DKXX.js.map +1 -0
  97. package/dist/chunk-M2CMDWUI.js +75 -0
  98. package/dist/chunk-M2CMDWUI.js.map +1 -0
  99. package/dist/chunk-PQ47MLTH.js +255 -0
  100. package/dist/chunk-PQ47MLTH.js.map +1 -0
  101. package/dist/{chunk-VX3WJLKK.js → chunk-QD7BMUDF.js} +17 -8
  102. package/dist/chunk-QD7BMUDF.js.map +1 -0
  103. package/dist/{chunk-E4MESMNR.js → chunk-QTSKCPSW.js} +7 -10
  104. package/dist/chunk-QTSKCPSW.js.map +1 -0
  105. package/dist/chunk-S56FQKPL.js +186 -0
  106. package/dist/chunk-S56FQKPL.js.map +1 -0
  107. package/dist/chunk-SGAFPNMA.js +75 -0
  108. package/dist/chunk-SGAFPNMA.js.map +1 -0
  109. package/dist/{chunk-OD7P4L3D.js → chunk-SOKCLVM4.js} +3 -3
  110. package/dist/{chunk-OD7P4L3D.js.map → chunk-SOKCLVM4.js.map} +1 -1
  111. package/dist/chunk-TL42NKTH.js +3 -0
  112. package/dist/chunk-TL42NKTH.js.map +1 -0
  113. package/dist/chunk-U6ZCO2PS.js +2964 -0
  114. package/dist/chunk-U6ZCO2PS.js.map +1 -0
  115. package/dist/chunk-VSXNROYH.js +16 -0
  116. package/dist/chunk-VSXNROYH.js.map +1 -0
  117. package/dist/chunk-WPFZCYZL.js +619 -0
  118. package/dist/chunk-WPFZCYZL.js.map +1 -0
  119. package/dist/chunk-XFTNIBDW.js +23 -0
  120. package/dist/chunk-XFTNIBDW.js.map +1 -0
  121. package/dist/chunk-Y66JDL6I.js +1020 -0
  122. package/dist/chunk-Y66JDL6I.js.map +1 -0
  123. package/dist/chunk-YEHIBPIX.js +137 -0
  124. package/dist/chunk-YEHIBPIX.js.map +1 -0
  125. package/dist/chunk-YKPPCV2Z.js +53 -0
  126. package/dist/chunk-YKPPCV2Z.js.map +1 -0
  127. package/dist/components/chat/markdown.d.ts.map +1 -1
  128. package/dist/components/plugins/PluginSettingsPanel.d.ts.map +1 -1
  129. package/dist/components/settings/SettingsPage.d.ts.map +1 -1
  130. package/dist/connect-XKQJOWR7.js +18 -0
  131. package/dist/connect-XKQJOWR7.js.map +1 -0
  132. package/dist/crud/CrudDetailPage.d.ts.map +1 -1
  133. package/dist/crud/CrudListView.d.ts.map +1 -1
  134. package/dist/crud/CrudPage.d.ts.map +1 -1
  135. package/dist/crud/RelatedListTab.d.ts.map +1 -1
  136. package/dist/crud/archetypes/EntityLink.d.ts +1 -1
  137. package/dist/crud/archetypes/EntityLink.d.ts.map +1 -1
  138. package/dist/crud/record-chrome.d.ts.map +1 -1
  139. package/dist/entity-routes-PGU7EHAD.js +4 -0
  140. package/dist/{entity-routes-LXOBW5IB.js.map → entity-routes-PGU7EHAD.js.map} +1 -1
  141. package/dist/hooks/useModuleNavigation.d.ts.map +1 -1
  142. package/dist/impersonation/ImpersonateDialog.d.ts.map +1 -1
  143. package/dist/impersonation/session.d.ts.map +1 -1
  144. package/dist/index.d.ts +1 -1
  145. package/dist/index.d.ts.map +1 -1
  146. package/dist/index.js +11902 -33551
  147. package/dist/index.js.map +1 -1
  148. package/dist/lib/entity-routes.d.ts.map +1 -1
  149. package/dist/org/index.js +4 -2
  150. package/dist/plugins/PluginRegistryManager.d.ts.map +1 -1
  151. package/dist/settings/MessageTemplateRow.d.ts.map +1 -1
  152. package/dist/timeline/PersonTimeline.d.ts.map +1 -1
  153. package/dist/timeline/TimelineList.d.ts.map +1 -1
  154. package/dist/units/UnitRailPage.d.ts.map +1 -1
  155. package/dist/units/useUnitFilter.d.ts.map +1 -1
  156. package/package.json +5 -5
  157. package/dist/PersonTimeline-X7JTPUWJ.js +0 -3
  158. package/dist/ScheduleEditor-L2UJXKMY.js +0 -6
  159. package/dist/SubscriptionPage-IDVEFLZ5.js +0 -8
  160. package/dist/chunk-3YP7KW47.js.map +0 -1
  161. package/dist/chunk-E4MESMNR.js.map +0 -1
  162. package/dist/chunk-IXSY4GPK.js.map +0 -1
  163. package/dist/chunk-JOBRLBIQ.js.map +0 -1
  164. package/dist/chunk-KPYRTOCK.js.map +0 -1
  165. package/dist/chunk-OQARLKZN.js.map +0 -1
  166. package/dist/chunk-P5UIGQFY.js.map +0 -1
  167. package/dist/chunk-P6XUDT2P.js.map +0 -1
  168. package/dist/chunk-VX3WJLKK.js.map +0 -1
  169. package/dist/entity-routes-LXOBW5IB.js +0 -4
@@ -0,0 +1,680 @@
1
+ import { normalizeBrand, EMPTY_BRAND, UpgradeOverlay } from './chunk-3HLX7YB2.js';
2
+ import './chunk-E6DF3VR6.js';
3
+ import './chunk-HCFO4Z6A.js';
4
+ import { useAccessOptional } from './chunk-S56FQKPL.js';
5
+ import { useTranslation } from './chunk-YUHCC7JY.js';
6
+ import { toast } from './chunk-3OUD4XBK.js';
7
+ import './chunk-VSXNROYH.js';
8
+ import './chunk-M2CMDWUI.js';
9
+ import './chunk-6CQFGMEO.js';
10
+ import './chunk-BG5Z6KLN.js';
11
+ import './chunk-SGAFPNMA.js';
12
+ import './chunk-TL42NKTH.js';
13
+ import { useAppConfigStore, OrgMark } from './chunk-5D5QLMOQ.js';
14
+ import './chunk-UQ2NTFQC.js';
15
+ import { getFayzSupabaseClient } from './chunk-KJELMULA.js';
16
+ import { cn } from './chunk-JRZJBMOY.js';
17
+ import { useOrganizationStore } from './chunk-YKPPCV2Z.js';
18
+ import './chunk-QD7BMUDF.js';
19
+ import * as React from 'react';
20
+ import { Save, X, Upload } from 'lucide-react';
21
+ import { SegmentedControl, Input, Separator, Button, Badge } from '@fayz-ai/ui';
22
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
23
+
24
+ function ListField({ label, hint, value, onChange, placeholder, danger }) {
25
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
26
+ /* @__PURE__ */ jsx("label", { className: cn("text-sm font-medium", danger && "text-destructive"), children: label }),
27
+ /* @__PURE__ */ jsx(
28
+ Input,
29
+ {
30
+ value: value.join(", "),
31
+ placeholder,
32
+ onChange: (e) => onChange(e.target.value.split(",").map((x) => x.trim()).filter(Boolean))
33
+ }
34
+ ),
35
+ hint && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: hint })
36
+ ] });
37
+ }
38
+ function FileUploadField({
39
+ label,
40
+ accept,
41
+ currentUrl,
42
+ onFileSelect,
43
+ onClear,
44
+ hint
45
+ }) {
46
+ const { t } = useTranslation();
47
+ const inputRef = React.useRef(null);
48
+ const [preview, setPreview] = React.useState(null);
49
+ const handleChange = (e) => {
50
+ const file = e.target.files?.[0];
51
+ if (file) {
52
+ onFileSelect(file);
53
+ const url = URL.createObjectURL(file);
54
+ setPreview(url);
55
+ }
56
+ if (e.target) {
57
+ e.target.value = "";
58
+ }
59
+ };
60
+ const displayUrl = preview ?? currentUrl;
61
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
62
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: label }),
63
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
64
+ displayUrl ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
65
+ /* @__PURE__ */ jsx(
66
+ "img",
67
+ {
68
+ src: displayUrl,
69
+ alt: label,
70
+ className: "h-16 w-16 rounded-md border object-contain p-1"
71
+ }
72
+ ),
73
+ onClear && /* @__PURE__ */ jsx(
74
+ Button,
75
+ {
76
+ variant: "bare",
77
+ size: "bare",
78
+ type: "button",
79
+ onClick: () => {
80
+ onClear();
81
+ setPreview(null);
82
+ },
83
+ className: "absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground",
84
+ "aria-label": `Remove ${label.toLowerCase()}`,
85
+ children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
86
+ }
87
+ )
88
+ ] }) : /* @__PURE__ */ jsx("div", { className: "flex h-16 w-16 items-center justify-center rounded-md border border-dashed", children: /* @__PURE__ */ jsx(Upload, { className: "h-5 w-5 text-muted-foreground/50" }) }),
89
+ /* @__PURE__ */ jsxs("div", { children: [
90
+ /* @__PURE__ */ jsx(
91
+ Button,
92
+ {
93
+ type: "button",
94
+ variant: "outline",
95
+ size: "sm",
96
+ onClick: () => inputRef.current?.click(),
97
+ children: t("settings.branding.chooseFile")
98
+ }
99
+ ),
100
+ hint && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: hint })
101
+ ] })
102
+ ] }),
103
+ /* @__PURE__ */ jsx(
104
+ "input",
105
+ {
106
+ ref: inputRef,
107
+ type: "file",
108
+ accept,
109
+ className: "hidden",
110
+ onChange: handleChange
111
+ }
112
+ )
113
+ ] });
114
+ }
115
+ function luminance(hex) {
116
+ const m = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
117
+ if (!m) return null;
118
+ const n = parseInt(m[1], 16);
119
+ const ch = [n >> 16 & 255, n >> 8 & 255, n & 255].map((v) => {
120
+ const c = v / 255;
121
+ return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
122
+ });
123
+ return 0.2126 * ch[0] + 0.7152 * ch[1] + 0.0722 * ch[2];
124
+ }
125
+ function contrastRatio(a, b) {
126
+ const la = luminance(a);
127
+ const lb = luminance(b);
128
+ if (la === null || lb === null) return null;
129
+ const [hi, lo] = la > lb ? [la, lb] : [lb, la];
130
+ return Math.round((hi + 0.05) / (lo + 0.05) * 100) / 100;
131
+ }
132
+ function selfContradictions(brand) {
133
+ const banned = (brand.voice?.avoid ?? []).map((w) => w.toLowerCase()).filter(Boolean);
134
+ if (banned.length === 0) return [];
135
+ const haystack = [
136
+ brand.identity?.tagline,
137
+ brand.identity?.mission,
138
+ brand.voice?.tone,
139
+ ...brand.voice?.ctas ?? [],
140
+ ...brand.voice?.lexicon ?? []
141
+ ].filter(Boolean).join(" ").toLowerCase();
142
+ return banned.filter((w) => haystack.includes(w));
143
+ }
144
+ function countChanges(a, b) {
145
+ const flat = (x) => ({
146
+ name: x.identity?.name ?? "",
147
+ tagline: x.identity?.tagline ?? "",
148
+ mission: x.identity?.mission ?? "",
149
+ logoUrl: x.identity?.logoUrl ?? "",
150
+ faviconUrl: x.identity?.faviconUrl ?? "",
151
+ primary: x.tokens?.color?.primary ?? "",
152
+ accent: x.tokens?.color?.accent ?? "",
153
+ heading: x.tokens?.font?.heading ?? "",
154
+ body: x.tokens?.font?.body ?? "",
155
+ // Sem estas duas o botão Salvar não acorda quando só a trilha muda.
156
+ rail: JSON.stringify(x.tokens?.rail ?? {}),
157
+ surface: JSON.stringify(x.tokens?.surface ?? {}),
158
+ tone: x.voice?.tone ?? "",
159
+ lexicon: (x.voice?.lexicon ?? []).join(","),
160
+ avoid: (x.voice?.avoid ?? []).join(","),
161
+ ctas: (x.voice?.ctas ?? []).join(","),
162
+ hashtags: (x.voice?.hashtags ?? []).join(",")
163
+ });
164
+ const fa = flat(a);
165
+ const fb = flat(b);
166
+ return Object.keys(fa).filter((k) => fa[k] !== fb[k]).length;
167
+ }
168
+ function readableOn(hex) {
169
+ const m = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
170
+ if (!m) return "#ffffff";
171
+ const n = parseInt(m[1], 16);
172
+ const lin = (c) => {
173
+ const v = c / 255;
174
+ return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
175
+ };
176
+ const L = 0.2126 * lin(n >> 16 & 255) + 0.7152 * lin(n >> 8 & 255) + 0.0722 * lin(n & 255);
177
+ return L > 0.45 ? "#1a1a1a" : "#ffffff";
178
+ }
179
+ function BrandPreview({ brand, t }) {
180
+ const primary = brand.tokens?.color?.primary || "#111827";
181
+ const accent = brand.tokens?.color?.accent || "#6366f1";
182
+ const railBg = brand.tokens?.rail?.background || primary;
183
+ const railFg = brand.tokens?.rail?.foreground || "#ffffff";
184
+ const railActive = brand.tokens?.rail?.accent || "rgba(255,255,255,0.14)";
185
+ const pageBg = brand.tokens?.surface?.background || "#ffffff";
186
+ const cardBg = brand.tokens?.surface?.card || "#ffffff";
187
+ const pageFg = brand.tokens?.surface?.foreground || "#111827";
188
+ const radius = brand.tokens?.radius || "0.75rem";
189
+ const ctaFg = readableOn(primary);
190
+ const mark = brand.identity?.markUrl || brand.identity?.logoUrl || "";
191
+ const heading = brand.tokens?.font?.heading;
192
+ const body = brand.tokens?.font?.body;
193
+ const name = brand.identity?.name || t("settings.brand.previewFallbackName");
194
+ const cta = brand.voice?.ctas?.[0] || t("settings.brand.previewFallbackCta");
195
+ const onPrimary = contrastRatio(primary, readableOn(primary));
196
+ const banned = brand.voice?.avoid ?? [];
197
+ const clashes = selfContradictions(brand);
198
+ const sample = [
199
+ brand.voice?.tone ? t("settings.brand.sampleWithTone", { name }) : t("settings.brand.sampleNoTone", { name }),
200
+ brand.voice?.lexicon?.length ? t("settings.brand.sampleLexicon", { word: brand.voice.lexicon[0] }) : "",
201
+ `${cta}.`
202
+ ].filter(Boolean).join(" ");
203
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-3 lg:sticky lg:top-4", "data-testid": "brand-preview", children: [
204
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground", children: t("settings.brand.previewTitle") }),
205
+ /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-xl border shadow-sm", style: { backgroundColor: railBg }, children: /* @__PURE__ */ jsxs("div", { className: "flex", children: [
206
+ /* @__PURE__ */ jsxs("div", { className: "w-16 shrink-0 space-y-2 p-2", children: [
207
+ /* @__PURE__ */ jsx(OrgMark, { name, logoUrl: mark || void 0, className: "h-5 w-5" }),
208
+ /* @__PURE__ */ jsx("div", { className: "flex h-3 items-center rounded px-1", style: { backgroundColor: railActive }, children: /* @__PURE__ */ jsx("span", { className: "h-1.5 w-7 rounded", style: { backgroundColor: railFg, opacity: 0.85 } }) }),
209
+ /* @__PURE__ */ jsx("div", { className: "h-1.5 w-7 rounded", style: { backgroundColor: railFg, opacity: 0.3 } }),
210
+ /* @__PURE__ */ jsx("div", { className: "h-1.5 w-8 rounded", style: { backgroundColor: railFg, opacity: 0.3 } })
211
+ ] }),
212
+ /* @__PURE__ */ jsx("div", { className: "flex-1 p-2 pl-0", children: /* @__PURE__ */ jsxs(
213
+ "div",
214
+ {
215
+ className: "space-y-3 p-3",
216
+ style: { backgroundColor: pageBg, color: pageFg, borderRadius: radius },
217
+ children: [
218
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold", style: heading ? { fontFamily: heading } : void 0, children: name }),
219
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] leading-relaxed opacity-70", style: body ? { fontFamily: body } : void 0, children: brand.identity?.tagline || t("settings.brand.previewFallbackTagline") }),
220
+ /* @__PURE__ */ jsxs(
221
+ "div",
222
+ {
223
+ className: "flex items-center gap-2 p-2",
224
+ style: { backgroundColor: cardBg, borderRadius: radius },
225
+ children: [
226
+ /* @__PURE__ */ jsx(
227
+ "span",
228
+ {
229
+ className: "px-2.5 py-1 text-[11px] font-medium",
230
+ style: { backgroundColor: primary, color: ctaFg, borderRadius: `calc(${radius} - 0.25rem)` },
231
+ children: cta
232
+ }
233
+ ),
234
+ /* @__PURE__ */ jsx(
235
+ "span",
236
+ {
237
+ className: "px-2 py-1 text-[11px]",
238
+ style: { backgroundColor: `${accent}22`, color: accent, borderRadius: `calc(${radius} - 0.25rem)` },
239
+ children: t("settings.brand.previewChip")
240
+ }
241
+ )
242
+ ]
243
+ }
244
+ )
245
+ ]
246
+ }
247
+ ) })
248
+ ] }) }),
249
+ onPrimary !== null && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-lg border px-3 py-2", "data-testid": "brand-contrast", children: [
250
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: t("settings.brand.contrast") }),
251
+ /* @__PURE__ */ jsxs("span", { className: "text-xs font-medium tabular-nums", children: [
252
+ onPrimary,
253
+ ":1"
254
+ ] }),
255
+ /* @__PURE__ */ jsx(Badge, { variant: onPrimary >= 4.5 ? "success" : "destructive", children: onPrimary >= 7 ? "AAA" : onPrimary >= 4.5 ? "AA" : t("settings.brand.contrastFail") })
256
+ ] }),
257
+ /* @__PURE__ */ jsxs("div", { className: "rounded-xl border bg-muted/20 p-3", children: [
258
+ /* @__PURE__ */ jsx("p", { className: "mb-1.5 text-[11px] font-medium text-muted-foreground", children: t("settings.brand.voicePreview") }),
259
+ /* @__PURE__ */ jsx("p", { className: "text-xs leading-relaxed", style: body ? { fontFamily: body } : void 0, children: sample }),
260
+ banned.length > 0 && /* @__PURE__ */ jsx("p", { className: "mt-2 text-[10px] text-muted-foreground", children: t("settings.brand.neverSays", { words: banned.join(", ") }) })
261
+ ] }),
262
+ clashes.length > 0 && /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-destructive/40 bg-destructive/5 px-3 py-2", "data-testid": "brand-clash", children: /* @__PURE__ */ jsx("p", { className: "text-[11px] text-destructive", children: t("settings.brand.clash", { words: clashes.join(", ") }) }) })
263
+ ] });
264
+ }
265
+ function SkinGate({ children }) {
266
+ const access = useAccessOptional();
267
+ if (access.entitled("branding.theme")) return /* @__PURE__ */ jsx(Fragment, { children });
268
+ return /* @__PURE__ */ jsx(UpgradeOverlay, { feature: "branding.theme", overlayClassName: "min-h-[22rem]", children });
269
+ }
270
+ function BrandingSettings({ brand, onSave }) {
271
+ const { t } = useTranslation();
272
+ const [section, setSection] = React.useState("identity");
273
+ const [saved, setSaved] = React.useState(brand ?? EMPTY_BRAND);
274
+ const [draft, setDraft] = React.useState(brand ?? EMPTY_BRAND);
275
+ const [logoFile, setLogoFile] = React.useState(null);
276
+ const [faviconFile, setFaviconFile] = React.useState(null);
277
+ const [saving, setSaving] = React.useState(false);
278
+ React.useEffect(() => {
279
+ if (brand) {
280
+ setSaved(brand);
281
+ setDraft(brand);
282
+ }
283
+ }, [brand]);
284
+ const identity = draft.identity ?? {};
285
+ const color = draft.tokens?.color ?? {};
286
+ const font = draft.tokens?.font ?? {};
287
+ const voice = draft.voice ?? {};
288
+ const rail = draft.tokens?.rail ?? {};
289
+ const surface = draft.tokens?.surface ?? {};
290
+ const changes = countChanges(saved, draft) + (logoFile ? 1 : 0) + (faviconFile ? 1 : 0);
291
+ const dirty = changes > 0;
292
+ const patchIdentity = (v) => setDraft((d) => ({ ...d, identity: { ...d.identity, ...v } }));
293
+ const patchColor = (v) => setDraft((d) => ({ ...d, tokens: { ...d.tokens, color: { ...d.tokens?.color, ...v } } }));
294
+ const patchFont = (v) => setDraft((d) => ({ ...d, tokens: { ...d.tokens, font: { ...d.tokens?.font, ...v } } }));
295
+ const patchLayer = (layer) => (v) => setDraft((d) => {
296
+ const next = { ...d.tokens?.[layer] };
297
+ for (const [k, val] of Object.entries(v)) {
298
+ if (val) next[k] = val;
299
+ else delete next[k];
300
+ }
301
+ const tokens = { ...d.tokens, [layer]: next };
302
+ if (!Object.keys(next).length) delete tokens[layer];
303
+ return { ...d, tokens };
304
+ });
305
+ const patchRail = patchLayer("rail");
306
+ const patchSurface = patchLayer("surface");
307
+ const patchVoice = (v) => setDraft((d) => ({ ...d, voice: { ...d.voice, ...v } }));
308
+ const discard = () => {
309
+ setDraft(saved);
310
+ setLogoFile(null);
311
+ setFaviconFile(null);
312
+ };
313
+ const submit = async (e) => {
314
+ e.preventDefault();
315
+ if (!onSave) return;
316
+ setSaving(true);
317
+ try {
318
+ await onSave({ identity: draft.identity, tokens: draft.tokens, voice: draft.voice }, { logoFile, faviconFile });
319
+ setSaved(draft);
320
+ setLogoFile(null);
321
+ setFaviconFile(null);
322
+ } finally {
323
+ setSaving(false);
324
+ }
325
+ };
326
+ const Swatch = ({ value, onChange, id, label, fallback }) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
327
+ /* @__PURE__ */ jsx("label", { htmlFor: id, className: "text-sm font-medium", children: label }),
328
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
329
+ /* @__PURE__ */ jsx(
330
+ "input",
331
+ {
332
+ type: "color",
333
+ id,
334
+ value: value || fallback || "#808080",
335
+ onChange: (e) => onChange(e.target.value),
336
+ className: "h-9 w-9 shrink-0 cursor-pointer rounded-lg border bg-transparent p-1"
337
+ }
338
+ ),
339
+ /* @__PURE__ */ jsx(
340
+ Input,
341
+ {
342
+ value: value ?? "",
343
+ onChange: (e) => onChange(e.target.value),
344
+ placeholder: fallback,
345
+ maxLength: 7,
346
+ className: "font-mono text-sm"
347
+ }
348
+ )
349
+ ] })
350
+ ] });
351
+ return /* @__PURE__ */ jsxs("form", { onSubmit: submit, className: "pb-24", children: [
352
+ /* @__PURE__ */ jsxs("div", { className: "mb-4 flex flex-wrap items-center justify-between gap-3", children: [
353
+ /* @__PURE__ */ jsx("p", { className: "max-w-xl text-sm text-muted-foreground", children: t("settings.brand.subtitle") }),
354
+ /* @__PURE__ */ jsx(
355
+ SegmentedControl,
356
+ {
357
+ value: section,
358
+ onChange: setSection,
359
+ options: [
360
+ { value: "identity", label: t("settings.brand.identity") },
361
+ { value: "color", label: t("settings.brand.colors") },
362
+ { value: "type", label: t("settings.brand.typography") },
363
+ { value: "voice", label: t("settings.brand.voice") }
364
+ ]
365
+ }
366
+ )
367
+ ] }),
368
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-6 lg:grid-cols-[minmax(0,1fr)_320px]", children: [
369
+ /* @__PURE__ */ jsxs("div", { className: "space-y-5", "data-testid": `brand-section-${section}`, children: [
370
+ section === "identity" && /* @__PURE__ */ jsxs(Fragment, { children: [
371
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("settings.brand.identityHint") }),
372
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [
373
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
374
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: t("settings.brand.name") }),
375
+ /* @__PURE__ */ jsx(Input, { value: identity.name ?? "", onChange: (e) => patchIdentity({ name: e.target.value }) })
376
+ ] }),
377
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
378
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: t("settings.brand.tagline") }),
379
+ /* @__PURE__ */ jsx(Input, { value: identity.tagline ?? "", onChange: (e) => patchIdentity({ tagline: e.target.value }) })
380
+ ] })
381
+ ] }),
382
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
383
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: t("settings.brand.mission") }),
384
+ /* @__PURE__ */ jsx(Input, { value: identity.mission ?? "", onChange: (e) => patchIdentity({ mission: e.target.value }) })
385
+ ] }),
386
+ /* @__PURE__ */ jsx(Separator, {}),
387
+ /* @__PURE__ */ jsx(
388
+ FileUploadField,
389
+ {
390
+ label: "Logo",
391
+ accept: "image/png,image/jpeg,image/svg+xml,image/webp",
392
+ currentUrl: identity.logoUrl || void 0,
393
+ onFileSelect: setLogoFile,
394
+ onClear: () => {
395
+ patchIdentity({ logoUrl: "" });
396
+ setLogoFile(null);
397
+ },
398
+ hint: "200x50px, PNG ou SVG"
399
+ }
400
+ ),
401
+ /* @__PURE__ */ jsx(
402
+ FileUploadField,
403
+ {
404
+ label: "Favicon",
405
+ accept: "image/png,image/x-icon,image/svg+xml",
406
+ currentUrl: identity.faviconUrl || void 0,
407
+ onFileSelect: setFaviconFile,
408
+ onClear: () => {
409
+ patchIdentity({ faviconUrl: "" });
410
+ setFaviconFile(null);
411
+ },
412
+ hint: "32x32px, PNG ou ICO"
413
+ }
414
+ )
415
+ ] }),
416
+ section === "color" && /* @__PURE__ */ jsxs(SkinGate, { children: [
417
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("settings.brand.colorsHint") }),
418
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [
419
+ /* @__PURE__ */ jsx(
420
+ Swatch,
421
+ {
422
+ value: color.primary,
423
+ onChange: (v) => patchColor({ primary: v }),
424
+ id: "primary-color",
425
+ label: t("settings.branding.primaryColor"),
426
+ fallback: "#111827"
427
+ }
428
+ ),
429
+ /* @__PURE__ */ jsx(
430
+ Swatch,
431
+ {
432
+ value: color.accent,
433
+ onChange: (v) => patchColor({ accent: v }),
434
+ id: "accent-color",
435
+ label: t("settings.branding.accentColor"),
436
+ fallback: "#6366f1"
437
+ }
438
+ )
439
+ ] }),
440
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("settings.brand.colorsWhere") }),
441
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3 border-t border-border pt-4", children: [
442
+ /* @__PURE__ */ jsxs("div", { children: [
443
+ /* @__PURE__ */ jsx("h4", { className: "text-sm font-medium", children: "Barra lateral" }),
444
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Com a moldura ligada, esta cor pinta a trilha E o fundo atr\xE1s do conte\xFAdo." })
445
+ ] }),
446
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-4 sm:grid-cols-3", children: [
447
+ /* @__PURE__ */ jsx(
448
+ Swatch,
449
+ {
450
+ value: rail.background,
451
+ onChange: (v) => patchRail({ background: v }),
452
+ id: "rail-bg",
453
+ label: "Fundo",
454
+ fallback: "#111827"
455
+ }
456
+ ),
457
+ /* @__PURE__ */ jsx(
458
+ Swatch,
459
+ {
460
+ value: rail.foreground,
461
+ onChange: (v) => patchRail({ foreground: v }),
462
+ id: "rail-fg",
463
+ label: "Texto",
464
+ fallback: "#FFFFFF"
465
+ }
466
+ ),
467
+ /* @__PURE__ */ jsx(
468
+ Swatch,
469
+ {
470
+ value: rail.accent,
471
+ onChange: (v) => patchRail({ accent: v }),
472
+ id: "rail-accent",
473
+ label: "Item ativo",
474
+ fallback: "#1F2937"
475
+ }
476
+ )
477
+ ] })
478
+ ] }),
479
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3 border-t border-border pt-4", children: [
480
+ /* @__PURE__ */ jsxs("div", { children: [
481
+ /* @__PURE__ */ jsx("h4", { className: "text-sm font-medium", children: "Superf\xEDcie" }),
482
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Apague o campo para devolver a decis\xE3o ao tema do sistema." })
483
+ ] }),
484
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-4 sm:grid-cols-3", children: [
485
+ /* @__PURE__ */ jsx(
486
+ Swatch,
487
+ {
488
+ value: surface.background,
489
+ onChange: (v) => patchSurface({ background: v }),
490
+ id: "surface-bg",
491
+ label: "P\xE1gina",
492
+ fallback: "#FFFFFF"
493
+ }
494
+ ),
495
+ /* @__PURE__ */ jsx(
496
+ Swatch,
497
+ {
498
+ value: surface.card,
499
+ onChange: (v) => patchSurface({ card: v }),
500
+ id: "surface-card",
501
+ label: "Cartas",
502
+ fallback: "#FFFFFF"
503
+ }
504
+ ),
505
+ /* @__PURE__ */ jsx(
506
+ Swatch,
507
+ {
508
+ value: surface.foreground,
509
+ onChange: (v) => patchSurface({ foreground: v }),
510
+ id: "surface-fg",
511
+ label: "Texto",
512
+ fallback: "#111827"
513
+ }
514
+ )
515
+ ] })
516
+ ] })
517
+ ] }),
518
+ section === "type" && /* @__PURE__ */ jsxs(Fragment, { children: [
519
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("settings.brand.typographyHint") }),
520
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [
521
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
522
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: t("settings.brand.headingFont") }),
523
+ /* @__PURE__ */ jsx(Input, { value: font.heading ?? "", onChange: (e) => patchFont({ heading: e.target.value }), placeholder: "Hanken Grotesk" })
524
+ ] }),
525
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
526
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: t("settings.brand.bodyFont") }),
527
+ /* @__PURE__ */ jsx(Input, { value: font.body ?? "", onChange: (e) => patchFont({ body: e.target.value }), placeholder: "Inter" })
528
+ ] })
529
+ ] })
530
+ ] }),
531
+ section === "voice" && /* @__PURE__ */ jsxs(Fragment, { children: [
532
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("settings.brand.voiceHint") }),
533
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
534
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: t("settings.brand.tone") }),
535
+ /* @__PURE__ */ jsx(
536
+ Input,
537
+ {
538
+ value: voice.tone ?? "",
539
+ onChange: (e) => patchVoice({ tone: e.target.value }),
540
+ placeholder: t("settings.brand.tonePlaceholder")
541
+ }
542
+ )
543
+ ] }),
544
+ /* @__PURE__ */ jsx(
545
+ ListField,
546
+ {
547
+ label: t("settings.brand.lexicon"),
548
+ value: voice.lexicon ?? [],
549
+ onChange: (v) => patchVoice({ lexicon: v }),
550
+ placeholder: "acolhimento, cuidado"
551
+ }
552
+ ),
553
+ /* @__PURE__ */ jsx(
554
+ ListField,
555
+ {
556
+ label: t("settings.brand.ctas"),
557
+ value: voice.ctas ?? [],
558
+ onChange: (v) => patchVoice({ ctas: v }),
559
+ placeholder: t("settings.brand.ctasPlaceholder")
560
+ }
561
+ ),
562
+ /* @__PURE__ */ jsx(
563
+ ListField,
564
+ {
565
+ label: t("settings.brand.hashtags"),
566
+ value: voice.hashtags ?? [],
567
+ onChange: (v) => patchVoice({ hashtags: v }),
568
+ placeholder: "#suamarca"
569
+ }
570
+ ),
571
+ /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-destructive/30 bg-destructive/[0.03] p-4", "data-testid": "brand-avoid", children: [
572
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-destructive", children: t("settings.brand.avoid") }),
573
+ /* @__PURE__ */ jsx("p", { className: "mb-3 mt-0.5 text-xs text-muted-foreground", children: t("settings.brand.avoidHint") }),
574
+ /* @__PURE__ */ jsx(
575
+ ListField,
576
+ {
577
+ label: t("settings.brand.avoidWords"),
578
+ value: voice.avoid ?? [],
579
+ onChange: (v) => patchVoice({ avoid: v }),
580
+ placeholder: t("settings.brand.avoidPlaceholder"),
581
+ danger: true
582
+ }
583
+ )
584
+ ] })
585
+ ] })
586
+ ] }),
587
+ /* @__PURE__ */ jsx(BrandPreview, { brand: draft, t })
588
+ ] }),
589
+ dirty && /* @__PURE__ */ jsx(
590
+ "div",
591
+ {
592
+ className: "fixed inset-x-0 bottom-0 z-30 border-t bg-background/95 px-4 py-3 backdrop-blur sm:px-6",
593
+ "data-testid": "brand-dirty-bar",
594
+ children: /* @__PURE__ */ jsxs("div", { className: "mx-auto flex max-w-5xl flex-wrap items-center justify-between gap-3", children: [
595
+ /* @__PURE__ */ jsx("p", { className: "text-sm", children: changes === 1 ? t("settings.brand.unsavedOne") : t("settings.brand.unsaved", { count: String(changes) }) }),
596
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
597
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", onClick: discard, disabled: saving, children: t("settings.brand.discard") }),
598
+ /* @__PURE__ */ jsxs(Button, { type: "submit", disabled: saving, children: [
599
+ /* @__PURE__ */ jsx(Save, { className: "mr-2 h-4 w-4" }),
600
+ saving ? t("common.saving") : t("settings.branding.saveBranding")
601
+ ] })
602
+ ] })
603
+ ] })
604
+ }
605
+ )
606
+ ] });
607
+ }
608
+ function ConnectedBrandingSettings() {
609
+ const currentOrg = useOrganizationStore((s) => s.currentOrg);
610
+ const setCurrentOrg = useOrganizationStore((s) => s.setCurrentOrg);
611
+ const handleSave = async (patch, assets) => {
612
+ if (!currentOrg) return;
613
+ try {
614
+ const supabase = getFayzSupabaseClient();
615
+ const next = {
616
+ ...patch,
617
+ identity: { ...patch.identity }
618
+ };
619
+ const stamp = Date.now().toString(36);
620
+ if (assets?.logoFile) {
621
+ const ext = assets.logoFile.name.split(".").pop() ?? "png";
622
+ const path = `${currentOrg.id}/branding/logo-${stamp}.${ext}`;
623
+ const { error } = await supabase.storage.from("avatars").upload(path, assets.logoFile, { upsert: true });
624
+ if (error) throw error;
625
+ next.identity.logoUrl = supabase.storage.from("avatars").getPublicUrl(path).data.publicUrl;
626
+ delete next.identity.markUrl;
627
+ }
628
+ if (assets?.faviconFile) {
629
+ const ext = assets.faviconFile.name.split(".").pop() ?? "png";
630
+ const path = `${currentOrg.id}/branding/favicon-${stamp}.${ext}`;
631
+ const { error } = await supabase.storage.from("avatars").upload(path, assets.faviconFile, { upsert: true });
632
+ if (error) throw error;
633
+ next.identity.faviconUrl = supabase.storage.from("avatars").getPublicUrl(path).data.publicUrl;
634
+ }
635
+ const { data: brand2, error: patchError } = await supabase.rpc("tenant_brand_patch", { p_patch: next });
636
+ if (patchError) throw patchError;
637
+ const logoUrl = brand2?.identity?.logoUrl ?? currentOrg.logoUrl ?? null;
638
+ if (logoUrl !== currentOrg.logoUrl) {
639
+ await supabase.from("tenants").update({ logo_url: logoUrl }).eq("id", currentOrg.id);
640
+ }
641
+ const settings = {
642
+ ...currentOrg.settings ?? {},
643
+ branding: {
644
+ ...(currentOrg.settings ?? {}).branding ?? {},
645
+ ...next
646
+ }
647
+ };
648
+ setCurrentOrg({ ...currentOrg, logoUrl: logoUrl ?? void 0, settings });
649
+ const appConfig = useAppConfigStore.getState();
650
+ if (brand2 && appConfig.tenantId === currentOrg.id) {
651
+ appConfig.setConfig({ ...appConfig.config, branding: brand2 }, appConfig.tenantId);
652
+ }
653
+ toast.success("Marca salva");
654
+ } catch (err) {
655
+ toast.error("N\xE3o foi poss\xEDvel salvar a marca", { description: err?.message });
656
+ }
657
+ };
658
+ const [brand, setBrand] = React.useState(() => normalizeBrand(
659
+ (currentOrg?.settings ?? {}).branding,
660
+ { name: currentOrg?.name, logoUrl: currentOrg?.logoUrl }
661
+ ));
662
+ React.useEffect(() => {
663
+ let alive = true;
664
+ void (async () => {
665
+ try {
666
+ const { data } = await getFayzSupabaseClient().rpc("tenant_brand");
667
+ if (alive && data) setBrand(normalizeBrand(data, { name: currentOrg?.name, logoUrl: currentOrg?.logoUrl }));
668
+ } catch {
669
+ }
670
+ })();
671
+ return () => {
672
+ alive = false;
673
+ };
674
+ }, [currentOrg?.id, currentOrg?.name, currentOrg?.logoUrl]);
675
+ return /* @__PURE__ */ jsx(BrandingSettings, { brand, onSave: handleSave });
676
+ }
677
+
678
+ export { ConnectedBrandingSettings };
679
+ //# sourceMappingURL=ConnectedBrandingSettings-43ZM3HCI.js.map
680
+ //# sourceMappingURL=ConnectedBrandingSettings-43ZM3HCI.js.map