@fayz-ai/saas 0.7.0 → 0.8.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 (47) 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/index.cjs +71 -75
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +26 -22
  14. package/dist/index.js.map +1 -1
  15. package/dist/lib/schedule-service.d.ts.map +1 -1
  16. package/dist/org/adapters/supabase.d.ts +9 -1
  17. package/dist/org/adapters/supabase.d.ts.map +1 -1
  18. package/dist/org/index.cjs +10 -10
  19. package/dist/org/index.js +1 -1
  20. package/dist/shell/components/settings/ConnectedUserProfile.d.ts.map +1 -1
  21. package/dist/shell/components/settings/LocationsCrudPage.d.ts.map +1 -1
  22. package/dist/shell/lib/create-client-orders-provider.d.ts.map +1 -1
  23. package/dist/shell/lib/supabase.d.ts +2 -1
  24. package/dist/shell/lib/supabase.d.ts.map +1 -1
  25. package/dist/shell/types/crud.d.ts +1 -1
  26. package/dist/shell/types/crud.d.ts.map +1 -1
  27. package/dist/supabase/client.d.ts +0 -4
  28. package/dist/supabase/client.d.ts.map +1 -1
  29. package/package.json +10 -7
  30. package/src/app/admin-app.tsx +9 -1
  31. package/src/archetype-lookup.ts +2 -5
  32. package/src/crud/archetypes/PersonPicker.tsx +6 -6
  33. package/src/crud/archetypes/SubjectDetailTabs.tsx +2 -2
  34. package/src/env.d.ts +15 -0
  35. package/src/index.ts +0 -2
  36. package/src/lib/schedule-service.ts +2 -1
  37. package/src/org/adapters/supabase.ts +15 -5
  38. package/src/shell/components/settings/ConnectedUserProfile.tsx +3 -6
  39. package/src/shell/components/settings/LocationsCrudPage.ts +0 -1
  40. package/src/shell/lib/create-client-orders-provider.ts +2 -4
  41. package/src/shell/lib/org-adapters/supabase.ts +3 -3
  42. package/src/shell/lib/supabase.ts +5 -3
  43. package/src/shell/stores/theme.store.ts +1 -1
  44. package/src/shell/types/crud.ts +1 -1
  45. package/src/supabase/client.ts +0 -8
  46. package/dist/chunk-DCRT47W4.js.map +0 -1
  47. 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(),
@@ -4521,7 +4521,7 @@ function mergeBlockSettings(metadata, settings) {
4521
4521
  return merged;
4522
4522
  }
4523
4523
  function getTenantId() {
4524
- const id = chunkSRIUD35R_cjs.useOrganizationStore.getState().currentOrg?.id;
4524
+ const id = chunkIPWCHJPE_cjs.useOrganizationStore.getState().currentOrg?.id;
4525
4525
  if (!id) throw new Error("No active tenant");
4526
4526
  return id;
4527
4527
  }
@@ -4533,13 +4533,13 @@ function mapRow(row) {
4533
4533
  return r;
4534
4534
  }
4535
4535
  async function getSchedules(assigneeId, kind = "working_hours") {
4536
- const core = chunkSRIUD35R_cjs.getCoreSchemaClient();
4536
+ const core = chunkIPWCHJPE_cjs.getFayzSupabaseClient();
4537
4537
  const { data, error } = await core.from("schedules").select("*").eq("kind", kind).eq("assignee_id", assigneeId).order("day_of_week").order("starts_at");
4538
4538
  if (error) throw error;
4539
4539
  return (data ?? []).map(mapRow);
4540
4540
  }
