@fayz-ai/saas 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +2 -0
  2. package/dist/app/admin-app.d.ts.map +1 -1
  3. package/dist/archetype-lookup.d.ts +1 -1
  4. package/dist/archetype-lookup.d.ts.map +1 -1
  5. package/dist/{chunk-DCRT47W4.js → chunk-3M25GRRU.js} +6 -10
  6. package/dist/chunk-3M25GRRU.js.map +1 -0
  7. package/dist/{chunk-SRIUD35R.cjs → chunk-IPWCHJPE.cjs} +5 -11
  8. package/dist/chunk-IPWCHJPE.cjs.map +1 -0
  9. package/dist/crud/CrudDetailPage.d.ts.map +1 -1
  10. package/dist/crud/CrudFormPage.d.ts.map +1 -1
  11. package/dist/index.cjs +84 -75
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +40 -23
  16. package/dist/index.js.map +1 -1
  17. package/dist/lib/schedule-service.d.ts.map +1 -1
  18. package/dist/org/adapters/supabase.d.ts +9 -1
  19. package/dist/org/adapters/supabase.d.ts.map +1 -1
  20. package/dist/org/index.cjs +10 -10
  21. package/dist/org/index.js +1 -1
  22. package/dist/shell/components/settings/ConnectedUserProfile.d.ts.map +1 -1
  23. package/dist/shell/components/settings/LocationsCrudPage.d.ts.map +1 -1
  24. package/dist/shell/lib/create-client-orders-provider.d.ts.map +1 -1
  25. package/dist/shell/lib/supabase.d.ts +2 -1
  26. package/dist/shell/lib/supabase.d.ts.map +1 -1
  27. package/dist/shell/types/crud.d.ts +2 -2
  28. package/dist/shell/types/crud.d.ts.map +1 -1
  29. package/dist/supabase/client.d.ts +0 -4
  30. package/dist/supabase/client.d.ts.map +1 -1
  31. package/package.json +10 -7
  32. package/src/app/admin-app.tsx +9 -1
  33. package/src/archetype-lookup.ts +2 -5
  34. package/src/crud/CrudDetailPage.tsx +3 -0
  35. package/src/crud/CrudFormPage.tsx +11 -0
  36. package/src/crud/archetypes/PersonPicker.tsx +6 -6
  37. package/src/crud/archetypes/SubjectDetailTabs.tsx +2 -2
  38. package/src/env.d.ts +15 -0
  39. package/src/index.ts +0 -2
  40. package/src/lib/schedule-service.ts +2 -1
  41. package/src/org/adapters/supabase.ts +15 -5
  42. package/src/shell/components/settings/ConnectedUserProfile.tsx +3 -6
  43. package/src/shell/components/settings/LocationsCrudPage.ts +0 -1
  44. package/src/shell/lib/create-client-orders-provider.ts +2 -4
  45. package/src/shell/lib/org-adapters/supabase.ts +3 -3
  46. package/src/shell/lib/supabase.ts +5 -3
  47. package/src/shell/stores/theme.store.ts +1 -1
  48. package/src/shell/types/crud.ts +2 -2
  49. package/src/supabase/client.ts +0 -8
  50. package/dist/chunk-DCRT47W4.js.map +0 -1
  51. package/dist/chunk-SRIUD35R.cjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkSRIUD35R_cjs = require('./chunk-SRIUD35R.cjs');
3
+ var chunkIPWCHJPE_cjs = require('./chunk-IPWCHJPE.cjs');
4
4
  var chunk4XTQ4V5L_cjs = require('./chunk-4XTQ4V5L.cjs');
5
5
  var chunkKYID2MR6_cjs = require('./chunk-KYID2MR6.cjs');
6
6
  var React2 = require('react');
@@ -327,7 +327,7 @@ function ensureStyles() {
327
327
  }
328
328
  function ChatFab({ className, apiEndpoint, systemPrompt }) {
329
329
  const { isOpen, toggleOpen, setOpen } = useChatStore();
330
- const currentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.currentOrg);
330
+ const currentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg);
331
331
  const { contextualSuggestions } = useAITools();
332
332
  const { sendMessage } = useChat({ apiEndpoint, systemPrompt });
333
333
  const { t } = useTranslation();
@@ -1060,7 +1060,7 @@ function buildTheme(base, overrides) {
1060
1060
  }
1061
1061
  };
1062
1062
  }
