@matterfact/embed 0.17.0 → 0.18.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/dist/chunk-5X2WFSIL.js +2 -0
- package/dist/chunk-5X2WFSIL.js.map +7 -0
- package/dist/{deeplink-IBFUWANV.js → deeplink-KCGMGNIR.js} +81 -5
- package/dist/deeplink-KCGMGNIR.js.map +1 -0
- package/dist/{deeplink-QW3VRPOY.js → deeplink-X7IQDBCR.js} +82 -7
- package/dist/deeplink-X7IQDBCR.js.map +1 -0
- package/dist/embed.js +1 -1
- package/dist/embed.js.map +3 -3
- package/dist/index.cjs +87 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +121 -11
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +14 -1
- package/dist/react.d.ts +14 -1
- package/dist/react.js +41 -7
- package/dist/react.js.map +1 -1
- package/examples/embed-demo/src/App.tsx +2 -2
- package/package.json +1 -1
- package/dist/chunk-QVNE5FQV.js +0 -2
- package/dist/chunk-QVNE5FQV.js.map +0 -7
- package/dist/deeplink-IBFUWANV.js.map +0 -1
- package/dist/deeplink-QW3VRPOY.js.map +0 -1
package/dist/react.d.cts
CHANGED
|
@@ -301,6 +301,19 @@ interface MatterfactAgentProps {
|
|
|
301
301
|
* matching the template the widget auto-opens that shared conversation.
|
|
302
302
|
* Exactly one `{share_token}`, as a whole path segment or whole query value,
|
|
303
303
|
* e.g. "https://portal.acme.com/assistant?mf_share={share_token}".
|
|
304
|
+
*
|
|
305
|
+
* DYNAMIC form: `{path}` directly after the origin stands for the page's current
|
|
306
|
+
* pathname — one template serves every page a popup install lives on. Links then
|
|
307
|
+
* carry the page the sharer was on, and pickup fires on any page:
|
|
308
|
+
* `` `${location.origin}{path}?mf_share={share_token}` `` (the token must be a
|
|
309
|
+
* query value in this form). Note `{path}` shares the current pathname with the
|
|
310
|
+
* widget; static templates never do.
|
|
311
|
+
*
|
|
312
|
+
* A query-only URL rewrite by your router (boot-time normalisation) does not
|
|
313
|
+
* cancel a picked-up conversation — only a real pathname change does. Your auth
|
|
314
|
+
* flow must still deliver the URL to the page: a redirect that drops the query
|
|
315
|
+
* before this page boots is unrecoverable from here.
|
|
316
|
+
*
|
|
304
317
|
* Read at mount; change requires a remount.
|
|
305
318
|
*/
|
|
306
319
|
shareDeeplinkFormat?: string;
|
|
@@ -418,7 +431,7 @@ interface MatterfactAgentProps {
|
|
|
418
431
|
*/
|
|
419
432
|
onEvent?: (e: MatterfactEvent) => void;
|
|
420
433
|
}
|
|
421
|
-
declare function MatterfactAgent({ publishableKey: publishableKeyProp, widgetOrigin: widgetOriginProp, surface, shareDeeplinkFormat, theme: themeProp, getAuthToken: getAuthTokenProp, getPageContext, inline, className, style, pageContext, dev, actions, sitemap, artifacts, resolve, tools, onToolEvent, onEvent, }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
|
|
434
|
+
declare function MatterfactAgent({ publishableKey: publishableKeyProp, widgetOrigin: widgetOriginProp, surface, shareDeeplinkFormat, theme: themeProp, getAuthToken: getAuthTokenProp, getPageContext, inline, className, style, pageContext, dev, actions, sitemap, artifacts, resolve, tools, onToolEvent, onEvent, ...unknownProps }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
|
|
422
435
|
interface MatterfactArtifactProps {
|
|
423
436
|
/** The artifact's name (its slug). */
|
|
424
437
|
name?: string;
|
package/dist/react.d.ts
CHANGED
|
@@ -301,6 +301,19 @@ interface MatterfactAgentProps {
|
|
|
301
301
|
* matching the template the widget auto-opens that shared conversation.
|
|
302
302
|
* Exactly one `{share_token}`, as a whole path segment or whole query value,
|
|
303
303
|
* e.g. "https://portal.acme.com/assistant?mf_share={share_token}".
|
|
304
|
+
*
|
|
305
|
+
* DYNAMIC form: `{path}` directly after the origin stands for the page's current
|
|
306
|
+
* pathname — one template serves every page a popup install lives on. Links then
|
|
307
|
+
* carry the page the sharer was on, and pickup fires on any page:
|
|
308
|
+
* `` `${location.origin}{path}?mf_share={share_token}` `` (the token must be a
|
|
309
|
+
* query value in this form). Note `{path}` shares the current pathname with the
|
|
310
|
+
* widget; static templates never do.
|
|
311
|
+
*
|
|
312
|
+
* A query-only URL rewrite by your router (boot-time normalisation) does not
|
|
313
|
+
* cancel a picked-up conversation — only a real pathname change does. Your auth
|
|
314
|
+
* flow must still deliver the URL to the page: a redirect that drops the query
|
|
315
|
+
* before this page boots is unrecoverable from here.
|
|
316
|
+
*
|
|
304
317
|
* Read at mount; change requires a remount.
|
|
305
318
|
*/
|
|
306
319
|
shareDeeplinkFormat?: string;
|
|
@@ -418,7 +431,7 @@ interface MatterfactAgentProps {
|
|
|
418
431
|
*/
|
|
419
432
|
onEvent?: (e: MatterfactEvent) => void;
|
|
420
433
|
}
|
|
421
|
-
declare function MatterfactAgent({ publishableKey: publishableKeyProp, widgetOrigin: widgetOriginProp, surface, shareDeeplinkFormat, theme: themeProp, getAuthToken: getAuthTokenProp, getPageContext, inline, className, style, pageContext, dev, actions, sitemap, artifacts, resolve, tools, onToolEvent, onEvent, }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
|
|
434
|
+
declare function MatterfactAgent({ publishableKey: publishableKeyProp, widgetOrigin: widgetOriginProp, surface, shareDeeplinkFormat, theme: themeProp, getAuthToken: getAuthTokenProp, getPageContext, inline, className, style, pageContext, dev, actions, sitemap, artifacts, resolve, tools, onToolEvent, onEvent, ...unknownProps }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
|
|
422
435
|
interface MatterfactArtifactProps {
|
|
423
436
|
/** The artifact's name (its slug). */
|
|
424
437
|
name?: string;
|
package/dist/react.js
CHANGED
|
@@ -227,7 +227,7 @@ function dockBox(g, vw, _vh) {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
// src/loader.ts
|
|
230
|
-
var EMBED_VERSION = "0.
|
|
230
|
+
var EMBED_VERSION = "0.18.0";
|
|
231
231
|
function devRequested() {
|
|
232
232
|
try {
|
|
233
233
|
if (new URLSearchParams(location.search).get("mfdev") === "1") return true;
|
|
@@ -375,12 +375,13 @@ var EmbedHost = class {
|
|
|
375
375
|
}
|
|
376
376
|
const fmt = this.config.shareDeeplinkFormat;
|
|
377
377
|
if (fmt) {
|
|
378
|
-
|
|
379
|
-
void import("./deeplink-IBFUWANV.js").then((m) => {
|
|
378
|
+
void import("./deeplink-KCGMGNIR.js").then((m) => {
|
|
380
379
|
if (this.destroyed) return;
|
|
381
|
-
this.deeplinkStop = m.installDeeplinkWatch(
|
|
382
|
-
|
|
383
|
-
|
|
380
|
+
this.deeplinkStop = m.installDeeplinkWatch(
|
|
381
|
+
fmt,
|
|
382
|
+
(token) => this.send({ type: "host.openShare", token }),
|
|
383
|
+
(format) => this.send({ type: "host.deeplinkFormat", format })
|
|
384
|
+
);
|
|
384
385
|
}).catch(() => {
|
|
385
386
|
});
|
|
386
387
|
}
|
|
@@ -922,6 +923,27 @@ function toolDescriptorKey(artifacts, resolve, tools) {
|
|
|
922
923
|
}))
|
|
923
924
|
});
|
|
924
925
|
}
|
|
926
|
+
var KNOWN_AGENT_PROPS = [
|
|
927
|
+
"publishableKey",
|
|
928
|
+
"widgetOrigin",
|
|
929
|
+
"surface",
|
|
930
|
+
"shareDeeplinkFormat",
|
|
931
|
+
"theme",
|
|
932
|
+
"getAuthToken",
|
|
933
|
+
"getPageContext",
|
|
934
|
+
"inline",
|
|
935
|
+
"className",
|
|
936
|
+
"style",
|
|
937
|
+
"pageContext",
|
|
938
|
+
"dev",
|
|
939
|
+
"actions",
|
|
940
|
+
"sitemap",
|
|
941
|
+
"artifacts",
|
|
942
|
+
"resolve",
|
|
943
|
+
"tools",
|
|
944
|
+
"onToolEvent",
|
|
945
|
+
"onEvent"
|
|
946
|
+
];
|
|
925
947
|
function MatterfactAgent({
|
|
926
948
|
publishableKey: publishableKeyProp,
|
|
927
949
|
widgetOrigin: widgetOriginProp,
|
|
@@ -941,8 +963,20 @@ function MatterfactAgent({
|
|
|
941
963
|
resolve,
|
|
942
964
|
tools,
|
|
943
965
|
onToolEvent,
|
|
944
|
-
onEvent
|
|
966
|
+
onEvent,
|
|
967
|
+
...unknownProps
|
|
945
968
|
}) {
|
|
969
|
+
useEffect2(() => {
|
|
970
|
+
if (process.env.NODE_ENV === "production") return;
|
|
971
|
+
for (const key of Object.keys(unknownProps)) {
|
|
972
|
+
const meant = KNOWN_AGENT_PROPS.find(
|
|
973
|
+
(k) => k.toLowerCase() === key.toLowerCase()
|
|
974
|
+
);
|
|
975
|
+
console.warn(
|
|
976
|
+
`[mf-embed] unknown prop "${key}" on <MatterfactAgent>` + (meant ? ` \u2014 did you mean "${meant}"?` : "")
|
|
977
|
+
);
|
|
978
|
+
}
|
|
979
|
+
}, []);
|
|
946
980
|
const ctx = useMatterfactConfig();
|
|
947
981
|
const publishableKey = publishableKeyProp ?? ctx?.publishableKey;
|
|
948
982
|
if (!publishableKey) {
|