@fayz-ai/sdk 0.15.0 → 0.30.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.
@@ -1 +1 @@
1
- {"version":3,"file":"shop.d.ts","sourceRoot":"","sources":["../src/shop.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC5B,eAAe,CAAC,EAAE,8BAA8B,EAAE,CAAA;IAClD,OAAO,CAAC,EAAE,OAAO,KAAK,CAAA;CACvB;AAED;;;;;;;;;;;;;GAaG;AACH,KAAK,mBAAmB,GAAG,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;AAI1D,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI,GAAG,IAAI,CAErF;AAoBD;;;;;GAKG;AACH,UAAU,mBAAmB;IAC3B,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAA;IAC9D,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IACzG,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AAED,kEAAk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iBG;8BAC6B,MAAM,YAAY,MAAM;IAwCxD;;;;;;;OAOG;mCACkC,MAAM;sCAcH,MAAM;;;;;;;;;;;;;;;0BA4BlB;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;uBAe3F,MAAM,SAAS;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;;;;;;;;;;;;;;uBAe7H,MAAM;4BAGD,4BAA4B;;;;;;;;;;;;;;;;;oBAWpC,MAAM;;;;;;;;;;;;;;;;;;;;EAc/B"}
package/dist/shop.js CHANGED
@@ -1,4 +1,4 @@
1
- export { FayzShopError, PRODUCT_METADATA_OVERLAY_DEPRECATION, createFayzShopProvider, resetProductMetadataOverlayDeprecationWarning, setShopAccessTokenResolver, setShopCarrierQuotesResolver, setShopShippingItemsResolver } from './chunk-QLTIO3QK.js';
2
- import './chunk-HA5O3CW7.js';
1
+ export { FayzShopError, PRODUCT_METADATA_OVERLAY_DEPRECATION, createFayzShopProvider, resetProductMetadataOverlayDeprecationWarning, setShopAccessTokenResolver, setShopCarrierQuotesResolver, setShopShippingItemsResolver } from './chunk-BTXIUI4E.js';
2
+ import './chunk-LCW5ZV5S.js';
3
3
  //# sourceMappingURL=shop.js.map
4
4
  //# sourceMappingURL=shop.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE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AAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,EACf,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,MAAM,CAGR;AAkBD,wBAAgB,QAAQ,CAAC,IAAI,GAAE,eAAoB,GAAG,UAAU,CA8F/D"}
package/dist/vite.js CHANGED
@@ -4,6 +4,7 @@ import { createHash } from 'crypto';
4
4
 
5
5
  // src/vite.ts
6
6
  var SW_FILE = "sw.js";
7
+ var HEADERS_FILE = "_headers";
7
8
  var MANIFEST_FILE = "manifest.webmanifest";
8
9
  var ICON_FILE = "icon.svg";
9
10
  var CACHE_PREFIX = "app-shell-";
@@ -115,6 +116,13 @@ self.addEventListener('activate', function (event) {
115
116
  );
116
117
  });
117
118
 