1063
- var STORE_KEY = "__saas_core_theme_store__";
1063
+ var STORE_KEY = "__fayz_theme_store__";
1064
1064
  function createThemeStore() {
1065
1065
  if (typeof window !== "undefined" && window[STORE_KEY]) {
1066
1066
  return window[STORE_KEY];
@@ -1600,8 +1600,8 @@ function toTenantSettings(settings) {
1600
1600
  };
1601
1601
  }
1602
1602
  function ConnectedCompanySettings() {
1603
- const currentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.currentOrg);
1604
- const setCurrentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.setCurrentOrg);
1603
+ const currentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg);
1604
+ const setCurrentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.setCurrentOrg);
1605
1605
  const adapter2 = useOrgAdapterOptional2();
1606
1606
  const tenant = currentOrg ? {
1607
1607
  id: currentOrg.id,
@@ -1749,10 +1749,10 @@ function ConnectedUserProfile() {
1749
1749
  const setUser = auth.useAuthStore((s) => s.setUser);
1750
1750
  const [profile, setProfile] = React2__namespace.useState(null);
1751
1751
  React2__namespace.useEffect(() => {
1752
- const supabase = chunkSRIUD35R_cjs.getFayzSupabaseClientOptional();
1752
+ const supabase = chunkIPWCHJPE_cjs.getFayzSupabaseClientOptional();
1753
1753
  if (!user || !supabase) return;
1754
1754
  let cancelled = false;
1755
- void supabase.schema(chunkSRIUD35R_cjs.CORE_SCHEMA).from("profiles").select("full_name, avatar_url, email").eq("id", user.id).maybeSingle().then(({ data }) => {
1755
+ void supabase.from("profiles").select("full_name, avatar_url, email").eq("id", user.id).maybeSingle().then(({ data }) => {
1756
1756
  if (!cancelled && data) setProfile(data);
1757
1757
  });
1758
1758
  return () => {
@@ -1762,8 +1762,8 @@ function ConnectedUserProfile() {
1762
1762
  const handleSave = async (data) => {
1763
1763
  if (!user) return;
1764
1764
  try {
1765
- const supabase = chunkSRIUD35R_cjs.getFayzSupabaseClient();
1766
- const { error: profileError } = await supabase.schema(chunkSRIUD35R_cjs.CORE_SCHEMA).from("profiles").upsert({ id: user.id, full_name: data.fullName, email: user.email }, { onConflict: "id" });
1765
+ const supabase = chunkIPWCHJPE_cjs.getFayzSupabaseClient();
1766
+ const { error: profileError } = await supabase.from("profiles").upsert({ id: user.id, full_name: data.fullName, email: user.email }, { onConflict: "id" });
1767
1767
  if (profileError) throw profileError;
1768
1768
  const { error: metaError } = await supabase.auth.updateUser({ data: { full_name: data.fullName } });
1769
1769
  if (metaError) throw metaError;
@@ -1777,14 +1777,14 @@ function ConnectedUserProfile() {
1777
1777
  const handleAvatarChange = async (file) => {
1778
1778
  if (!user) return;
1779
1779
  try {
1780
- const supabase = chunkSRIUD35R_cjs.getFayzSupabaseClient();
1780
+ const supabase = chunkIPWCHJPE_cjs.getFayzSupabaseClient();
1781
1781
  const ext = file.name.split(".").pop();
1782
1782
  const path = `avatars/${user.id}.${ext}`;
1783
1783
  const { error: uploadError } = await supabase.storage.from("avatars").upload(path, file, { upsert: true });
1784
1784
  if (uploadError) throw uploadError;
1785
1785
  const { data: urlData } = supabase.storage.from("avatars").getPublicUrl(path);
1786
1786
  const avatarUrl = urlData.publicUrl;
1787
- const { error: profileError } = await supabase.schema(chunkSRIUD35R_cjs.CORE_SCHEMA).from("profiles").upsert({ id: user.id, avatar_url: avatarUrl, email: user.email }, { onConflict: "id" });
1787
+ const { error: profileError } = await supabase.from("profiles").upsert({ id: user.id, avatar_url: avatarUrl, email: user.email }, { onConflict: "id" });
1788
1788
  if (profileError) throw profileError;
1789
1789
  await supabase.auth.updateUser({ data: { avatar_url: avatarUrl } });
1790
1790
  setUser({ ...user, avatarUrl });
@@ -1976,11 +1976,11 @@ function ConnectedSecuritySettings() {
1976
1976
  const user = useAuthStore2((s) => s.user);
1977
1977
  const authAdapter = useAuthAdapterOptional();
1978
1978
  const orgAdapter = useOrgAdapterOptional2();
1979
- const currentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.currentOrg);
1980
- const setCurrentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.setCurrentOrg);
1979
+ const currentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg);
1980
+ const setCurrentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.setCurrentOrg);
1981
1981
  const settings = currentOrg?.settings ?? {};
1982
1982
  const tenantSecurity = settings.security ?? {};
1983
- const members = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.members);
1983
+ const members = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.members);
1984
1984
  const currentMember = members.find((m) => m.userId === user?.id);
1985
1985
  const isAdmin = currentMember?.profileName?.toLowerCase() === "owner" || currentMember?.profileName?.toLowerCase() === "admin";
1986
1986
  const handleResetPassword = async () => {
@@ -2242,12 +2242,12 @@ function BrandingSettings({ branding, onSave }) {
2242
2242
  ] }) });
2243
2243
  }
2244
2244
  function ConnectedBrandingSettings() {
2245
- const currentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.currentOrg);
2246
- const setCurrentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.setCurrentOrg);
2245
+ const currentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg);
2246
+ const setCurrentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.setCurrentOrg);
2247
2247
  const handleSave = async (branding, assets) => {
2248
2248
  if (!currentOrg) return;
2249
2249
  try {
2250
- const supabase = chunkSRIUD35R_cjs.getFayzSupabaseClient();
2250
+ const supabase = chunkIPWCHJPE_cjs.getFayzSupabaseClient();
2251
2251
  let nextBranding = { ...branding };
2252
2252
  if (assets?.logoFile) {
2253
2253
  const ext = assets.logoFile.name.split(".").pop() ?? "png";
@@ -2398,11 +2398,11 @@ var useInviteStore = zustand.create((set) => ({
2398
2398
  setLoading: (loading) => set({ loading }),
2399
2399
  reset: () => set({ invites: [], loading: false })
2400
2400
  }));
2401
- var useOrgAdapterOptional3 = () => chunkSRIUD35R_cjs.useOrgAdapterOptional();
2401
+ var useOrgAdapterOptional3 = () => chunkIPWCHJPE_cjs.useOrgAdapterOptional();
2402
2402
  function InviteMemberDialog({ open, onOpenChange, defaultEmail }) {
2403
2403
  const { t } = useTranslation();
2404
2404
  const adapter2 = useOrgAdapterOptional3();
2405
- const currentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.currentOrg);
2405
+ const currentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg);
2406
2406
  const profiles = chunk4XTQ4V5L_cjs.usePermissionsStore((s) => s.profiles);
2407
2407
  const setInvites = useInviteStore((s) => s.setInvites);
2408
2408
  const { user } = auth.useAuthStore();
@@ -2597,12 +2597,12 @@ function dedup(key, fn) {
2597
2597
  inflight.set(key, promise);
2598
2598
  return promise;
2599
2599
  }
2600
- var useOrgAdapterOptional4 = () => chunkSRIUD35R_cjs.useOrgAdapterOptional();
2600
+ var useOrgAdapterOptional4 = () => chunkIPWCHJPE_cjs.useOrgAdapterOptional();
2601
2601
  function TeamTab() {
2602
2602
  const adapter2 = useOrgAdapterOptional4();
2603
- const currentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.currentOrg);
2604
- const members = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.members);
2605
- const setMembers = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.setMembers);
2603
+ const currentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg);
2604
+ const members = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.members);
2605
+ const setMembers = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.setMembers);
2606
2606
  const profiles = chunk4XTQ4V5L_cjs.usePermissionsStore((s) => s.profiles);
