@liforma/client 0.4.6 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +23 -0
  3. package/dist/next/index.js +18 -2
  4. package/dist/next/index.js.map +1 -1
  5. package/dist/next/next/thumbnail.d.ts +5 -0
  6. package/dist/next/next/thumbnail.d.ts.map +1 -0
  7. package/dist/next/react/thumbnail.d.ts +4 -0
  8. package/dist/next/react/thumbnail.d.ts.map +1 -0
  9. package/dist/next/thumbnail.js +396 -0
  10. package/dist/next/thumbnail.js.map +1 -0
  11. package/dist/next/v2/embed/iframeHost.d.ts +1 -0
  12. package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
  13. package/dist/next/v2/embed/protocol.d.ts +6 -0
  14. package/dist/next/v2/embed/protocol.d.ts.map +1 -1
  15. package/dist/next/v2/experience.d.ts +3 -0
  16. package/dist/next/v2/experience.d.ts.map +1 -1
  17. package/dist/next/v2/experienceEvents.d.ts +2 -0
  18. package/dist/next/v2/experienceEvents.d.ts.map +1 -1
  19. package/dist/npm/index.js +18 -2
  20. package/dist/npm/index.js.map +1 -1
  21. package/dist/npm/thumbnail/index.js +231 -0
  22. package/dist/npm/thumbnail/index.js.map +1 -0
  23. package/dist/npm/v2/embed/iframeHost.d.ts +1 -0
  24. package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
  25. package/dist/npm/v2/embed/protocol.d.ts +6 -0
  26. package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
  27. package/dist/npm/v2/experience.d.ts +3 -0
  28. package/dist/npm/v2/experience.d.ts.map +1 -1
  29. package/dist/npm/v2/experienceEvents.d.ts +2 -0
  30. package/dist/npm/v2/experienceEvents.d.ts.map +1 -1
  31. package/dist/npm/v2/thumbnail-cdn.d.ts +17 -0
  32. package/dist/npm/v2/thumbnail-cdn.d.ts.map +1 -0
  33. package/dist/react/component/experienceComponentTypes.d.ts +3 -0
  34. package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
  35. package/dist/react/index.js +19 -2
  36. package/dist/react/index.js.map +1 -1
  37. package/dist/react/react/Experience.d.ts.map +1 -1
  38. package/dist/react/react/thumbnail.d.ts +4 -0
  39. package/dist/react/react/thumbnail.d.ts.map +1 -0
  40. package/dist/react/thumbnail.js +396 -0
  41. package/dist/react/thumbnail.js.map +1 -0
  42. package/dist/react/v2/embed/iframeHost.d.ts +1 -0
  43. package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
  44. package/dist/react/v2/embed/protocol.d.ts +6 -0
  45. package/dist/react/v2/embed/protocol.d.ts.map +1 -1
  46. package/dist/react/v2/experience.d.ts +3 -0
  47. package/dist/react/v2/experience.d.ts.map +1 -1
  48. package/dist/react/v2/experienceEvents.d.ts +2 -0
  49. package/dist/react/v2/experienceEvents.d.ts.map +1 -1
  50. package/dist/sdk/v2/client.js +3 -810
  51. package/dist/sdk/v2/client.js.map +1 -1
  52. package/dist/sdk/v2/thumbnail.js +222 -0
  53. package/dist/sdk/v2/thumbnail.js.map +1 -0
  54. package/dist/svelte/Experience.svelte +9 -0
  55. package/dist/svelte/Experience.svelte.d.ts +1 -0
  56. package/dist/svelte/ExperienceThumbnail.svelte +1 -1
  57. package/dist/svelte/ExperienceThumbnail.svelte.d.ts +1 -1
  58. package/dist/svelte/thumbnail.d.ts +2 -0
  59. package/dist/svelte/thumbnail.js +1 -0
  60. package/package.json +24 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @liforma/client changelog
2
2
 
3
+ ## 0.4.8 — 2026-08-30
4
+
5
+ ### Added
6
+
7
+ - `@liforma/client/react/thumbnail` and `@liforma/client/next/thumbnail` — gallery components without session / widget code
8
+ - CDN `https://cdn.liforma.ai/sdk/v2/thumbnail.js` — registers `<liforma-experience-thumbnail>` only
9
+
10
+ ### Changed
11
+
12
+ - Package `"sideEffects": false` so bundlers can drop unused barrel exports
13
+ - Docs / snippets default gallery imports to the light thumbnail entries
14
+ - Verify scripts fail if light thumbnail builds contain session SDK markers
15
+
16
+ ## 0.4.7 — 2026-08-30
17
+
18
+ ### Added
19
+
20
+ - `@liforma/client/thumbnail` — thumbnail helpers without the session player
21
+ - `@liforma/client/svelte/thumbnail` — `<ExperienceThumbnail>` without pulling `<Experience>` / widget
22
+
23
+ ### Notes
24
+
25
+ - Gallery hosts should import the thumbnail entry so marketing pages do not hydrate the session SDK
26
+
3
27
  ## 0.4.6 — 2026-08-30
4
28
 
5
29
  ### Added
package/README.md CHANGED
@@ -30,6 +30,24 @@ Optional peers: `svelte` ^5 for the Svelte entry; `react` / `react-dom` ^18 or ^
30
30
  <Experience experienceId="exp_01EXAMPLES_COFFEE_BARISTA" />