119
+ // The ONLY way to take over early, and it comes from outside. The page asks;
120
+ // if the person says yes, it sends this message. Without it the behaviour is
121
+ // what it always was: install quietly, take over when allowed.
122
+ self.addEventListener('message', function (event) {
123
+ if (event.data === 'skip-waiting') self.skipWaiting();
124
+ });
125
+
118
126
  self.addEventListener('fetch', function (event) {
119
127
  var request = event.request;
120
128
  if (request.method !== 'GET') return;
@@ -158,12 +166,62 @@ function insertAfter(html, anchor, chunk) {
158
166
  ${chunk}${html.slice(at)}`;
159
167
  }
160
168
  function registrationScript(swUrl) {
161
- return `<script>if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${swUrl}').catch(function(){})})}</script>`;
169
+ const source = `
170
+ if ('serviceWorker' in navigator) {
171
+ addEventListener('load', function () {
172
+ navigator.serviceWorker.register('${swUrl}').then(function (reg) {
173
+ var reloading = false;
174
+ navigator.serviceWorker.addEventListener('controllerchange', function () {
175
+ if (reloading) return;
176
+ reloading = true;
177
+ location.reload();
178
+ });
179
+ window.fayzApplyUpdate = function () {
180
+ if (reg.waiting) reg.waiting.postMessage('skip-waiting');
181
+ };
182
+ function announce() {
183
+ // Only when a controller ALREADY exists: without one this is a first
184
+ // visit, the worker is installing for the first time and there is no
185
+ // "new version" to offer \u2014 announcing here would ask someone to
186
+ // reload a page they just opened.
187
+ if (reg.waiting && navigator.serviceWorker.controller) {
188
+ dispatchEvent(new CustomEvent('fayz:update-ready'));
189
+ }
190
+ }
191
+ announce();
192
+ reg.addEventListener('updatefound', function () {
193
+ var sw = reg.installing;
194
+ if (!sw) return;
195
+ sw.addEventListener('statechange', function () {
196
+ if (sw.state === 'installed') announce();
197
+ });
198
+ });
199
+ // A tab left open all day never re-checks the worker on its own. Hourly
200
+ // is cheap (a conditional GET of a few KB) and it is what gets the
201
+ // invitation to the people who never close the browser.
202
+ setInterval(function () { reg.update().catch(function () {}); }, 3600000);
203
+ }).catch(function () {});
204
+ });
205
+ }`.trim();
206
+ return `<script>${source}</script>`;
162
207
  }
163
208
  function isPrecacheable(fileName) {
164
209
  if (fileName === SW_FILE || fileName === MANIFEST_FILE) return false;
165
210
  return !fileName.endsWith(".map") && !fileName.endsWith(".html");
166
211
  }
212
+ function headersSource(base) {
213
+ return [
214
+ `${base}assets/*`,
215
+ " Cache-Control: public, max-age=31536000, immutable",
216
+ "",
217
+ `${base}${SW_FILE}`,
218
+ " Cache-Control: no-cache",
219
+ "",
220
+ `${base}index.html`,
221
+ " Cache-Control: no-cache",
222
+ ""
223
+ ].join("\n");
224
+ }
167
225
  function appShellPwa(root, opts = {}) {
168
226
  const app = identity(root, opts);
169
227
  const themeColor = opts.themeColor ?? DEFAULT_THEME;
@@ -190,6 +248,11 @@ function appShellPwa(root, opts = {}) {
190
248
  fileName: SW_FILE,
191
249
  source: serviceWorkerSource(buildId, shell, precache)
192
250
  });
251
+ this.emitFile({
252
+ type: "asset",
253
+ fileName: HEADERS_FILE,
254
+ source: headersSource(base)
255
+ });
193
256
  this.emitFile({
194
257
  type: "asset",
195
258
  fileName: MANIFEST_FILE,
@@ -394,7 +457,32 @@ function fayzVite(opts = {}) {
394
457
  // (so they're hoisted to its root node_modules) — deduping a transitive
395
458
  // like @tanstack/react-table makes Vite resolve it from the app root,
396
459
  // which fails in local-source mode and 500s the aliased UI source.
397
- dedupe: userDedupe ?? ["react", "react-dom", "zustand", "lucide-react", "react-router-dom", "@supabase/supabase-js", "sonner"],
460
+ //
461
+ // @fullcalendar/* is here for a different reason: plugin-agenda and the
462
+ // app each carry a copy, and only the app's has `premium-common`. Split
463
+ // across two copies, the resource views register their ScrollGrid into a
464
+ // `core` the calendar is not the instance of, and the week grid dies with
465
+ // "No ScrollGrid implementation" — a failure that only surfaces after the
466
+ // dep cache is cleared, so it reads as random.
467
+ dedupe: userDedupe ?? [
468
+ "react",
469
+ "react-dom",
470
+ "zustand",
471
+ "lucide-react",
472
+ "react-router-dom",
473
+ "@supabase/supabase-js",
474
+ "sonner",
475
+ "@fullcalendar/core",
476
+ "@fullcalendar/react",
477
+ "@fullcalendar/daygrid",
478
+ "@fullcalendar/timegrid",
479
+ "@fullcalendar/list",
480
+ "@fullcalendar/interaction",
481
+ "@fullcalendar/premium-common",
482
+ "@fullcalendar/resource",
483
+ "@fullcalendar/resource-daygrid",
484
+ "@fullcalendar/resource-timegrid"
485
+ ],
398
486
  conditions: useLocal ? ["source", "browser", "module", "jsnext:main", "jsnext"] : void 0
399
487
  },
400
488
  optimizeDeps: {
package/dist/vite.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/app-shell-pwa.ts","../src/lib/boot-skeleton.ts","../src/vite.ts"],"names":["identity","lightnessOf","resolve","existsSync","readFileSync","HEAD_ANCHOR","insertAfter"],"mappings":";;;;;AAoCA,IAAM,OAAA,GAAU,OAAA;AAChB,IAAM,aAAA,GAAgB,sBAAA;AACtB,IAAM,SAAA,GAAY,UAAA;AAIlB,IAAM,YAAA,GAAe,YAAA;AAIrB,IAAM,aAAA,GAAgB,SAAA;AACtB,IAAM,kBAAA,GAAqB,SAAA;AAQ3B,SAAS,YAAY,GAAA,EAAqB;AACxC,EAAA,MAAM,MAAM,GAAA,CAAI,IAAA,EAAK,CAAE,OAAA,CAAQ,KAAK,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H,KAAA,EAAO;AAAA,QACL,GAAA,EAAKA,OAAAA,CAAQ,IAAA,EAAM,KAAK,CAAA;AAAA,QACxB,GAAG,YAAA;AAAA,QACH,GAAI,IAAA,CAAK,OAAA,IAAW,EAAC;AAAA,QACrB,GAAK,aAAoD;AAAC,OAC5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MASA,MAAA,EAAQ,cAAc,CAAC,OAAA,EAAS,aAAa,SAAA,EAAW,cAAA,EAAgB,kBAAA,EAAoB,uBAAA,EAAyB,QAAQ,CAAA;AAAA,MAC7H,UAAA,EAAY,WAAW,CAAC,QAAA,EAAU,WAAW,QAAA,EAAU,aAAA,EAAe,QAAQ,CAAA,GAAI;AAAA,KACpF;AAAA,IACA,YAAA,EAAc;AAAA,MACZ,SAAS,QAAA,GAAW,MAAA,CAAO,IAAA,CAAK,YAAY,IAAI,EAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOjD,OAAA,EAAS,QAAA,GAAW,aAAA,CAAc,IAAA,EAAM,cAAc,CAAA,GAAI;AAAA,KAC5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,MAAA,EAAQ;AAAA,MACN,IAAA,EAAM,IAAA;AAAA,MACN,MAAM,IAAA,CAAK,IAAA;AAAA,MACX,YAAY,IAAA,CAAK,UAAA;AAAA,MACjB,IAAA,EAAM,IAAA;AAAA,MACN,YAAA,EAAc,IAAA;AAAA,MACd,OAAA,EAAS;AAAA,QACP,6BAAA,EAA+B,GAAA;AAAA,QAC/B,8BAAA,EAAgC;AAAA,OAClC;AAAA,MACA,IAAI,EAAE,KAAA,EAAO,CAAC,IAAA,EAAM,OAAO,CAAA,EAAE;AAAA,MAC7B,GAAI,IAAA,CAAK,MAAA,IAAU;AAAC;AACtB,GACF;AACF","file":"vite.js","sourcesContent":["import { createHash } from 'node:crypto'\nimport { existsSync, readFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport type { Plugin } from 'vite'\n\n// ---------------------------------------------------------------------------\n// App shell, cached — the second load, and every load after it.\n//\n// The boot screen fixes the blank page; it does not fix the WAIT. A deployed\n// app still fetches its entry chunk over the network every single time, and on\n// a phone on café wifi that is the whole perceived cost of \"opening the app\".\n// A service worker that precaches the build turns the shell into something the\n// device already has: reload is instant, and a dropped connection still gets\n// the app (its own data is another story — see the fetch rules below).\n//\n// Hand-rolled on purpose. What we need is a precache list, a cache name and\n// three event listeners — about a page of JavaScript, against a build-time\n// dependency the preview container would have to cold-install on every start.\n//\n// Build only. A dev server that installs a service worker serves yesterday's\n// bundle to a developer who just saved a file, and the confusion costs more\n// than the caching saves.\n// ---------------------------------------------------------------------------\n\nexport interface AppShellPwaOptions {\n /** Install name. Default: the app's package.json name, de-scoped and titled. */\n name?: string\n /** Home-screen label, ideally ≤12 chars. Default: derived from `name`. */\n shortName?: string\n /** Browser chrome / icon color. Default: the boot screen's neutral rail. */\n themeColor?: string\n /** Splash background while the app boots. Default: the boot screen's page. */\n backgroundColor?: string\n}\n\n/** The emitted file names, at the bundle root (not under assets/). */\nconst SW_FILE = 'sw.js'\nconst MANIFEST_FILE = 'manifest.webmanifest'\nconst ICON_FILE = 'icon.svg'\n\n/** Every cache this SW owns is `<prefix><build id>`, so activate can tell its\n * own stale generations apart from caches belonging to anything else. */\nconst CACHE_PREFIX = 'app-shell-'\n\n// The same neutral defaults the boot screen paints with (see boot-skeleton.ts),\n// so the manifest, the theme-color meta and the first paint agree.\nconst DEFAULT_THEME = '#131c26'\nconst DEFAULT_BACKGROUND = '#f1f1f1'\n\ninterface AppIdentity {\n name: string\n shortName: string\n}\n\n/** Perceived lightness of a hex color, 0-100; non-hex is assumed light. */\nfunction lightnessOf(css: string): number {\n const hex = css.trim().replace('#', '')\n const full = hex.length === 3 ? hex.replace(/./g, (c) => c + c) : hex\n if (!/^[0-9a-f]{6}$/i.test(full)) return 100\n const [r, g, b] = [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16) / 255)\n return ((Math.max(r, g, b) + Math.min(r, g, b)) / 2) * 100\n}\n\nfunction readPackageName(root: string): string | undefined {\n const pkgPath = resolve(root, 'package.json')\n if (!existsSync(pkgPath)) return undefined\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) as { name?: string }\n return pkg.name\n } catch {\n return undefined\n }\n}\n\n/** `@acme/beauty-saas` → `Beauty Saas`. Good enough for a home-screen label,\n * and `name` overrides it whenever the app cares. */\nfunction titleize(pkgName: string): string {\n const bare = pkgName.replace(/^@[^/]+\\//, '')\n return (\n bare\n .split(/[-_.\\s]+/)\n .filter(Boolean)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ') || bare\n )\n}\n\nfunction identity(root: string, opts: AppShellPwaOptions): AppIdentity {\n const pkgName = readPackageName(root)\n const name = opts.name ?? (pkgName ? titleize(pkgName) : 'App')\n const shortName = opts.shortName ?? (name.length <= 12 ? name : name.split(' ')[0].slice(0, 12))\n return { name, shortName }\n}\n\n/** A maskable mark: rounded square in the theme color, app initial on top.\n * The glyph stays well inside the 80% safe zone, so a circular mask on\n * Android does not clip it. PNG sizes are a follow-up. */\nfunction iconSvg(identity: AppIdentity, themeColor: string): string {\n const initial = (identity.name.match(/[a-z0-9]/i)?.[0] ?? 'A').toUpperCase()\n const ink = lightnessOf(themeColor) > 55 ? '#111111' : '#ffffff'\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" width=\"512\" height=\"512\" role=\"img\" aria-label=\"${escapeXml(identity.name)}\">\n<rect width=\"512\" height=\"512\" rx=\"112\" fill=\"${themeColor}\"/>\n<text x=\"256\" y=\"256\" fill=\"${ink}\" font-family=\"system-ui,-apple-system,'Segoe UI',sans-serif\" font-size=\"232\" font-weight=\"600\" text-anchor=\"middle\" dominant-baseline=\"central\">${escapeXml(initial)}</text>\n</svg>\n`\n}\n\nfunction escapeXml(value: string): string {\n return value.replace(/[<>&\"']/g, (c) => `&#${c.charCodeAt(0)};`)\n}\n\nfunction manifestJson(\n identity: AppIdentity,\n base: string,\n themeColor: string,\n backgroundColor: string,\n): string {\n return `${JSON.stringify(\n {\n name: identity.name,\n short_name: identity.shortName,\n start_url: base,\n scope: base,\n display: 'standalone',\n theme_color: themeColor,\n background_color: backgroundColor,\n icons: [\n {\n src: `${base}${ICON_FILE}`,\n sizes: 'any',\n type: 'image/svg+xml',\n purpose: 'any maskable',\n },\n ],\n },\n null,\n 2,\n )}\\n`\n}\n\n/**\n * The worker itself, as plain JS with the build's precache list baked in.\n *\n * Caching rules, in the order the fetch handler applies them:\n * - non-GET, or cross-origin → untouched, the network answers\n * - navigation → network first, cached index.html offline\n * - a precached (hashed) asset → cache first, it can never go stale\n * - anything else same-origin → untouched (API reads/writes land here)\n *\n * The last rule is the important one: Supabase and every other API call goes\n * straight to the network, always. A service worker that answers a data\n * request from cache shows the user a number that is quietly wrong, which is\n * worse than an error.\n *\n * There is no `skipWaiting`. A new build installs in the background and takes\n * over on the NEXT load, so a tab in the middle of a form never has its code\n * swapped underneath it.\n */\nfunction serviceWorkerSource(buildId: string, shell: string, precache: string[]): string {\n return `// Generated by @fayz-ai/sdk at build time. Do not edit.\nconst BUILD_ID = ${JSON.stringify(buildId)};\nconst CACHE = ${JSON.stringify(CACHE_PREFIX)} + BUILD_ID;\nconst SHELL = ${JSON.stringify(shell)};\nconst PRECACHE = ${JSON.stringify(precache, null, 2)};\nconst PRECACHED = new Set(PRECACHE);\n\nself.addEventListener('install', function (event) {\n event.waitUntil(\n caches.open(CACHE).then(function (cache) {\n // One request at a time and forgiving: a single 404 must not void the\n // whole precache the way cache.addAll() would.\n return Promise.all(\n PRECACHE.map(function (url) {\n return cache.add(new Request(url, { cache: 'reload' })).catch(function () {});\n })\n );\n })\n );\n});\n\nself.addEventListener('activate', function (event) {\n event.waitUntil(\n caches\n .keys()\n .then(function (keys) {\n return Promise.all(\n keys\n .filter(function (key) {\n return key.indexOf(${JSON.stringify(CACHE_PREFIX)}) === 0 && key !== CACHE;\n })\n .map(function (key) {\n return caches.delete(key);\n })\n );\n })\n .then(function () {\n return self.clients.claim();\n })\n );\n});\n\nself.addEventListener('fetch', function (event) {\n var request = event.request;\n if (request.method !== 'GET') return;\n var url;\n try {\n url = new URL(request.url);\n } catch (e) {\n return;\n }\n if (url.origin !== self.location.origin) return;\n\n if (request.mode === 'navigate') {\n event.respondWith(\n fetch(request).catch(function () {\n return caches.match(SHELL, { cacheName: CACHE }).then(function (hit) {\n return hit || Response.error();\n });\n })\n );\n return;\n }\n\n // Only the build's own hashed assets, which are immutable by construction.\n // Everything else same-origin (API calls above all) is left to the network.\n if (!PRECACHED.has(url.pathname)) return;\n event.respondWith(\n caches.match(request, { cacheName: CACHE }).then(function (hit) {\n return hit || fetch(request);\n })\n );\n});\n`\n}\n\nconst HEAD_ANCHOR = /<head[^>]*>/i\nconst BODY_END = /<\\/body>/i\n\nfunction insertAfter(html: string, anchor: RegExp, chunk: string): string | null {\n const match = anchor.exec(html)\n if (!match) return null\n const at = match.index + match[0].length\n return `${html.slice(0, at)}\\n${chunk}${html.slice(at)}`\n}\n\nfunction registrationScript(swUrl: string): string {\n return `<script>if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${swUrl}').catch(function(){})})}</script>`\n}\n\n/** What goes in the precache list: the build's own output, minus the things a\n * cache has no use for (sourcemaps, the worker itself, other HTML). */\nfunction isPrecacheable(fileName: string): boolean {\n if (fileName === SW_FILE || fileName === MANIFEST_FILE) return false\n return !fileName.endsWith('.map') && !fileName.endsWith('.html')\n}\n\nexport function appShellPwa(root: string, opts: AppShellPwaOptions = {}): Plugin {\n const app = identity(root, opts)\n const themeColor = opts.themeColor ?? DEFAULT_THEME\n const backgroundColor = opts.backgroundColor ?? DEFAULT_BACKGROUND\n // Deployments under a subpath exist (preview containers, docs sites); every\n // emitted URL is base-relative so `/` is just the common case.\n let base = '/'\n\n return {\n name: 'fayz:app-shell-pwa',\n apply: 'build',\n\n configResolved(config) {\n base = config.base || '/'\n if (!base.endsWith('/')) base += '/'\n },\n\n generateBundle: {\n order: 'post',\n handler(_options, bundle) {\n const precache = Object.keys(bundle)\n .filter(isPrecacheable)\n .sort()\n .map((fileName) => `${base}${fileName}`)\n const shell = `${base}index.html`\n precache.unshift(shell)\n\n // The index.html source joins the hash: its asset names already change\n // per build, but its INLINE content (boot screen, meta) can change on\n // its own, and a shell served from an old cache would be that content.\n const indexAsset = bundle['index.html']\n const indexSource =\n indexAsset && indexAsset.type === 'asset' ? String(indexAsset.source) : ''\n const buildId = createHash('sha256')\n .update(precache.join('\\n'))\n .update(indexSource)\n .digest('hex')\n .slice(0, 12)\n\n this.emitFile({\n type: 'asset',\n fileName: SW_FILE,\n source: serviceWorkerSource(buildId, shell, precache),\n })\n this.emitFile({\n type: 'asset',\n fileName: MANIFEST_FILE,\n source: manifestJson(app, base, themeColor, backgroundColor),\n })\n this.emitFile({ type: 'asset', fileName: ICON_FILE, source: iconSvg(app, themeColor) })\n },\n },\n\n transformIndexHtml: {\n order: 'post',\n handler(html: string) {\n const manifestHref = `${base}${MANIFEST_FILE}`\n const link = /<link[^>]+rel=[\"']?manifest/i.test(html)\n ? ''\n : `<link rel=\"manifest\" href=\"${manifestHref}\" />`\n const script = html.includes('serviceWorker.register')\n ? ''\n : registrationScript(`${base}${SW_FILE}`)\n if (!link && !script) return html\n\n const withLink = link ? (insertAfter(html, HEAD_ANCHOR, link) ?? `${link}\\n${html}`) : html\n if (!script) return withLink\n return BODY_END.test(withLink)\n ? withLink.replace(BODY_END, `${script}\\n</body>`)\n : `${withLink}\\n${script}`\n },\n },\n }\n}\n","import { existsSync, readFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport type { Plugin } from 'vite'\n\n// ---------------------------------------------------------------------------\n// Boot screen — the first thing painted, from the HTML itself.\n//\n// The React boot screen only exists once React exists, and the wait BEFORE that\n// (fetch the entry chunk, parse it, run it) is the long part of a cold load:\n// the page sat blank for most of the wait. Anything that fills that window has\n// to be in the document the server already sent — markup and CSS the browser\n// can paint on its own, with no module graph behind it.\n//\n// What it paints is the THEME BACKGROUND and a spinner in the middle — light in\n// light mode, dark in dark mode. It used to paint the rail's color edge to\n// edge, but a dark splash in front of a light interface reads as a flash, not\n// a hand-off; the surface the app is about to paint is the only color that\n// disappears into it. It is deliberately the SAME image as AppShellSkeleton in\n// @fayz-ai/ui, so the handoff HTML → React → app never swaps anything the eye\n// can catch.\n//\n// The same inline script also resolves the theme mode before first paint, so a\n// dark-mode reload never flashes a light frame while React boots.\n//\n// It dismisses itself the moment React puts anything in #root.\n// ---------------------------------------------------------------------------\n\nexport interface BootSkeletonOptions {\n /**\n * 'admin' additionally seeds the app's stored palette tokens (sidebar) into\n * the document before React paints, so the console's rail mounts in its own\n * color; 'page' skips that; 'none' injects nothing. Both visible surfaces\n * paint the same background-colored screen. Default: 'admin' when the app\n * depends on @fayz-ai/admin or @fayz-ai/saas and not on @fayz-ai/storefront,\n * 'page' otherwise.\n */\n surface?: 'admin' | 'page' | 'none'\n /** @deprecated The boot screen paints the theme background, not the rail.\n * Accepted and ignored. */\n sidebar?: string\n /** Boot background, light mode. */\n background?: string\n /** Boot background, dark mode. */\n backgroundDark?: string\n}\n\n/** localStorage key the admin writes its resolved palette to, so the NEXT boot\n * paints in the app's own colors instead of the neutral default. */\nexport const BOOT_THEME_STORAGE_KEY = 'fayz:boot-theme'\n\n/** localStorage key the admin theme store writes the chosen mode to\n * ('light' | 'dark' | 'system', default 'light'). Duplicated as a literal on\n * both sides — see persistBootPalette in packages/admin/src/theme/utils.ts:\n * the app runtime must not depend on the build-tool package, and this file\n * must not depend on the admin package. */\nexport const THEME_MODE_STORAGE_KEY = 'saas-core:theme-mode'\n\n/** The same thing under @fayz-ai/ui's own theme store, which is what a\n * storefront or member app runs (packages/ui/src/stores/theme.store.ts). */\nexport const UI_THEME_MODE_STORAGE_KEY = 'fayz-ui:theme-mode'\n\n// The light/dark values of `--background` in @fayz-ai/ui — so React's first\n// real paint changes nothing.\nconst DEFAULT_PAGE = '#f1f1f1'\nconst DEFAULT_PAGE_DARK = '#1a1a1a'\n\nconst RING_ON_DARK = ['rgba(255,255,255,.18)', 'rgba(255,255,255,.7)'] as const\nconst RING_ON_LIGHT = ['rgba(0,0,0,.15)', 'rgba(0,0,0,.55)'] as const\n\n/** Perceived lightness of a hex color, 0-100. Non-hex CSS is assumed light —\n * a dark ring on an unknown surface is the safer miss on a white default. */\nfunction lightnessOf(css: string): number {\n const hex = css.trim().replace('#', '')\n const full = hex.length === 3 ? hex.replace(/./g, (c) => c + c) : hex\n if (!/^[0-9a-f]{6}$/i.test(full)) return 100\n const [r, g, b] = [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16) / 255)\n return ((Math.max(r, g, b) + Math.min(r, g, b)) / 2) * 100\n}\n\nfunction ringTones(background: string): readonly [string, string] {\n return lightnessOf(background) > 55 ? RING_ON_LIGHT : RING_ON_DARK\n}\n\nfunction markup(): string {\n return `<div id=\"fayz-boot\" role=\"status\" aria-live=\"polite\" aria-label=\"Carregando\"><span class=\"fb-spin\"></span></div>`\n}\n\n/** The overlay's own CSS. The `.dark` rule makes the screen correct at the\n * very first paint: the inline script sets the class synchronously before\n * the browser draws. The ring is drawn in rgba rather than a theme token,\n * which could land invisible. */\nfunction style(colors: { light: string; dark: string }): string {\n const [ring, ringLit] = ringTones(colors.light)\n const [darkRing, darkRingLit] = ringTones(colors.dark)\n return `<style id=\"fayz-boot-style\">\n#fayz-boot{--fb-bg:${colors.light};--fb-ring:${ring};--fb-ring-lit:${ringLit};position:fixed;inset:0;z-index:2147483000;display:flex;align-items:center;justify-content:center;background:var(--fb-bg);opacity:1;transition:opacity .2s ease}\n.dark #fayz-boot{--fb-bg:${colors.dark};--fb-ring:${darkRing};--fb-ring-lit:${darkRingLit}}\n#fayz-boot[data-leaving]{opacity:0;pointer-events:none}\n#fayz-boot .fb-spin{display:block;width:1.75rem;height:1.75rem;border-radius:9999px;border:2px solid var(--fb-ring);border-top-color:var(--fb-ring-lit);animation:fb-spin .7s linear infinite}\n@keyframes fb-spin{to{transform:rotate(360deg)}}\n@media (prefers-reduced-motion:reduce){#fayz-boot .fb-spin{animation:none;border-top-color:var(--fb-ring)}}\n</style>`\n}\n\n/**\n * Resolves the theme mode, seeds the app's stored palette tokens, then removes\n * the whole thing as soon as React fills #root.\n *\n * The mode has to be resolved HERE and not in React: the class that makes the\n * page dark only exists once the theme store runs, which is a whole module\n * graph too late — the browser has already painted a light frame by then.\n *\n * The MutationObserver is the handoff: no import, no callback the app has to\n * remember to call, and it works for any scaffold. The timeout is the safety\n * net — a boot that never mounts must not leave a fixed overlay on top of\n * whatever error the page is trying to show.\n */\nfunction dismissScript(surface: 'admin' | 'page', colors: { light: string; dark: string }): string {\n // Seed the app's own sidebar tokens before the bundle paints: the console's\n // rail (and the React skeleton's spinner) mount BEFORE the theme effect\n // applies the palette, and the default tokens would flash the wrong colors\n // for one theme-effect's worth of frames. applyTheme overwrites these same\n // inline properties on every boot.\n const paletteSeed =\n surface === 'admin'\n ? `\n try{\n var t=JSON.parse(localStorage.getItem('${BOOT_THEME_STORAGE_KEY}')||'null');\n if(t&&t.sidebar){\n de.style.setProperty('--sidebar',t.sidebar);\n if(t.sidebarForeground)de.style.setProperty('--sidebar-foreground',t.sidebarForeground);\n }\n }catch(e){}`\n : ''\n return `<script>(function(){\n var de=document.documentElement,dark=false;\n try{\n var m=localStorage.getItem('${THEME_MODE_STORAGE_KEY}')||localStorage.getItem('${UI_THEME_MODE_STORAGE_KEY}');\n dark=m==='dark'||(m==='system'&&!!window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches);\n }catch(e){}\n de.classList.toggle('dark',dark);\n de.style.colorScheme=dark?'dark':'light';${paletteSeed}\n var boot=document.getElementById('fayz-boot'),root=document.getElementById('root');\n if(!boot)return;\n var meta=document.querySelector('meta[name=\"theme-color\"]');\n if(meta)meta.setAttribute('content',dark?'${colors.dark}':'${colors.light}');\n var gone=false,drop=function(){\n if(gone)return;gone=true;boot.setAttribute('data-leaving','');\n setTimeout(function(){boot.parentNode&&boot.parentNode.removeChild(boot)},250);\n };\n if(!root){drop();return}\n if(root.childNodes.length){drop();return}\n var mo=new MutationObserver(function(){\n if(!root.childNodes.length)return;\n mo.disconnect();\n (window.requestAnimationFrame||setTimeout)(drop);\n });\n mo.observe(root,{childList:true});\n setTimeout(function(){mo.disconnect();drop()},15000);\n})();</script>`\n}\n\n/** True when the app on disk renders an admin console. */\nfunction looksLikeAdminApp(root: string): boolean {\n const pkgPath = resolve(root, 'package.json')\n if (!existsSync(pkgPath)) return false\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) as {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n }\n const deps = { ...pkg.dependencies, ...pkg.devDependencies }\n if (deps['@fayz-ai/storefront']) return false\n return Boolean(deps['@fayz-ai/admin'] || deps['@fayz-ai/saas'])\n } catch {\n return false\n }\n}\n\n// The head anchor swallows a leading charset meta if there is one: that\n// declaration has to stay inside the document's first 1024 bytes, and the boot\n// style is most of a kilobyte on its own.\nconst HEAD_ANCHOR = /<head[^>]*>(\\s*<meta[^>]+charset[^>]*>)?/i\nconst BODY_ANCHOR = /<body[^>]*>/i\n\n/** Inserts right after the opening tag, so the overlay paints before whatever\n * the template already had in there. */\nfunction insertAfter(html: string, anchor: RegExp, chunk: string): string | null {\n const match = anchor.exec(html)\n if (!match) return null\n const at = match.index + match[0].length\n return `${html.slice(0, at)}\\n${chunk}${html.slice(at)}`\n}\n\nexport function fayzBootSkeleton(root: string, opts: BootSkeletonOptions = {}): Plugin {\n const surface = opts.surface ?? (looksLikeAdminApp(root) ? 'admin' : 'page')\n // Neutral, not a guess at the brand: @fayz-ai/ui's own background values,\n // which is exactly what the app paints next.\n const colors = {\n light: opts.background ?? DEFAULT_PAGE,\n dark: opts.backgroundDark ?? DEFAULT_PAGE_DARK,\n }\n\n return {\n name: 'fayz:boot-skeleton',\n transformIndexHtml: {\n order: 'post',\n handler(html: string) {\n if (surface === 'none') return html\n if (!html.includes('id=\"root\"')) return html\n\n const hasThemeColor = /<meta[^>]+name=[\"']?theme-color/i.test(html)\n const headChunk = hasThemeColor\n ? style(colors)\n : `<meta name=\"theme-color\" content=\"${colors.light}\" />\\n${style(colors)}`\n const bodyChunk = `${markup()}\\n${dismissScript(surface, colors)}`\n\n const withHead = insertAfter(html, HEAD_ANCHOR, headChunk)\n // No <head> in the template: the style rides along at the top of the\n // body, still ahead of the markup it paints.\n const base = withHead ?? html\n const pending = withHead ? bodyChunk : `${headChunk}\\n${bodyChunk}`\n return insertAfter(base, BODY_ANCHOR, pending) ?? `${base}\\n${pending}`\n },\n },\n }\n}\n","import { existsSync, readdirSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport type { UserConfig, PluginOption, AliasOptions } from 'vite'\nimport { appShellPwa, type AppShellPwaOptions } from './lib/app-shell-pwa'\nimport { fayzBootSkeleton, type BootSkeletonOptions } from './lib/boot-skeleton'\n\nexport { BOOT_THEME_STORAGE_KEY, type BootSkeletonOptions } from './lib/boot-skeleton'\nexport { appShellPwa, type AppShellPwaOptions } from './lib/app-shell-pwa'\n\n/**\n * Every `@fayz-ai/*` package in the checkout, as a Vite alias map (root src).\n * Subpaths (e.g. `@fayz-ai/admin/ui`, `@fayz-ai/storefront/catalog`) resolve\n * automatically via Vite's prefix alias matching — the shim files mirror the\n * subpath under `src/`.\n *\n * Read from disk rather than listed, because a hardcoded list is only correct\n * for the version it shipped in and apps run the INSTALLED `fayzVite`, not this\n * one. That is how the `saas` → `admin` rename half-broke the fleet: `admin`\n * was not in 0.9.0's list, so every app resolved it through the workspace to\n * `packages/admin/dist` — a stale build in the middle of an otherwise\n * source-resolved app, which reads as a bug in the code rather than in the\n * setup. A directory listing cannot go stale.\n */\nfunction sdkAliases(sdkDir: string): Record<string, string> {\n const out: Record<string, string> = {}\n for (const group of ['packages', 'plugins']) {\n const dir = resolve(sdkDir, group)\n if (!existsSync(dir)) continue\n for (const name of readdirSync(dir)) {\n const src = resolve(dir, name, 'src')\n // The directory name is the package name minus the scope, for both groups\n // (packages/admin → @fayz-ai/admin, plugins/plugin-crm → …/plugin-crm).\n if (existsSync(resolve(src, 'index.ts'))) out[`@fayz-ai/${name}`] = src\n }\n }\n return out\n}\n\nexport interface FayzViteOptions {\n /** Dev server port. */\n port?: number\n /** Fail instead of incrementing if the port is taken. */\n strictPort?: boolean\n /** Extra app-specific aliases, merged after the SDK aliases. */\n aliases?: Record<string, string>\n /** Extra Vite plugins, appended after @vitejs/plugin-react. */\n plugins?: PluginOption[]\n /**\n * SDK source location, absolute or relative to the app root\n * (default `../../fayz-sdk`).\n *\n * The `FAYZ_SDK_DIR` environment variable OVERRIDES this — see\n * {@link resolveSdkDir}.\n */\n sdkDir?: string\n /** App root directory (default process.cwd()). */\n root?: string\n /**\n * Extra Vite `server` config, merged over the SDK server defaults. The\n * preview-container contract (host/cors/allowedHosts/headers) is applied\n * first, so an override can add e.g. `proxy` without dropping it.\n */\n server?: UserConfig['server']\n /**\n * Extra Vite `resolve` config, merged over the SDK resolve defaults. The SDK\n * alias map / dedupe / conditions win for `@fayz-ai/*` local-source\n * resolution; any other resolve keys (and extra aliases) are merged in.\n */\n resolve?: UserConfig['resolve']\n /**\n * The shell outline painted into index.html, so the wait for the entry chunk\n * is not a blank page. Auto-detected from the app's dependencies; pass\n * `{ surface: 'none' }` to opt out, or colors to match the app's palette on a\n * first-ever visit (later visits reuse the palette the app itself stored).\n */\n bootSkeleton?: BootSkeletonOptions\n /**\n * The built app precaches itself: a service worker + webmanifest emitted at\n * build time, so a deployed app reloads instantly and still opens with no\n * network. On by default, and build-only by construction — the dev server\n * never registers a worker. Pass `false` to opt out, or an object to name\n * the install / set its colors.\n */\n pwa?: boolean | AppShellPwaOptions\n}\n\n/**\n * Shared Vite config for Fayz dogfood apps. Resolves `@fayz-ai/*` from the local\n * SDK source when it is checked out next to the app AND `FAYZ_SDK_SOURCE` is not\n * `published`; otherwise from node_modules (the Fayz editor sandbox / published\n * npm). Apps no longer hand-maintain alias maps or the local-vs-npm guard.\n *\n * import { defineConfig } from 'vite'\n * import react from '@vitejs/plugin-react'\n * import { fayzVite } from '@fayz-ai/sdk/vite'\n * export default defineConfig(fayzVite({ port: 5185, plugins: [react()] }))\n *\n * Where that local source is read from is {@link resolveSdkDir}: `FAYZ_SDK_DIR`\n * beats the `sdkDir` option beats `../../fayz-sdk`.\n *\n * The app passes its own `@vitejs/plugin-react` so `@fayz-ai/sdk` carries no\n * build-tool peer deps (which otherwise choke npm's peer resolution, since sdk\n * sits in every dependency path).\n */\n/** Env var that redirects local-source resolution to another SDK checkout. */\nexport const FAYZ_SDK_DIR_ENV = 'FAYZ_SDK_DIR'\n\n/**\n * Where the local SDK source is, as an absolute path. Resolution order:\n *\n * 1. `FAYZ_SDK_DIR` (env) — wins, absolute or root-relative\n * 2. `sdkDir` (option) — what the app's vite config declares\n * 3. `../../fayz-sdk` — the sibling-checkout convention\n *\n * Env wins deliberately. `sdkDir` lives in the app's COMMITTED vite config, so\n * without an override there was no way to build, dev or `fayz validate` a\n * store against a different SDK tree (a worktree, a release branch) short of\n * editing that committed file or dropping an untracked config shim next to it\n * — which is exactly what the fleet ended up doing. An env var is the one\n * knob a CLI flag and a container can both set without touching the repo.\n *\n * Exported so the CLI and the tests agree on the precedence by construction\n * rather than by comment.\n */\nexport function resolveSdkDir(\n root: string,\n sdkDir?: string,\n env: Record<string, string | undefined> = process.env,\n): string {\n const fromEnv = env[FAYZ_SDK_DIR_ENV]?.trim()\n return resolve(root, fromEnv || sdkDir || '../../fayz-sdk')\n}\n\n/**\n * Bare deps that only ever appear behind a `React.lazy()` inside an @fayz-ai\n * package. See the `optimizeDeps.include` comment below for why they have to be\n * named. Filtered by what is actually installed, because a plugin the app does\n * not carry leaves its deps uninstalled and `include` hard-fails on those.\n */\nconst LAZY_ONLY_DEPS = ['recharts', '@dnd-kit/core', '@dnd-kit/sortable', '@dnd-kit/modifiers', '@dnd-kit/utilities']\n\nfunction installedDeps(root: string, names: string[]): string[] {\n const roots: string[] = []\n for (let dir = root, prev = ''; dir !== prev; prev = dir, dir = resolve(dir, '..')) {\n roots.push(resolve(dir, 'node_modules'))\n }\n return names.filter((name) => roots.some((nm) => existsSync(resolve(nm, name, 'package.json'))))\n}\n\nexport function fayzVite(opts: FayzViteOptions = {}): UserConfig {\n const root = opts.root ?? process.cwd()\n const fayzSdk = resolveSdkDir(root, opts.sdkDir)\n const wantLocal = process.env.FAYZ_SDK_SOURCE !== 'published'\n const localPresent = existsSync(resolve(fayzSdk, 'packages/core/src/index.ts'))\n const useLocal = wantLocal && localPresent\n\n const localAliases = useLocal ? sdkAliases(fayzSdk) : {}\n\n // Pull SDK-owned resolve keys out of any caller override so they can't clobber\n // local-source @fayz-ai/* resolution; the rest of `resolve` is merged in.\n const { alias: userAlias, dedupe: userDedupe, conditions: _ignore, ...restResolve } =\n (opts.resolve ?? {}) as Exclude<UserConfig['resolve'], undefined>\n\n const pwa = opts.pwa ?? true\n // The install colors follow the boot screen's, so the splash, the browser\n // chrome and the first paint are one surface rather than three guesses.\n const pwaPlugins =\n pwa === false\n ? []\n : [\n appShellPwa(root, {\n themeColor: opts.bootSkeleton?.sidebar ?? opts.bootSkeleton?.background,\n backgroundColor: opts.bootSkeleton?.background ?? opts.bootSkeleton?.sidebar,\n ...(pwa === true ? {} : pwa),\n }),\n ]\n\n return {\n plugins: [...(opts.plugins ?? []), fayzBootSkeleton(root, opts.bootSkeleton), ...pwaPlugins],\n envPrefix: ['VITE_', 'PUBLIC_'],\n resolve: {\n ...restResolve,\n alias: {\n '@': resolve(root, 'src'),\n ...localAliases,\n ...(opts.aliases ?? {}),\n ...((userAlias as Record<string, string> | undefined) ?? {}),\n } as AliasOptions,\n // lucide-react is a direct dep of both the app and every @fayz-ai/*\n // package; without dedupe a version skew installs two copies and esbuild\n // pre-bundles each barrel separately (~1,500 icon modules each).\n // Collapsing to one copy is the single biggest cut to the editor-container\n // optimize RAM/CPU spike. Only dedupe deps the *app* directly depends on\n // (so they're hoisted to its root node_modules) — deduping a transitive\n // like @tanstack/react-table makes Vite resolve it from the app root,\n // which fails in local-source mode and 500s the aliased UI source.\n dedupe: userDedupe ?? ['react', 'react-dom', 'zustand', 'lucide-react', 'react-router-dom', '@supabase/supabase-js', 'sonner'],\n conditions: useLocal ? ['source', 'browser', 'module', 'jsnext:main', 'jsnext'] : undefined,\n },\n optimizeDeps: {\n exclude: useLocal ? Object.keys(localAliases) : [],\n // Excluding @fayz-ai/* also hides THEIR bare deps from Vite's initial\n // scan. A dep that first appears behind a React.lazy() is then discovered\n // at click time, and the re-optimize that follows kills the very imports\n // that triggered it — the screen fails with \"Failed to fetch dynamically\n // imported module\" (recharts: every chart at once; @dnd-kit: the forms\n // builder). Naming them keeps the exclude that keeps SDK source hot.\n include: useLocal ? installedDeps(root, LAZY_ONLY_DEPS) : undefined,\n },\n // The preview-container runtime contract: Vite's host-check 403s any\n // non-local Host (browser iframe via Caddy, health probe via\n // host.docker.internal) unless allowedHosts is set. host/cors/headers keep\n // the proxied iframe + cross-origin asset fetches working. Owned here\n // because the app's vite.config has no literal `server: {` for the\n // container's text patchers to anchor on. Caller `server` merges last.\n server: {\n host: true,\n port: opts.port,\n strictPort: opts.strictPort,\n cors: true,\n allowedHosts: true,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Cross-Origin-Resource-Policy': 'cross-origin',\n },\n fs: { allow: [root, fayzSdk] },\n ...(opts.server ?? {}),\n },\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/app-shell-pwa.ts","../src/lib/boot-skeleton.ts","../src/vite.ts"],"names":["identity","lightnessOf","resolve","existsSync","readFileSync","HEAD_ANCHOR","insertAfter"],"mappings":";;;;;AAoCA,IAAM,OAAA,GAAU,OAAA;AAChB,IAAM,YAAA,GAAe,UAAA;AACrB,IAAM,aAAA,GAAgB,sBAAA;AACtB,IAAM,SAAA,GAAY,UAAA;AAIlB,IAAM,YAAA,GAAe,YAAA;AAI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, readFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport type { Plugin } from 'vite'\n\n// ---------------------------------------------------------------------------\n// App shell, cached — the second load, and every load after it.\n//\n// The boot screen fixes the blank page; it does not fix the WAIT. A deployed\n// app still fetches its entry chunk over the network every single time, and on\n// a phone on café wifi that is the whole perceived cost of \"opening the app\".\n// A service worker that precaches the build turns the shell into something the\n// device already has: reload is instant, and a dropped connection still gets\n// the app (its own data is another story — see the fetch rules below).\n//\n// Hand-rolled on purpose. What we need is a precache list, a cache name and\n// three event listeners — about a page of JavaScript, against a build-time\n// dependency the preview container would have to cold-install on every start.\n//\n// Build only. A dev server that installs a service worker serves yesterday's\n// bundle to a developer who just saved a file, and the confusion costs more\n// than the caching saves.\n// ---------------------------------------------------------------------------\n\nexport interface AppShellPwaOptions {\n /** Install name. Default: the app's package.json name, de-scoped and titled. */\n name?: string\n /** Home-screen label, ideally ≤12 chars. Default: derived from `name`. */\n shortName?: string\n /** Browser chrome / icon color. Default: the boot screen's neutral rail. */\n themeColor?: string\n /** Splash background while the app boots. Default: the boot screen's page. */\n backgroundColor?: string\n}\n\n/** The emitted file names, at the bundle root (not under assets/). */\nconst SW_FILE = 'sw.js'\nconst HEADERS_FILE = '_headers'\nconst MANIFEST_FILE = 'manifest.webmanifest'\nconst ICON_FILE = 'icon.svg'\n\n/** Every cache this SW owns is `<prefix><build id>`, so activate can tell its\n * own stale generations apart from caches belonging to anything else. */\nconst CACHE_PREFIX = 'app-shell-'\n\n// The same neutral defaults the boot screen paints with (see boot-skeleton.ts),\n// so the manifest, the theme-color meta and the first paint agree.\nconst DEFAULT_THEME = '#131c26'\nconst DEFAULT_BACKGROUND = '#f1f1f1'\n\ninterface AppIdentity {\n name: string\n shortName: string\n}\n\n/** Perceived lightness of a hex color, 0-100; non-hex is assumed light. */\nfunction lightnessOf(css: string): number {\n const hex = css.trim().replace('#', '')\n const full = hex.length === 3 ? hex.replace(/./g, (c) => c + c) : hex\n if (!/^[0-9a-f]{6}$/i.test(full)) return 100\n const [r, g, b] = [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16) / 255)\n return ((Math.max(r, g, b) + Math.min(r, g, b)) / 2) * 100\n}\n\nfunction readPackageName(root: string): string | undefined {\n const pkgPath = resolve(root, 'package.json')\n if (!existsSync(pkgPath)) return undefined\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) as { name?: string }\n return pkg.name\n } catch {\n return undefined\n }\n}\n\n/** `@acme/beauty-saas` → `Beauty Saas`. Good enough for a home-screen label,\n * and `name` overrides it whenever the app cares. */\nfunction titleize(pkgName: string): string {\n const bare = pkgName.replace(/^@[^/]+\\//, '')\n return (\n bare\n .split(/[-_.\\s]+/)\n .filter(Boolean)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ') || bare\n )\n}\n\nfunction identity(root: string, opts: AppShellPwaOptions): AppIdentity {\n const pkgName = readPackageName(root)\n const name = opts.name ?? (pkgName ? titleize(pkgName) : 'App')\n const shortName = opts.shortName ?? (name.length <= 12 ? name : name.split(' ')[0].slice(0, 12))\n return { name, shortName }\n}\n\n/** A maskable mark: rounded square in the theme color, app initial on top.\n * The glyph stays well inside the 80% safe zone, so a circular mask on\n * Android does not clip it. PNG sizes are a follow-up. */\nfunction iconSvg(identity: AppIdentity, themeColor: string): string {\n const initial = (identity.name.match(/[a-z0-9]/i)?.[0] ?? 'A').toUpperCase()\n const ink = lightnessOf(themeColor) > 55 ? '#111111' : '#ffffff'\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" width=\"512\" height=\"512\" role=\"img\" aria-label=\"${escapeXml(identity.name)}\">\n<rect width=\"512\" height=\"512\" rx=\"112\" fill=\"${themeColor}\"/>\n<text x=\"256\" y=\"256\" fill=\"${ink}\" font-family=\"system-ui,-apple-system,'Segoe UI',sans-serif\" font-size=\"232\" font-weight=\"600\" text-anchor=\"middle\" dominant-baseline=\"central\">${escapeXml(initial)}</text>\n</svg>\n`\n}\n\nfunction escapeXml(value: string): string {\n return value.replace(/[<>&\"']/g, (c) => `&#${c.charCodeAt(0)};`)\n}\n\nfunction manifestJson(\n identity: AppIdentity,\n base: string,\n themeColor: string,\n backgroundColor: string,\n): string {\n return `${JSON.stringify(\n {\n name: identity.name,\n short_name: identity.shortName,\n start_url: base,\n scope: base,\n display: 'standalone',\n theme_color: themeColor,\n background_color: backgroundColor,\n icons: [\n {\n src: `${base}${ICON_FILE}`,\n sizes: 'any',\n type: 'image/svg+xml',\n purpose: 'any maskable',\n },\n ],\n },\n null,\n 2,\n )}\\n`\n}\n\n/**\n * The worker itself, as plain JS with the build's precache list baked in.\n *\n * Caching rules, in the order the fetch handler applies them:\n * - non-GET, or cross-origin → untouched, the network answers\n * - navigation → network first, cached index.html offline\n * - a precached (hashed) asset → cache first, it can never go stale\n * - anything else same-origin → untouched (API reads/writes land here)\n *\n * The last rule is the important one: Supabase and every other API call goes\n * straight to the network, always. A service worker that answers a data\n * request from cache shows the user a number that is quietly wrong, which is\n * worse than an error.\n *\n * ── a troca de versão ──────────────────────────────────────────────────────\n *\n * There is no UNCONDITIONAL `skipWaiting`, and that part was right: a tab in\n * the middle of a form must never have its code swapped underneath it.\n *\n * What was wrong is what came with it. Without skipWaiting the new worker sits\n * in `waiting` until every tab of the origin is CLOSED — not reloaded, closed.\n * F5 on a controlled page does not replace the worker. So a deploy reached the\n * edge and did not reach the person, and the only gesture they knew that did\n * replace it was \"clear the browser cache\", because that unregisters the\n * worker. We were teaching non-technical users to clear site data on every\n * release.\n *\n * So the worker now skips waiting ON REQUEST — `postMessage('skip-waiting')`\n * — and the page asks first. The decision is the person's, taken in one click,\n * with the form still on screen. It is the Workbox pattern, and it is the only\n * one that keeps both halves: no silent swap, no cache ritual.\n */\nfunction serviceWorkerSource(buildId: string, shell: string, precache: string[]): string {\n return `// Generated by @fayz-ai/sdk at build time. Do not edit.\nconst BUILD_ID = ${JSON.stringify(buildId)};\nconst CACHE = ${JSON.stringify(CACHE_PREFIX)} + BUILD_ID;\nconst SHELL = ${JSON.stringify(shell)};\nconst PRECACHE = ${JSON.stringify(precache, null, 2)};\nconst PRECACHED = new Set(PRECACHE);\n\nself.addEventListener('install', function (event) {\n event.waitUntil(\n caches.open(CACHE).then(function (cache) {\n // One request at a time and forgiving: a single 404 must not void the\n // whole precache the way cache.addAll() would.\n return Promise.all(\n PRECACHE.map(function (url) {\n return cache.add(new Request(url, { cache: 'reload' })).catch(function () {});\n })\n );\n })\n );\n});\n\nself.addEventListener('activate', function (event) {\n event.waitUntil(\n caches\n .keys()\n .then(function (keys) {\n return Promise.all(\n keys\n .filter(function (key) {\n return key.indexOf(${JSON.stringify(CACHE_PREFIX)}) === 0 && key !== CACHE;\n })\n .map(function (key) {\n return caches.delete(key);\n })\n );\n })\n .then(function () {\n return self.clients.claim();\n })\n );\n});\n\n// The ONLY way to take over early, and it comes from outside. The page asks;\n// if the person says yes, it sends this message. Without it the behaviour is\n// what it always was: install quietly, take over when allowed.\nself.addEventListener('message', function (event) {\n if (event.data === 'skip-waiting') self.skipWaiting();\n});\n\nself.addEventListener('fetch', function (event) {\n var request = event.request;\n if (request.method !== 'GET') return;\n var url;\n try {\n url = new URL(request.url);\n } catch (e) {\n return;\n }\n if (url.origin !== self.location.origin) return;\n\n if (request.mode === 'navigate') {\n event.respondWith(\n fetch(request).catch(function () {\n return caches.match(SHELL, { cacheName: CACHE }).then(function (hit) {\n return hit || Response.error();\n });\n })\n );\n return;\n }\n\n // Only the build's own hashed assets, which are immutable by construction.\n // Everything else same-origin (API calls above all) is left to the network.\n if (!PRECACHED.has(url.pathname)) return;\n event.respondWith(\n caches.match(request, { cacheName: CACHE }).then(function (hit) {\n return hit || fetch(request);\n })\n );\n});\n`\n}\n\nconst HEAD_ANCHOR = /<head[^>]*>/i\nconst BODY_END = /<\\/body>/i\n\nfunction insertAfter(html: string, anchor: RegExp, chunk: string): string | null {\n const match = anchor.exec(html)\n if (!match) return null\n const at = match.index + match[0].length\n return `${html.slice(0, at)}\\n${chunk}${html.slice(at)}`\n}\n\n/**\n * Registra o worker E avisa a página quando há versão nova esperando.\n *\n * O aviso é um `CustomEvent` no `window`, não um import: este script é uma\n * tag inline no HTML, roda antes de qualquer bundle, e não pode depender de\n * React nem de nada que o app monte depois. Quem quiser desenhar o convite\n * escuta `fayz:update-ready`; quem não escutar não ganha comportamento\n * nenhum — a versão nova continua entrando na próxima visita, como antes.\n *\n * `window.fayzApplyUpdate()` é a outra metade: manda o worker assumir e\n * recarrega quando ele assumir. Recarregar no `controllerchange` e não no\n * clique é o que garante que a página que volta é a NOVA — recarregar antes\n * pega o worker velho de novo e o convite reaparece, que é a falha que faz o\n * usuário clicar três vezes e desistir.\n *\n * `reloading` existe porque o Chrome dispara `controllerchange` mais de uma\n * vez quando há abas irmãs, e dois `location.reload()` numa mesma navegação\n * deixam a aba piscando.\n */\nfunction registrationScript(swUrl: string): string {\n const source = `\nif ('serviceWorker' in navigator) {\n addEventListener('load', function () {\n navigator.serviceWorker.register('${swUrl}').then(function (reg) {\n var reloading = false;\n navigator.serviceWorker.addEventListener('controllerchange', function () {\n if (reloading) return;\n reloading = true;\n location.reload();\n });\n window.fayzApplyUpdate = function () {\n if (reg.waiting) reg.waiting.postMessage('skip-waiting');\n };\n function announce() {\n // Only when a controller ALREADY exists: without one this is a first\n // visit, the worker is installing for the first time and there is no\n // \"new version\" to offer — announcing here would ask someone to\n // reload a page they just opened.\n if (reg.waiting && navigator.serviceWorker.controller) {\n dispatchEvent(new CustomEvent('fayz:update-ready'));\n }\n }\n announce();\n reg.addEventListener('updatefound', function () {\n var sw = reg.installing;\n if (!sw) return;\n sw.addEventListener('statechange', function () {\n if (sw.state === 'installed') announce();\n });\n });\n // A tab left open all day never re-checks the worker on its own. Hourly\n // is cheap (a conditional GET of a few KB) and it is what gets the\n // invitation to the people who never close the browser.\n setInterval(function () { reg.update().catch(function () {}); }, 3600000);\n }).catch(function () {});\n });\n}`.trim()\n return `<script>${source}</script>`\n}\n\n/** What goes in the precache list: the build's own output, minus the things a\n * cache has no use for (sourcemaps, the worker itself, other HTML). */\nfunction isPrecacheable(fileName: string): boolean {\n if (fileName === SW_FILE || fileName === MANIFEST_FILE) return false\n return !fileName.endsWith('.map') && !fileName.endsWith('.html')\n}\n\n\n/**\n * The HOST's cache rules, which the worker alone cannot reach.\n *\n * Cloudflare (Pages and Workers Static Assets) reads `_headers` from the\n * published directory. Without one the default is `max-age=0,\n * must-revalidate` for EVERYTHING — including `/assets/app-BzniUHZd.js`,\n * whose name carries the hash of its content and therefore can never change\n * content. The result is revalidating several megabytes on every load, for\n * nothing, to confirm what the name already proved.\n *\n * The inverse is what has to stay volatile:\n *\n * index.html is the map to the build's hashes; serving it stale serves\n * the whole stale build, and is the one way a deploy fails to\n * reach someone who has visited before.\n * sw.js is what replaces the worker. Cached, a new version would\n * never be discovered. (Browsers already cap this one at 24h\n * on their own; saying `no-cache` removes the doubt.)\n */\nfunction headersSource(base: string): string {\n return [\n `${base}assets/*`,\n ' Cache-Control: public, max-age=31536000, immutable',\n '',\n `${base}${SW_FILE}`,\n ' Cache-Control: no-cache',\n '',\n `${base}index.html`,\n ' Cache-Control: no-cache',\n '',\n ].join('\\n')\n}\n\nexport function appShellPwa(root: string, opts: AppShellPwaOptions = {}): Plugin {\n const app = identity(root, opts)\n const themeColor = opts.themeColor ?? DEFAULT_THEME\n const backgroundColor = opts.backgroundColor ?? DEFAULT_BACKGROUND\n // Deployments under a subpath exist (preview containers, docs sites); every\n // emitted URL is base-relative so `/` is just the common case.\n let base = '/'\n\n return {\n name: 'fayz:app-shell-pwa',\n apply: 'build',\n\n configResolved(config) {\n base = config.base || '/'\n if (!base.endsWith('/')) base += '/'\n },\n\n generateBundle: {\n order: 'post',\n handler(_options, bundle) {\n const precache = Object.keys(bundle)\n .filter(isPrecacheable)\n .sort()\n .map((fileName) => `${base}${fileName}`)\n const shell = `${base}index.html`\n precache.unshift(shell)\n\n // The index.html source joins the hash: its asset names already change\n // per build, but its INLINE content (boot screen, meta) can change on\n // its own, and a shell served from an old cache would be that content.\n const indexAsset = bundle['index.html']\n const indexSource =\n indexAsset && indexAsset.type === 'asset' ? String(indexAsset.source) : ''\n const buildId = createHash('sha256')\n .update(precache.join('\\n'))\n .update(indexSource)\n .digest('hex')\n .slice(0, 12)\n\n this.emitFile({\n type: 'asset',\n fileName: SW_FILE,\n source: serviceWorkerSource(buildId, shell, precache),\n })\n this.emitFile({\n type: 'asset',\n fileName: HEADERS_FILE,\n source: headersSource(base),\n })\n this.emitFile({\n type: 'asset',\n fileName: MANIFEST_FILE,\n source: manifestJson(app, base, themeColor, backgroundColor),\n })\n this.emitFile({ type: 'asset', fileName: ICON_FILE, source: iconSvg(app, themeColor) })\n },\n },\n\n transformIndexHtml: {\n order: 'post',\n handler(html: string) {\n const manifestHref = `${base}${MANIFEST_FILE}`\n const link = /<link[^>]+rel=[\"']?manifest/i.test(html)\n ? ''\n : `<link rel=\"manifest\" href=\"${manifestHref}\" />`\n const script = html.includes('serviceWorker.register')\n ? ''\n : registrationScript(`${base}${SW_FILE}`)\n if (!link && !script) return html\n\n const withLink = link ? (insertAfter(html, HEAD_ANCHOR, link) ?? `${link}\\n${html}`) : html\n if (!script) return withLink\n return BODY_END.test(withLink)\n ? withLink.replace(BODY_END, `${script}\\n</body>`)\n : `${withLink}\\n${script}`\n },\n },\n }\n}\n","import { existsSync, readFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport type { Plugin } from 'vite'\n\n// ---------------------------------------------------------------------------\n// Boot screen — the first thing painted, from the HTML itself.\n//\n// The React boot screen only exists once React exists, and the wait BEFORE that\n// (fetch the entry chunk, parse it, run it) is the long part of a cold load:\n// the page sat blank for most of the wait. Anything that fills that window has\n// to be in the document the server already sent — markup and CSS the browser\n// can paint on its own, with no module graph behind it.\n//\n// What it paints is the THEME BACKGROUND and a spinner in the middle — light in\n// light mode, dark in dark mode. It used to paint the rail's color edge to\n// edge, but a dark splash in front of a light interface reads as a flash, not\n// a hand-off; the surface the app is about to paint is the only color that\n// disappears into it. It is deliberately the SAME image as AppShellSkeleton in\n// @fayz-ai/ui, so the handoff HTML → React → app never swaps anything the eye\n// can catch.\n//\n// The same inline script also resolves the theme mode before first paint, so a\n// dark-mode reload never flashes a light frame while React boots.\n//\n// It dismisses itself the moment React puts anything in #root.\n// ---------------------------------------------------------------------------\n\nexport interface BootSkeletonOptions {\n /**\n * 'admin' additionally seeds the app's stored palette tokens (sidebar) into\n * the document before React paints, so the console's rail mounts in its own\n * color; 'page' skips that; 'none' injects nothing. Both visible surfaces\n * paint the same background-colored screen. Default: 'admin' when the app\n * depends on @fayz-ai/admin or @fayz-ai/saas and not on @fayz-ai/storefront,\n * 'page' otherwise.\n */\n surface?: 'admin' | 'page' | 'none'\n /** @deprecated The boot screen paints the theme background, not the rail.\n * Accepted and ignored. */\n sidebar?: string\n /** Boot background, light mode. */\n background?: string\n /** Boot background, dark mode. */\n backgroundDark?: string\n}\n\n/** localStorage key the admin writes its resolved palette to, so the NEXT boot\n * paints in the app's own colors instead of the neutral default. */\nexport const BOOT_THEME_STORAGE_KEY = 'fayz:boot-theme'\n\n/** localStorage key the admin theme store writes the chosen mode to\n * ('light' | 'dark' | 'system', default 'light'). Duplicated as a literal on\n * both sides — see persistBootPalette in packages/admin/src/theme/utils.ts:\n * the app runtime must not depend on the build-tool package, and this file\n * must not depend on the admin package. */\nexport const THEME_MODE_STORAGE_KEY = 'saas-core:theme-mode'\n\n/** The same thing under @fayz-ai/ui's own theme store, which is what a\n * storefront or member app runs (packages/ui/src/stores/theme.store.ts). */\nexport const UI_THEME_MODE_STORAGE_KEY = 'fayz-ui:theme-mode'\n\n// The light/dark values of `--background` in @fayz-ai/ui — so React's first\n// real paint changes nothing.\nconst DEFAULT_PAGE = '#f1f1f1'\nconst DEFAULT_PAGE_DARK = '#1a1a1a'\n\nconst RING_ON_DARK = ['rgba(255,255,255,.18)', 'rgba(255,255,255,.7)'] as const\nconst RING_ON_LIGHT = ['rgba(0,0,0,.15)', 'rgba(0,0,0,.55)'] as const\n\n/** Perceived lightness of a hex color, 0-100. Non-hex CSS is assumed light —\n * a dark ring on an unknown surface is the safer miss on a white default. */\nfunction lightnessOf(css: string): number {\n const hex = css.trim().replace('#', '')\n const full = hex.length === 3 ? hex.replace(/./g, (c) => c + c) : hex\n if (!/^[0-9a-f]{6}$/i.test(full)) return 100\n const [r, g, b] = [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16) / 255)\n return ((Math.max(r, g, b) + Math.min(r, g, b)) / 2) * 100\n}\n\nfunction ringTones(background: string): readonly [string, string] {\n return lightnessOf(background) > 55 ? RING_ON_LIGHT : RING_ON_DARK\n}\n\nfunction markup(): string {\n return `<div id=\"fayz-boot\" role=\"status\" aria-live=\"polite\" aria-label=\"Carregando\"><span class=\"fb-spin\"></span></div>`\n}\n\n/** The overlay's own CSS. The `.dark` rule makes the screen correct at the\n * very first paint: the inline script sets the class synchronously before\n * the browser draws. The ring is drawn in rgba rather than a theme token,\n * which could land invisible. */\nfunction style(colors: { light: string; dark: string }): string {\n const [ring, ringLit] = ringTones(colors.light)\n const [darkRing, darkRingLit] = ringTones(colors.dark)\n return `<style id=\"fayz-boot-style\">\n#fayz-boot{--fb-bg:${colors.light};--fb-ring:${ring};--fb-ring-lit:${ringLit};position:fixed;inset:0;z-index:2147483000;display:flex;align-items:center;justify-content:center;background:var(--fb-bg);opacity:1;transition:opacity .2s ease}\n.dark #fayz-boot{--fb-bg:${colors.dark};--fb-ring:${darkRing};--fb-ring-lit:${darkRingLit}}\n#fayz-boot[data-leaving]{opacity:0;pointer-events:none}\n#fayz-boot .fb-spin{display:block;width:1.75rem;height:1.75rem;border-radius:9999px;border:2px solid var(--fb-ring);border-top-color:var(--fb-ring-lit);animation:fb-spin .7s linear infinite}\n@keyframes fb-spin{to{transform:rotate(360deg)}}\n@media (prefers-reduced-motion:reduce){#fayz-boot .fb-spin{animation:none;border-top-color:var(--fb-ring)}}\n</style>`\n}\n\n/**\n * Resolves the theme mode, seeds the app's stored palette tokens, then removes\n * the whole thing as soon as React fills #root.\n *\n * The mode has to be resolved HERE and not in React: the class that makes the\n * page dark only exists once the theme store runs, which is a whole module\n * graph too late — the browser has already painted a light frame by then.\n *\n * The MutationObserver is the handoff: no import, no callback the app has to\n * remember to call, and it works for any scaffold. The timeout is the safety\n * net — a boot that never mounts must not leave a fixed overlay on top of\n * whatever error the page is trying to show.\n */\nfunction dismissScript(surface: 'admin' | 'page', colors: { light: string; dark: string }): string {\n // Seed the app's own sidebar tokens before the bundle paints: the console's\n // rail (and the React skeleton's spinner) mount BEFORE the theme effect\n // applies the palette, and the default tokens would flash the wrong colors\n // for one theme-effect's worth of frames. applyTheme overwrites these same\n // inline properties on every boot.\n const paletteSeed =\n surface === 'admin'\n ? `\n try{\n var t=JSON.parse(localStorage.getItem('${BOOT_THEME_STORAGE_KEY}')||'null');\n if(t&&t.sidebar){\n de.style.setProperty('--sidebar',t.sidebar);\n if(t.sidebarForeground)de.style.setProperty('--sidebar-foreground',t.sidebarForeground);\n }\n }catch(e){}`\n : ''\n return `<script>(function(){\n var de=document.documentElement,dark=false;\n try{\n var m=localStorage.getItem('${THEME_MODE_STORAGE_KEY}')||localStorage.getItem('${UI_THEME_MODE_STORAGE_KEY}');\n dark=m==='dark'||(m==='system'&&!!window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches);\n }catch(e){}\n de.classList.toggle('dark',dark);\n de.style.colorScheme=dark?'dark':'light';${paletteSeed}\n var boot=document.getElementById('fayz-boot'),root=document.getElementById('root');\n if(!boot)return;\n var meta=document.querySelector('meta[name=\"theme-color\"]');\n if(meta)meta.setAttribute('content',dark?'${colors.dark}':'${colors.light}');\n var gone=false,drop=function(){\n if(gone)return;gone=true;boot.setAttribute('data-leaving','');\n setTimeout(function(){boot.parentNode&&boot.parentNode.removeChild(boot)},250);\n };\n if(!root){drop();return}\n if(root.childNodes.length){drop();return}\n var mo=new MutationObserver(function(){\n if(!root.childNodes.length)return;\n mo.disconnect();\n (window.requestAnimationFrame||setTimeout)(drop);\n });\n mo.observe(root,{childList:true});\n setTimeout(function(){mo.disconnect();drop()},15000);\n})();</script>`\n}\n\n/** True when the app on disk renders an admin console. */\nfunction looksLikeAdminApp(root: string): boolean {\n const pkgPath = resolve(root, 'package.json')\n if (!existsSync(pkgPath)) return false\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) as {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n }\n const deps = { ...pkg.dependencies, ...pkg.devDependencies }\n if (deps['@fayz-ai/storefront']) return false\n return Boolean(deps['@fayz-ai/admin'] || deps['@fayz-ai/saas'])\n } catch {\n return false\n }\n}\n\n// The head anchor swallows a leading charset meta if there is one: that\n// declaration has to stay inside the document's first 1024 bytes, and the boot\n// style is most of a kilobyte on its own.\nconst HEAD_ANCHOR = /<head[^>]*>(\\s*<meta[^>]+charset[^>]*>)?/i\nconst BODY_ANCHOR = /<body[^>]*>/i\n\n/** Inserts right after the opening tag, so the overlay paints before whatever\n * the template already had in there. */\nfunction insertAfter(html: string, anchor: RegExp, chunk: string): string | null {\n const match = anchor.exec(html)\n if (!match) return null\n const at = match.index + match[0].length\n return `${html.slice(0, at)}\\n${chunk}${html.slice(at)}`\n}\n\nexport function fayzBootSkeleton(root: string, opts: BootSkeletonOptions = {}): Plugin {\n const surface = opts.surface ?? (looksLikeAdminApp(root) ? 'admin' : 'page')\n // Neutral, not a guess at the brand: @fayz-ai/ui's own background values,\n // which is exactly what the app paints next.\n const colors = {\n light: opts.background ?? DEFAULT_PAGE,\n dark: opts.backgroundDark ?? DEFAULT_PAGE_DARK,\n }\n\n return {\n name: 'fayz:boot-skeleton',\n transformIndexHtml: {\n order: 'post',\n handler(html: string) {\n if (surface === 'none') return html\n if (!html.includes('id=\"root\"')) return html\n\n const hasThemeColor = /<meta[^>]+name=[\"']?theme-color/i.test(html)\n const headChunk = hasThemeColor\n ? style(colors)\n : `<meta name=\"theme-color\" content=\"${colors.light}\" />\\n${style(colors)}`\n const bodyChunk = `${markup()}\\n${dismissScript(surface, colors)}`\n\n const withHead = insertAfter(html, HEAD_ANCHOR, headChunk)\n // No <head> in the template: the style rides along at the top of the\n // body, still ahead of the markup it paints.\n const base = withHead ?? html\n const pending = withHead ? bodyChunk : `${headChunk}\\n${bodyChunk}`\n return insertAfter(base, BODY_ANCHOR, pending) ?? `${base}\\n${pending}`\n },\n },\n }\n}\n","import { existsSync, readdirSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport type { UserConfig, PluginOption, AliasOptions } from 'vite'\nimport { appShellPwa, type AppShellPwaOptions } from './lib/app-shell-pwa'\nimport { fayzBootSkeleton, type BootSkeletonOptions } from './lib/boot-skeleton'\n\nexport { BOOT_THEME_STORAGE_KEY, type BootSkeletonOptions } from './lib/boot-skeleton'\nexport { appShellPwa, type AppShellPwaOptions } from './lib/app-shell-pwa'\n\n/**\n * Every `@fayz-ai/*` package in the checkout, as a Vite alias map (root src).\n * Subpaths (e.g. `@fayz-ai/admin/ui`, `@fayz-ai/storefront/catalog`) resolve\n * automatically via Vite's prefix alias matching — the shim files mirror the\n * subpath under `src/`.\n *\n * Read from disk rather than listed, because a hardcoded list is only correct\n * for the version it shipped in and apps run the INSTALLED `fayzVite`, not this\n * one. That is how the `saas` → `admin` rename half-broke the fleet: `admin`\n * was not in 0.9.0's list, so every app resolved it through the workspace to\n * `packages/admin/dist` — a stale build in the middle of an otherwise\n * source-resolved app, which reads as a bug in the code rather than in the\n * setup. A directory listing cannot go stale.\n */\nfunction sdkAliases(sdkDir: string): Record<string, string> {\n const out: Record<string, string> = {}\n for (const group of ['packages', 'plugins']) {\n const dir = resolve(sdkDir, group)\n if (!existsSync(dir)) continue\n for (const name of readdirSync(dir)) {\n const src = resolve(dir, name, 'src')\n // The directory name is the package name minus the scope, for both groups\n // (packages/admin → @fayz-ai/admin, plugins/plugin-crm → …/plugin-crm).\n if (existsSync(resolve(src, 'index.ts'))) out[`@fayz-ai/${name}`] = src\n }\n }\n return out\n}\n\nexport interface FayzViteOptions {\n /** Dev server port. */\n port?: number\n /** Fail instead of incrementing if the port is taken. */\n strictPort?: boolean\n /** Extra app-specific aliases, merged after the SDK aliases. */\n aliases?: Record<string, string>\n /** Extra Vite plugins, appended after @vitejs/plugin-react. */\n plugins?: PluginOption[]\n /**\n * SDK source location, absolute or relative to the app root\n * (default `../../fayz-sdk`).\n *\n * The `FAYZ_SDK_DIR` environment variable OVERRIDES this — see\n * {@link resolveSdkDir}.\n */\n sdkDir?: string\n /** App root directory (default process.cwd()). */\n root?: string\n /**\n * Extra Vite `server` config, merged over the SDK server defaults. The\n * preview-container contract (host/cors/allowedHosts/headers) is applied\n * first, so an override can add e.g. `proxy` without dropping it.\n */\n server?: UserConfig['server']\n /**\n * Extra Vite `resolve` config, merged over the SDK resolve defaults. The SDK\n * alias map / dedupe / conditions win for `@fayz-ai/*` local-source\n * resolution; any other resolve keys (and extra aliases) are merged in.\n */\n resolve?: UserConfig['resolve']\n /**\n * The shell outline painted into index.html, so the wait for the entry chunk\n * is not a blank page. Auto-detected from the app's dependencies; pass\n * `{ surface: 'none' }` to opt out, or colors to match the app's palette on a\n * first-ever visit (later visits reuse the palette the app itself stored).\n */\n bootSkeleton?: BootSkeletonOptions\n /**\n * The built app precaches itself: a service worker + webmanifest emitted at\n * build time, so a deployed app reloads instantly and still opens with no\n * network. On by default, and build-only by construction — the dev server\n * never registers a worker. Pass `false` to opt out, or an object to name\n * the install / set its colors.\n */\n pwa?: boolean | AppShellPwaOptions\n}\n\n/**\n * Shared Vite config for Fayz dogfood apps. Resolves `@fayz-ai/*` from the local\n * SDK source when it is checked out next to the app AND `FAYZ_SDK_SOURCE` is not\n * `published`; otherwise from node_modules (the Fayz editor sandbox / published\n * npm). Apps no longer hand-maintain alias maps or the local-vs-npm guard.\n *\n * import { defineConfig } from 'vite'\n * import react from '@vitejs/plugin-react'\n * import { fayzVite } from '@fayz-ai/sdk/vite'\n * export default defineConfig(fayzVite({ port: 5185, plugins: [react()] }))\n *\n * Where that local source is read from is {@link resolveSdkDir}: `FAYZ_SDK_DIR`\n * beats the `sdkDir` option beats `../../fayz-sdk`.\n *\n * The app passes its own `@vitejs/plugin-react` so `@fayz-ai/sdk` carries no\n * build-tool peer deps (which otherwise choke npm's peer resolution, since sdk\n * sits in every dependency path).\n */\n/** Env var that redirects local-source resolution to another SDK checkout. */\nexport const FAYZ_SDK_DIR_ENV = 'FAYZ_SDK_DIR'\n\n/**\n * Where the local SDK source is, as an absolute path. Resolution order:\n *\n * 1. `FAYZ_SDK_DIR` (env) — wins, absolute or root-relative\n * 2. `sdkDir` (option) — what the app's vite config declares\n * 3. `../../fayz-sdk` — the sibling-checkout convention\n *\n * Env wins deliberately. `sdkDir` lives in the app's COMMITTED vite config, so\n * without an override there was no way to build, dev or `fayz validate` a\n * store against a different SDK tree (a worktree, a release branch) short of\n * editing that committed file or dropping an untracked config shim next to it\n * — which is exactly what the fleet ended up doing. An env var is the one\n * knob a CLI flag and a container can both set without touching the repo.\n *\n * Exported so the CLI and the tests agree on the precedence by construction\n * rather than by comment.\n */\nexport function resolveSdkDir(\n root: string,\n sdkDir?: string,\n env: Record<string, string | undefined> = process.env,\n): string {\n const fromEnv = env[FAYZ_SDK_DIR_ENV]?.trim()\n return resolve(root, fromEnv || sdkDir || '../../fayz-sdk')\n}\n\n/**\n * Bare deps that only ever appear behind a `React.lazy()` inside an @fayz-ai\n * package. See the `optimizeDeps.include` comment below for why they have to be\n * named. Filtered by what is actually installed, because a plugin the app does\n * not carry leaves its deps uninstalled and `include` hard-fails on those.\n */\nconst LAZY_ONLY_DEPS = ['recharts', '@dnd-kit/core', '@dnd-kit/sortable', '@dnd-kit/modifiers', '@dnd-kit/utilities']\n\nfunction installedDeps(root: string, names: string[]): string[] {\n const roots: string[] = []\n for (let dir = root, prev = ''; dir !== prev; prev = dir, dir = resolve(dir, '..')) {\n roots.push(resolve(dir, 'node_modules'))\n }\n return names.filter((name) => roots.some((nm) => existsSync(resolve(nm, name, 'package.json'))))\n}\n\nexport function fayzVite(opts: FayzViteOptions = {}): UserConfig {\n const root = opts.root ?? process.cwd()\n const fayzSdk = resolveSdkDir(root, opts.sdkDir)\n const wantLocal = process.env.FAYZ_SDK_SOURCE !== 'published'\n const localPresent = existsSync(resolve(fayzSdk, 'packages/core/src/index.ts'))\n const useLocal = wantLocal && localPresent\n\n const localAliases = useLocal ? sdkAliases(fayzSdk) : {}\n\n // Pull SDK-owned resolve keys out of any caller override so they can't clobber\n // local-source @fayz-ai/* resolution; the rest of `resolve` is merged in.\n const { alias: userAlias, dedupe: userDedupe, conditions: _ignore, ...restResolve } =\n (opts.resolve ?? {}) as Exclude<UserConfig['resolve'], undefined>\n\n const pwa = opts.pwa ?? true\n // The install colors follow the boot screen's, so the splash, the browser\n // chrome and the first paint are one surface rather than three guesses.\n const pwaPlugins =\n pwa === false\n ? []\n : [\n appShellPwa(root, {\n themeColor: opts.bootSkeleton?.sidebar ?? opts.bootSkeleton?.background,\n backgroundColor: opts.bootSkeleton?.background ?? opts.bootSkeleton?.sidebar,\n ...(pwa === true ? {} : pwa),\n }),\n ]\n\n return {\n plugins: [...(opts.plugins ?? []), fayzBootSkeleton(root, opts.bootSkeleton), ...pwaPlugins],\n envPrefix: ['VITE_', 'PUBLIC_'],\n resolve: {\n ...restResolve,\n alias: {\n '@': resolve(root, 'src'),\n ...localAliases,\n ...(opts.aliases ?? {}),\n ...((userAlias as Record<string, string> | undefined) ?? {}),\n } as AliasOptions,\n // lucide-react is a direct dep of both the app and every @fayz-ai/*\n // package; without dedupe a version skew installs two copies and esbuild\n // pre-bundles each barrel separately (~1,500 icon modules each).\n // Collapsing to one copy is the single biggest cut to the editor-container\n // optimize RAM/CPU spike. Only dedupe deps the *app* directly depends on\n // (so they're hoisted to its root node_modules) — deduping a transitive\n // like @tanstack/react-table makes Vite resolve it from the app root,\n // which fails in local-source mode and 500s the aliased UI source.\n //\n // @fullcalendar/* is here for a different reason: plugin-agenda and the\n // app each carry a copy, and only the app's has `premium-common`. Split\n // across two copies, the resource views register their ScrollGrid into a\n // `core` the calendar is not the instance of, and the week grid dies with\n // \"No ScrollGrid implementation\" — a failure that only surfaces after the\n // dep cache is cleared, so it reads as random.\n dedupe: userDedupe ?? [\n 'react', 'react-dom', 'zustand', 'lucide-react', 'react-router-dom',\n '@supabase/supabase-js', 'sonner',\n '@fullcalendar/core', '@fullcalendar/react', '@fullcalendar/daygrid',\n '@fullcalendar/timegrid', '@fullcalendar/list', '@fullcalendar/interaction',\n '@fullcalendar/premium-common', '@fullcalendar/resource',\n '@fullcalendar/resource-daygrid', '@fullcalendar/resource-timegrid',\n ],\n conditions: useLocal ? ['source', 'browser', 'module', 'jsnext:main', 'jsnext'] : undefined,\n },\n optimizeDeps: {\n exclude: useLocal ? Object.keys(localAliases) : [],\n // Excluding @fayz-ai/* also hides THEIR bare deps from Vite's initial\n // scan. A dep that first appears behind a React.lazy() is then discovered\n // at click time, and the re-optimize that follows kills the very imports\n // that triggered it — the screen fails with \"Failed to fetch dynamically\n // imported module\" (recharts: every chart at once; @dnd-kit: the forms\n // builder). Naming them keeps the exclude that keeps SDK source hot.\n include: useLocal ? installedDeps(root, LAZY_ONLY_DEPS) : undefined,\n },\n // The preview-container runtime contract: Vite's host-check 403s any\n // non-local Host (browser iframe via Caddy, health probe via\n // host.docker.internal) unless allowedHosts is set. host/cors/headers keep\n // the proxied iframe + cross-origin asset fetches working. Owned here\n // because the app's vite.config has no literal `server: {` for the\n // container's text patchers to anchor on. Caller `server` merges last.\n server: {\n host: true,\n port: opts.port,\n strictPort: opts.strictPort,\n cors: true,\n allowedHosts: true,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Cross-Origin-Resource-Policy': 'cross-origin',\n },\n fs: { allow: [root, fayzSdk] },\n ...(opts.server ?? {}),\n },\n }\n}\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "fayz": {
4
4
  "status": "beta"
5
5
  },
6
- "version": "0.15.0",
6
+ "version": "0.30.1",
7
7
  "description": "Fayz SDK — API client, app params, runtime broker helpers, and shared types for generated Fayz projects",
8
8
  "type": "module",
9
9
  "sideEffects": false,
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/deprecations.json","../src/deprecations.ts"],"names":[],"mappings":";AAAA,IAAA,oBAAA,GAAA;AAAA,EACE,eAAA,EAAmB,CAAA;AAAA,EACnB,MAAA,EAAU;AAAA,IACR,sBAAA,EAA0B,CAAA;AAAA,IAC1B,OAAA,EAAW;AAAA,GACb;AAAA,EACA,YAAA,EAAgB;AAAA,IACd;AAAA,MACE,EAAA,EAAM,oBAAA;AAAA,MACN,OAAA,EAAW,eAAA;AAAA,MACX,OAAA,EAAW,cAAA;AAAA,MACX,KAAA,EAAS,gCAAA;AAAA,MACT,YAAA,EAAgB,QAAA;AAAA,MAChB,QAAA,EAAY,QAAA;AAAA,MACZ,WAAA,EAAe,sNAAA;AAAA,MACf,IAAA,EAAQ,mSAAA;AAAA,MACR,KAAA,EAAS,CAAC,4BAAA,EAA8B,4BAAA,EAA8B,0BAA0B,CAAA;AAAA,MAChG,MAAA,EAAU,uGAAA;AAAA,MACV,OAAA,EAAW,2BAAA;AAAA,MACX,SAAA,EAAa;AAAA,KACf;AAAA,IACA;AAAA,MACE,EAAA,EAAM,+BAAA;AAAA,MACN,OAAA,EAAW,cAAA;AAAA,MACX,OAAA,EAAW,iBAAA;AAAA,MACX,KAAA,EAAS,6CAAA;AAAA,MACT,YAAA,EAAgB,OAAA;AAAA,MAChB,QAAA,EAAY,QAAA;AAAA,MACZ,WAAA,EAAe,mIAAA;AAAA,MACf,IAAA,EAAQ,4VAAA;AAAA,MACR,KAAA,EAAS,CAAC,0BAAA,EAA4B,iDAAiD,CAAA;AAAA,MACvF,MAAA,EAAU,0IAAA;AAAA,MACV,OAAA,EAAW,+BAAA;AAAA,MACX,SAAA,EAAa;AAAA,KACf;AAAA,IACA;AAAA,MACE,EAAA,EAAM,+BAAA;AAAA,MACN,OAAA,EAAW,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AA,CAAK,KAAA,SAAc,MAAA,CAAO,iBAAA;AACzC,EAAA,OAAO,EAAA,CAAG,QAAQ,IAAA,CAAK,KAAA;AACzB","file":"chunk-HA5O3CW7.js","sourcesContent":["{\n \"registryVersion\": 1,\n \"policy\": {\n \"minMinorsBeforeRemoval\": 2,\n \"summary\": \"Nothing is removed without a shim, and the deprecation is enumerable (spine I10). A deprecation is ANNOUNCED in a minor release and REMOVED no earlier than two minor releases later, so a store always has one whole release in which both the old and the new input work. Every shim's warning names its replacement (I2). Every row here carries a codemod id; a codemod that cannot be safe refuses and names the decision a human must make.\"\n },\n \"deprecations\": [\n {\n \"id\": \"admin.package.saas\",\n \"package\": \"@fayz-ai/saas\",\n \"surface\": \"package-name\",\n \"title\": \"the @fayz-ai/saas package name\",\n \"deprecatedIn\": \"0.10.0\",\n \"removeIn\": \"0.12.0\",\n \"replacement\": \"@fayz-ai/admin — same exports, same subpaths (/ui, /db, /org, /billing, /permissions), renamed because the package is the admin surface (shell, CRUD engine, org, billing, permissions), not the business model\",\n \"shim\": \"packages/saas is now a thin package that re-exports @fayz-ai/admin, so an app that has not migrated builds and runs unchanged. What it costs is a second package in the graph and one console warning per entry point per session. It ships no implementation, so there is no behaviour to drift.\",\n \"where\": [\"packages/saas/src/index.ts\", \"packages/saas/package.json\", \"packages/sdk/src/vite.ts\"],\n \"detect\": \"The app's package.json depends on @fayz-ai/saas, or any file under src/ imports from '@fayz-ai/saas'.\",\n \"codemod\": \"admin.saas-package-rename\",\n \"reference\": \"packages/saas/README.md\"\n },\n {\n \"id\": \"shop.provider.productMetadata\",\n \"package\": \"@fayz-ai/sdk\",\n \"surface\": \"provider-option\",\n \"title\": \"createFayzShopProvider({ productMetadata })\",\n \"deprecatedIn\": \"0.9.0\",\n \"removeIn\": \"0.11.0\",\n \"replacement\": \"product variants — plg_shop_product_variants, read through products.bySlug / getProductVariants (admin > product > variants)\",\n \"shim\": \"The overlay is still merged into each product's metadata for DISPLAY, so a store passing it keeps rendering. What it no longer does is define the option axes checkout sells: 0028 variants are the sellable unit and 0029 prices and names an order line from them. An axis that exists only in the overlay renders a picker that resolves to no variant.\",\n \"where\": [\"packages/sdk/src/shop.ts\", \"packages/storefront/src/data/product-options.ts\"],\n \"detect\": \"The app passes `productMetadata` to createFayzShopProvider (usually src/config/shop.ts), or the running provider warns once per session.\",\n \"codemod\": \"shop.product-metadata-overlay\",\n \"reference\": \"docs/storefront/storefront-architecture-spine.md (M5), docs/storefront/storefront-contract.md\"\n },\n {\n \"id\": \"storefront.commerce.discounts\",\n \"package\": \"@fayz-ai/storefront\",\n \"surface\": \"document-field\",\n \"title\": \"config.discounts / commerce.discounts (percent coupon codes)\",\n \"deprecatedIn\": \"0.9.0\",\n \"removeIn\": \"0.11.0\",\n \"replacement\": \"promotions.promotions — a rule-engine Promotion with an eligibility rule on `code` and a percentage application method (spine M6, I8)\",\n \"shim\": \"The provider still honours the legacy path: every `{code, percent}` entry is translated by storefrontDiscountToPromotion and evaluated by the ONE rule engine, so the money is identical. What the legacy shape cannot express is everything the engine exists for — buy-N-get-M, tiers, minimum subtotal, product/category scoping, automatic application.\",\n \"where\": [\n \"packages/shop/src/rules/adapter.ts\",\n \"packages/storefront/src/hooks/use-discount-validator.ts\",\n \"packages/storefront/src/document/sections.ts\"\n ],\n \"detect\": \"commerce.discounts is present in the Store Document (config.discounts in a config-derived document).\",\n \"codemod\": \"commerce.discounts-to-promotions\",\n \"reference\": \"docs/storefront/storefront-architecture-spine.md (M6, I8), docs/storefront/storefront-contract.md\"\n },\n {\n \"id\": \"shop.inventory.directCountWrite\",\n \"package\": \"@fayz-ai/shop\",\n \"surface\": \"sql-column-write\",\n \"title\": \"direct writes to plg_shop_product_variants.inventory_count (and plg_shop_products.inventory_count)\",\n \"deprecatedIn\": \"0.9.0\",\n \"removeIn\": \"0.11.0\",\n \"replacement\": \"insert a plg_shop_stock_movements row (receipt / adjustment / loss / count) — the ledger is the truth and inventory_count is its mirror\",\n \"shim\": \"0036 turns a direct write to a VARIANT count into an `adjustment` movement with reason `legacy_write`, and 0037 forwards a write to the PRODUCT count to that product's default variant the same way. Both RAISE a WARNING. The quantities are exact; the taxonomy is not — the shim is told a number changed and never why, so a sale arriving this way is recorded as an adjustment with no order_id.\",\n \"where\": [\n \"packages/shop/migrations/0036_inventory_count_mirror.sql\",\n \"packages/shop/migrations/0037_default_variant.sql\"\n ],\n \"signals\": [\n \"DEPRECATED (I10): direct write to plg_shop_product_variants.inventory_count\",\n \"DEPRECATED (I10): direct write to plg_shop_products.inventory_count\"\n ],\n \"detect\": \"Not visible in a store's repo: it is a property of the callers writing to a pool. Count the `legacy_write` reason in plg_shop_stock_movements — that count IS the migration backlog.\",\n \"codemod\": \"shop.inventory-count-write\",\n \"reference\": \"docs/storefront/inventory-model.md §6, §9 step 3\"\n },\n {\n \"id\": \"shop.placeOrder.variantless\",\n \"package\": \"@fayz-ai/shop\",\n \"surface\": \"sql-code-path\",\n \"title\": \"the variantless leg of shop_place_order\",\n \"deprecatedIn\": \"0.9.0\",\n \"removeIn\": \"0.11.0\",\n \"replacement\": \"every product gets a default variant (migration 0037), and the variant is the universal sellable unit — the order line resolves a variant and the sale reaches the ledger\",\n \"shim\": \"0039 keeps the leg: a line whose product has no variant at all still sells, guarded against the product-level inventory_count exactly as before 0034. It emits one enumerable NOTICE per order naming the products that took it, so the deprecation is countable rather than silent. Such a sale does NOT reach the stock ledger, so it answers none of the questions inventory-model.md §0 exists for.\",\n \"where\": [\"packages/shop/migrations/0039_place_order_ledger.sql\"],\n \"signals\": [\"shop_place_order: DEPRECATED variantless stock path used for\"],\n \"detect\": \"Not visible in a store's repo: it is pool state. Its exit condition is in 0039's header — the count of products with no variant must read 0 on every pool.\",\n \"codemod\": \"shop.place-order-variantless\",\n \"reference\": \"docs/storefront/inventory-model.md §10 q6, packages/shop/migrations/0039_place_order_ledger.sql (header)\"\n },\n {\n \"id\": \"storefront.backend.supabaseUrl\",\n \"package\": \"@fayz-ai/storefront\",\n \"surface\": \"document-field\",\n \"title\": \"config.supabaseUrl / backend.supabaseUrl\",\n \"deprecatedIn\": \"0.9.0\",\n \"removeIn\": \"0.11.0\",\n \"replacement\": \"auth.supabase.url\",\n \"shim\": \"The legacy field still rides in the backend section so an old config round-trips losslessly, and hydrateStoreDocument still sets config.supabaseUrl from it.\",\n \"where\": [\"packages/storefront/src/document/sections.ts\", \"packages/storefront/src/document/round-trip.ts\"],\n \"detect\": \"backend.supabaseUrl is present in the Store Document.\",\n \"codemod\": \"backend.supabase-to-auth\",\n \"reference\": \"docs/storefront/storefront-contract.md\"\n },\n {\n \"id\": \"storefront.backend.supabaseAnonKey\",\n \"package\": \"@fayz-ai/storefront\",\n \"surface\": \"document-field\",\n \"title\": \"config.supabaseAnonKey / backend.supabaseAnonKey\",\n \"deprecatedIn\": \"0.9.0\",\n \"removeIn\": \"0.11.0\",\n \"replacement\": \"auth.supabase.anonKey\",\n \"shim\": \"The legacy field still rides in the backend section so an old config round-trips losslessly, and hydrateStoreDocument still sets config.supabaseAnonKey from it.\",\n \"where\": [\"packages/storefront/src/document/sections.ts\", \"packages/storefront/src/document/round-trip.ts\"],\n \"detect\": \"backend.supabaseAnonKey is present in the Store Document.\",\n \"codemod\": \"backend.supabase-to-auth\",\n \"reference\": \"docs/storefront/storefront-contract.md\"\n }\n ]\n}\n","import registry from './deprecations.json'\n\n// ---------------------------------------------------------------------------\n// The deprecation registry — spine I10, as ROWS.\n//\n// \"Nothing is removed without a shim, and the deprecation is enumerable.\" The\n// enumerable half is this file. WooCommerce keeps 60 deprecated hooks alive\n// through a DECLARED map dispatched at runtime; the reason that works at their\n// scale is that the map is data one tool can read. Ours is\n// `deprecations.json`, and it lives here for the same reason\n// `supported-surface.json` and `release-channels.json` do: @fayz-ai/sdk has no\n// dependencies, so every package, the CLI and a generated app can all read the\n// same table without anyone taking a dependency to do it.\n//\n// Two properties are load-bearing, and both are tested:\n//\n// 1. EVERY warning names its replacement (I2). A shim that can import this\n// module builds its message with `deprecationMessage(id)`, so the warning\n// and the row cannot drift. A shim that CANNOT — PL/pgSQL cannot import\n// JSON — declares its literal marker text in the row's `signals`, and a\n// test asserts that text really occurs in the named migration.\n// 2. EVERY row carries a codemod id. `fayz upgrade` either transforms the\n// document or REFUSES and names the decision a human must make. A\n// deprecation with no answer at all is the thing this registry exists to\n// make impossible.\n//\n// The policy is a number, not a promise: a deprecation announced in 0.9 is\n// removed no earlier than 0.11, so a fleet always has one whole release in\n// which both the old and the new input work.\n// ---------------------------------------------------------------------------\n\n/** Where a deprecated thing lives, which is also what can detect it. */\nexport type FayzDeprecationSurface =\n /** A field of the Store Document (and of the config it is derived from). */\n | 'document-field'\n /** An option passed to a provider factory in the store's own code. */\n | 'provider-option'\n /** A write to a column that is no longer the truth. */\n | 'sql-column-write'\n /** A branch of a SQL function kept alive for data that has not migrated. */\n | 'sql-code-path'\n /** A package name kept alive by a re-export after the package was renamed. */\n | 'package-name'\n\nexport interface FayzDeprecation {\n /** Stable dotted id. The key everything else references. */\n id: string\n /** Package that owns the surface. */\n package: string\n surface: FayzDeprecationSurface\n /** What is deprecated, in the words the author would recognize. */\n title: string\n /** SDK minor in which the deprecation was ANNOUNCED. */\n deprecatedIn: string\n /** SDK minor in which the shim is REMOVED. */\n removeIn: string\n /** What to use instead. Every warning for this id names it (I2). */\n replacement: string\n /** What keeps working during the window, and precisely what it costs. */\n shim: string\n /** Repo paths where the shim lives — the registry has to be auditable. */\n where: string[]\n /**\n * Literal marker text the shim emits at runtime, for shims that cannot build\n * their message from this row (PL/pgSQL). Asserted against the real file by\n * packages/shop/src/deprecations.test.ts.\n */\n signals?: string[]\n /** How `fayz upgrade` finds it in a store — including \"you cannot, here is\n * the query that counts it in the pool instead\". */\n detect: string\n /** Codemod id that retires it. Never empty: a codemod that cannot be safe\n * exists anyway and refuses, naming the human decision. */\n codemod: string\n /** The design record. */\n reference: string\n}\n\nexport interface FayzDeprecationPolicy {\n /** Minimum number of minor releases between announcement and removal. */\n minMinorsBeforeRemoval: number\n summary: string\n}\n\nexport interface FayzDeprecationRegistry {\n registryVersion: number\n policy: FayzDeprecationPolicy\n deprecations: FayzDeprecation[]\n}\n\nconst table = registry as unknown as FayzDeprecationRegistry\n\nexport const fayzDeprecationPolicy: FayzDeprecationPolicy = table.policy\n\n/** Every deprecation, in declaration order. */\nexport function listDeprecations(): FayzDeprecation[] {\n return table.deprecations.map((row) => ({ ...row, where: [...row.where], signals: row.signals ? [...row.signals] : undefined }))\n}\n\n/** One row by id. Unknown ids throw and name the valid set (I2). */\nexport function getDeprecation(id: string): FayzDeprecation {\n const row = table.deprecations.find((entry) => entry.id === id)\n if (!row) {\n throw new Error(\n `Unknown deprecation id \"${id}\". Valid: ${table.deprecations.map((entry) => entry.id).join(', ')}`,\n )\n }\n return row\n}\n\nexport function hasDeprecation(id: string): boolean {\n return table.deprecations.some((entry) => entry.id === id)\n}\n\n/** Deprecation ids a given codemod retires. */\nexport function deprecationsForCodemod(codemod: string): FayzDeprecation[] {\n return table.deprecations.filter((entry) => entry.codemod === codemod)\n}\n\n/** Every codemod id the registry references, deduped, in declaration order. */\nexport function listDeprecationCodemods(): string[] {\n return [...new Set(table.deprecations.map((entry) => entry.codemod))]\n}\n\n/**\n * The warning text for a deprecation — the ONE place its prose is built.\n *\n * `context` is the caller's specifics (\"on variant abc\", \"at commerce.discounts[0]\");\n * it is appended, never substituted, so no caller can drop the replacement.\n */\nexport function deprecationMessage(id: string, context?: string): string {\n const row = getDeprecation(id)\n const where = context ? ` ${context}` : ''\n return (\n `DEPRECATED (${row.id}):${where} ${row.title} is deprecated since ${row.deprecatedIn} ` +\n `and is REMOVED in ${row.removeIn}. Use instead: ${row.replacement}. ` +\n `Migrate with \\`fayz upgrade\\` (codemod ${row.codemod}).`\n )\n}\n\nconst warned = new Set<string>()\n\n/**\n * Warn once per id per session.\n *\n * Once, because the alternative is one line per request, which buries the\n * signal this exists to produce. The dedupe key is the ID ALONE, not\n * (id, context): a shim whose context varies per call would otherwise\n * re-warn forever and reintroduce exactly the flood the once-ness exists to\n * prevent. Returns true when it actually warned, so a shim is testable\n * without reading the console.\n */\nexport function warnDeprecated(id: string, context?: string): boolean {\n if (warned.has(id)) return false\n warned.add(id)\n console.warn(deprecationMessage(id, context))\n return true\n}\n\n/** Test seam — re-arms every once-per-session deprecation warning. */\nexport function resetDeprecationWarnings(): void {\n warned.clear()\n}\n\nfunction minorOf(version: string): { major: number; minor: number } {\n const [major = '0', minor = '0'] = version.split('.')\n return { major: Number(major), minor: Number(minor) }\n}\n\n/**\n * Does `version` still get the shim?\n *\n * The question every consumer actually asks, answered from the table rather\n * than from a comment. Compared on (major, minor) because the policy is stated\n * in minors — a patch never removes anything.\n */\nexport function isDeprecationShimmed(id: string, version: string): boolean {\n const row = getDeprecation(id)\n const at = minorOf(version)\n const gone = minorOf(row.removeIn)\n if (at.major !== gone.major) return at.major < gone.major\n return at.minor < gone.minor\n}\n\n/** Minors between announcement and removal — the policy's unit. */\nexport function deprecationWindowMinors(row: FayzDeprecation): number {\n const from = minorOf(row.deprecatedIn)\n const to = minorOf(row.removeIn)\n // Majors are not commensurable with minors; a major bump is treated as\n // \"far beyond the window\", which is the only safe reading.\n if (to.major > from.major) return Number.POSITIVE_INFINITY\n return to.minor - from.minor\n}\n\nexport { table as fayzDeprecationRegistry }\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/agent.ts"],"names":["eventName"],"mappings":";AA+HO,IAAM,cAAA,GAAN,cAA6B,KAAA,CAAM;AAAA,EACxC,WAAA,CACE,SACS,MAAA,EACT;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAFJ,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAGT,IAAA,IAAA,CAAK,IAAA,GAAO,gBAAA;AAAA,EACd;AACF;AA0DA,SAAS,kBAAkB,IAAA,EAA6D;AACtF,EAAA,OAAO;AAAA,IACL,cAAA,EAAgB,KAAK,cAAA,IAAkB,EAAA;AAAA,IACvC,OAAA,EAAS,KAAK,OAAA,IAAW,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AA,CAAa,OAAA,GAAU,WAAA;AAClD,MAAA,OAAO,kBAAkB,YAAY,CAAA;AAAA,IACvC,CAAA;AAAA,IAEA,MAAM,iBAAA,CAAkB,cAAA,EAAgB,MAAA,EAAQ;AAC9C,MAAA,MAAM,QAAQ,cAAA,GAAiB,CAAA,gBAAA,EAAmB,kBAAA,CAAmB,cAAc,CAAC,CAAA,CAAA,GAAK,EAAA;AACzF,MAAA,MAAM,OAAO,MAAM,OAAA;AAAA,QACjB,iBAAiB,KAAK,CAAA,CAAA;AAAA,QACtB,EAAE,MAAA,EAAQ,KAAA,EAAO,MAAA;AAAO,OAC1B;AACA,MAAA,OAAO,IAAA,CAAK,iBAAiB,EAAC;AAAA,IAChC,CAAA;AAAA,IAEA,MAAM,eAAA,CAAgB,cAAA,EAAgB,cAAA,EAAgB,MAAA,EAAQ;AAC5D,MAAA,MAAM,QAAQ,cAAA,GAAiB,CAAA,gBAAA,EAAmB,kBAAA,CAAmB,cAAc,CAAC,CAAA,CAAA,GAAK,EAAA;AACzF,MAAA,MAAM,OAAO,MAAM,OAAA;AAAA,QACjB,CAAA,eAAA,EAAkB,kBAAA,CAAmB,cAAc,CAAC,GAAG,KAAK,CAAA,CAAA;AAAA,QAC5D,EAAE,MAAA,EAAQ,KAAA,EAAO,MAAA;AAAO,OAC1B;AACA,MAAA,OAAO,IAAA,CAAK,YAAA;AAAA,IACd;AAAA,GACF;AACF","file":"chunk-LSBVNW75.js","sourcesContent":["/**\n * Client for the Fayz agent broker — the runtime surface a generated app uses\n * to reach the AI agent configured for its project in Fayz.\n *\n * Mirrors `createFayzShopProvider`: the app holds a publishable key, Fayz holds\n * the model credentials. The key ships in the bundle the same way a Supabase\n * anon key does; it only ever resolves to the one agent its web channel belongs\n * to, and the broker rate-limits per project.\n *\n * Tools are client-plane. The app declares what it can do (`tools`), the model\n * decides what to call, and the app executes the calls against its own session\n * before handing results back. Fayz never needs the app's data credentials.\n */\n\nexport interface FayzAgentClientOptions {\n /** Fayz API base, e.g. https://fayz.ai/api */\n baseUrl: string\n projectId: string\n /** Publishable key of the project's WEB agent channel. */\n publishableKey: string\n fetcher?: typeof fetch\n}\n\nexport interface FayzAgentTool {\n name: string\n description: string\n /** JSON Schema for the tool's arguments. */\n parameters?: Record<string, unknown>\n}\n\nexport interface FayzAgentToolCall {\n id: string\n name: string\n arguments: Record<string, unknown>\n}\n\nexport interface FayzAgentToolResult {\n toolCallId: string\n content: string\n}\n\n/**\n * A file the user attached, described rather than uploaded.\n *\n * The bytes stay in the browser: a spreadsheet of clients or patients is\n * personal data, and handing it to a model provider so it can \"take a look\" is\n * a disclosure, not a convenience. What travels is the shape — sheets,\n * headers, how many rows, the inferred type per column and a handful of sample\n * rows. Enough to plan an import; never the data set itself.\n */\nexport interface AgentAttachmentColumn {\n name: string\n type: 'text' | 'number' | 'date' | 'boolean' | 'email' | 'phone'\n /** Literal shape when known ('dd/mm/yyyy', '1.234,56'). */\n format?: string\n /** Why the column is not the type it looks like (ambiguous dates, mixed values). */\n note?: string\n}\n\nexport interface AgentAttachmentSheet {\n name: string\n headers: string[]\n rowCount?: number\n sample: string[][]\n columnTypes: AgentAttachmentColumn[]\n}\n\nexport interface AgentAttachmentDigest {\n id: string\n name: string\n mime: string\n size: number\n kind: 'spreadsheet' | 'csv' | 'text' | 'image' | 'pdf' | 'binary'\n /** Multi-tab spreadsheets. Single-tab files use the flat fields below. */\n sheets?: AgentAttachmentSheet[]\n headers?: string[]\n rowCount?: number\n sample?: string[][]\n columnTypes?: AgentAttachmentColumn[]\n /** Head of a text/markdown file. */\n preview?: string\n /** What the reader had to guess at, truncate or give up on. */\n warnings?: string[]\n}\n\nexport interface FayzAgentChatInput {\n /** New end-user message. Omit when replying with tool results. */\n message?: string\n conversationId?: string\n /** Identity of the end user, required by channels with an INTERNAL audience. */\n externalUserId?: string\n /** Human label for that user, so the owner's dashboard shows a name. */\n externalUserName?: string\n tools?: FayzAgentTool[]\n toolResults?: FayzAgentToolResult[]\n /** Decision for a server-parked write (broker PENDING_CONFIRMATION step). */\n confirmAction?: { id: string; approved: boolean }\n /** Runtime context the agent should know about (page, locale, tenant). */\n context?: Record<string, unknown>\n /** Files the user attached this turn, as digests — never as bytes. */\n attachments?: AgentAttachmentDigest[]\n signal?: AbortSignal\n}\n\n/** A server-plane write the broker parked pending human confirmation. */\nexport interface FayzAgentPendingAction {\n id: string\n toolName: string\n title?: string\n params?: Record<string, unknown>\n}\n\nexport interface FayzAgentChatResponse {\n conversationId: string\n content: string\n toolCalls: FayzAgentToolCall[]\n /** Present when the broker is waiting on a confirmAction for this write. */\n pendingAction?: FayzAgentPendingAction\n}\n\nexport interface FayzAgentInfo {\n id: string\n name: string\n description: string | null\n icon: string | null\n}\n\nexport class FayzAgentError extends Error {\n constructor(\n message: string,\n readonly status: number,\n ) {\n super(message)\n this.name = 'FayzAgentError'\n }\n}\n\nexport interface FayzAgentConversationSummary {\n id: string\n title: string | null\n /** Last activity — the field the list is ordered by. */\n updatedAt: string\n}\n\nexport interface FayzAgentConversationMessage {\n id: string\n role: string\n content: string\n createdAt: string\n /** Files the user attached to this turn, as the digest that was sent. Only\n * the description — the bytes never left the browser that produced them. */\n attachments?: AgentAttachmentDigest[]\n /** Tool calls this reply made, with their results — so a resumed thread shows\n * the same trace and record links it showed live. */\n toolCalls?: Array<{\n name: string\n arguments?: Record<string, unknown>\n result?: string\n }>\n}\n\nexport interface FayzAgentConversationDetail {\n id: string\n title: string | null\n messages: FayzAgentConversationMessage[]\n}\n\nexport interface FayzAgentStreamCallbacks {\n /** Fired per text delta with the accumulated text so far (fill-in-place UIs). */\n onDelta?: (accumulated: string, delta: string) => void\n}\n\nexport interface FayzAgentClient {\n /** Identity of the agent behind the key, for rendering its name/icon. */\n getInfo(signal?: AbortSignal): Promise<FayzAgentInfo>\n chat(input: FayzAgentChatInput): Promise<FayzAgentChatResponse>\n /**\n * Like `chat`, but asks the broker for an SSE stream (`Accept:\n * text/event-stream`) and reports text deltas as they arrive. Falls back\n * transparently to the JSON round-trip when the broker predates streaming —\n * callers can always use this and treat `onDelta` as best-effort.\n */\n chatStream(input: FayzAgentChatInput, callbacks?: FayzAgentStreamCallbacks): Promise<FayzAgentChatResponse>\n /** The signed-in user's own threads, most-recently-active first. */\n listConversations(externalUserId?: string, signal?: AbortSignal): Promise<FayzAgentConversationSummary[]>\n /** One thread with its transcript — 404s on another user's thread. */\n getConversation(\n conversationId: string,\n externalUserId?: string,\n signal?: AbortSignal,\n ): Promise<FayzAgentConversationDetail>\n}\n\nfunction normalizeResponse(body: Partial<FayzAgentChatResponse>): FayzAgentChatResponse {\n return {\n conversationId: body.conversationId ?? '',\n content: body.content ?? '',\n toolCalls: body.toolCalls ?? [],\n ...(body.pendingAction ? { pendingAction: body.pendingAction } : {}),\n }\n}\n\nexport function createFayzAgentClient(options: FayzAgentClientOptions): FayzAgentClient {\n const fetcher = options.fetcher ?? globalThis.fetch\n const base = `${options.baseUrl.replace(/\\/+$/, '')}/public/projects/${options.projectId}/agents`\n const headers = {\n 'Content-Type': 'application/json',\n 'x-fayz-agent-key': options.publishableKey,\n }\n\n async function request<T>(path: string, init: RequestInit): Promise<T> {\n const response = await fetcher(`${base}${path}`, { ...init, headers })\n if (!response.ok) {\n const body = (await response.json().catch(() => null)) as { error?: string } | null\n throw new FayzAgentError(body?.error ?? `Agent request failed (${response.status})`, response.status)\n }\n return (await response.json()) as T\n }\n\n return {\n async getInfo(signal) {\n const body = await request<{ agent: FayzAgentInfo }>('/config', { method: 'GET', signal })\n return body.agent\n },\n\n async chat({ signal, ...input }) {\n const body = await request<Partial<FayzAgentChatResponse>>('/chat', {\n method: 'POST',\n body: JSON.stringify(input),\n signal,\n })\n return normalizeResponse(body)\n },\n\n async chatStream({ signal, ...input }, callbacks) {\n const response = await fetcher(`${base}/chat`, {\n method: 'POST',\n body: JSON.stringify(input),\n signal,\n headers: { ...headers, Accept: 'text/event-stream' },\n })\n if (!response.ok) {\n const body = (await response.json().catch(() => null)) as { error?: string } | null\n throw new FayzAgentError(body?.error ?? `Agent request failed (${response.status})`, response.status)\n }\n // Broker predates streaming (or chose not to): plain JSON round-trip.\n const contentType = response.headers.get('content-type') ?? ''\n if (!contentType.includes('text/event-stream') || !response.body) {\n return normalizeResponse((await response.json()) as Partial<FayzAgentChatResponse>)\n }\n\n const reader = response.body.getReader()\n const decoder = new TextDecoder()\n let buffer = ''\n let accumulated = ''\n let done: Partial<FayzAgentChatResponse> | null = null\n\n const dispatch = (eventName: string, data: string) => {\n if (!data) return\n let payload: Record<string, unknown>\n try {\n payload = JSON.parse(data) as Record<string, unknown>\n } catch {\n return\n }\n if (eventName === 'delta') {\n const text = typeof payload.text === 'string' ? payload.text : ''\n if (text) {\n accumulated += text\n callbacks?.onDelta?.(accumulated, text)\n }\n } else if (eventName === 'done') {\n done = payload as Partial<FayzAgentChatResponse>\n } else if (eventName === 'error') {\n throw new FayzAgentError(\n typeof payload.error === 'string' ? payload.error : 'Agent stream failed',\n response.status,\n )\n }\n }\n\n let eventName = 'message'\n let dataLines: string[] = []\n const processLine = (line: string) => {\n if (line === '') {\n dispatch(eventName, dataLines.join('\\n'))\n eventName = 'message'\n dataLines = []\n } else if (line.startsWith('event:')) {\n eventName = line.slice(6).trim()\n } else if (line.startsWith('data:')) {\n dataLines.push(line.slice(5).trimStart())\n }\n }\n\n for (;;) {\n const { value, done: streamDone } = await reader.read()\n if (streamDone) break\n buffer += decoder.decode(value, { stream: true })\n let newline = buffer.indexOf('\\n')\n while (newline >= 0) {\n processLine(buffer.slice(0, newline).replace(/\\r$/, ''))\n buffer = buffer.slice(newline + 1)\n newline = buffer.indexOf('\\n')\n }\n }\n processLine(buffer.replace(/\\r$/, ''))\n processLine('')\n\n // The final `done` event carries the same payload shape as the JSON\n // route; accumulated deltas back-fill `content` if the broker omits it.\n const finalPayload: Partial<FayzAgentChatResponse> = { ...(done ?? {}) }\n if (!finalPayload.content) finalPayload.content = accumulated\n return normalizeResponse(finalPayload)\n },\n\n async listConversations(externalUserId, signal) {\n const query = externalUserId ? `?externalUserId=${encodeURIComponent(externalUserId)}` : ''\n const body = await request<{ conversations?: FayzAgentConversationSummary[] }>(\n `/conversations${query}`,\n { method: 'GET', signal },\n )\n return body.conversations ?? []\n },\n\n async getConversation(conversationId, externalUserId, signal) {\n const query = externalUserId ? `?externalUserId=${encodeURIComponent(externalUserId)}` : ''\n const body = await request<{ conversation: FayzAgentConversationDetail }>(\n `/conversations/${encodeURIComponent(conversationId)}${query}`,\n { method: 'GET', signal },\n )\n return body.conversation\n },\n }\n}\n"]}