@matterfact/embed 0.6.0 → 0.8.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.
Files changed (52) hide show
  1. package/README.md +99 -1
  2. package/dist/chunk-PNSYFXXU.js +791 -0
  3. package/dist/chunk-PNSYFXXU.js.map +1 -0
  4. package/dist/chunk-R2ZEJARX.js +776 -0
  5. package/dist/chunk-R2ZEJARX.js.map +1 -0
  6. package/dist/{chunk-4Q2ROXLR.js → chunk-UD7CAQXV.js} +2 -2
  7. package/dist/{chunk-7I37ZFAJ.js → chunk-UQCETVRF.js} +2 -2
  8. package/dist/chunk-W52Q7G4J.js +3 -0
  9. package/dist/chunk-W52Q7G4J.js.map +7 -0
  10. package/dist/context-ARBB2XD6.js +3 -0
  11. package/dist/{context-YX2KXFLI.js.map → context-ARBB2XD6.js.map} +1 -1
  12. package/dist/{context-WU2F5CBC.js → context-MVGSYIMB.js} +2 -2
  13. package/dist/embed.js +1 -1
  14. package/dist/embed.js.map +4 -4
  15. package/dist/index.cjs +986 -159
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +140 -31
  18. package/dist/index.d.ts +140 -31
  19. package/dist/index.js +542 -130
  20. package/dist/index.js.map +1 -1
  21. package/dist/react.cjs +1012 -165
  22. package/dist/react.cjs.map +1 -1
  23. package/dist/react.d.cts +33 -1
  24. package/dist/react.d.ts +33 -1
  25. package/dist/react.js +561 -132
  26. package/dist/react.js.map +1 -1
  27. package/dist/{snapshot-MUXE7KXX.js → snapshot-GL4YBMXD.js} +3 -3
  28. package/dist/{snapshot-MUXE7KXX.js.map → snapshot-GL4YBMXD.js.map} +1 -1
  29. package/dist/{snapshot-JOGZWESK.js → snapshot-UGTXZVB6.js} +2 -2
  30. package/examples/embed-demo/.env.example +5 -1
  31. package/examples/embed-demo/README.md +37 -0
  32. package/examples/embed-demo/package.json +1 -1
  33. package/examples/embed-demo/src/App.tsx +82 -44
  34. package/examples/embed-demo/src/HoistDemo.tsx +390 -0
  35. package/examples/embed-demo/src/config.ts +34 -4
  36. package/examples/embed-demo/src/main.tsx +7 -0
  37. package/examples/embed-demo/src/mockXH.ts +492 -0
  38. package/examples/embed-demo/src/placement.tsx +43 -0
  39. package/examples/embed-demo/src/styles.css +147 -2
  40. package/examples/embed-demo/vite.config.ts +2 -2
  41. package/package.json +1 -1
  42. package/dist/chunk-AXKXNYRT.js +0 -381
  43. package/dist/chunk-AXKXNYRT.js.map +0 -1
  44. package/dist/chunk-D7R6WVHG.js +0 -2
  45. package/dist/chunk-D7R6WVHG.js.map +0 -7
  46. package/dist/chunk-RS6RMZ77.js +0 -396
  47. package/dist/chunk-RS6RMZ77.js.map +0 -1
  48. package/dist/context-YX2KXFLI.js +0 -3
  49. /package/dist/{chunk-4Q2ROXLR.js.map → chunk-UD7CAQXV.js.map} +0 -0
  50. /package/dist/{chunk-7I37ZFAJ.js.map → chunk-UQCETVRF.js.map} +0 -0
  51. /package/dist/{context-WU2F5CBC.js.map → context-MVGSYIMB.js.map} +0 -0
  52. /package/dist/{snapshot-JOGZWESK.js.map → snapshot-UGTXZVB6.js.map} +0 -0
package/dist/react.d.cts CHANGED
@@ -25,6 +25,27 @@ interface PageEntity {
25
25
  data?: Record<string, unknown>;
26
26
  }
27
27
 