31
31
  ```
32
32
 
33
+ Gallery cards — use the light thumbnail entry so landing pages do not load the session SDK:
34
+
35
+ ```svelte
36
+ <script>
37
+ import { ExperienceThumbnail } from '@liforma/client/svelte/thumbnail';
38
+ </script>
39
+ ```
40
+
41
+ ```tsx
42
+ import { ExperienceThumbnail } from '@liforma/client/react/thumbnail';
43
+ // or: import { ExperienceThumbnail } from '@liforma/client/next/thumbnail';
44
+ ```
45
+
46
+ ```html
47
+ <script src="https://cdn.liforma.ai/sdk/v2/thumbnail.js" defer></script>
48
+ <liforma-experience-thumbnail experience-id="exp_…" alt="…"></liforma-experience-thumbnail>
49
+ ```
50
+
33
51
  ### React
34
52
 
35
53
  ```tsx
@@ -79,8 +97,12 @@ export function Demo() {
79
97
  |--------|---------|
80
98
  | `@liforma/client` | JS API (`Experience.startSession`, types) |
81
99
  | `@liforma/client/svelte` | `<Experience />`, `<ExperienceThumbnail />`, `<ExperienceWidget />` |
100
+ | `@liforma/client/svelte/thumbnail` | `<ExperienceThumbnail />` only (prefer for galleries) |
101
+ | `@liforma/client/thumbnail` | Shared thumbnail helpers (no session player) |
82
102
  | `@liforma/client/react` | React components |
103
+ | `@liforma/client/react/thumbnail` | `<ExperienceThumbnail />` only (prefer for galleries) |
83
104
  | `@liforma/client/next` | Next helpers + client components |
105
+ | `@liforma/client/next/thumbnail` | `<ExperienceThumbnail />` only (prefer for galleries) |
84
106
  | `@liforma/client/byo` | Shared BYO primitives (PCM/mic/turn helpers) |
85
107
  | `@liforma/client/elevenlabs` | `connectElevenLabsAgent` (BYO ElevenLabs Agents → avatar) |
86
108
  | `@liforma/client/openai` | `connectOpenAiRealtime` / `connectOpenAiRealtimeWebRtc` (BYO OpenAI Realtime → avatar) |
@@ -88,6 +110,7 @@ export function Demo() {
88
110
  | `@liforma/client/google` | `connectGeminiLive` (BYO Gemini Live → avatar) |
89
111
  | `@liforma/client/livekit` | `connectLiveKitAgent` (BYO LiveKit remote track → avatar) |
90
112
  | CDN `sdk/v2/client.js` | Web components + `window.Liforma` |
113
+ | CDN `sdk/v2/thumbnail.js` | `<liforma-experience-thumbnail>` only |
91
114
 
92
115
  ## Session minting
93
116
 
@@ -1424,6 +1424,13 @@ function ft(e) {
1424
1424
  }
1425
1425
  });
1426
1426
  },
1427
+ engage() {
1428
+ return C({
1429
+ type: "engage",
1430
+ schemaVersion: 2,
1431
+ payload: { correlationId: Z() }
1432
+ });
1433
+ },
1427
1434
  destroy() {
1428
1435
  if (!r) {
1429
1436
  r = !0, i && s(!1);
@@ -1497,6 +1504,7 @@ function wt() {
1497
1504
  return {
1498
1505
  ready: /* @__PURE__ */ new Set(),
1499
1506
  started: /* @__PURE__ */ new Set(),
1507
+ sessionMinted: /* @__PURE__ */ new Set(),
1500
1508
  userTranscript: /* @__PURE__ */ new Set(),
1501
1509
  userSpeechStarted: /* @__PURE__ */ new Set(),
1502
1510
  userSpeechEnded: /* @__PURE__ */ new Set(),
@@ -2173,6 +2181,7 @@ var un = class e {
2173
2181
  eventRegistry = wt();
2174
2182
  readyEnvelope = null;
2175
2183
  startedEnvelope = null;
2184
+ sessionMintedEnvelope = null;
2176
2185
  conversationCache = [];
2177
2186
  speech;
2178
2187
  constructor(e) {
@@ -2261,7 +2270,7 @@ var un = class e {
2261
2270
  }
2262
2271
  on(e, t) {
2263
2272
  let n = Tt(this.eventRegistry, e, t);
2264
- return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), n;
2273
+ return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), e === "sessionMinted" && this.sessionMintedEnvelope && queueMicrotask(() => t(this.sessionMintedEnvelope)), n;
2265
2274
  }
2266
2275
  async attach(e) {
2267
2276
  if (this.closed) throw Error("Session has ended.");
@@ -2377,7 +2386,9 @@ var un = class e {
2377
2386
  f.postParentHello();
2378
2387
  let g = h?.launch ?? (this.bootstrap.kind === "launch" ? this.bootstrap.launch : null), _ = h?.session ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
2379
2388
  if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
2380
- return this.launchToken = g, _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && Fe(_), f.postLaunch(g, _, {
2389
+ this.launchToken = g;
2390
+ let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
2391
+ return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && Fe(_), f.postLaunch(g, _, {
2381
2392
  startButton: e.startButton,
2382
2393
  theme: e.theme,
2383
2394
  showFeedback: e.showFeedback
@@ -2423,6 +2434,11 @@ var un = class e {
2423
2434
  if (!this.iframeHost) throw Error("conversion() requires attach() first.");
2424
2435
  await this.iframeHost.conversion(e);
2425
2436
  }
2437
+ async engage() {
2438
+ if (this.closed) throw Error("Session has ended.");
2439
+ if (!this.iframeHost) throw Error("engage() requires attach() first.");
2440
+ await this.iframeHost.engage();
2441
+ }
2426
2442
  getLastTurn() {
2427
2443
  if (this.conversationCache.length === 0) return [];
2428
2444
  let e = this.conversationCache[this.conversationCache.length - 1].turnId;