2607
2607
  const invites = useInviteStore((s) => s.invites);
2608
2608
  const setInvites = useInviteStore((s) => s.setInvites);
@@ -2918,12 +2918,12 @@ function PermissionMatrixEditor({ features, profile, onSave, onCancel, saving, i
2918
2918
  ] });
2919
2919
  }
2920
2920
  function PermissionProfilesTab() {
2921
- const adapter2 = chunkSRIUD35R_cjs.useOrgAdapterOptional();
2922
- const currentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.currentOrg);
2921
+ const adapter2 = chunkIPWCHJPE_cjs.useOrgAdapterOptional();
2922
+ const currentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg);
2923
2923
  const profiles = chunk4XTQ4V5L_cjs.usePermissionsStore((s) => s.profiles);
2924
2924
  const features = chunk4XTQ4V5L_cjs.usePermissionsStore((s) => s.features);
2925
2925
  const setProfiles = chunk4XTQ4V5L_cjs.usePermissionsStore((s) => s.setProfiles);
2926
- const members = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.members);
2926
+ const members = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.members);
2927
2927
  const realProfile = chunk4XTQ4V5L_cjs.usePermissionsStore((s) => s.realProfile);
2928
2928
  const startImpersonation = chunk4XTQ4V5L_cjs.usePermissionsStore((s) => s.startImpersonation);
2929
2929
  const canPreview = (realProfile?.systemPermissions ?? []).includes("manage_permissions") ?? false;
