@player-ui/reference-assets-plugin 0.14.1-next.1 → 0.14.1-next.2
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/ReferenceAssetsPlugin.native.js +45 -21
- package/dist/ReferenceAssetsPlugin.native.js.map +1 -1
- package/dist/cjs/index.cjs +5 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +7 -1
- package/dist/index.mjs +7 -1
- package/dist/index.mjs.map +1 -1
- package/dist/xlr/ActionAsset.json +2 -2
- package/dist/xlr/ChatMessageAsset.json +1 -1
- package/dist/xlr/ChoiceAsset.json +5 -5
- package/dist/xlr/CollectionAsset.json +1 -1
- package/dist/xlr/ImageAsset.json +2 -2
- package/dist/xlr/InfoAsset.json +1 -1
- package/dist/xlr/InputAsset.json +2 -2
- package/dist/xlr/TextAsset.json +4 -4
- package/dist/xlr/send.json +1 -1
- package/package.json +7 -7
- package/src/__tests__/plugin.test.ts +29 -14
- package/src/plugins/chat-ui-demo-plugin.ts +11 -1
|
@@ -2,6 +2,7 @@ import { AsyncNodePlugin } from "@player-ui/async-node-plugin";
|
|
|
2
2
|
import {
|
|
3
3
|
ExpressionContext,
|
|
4
4
|
ExtendedPlayerPlugin,
|
|
5
|
+
NodeType,
|
|
5
6
|
Player,
|
|
6
7
|
} from "@player-ui/player";
|
|
7
8
|
import { ExpressionPlugin } from "@player-ui/expression-plugin";
|
|
@@ -63,7 +64,7 @@ export class ChatUiDemoPlugin implements ExtendedPlayerPlugin<[], [], [send]> {
|
|
|
63
64
|
for (const id of keys) {
|
|
64
65
|
const content = createContentFromMessage(
|
|
65
66
|
message,
|
|
66
|
-
`
|
|
67
|
+
`chat-demo-${counter++}`,
|
|
67
68
|
);
|
|
68
69
|
const resolveFunction = deferredPromises[id];
|
|
69
70
|
resolveFunction?.(content);
|
|
@@ -79,6 +80,15 @@ export class ChatUiDemoPlugin implements ExtendedPlayerPlugin<[], [], [send]> {
|
|
|
79
80
|
};
|
|
80
81
|
|
|
81
82
|
asyncNodePlugin.hooks.onAsyncNode.tap(this.name, (node) => {
|
|
83
|
+
// Ensure this is only used on the chat-ui.tsx mock to prevent the promise from setting up during tests.
|
|
84
|
+
if (
|
|
85
|
+
(node.parent?.parent?.type !== NodeType.Asset &&
|
|
86
|
+
node.parent?.parent?.type !== NodeType.View) ||
|
|
87
|
+
!node.parent.parent.value.id.startsWith("collection-async-chat-demo")
|
|
88
|
+
) {
|
|
89
|
+
return Promise.resolve(undefined);
|
|
90
|
+
}
|
|
91
|
+
|
|
82
92
|
return new Promise((res) => {
|
|
83
93
|
deferredPromises[node.id] = res;
|
|
84
94
|
allPromiseKeys.push(node.id);
|