4541
4541
  async function replaceWeeklySchedules(assigneeId, week, kind = "working_hours") {
4542
- const core = chunkSRIUD35R_cjs.getCoreSchemaClient();
4542
+ const core = chunkIPWCHJPE_cjs.getFayzSupabaseClient();
4543
4543
  const tenantId = getTenantId();
4544
4544
  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
4545
  if (delErr) throw delErr;
@@ -4577,7 +4577,7 @@ function eachDate(startDate, endDate) {
4577
4577
  return dates;
4578
4578
  }
4579
4579
  async function saveException(input) {
4580
- const core = chunkSRIUD35R_cjs.getCoreSchemaClient();
4580
+ const core = chunkIPWCHJPE_cjs.getFayzSupabaseClient();
4581
4581
  const tenantId = getTenantId();
4582
4582
  const kind = input.kind ?? "working_hours";
4583
4583
  const dates = eachDate(input.startDate, input.endDate);
@@ -4630,7 +4630,7 @@ async function saveException(input) {
4630
4630
  }
4631
4631
  }
4632
4632
  async function deleteException(assigneeId, startDate, endDate, kind = "working_hours") {
4633
- const core = chunkSRIUD35R_cjs.getCoreSchemaClient();
4633
+ const core = chunkIPWCHJPE_cjs.getFayzSupabaseClient();
4634
4634
  const dates = eachDate(startDate, endDate ?? startDate);
4635
4635
  const { error } = await core.from("schedules").delete().eq("assignee_id", assigneeId).eq("kind", kind).in("specific_date", dates);
4636
4636
  if (error) throw error;
@@ -5847,7 +5847,7 @@ function OwnerTab({ item }) {
5847
5847
  setLoading(false);
5848
5848
  return;
5849
5849
  }
5850
- supabase.schema("saas_core").from("persons").select("*").eq("id", tutorId).single().then(({ data }) => {
5850
+ supabase.from("people").select("*").eq("id", tutorId).single().then(({ data }) => {
5851
5851
  setPerson(data);
5852
5852
  setLoading(false);
5853
5853
  }, () => setLoading(false));
@@ -6831,7 +6831,7 @@ function CrudPage({ entityDef: rawEntityDef, useStore, basePath, display, featur
6831
6831
  await store.update(id, { [field]: value });
6832
6832
  }, [store]);
6833
6833
  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);
6834
+ const currentOrgId = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg?.id);
6835
6835
  React2.useEffect(() => {
6836
6836
  if (currentOrgId) store.fetch();
6837
6837
  }, [currentOrgId]);
@@ -7231,7 +7231,6 @@ var locationEntityDef = {
7231
7231
  ],
7232
7232
  data: {
7233
7233
  table: "locations",
7234
- schema: "saas_core",
7235
7234
  tenantScoped: true,
7236
7235
  searchColumns: ["name", "city", "state"],
7237
7236
  defaults: { kind: "branch" }
@@ -7604,8 +7603,8 @@ function extractFieldRules(settings) {
7604
7603
  }
7605
7604
  function ConnectedFieldRulesSettings() {
7606
7605
  const { t } = useTranslation();
7607
- const currentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.currentOrg);
7608
- const setCurrentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.setCurrentOrg);
7606
+ const currentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg);
7607
+ const setCurrentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.setCurrentOrg);
7609
7608
  const adapter2 = useOrgAdapterOptional2();
7610
7609
  const entities = getRegisteredEntities();
7611
7610
  const rules = extractFieldRules(currentOrg?.settings);
@@ -7635,9 +7634,9 @@ function ConnectedFieldRulesSettings() {
7635
7634
  );
7636
7635
  }
7637
7636
  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);
7637
+ const currentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg);
7638
+ const userOrgs = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.userOrgs);
7639
+ const setCurrentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.setCurrentOrg);
7641
7640
  if (!currentOrg) return null;
7642
7641
  const Building = LucideIcons4__namespace.Building2;
7643
7642
  const Chevron = LucideIcons4__namespace.ChevronsUpDown;
@@ -7978,7 +7977,7 @@ function resolveAuthRuntime(config) {
7978
7977
  supabase: {
7979
7978
  url: auth?.supabase?.url ?? config.supabaseUrl,
7980
7979
  anonKey: auth?.supabase?.anonKey ?? config.supabaseAnonKey,
7981
- client: auth?.supabase?.client ?? chunkSRIUD35R_cjs.getFayzSupabaseClientOptional() ?? void 0,
7980
+ client: auth?.supabase?.client ?? chunkIPWCHJPE_cjs.getFayzSupabaseClientOptional() ?? void 0,
7982
7981
  callbackUrl: auth?.supabase?.callbackUrl,
7983
7982
  resetPasswordUrl: auth?.supabase?.resetPasswordUrl
7984
7983
  }
@@ -8016,8 +8015,13 @@ function resolveOrgAdapter(config, authAdapter) {
8016
8015
  name: p.name,
8017
8016
  description: p.description
8018
8017
  }));
8019
- if (strategy === "supabase") return chunkSRIUD35R_cjs.createSupabaseOrgAdapter({ roles: declaredRoles, authAdapter });
8020
- return chunkSRIUD35R_cjs.createMockOrgAdapter(config.permissions?.defaultProfiles);
8018
+ if (strategy === "supabase")
8019
+ return chunkIPWCHJPE_cjs.createSupabaseOrgAdapter({
8020
+ roles: declaredRoles,
8021
+ authAdapter,
8022
+ siteUrl: undefined.VITE_APP_URL
8023
+ });
8024
+ return chunkIPWCHJPE_cjs.createMockOrgAdapter(config.permissions?.defaultProfiles);
8021
8025
  }
