@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
@@ -395,6 +395,7 @@ var te = e(function(e, a) {
395
395
  focusCharacter: (e) => R.current.withSession((t) => t.focusCharacter(e)),
396
396
  setFit: (e) => R.current.withSession((t) => t.setFit(e)),
397
397
  conversion: (e) => R.current.withSession((t) => t.conversion(e)),
398
+ engage: () => R.current.withSession((e) => e.engage()),
398
399
  end: () => R.current.withSession((e) => e.end())
399
400
  }), []), i(() => {
400
401
  if (!B || !se.current) return;
@@ -1787,6 +1788,13 @@ function Mt(e) {
1787
1788
  }
1788
1789
  });
1789
1790
  },
1791
+ engage() {
1792
+ return C({
1793
+ type: "engage",
1794
+ schemaVersion: 2,
1795
+ payload: { correlationId: Z() }
1796
+ });
1797
+ },
1790
1798
  destroy() {
1791
1799
  if (!r) {
1792
1800
  r = !0, i && s(!1);
@@ -1860,6 +1868,7 @@ function Wt() {
1860
1868
  return {
1861
1869
  ready: /* @__PURE__ */ new Set(),
1862
1870
  started: /* @__PURE__ */ new Set(),
1871
+ sessionMinted: /* @__PURE__ */ new Set(),
1863
1872
  userTranscript: /* @__PURE__ */ new Set(),
1864
1873
  userSpeechStarted: /* @__PURE__ */ new Set(),
1865
1874
  userSpeechEnded: /* @__PURE__ */ new Set(),
@@ -2536,6 +2545,7 @@ var An = class e {
2536
2545
  eventRegistry = Wt();
2537
2546
  readyEnvelope = null;
2538
2547
  startedEnvelope = null;
2548
+ sessionMintedEnvelope = null;
2539
2549
  conversationCache = [];
2540
2550
  speech;
2541
2551
  constructor(e) {
@@ -2624,7 +2634,7 @@ var An = class e {
2624
2634
  }
2625
2635
  on(e, t) {
2626
2636
  let n = Gt(this.eventRegistry, e, t);
2627
- return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), n;
2637
+ 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;
2628
2638
  }
2629
2639
  async attach(e) {
2630
2640
  if (this.closed) throw Error("Session has ended.");
@@ -2740,7 +2750,9 @@ var An = class e {
2740
2750
  f.postParentHello();
2741
2751
  let g = h?.launch ?? (this.bootstrap.kind === "launch" ? this.bootstrap.launch : null), _ = h?.session ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
2742
2752
  if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
2743
- return this.launchToken = g, _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && tt(_), f.postLaunch(g, _, {
2753
+ this.launchToken = g;
2754
+ let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
2755
+ return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && tt(_), f.postLaunch(g, _, {
2744
2756
  startButton: e.startButton,
2745
2757
  theme: e.theme,
2746
2758
  showFeedback: e.showFeedback
@@ -2786,6 +2798,11 @@ var An = class e {
2786
2798
  if (!this.iframeHost) throw Error("conversion() requires attach() first.");
2787
2799
  await this.iframeHost.conversion(e);
2788
2800
  }
2801
+ async engage() {
2802
+ if (this.closed) throw Error("Session has ended.");
2803
+ if (!this.iframeHost) throw Error("engage() requires attach() first.");
2804
+ await this.iframeHost.engage();
2805
+ }
2789
2806
  getLastTurn() {
2790
2807
  if (this.conversationCache.length === 0) return [];
2791
2808
  let e = this.conversationCache[this.conversationCache.length - 1].turnId;