@matterfact/embed 0.12.0 → 0.15.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 +41 -0
- package/dist/{chunk-M5TS546Z.js → chunk-C7DXO37G.js} +2 -2
- package/dist/{chunk-ZXMJWCQV.js → chunk-JLJG3MDX.js} +57 -35
- package/dist/chunk-JLJG3MDX.js.map +1 -0
- package/dist/chunk-QZCUQZJK.js +3 -0
- package/dist/chunk-QZCUQZJK.js.map +7 -0
- package/dist/{chunk-C4XGE6BO.js → chunk-S6OT47DL.js} +56 -34
- package/dist/chunk-S6OT47DL.js.map +1 -0
- package/dist/{chunk-WAUSVV7Y.js → chunk-UA4Y2O64.js} +2 -2
- package/dist/{context-4LP3EDXL.js → context-DAXACLSP.js} +3 -3
- package/dist/{context-4LP3EDXL.js.map → context-DAXACLSP.js.map} +1 -1
- package/dist/{context-ZSPDZWIB.js → context-IJK345PN.js} +2 -2
- package/dist/embed.js +1 -1
- package/dist/embed.js.map +3 -3
- package/dist/index.cjs +82 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +73 -2
- package/dist/index.d.ts +73 -2
- package/dist/index.js +29 -1
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +281 -55
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +168 -12
- package/dist/react.d.ts +168 -12
- package/dist/react.js +221 -19
- package/dist/react.js.map +1 -1
- package/dist/{snapshot-OR5SVEUD.js → snapshot-EVBNVVCT.js} +2 -2
- package/dist/{snapshot-X6FPP3HF.js → snapshot-P5SVKSPB.js} +3 -3
- package/dist/{snapshot-X6FPP3HF.js.map → snapshot-P5SVKSPB.js.map} +1 -1
- package/examples/embed-demo/.env.example +9 -0
- package/examples/embed-demo/README.md +66 -12
- package/examples/embed-demo/src/App.tsx +56 -12
- package/examples/embed-demo/src/config.ts +8 -0
- package/package.json +1 -1
- package/dist/chunk-C4XGE6BO.js.map +0 -1
- package/dist/chunk-SR4ZNUAN.js +0 -3
- package/dist/chunk-SR4ZNUAN.js.map +0 -7
- package/dist/chunk-ZXMJWCQV.js.map +0 -1
- /package/dist/{chunk-M5TS546Z.js.map → chunk-C7DXO37G.js.map} +0 -0
- /package/dist/{chunk-WAUSVV7Y.js.map → chunk-UA4Y2O64.js.map} +0 -0
- /package/dist/{context-ZSPDZWIB.js.map → context-IJK345PN.js.map} +0 -0
- /package/dist/{snapshot-OR5SVEUD.js.map → snapshot-EVBNVVCT.js.map} +0 -0
package/dist/react.d.cts
CHANGED
|
@@ -108,7 +108,30 @@ interface ToolEvent {
|
|
|
108
108
|
* - `chat` — a chat-turn moment. Content-free: phase + opaque chatId only.
|
|
109
109
|
* - `tool` — a host-tool lifecycle event (the `ToolEvent` shape, tagged). Also
|
|
110
110
|
* still delivered untagged to the legacy `onToolEvent` hook for back-compat.
|
|
111
|
+
* - `artifactParams` — an artifact param changed in the widget.
|
|
111
112
|
*/
|
|
113
|
+
/**
|
|
114
|
+
* A value an artifact param can carry. Mirrors the app's `ParamValue`
|
|
115
|
+
* (`enum` / `enum[]` / `entity` / `date` / `daterange` / `boolean` / `number`)
|
|
116
|
+
* DELIBERATELY BY COPY, not by import: this is a wire contract between two
|
|
117
|
+
* independently-deployed artifacts, and a shared type would let a rename
|
|
118
|
+
* compile on both sides while still breaking the wire. Bump PROTOCOL_VERSION
|
|
119
|
+
* instead. See this file's header.
|
|
120
|
+
*/
|
|
121
|
+
type ArtifactParamValue = string | string[] | number | boolean
|
|
122
|
+
/** `daterange`: a [from, to] pair of YYYY-MM-DD strings. */
|
|
123
|
+
| [string, string];
|
|
124
|
+
/**
|
|
125
|
+
* Artifact params on the wire, keyed by declared param name.
|
|
126
|
+
*
|
|
127
|
+
* Values are typed but NOT verified against the artifact's declared spec —
|
|
128
|
+
* a host can send anything, and the widget's param store coerces each value
|
|
129
|
+
* to its declared type (or drops it) on arrival. This type says what a
|
|
130
|
+
* well-behaved host means to send, not what the widget trusts it to have sent.
|
|
131
|
+
*/
|
|
132
|
+
type ArtifactParams = {
|
|
133
|
+
[name: string]: ArtifactParamValue;
|
|
134
|
+
};
|
|
112
135
|
type MatterfactEvent = {
|
|
113
136
|
type: 'ready';
|
|
114
137
|
} | {
|
|
@@ -130,7 +153,49 @@ type MatterfactEvent = {
|
|
|
130
153
|
chatId?: string;
|
|
131
154
|
} | ({
|
|
132
155
|
type: 'tool';
|
|
133
|
-
} & ToolEvent)
|
|
156
|
+
} & ToolEvent) | {
|
|
157
|
+
type: 'artifactParams';
|
|
158
|
+
params: ArtifactParams;
|
|
159
|
+
source: 'user' | 'context';
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
interface MatterfactAuthProviderProps {
|
|
163
|
+
/**
|
|
164
|
+
* Publishable key (`pk_…`) identifying this embed app. Public and origin-scoped —
|
|
165
|
+
* meant to sit in HTML. Every `MatterfactAgent`/`MatterfactArtifact`/`MatterfactDoc`
|
|
166
|
+
* under this provider inherits it, so you set it once here rather than on each child.
|
|
167
|
+
*/
|
|
168
|
+
publishableKey: string;
|
|
169
|
+
/**
|
|
170
|
+
* Origin serving the matterfact widgets (the app that hosts `/embed/*`). Defaults to
|
|
171
|
+
* production. This is the ONE place to set it — every child inherits it, and the
|
|
172
|
+
* `widgetOrigin` prop on `MatterfactAgent`/`MatterfactArtifact` is deprecated in
|
|
173
|
+
* favour of setting it here.
|
|
174
|
+
*/
|
|
175
|
+
widgetOrigin?: string;
|
|
176
|
+
/**
|
|
177
|
+
* HOST-AUTH PASSTHROUGH (trusted first-party embeds). Return a token this matterfact
|
|
178
|
+
* deployment already trusts — the host app's Entra/Firebase token, whatever its auth
|
|
179
|
+
* provider verifies — and every child iframe signs in SILENTLY with it, no separate
|
|
180
|
+
* sign-in. The provider brokers it: when a child needs auth it asks the provider,
|
|
181
|
+
* which calls this and hands the token back (over `postMessage`, pinned to the widget
|
|
182
|
+
* origin). Called on demand so the token can be fresh; may be async. Omit for the
|
|
183
|
+
* standard interactive sign-in.
|
|
184
|
+
*/
|
|
185
|
+
getAuthToken?: () => string | null | Promise<string | null>;
|
|
186
|
+
/** Colour theme applied to every child widget. Falls back to `'auto'`. */
|
|
187
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
188
|
+
/**
|
|
189
|
+
* Unified telemetry hook, fired for every embed lifecycle moment (`ready`, `auth`,
|
|
190
|
+
* `error`, …) across the children — pipe the whole embed into your own observability
|
|
191
|
+
* from one place. Never blocks or breaks a widget; a throw here is swallowed.
|
|
192
|
+
*/
|
|
193
|
+
onEvent?: (e: MatterfactEvent) => void;
|
|
194
|
+
/** The embed components (`MatterfactAgent`/`MatterfactArtifact`/`MatterfactDoc`) that
|
|
195
|
+
* inherit this provider's config. */
|
|
196
|
+
children: React.ReactNode;
|
|
197
|
+
}
|
|
198
|
+
declare function MatterfactAuthProvider({ publishableKey, widgetOrigin, getAuthToken, theme, onEvent, children, }: MatterfactAuthProviderProps): react_jsx_runtime.JSX.Element;
|
|
134
199
|
|
|
135
200
|
/**
|
|
136
201
|
* The Hoist adapter — a pure transform from a `HoistRuntime` (already read out of
|
|
@@ -212,12 +277,25 @@ interface HostToolDef {
|
|
|
212
277
|
}
|
|
213
278
|
|
|
214
279
|
interface MatterfactAgentProps {
|
|
215
|
-
/**
|
|
216
|
-
|
|
217
|
-
|
|
280
|
+
/**
|
|
281
|
+
* Publishable key (`pk_…`) identifying this embed app. Public, origin-scoped.
|
|
282
|
+
*
|
|
283
|
+
* Optional here ONLY because it can instead come from an ancestor
|
|
284
|
+
* `MatterfactAuthProvider` (`prop ?? context`) — one of the two must supply it,
|
|
285
|
+
* or the component throws at mount.
|
|
286
|
+
*/
|
|
287
|
+
publishableKey?: string;
|
|
288
|
+
/**
|
|
289
|
+
* Origin serving the widget (the matterfact app). Defaults to production.
|
|
290
|
+
*
|
|
291
|
+
* @deprecated Prefer setting this once on `<MatterfactAuthProvider>` and letting
|
|
292
|
+
* every `<MatterfactAgent>`/`<MatterfactArtifact>` underneath inherit it. Still
|
|
293
|
+
* fully supported standalone (no provider) — resolved as `prop ?? context ?? default`.
|
|
294
|
+
*/
|
|
218
295
|
widgetOrigin?: string;
|
|
219
296
|
/** Label for THIS embedding, for per-surface usage/history attribution. */
|
|
220
297
|
surface?: string;
|
|
298
|
+
/** Resolved as `prop ?? MatterfactAuthProvider's theme ?? 'auto'`. */
|
|
221
299
|
theme?: 'light' | 'dark' | 'auto';
|
|
222
300
|
/**
|
|
223
301
|
* HOST-AUTH PASSTHROUGH (trusted first-party embeds only). Return a token this
|
|
@@ -225,6 +303,8 @@ interface MatterfactAgentProps {
|
|
|
225
303
|
* token, whatever its auth provider verifies — and the widget signs in SILENTLY with
|
|
226
304
|
* it, no separate sign-in. Called on demand so the token can be fresh. Omit for the
|
|
227
305
|
* standard popup/inline sign-in (third-party hosts).
|
|
306
|
+
*
|
|
307
|
+
* Resolved as `prop ?? MatterfactAuthProvider's getAuthToken`.
|
|
228
308
|
*/
|
|
229
309
|
getAuthToken?: () => string | null | Promise<string | null>;
|
|
230
310
|
/**
|
|
@@ -329,25 +409,101 @@ interface MatterfactAgentProps {
|
|
|
329
409
|
*/
|
|
330
410
|
onEvent?: (e: MatterfactEvent) => void;
|
|
331
411
|
}
|
|
332
|
-
declare function MatterfactAgent({ publishableKey, widgetOrigin, surface, theme, getAuthToken, getPageContext, inline, className, style, pageContext, dev, actions, sitemap, artifacts, resolve, tools, onToolEvent, onEvent, }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
|
|
412
|
+
declare function MatterfactAgent({ publishableKey: publishableKeyProp, widgetOrigin: widgetOriginProp, surface, theme: themeProp, getAuthToken: getAuthTokenProp, getPageContext, inline, className, style, pageContext, dev, actions, sitemap, artifacts, resolve, tools, onToolEvent, onEvent, }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
|
|
333
413
|
interface MatterfactArtifactProps {
|
|
334
|
-
/** The artifact's slug
|
|
335
|
-
|
|
414
|
+
/** The artifact's name (its slug). */
|
|
415
|
+
name?: string;
|
|
416
|
+
/**
|
|
417
|
+
* @deprecated Use `name` instead. Still accepted as an alias — `name` wins
|
|
418
|
+
* when both are given.
|
|
419
|
+
*/
|
|
420
|
+
slug?: string;
|
|
336
421
|
/** The artifact owner's email — same as the Share dialog's `?owner=` param. */
|
|
337
422
|
owner: string;
|
|
338
|
-
/**
|
|
339
|
-
|
|
340
|
-
|
|
423
|
+
/**
|
|
424
|
+
* The artifact's read-only capability token — same as the Share dialog's `?t=`
|
|
425
|
+
* param. This is the standalone share-link path.
|
|
426
|
+
*
|
|
427
|
+
* @deprecated Prefer an ancestor `MatterfactAuthProvider` instead: with no
|
|
428
|
+
* `token`, the iframe authenticates the same way `MatterfactAgent` does — the
|
|
429
|
+
* provider's publishable key (`?k=`) plus the host page's origin (`?o=`) —
|
|
430
|
+
* instead of a share-link capability token. `token` still wins when both a
|
|
431
|
+
* token and a provider are present.
|
|
432
|
+
*/
|
|
433
|
+
token?: string;
|
|
434
|
+
/**
|
|
435
|
+
* Origin serving the widget (the matterfact app). Defaults to production.
|
|
436
|
+
*
|
|
437
|
+
* @deprecated Prefer setting this once on `<MatterfactAuthProvider>` and
|
|
438
|
+
* letting every `<MatterfactAgent>`/`<MatterfactArtifact>` underneath inherit
|
|
439
|
+
* it. Still fully supported standalone (no provider) — resolved as
|
|
440
|
+
* `prop ?? context ?? default`.
|
|
441
|
+
*/
|
|
341
442
|
widgetOrigin?: string;
|
|
443
|
+
/** Resolved as `prop ?? MatterfactAuthProvider's theme ?? 'auto'`. */
|
|
342
444
|
theme?: 'auto' | 'light' | 'dark';
|
|
445
|
+
/** Applied to the `<iframe>` element the artifact renders into. */
|
|
343
446
|
className?: string;
|
|
447
|
+
/** Applied to the `<iframe>` element. Merged over the default fill. */
|
|
344
448
|
style?: React.CSSProperties;
|
|
345
449
|
}
|
|
346
450
|
/**
|
|
347
451
|
* Render a matterfact artifact inline in a host page. Chrome-free, cross-origin. When a
|
|
348
452
|
* MatterfactAgent is embedded on the same page, the loader sees this iframe and both
|
|
349
453
|
* makes the agent aware of it and (via its token) lets the agent read its data.
|
|
454
|
+
*
|
|
455
|
+
* Two auth modes, `token` wins when both are available:
|
|
456
|
+
* - TOKEN mode (`token` given): a standalone share link, `?t=`. This is the LIVE
|
|
457
|
+
* third-party embed path — its `src` format must stay byte-identical.
|
|
458
|
+
* - SESSION mode (no `token`, an ancestor `MatterfactAuthProvider` is present):
|
|
459
|
+
* tokenless, `?k=<publishableKey>&o=<host origin>`, the same authentication
|
|
460
|
+
* `MatterfactAgent` uses.
|
|
461
|
+
* With neither, there is no way for the iframe to authenticate, so no iframe is
|
|
462
|
+
* built at all — matching the "incomplete link" placeholder the embed artifact
|
|
463
|
+
* page itself renders for a missing owner/token.
|
|
464
|
+
*/
|
|
465
|
+
declare function MatterfactArtifact({ name: nameProp, slug, owner, token, widgetOrigin: widgetOriginProp, theme: themeProp, className, style, }: MatterfactArtifactProps): react_jsx_runtime.JSX.Element;
|
|
466
|
+
/** The two live-drivable doc params, mirroring `EmbedDocumentPage`'s `HostDocParams`. */
|
|
467
|
+
type MatterfactDocParams = {
|
|
468
|
+
ticker?: string;
|
|
469
|
+
version?: string;
|
|
470
|
+
};
|
|
471
|
+
interface MatterfactDocProps {
|
|
472
|
+
/** The document catalog key (`EmbedDocumentPage`'s `?key=`). Fixed at mount — not
|
|
473
|
+
* drivable via `params`, unlike `ticker`/`version`. */
|
|
474
|
+
docKey: string;
|
|
475
|
+
/** Initial ticker, seeds the iframe's `?ticker=` query param. */
|
|
476
|
+
ticker?: string;
|
|
477
|
+
/** Initial version. Always sent explicitly on the iframe `src` — defaults to
|
|
478
|
+
* `'latest'` rather than being omitted, so the doc page never has to guess. */
|
|
479
|
+
version?: 'latest' | `${number}-${number}-${number}`;
|
|
480
|
+
/** Resolved as `prop ?? MatterfactAuthProvider's theme ?? 'auto'`. */
|
|
481
|
+
theme?: 'auto' | 'light' | 'dark';
|
|
482
|
+
/**
|
|
483
|
+
* Drive the document's ticker/version from your page after mount. Pass your whole
|
|
484
|
+
* param state; only the keys that actually changed since the last render are pushed
|
|
485
|
+
* to the iframe (as `host.docParams`), and the full set is re-sent once the iframe
|
|
486
|
+
* loads. A push is authoritative for every key it names — dropping a key stops
|
|
487
|
+
* driving it, it does not reset it. Omit this prop entirely for a static document
|
|
488
|
+
* whose ticker/version never change after mount.
|
|
489
|
+
*/
|
|
490
|
+
params?: MatterfactDocParams;
|
|
491
|
+
/** Applied to the `<iframe>` element the document renders into. */
|
|
492
|
+
className?: string;
|
|
493
|
+
/** Applied to the `<iframe>` element. Merged over the default fill. */
|
|
494
|
+
style?: React.CSSProperties;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Render a matterfact catalog document inline in a host page — the `MatterfactArtifact`
|
|
498
|
+
* counterpart for a published document/report instead of an artifact board.
|
|
499
|
+
*
|
|
500
|
+
* ALWAYS session-authed: there's no standalone share-token mode the way
|
|
501
|
+
* `MatterfactArtifact` has, so an ancestor `MatterfactAuthProvider` is required. With
|
|
502
|
+
* none present (or a provider with no `publishableKey`), there's no way for the
|
|
503
|
+
* iframe to authenticate — matching `MatterfactArtifact`'s own no-token-no-provider
|
|
504
|
+
* decision, no iframe is built at all; the same "incomplete link" placeholder shape
|
|
505
|
+
* is rendered instead of throwing.
|
|
350
506
|
*/
|
|
351
|
-
declare function
|
|
507
|
+
declare function MatterfactDoc({ docKey, ticker, version, theme: themeProp, params, className, style, }: MatterfactDocProps): react_jsx_runtime.JSX.Element;
|
|
352
508
|
|
|
353
|
-
export { type HostResolvers, type HostToolDef, MatterfactAgent, type MatterfactAgentProps, MatterfactArtifact, type MatterfactArtifactProps };
|
|
509
|
+
export { type HoistActionsConfig, type HostResolvers, type HostToolDef, MatterfactAgent, type MatterfactAgentProps, MatterfactArtifact, type MatterfactArtifactProps, MatterfactAuthProvider, type MatterfactAuthProviderProps, MatterfactDoc, type MatterfactDocParams, type MatterfactDocProps };
|
package/dist/react.d.ts
CHANGED
|
@@ -108,7 +108,30 @@ interface ToolEvent {
|
|
|
108
108
|
* - `chat` — a chat-turn moment. Content-free: phase + opaque chatId only.
|
|
109
109
|
* - `tool` — a host-tool lifecycle event (the `ToolEvent` shape, tagged). Also
|
|
110
110
|
* still delivered untagged to the legacy `onToolEvent` hook for back-compat.
|
|
111
|
+
* - `artifactParams` — an artifact param changed in the widget.
|
|
111
112
|
*/
|
|
113
|
+
/**
|
|
114
|
+
* A value an artifact param can carry. Mirrors the app's `ParamValue`
|
|
115
|
+
* (`enum` / `enum[]` / `entity` / `date` / `daterange` / `boolean` / `number`)
|
|
116
|
+
* DELIBERATELY BY COPY, not by import: this is a wire contract between two
|
|
117
|
+
* independently-deployed artifacts, and a shared type would let a rename
|
|
118
|
+
* compile on both sides while still breaking the wire. Bump PROTOCOL_VERSION
|
|
119
|
+
* instead. See this file's header.
|
|
120
|
+
*/
|
|
121
|
+
type ArtifactParamValue = string | string[] | number | boolean
|
|
122
|
+
/** `daterange`: a [from, to] pair of YYYY-MM-DD strings. */
|
|
123
|
+
| [string, string];
|
|
124
|
+
/**
|
|
125
|
+
* Artifact params on the wire, keyed by declared param name.
|
|
126
|
+
*
|
|
127
|
+
* Values are typed but NOT verified against the artifact's declared spec —
|
|
128
|
+
* a host can send anything, and the widget's param store coerces each value
|
|
129
|
+
* to its declared type (or drops it) on arrival. This type says what a
|
|
130
|
+
* well-behaved host means to send, not what the widget trusts it to have sent.
|
|
131
|
+
*/
|
|
132
|
+
type ArtifactParams = {
|
|
133
|
+
[name: string]: ArtifactParamValue;
|
|
134
|
+
};
|
|
112
135
|
type MatterfactEvent = {
|
|
113
136
|
type: 'ready';
|
|
114
137
|
} | {
|
|
@@ -130,7 +153,49 @@ type MatterfactEvent = {
|
|
|
130
153
|
chatId?: string;
|
|
131
154
|
} | ({
|
|
132
155
|
type: 'tool';
|
|
133
|
-
} & ToolEvent)
|
|
156
|
+
} & ToolEvent) | {
|
|
157
|
+
type: 'artifactParams';
|
|
158
|
+
params: ArtifactParams;
|
|
159
|
+
source: 'user' | 'context';
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
interface MatterfactAuthProviderProps {
|
|
163
|
+
/**
|
|
164
|
+
* Publishable key (`pk_…`) identifying this embed app. Public and origin-scoped —
|
|
165
|
+
* meant to sit in HTML. Every `MatterfactAgent`/`MatterfactArtifact`/`MatterfactDoc`
|
|
166
|
+
* under this provider inherits it, so you set it once here rather than on each child.
|
|
167
|
+
*/
|
|
168
|
+
publishableKey: string;
|
|
169
|
+
/**
|
|
170
|
+
* Origin serving the matterfact widgets (the app that hosts `/embed/*`). Defaults to
|
|
171
|
+
* production. This is the ONE place to set it — every child inherits it, and the
|
|
172
|
+
* `widgetOrigin` prop on `MatterfactAgent`/`MatterfactArtifact` is deprecated in
|
|
173
|
+
* favour of setting it here.
|
|
174
|
+
*/
|
|
175
|
+
widgetOrigin?: string;
|
|
176
|
+
/**
|
|
177
|
+
* HOST-AUTH PASSTHROUGH (trusted first-party embeds). Return a token this matterfact
|
|
178
|
+
* deployment already trusts — the host app's Entra/Firebase token, whatever its auth
|
|
179
|
+
* provider verifies — and every child iframe signs in SILENTLY with it, no separate
|
|
180
|
+
* sign-in. The provider brokers it: when a child needs auth it asks the provider,
|
|
181
|
+
* which calls this and hands the token back (over `postMessage`, pinned to the widget
|
|
182
|
+
* origin). Called on demand so the token can be fresh; may be async. Omit for the
|
|
183
|
+
* standard interactive sign-in.
|
|
184
|
+
*/
|
|
185
|
+
getAuthToken?: () => string | null | Promise<string | null>;
|
|
186
|
+
/** Colour theme applied to every child widget. Falls back to `'auto'`. */
|
|
187
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
188
|
+
/**
|
|
189
|
+
* Unified telemetry hook, fired for every embed lifecycle moment (`ready`, `auth`,
|
|
190
|
+
* `error`, …) across the children — pipe the whole embed into your own observability
|
|
191
|
+
* from one place. Never blocks or breaks a widget; a throw here is swallowed.
|
|
192
|
+
*/
|
|
193
|
+
onEvent?: (e: MatterfactEvent) => void;
|
|
194
|
+
/** The embed components (`MatterfactAgent`/`MatterfactArtifact`/`MatterfactDoc`) that
|
|
195
|
+
* inherit this provider's config. */
|
|
196
|
+
children: React.ReactNode;
|
|
197
|
+
}
|
|
198
|
+
declare function MatterfactAuthProvider({ publishableKey, widgetOrigin, getAuthToken, theme, onEvent, children, }: MatterfactAuthProviderProps): react_jsx_runtime.JSX.Element;
|
|
134
199
|
|
|
135
200
|
/**
|
|
136
201
|
* The Hoist adapter — a pure transform from a `HoistRuntime` (already read out of
|
|
@@ -212,12 +277,25 @@ interface HostToolDef {
|
|
|
212
277
|
}
|
|
213
278
|
|
|
214
279
|
interface MatterfactAgentProps {
|
|
215
|
-
/**
|
|
216
|
-
|
|
217
|
-
|
|
280
|
+
/**
|
|
281
|
+
* Publishable key (`pk_…`) identifying this embed app. Public, origin-scoped.
|
|
282
|
+
*
|
|
283
|
+
* Optional here ONLY because it can instead come from an ancestor
|
|
284
|
+
* `MatterfactAuthProvider` (`prop ?? context`) — one of the two must supply it,
|
|
285
|
+
* or the component throws at mount.
|
|
286
|
+
*/
|
|
287
|
+
publishableKey?: string;
|
|
288
|
+
/**
|
|
289
|
+
* Origin serving the widget (the matterfact app). Defaults to production.
|
|
290
|
+
*
|
|
291
|
+
* @deprecated Prefer setting this once on `<MatterfactAuthProvider>` and letting
|
|
292
|
+
* every `<MatterfactAgent>`/`<MatterfactArtifact>` underneath inherit it. Still
|
|
293
|
+
* fully supported standalone (no provider) — resolved as `prop ?? context ?? default`.
|
|
294
|
+
*/
|
|
218
295
|
widgetOrigin?: string;
|
|
219
296
|
/** Label for THIS embedding, for per-surface usage/history attribution. */
|
|
220
297
|
surface?: string;
|
|
298
|
+
/** Resolved as `prop ?? MatterfactAuthProvider's theme ?? 'auto'`. */
|
|
221
299
|
theme?: 'light' | 'dark' | 'auto';
|
|
222
300
|
/**
|
|
223
301
|
* HOST-AUTH PASSTHROUGH (trusted first-party embeds only). Return a token this
|
|
@@ -225,6 +303,8 @@ interface MatterfactAgentProps {
|
|
|
225
303
|
* token, whatever its auth provider verifies — and the widget signs in SILENTLY with
|
|
226
304
|
* it, no separate sign-in. Called on demand so the token can be fresh. Omit for the
|
|
227
305
|
* standard popup/inline sign-in (third-party hosts).
|
|
306
|
+
*
|
|
307
|
+
* Resolved as `prop ?? MatterfactAuthProvider's getAuthToken`.
|
|
228
308
|
*/
|
|
229
309
|
getAuthToken?: () => string | null | Promise<string | null>;
|
|
230
310
|
/**
|
|
@@ -329,25 +409,101 @@ interface MatterfactAgentProps {
|
|
|
329
409
|
*/
|
|
330
410
|
onEvent?: (e: MatterfactEvent) => void;
|
|
331
411
|
}
|
|
332
|
-
declare function MatterfactAgent({ publishableKey, widgetOrigin, surface, theme, getAuthToken, getPageContext, inline, className, style, pageContext, dev, actions, sitemap, artifacts, resolve, tools, onToolEvent, onEvent, }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
|
|
412
|
+
declare function MatterfactAgent({ publishableKey: publishableKeyProp, widgetOrigin: widgetOriginProp, surface, theme: themeProp, getAuthToken: getAuthTokenProp, getPageContext, inline, className, style, pageContext, dev, actions, sitemap, artifacts, resolve, tools, onToolEvent, onEvent, }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
|
|
333
413
|
interface MatterfactArtifactProps {
|
|
334
|
-
/** The artifact's slug
|
|
335
|
-
|
|
414
|
+
/** The artifact's name (its slug). */
|
|
415
|
+
name?: string;
|
|
416
|
+
/**
|
|
417
|
+
* @deprecated Use `name` instead. Still accepted as an alias — `name` wins
|
|
418
|
+
* when both are given.
|
|
419
|
+
*/
|
|
420
|
+
slug?: string;
|
|
336
421
|
/** The artifact owner's email — same as the Share dialog's `?owner=` param. */
|
|
337
422
|
owner: string;
|
|
338
|
-
/**
|
|
339
|
-
|
|
340
|
-
|
|
423
|
+
/**
|
|
424
|
+
* The artifact's read-only capability token — same as the Share dialog's `?t=`
|
|
425
|
+
* param. This is the standalone share-link path.
|
|
426
|
+
*
|
|
427
|
+
* @deprecated Prefer an ancestor `MatterfactAuthProvider` instead: with no
|
|
428
|
+
* `token`, the iframe authenticates the same way `MatterfactAgent` does — the
|
|
429
|
+
* provider's publishable key (`?k=`) plus the host page's origin (`?o=`) —
|
|
430
|
+
* instead of a share-link capability token. `token` still wins when both a
|
|
431
|
+
* token and a provider are present.
|
|
432
|
+
*/
|
|
433
|
+
token?: string;
|
|
434
|
+
/**
|
|
435
|
+
* Origin serving the widget (the matterfact app). Defaults to production.
|
|
436
|
+
*
|
|
437
|
+
* @deprecated Prefer setting this once on `<MatterfactAuthProvider>` and
|
|
438
|
+
* letting every `<MatterfactAgent>`/`<MatterfactArtifact>` underneath inherit
|
|
439
|
+
* it. Still fully supported standalone (no provider) — resolved as
|
|
440
|
+
* `prop ?? context ?? default`.
|
|
441
|
+
*/
|
|
341
442
|
widgetOrigin?: string;
|
|
443
|
+
/** Resolved as `prop ?? MatterfactAuthProvider's theme ?? 'auto'`. */
|
|
342
444
|
theme?: 'auto' | 'light' | 'dark';
|
|
445
|
+
/** Applied to the `<iframe>` element the artifact renders into. */
|
|
343
446
|
className?: string;
|
|
447
|
+
/** Applied to the `<iframe>` element. Merged over the default fill. */
|
|
344
448
|
style?: React.CSSProperties;
|
|
345
449
|
}
|
|
346
450
|
/**
|
|
347
451
|
* Render a matterfact artifact inline in a host page. Chrome-free, cross-origin. When a
|
|
348
452
|
* MatterfactAgent is embedded on the same page, the loader sees this iframe and both
|
|
349
453
|
* makes the agent aware of it and (via its token) lets the agent read its data.
|
|
454
|
+
*
|
|
455
|
+
* Two auth modes, `token` wins when both are available:
|
|
456
|
+
* - TOKEN mode (`token` given): a standalone share link, `?t=`. This is the LIVE
|
|
457
|
+
* third-party embed path — its `src` format must stay byte-identical.
|
|
458
|
+
* - SESSION mode (no `token`, an ancestor `MatterfactAuthProvider` is present):
|
|
459
|
+
* tokenless, `?k=<publishableKey>&o=<host origin>`, the same authentication
|
|
460
|
+
* `MatterfactAgent` uses.
|
|
461
|
+
* With neither, there is no way for the iframe to authenticate, so no iframe is
|
|
462
|
+
* built at all — matching the "incomplete link" placeholder the embed artifact
|
|
463
|
+
* page itself renders for a missing owner/token.
|
|
464
|
+
*/
|
|
465
|
+
declare function MatterfactArtifact({ name: nameProp, slug, owner, token, widgetOrigin: widgetOriginProp, theme: themeProp, className, style, }: MatterfactArtifactProps): react_jsx_runtime.JSX.Element;
|
|
466
|
+
/** The two live-drivable doc params, mirroring `EmbedDocumentPage`'s `HostDocParams`. */
|
|
467
|
+
type MatterfactDocParams = {
|
|
468
|
+
ticker?: string;
|
|
469
|
+
version?: string;
|
|
470
|
+
};
|
|
471
|
+
interface MatterfactDocProps {
|
|
472
|
+
/** The document catalog key (`EmbedDocumentPage`'s `?key=`). Fixed at mount — not
|
|
473
|
+
* drivable via `params`, unlike `ticker`/`version`. */
|
|
474
|
+
docKey: string;
|
|
475
|
+
/** Initial ticker, seeds the iframe's `?ticker=` query param. */
|
|
476
|
+
ticker?: string;
|
|
477
|
+
/** Initial version. Always sent explicitly on the iframe `src` — defaults to
|
|
478
|
+
* `'latest'` rather than being omitted, so the doc page never has to guess. */
|
|
479
|
+
version?: 'latest' | `${number}-${number}-${number}`;
|
|
480
|
+
/** Resolved as `prop ?? MatterfactAuthProvider's theme ?? 'auto'`. */
|
|
481
|
+
theme?: 'auto' | 'light' | 'dark';
|
|
482
|
+
/**
|
|
483
|
+
* Drive the document's ticker/version from your page after mount. Pass your whole
|
|
484
|
+
* param state; only the keys that actually changed since the last render are pushed
|
|
485
|
+
* to the iframe (as `host.docParams`), and the full set is re-sent once the iframe
|
|
486
|
+
* loads. A push is authoritative for every key it names — dropping a key stops
|
|
487
|
+
* driving it, it does not reset it. Omit this prop entirely for a static document
|
|
488
|
+
* whose ticker/version never change after mount.
|
|
489
|
+
*/
|
|
490
|
+
params?: MatterfactDocParams;
|
|
491
|
+
/** Applied to the `<iframe>` element the document renders into. */
|
|
492
|
+
className?: string;
|
|
493
|
+
/** Applied to the `<iframe>` element. Merged over the default fill. */
|
|
494
|
+
style?: React.CSSProperties;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Render a matterfact catalog document inline in a host page — the `MatterfactArtifact`
|
|
498
|
+
* counterpart for a published document/report instead of an artifact board.
|
|
499
|
+
*
|
|
500
|
+
* ALWAYS session-authed: there's no standalone share-token mode the way
|
|
501
|
+
* `MatterfactArtifact` has, so an ancestor `MatterfactAuthProvider` is required. With
|
|
502
|
+
* none present (or a provider with no `publishableKey`), there's no way for the
|
|
503
|
+
* iframe to authenticate — matching `MatterfactArtifact`'s own no-token-no-provider
|
|
504
|
+
* decision, no iframe is built at all; the same "incomplete link" placeholder shape
|
|
505
|
+
* is rendered instead of throwing.
|
|
350
506
|
*/
|
|
351
|
-
declare function
|
|
507
|
+
declare function MatterfactDoc({ docKey, ticker, version, theme: themeProp, params, className, style, }: MatterfactDocProps): react_jsx_runtime.JSX.Element;
|
|
352
508
|
|
|
353
|
-
export { type HostResolvers, type HostToolDef, MatterfactAgent, type MatterfactAgentProps, MatterfactArtifact, type MatterfactArtifactProps };
|
|
509
|
+
export { type HoistActionsConfig, type HostResolvers, type HostToolDef, MatterfactAgent, type MatterfactAgentProps, MatterfactArtifact, type MatterfactArtifactProps, MatterfactAuthProvider, type MatterfactAuthProviderProps, MatterfactDoc, type MatterfactDocParams, type MatterfactDocProps };
|