@ai4b-team/fsaos-gateway-sdk 3.18.0 → 3.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -40,6 +40,7 @@ Rule of thumb: if the answer should differ depending on *who is asking* or *whic
40
40
 
41
41
  ### Session Management
42
42
  - `initSession()` — Initialize domain-scoped session via `GET /d/{hostname}/init`
43
+ - `initializeFsaos()` — Canonical one-call domain session + tracking bootstrap
43
44
  - `clearSession()` — Clear cached session
44
45
  - `getSessionEntry()` — Get current session entry (or null)
45
46
  - `getAccessToken()` — Get current auth token (waits for first auth event)
@@ -49,6 +50,25 @@ Rule of thumb: if the answer should differ depending on *who is asking* or *whic
49
50
  ### Gateway Call
50
51
  - `gatewayCall(method, params)` — Core RPC dispatcher: `POST /d/{hostname}`
51
52
 
53
+ ### Public Page Forms
54
+ - `submitForm(capabilityId, fields, options?)` — Submit through the public domain gateway to the form dataset bound to the current published page release. The browser supplies only the declared capability name, current page URL, and field values; it never receives a dataset identity or write credential. This works from the IIFE, ESM, or npm build.
55
+ - `FormSubmissionError` — Includes the stable `fillId`, HTTP status, and error code so an uncertain submission can be retried without creating a second fill.
56
+
57
+ ```ts
58
+ const receipt = await submitForm('hero-optin', { email });
59
+ if (receipt.next) window.location.assign(receipt.next);
60
+ ```
61
+
62
+ Plain HTML can use the same contract without loading the SDK:
63
+
64
+ ```html
65
+ <form method="post" action="https://fsaos-mcp-gw-rust.fly.dev/d/launch.example.com/actions/hero-optin">
66
+ <input type="hidden" name="_page_path" value="/offer">
67
+ <input type="email" name="email" required>
68
+ <button type="submit">Continue</button>
69
+ </form>
70
+ ```
71
+
52
72
  ### Shared Instances
53
73
  - `supabase` — Shared Supabase client instance
54
74
  - `queryClient` — Shared TanStack QueryClient instance
@@ -181,6 +201,26 @@ src/
181
201
  index.ts — Barrel export
182
202
  ```
183
203
 
204
+ ## Application bootstrap
205
+
206
+ Set the registered application configuration before importing the SDK, then
207
+ initialize it once. Tracking starts by default; custom business events remain
208
+ explicit.
209
+
210
+ ```ts
211
+ window.__FSAOS_CONFIG__ = {
212
+ hostname: 'app.example.com',
213
+ gatewayUrl: 'https://fsaos-mcp-gw-rust.fly.dev',
214
+ };
215
+
216
+ const { initializeFsaos } = await import('@ai4b-team/fsaos-gateway-sdk');
217
+ const fsaos = await initializeFsaos();
218
+ ```
219
+
220
+ Use `initializeFsaos({ tracking: false })` when consent or product policy
221
+ requires tracking to remain disabled. Published FSAOS IIFE pages call the same
222
+ bootstrap automatically.
223
+
184
224
  ## Build
185
225
 
186
226
  ```bash