8022
8026
  function buildI18nConfig(config) {
8023
8027
  const defaultLocale = config.locale?.default ?? "en";
@@ -8070,10 +8074,10 @@ function ThemeInitializer({ config }) {
8070
8074
  return null;
8071
8075
  }
8072
8076
  function AdminProviders({ config, children }) {
8073
- const currentOrg = chunkSRIUD35R_cjs.useOrganizationStore((s) => s.currentOrg);
8077
+ const currentOrg = chunkIPWCHJPE_cjs.useOrganizationStore((s) => s.currentOrg);
8074
8078
  const resolved = React2__namespace.useMemo(() => {
8075
8079
  if (config.supabaseUrl && config.supabaseAnonKey) {
8076
- chunkSRIUD35R_cjs.createFayzSupabaseClient(config.supabaseUrl, config.supabaseAnonKey);
8080
+ chunkIPWCHJPE_cjs.createFayzSupabaseClient(config.supabaseUrl, config.supabaseAnonKey);
8077
8081
  }
8078
8082
  const i18n = buildI18nConfig(config);
8079
8083
  const authRuntime = resolveAuthRuntime(config);
@@ -8106,7 +8110,7 @@ function AdminProviders({ config, children }) {
8106
8110
  }),
8107
8111
  [resolved.plugins, path, config.layout, currentOrg]
8108
8112
  );
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: [
8113
+ 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
8114
  /* @__PURE__ */ jsxRuntime.jsx(ThemeInitializer, { config }),
8111
8115
  /* @__PURE__ */ jsxRuntime.jsx(BillingInitializer, { config }),
8112
8116
  /* @__PURE__ */ jsxRuntime.jsx(ui.ToastProvider, {}),
@@ -8452,7 +8456,7 @@ function createClientOrdersProvider() {
8452
8456
  const supabase = getSupabaseClientOptional();
8453
8457
  if (!supabase) return { data: [], total: 0 };
8454
8458
  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);
8459
+ let qb = supabase.from("orders").select("id, kind, status, total, reference_number, notes, metadata, created_at", { count: "exact" }).eq("party_id", query.clientId);
8456
8460
  if (query.stages && query.stages.length > 0) {
8457
8461
  const allStages = query.stages.flatMap((s) => STAGE_FILTER_MAP[s] ?? [s]);
8458
8462
  qb = qb.in("status", allStages);
@@ -8465,7 +8469,7 @@ function createClientOrdersProvider() {
8465
8469
  const orderIds = (data ?? []).map((row) => row.id).filter(Boolean);
8466
8470
  const bookingStartsByOrderId = /* @__PURE__ */ new Map();
8467
8471
  if (orderIds.length > 0) {
8468
- const { data: bookings } = await supabase.schema("saas_core").from("bookings").select("order_id, starts_at").in("order_id", orderIds);
8472
+ const { data: bookings } = await supabase.from("appointments").select("order_id, starts_at").in("order_id", orderIds);
8469
8473
  for (const booking of bookings ?? []) {
8470
8474
  if (booking.order_id && booking.starts_at && !bookingStartsByOrderId.has(booking.order_id)) {
8471
8475
  bookingStartsByOrderId.set(booking.order_id, booking.starts_at);
@@ -8496,7 +8500,7 @@ function createClientOrdersProvider() {
8496
8500
  };
8497
8501
  }
8498
8502
  var ARCHETYPE_DISPLAY = {
8499
- person: { table: "persons", labelField: "name", subtitleFields: ["phone"], groupField: "kind" },
8503
+ person: { table: "people", labelField: "name", subtitleFields: ["phone"], groupField: "kind" },
8500
8504
  product: { table: "products", labelField: "name", subtitleFields: ["sku", "description"], priceField: "price" },
8501
8505
  service: { table: "services", labelField: "name", subtitleFields: ["duration_minutes", "description"], priceField: "price" },
8502
8506
  location: { table: "locations", labelField: "name", subtitleFields: ["city", "address"], groupField: "kind" }
@@ -8535,7 +8539,7 @@ function createArchetypeLookup(config) {
8535
8539
  async search(query) {
8536
8540
  const supabase = core.getSupabaseClientOptional();
8537
8541
  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);
8542
+ let qb = supabase.from(display.table).select("*").eq("is_active", true).order(display.labelField, { ascending: true }).limit(limit);
8539
8543
  if (query) qb = qb.ilike(display.labelField, `%${query}%`);
8540
8544
  qb = applyKindFilter(qb);
8541
8545
  const { data } = await qb;
@@ -8546,7 +8550,7 @@ function createArchetypeLookup(config) {
8546
8550
  async list() {
8547
8551
  const supabase = core.getSupabaseClientOptional();
8548
8552
  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);
8553
+ let qb = supabase.from(display.table).select("*").eq("is_active", true).order(display.labelField, { ascending: true }).limit(limit);
8550
8554
  qb = applyKindFilter(qb);
8551
8555
  const { data } = await qb;
8552
8556
  return (data ?? []).map(
@@ -8556,7 +8560,7 @@ function createArchetypeLookup(config) {
8556
8560
  async getById(id) {
8557
8561
  const supabase = core.getSupabaseClientOptional();
8558
8562
  if (!supabase) return null;
8559
- const { data } = await supabase.schema("saas_core").from(display.table).select("*").eq("id", id).single();
8563
+ const { data } = await supabase.from(display.table).select("*").eq("id", id).single();
8560
8564
  return data ? toResult(data, display, config.kindLabels) : null;
8561
8565
  }
8562
8566
  };
@@ -9422,61 +9426,53 @@ function PluginSettingsPanel({ title, subtitle, generalSettings, registries, cus
9422
9426
  ] });
9423
9427
  }
9424
9428
 
9425
- Object.defineProperty(exports, "CORE_SCHEMA", {
9426
- enumerable: true,
9427
- get: function () { return chunkSRIUD35R_cjs.CORE_SCHEMA; }
9428
- });
9429
9429
  Object.defineProperty(exports, "OrgProvider", {
9430
9430
  enumerable: true,
9431
- get: function () { return chunkSRIUD35R_cjs.OrgProvider; }
9431
+ get: function () { return chunkIPWCHJPE_cjs.OrgProvider; }
9432
9432
  });
9433
9433
  Object.defineProperty(exports, "createFayzSupabaseClient", {
9434
9434
  enumerable: true,
9435
- get: function () { return chunkSRIUD35R_cjs.createFayzSupabaseClient; }
9435
+ get: function () { return chunkIPWCHJPE_cjs.createFayzSupabaseClient; }
9436
9436
  });
9437
9437
  Object.defineProperty(exports, "createMockOrgAdapter", {
9438
9438
  enumerable: true,
9439
- get: function () { return chunkSRIUD35R_cjs.createMockOrgAdapter; }
9439
+ get: function () { return chunkIPWCHJPE_cjs.createMockOrgAdapter; }
9440
9440
  });
9441
9441
  Object.defineProperty(exports, "createSupabaseOrgAdapter", {
9442
9442
  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; }
9443
+ get: function () { return chunkIPWCHJPE_cjs.createSupabaseOrgAdapter; }
9448
9444
  });
9449
9445
  Object.defineProperty(exports, "getFayzSupabaseClient", {
9450
9446
  enumerable: true,
9451
- get: function () { return chunkSRIUD35R_cjs.getFayzSupabaseClient; }
9447
+ get: function () { return chunkIPWCHJPE_cjs.getFayzSupabaseClient; }
9452
9448
  });
9453
9449
  Object.defineProperty(exports, "getFayzSupabaseClientOptional", {
9454
9450
  enumerable: true,
9455
- get: function () { return chunkSRIUD35R_cjs.getFayzSupabaseClientOptional; }
9451
+ get: function () { return chunkIPWCHJPE_cjs.getFayzSupabaseClientOptional; }
9456
9452
  });
9457
9453
  Object.defineProperty(exports, "getPersistedOrgId", {
9458
9454
  enumerable: true,
9459
- get: function () { return chunkSRIUD35R_cjs.getPersistedOrgId; }
9455
+ get: function () { return chunkIPWCHJPE_cjs.getPersistedOrgId; }
9460
9456
  });
9461
9457
  Object.defineProperty(exports, "useOrgAdapter", {
9462
9458
  enumerable: true,
9463
- get: function () { return chunkSRIUD35R_cjs.useOrgAdapter; }
9459
+ get: function () { return chunkIPWCHJPE_cjs.useOrgAdapter; }
9464
9460
  });
9465
9461
  Object.defineProperty(exports, "useOrgAdapterOptional", {
9466
9462
  enumerable: true,
9467
- get: function () { return chunkSRIUD35R_cjs.useOrgAdapterOptional; }
9463
+ get: function () { return chunkIPWCHJPE_cjs.useOrgAdapterOptional; }
9468
9464
  });
9469
9465
  Object.defineProperty(exports, "useOrganizationStore", {
9470
9466
  enumerable: true,
9471
- get: function () { return chunkSRIUD35R_cjs.useOrganizationStore; }
9467
+ get: function () { return chunkIPWCHJPE_cjs.useOrganizationStore; }
9472
9468
  });
9473
9469
  Object.defineProperty(exports, "useTenant", {
9474
9470
  enumerable: true,
9475
- get: function () { return chunkSRIUD35R_cjs.useTenant; }
9471
+ get: function () { return chunkIPWCHJPE_cjs.useTenant; }
9476
9472
  });
9477
9473
  Object.defineProperty(exports, "useTenantOptional", {
9478
9474
  enumerable: true,
9479
- get: function () { return chunkSRIUD35R_cjs.useTenantOptional; }
9475
+ get: function () { return chunkIPWCHJPE_cjs.useTenantOptional; }
9480
9476
  });
9481
9477
  Object.defineProperty(exports, "PermissionsProvider", {
9482
9478
  enumerable: true,