@@ -3437,12 +3437,12 @@ function PersonPicker({
3437
3437
  const containerRef = React2.useRef(null);
3438
3438
  const [newPhone, setNewPhone] = React2.useState("");
3439
3439
  const [newEmail, setNewEmail] = React2.useState("");
3440
- const tenantId = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.currentOrg?.id);
3440
+ const tenantId = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg?.id);
3441
3441
  React2.useEffect(() => {
3442
3442
  if (value && !selected) {
3443
3443
  const supabase = core.getSupabaseClientOptional();
3444
3444
  if (!supabase) return;
3445
- supabase.schema("saas_core").from("persons").select("id, name, email, phone, kind").eq("id", value).single().then(({ data }) => {
3445
+ supabase.from("people").select("id, name, email, phone, kind").eq("id", value).single().then(({ data }) => {
3446
3446
  if (data) setSelected(data);
3447
3447
  });
3448
3448
  }
@@ -3466,7 +3466,7 @@ function PersonPicker({
3466
3466
  try {
3467
3467
  const supabase = core.getSupabaseClientOptional();
3468
3468
  if (!supabase) return;
3469
- const { data } = await supabase.schema("saas_core").from("persons").select("id, name, email, phone, kind").eq("tenant_id", tenantId).ilike("name", `%${term}%`).limit(6);
3469
+ const { data } = await supabase.from("people").select("id, name, email, phone, kind").eq("tenant_id", tenantId).ilike("name", `%${term}%`).limit(6);
3470
3470
  setResults(data ?? []);
3471
3471
  } finally {
3472
3472
  setSearching(false);
@@ -3499,7 +3499,7 @@ function PersonPicker({
3499
3499
  try {
3500
3500
  const supabase = core.getSupabaseClientOptional();
3501
3501
  if (!supabase) return;
3502
- const { data, error } = await supabase.schema("saas_core").from("persons").insert({
3502
+ const { data, error } = await supabase.from("people").insert({
3503
3503
  tenant_id: tenantId,
3504
3504
  kind: personKind,
3505
3505
  name: query.trim(),
@@ -3925,6 +3925,17 @@ function renderField(field, value, onChange, allValues = {}) {
3925
3925
  className: `${baseClass} min-h-[60px] py-1.5`
3926
3926
  }
3927
3927
  );
3928
+ case "markdown":
3929
+ return /* @__PURE__ */ jsxRuntime.jsx(
3930
+ ui.MarkdownEditor,
3931
+ {
3932
+ value: value ?? "",
3933
+ onChange,
3934
+ placeholder: field.placeholder,
3935
+ minRows: 12,
3936
+ defaultMode: "edit"
3937
+ }
3938
+ );
3928
3939
  case "relation":
3929
3940
  return /* @__PURE__ */ jsxRuntime.jsx(
3930
3941
  RelationSelect,
@@ -4521,7 +4532,7 @@ function mergeBlockSettings(metadata, settings) {
4521
4532
  return merged;
4522
4533
  }
4523
4534
  function getTenantId() {
4524
- const id = chunkSRIUD35R_cjs.useOrganizationStore.getState().currentOrg?.id;
4535
+ const id = chunkIPWCHJPE_cjs.useOrganizationStore.getState().currentOrg?.id;
4525
4536
  if (!id) throw new Error("No active tenant");
4526
4537
  return id;
4527
4538
  }
@@ -4533,13 +4544,13 @@ function mapRow(row) {
4533
4544
  return r;
4534
4545
  }
4535
4546
  async function getSchedules(assigneeId, kind = "working_hours") {
4536
- const core = chunkSRIUD35R_cjs.getCoreSchemaClient();
4547
+ const core = chunkIPWCHJPE_cjs.getFayzSupabaseClient();
4537
4548
  const { data, error } = await core.from("schedules").select("*").eq("kind", kind).eq("assignee_id", assigneeId).order("day_of_week").order("starts_at");
4538
4549
  if (error) throw error;
4539
4550
  return (data ?? []).map(mapRow);
4540
4551
  }
4541
4552
  async function replaceWeeklySchedules(assigneeId, week, kind = "working_hours") {
4542
- const core = chunkSRIUD35R_cjs.getCoreSchemaClient();
4553
+ const core = chunkIPWCHJPE_cjs.getFayzSupabaseClient();
4543
4554
  const tenantId = getTenantId();
4544
4555
  const { error: delErr } = await core.from("schedules").delete().eq("assignee_id", assigneeId).eq("kind", kind).not("day_of_week", "is", null).is("specific_date", null);
4545
4556
  if (delErr) throw delErr;
@@ -4577,7 +4588,7 @@ function eachDate(startDate, endDate) {
4577
4588
  return dates;
4578
4589
  }
4579
4590
  async function saveException(input) {
4580
- const core = chunkSRIUD35R_cjs.getCoreSchemaClient();
4591
+ const core = chunkIPWCHJPE_cjs.getFayzSupabaseClient();
4581
4592
  const tenantId = getTenantId();
4582
4593
  const kind = input.kind ?? "working_hours";
4583
4594
  const dates = eachDate(input.startDate, input.endDate);
@@ -4630,7 +4641,7 @@ async function saveException(input) {
4630
4641
  }
4631
4642
  }
4632
4643
  async function deleteException(assigneeId, startDate, endDate, kind = "working_hours") {
4633
- const core = chunkSRIUD35R_cjs.getCoreSchemaClient();
4644
+ const core = chunkIPWCHJPE_cjs.getFayzSupabaseClient();
4634
4645
  const dates = eachDate(startDate, endDate ?? startDate);
4635
4646
  const { error } = await core.from("schedules").delete().eq("assignee_id", assigneeId).eq("kind", kind).in("specific_date", dates);
4636
4647
  if (error) throw error;
@@ -5847,7 +5858,7 @@ function OwnerTab({ item }) {
5847
5858
  setLoading(false);
5848
5859
  return;
5849
5860
  }
5850
- supabase.schema("saas_core").from("persons").select("*").eq("id", tutorId).single().then(({ data }) => {
5861
+ supabase.from("people").select("*").eq("id", tutorId).single().then(({ data }) => {
5851
5862
  setPerson(data);
5852
5863
  setLoading(false);
5853
5864
  }, () => setLoading(false));
@@ -5955,6 +5966,8 @@ function formatValue2(field, value, t) {
5955
5966
  return /* @__PURE__ */ jsxRuntime.jsx("a", { href: value, target: "_blank", rel: "noopener noreferrer", className: "text-primary hover:underline", children: value });
5956
5967
  case "textarea":
5957
5968
  return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-pre-wrap", children: value });
5969
+ case "markdown":
5970
+ return value ? /* @__PURE__ */ jsxRuntime.jsx(ui.Markdown, { source: String(value) }) : null;
5958
5971
  default:
5959
5972
  return String(value);
5960
5973
  }
@@ -6831,7 +6844,7 @@ function CrudPage({ entityDef: rawEntityDef, useStore, basePath, display, featur
6831
6844
  await store.update(id, { [field]: value });
6832
6845
  }, [store]);
6833
6846
  const tanColumns = useCrudColumns(entityDef, { basePath: normalizedBasePath, onDelete: readOnly ? void 0 : (item) => setDeleteItem(item), onInlineUpdate: handleInlineUpdate, feature, readOnly });
6834
- const currentOrgId = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.currentOrg?.id);
6847
+ const currentOrgId = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg?.id);
6835
6848
  React2.useEffect(() => {
6836
6849
  if (currentOrgId) store.fetch();
6837
6850
  }, [currentOrgId]);
@@ -7231,7 +7244,6 @@ var locationEntityDef = {
7231
7244
  ],
7232
7245
  data: {
7233
7246
  table: "locations",
7234
- schema: "saas_core",
7235
7247
  tenantScoped: true,
7236
7248
  searchColumns: ["name", "city", "state"],
7237
7249
  defaults: { kind: "branch" }
@@ -7604,8 +7616,8 @@ function extractFieldRules(settings) {
7604
7616
  }
7605
7617
  function ConnectedFieldRulesSettings() {
7606
7618
  const { t } = useTranslation();
7607
- const currentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.currentOrg);
7608
- const setCurrentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.setCurrentOrg);
7619
+ const currentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg);
7620
+ const setCurrentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.setCurrentOrg);
7609
7621
  const adapter2 = useOrgAdapterOptional2();
7610
7622
  const entities = getRegisteredEntities();
7611
7623
  const rules = extractFieldRules(currentOrg?.settings);
@@ -7635,9 +7647,9 @@ function ConnectedFieldRulesSettings() {
7635
7647
  );
7636
7648
  }
7637
7649
  function WorkspaceSwitcher() {
7638
- const currentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.currentOrg);
7639
- const userOrgs = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.userOrgs);
7640
- const setCurrentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.setCurrentOrg);
7650
+ const currentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg);
7651
+ const userOrgs = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.userOrgs);
7652
+ const setCurrentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.setCurrentOrg);
7641
7653
  if (!currentOrg) return null;
7642
7654
  const Building = LucideIcons4__namespace.Building2;
7643
7655
  const Chevron = LucideIcons4__namespace.ChevronsUpDown;
@@ -7978,7 +7990,7 @@ function resolveAuthRuntime(config) {
7978
7990
  supabase: {
7979
7991
  url: auth?.supabase?.url ?? config.supabaseUrl,
7980
7992
  anonKey: auth?.supabase?.anonKey ?? config.supabaseAnonKey,
7981
- client: auth?.supabase?.client ?? chunkSRIUD35R_cjs.getFayzSupabaseClientOptional() ?? void 0,
7993
+ client: auth?.supabase?.client ?? chunkIPWCHJPE_cjs.getFayzSupabaseClientOptional() ?? void 0,
7982
7994
  callbackUrl: auth?.supabase?.callbackUrl,
7983
7995
  resetPasswordUrl: auth?.supabase?.resetPasswordUrl
7984
7996
  }
@@ -8016,8 +8028,13 @@ function resolveOrgAdapter(config, authAdapter) {
8016
8028
  name: p.name,
8017
8029
  description: p.description
8018
8030
  }));
8019
- if (strategy === "supabase") return chunkSRIUD35R_cjs.createSupabaseOrgAdapter({ roles: declaredRoles, authAdapter });
8020
- return chunkSRIUD35R_cjs.createMockOrgAdapter(config.permissions?.defaultProfiles);
8031
+ if (strategy === "supabase")
8032
+ return chunkIPWCHJPE_cjs.createSupabaseOrgAdapter({
8033
+ roles: declaredRoles,
8034
+ authAdapter,
8035
+ siteUrl: undefined.VITE_APP_URL
8036
+ });
8037
+ return chunkIPWCHJPE_cjs.createMockOrgAdapter(config.permissions?.defaultProfiles);
8021
8038
  }
8022
8039
  function buildI18nConfig(config) {
8023
8040
  const defaultLocale = config.locale?.default ?? "en";
@@ -8070,10 +8087,10 @@ function ThemeInitializer({ config }) {
8070
8087
  return null;
8071
8088
  }
8072
8089
  function AdminProviders({ config, children }) {
8073
- const currentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.currentOrg);
8090
+ const currentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg);
8074
8091
  const resolved = React2__namespace.useMemo(() => {
8075
8092
  if (config.supabaseUrl && config.supabaseAnonKey) {
8076
- chunkSRIUD35R_cjs.createFayzSupabaseClient(config.supabaseUrl, config.supabaseAnonKey);
8093
+ chunkIPWCHJPE_cjs.createFayzSupabaseClient(config.supabaseUrl, config.supabaseAnonKey);
8077
8094
  }
8078
8095
  const i18n = buildI18nConfig(config);
8079
8096
  const authRuntime = resolveAuthRuntime(config);
@@ -8106,7 +8123,7 @@ function AdminProviders({ config, children }) {
8106
8123
  }),
8107
8124
  [resolved.plugins, path, config.layout, currentOrg]
8108
8125
  );
8109
- return /* @__PURE__ */ jsxRuntime.jsx(pluginAuth.AuthProvider, { adapter: resolved.authRuntime.adapter, children: /* @__PURE__ */ jsxRuntime.jsx(chunkSRIUD35R_cjs.OrgProvider, { adapter: resolved.orgAdapter, autoCreate: config.org?.autoCreate ?? true, children: /* @__PURE__ */ jsxRuntime.jsx(core.PluginRuntimeProvider, { value: runtime, children: /* @__PURE__ */ jsxRuntime.jsx(chunk4XTQ4V5L_cjs.PermissionsProvider, { config: config.permissions, children: /* @__PURE__ */ jsxRuntime.jsxs(core.I18nProvider, { value: resolved.i18n, children: [
8126
+ return /* @__PURE__ */ jsxRuntime.jsx(pluginAuth.AuthProvider, { adapter: resolved.authRuntime.adapter, children: /* @__PURE__ */ jsxRuntime.jsx(chunkIPWCHJPE_cjs.OrgProvider, { adapter: resolved.orgAdapter, autoCreate: config.org?.autoCreate ?? true, children: /* @__PURE__ */ jsxRuntime.jsx(core.PluginRuntimeProvider, { value: runtime, children: /* @__PURE__ */ jsxRuntime.jsx(chunk4XTQ4V5L_cjs.PermissionsProvider, { config: config.permissions, children: /* @__PURE__ */ jsxRuntime.jsxs(core.I18nProvider, { value: resolved.i18n, children: [
8110
8127
  /* @__PURE__ */ jsxRuntime.jsx(ThemeInitializer, { config }),
8111
8128
  /* @__PURE__ */ jsxRuntime.jsx(BillingInitializer, { config }),
8112
8129
  /* @__PURE__ */ jsxRuntime.jsx(ui.ToastProvider, {}),
@@ -8452,7 +8469,7 @@ function createClientOrdersProvider() {
8452
8469
  const supabase = getSupabaseClientOptional();
8453
8470
  if (!supabase) return { data: [], total: 0 };
8454
8471
  try {
8455
- let qb = supabase.schema("saas_core").from("orders").select("id, kind, status, total, reference_number, notes, metadata, created_at", { count: "exact" }).eq("party_id", query.clientId);
8472
+ let qb = supabase.from("orders").select("id, kind, status, total, reference_number, notes, metadata, created_at", { count: "exact" }).eq("party_id", query.clientId);
8456
8473
  if (query.stages && query.stages.length > 0) {
8457
8474
  const allStages = query.stages.flatMap((s) => STAGE_FILTER_MAP[s] ?? [s]);
8458
8475
  qb = qb.in("status", allStages);
@@ -8465,7 +8482,7 @@ function createClientOrdersProvider() {
8465
8482
  const orderIds = (data ?? []).map((row) => row.id).filter(Boolean);
8466
8483
  const bookingStartsByOrderId = /* @__PURE__ */ new Map();
8467
8484
  if (orderIds.length > 0) {
8468
- const { data: bookings } = await supabase.schema("saas_core").from("bookings").select("order_id, starts_at").in("order_id", orderIds);
8485
+ const { data: bookings } = await supabase.from("appointments").select("order_id, starts_at").in("order_id", orderIds);
8469
8486
  for (const booking of bookings ?? []) {
8470
8487
  if (booking.order_id && booking.starts_at && !bookingStartsByOrderId.has(booking.order_id)) {
8471
8488
  bookingStartsByOrderId.set(booking.order_id, booking.starts_at);
@@ -8496,7 +8513,7 @@ function createClientOrdersProvider() {
8496
8513
  };
8497
8514
  }
8498
8515
  var ARCHETYPE_DISPLAY = {
8499
- person: { table: "persons", labelField: "name", subtitleFields: ["phone"], groupField: "kind" },
8516
+ person: { table: "people", labelField: "name", subtitleFields: ["phone"], groupField: "kind" },
8500
8517
  product: { table: "products", labelField: "name", subtitleFields: ["sku", "description"], priceField: "price" },
8501
8518
  service: { table: "services", labelField: "name", subtitleFields: ["duration_minutes", "description"], priceField: "price" },
8502
8519
  location: { table: "locations", labelField: "name", subtitleFields: ["city", "address"], groupField: "kind" }
@@ -8535,7 +8552,7 @@ function createArchetypeLookup(config) {
8535
8552
  async search(query) {
8536
8553
  const supabase = core.getSupabaseClientOptional();
8537
8554
  if (!supabase) return [];
8538
- let qb = supabase.schema("saas_core").from(display.table).select("*").eq("is_active", true).order(display.labelField, { ascending: true }).limit(limit);
8555
+ let qb = supabase.from(display.table).select("*").eq("is_active", true).order(display.labelField, { ascending: true }).limit(limit);
8539
8556
  if (query) qb = qb.ilike(display.labelField, `%${query}%`);
8540
8557
  qb = applyKindFilter(qb);
8541
8558
  const { data } = await qb;
@@ -8546,7 +8563,7 @@ function createArchetypeLookup(config) {
8546
8563
  async list() {
8547
8564
  const supabase = core.getSupabaseClientOptional();
8548
8565
  if (!supabase) return [];
8549
- let qb = supabase.schema("saas_core").from(display.table).select("*").eq("is_active", true).order(display.labelField, { ascending: true }).limit(limit);
8566
+ let qb = supabase.from(display.table).select("*").eq("is_active", true).order(display.labelField, { ascending: true }).limit(limit);
8550
8567
  qb = applyKindFilter(qb);
8551
8568
  const { data } = await qb;
8552
8569
  return (data ?? []).map(
@@ -8556,7 +8573,7 @@ function createArchetypeLookup(config) {
8556
8573
  async getById(id) {
8557
8574
  const supabase = core.getSupabaseClientOptional();
8558
8575
  if (!supabase) return null;
8559
- const { data } = await supabase.schema("saas_core").from(display.table).select("*").eq("id", id).single();
8576
+ const { data } = await supabase.from(display.table).select("*").eq("id", id).single();
8560
8577
  return data ? toResult(data, display, config.kindLabels) : null;
8561
8578
  }
8562
8579
  };
@@ -9422,61 +9439,53 @@ function PluginSettingsPanel({ title, subtitle, generalSettings, registries, cus
9422
9439
  ] });
9423
9440
  }
9424
9441
 
9425
- Object.defineProperty(exports, "CORE_SCHEMA", {
9426
- enumerable: true,
9427
- get: function () { return chunkSRIUD35R_cjs.CORE_SCHEMA; }
9428
- });
9429
9442
  Object.defineProperty(exports, "OrgProvider", {
9430
9443
  enumerable: true,
9431
- get: function () { return chunkSRIUD35R_cjs.OrgProvider; }
9444
+ get: function () { return chunkIPWCHJPE_cjs.OrgProvider; }
9432
9445
  });
9433
9446
  Object.defineProperty(exports, "createFayzSupabaseClient", {
9434
9447
  enumerable: true,
9435
- get: function () { return chunkSRIUD35R_cjs.createFayzSupabaseClient; }
9448
+ get: function () { return chunkIPWCHJPE_cjs.createFayzSupabaseClient; }
9436
9449
  });
9437
9450
  Object.defineProperty(exports, "createMockOrgAdapter", {
9438
9451
  enumerable: true,
9439
- get: function () { return chunkSRIUD35R_cjs.createMockOrgAdapter; }
9452
+ get: function () { return chunkIPWCHJPE_cjs.createMockOrgAdapter; }
9440
9453
  });
9441
9454
  Object.defineProperty(exports, "createSupabaseOrgAdapter", {
9442
9455
  enumerable: true,
9443
- get: function () { return chunkSRIUD35R_cjs.createSupabaseOrgAdapter; }
9444
- });
9445
- Object.defineProperty(exports, "getCoreSchemaClient", {
9446
- enumerable: true,
9447
- get: function () { return chunkSRIUD35R_cjs.getCoreSchemaClient; }
9456
+ get: function () { return chunkIPWCHJPE_cjs.createSupabaseOrgAdapter; }
9448
9457
  });
9449
9458
  Object.defineProperty(exports, "getFayzSupabaseClient", {
9450
9459
  enumerable: true,
9451
- get: function () { return chunkSRIUD35R_cjs.getFayzSupabaseClient; }
9460
+ get: function () { return chunkIPWCHJPE_cjs.getFayzSupabaseClient; }
9452
9461
  });
9453
9462
  Object.defineProperty(exports, "getFayzSupabaseClientOptional", {
9454
9463
  enumerable: true,
9455
- get: function () { return chunkSRIUD35R_cjs.getFayzSupabaseClientOptional; }
9464
+ get: function () { return chunkIPWCHJPE_cjs.getFayzSupabaseClientOptional; }
9456
9465
  });
9457
9466
  Object.defineProperty(exports, "getPersistedOrgId", {
9458
9467
  enumerable: true,
9459
- get: function () { return chunkSRIUD35R_cjs.getPersistedOrgId; }
9468
+ get: function () { return chunkIPWCHJPE_cjs.getPersistedOrgId; }
9460
9469
  });
9461
9470
  Object.defineProperty(exports, "useOrgAdapter", {
9462
9471
  enumerable: true,
9463
- get: function () { return chunkSRIUD35R_cjs.useOrgAdapter; }
9472
+ get: function () { return chunkIPWCHJPE_cjs.useOrgAdapter; }
9464
9473
  });
9465
9474
  Object.defineProperty(exports, "useOrgAdapterOptional", {
9466
9475
  enumerable: true,
9467
- get: function () { return chunkSRIUD35R_cjs.useOrgAdapterOptional; }
9476
+ get: function () { return chunkIPWCHJPE_cjs.useOrgAdapterOptional; }
9468
9477
  });
9469
9478
  Object.defineProperty(exports, "useOrganizationStore", {
9470
9479
  enumerable: true,
9471
- get: function () { return chunkSRIUD35R_cjs.useOrganizationStore; }
9480
+ get: function () { return chunkIPWCHJPE_cjs.useOrganizationStore; }
9472
9481
  });
9473
9482
  Object.defineProperty(exports, "useTenant", {
9474
9483
  enumerable: true,
9475
- get: function () { return chunkSRIUD35R_cjs.useTenant; }
9484
+ get: function () { return chunkIPWCHJPE_cjs.useTenant; }
9476
9485
  });
9477
9486
  Object.defineProperty(exports, "useTenantOptional", {
9478
9487
  enumerable: true,
9479
- get: function () { return chunkSRIUD35R_cjs.useTenantOptional; }
9488
+ get: function () { return chunkIPWCHJPE_cjs.useTenantOptional; }
9480
9489
  });
9481
9490
  Object.defineProperty(exports, "PermissionsProvider", {
9482
9491
  enumerable: true,