28
+ /**
29
+ * The Hoist adapter — a pure transform from a `HoistRuntime` (already read out of
30
+ * `window.XH` by hoist-runtime.ts) into the context/snapshot shapes context.ts sends
31
+ * over the bridge.
32
+ *
33
+ * This file never touches `window` or `XH` itself — see hoist-runtime.ts for the only
34
+ * code that does — so every function here is a plain, fully unit-testable transform
35
+ * against a plain object. That split is what keeps this file degrade-safe: it can be
36
+ * exhaustively tested without a real Hoist app, and hoist-runtime.ts's own try/catch
37
+ * (via detectHoist) is the one place a live-model surprise can ever throw.
38
+ */
39
+
40
+ /** The host's policy for agent-driven actions, keyed by tool family. Read from
41
+ * `window.matterfact.hoist.actions` by hoist-runtime.ts's `readActionsConfig`
42
+ * (the `<MatterfactAgent actions>` React prop is sugar that writes that same
43
+ * global — see react.tsx's `writeActionsGlobal`); `'off'` is the default — the
44
+ * tool is opt-in, never advertised unless a host turns it on. */
45
+ interface HoistActionsConfig {
46
+ navigate: 'off' | 'confirm' | 'auto';
47
+ }
48
+
28
49
  interface MatterfactAgentProps {
29
50
  /** Publishable key (`pk_…`) identifying this embed app. Public, origin-scoped. */
30
51
  publishableKey: string;
@@ -76,8 +97,19 @@ interface MatterfactAgentProps {
76
97
  * OR'd together.
77
98
  */
78
99
  dev?: boolean;
100
+ /**
101
+ * Turn on agent-driven host tools (today: `hoist.navigate`) at the given confirm
102
+ * tier, e.g. `{ navigate: 'confirm' }`. Default is every action tool OFF; this is
103
+ * opt-in only.
104
+ *
105
+ * This is just sugar over setting `window.matterfact.hoist.actions` yourself — the
106
+ * LAZY chunk (adapters/hoist-runtime.ts's `readActionsConfig`) reads that global
107
+ * directly at advertise/execute time, so there is nothing for the eager loader to
108
+ * carry. See `writeActionsGlobal` below.
109
+ */
110
+ actions?: HoistActionsConfig;
79
111
  }
80
- declare function MatterfactAgent({ publishableKey, widgetOrigin, surface, theme, getAuthToken, getPageContext, inline, className, style, pageContext, dev, }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
112
+ declare function MatterfactAgent({ publishableKey, widgetOrigin, surface, theme, getAuthToken, getPageContext, inline, className, style, pageContext, dev, actions, }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
81
113
  interface MatterfactArtifactProps {
82
114
  /** The artifact's slug/name. */
83
115
  slug: string;
package/dist/react.d.ts CHANGED
@@ -25,6 +25,27 @@ interface PageEntity {
25
25
  data?: Record<string, unknown>;
26
26
  }
27
27
 
28
+ /**
29
+ * The Hoist adapter — a pure transform from a `HoistRuntime` (already read out of
30
+ * `window.XH` by hoist-runtime.ts) into the context/snapshot shapes context.ts sends
31
+ * over the bridge.
32
+ *
33
+ * This file never touches `window` or `XH` itself — see hoist-runtime.ts for the only
34
+ * code that does — so every function here is a plain, fully unit-testable transform
35
+ * against a plain object. That split is what keeps this file degrade-safe: it can be
36
+ * exhaustively tested without a real Hoist app, and hoist-runtime.ts's own try/catch
37
+ * (via detectHoist) is the one place a live-model surprise can ever throw.
38
+ */
39
+
40
+ /** The host's policy for agent-driven actions, keyed by tool family. Read from
41
+ * `window.matterfact.hoist.actions` by hoist-runtime.ts's `readActionsConfig`
42
+ * (the `<MatterfactAgent actions>` React prop is sugar that writes that same
43
+ * global — see react.tsx's `writeActionsGlobal`); `'off'` is the default — the
44
+ * tool is opt-in, never advertised unless a host turns it on. */
45
+ interface HoistActionsConfig {
46
+ navigate: 'off' | 'confirm' | 'auto';
47
+ }
48
+
28
49
  interface MatterfactAgentProps {
29
50
  /** Publishable key (`pk_…`) identifying this embed app. Public, origin-scoped. */
30
51
  publishableKey: string;
@@ -76,8 +97,19 @@ interface MatterfactAgentProps {
76
97
  * OR'd together.
77
98
  */
78
99
  dev?: boolean;
100
+ /**
101
+ * Turn on agent-driven host tools (today: `hoist.navigate`) at the given confirm
102
+ * tier, e.g. `{ navigate: 'confirm' }`. Default is every action tool OFF; this is
103
+ * opt-in only.
104
+ *
105
+ * This is just sugar over setting `window.matterfact.hoist.actions` yourself — the
106
+ * LAZY chunk (adapters/hoist-runtime.ts's `readActionsConfig`) reads that global
107
+ * directly at advertise/execute time, so there is nothing for the eager loader to
108
+ * carry. See `writeActionsGlobal` below.
109
+ */
110
+ actions?: HoistActionsConfig;
79
111
  }
80
- declare function MatterfactAgent({ publishableKey, widgetOrigin, surface, theme, getAuthToken, getPageContext, inline, className, style, pageContext, dev, }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
112
+ declare function MatterfactAgent({ publishableKey, widgetOrigin, surface, theme, getAuthToken, getPageContext, inline, className, style, pageContext, dev, actions, }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
81
113
  interface MatterfactArtifactProps {
82
114
  /** The artifact's slug/name. */
83
115
  slug: string;