@matterfact/embed 0.13.0 → 0.16.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 +37 -2
- package/dist/react.cjs +275 -28
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +164 -11
- package/dist/react.d.ts +164 -11
- package/dist/react.js +264 -19
- package/dist/react.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/react.d.cts
CHANGED
|
@@ -159,6 +159,44 @@ type MatterfactEvent = {
|
|
|
159
159
|
source: 'user' | 'context';
|
|
160
160
|
};
|
|
161
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;
|
|
199
|
+
|
|
162
200
|
/**
|
|
163
201
|
* The Hoist adapter — a pure transform from a `HoistRuntime` (already read out of
|
|
164
202
|
* `window.XH` by hoist-runtime.ts) into the context/snapshot shapes context.ts sends
|
|
@@ -239,12 +277,25 @@ interface HostToolDef {
|
|
|
239
277
|
}
|
|
240
278
|
|
|
241
279
|
interface MatterfactAgentProps {
|
|
242
|
-
/**
|
|
243
|
-
|
|
244
|
-
|
|
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
|
+
*/
|
|
245
295
|
widgetOrigin?: string;
|
|
246
296
|
/** Label for THIS embedding, for per-surface usage/history attribution. */
|
|
247
297
|
surface?: string;
|
|
298
|
+
/** Resolved as `prop ?? MatterfactAuthProvider's theme ?? 'auto'`. */
|
|
248
299
|
theme?: 'light' | 'dark' | 'auto';
|
|
249
300
|
/**
|
|
250
301
|
* HOST-AUTH PASSTHROUGH (trusted first-party embeds only). Return a token this
|
|
@@ -252,6 +303,8 @@ interface MatterfactAgentProps {
|
|
|
252
303
|
* token, whatever its auth provider verifies — and the widget signs in SILENTLY with
|
|
253
304
|
* it, no separate sign-in. Called on demand so the token can be fresh. Omit for the
|
|
254
305
|
* standard popup/inline sign-in (third-party hosts).
|
|
306
|
+
*
|
|
307
|
+
* Resolved as `prop ?? MatterfactAuthProvider's getAuthToken`.
|
|
255
308
|
*/
|
|
256
309
|
getAuthToken?: () => string | null | Promise<string | null>;
|
|
257
310
|
/**
|
|
@@ -356,25 +409,125 @@ interface MatterfactAgentProps {
|
|
|
356
409
|
*/
|
|
357
410
|
onEvent?: (e: MatterfactEvent) => void;
|
|
358
411
|
}
|
|
359
|
-
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;
|
|
360
413
|
interface MatterfactArtifactProps {
|
|
361
|
-
/** The artifact's slug
|
|
362
|
-
|
|
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;
|
|
363
421
|
/** The artifact owner's email — same as the Share dialog's `?owner=` param. */
|
|
364
422
|
owner: string;
|
|
365
|
-
/**
|
|
366
|
-
|
|
367
|
-
|
|
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
|
+
*/
|
|
368
442
|
widgetOrigin?: string;
|
|
443
|
+
/** Resolved as `prop ?? MatterfactAuthProvider's theme ?? 'auto'`. */
|
|
369
444
|
theme?: 'auto' | 'light' | 'dark';
|
|
445
|
+
/** Applied to the `<iframe>` element the artifact renders into. */
|
|
370
446
|
className?: string;
|
|
447
|
+
/** Applied to the `<iframe>` element. Merged over the default fill. */
|
|
371
448
|
style?: React.CSSProperties;
|
|
449
|
+
/**
|
|
450
|
+
* Drive the artifact's declared params from your page — the company it's about, the
|
|
451
|
+
* time window, the peer set. View-only: a param change re-renders the artifact from
|
|
452
|
+
* data it already has, and never re-queries or runs the agent.
|
|
453
|
+
*
|
|
454
|
+
* Pass your whole param state; the component works out what actually changed and
|
|
455
|
+
* pushes only that. That matters, because a push is authoritative for every key it
|
|
456
|
+
* names: re-asserting a param the reader has since changed in the artifact's own
|
|
457
|
+
* control bar would silently overwrite their choice. Dropping a key stops driving it
|
|
458
|
+
* and leaves its current value alone — there is no "unset".
|
|
459
|
+
*
|
|
460
|
+
* NOTE: `MatterfactAgent`'s `setArtifactParams` steers artifacts rendered INSIDE the
|
|
461
|
+
* chat. This prop steers THIS artifact. They are different iframes; neither reaches
|
|
462
|
+
* the other.
|
|
463
|
+
*/
|
|
464
|
+
params?: Record<string, unknown>;
|
|
465
|
+
/**
|
|
466
|
+
* Fired when a param changes inside the artifact — `'user'` when the reader used its
|
|
467
|
+
* control bar, `'context'` when a bound param followed the host page's context.
|
|
468
|
+
*
|
|
469
|
+
* Never fires for your own `params` pushes, so feeding this straight back into the
|
|
470
|
+
* `params` prop cannot loop.
|
|
471
|
+
*/
|
|
472
|
+
onParamsChange?: (params: Record<string, unknown>, source: 'user' | 'context') => void;
|
|
372
473
|
}
|
|
373
474
|
/**
|
|
374
475
|
* Render a matterfact artifact inline in a host page. Chrome-free, cross-origin. When a
|
|
375
476
|
* MatterfactAgent is embedded on the same page, the loader sees this iframe and both
|
|
376
477
|
* makes the agent aware of it and (via its token) lets the agent read its data.
|
|
478
|
+
*
|
|
479
|
+
* Two auth modes, `token` wins when both are available:
|
|
480
|
+
* - TOKEN mode (`token` given): a standalone share link, `?t=`. This is the LIVE
|
|
481
|
+
* third-party embed path — its `src` format must stay byte-identical.
|
|
482
|
+
* - SESSION mode (no `token`, an ancestor `MatterfactAuthProvider` is present):
|
|
483
|
+
* tokenless, `?k=<publishableKey>&o=<host origin>`, the same authentication
|
|
484
|
+
* `MatterfactAgent` uses.
|
|
485
|
+
* With neither, there is no way for the iframe to authenticate, so no iframe is
|
|
486
|
+
* built at all — matching the "incomplete link" placeholder the embed artifact
|
|
487
|
+
* page itself renders for a missing owner/token.
|
|
488
|
+
*/
|
|
489
|
+
declare function MatterfactArtifact({ name: nameProp, slug, owner, token, widgetOrigin: widgetOriginProp, theme: themeProp, className, style, params, onParamsChange, }: MatterfactArtifactProps): react_jsx_runtime.JSX.Element;
|
|
490
|
+
/** The two live-drivable doc params, mirroring `EmbedDocumentPage`'s `HostDocParams`. */
|
|
491
|
+
type MatterfactDocParams = {
|
|
492
|
+
ticker?: string;
|
|
493
|
+
version?: string;
|
|
494
|
+
};
|
|
495
|
+
interface MatterfactDocProps {
|
|
496
|
+
/** The document catalog key (`EmbedDocumentPage`'s `?key=`). Fixed at mount — not
|
|
497
|
+
* drivable via `params`, unlike `ticker`/`version`. */
|
|
498
|
+
docKey: string;
|
|
499
|
+
/** Initial ticker, seeds the iframe's `?ticker=` query param. */
|
|
500
|
+
ticker?: string;
|
|
501
|
+
/** Initial version. Always sent explicitly on the iframe `src` — defaults to
|
|
502
|
+
* `'latest'` rather than being omitted, so the doc page never has to guess. */
|
|
503
|
+
version?: 'latest' | `${number}-${number}-${number}`;
|
|
504
|
+
/** Resolved as `prop ?? MatterfactAuthProvider's theme ?? 'auto'`. */
|
|
505
|
+
theme?: 'auto' | 'light' | 'dark';
|
|
506
|
+
/**
|
|
507
|
+
* Drive the document's ticker/version from your page after mount. Pass your whole
|
|
508
|
+
* param state; only the keys that actually changed since the last render are pushed
|
|
509
|
+
* to the iframe (as `host.docParams`), and the full set is re-sent once the iframe
|
|
510
|
+
* loads. A push is authoritative for every key it names — dropping a key stops
|
|
511
|
+
* driving it, it does not reset it. Omit this prop entirely for a static document
|
|
512
|
+
* whose ticker/version never change after mount.
|
|
513
|
+
*/
|
|
514
|
+
params?: MatterfactDocParams;
|
|
515
|
+
/** Applied to the `<iframe>` element the document renders into. */
|
|
516
|
+
className?: string;
|
|
517
|
+
/** Applied to the `<iframe>` element. Merged over the default fill. */
|
|
518
|
+
style?: React.CSSProperties;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Render a matterfact catalog document inline in a host page — the `MatterfactArtifact`
|
|
522
|
+
* counterpart for a published document/report instead of an artifact board.
|
|
523
|
+
*
|
|
524
|
+
* ALWAYS session-authed: there's no standalone share-token mode the way
|
|
525
|
+
* `MatterfactArtifact` has, so an ancestor `MatterfactAuthProvider` is required. With
|
|
526
|
+
* none present (or a provider with no `publishableKey`), there's no way for the
|
|
527
|
+
* iframe to authenticate — matching `MatterfactArtifact`'s own no-token-no-provider
|
|
528
|
+
* decision, no iframe is built at all; the same "incomplete link" placeholder shape
|
|
529
|
+
* is rendered instead of throwing.
|
|
377
530
|
*/
|
|
378
|
-
declare function
|
|
531
|
+
declare function MatterfactDoc({ docKey, ticker, version, theme: themeProp, params, className, style, }: MatterfactDocProps): react_jsx_runtime.JSX.Element;
|
|
379
532
|
|
|
380
|
-
export { type HostResolvers, type HostToolDef, MatterfactAgent, type MatterfactAgentProps, MatterfactArtifact, type MatterfactArtifactProps };
|
|
533
|
+
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
|
@@ -159,6 +159,44 @@ type MatterfactEvent = {
|
|
|
159
159
|
source: 'user' | 'context';
|
|
160
160
|
};
|
|
161
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;
|
|
199
|
+
|
|
162
200
|
/**
|
|
163
201
|
* The Hoist adapter — a pure transform from a `HoistRuntime` (already read out of
|
|
164
202
|
* `window.XH` by hoist-runtime.ts) into the context/snapshot shapes context.ts sends
|
|
@@ -239,12 +277,25 @@ interface HostToolDef {
|
|
|
239
277
|
}
|
|
240
278
|
|
|
241
279
|
interface MatterfactAgentProps {
|
|
242
|
-
/**
|
|
243
|
-
|
|
244
|
-
|
|
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
|
+
*/
|
|
245
295
|
widgetOrigin?: string;
|
|
246
296
|
/** Label for THIS embedding, for per-surface usage/history attribution. */
|
|
247
297
|
surface?: string;
|
|
298
|
+
/** Resolved as `prop ?? MatterfactAuthProvider's theme ?? 'auto'`. */
|
|
248
299
|
theme?: 'light' | 'dark' | 'auto';
|
|
249
300
|
/**
|
|
250
301
|
* HOST-AUTH PASSTHROUGH (trusted first-party embeds only). Return a token this
|
|
@@ -252,6 +303,8 @@ interface MatterfactAgentProps {
|
|
|
252
303
|
* token, whatever its auth provider verifies — and the widget signs in SILENTLY with
|
|
253
304
|
* it, no separate sign-in. Called on demand so the token can be fresh. Omit for the
|
|
254
305
|
* standard popup/inline sign-in (third-party hosts).
|
|
306
|
+
*
|
|
307
|
+
* Resolved as `prop ?? MatterfactAuthProvider's getAuthToken`.
|
|
255
308
|
*/
|
|
256
309
|
getAuthToken?: () => string | null | Promise<string | null>;
|
|
257
310
|
/**
|
|
@@ -356,25 +409,125 @@ interface MatterfactAgentProps {
|
|
|
356
409
|
*/
|
|
357
410
|
onEvent?: (e: MatterfactEvent) => void;
|
|
358
411
|
}
|
|
359
|
-
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;
|
|
360
413
|
interface MatterfactArtifactProps {
|
|
361
|
-
/** The artifact's slug
|
|
362
|
-
|
|
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;
|
|
363
421
|
/** The artifact owner's email — same as the Share dialog's `?owner=` param. */
|
|
364
422
|
owner: string;
|
|
365
|
-
/**
|
|
366
|
-
|
|
367
|
-
|
|
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
|
+
*/
|
|
368
442
|
widgetOrigin?: string;
|
|
443
|
+
/** Resolved as `prop ?? MatterfactAuthProvider's theme ?? 'auto'`. */
|
|
369
444
|
theme?: 'auto' | 'light' | 'dark';
|
|
445
|
+
/** Applied to the `<iframe>` element the artifact renders into. */
|
|
370
446
|
className?: string;
|
|
447
|
+
/** Applied to the `<iframe>` element. Merged over the default fill. */
|
|
371
448
|
style?: React.CSSProperties;
|
|
449
|
+
/**
|
|
450
|
+
* Drive the artifact's declared params from your page — the company it's about, the
|
|
451
|
+
* time window, the peer set. View-only: a param change re-renders the artifact from
|
|
452
|
+
* data it already has, and never re-queries or runs the agent.
|
|
453
|
+
*
|
|
454
|
+
* Pass your whole param state; the component works out what actually changed and
|
|
455
|
+
* pushes only that. That matters, because a push is authoritative for every key it
|
|
456
|
+
* names: re-asserting a param the reader has since changed in the artifact's own
|
|
457
|
+
* control bar would silently overwrite their choice. Dropping a key stops driving it
|
|
458
|
+
* and leaves its current value alone — there is no "unset".
|
|
459
|
+
*
|
|
460
|
+
* NOTE: `MatterfactAgent`'s `setArtifactParams` steers artifacts rendered INSIDE the
|
|
461
|
+
* chat. This prop steers THIS artifact. They are different iframes; neither reaches
|
|
462
|
+
* the other.
|
|
463
|
+
*/
|
|
464
|
+
params?: Record<string, unknown>;
|
|
465
|
+
/**
|
|
466
|
+
* Fired when a param changes inside the artifact — `'user'` when the reader used its
|
|
467
|
+
* control bar, `'context'` when a bound param followed the host page's context.
|
|
468
|
+
*
|
|
469
|
+
* Never fires for your own `params` pushes, so feeding this straight back into the
|
|
470
|
+
* `params` prop cannot loop.
|
|
471
|
+
*/
|
|
472
|
+
onParamsChange?: (params: Record<string, unknown>, source: 'user' | 'context') => void;
|
|
372
473
|
}
|
|
373
474
|
/**
|
|
374
475
|
* Render a matterfact artifact inline in a host page. Chrome-free, cross-origin. When a
|
|
375
476
|
* MatterfactAgent is embedded on the same page, the loader sees this iframe and both
|
|
376
477
|
* makes the agent aware of it and (via its token) lets the agent read its data.
|
|
478
|
+
*
|
|
479
|
+
* Two auth modes, `token` wins when both are available:
|
|
480
|
+
* - TOKEN mode (`token` given): a standalone share link, `?t=`. This is the LIVE
|
|
481
|
+
* third-party embed path — its `src` format must stay byte-identical.
|
|
482
|
+
* - SESSION mode (no `token`, an ancestor `MatterfactAuthProvider` is present):
|
|
483
|
+
* tokenless, `?k=<publishableKey>&o=<host origin>`, the same authentication
|
|
484
|
+
* `MatterfactAgent` uses.
|
|
485
|
+
* With neither, there is no way for the iframe to authenticate, so no iframe is
|
|
486
|
+
* built at all — matching the "incomplete link" placeholder the embed artifact
|
|
487
|
+
* page itself renders for a missing owner/token.
|
|
488
|
+
*/
|
|
489
|
+
declare function MatterfactArtifact({ name: nameProp, slug, owner, token, widgetOrigin: widgetOriginProp, theme: themeProp, className, style, params, onParamsChange, }: MatterfactArtifactProps): react_jsx_runtime.JSX.Element;
|
|
490
|
+
/** The two live-drivable doc params, mirroring `EmbedDocumentPage`'s `HostDocParams`. */
|
|
491
|
+
type MatterfactDocParams = {
|
|
492
|
+
ticker?: string;
|
|
493
|
+
version?: string;
|
|
494
|
+
};
|
|
495
|
+
interface MatterfactDocProps {
|
|
496
|
+
/** The document catalog key (`EmbedDocumentPage`'s `?key=`). Fixed at mount — not
|
|
497
|
+
* drivable via `params`, unlike `ticker`/`version`. */
|
|
498
|
+
docKey: string;
|
|
499
|
+
/** Initial ticker, seeds the iframe's `?ticker=` query param. */
|
|
500
|
+
ticker?: string;
|
|
501
|
+
/** Initial version. Always sent explicitly on the iframe `src` — defaults to
|
|
502
|
+
* `'latest'` rather than being omitted, so the doc page never has to guess. */
|
|
503
|
+
version?: 'latest' | `${number}-${number}-${number}`;
|
|
504
|
+
/** Resolved as `prop ?? MatterfactAuthProvider's theme ?? 'auto'`. */
|
|
505
|
+
theme?: 'auto' | 'light' | 'dark';
|
|
506
|
+
/**
|
|
507
|
+
* Drive the document's ticker/version from your page after mount. Pass your whole
|
|
508
|
+
* param state; only the keys that actually changed since the last render are pushed
|
|
509
|
+
* to the iframe (as `host.docParams`), and the full set is re-sent once the iframe
|
|
510
|
+
* loads. A push is authoritative for every key it names — dropping a key stops
|
|
511
|
+
* driving it, it does not reset it. Omit this prop entirely for a static document
|
|
512
|
+
* whose ticker/version never change after mount.
|
|
513
|
+
*/
|
|
514
|
+
params?: MatterfactDocParams;
|
|
515
|
+
/** Applied to the `<iframe>` element the document renders into. */
|
|
516
|
+
className?: string;
|
|
517
|
+
/** Applied to the `<iframe>` element. Merged over the default fill. */
|
|
518
|
+
style?: React.CSSProperties;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Render a matterfact catalog document inline in a host page — the `MatterfactArtifact`
|
|
522
|
+
* counterpart for a published document/report instead of an artifact board.
|
|
523
|
+
*
|
|
524
|
+
* ALWAYS session-authed: there's no standalone share-token mode the way
|
|
525
|
+
* `MatterfactArtifact` has, so an ancestor `MatterfactAuthProvider` is required. With
|
|
526
|
+
* none present (or a provider with no `publishableKey`), there's no way for the
|
|
527
|
+
* iframe to authenticate — matching `MatterfactArtifact`'s own no-token-no-provider
|
|
528
|
+
* decision, no iframe is built at all; the same "incomplete link" placeholder shape
|
|
529
|
+
* is rendered instead of throwing.
|
|
377
530
|
*/
|
|
378
|
-
declare function
|
|
531
|
+
declare function MatterfactDoc({ docKey, ticker, version, theme: themeProp, params, className, style, }: MatterfactDocProps): react_jsx_runtime.JSX.Element;
|
|
379
532
|
|
|
380
|
-
export { type HostResolvers, type HostToolDef, MatterfactAgent, type MatterfactAgentProps, MatterfactArtifact, type MatterfactArtifactProps };
|
|
533
|
+
export { type HoistActionsConfig, type HostResolvers, type HostToolDef, MatterfactAgent, type MatterfactAgentProps, MatterfactArtifact, type MatterfactArtifactProps, MatterfactAuthProvider, type MatterfactAuthProviderProps, MatterfactDoc, type MatterfactDocParams, type MatterfactDocProps };
|