@ai4b-team/fsaos-gateway-sdk 5.1.1 → 5.3.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 +40 -0
- package/dist/iife/gateway.js +4 -4
- package/dist/iife/gateway.js.map +4 -4
- package/dist/iife/ui.js +1 -1
- package/dist/index.cjs +219 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +71 -1
- package/dist/index.d.ts +71 -1
- package/dist/index.js +217 -44
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -333,6 +333,46 @@ Use `initializeFsaos({ tracking: false })` when consent or product policy
|
|
|
333
333
|
requires tracking to remain disabled. Published FSAOS IIFE pages call the same
|
|
334
334
|
bootstrap automatically.
|
|
335
335
|
|
|
336
|
+
### A host that holds the session
|
|
337
|
+
|
|
338
|
+
A page can run with no session of its own: the app that frames it makes its
|
|
339
|
+
kernel calls. A RevDev desk preview inside the builder works this way. The
|
|
340
|
+
previewed page holds no credential and nothing secret is in its address; its
|
|
341
|
+
calls go through the same gateway door, as the same person, as the app around
|
|
342
|
+
it.
|
|
343
|
+
|
|
344
|
+
The framed page is started with `hostSession` and meets its host before it
|
|
345
|
+
renders:
|
|
346
|
+
|
|
347
|
+
```ts
|
|
348
|
+
window.__FSAOS_CONFIG__ = { hostSession: true };
|
|
349
|
+
|
|
350
|
+
const { connectHostSession } = await import('@ai4b-team/fsaos-gateway-sdk');
|
|
351
|
+
const { item } = await connectHostSession(); // sets the host's anchor; `item` is what the app is handed
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
The host answers one frame, and stops when the frame goes away:
|
|
355
|
+
|
|
356
|
+
```ts
|
|
357
|
+
const stop = serveHostSession({
|
|
358
|
+
frame: () => iframe.contentWindow,
|
|
359
|
+
origin: 'https://desk-1-preview.example',
|
|
360
|
+
item: () => envelope,
|
|
361
|
+
});
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
With `hostSession` every `gatewayCall` (and so every hook and `callTool`) goes
|
|
365
|
+
to the host, which makes it with its own token and anchor and passes back the
|
|
366
|
+
same response or the same error. The page sends no bearer, does not wait for a
|
|
367
|
+
sign-in, and opens no realtime connection: change events do not arrive, so a
|
|
368
|
+
read made with `useRealtimeQuery` runs once and is not refreshed. Outside its
|
|
369
|
+
host (opened in its own tab) the page has no session, and
|
|
370
|
+
`connectHostSession()` rejects with `HostSessionUnavailableError`.
|
|
371
|
+
|
|
372
|
+
The framed page's code runs as the signed-in person for as long as it is
|
|
373
|
+
served, as a screen opened inside the app does. Serve only a frame the person
|
|
374
|
+
chose to open.
|
|
375
|
+
|
|
336
376
|
## Build
|
|
337
377
|
|
|
338
378
|
```bash
|