@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.
@@ -202,6 +202,7 @@ var import_meta_plugin = require("@player-ui/meta-plugin");
202
202
 
203
203
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugins/chat-ui-demo-plugin.ts
204
204
  var import_async_node_plugin2 = require("@player-ui/async-node-plugin");
205
+ var import_player = require("@player-ui/player");
205
206
  var import_expression_plugin = require("@player-ui/expression-plugin");
206
207
  var createContentFromMessage = (message, id) => ({
207
208
  asset: {
@@ -248,7 +249,7 @@ var ChatUiDemoPlugin = class {
248
249
  for (const id of keys) {
249
250
  const content = createContentFromMessage(
250
251
  message,
251
- `message-${counter++}`
252
+ `chat-demo-${counter++}`
252
253
  );
253
254
  const resolveFunction = deferredPromises[id];
254
255
  resolveFunction?.(content);
@@ -262,6 +263,9 @@ var ChatUiDemoPlugin = class {
262
263
  }
263
264
  };
264
265
  asyncNodePlugin.hooks.onAsyncNode.tap(this.name, (node) => {
266
+ if (node.parent?.parent?.type !== import_player.NodeType.Asset && node.parent?.parent?.type !== import_player.NodeType.View || !node.parent.parent.value.id.startsWith("collection-async-chat-demo")) {
267
+ return Promise.resolve(void 0);
268
+ }
265
269
  return new Promise((res) => {
266
270
  deferredPromises[node.id] = res;
267
271
  allPromiseKeys.push(node.id);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/index.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/input/transform.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/action/transform.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/info/transform.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/image/transform.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/choice/transform.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/chat-message/transform.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugin.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugins/chat-ui-demo-plugin.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugins/reference-assets-transform-plugin.ts"],"sourcesContent":["export * from \"./assets\";\nexport * from \"./plugin\";\n","import type { TransformFunction } from \"@player-ui/player\";\nimport type { InputAsset, TransformedInput } from \"./types\";\n\n/**\n * Docs about the asset transform\n */\nexport const inputTransform: TransformFunction<InputAsset, TransformedInput> = (\n asset,\n options,\n) => {\n return {\n ...asset,\n format(val) {\n if (asset.binding === undefined) {\n return val;\n }\n\n return options.data.format(asset.binding, val);\n },\n set(val) {\n if (asset.binding === undefined) {\n return;\n }\n\n return options.data.model.set([[asset.binding, val]], {\n formatted: true,\n });\n },\n value:\n asset.binding === undefined\n ? \"\"\n : options.data.model.get(asset.binding, {\n includeInvalid: true,\n formatted: true,\n }),\n validation:\n asset.binding === undefined\n ? undefined\n : options.validation?.get(asset.binding, { track: true }),\n dataType:\n asset.binding === undefined\n ? undefined\n : options.validation?.type(asset.binding),\n };\n};\n","import type {\n Asset,\n TransformFunction,\n BeforeTransformFunction,\n} from \"@player-ui/player\";\nimport { compose, composeBefore } from \"@player-ui/asset-transform-plugin\";\nimport type { ActionAsset, TransformedAction } from \"./types\";\n\n/**\n * Function to find prev button\n */\nexport function isBackAction(action: ActionAsset): boolean {\n return action.value === \"Prev\";\n}\n\n/**\n * Attaches the methods to execute an action to an action\n */\nconst transform: TransformFunction<ActionAsset, TransformedAction> = (\n action,\n options,\n) => {\n return {\n ...action,\n run() {\n if (action.exp) {\n options.evaluate(action.exp);\n }\n\n if (action.value) {\n const skipValidation = action.metaData?.skipValidation;\n options.transition?.(action.value, { force: skipValidation });\n }\n },\n };\n};\n\n/**\n * De couples back button from the back icon\n */\nconst backIconTransform: TransformFunction<ActionAsset, ActionAsset> = (\n action,\n) => {\n /** For previous versions of player, the back button would already have the back icon.\n * This ensures that the old functionality does not break and back button is still visible when they update the player.\n */\n if (isBackAction(action) && action?.metaData?.role === undefined) {\n return {\n ...action,\n metaData: {\n ...action?.metaData,\n role: \"back\",\n },\n };\n }\n\n return action;\n};\n\n/**\n * Appends `exp` to the plugins.stringResolver.propertiesToSkip array or creates it if it doesn't exist\n *\n * @param asset - Asset to apply the transform to\n */\nexport const expPropTransform: BeforeTransformFunction<Asset> = (asset) => {\n const skipArray = asset.plugins?.stringResolver?.propertiesToSkip;\n\n if (skipArray && skipArray.indexOf(\"exp\") > 1) {\n return asset;\n }\n\n return {\n ...asset,\n plugins: {\n ...asset.plugins,\n stringResolver: {\n ...asset?.plugins?.stringResolver,\n propertiesToSkip: [\n ...(asset.plugins?.stringResolver?.propertiesToSkip ?? []),\n \"exp\",\n ],\n },\n },\n };\n};\n\nexport const actionTransform = compose(\n transform,\n backIconTransform,\n composeBefore(expPropTransform),\n);\n","import type { TransformFunction } from \"@player-ui/player\";\nimport type { AssetWrapper } from \"@player-ui/player\";\nimport type { InfoAsset, InfoAssetTransform } from \"./types\";\nimport type { ActionAsset } from \"../action/types\";\nimport { isBackAction } from \"../action/transform\";\n\n/**\n * This transform should add segmentedActions to the info asset.\n * Segmented actions display side by side in larger viewports. Segmented Actions is an object of next and prev actions\n */\nexport const infoTransform: TransformFunction<InfoAsset, InfoAssetTransform> = (\n infoAsset,\n) => {\n const actions = infoAsset?.actions;\n const segmentedActions = actions?.reduce(\n (segmentedActionsArray, action) => {\n segmentedActionsArray[\n isBackAction(action.asset as ActionAsset) ? \"prev\" : \"next\"\n ].push(action as AssetWrapper<ActionAsset>);\n return segmentedActionsArray;\n },\n { next: [], prev: [] } as {\n /**\n * next is an array of next actions\n */\n next: Array<AssetWrapper<ActionAsset>>;\n /**\n * prev is an array of prev actions\n */\n prev: Array<AssetWrapper<ActionAsset>>;\n },\n );\n\n return {\n ...infoAsset,\n segmentedActions,\n };\n};\n","import type { TransformFunction } from \"@player-ui/player\";\nimport type { ImageAsset, TransformedImage } from \"./types\";\n\n/**\n * Function to retrieve the desired alt text based on passed in props.\n * @param props Image props\n * @returns The alt text for the image asset\n */\nconst getImageAlt = (props: ImageAsset): string => {\n const { metaData, placeholder } = props;\n if (metaData.accessibility) return metaData.accessibility;\n\n if (placeholder) return placeholder;\n\n return \"Image\";\n};\n\n/**\n * Sets the Image's placeholder and accessibilty\n */\nexport const imageTransform: TransformFunction<ImageAsset, TransformedImage> = (\n props,\n) => {\n const altText = getImageAlt(props);\n\n const newImage = {\n ...props,\n altText,\n };\n\n return newImage;\n};\n","import type { TransformFunction } from \"@player-ui/player\";\nimport type {\n ChoiceAsset,\n TransformedChoice,\n TransformedChoiceItem,\n} from \"./types\";\n\n/**\n * Docs about the asset transform\n */\nexport const choiceTransform: TransformFunction<\n ChoiceAsset,\n TransformedChoice\n> = (asset, options) => {\n const { items, binding, ...rest } = asset;\n\n const assetHasBinding = binding !== undefined;\n\n const currentValue = assetHasBinding\n ? options.data.model.get(binding, {\n includeInvalid: true,\n })\n : undefined;\n\n const resetValue = () => {\n if (assetHasBinding) {\n return options.data.model.set([[binding, null]]);\n }\n };\n\n const transformedChoiceItems: TransformedChoiceItem[] = (items || []).map(\n (item, index) => ({\n ...item,\n id: item.id ?? `${asset.id}-choice-${index}`,\n select() {\n if (assetHasBinding) {\n return options.data.model.set([[binding, item.value]]);\n }\n },\n unselect: resetValue,\n }),\n );\n\n return {\n ...rest,\n binding,\n clearSelection: resetValue,\n items: transformedChoiceItems,\n value: currentValue,\n validation: assetHasBinding\n ? options.validation?.get(binding, { track: true })\n : undefined,\n dataType: assetHasBinding ? options.validation?.type(binding) : undefined,\n };\n};\n","import type {\n BeforeTransformFunction,\n TransformFunctions,\n} from \"@player-ui/player\";\nimport { composeBefore, compose } from \"@player-ui/asset-transform-plugin\";\nimport { createAsyncTransform } from \"@player-ui/async-node-plugin\";\nimport { ChatMessageAsset } from \"./types\";\n/**\n * In beforeTransform function, pass in flatten marker and call beforeResolve function.\n * Flatten default value is true.\n * input: ChatMessageAsset\n * @param asset - Asset to apply the transform to\n * @returns - transformed asset with async node and asset node\n */\nexport const transform: BeforeTransformFunction<ChatMessageAsset> =\n createAsyncTransform({\n transformAssetType: \"chat-message\",\n wrapperAssetType: \"collection\",\n getNestedAsset: (node) => node.children?.[0]?.value,\n });\n\nexport const chatMessageTransform: TransformFunctions = compose(\n composeBefore(transform),\n);\n","import type { Player, PlayerPlugin } from \"@player-ui/player\";\nimport { MetaPlugin } from \"@player-ui/meta-plugin\";\nimport { ChatUiDemoPlugin, ReferenceAssetsTransformPlugin } from \"./plugins\";\nimport {\n AsyncNodePlugin,\n AsyncNodePluginPlugin,\n} from \"@player-ui/async-node-plugin\";\n\n/**\n * A plugin to add transforms for the reference assets\n */\nexport class ReferenceAssetsPlugin implements PlayerPlugin {\n name = \"reference-assets-plugin\";\n\n private readonly metaPlugin = new MetaPlugin([\n new AsyncNodePlugin({\n plugins: [new AsyncNodePluginPlugin()],\n }),\n new ReferenceAssetsTransformPlugin(),\n new ChatUiDemoPlugin(),\n ]);\n\n apply(player: Player): void {\n player.registerPlugin(this.metaPlugin);\n }\n}\n","import { AsyncNodePlugin } from \"@player-ui/async-node-plugin\";\nimport {\n ExpressionContext,\n ExtendedPlayerPlugin,\n Player,\n} from \"@player-ui/player\";\nimport { ExpressionPlugin } from \"@player-ui/expression-plugin\";\nimport { send } from \"./send\";\n\nconst createContentFromMessage = (message: string, id: string): any => ({\n asset: {\n type: \"chat-message\",\n id,\n value: {\n asset: {\n type: \"text\",\n id: `${id}-value`,\n value: message,\n },\n },\n },\n});\n\nexport class ChatUiDemoPlugin implements ExtendedPlayerPlugin<[], [], [send]> {\n public readonly name = \"chat-ui-demo-plugin\";\n\n public apply(player: Player): void {\n const asyncNodePlugin = player.findPlugin<AsyncNodePlugin>(\n AsyncNodePlugin.Symbol,\n );\n\n if (!asyncNodePlugin) {\n player.logger.warn(\n `Failed to apply '${this.name}'. Reason: Could not find AsyncNodePlugin.`,\n );\n return;\n }\n\n let deferredPromises: Record<string, (val: string) => void> = {};\n let allPromiseKeys: string[] = [];\n let counter = 0;\n\n const sendMessage: send = (\n context: ExpressionContext,\n message: string,\n nodeId?: string,\n ): void => {\n if (nodeId && !(nodeId in deferredPromises)) {\n context.logger?.warn(\n `'send' expression called with unrecognized id '${nodeId}'`,\n );\n return;\n }\n\n if (!nodeId && allPromiseKeys.length === 0) {\n context.logger?.warn(`'send' called with no waiting async nodes`);\n return;\n }\n\n // Either resolve the node by the id or resolve all of them if no id provided\n const keys = nodeId ? [nodeId] : allPromiseKeys;\n\n for (const id of keys) {\n const content = createContentFromMessage(\n message,\n `message-${counter++}`,\n );\n const resolveFunction = deferredPromises[id];\n resolveFunction?.(content);\n delete deferredPromises[id];\n }\n\n if (nodeId) {\n const index = allPromiseKeys.indexOf(nodeId);\n allPromiseKeys.splice(index, 1);\n } else {\n allPromiseKeys = [];\n }\n };\n\n asyncNodePlugin.hooks.onAsyncNode.tap(this.name, (node) => {\n return new Promise((res) => {\n deferredPromises[node.id] = res;\n allPromiseKeys.push(node.id);\n });\n });\n\n // Reset at the start of a new view.\n player.hooks.view.tap(this.name, (_) => {\n deferredPromises = {};\n allPromiseKeys = [];\n counter = 0;\n });\n\n // Register 'send' expression\n const expressionPlugin = new ExpressionPlugin(\n new Map([[\"send\", sendMessage]]),\n );\n player.registerPlugin(expressionPlugin);\n }\n}\n","import type { ExtendedPlayerPlugin, Player } from \"@player-ui/player\";\nimport { AssetTransformPlugin } from \"@player-ui/asset-transform-plugin\";\nimport {\n actionTransform,\n chatMessageTransform,\n choiceTransform,\n imageTransform,\n infoTransform,\n inputTransform,\n} from \"../assets\";\nimport type {\n ActionAsset,\n ChatMessageAsset,\n ChoiceAsset,\n CollectionAsset,\n ImageAsset,\n InfoAsset,\n InputAsset,\n TextAsset,\n} from \"../assets\";\n\nexport class ReferenceAssetsTransformPlugin\n implements\n ExtendedPlayerPlugin<\n [\n ActionAsset,\n InputAsset,\n ImageAsset,\n TextAsset,\n CollectionAsset,\n ChoiceAsset,\n ChatMessageAsset,\n ],\n [InfoAsset]\n >\n{\n name = \"reference-assets-transforms\";\n\n apply(player: Player): void {\n player.registerPlugin(\n new AssetTransformPlugin([\n [{ type: \"action\" }, actionTransform],\n [{ type: \"input\" }, inputTransform],\n [{ type: \"image\" }, imageTransform],\n [{ type: \"info\" }, infoTransform],\n [{ type: \"choice\" }, choiceTransform],\n [{ type: \"chat-message\" }, chatMessageTransform],\n ]),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAAA;AAAA;AAAA;;;ACMO,IAAM,iBAAkE,CAC7E,OACA,YACG;AACH,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO,KAAK;AACV,UAAI,MAAM,YAAY,QAAW;AAC/B,eAAO;AAAA,MACT;AAEA,aAAO,QAAQ,KAAK,OAAO,MAAM,SAAS,GAAG;AAAA,IAC/C;AAAA,IACA,IAAI,KAAK;AACP,UAAI,MAAM,YAAY,QAAW;AAC/B;AAAA,MACF;AAEA,aAAO,QAAQ,KAAK,MAAM,IAAI,CAAC,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG;AAAA,QACpD,WAAW;AAAA,MACb,CAAC;AAAA,IACH;AAAA,IACA,OACE,MAAM,YAAY,SACd,KACA,QAAQ,KAAK,MAAM,IAAI,MAAM,SAAS;AAAA,MACpC,gBAA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AA,QACvB,CAAC,EAAE,MAAM,SAAS,GAAG,eAAe;AAAA,QACpC,CAAC,EAAE,MAAM,QAAQ,GAAG,cAAc;AAAA,QAClC,CAAC,EAAE,MAAM,QAAQ,GAAG,cAAc;AAAA,QAClC,CAAC,EAAE,MAAM,OAAO,GAAG,aAAa;AAAA,QAChC,CAAC,EAAE,MAAM,SAAS,GAAG,eAAe;AAAA,QACpC,CAAC,EAAE,MAAM,eAAe,GAAG,oBAAoB;AAAA,MACjD,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AF/CA,IAAAC,4BAGO;AAKA,IAAM,wBAAN,MAAoD;AAAA,EAApD;AACL,gBAAO;AAEP,SAAiB,aAAa,IAAI,8BAAW;AAAA,MAC3C,IAAI,0CAAgB;AAAA,QAClB,SAAS,CAAC,IAAI,gDAAsB,CAAC;AAAA,MACvC,CAAC;AAAA,MACD,IAAI,+BAA+B;AAAA,MACnC,IAAI,iBAAiB;AAAA,IACvB,CAAC;AAAA;AAAA,EAED,MAAM,QAAsB;AAC1B,WAAO,eAAe,KAAK,UAAU;AAAA,EACvC;AACF;","names":["transform","import_asset_transform_plugin","transform","import_async_node_plugin","import_asset_transform_plugin","import_async_node_plugin"]}
1
+ {"version":3,"sources":["../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/index.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/input/transform.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/action/transform.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/info/transform.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/image/transform.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/choice/transform.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/chat-message/transform.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugin.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugins/chat-ui-demo-plugin.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugins/reference-assets-transform-plugin.ts"],"sourcesContent":["export * from \"./assets\";\nexport * from \"./plugin\";\n","import type { TransformFunction } from \"@player-ui/player\";\nimport type { InputAsset, TransformedInput } from \"./types\";\n\n/**\n * Docs about the asset transform\n */\nexport const inputTransform: TransformFunction<InputAsset, TransformedInput> = (\n asset,\n options,\n) => {\n return {\n ...asset,\n format(val) {\n if (asset.binding === undefined) {\n return val;\n }\n\n return options.data.format(asset.binding, val);\n },\n set(val) {\n if (asset.binding === undefined) {\n return;\n }\n\n return options.data.model.set([[asset.binding, val]], {\n formatted: true,\n });\n },\n value:\n asset.binding === undefined\n ? \"\"\n : options.data.model.get(asset.binding, {\n includeInvalid: true,\n formatted: true,\n }),\n validation:\n asset.binding === undefined\n ? undefined\n : options.validation?.get(asset.binding, { track: true }),\n dataType:\n asset.binding === undefined\n ? undefined\n : options.validation?.type(asset.binding),\n };\n};\n","import type {\n Asset,\n TransformFunction,\n BeforeTransformFunction,\n} from \"@player-ui/player\";\nimport { compose, composeBefore } from \"@player-ui/asset-transform-plugin\";\nimport type { ActionAsset, TransformedAction } from \"./types\";\n\n/**\n * Function to find prev button\n */\nexport function isBackAction(action: ActionAsset): boolean {\n return action.value === \"Prev\";\n}\n\n/**\n * Attaches the methods to execute an action to an action\n */\nconst transform: TransformFunction<ActionAsset, TransformedAction> = (\n action,\n options,\n) => {\n return {\n ...action,\n run() {\n if (action.exp) {\n options.evaluate(action.exp);\n }\n\n if (action.value) {\n const skipValidation = action.metaData?.skipValidation;\n options.transition?.(action.value, { force: skipValidation });\n }\n },\n };\n};\n\n/**\n * De couples back button from the back icon\n */\nconst backIconTransform: TransformFunction<ActionAsset, ActionAsset> = (\n action,\n) => {\n /** For previous versions of player, the back button would already have the back icon.\n * This ensures that the old functionality does not break and back button is still visible when they update the player.\n */\n if (isBackAction(action) && action?.metaData?.role === undefined) {\n return {\n ...action,\n metaData: {\n ...action?.metaData,\n role: \"back\",\n },\n };\n }\n\n return action;\n};\n\n/**\n * Appends `exp` to the plugins.stringResolver.propertiesToSkip array or creates it if it doesn't exist\n *\n * @param asset - Asset to apply the transform to\n */\nexport const expPropTransform: BeforeTransformFunction<Asset> = (asset) => {\n const skipArray = asset.plugins?.stringResolver?.propertiesToSkip;\n\n if (skipArray && skipArray.indexOf(\"exp\") > 1) {\n return asset;\n }\n\n return {\n ...asset,\n plugins: {\n ...asset.plugins,\n stringResolver: {\n ...asset?.plugins?.stringResolver,\n propertiesToSkip: [\n ...(asset.plugins?.stringResolver?.propertiesToSkip ?? []),\n \"exp\",\n ],\n },\n },\n };\n};\n\nexport const actionTransform = compose(\n transform,\n backIconTransform,\n composeBefore(expPropTransform),\n);\n","import type { TransformFunction } from \"@player-ui/player\";\nimport type { AssetWrapper } from \"@player-ui/player\";\nimport type { InfoAsset, InfoAssetTransform } from \"./types\";\nimport type { ActionAsset } from \"../action/types\";\nimport { isBackAction } from \"../action/transform\";\n\n/**\n * This transform should add segmentedActions to the info asset.\n * Segmented actions display side by side in larger viewports. Segmented Actions is an object of next and prev actions\n */\nexport const infoTransform: TransformFunction<InfoAsset, InfoAssetTransform> = (\n infoAsset,\n) => {\n const actions = infoAsset?.actions;\n const segmentedActions = actions?.reduce(\n (segmentedActionsArray, action) => {\n segmentedActionsArray[\n isBackAction(action.asset as ActionAsset) ? \"prev\" : \"next\"\n ].push(action as AssetWrapper<ActionAsset>);\n return segmentedActionsArray;\n },\n { next: [], prev: [] } as {\n /**\n * next is an array of next actions\n */\n next: Array<AssetWrapper<ActionAsset>>;\n /**\n * prev is an array of prev actions\n */\n prev: Array<AssetWrapper<ActionAsset>>;\n },\n );\n\n return {\n ...infoAsset,\n segmentedActions,\n };\n};\n","import type { TransformFunction } from \"@player-ui/player\";\nimport type { ImageAsset, TransformedImage } from \"./types\";\n\n/**\n * Function to retrieve the desired alt text based on passed in props.\n * @param props Image props\n * @returns The alt text for the image asset\n */\nconst getImageAlt = (props: ImageAsset): string => {\n const { metaData, placeholder } = props;\n if (metaData.accessibility) return metaData.accessibility;\n\n if (placeholder) return placeholder;\n\n return \"Image\";\n};\n\n/**\n * Sets the Image's placeholder and accessibilty\n */\nexport const imageTransform: TransformFunction<ImageAsset, TransformedImage> = (\n props,\n) => {\n const altText = getImageAlt(props);\n\n const newImage = {\n ...props,\n altText,\n };\n\n return newImage;\n};\n","import type { TransformFunction } from \"@player-ui/player\";\nimport type {\n ChoiceAsset,\n TransformedChoice,\n TransformedChoiceItem,\n} from \"./types\";\n\n/**\n * Docs about the asset transform\n */\nexport const choiceTransform: TransformFunction<\n ChoiceAsset,\n TransformedChoice\n> = (asset, options) => {\n const { items, binding, ...rest } = asset;\n\n const assetHasBinding = binding !== undefined;\n\n const currentValue = assetHasBinding\n ? options.data.model.get(binding, {\n includeInvalid: true,\n })\n : undefined;\n\n const resetValue = () => {\n if (assetHasBinding) {\n return options.data.model.set([[binding, null]]);\n }\n };\n\n const transformedChoiceItems: TransformedChoiceItem[] = (items || []).map(\n (item, index) => ({\n ...item,\n id: item.id ?? `${asset.id}-choice-${index}`,\n select() {\n if (assetHasBinding) {\n return options.data.model.set([[binding, item.value]]);\n }\n },\n unselect: resetValue,\n }),\n );\n\n return {\n ...rest,\n binding,\n clearSelection: resetValue,\n items: transformedChoiceItems,\n value: currentValue,\n validation: assetHasBinding\n ? options.validation?.get(binding, { track: true })\n : undefined,\n dataType: assetHasBinding ? options.validation?.type(binding) : undefined,\n };\n};\n","import type {\n BeforeTransformFunction,\n TransformFunctions,\n} from \"@player-ui/player\";\nimport { composeBefore, compose } from \"@player-ui/asset-transform-plugin\";\nimport { createAsyncTransform } from \"@player-ui/async-node-plugin\";\nimport { ChatMessageAsset } from \"./types\";\n/**\n * In beforeTransform function, pass in flatten marker and call beforeResolve function.\n * Flatten default value is true.\n * input: ChatMessageAsset\n * @param asset - Asset to apply the transform to\n * @returns - transformed asset with async node and asset node\n */\nexport const transform: BeforeTransformFunction<ChatMessageAsset> =\n createAsyncTransform({\n transformAssetType: \"chat-message\",\n wrapperAssetType: \"collection\",\n getNestedAsset: (node) => node.children?.[0]?.value,\n });\n\nexport const chatMessageTransform: TransformFunctions = compose(\n composeBefore(transform),\n);\n","import type { Player, PlayerPlugin } from \"@player-ui/player\";\nimport { MetaPlugin } from \"@player-ui/meta-plugin\";\nimport { ChatUiDemoPlugin, ReferenceAssetsTransformPlugin } from \"./plugins\";\nimport {\n AsyncNodePlugin,\n AsyncNodePluginPlugin,\n} from \"@player-ui/async-node-plugin\";\n\n/**\n * A plugin to add transforms for the reference assets\n */\nexport class ReferenceAssetsPlugin implements PlayerPlugin {\n name = \"reference-assets-plugin\";\n\n private readonly metaPlugin = new MetaPlugin([\n new AsyncNodePlugin({\n plugins: [new AsyncNodePluginPlugin()],\n }),\n new ReferenceAssetsTransformPlugin(),\n new ChatUiDemoPlugin(),\n ]);\n\n apply(player: Player): void {\n player.registerPlugin(this.metaPlugin);\n }\n}\n","import { AsyncNodePlugin } from \"@player-ui/async-node-plugin\";\nimport {\n ExpressionContext,\n ExtendedPlayerPlugin,\n NodeType,\n Player,\n} from \"@player-ui/player\";\nimport { ExpressionPlugin } from \"@player-ui/expression-plugin\";\nimport { send } from \"./send\";\n\nconst createContentFromMessage = (message: string, id: string): any => ({\n asset: {\n type: \"chat-message\",\n id,\n value: {\n asset: {\n type: \"text\",\n id: `${id}-value`,\n value: message,\n },\n },\n },\n});\n\nexport class ChatUiDemoPlugin implements ExtendedPlayerPlugin<[], [], [send]> {\n public readonly name = \"chat-ui-demo-plugin\";\n\n public apply(player: Player): void {\n const asyncNodePlugin = player.findPlugin<AsyncNodePlugin>(\n AsyncNodePlugin.Symbol,\n );\n\n if (!asyncNodePlugin) {\n player.logger.warn(\n `Failed to apply '${this.name}'. Reason: Could not find AsyncNodePlugin.`,\n );\n return;\n }\n\n let deferredPromises: Record<string, (val: string) => void> = {};\n let allPromiseKeys: string[] = [];\n let counter = 0;\n\n const sendMessage: send = (\n context: ExpressionContext,\n message: string,\n nodeId?: string,\n ): void => {\n if (nodeId && !(nodeId in deferredPromises)) {\n context.logger?.warn(\n `'send' expression called with unrecognized id '${nodeId}'`,\n );\n return;\n }\n\n if (!nodeId && allPromiseKeys.length === 0) {\n context.logger?.warn(`'send' called with no waiting async nodes`);\n return;\n }\n\n // Either resolve the node by the id or resolve all of them if no id provided\n const keys = nodeId ? [nodeId] : allPromiseKeys;\n\n for (const id of keys) {\n const content = createContentFromMessage(\n message,\n `chat-demo-${counter++}`,\n );\n const resolveFunction = deferredPromises[id];\n resolveFunction?.(content);\n delete deferredPromises[id];\n }\n\n if (nodeId) {\n const index = allPromiseKeys.indexOf(nodeId);\n allPromiseKeys.splice(index, 1);\n } else {\n allPromiseKeys = [];\n }\n };\n\n asyncNodePlugin.hooks.onAsyncNode.tap(this.name, (node) => {\n // Ensure this is only used on the chat-ui.tsx mock to prevent the promise from setting up during tests.\n if (\n (node.parent?.parent?.type !== NodeType.Asset &&\n node.parent?.parent?.type !== NodeType.View) ||\n !node.parent.parent.value.id.startsWith(\"collection-async-chat-demo\")\n ) {\n return Promise.resolve(undefined);\n }\n\n return new Promise((res) => {\n deferredPromises[node.id] = res;\n allPromiseKeys.push(node.id);\n });\n });\n\n // Reset at the start of a new view.\n player.hooks.view.tap(this.name, (_) => {\n deferredPromises = {};\n allPromiseKeys = [];\n counter = 0;\n });\n\n // Register 'send' expression\n const expressionPlugin = new ExpressionPlugin(\n new Map([[\"send\", sendMessage]]),\n );\n player.registerPlugin(expressionPlugin);\n }\n}\n","import type { ExtendedPlayerPlugin, Player } from \"@player-ui/player\";\nimport { AssetTransformPlugin } from \"@player-ui/asset-transform-plugin\";\nimport {\n actionTransform,\n chatMessageTransform,\n choiceTransform,\n imageTransform,\n infoTransform,\n inputTransform,\n} from \"../assets\";\nimport type {\n ActionAsset,\n ChatMessageAsset,\n ChoiceAsset,\n CollectionAsset,\n ImageAsset,\n InfoAsset,\n InputAsset,\n TextAsset,\n} from \"../assets\";\n\nexport class ReferenceAssetsTransformPlugin\n implements\n ExtendedPlayerPlugin<\n [\n ActionAsset,\n InputAsset,\n ImageAsset,\n TextAsset,\n CollectionAsset,\n ChoiceAsset,\n ChatMessageAsset,\n ],\n [InfoAsset]\n >\n{\n name = \"reference-assets-transforms\";\n\n apply(player: Player): void {\n player.registerPlugin(\n new AssetTransformPlugin([\n [{ type: \"action\" }, actionTransform],\n [{ type: \"input\" }, inputTransform],\n [{ type: \"image\" }, imageTransform],\n [{ type: \"info\" }, infoTransform],\n [{ type: \"choice\" }, choiceTransform],\n [{ type: \"chat-message\" }, chatMessageTransform],\n ]),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAAA;AAAA;AAAA;;;ACMO,IAAM,iBAAkE,CAC7E,OACA,YACG;AACH,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO,KAAK;AACV,UAAI,MAAM,YAAY,QAAW;AAC/B,eAAO;AAAA,MACT;AAEA,aAAO,QAAQ,KAAK,OAAO,MAAM,SAAS,GAAG;AAAA,IAC/C;AAAA,IACA,IAAI,KAAK;AACP,UAAI,MAAM,YAAY,QAAW;AAC/B;AAAA,MACF;AAEA,aAAO,QAAQ,KAAK,MAAM,IAAI,CAAC,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG;AAAA,QACpD,WAAW;AAAA,MACb,CAAC;AAAA,IACH;AAAA,IACA,OACE,MAAM,YAAY,SACd,KACA,QAAQ,KAAK,MAAM,IAAI,MAAM,SAAS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AW,CAAC,CAAC;AAAA,IACjC;AACA,WAAO,eAAe,gBAAgB;AAAA,EACxC;AACF;;;AC7GA,IAAAC,iCAAqC;AAoB9B,IAAM,iCAAN,MAcP;AAAA,EAdO;AAeL,gBAAO;AAAA;AAAA,EAEP,MAAM,QAAsB;AAC1B,WAAO;AAAA,MACL,IAAI,oDAAqB;AAAA,QACvB,CAAC,EAAE,MAAM,SAAS,GAAG,eAAe;AAAA,QACpC,CAAC,EAAE,MAAM,QAAQ,GAAG,cAAc;AAAA,QAClC,CAAC,EAAE,MAAM,QAAQ,GAAG,cAAc;AAAA,QAClC,CAAC,EAAE,MAAM,OAAO,GAAG,aAAa;AAAA,QAChC,CAAC,EAAE,MAAM,SAAS,GAAG,eAAe;AAAA,QACpC,CAAC,EAAE,MAAM,eAAe,GAAG,oBAAoB;AAAA,MACjD,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AF/CA,IAAAC,4BAGO;AAKA,IAAM,wBAAN,MAAoD;AAAA,EAApD;AACL,gBAAO;AAEP,SAAiB,aAAa,IAAI,8BAAW;AAAA,MAC3C,IAAI,0CAAgB;AAAA,QAClB,SAAS,CAAC,IAAI,gDAAsB,CAAC;AAAA,MACvC,CAAC;AAAA,MACD,IAAI,+BAA+B;AAAA,MACnC,IAAI,iBAAiB;AAAA,IACvB,CAAC;AAAA;AAAA,EAED,MAAM,QAAsB;AAC1B,WAAO,eAAe,KAAK,UAAU;AAAA,EACvC;AACF;","names":["transform","import_asset_transform_plugin","transform","import_async_node_plugin","import_asset_transform_plugin","import_async_node_plugin"]}
@@ -167,6 +167,9 @@ import { MetaPlugin } from "@player-ui/meta-plugin";
167
167
 
168
168
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugins/chat-ui-demo-plugin.ts
169
169
  import { AsyncNodePlugin } from "@player-ui/async-node-plugin";
170
+ import {
171
+ NodeType
172
+ } from "@player-ui/player";
170
173
  import { ExpressionPlugin } from "@player-ui/expression-plugin";
171
174
  var createContentFromMessage = (message, id) => ({
172
175
  asset: {
@@ -213,7 +216,7 @@ var ChatUiDemoPlugin = class {
213
216
  for (const id of keys) {
214
217
  const content = createContentFromMessage(
215
218
  message,
216
- `message-${counter++}`
219
+ `chat-demo-${counter++}`
217
220
  );
218
221
  const resolveFunction = deferredPromises[id];
219
222
  resolveFunction?.(content);
@@ -227,6 +230,9 @@ var ChatUiDemoPlugin = class {
227
230
  }
228
231
  };
229
232
  asyncNodePlugin.hooks.onAsyncNode.tap(this.name, (node) => {
233
+ if (node.parent?.parent?.type !== NodeType.Asset && node.parent?.parent?.type !== NodeType.View || !node.parent.parent.value.id.startsWith("collection-async-chat-demo")) {
234
+ return Promise.resolve(void 0);
235
+ }
230
236
  return new Promise((res) => {
231
237
  deferredPromises[node.id] = res;
232
238
  allPromiseKeys.push(node.id);
package/dist/index.mjs CHANGED
@@ -167,6 +167,9 @@ import { MetaPlugin } from "@player-ui/meta-plugin";
167
167
 
168
168
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugins/chat-ui-demo-plugin.ts
169
169
  import { AsyncNodePlugin } from "@player-ui/async-node-plugin";
170
+ import {
171
+ NodeType
172
+ } from "@player-ui/player";
170
173
  import { ExpressionPlugin } from "@player-ui/expression-plugin";
171
174
  var createContentFromMessage = (message, id) => ({
172
175
  asset: {
@@ -213,7 +216,7 @@ var ChatUiDemoPlugin = class {
213
216
  for (const id of keys) {
214
217
  const content = createContentFromMessage(
215
218
  message,
216
- `message-${counter++}`
219
+ `chat-demo-${counter++}`
217
220
  );
218
221
  const resolveFunction = deferredPromises[id];
219
222
  resolveFunction?.(content);
@@ -227,6 +230,9 @@ var ChatUiDemoPlugin = class {
227
230
  }
228
231
  };
229
232
  asyncNodePlugin.hooks.onAsyncNode.tap(this.name, (node) => {
233
+ if (node.parent?.parent?.type !== NodeType.Asset && node.parent?.parent?.type !== NodeType.View || !node.parent.parent.value.id.startsWith("collection-async-chat-demo")) {
234
+ return Promise.resolve(void 0);
235
+ }
230
236
  return new Promise((res) => {
231
237
  deferredPromises[node.id] = res;
232
238
  allPromiseKeys.push(node.id);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/input/transform.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/action/transform.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/info/transform.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/image/transform.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/choice/transform.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/chat-message/transform.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugin.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugins/chat-ui-demo-plugin.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugins/reference-assets-transform-plugin.ts"],"sourcesContent":["import type { TransformFunction } from \"@player-ui/player\";\nimport type { InputAsset, TransformedInput } from \"./types\";\n\n/**\n * Docs about the asset transform\n */\nexport const inputTransform: TransformFunction<InputAsset, TransformedInput> = (\n asset,\n options,\n) => {\n return {\n ...asset,\n format(val) {\n if (asset.binding === undefined) {\n return val;\n }\n\n return options.data.format(asset.binding, val);\n },\n set(val) {\n if (asset.binding === undefined) {\n return;\n }\n\n return options.data.model.set([[asset.binding, val]], {\n formatted: true,\n });\n },\n value:\n asset.binding === undefined\n ? \"\"\n : options.data.model.get(asset.binding, {\n includeInvalid: true,\n formatted: true,\n }),\n validation:\n asset.binding === undefined\n ? undefined\n : options.validation?.get(asset.binding, { track: true }),\n dataType:\n asset.binding === undefined\n ? undefined\n : options.validation?.type(asset.binding),\n };\n};\n","import type {\n Asset,\n TransformFunction,\n BeforeTransformFunction,\n} from \"@player-ui/player\";\nimport { compose, composeBefore } from \"@player-ui/asset-transform-plugin\";\nimport type { ActionAsset, TransformedAction } from \"./types\";\n\n/**\n * Function to find prev button\n */\nexport function isBackAction(action: ActionAsset): boolean {\n return action.value === \"Prev\";\n}\n\n/**\n * Attaches the methods to execute an action to an action\n */\nconst transform: TransformFunction<ActionAsset, TransformedAction> = (\n action,\n options,\n) => {\n return {\n ...action,\n run() {\n if (action.exp) {\n options.evaluate(action.exp);\n }\n\n if (action.value) {\n const skipValidation = action.metaData?.skipValidation;\n options.transition?.(action.value, { force: skipValidation });\n }\n },\n };\n};\n\n/**\n * De couples back button from the back icon\n */\nconst backIconTransform: TransformFunction<ActionAsset, ActionAsset> = (\n action,\n) => {\n /** For previous versions of player, the back button would already have the back icon.\n * This ensures that the old functionality does not break and back button is still visible when they update the player.\n */\n if (isBackAction(action) && action?.metaData?.role === undefined) {\n return {\n ...action,\n metaData: {\n ...action?.metaData,\n role: \"back\",\n },\n };\n }\n\n return action;\n};\n\n/**\n * Appends `exp` to the plugins.stringResolver.propertiesToSkip array or creates it if it doesn't exist\n *\n * @param asset - Asset to apply the transform to\n */\nexport const expPropTransform: BeforeTransformFunction<Asset> = (asset) => {\n const skipArray = asset.plugins?.stringResolver?.propertiesToSkip;\n\n if (skipArray && skipArray.indexOf(\"exp\") > 1) {\n return asset;\n }\n\n return {\n ...asset,\n plugins: {\n ...asset.plugins,\n stringResolver: {\n ...asset?.plugins?.stringResolver,\n propertiesToSkip: [\n ...(asset.plugins?.stringResolver?.propertiesToSkip ?? []),\n \"exp\",\n ],\n },\n },\n };\n};\n\nexport const actionTransform = compose(\n transform,\n backIconTransform,\n composeBefore(expPropTransform),\n);\n","import type { TransformFunction } from \"@player-ui/player\";\nimport type { AssetWrapper } from \"@player-ui/player\";\nimport type { InfoAsset, InfoAssetTransform } from \"./types\";\nimport type { ActionAsset } from \"../action/types\";\nimport { isBackAction } from \"../action/transform\";\n\n/**\n * This transform should add segmentedActions to the info asset.\n * Segmented actions display side by side in larger viewports. Segmented Actions is an object of next and prev actions\n */\nexport const infoTransform: TransformFunction<InfoAsset, InfoAssetTransform> = (\n infoAsset,\n) => {\n const actions = infoAsset?.actions;\n const segmentedActions = actions?.reduce(\n (segmentedActionsArray, action) => {\n segmentedActionsArray[\n isBackAction(action.asset as ActionAsset) ? \"prev\" : \"next\"\n ].push(action as AssetWrapper<ActionAsset>);\n return segmentedActionsArray;\n },\n { next: [], prev: [] } as {\n /**\n * next is an array of next actions\n */\n next: Array<AssetWrapper<ActionAsset>>;\n /**\n * prev is an array of prev actions\n */\n prev: Array<AssetWrapper<ActionAsset>>;\n },\n );\n\n return {\n ...infoAsset,\n segmentedActions,\n };\n};\n","import type { TransformFunction } from \"@player-ui/player\";\nimport type { ImageAsset, TransformedImage } from \"./types\";\n\n/**\n * Function to retrieve the desired alt text based on passed in props.\n * @param props Image props\n * @returns The alt text for the image asset\n */\nconst getImageAlt = (props: ImageAsset): string => {\n const { metaData, placeholder } = props;\n if (metaData.accessibility) return metaData.accessibility;\n\n if (placeholder) return placeholder;\n\n return \"Image\";\n};\n\n/**\n * Sets the Image's placeholder and accessibilty\n */\nexport const imageTransform: TransformFunction<ImageAsset, TransformedImage> = (\n props,\n) => {\n const altText = getImageAlt(props);\n\n const newImage = {\n ...props,\n altText,\n };\n\n return newImage;\n};\n","import type { TransformFunction } from \"@player-ui/player\";\nimport type {\n ChoiceAsset,\n TransformedChoice,\n TransformedChoiceItem,\n} from \"./types\";\n\n/**\n * Docs about the asset transform\n */\nexport const choiceTransform: TransformFunction<\n ChoiceAsset,\n TransformedChoice\n> = (asset, options) => {\n const { items, binding, ...rest } = asset;\n\n const assetHasBinding = binding !== undefined;\n\n const currentValue = assetHasBinding\n ? options.data.model.get(binding, {\n includeInvalid: true,\n })\n : undefined;\n\n const resetValue = () => {\n if (assetHasBinding) {\n return options.data.model.set([[binding, null]]);\n }\n };\n\n const transformedChoiceItems: TransformedChoiceItem[] = (items || []).map(\n (item, index) => ({\n ...item,\n id: item.id ?? `${asset.id}-choice-${index}`,\n select() {\n if (assetHasBinding) {\n return options.data.model.set([[binding, item.value]]);\n }\n },\n unselect: resetValue,\n }),\n );\n\n return {\n ...rest,\n binding,\n clearSelection: resetValue,\n items: transformedChoiceItems,\n value: currentValue,\n validation: assetHasBinding\n ? options.validation?.get(binding, { track: true })\n : undefined,\n dataType: assetHasBinding ? options.validation?.type(binding) : undefined,\n };\n};\n","import type {\n BeforeTransformFunction,\n TransformFunctions,\n} from \"@player-ui/player\";\nimport { composeBefore, compose } from \"@player-ui/asset-transform-plugin\";\nimport { createAsyncTransform } from \"@player-ui/async-node-plugin\";\nimport { ChatMessageAsset } from \"./types\";\n/**\n * In beforeTransform function, pass in flatten marker and call beforeResolve function.\n * Flatten default value is true.\n * input: ChatMessageAsset\n * @param asset - Asset to apply the transform to\n * @returns - transformed asset with async node and asset node\n */\nexport const transform: BeforeTransformFunction<ChatMessageAsset> =\n createAsyncTransform({\n transformAssetType: \"chat-message\",\n wrapperAssetType: \"collection\",\n getNestedAsset: (node) => node.children?.[0]?.value,\n });\n\nexport const chatMessageTransform: TransformFunctions = compose(\n composeBefore(transform),\n);\n","import type { Player, PlayerPlugin } from \"@player-ui/player\";\nimport { MetaPlugin } from \"@player-ui/meta-plugin\";\nimport { ChatUiDemoPlugin, ReferenceAssetsTransformPlugin } from \"./plugins\";\nimport {\n AsyncNodePlugin,\n AsyncNodePluginPlugin,\n} from \"@player-ui/async-node-plugin\";\n\n/**\n * A plugin to add transforms for the reference assets\n */\nexport class ReferenceAssetsPlugin implements PlayerPlugin {\n name = \"reference-assets-plugin\";\n\n private readonly metaPlugin = new MetaPlugin([\n new AsyncNodePlugin({\n plugins: [new AsyncNodePluginPlugin()],\n }),\n new ReferenceAssetsTransformPlugin(),\n new ChatUiDemoPlugin(),\n ]);\n\n apply(player: Player): void {\n player.registerPlugin(this.metaPlugin);\n }\n}\n","import { AsyncNodePlugin } from \"@player-ui/async-node-plugin\";\nimport {\n ExpressionContext,\n ExtendedPlayerPlugin,\n Player,\n} from \"@player-ui/player\";\nimport { ExpressionPlugin } from \"@player-ui/expression-plugin\";\nimport { send } from \"./send\";\n\nconst createContentFromMessage = (message: string, id: string): any => ({\n asset: {\n type: \"chat-message\",\n id,\n value: {\n asset: {\n type: \"text\",\n id: `${id}-value`,\n value: message,\n },\n },\n },\n});\n\nexport class ChatUiDemoPlugin implements ExtendedPlayerPlugin<[], [], [send]> {\n public readonly name = \"chat-ui-demo-plugin\";\n\n public apply(player: Player): void {\n const asyncNodePlugin = player.findPlugin<AsyncNodePlugin>(\n AsyncNodePlugin.Symbol,\n );\n\n if (!asyncNodePlugin) {\n player.logger.warn(\n `Failed to apply '${this.name}'. Reason: Could not find AsyncNodePlugin.`,\n );\n return;\n }\n\n let deferredPromises: Record<string, (val: string) => void> = {};\n let allPromiseKeys: string[] = [];\n let counter = 0;\n\n const sendMessage: send = (\n context: ExpressionContext,\n message: string,\n nodeId?: string,\n ): void => {\n if (nodeId && !(nodeId in deferredPromises)) {\n context.logger?.warn(\n `'send' expression called with unrecognized id '${nodeId}'`,\n );\n return;\n }\n\n if (!nodeId && allPromiseKeys.length === 0) {\n context.logger?.warn(`'send' called with no waiting async nodes`);\n return;\n }\n\n // Either resolve the node by the id or resolve all of them if no id provided\n const keys = nodeId ? [nodeId] : allPromiseKeys;\n\n for (const id of keys) {\n const content = createContentFromMessage(\n message,\n `message-${counter++}`,\n );\n const resolveFunction = deferredPromises[id];\n resolveFunction?.(content);\n delete deferredPromises[id];\n }\n\n if (nodeId) {\n const index = allPromiseKeys.indexOf(nodeId);\n allPromiseKeys.splice(index, 1);\n } else {\n allPromiseKeys = [];\n }\n };\n\n asyncNodePlugin.hooks.onAsyncNode.tap(this.name, (node) => {\n return new Promise((res) => {\n deferredPromises[node.id] = res;\n allPromiseKeys.push(node.id);\n });\n });\n\n // Reset at the start of a new view.\n player.hooks.view.tap(this.name, (_) => {\n deferredPromises = {};\n allPromiseKeys = [];\n counter = 0;\n });\n\n // Register 'send' expression\n const expressionPlugin = new ExpressionPlugin(\n new Map([[\"send\", sendMessage]]),\n );\n player.registerPlugin(expressionPlugin);\n }\n}\n","import type { ExtendedPlayerPlugin, Player } from \"@player-ui/player\";\nimport { AssetTransformPlugin } from \"@player-ui/asset-transform-plugin\";\nimport {\n actionTransform,\n chatMessageTransform,\n choiceTransform,\n imageTransform,\n infoTransform,\n inputTransform,\n} from \"../assets\";\nimport type {\n ActionAsset,\n ChatMessageAsset,\n ChoiceAsset,\n CollectionAsset,\n ImageAsset,\n InfoAsset,\n InputAsset,\n TextAsset,\n} from \"../assets\";\n\nexport class ReferenceAssetsTransformPlugin\n implements\n ExtendedPlayerPlugin<\n [\n ActionAsset,\n InputAsset,\n ImageAsset,\n TextAsset,\n CollectionAsset,\n ChoiceAsset,\n ChatMessageAsset,\n ],\n [InfoAsset]\n >\n{\n name = \"reference-assets-transforms\";\n\n apply(player: Player): void {\n player.registerPlugin(\n new AssetTransformPlugin([\n [{ type: \"action\" }, actionTransform],\n [{ type: \"input\" }, inputTransform],\n [{ type: \"image\" }, imageTransform],\n [{ type: \"info\" }, infoTransform],\n [{ type: \"choice\" }, choiceTransform],\n [{ type: \"chat-message\" }, chatMessageTransform],\n ]),\n );\n }\n}\n"],"mappings":";AAMO,IAAM,iBAAkE,CAC7E,OACA,YACG;AACH,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO,KAAK;AACV,UAAI,MAAM,YAAY,QAAW;AAC/B,eAAO;AAAA,MACT;AAEA,aAAO,QAAQ,KAAK,OAAO,MAAM,SAAS,GAAG;AAAA,IAC/C;AAAA,IACA,IAAI,KAAK;AACP,UAAI,MAAM,YAAY,QAAW;AAC/B;AAAA,MACF;AAEA,aAAO,QAAQ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AAI,CAAC,CAAC,QAAQ,WAAW,CAAC,CAAC;AAAA,IACjC;AACA,WAAO,eAAe,gBAAgB;AAAA,EACxC;AACF;;;ACnGA,SAAS,4BAA4B;AAoB9B,IAAM,iCAAN,MAcP;AAAA,EAdO;AAeL,gBAAO;AAAA;AAAA,EAEP,MAAM,QAAsB;AAC1B,WAAO;AAAA,MACL,IAAI,qBAAqB;AAAA,QACvB,CAAC,EAAE,MAAM,SAAS,GAAG,eAAe;AAAA,QACpC,CAAC,EAAE,MAAM,QAAQ,GAAG,cAAc;AAAA,QAClC,CAAC,EAAE,MAAM,QAAQ,GAAG,cAAc;AAAA,QAClC,CAAC,EAAE,MAAM,OAAO,GAAG,aAAa;AAAA,QAChC,CAAC,EAAE,MAAM,SAAS,GAAG,eAAe;AAAA,QACpC,CAAC,EAAE,MAAM,eAAe,GAAG,oBAAoB;AAAA,MACjD,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AF/CA;AAAA,EACE,mBAAAC;AAAA,EACA;AAAA,OACK;AAKA,IAAM,wBAAN,MAAoD;AAAA,EAApD;AACL,gBAAO;AAEP,SAAiB,aAAa,IAAI,WAAW;AAAA,MAC3C,IAAIA,iBAAgB;AAAA,QAClB,SAAS,CAAC,IAAI,sBAAsB,CAAC;AAAA,MACvC,CAAC;AAAA,MACD,IAAI,+BAA+B;AAAA,MACnC,IAAI,iBAAiB;AAAA,IACvB,CAAC;AAAA;AAAA,EAED,MAAM,QAAsB;AAC1B,WAAO,eAAe,KAAK,UAAU;AAAA,EACvC;AACF;","names":["composeBefore","compose","transform","AsyncNodePlugin"]}
1
+ {"version":3,"sources":["../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/input/transform.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/action/transform.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/info/transform.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/image/transform.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/choice/transform.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/chat-message/transform.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugin.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugins/chat-ui-demo-plugin.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugins/reference-assets-transform-plugin.ts"],"sourcesContent":["import type { TransformFunction } from \"@player-ui/player\";\nimport type { InputAsset, TransformedInput } from \"./types\";\n\n/**\n * Docs about the asset transform\n */\nexport const inputTransform: TransformFunction<InputAsset, TransformedInput> = (\n asset,\n options,\n) => {\n return {\n ...asset,\n format(val) {\n if (asset.binding === undefined) {\n return val;\n }\n\n return options.data.format(asset.binding, val);\n },\n set(val) {\n if (asset.binding === undefined) {\n return;\n }\n\n return options.data.model.set([[asset.binding, val]], {\n formatted: true,\n });\n },\n value:\n asset.binding === undefined\n ? \"\"\n : options.data.model.get(asset.binding, {\n includeInvalid: true,\n formatted: true,\n }),\n validation:\n asset.binding === undefined\n ? undefined\n : options.validation?.get(asset.binding, { track: true }),\n dataType:\n asset.binding === undefined\n ? undefined\n : options.validation?.type(asset.binding),\n };\n};\n","import type {\n Asset,\n TransformFunction,\n BeforeTransformFunction,\n} from \"@player-ui/player\";\nimport { compose, composeBefore } from \"@player-ui/asset-transform-plugin\";\nimport type { ActionAsset, TransformedAction } from \"./types\";\n\n/**\n * Function to find prev button\n */\nexport function isBackAction(action: ActionAsset): boolean {\n return action.value === \"Prev\";\n}\n\n/**\n * Attaches the methods to execute an action to an action\n */\nconst transform: TransformFunction<ActionAsset, TransformedAction> = (\n action,\n options,\n) => {\n return {\n ...action,\n run() {\n if (action.exp) {\n options.evaluate(action.exp);\n }\n\n if (action.value) {\n const skipValidation = action.metaData?.skipValidation;\n options.transition?.(action.value, { force: skipValidation });\n }\n },\n };\n};\n\n/**\n * De couples back button from the back icon\n */\nconst backIconTransform: TransformFunction<ActionAsset, ActionAsset> = (\n action,\n) => {\n /** For previous versions of player, the back button would already have the back icon.\n * This ensures that the old functionality does not break and back button is still visible when they update the player.\n */\n if (isBackAction(action) && action?.metaData?.role === undefined) {\n return {\n ...action,\n metaData: {\n ...action?.metaData,\n role: \"back\",\n },\n };\n }\n\n return action;\n};\n\n/**\n * Appends `exp` to the plugins.stringResolver.propertiesToSkip array or creates it if it doesn't exist\n *\n * @param asset - Asset to apply the transform to\n */\nexport const expPropTransform: BeforeTransformFunction<Asset> = (asset) => {\n const skipArray = asset.plugins?.stringResolver?.propertiesToSkip;\n\n if (skipArray && skipArray.indexOf(\"exp\") > 1) {\n return asset;\n }\n\n return {\n ...asset,\n plugins: {\n ...asset.plugins,\n stringResolver: {\n ...asset?.plugins?.stringResolver,\n propertiesToSkip: [\n ...(asset.plugins?.stringResolver?.propertiesToSkip ?? []),\n \"exp\",\n ],\n },\n },\n };\n};\n\nexport const actionTransform = compose(\n transform,\n backIconTransform,\n composeBefore(expPropTransform),\n);\n","import type { TransformFunction } from \"@player-ui/player\";\nimport type { AssetWrapper } from \"@player-ui/player\";\nimport type { InfoAsset, InfoAssetTransform } from \"./types\";\nimport type { ActionAsset } from \"../action/types\";\nimport { isBackAction } from \"../action/transform\";\n\n/**\n * This transform should add segmentedActions to the info asset.\n * Segmented actions display side by side in larger viewports. Segmented Actions is an object of next and prev actions\n */\nexport const infoTransform: TransformFunction<InfoAsset, InfoAssetTransform> = (\n infoAsset,\n) => {\n const actions = infoAsset?.actions;\n const segmentedActions = actions?.reduce(\n (segmentedActionsArray, action) => {\n segmentedActionsArray[\n isBackAction(action.asset as ActionAsset) ? \"prev\" : \"next\"\n ].push(action as AssetWrapper<ActionAsset>);\n return segmentedActionsArray;\n },\n { next: [], prev: [] } as {\n /**\n * next is an array of next actions\n */\n next: Array<AssetWrapper<ActionAsset>>;\n /**\n * prev is an array of prev actions\n */\n prev: Array<AssetWrapper<ActionAsset>>;\n },\n );\n\n return {\n ...infoAsset,\n segmentedActions,\n };\n};\n","import type { TransformFunction } from \"@player-ui/player\";\nimport type { ImageAsset, TransformedImage } from \"./types\";\n\n/**\n * Function to retrieve the desired alt text based on passed in props.\n * @param props Image props\n * @returns The alt text for the image asset\n */\nconst getImageAlt = (props: ImageAsset): string => {\n const { metaData, placeholder } = props;\n if (metaData.accessibility) return metaData.accessibility;\n\n if (placeholder) return placeholder;\n\n return \"Image\";\n};\n\n/**\n * Sets the Image's placeholder and accessibilty\n */\nexport const imageTransform: TransformFunction<ImageAsset, TransformedImage> = (\n props,\n) => {\n const altText = getImageAlt(props);\n\n const newImage = {\n ...props,\n altText,\n };\n\n return newImage;\n};\n","import type { TransformFunction } from \"@player-ui/player\";\nimport type {\n ChoiceAsset,\n TransformedChoice,\n TransformedChoiceItem,\n} from \"./types\";\n\n/**\n * Docs about the asset transform\n */\nexport const choiceTransform: TransformFunction<\n ChoiceAsset,\n TransformedChoice\n> = (asset, options) => {\n const { items, binding, ...rest } = asset;\n\n const assetHasBinding = binding !== undefined;\n\n const currentValue = assetHasBinding\n ? options.data.model.get(binding, {\n includeInvalid: true,\n })\n : undefined;\n\n const resetValue = () => {\n if (assetHasBinding) {\n return options.data.model.set([[binding, null]]);\n }\n };\n\n const transformedChoiceItems: TransformedChoiceItem[] = (items || []).map(\n (item, index) => ({\n ...item,\n id: item.id ?? `${asset.id}-choice-${index}`,\n select() {\n if (assetHasBinding) {\n return options.data.model.set([[binding, item.value]]);\n }\n },\n unselect: resetValue,\n }),\n );\n\n return {\n ...rest,\n binding,\n clearSelection: resetValue,\n items: transformedChoiceItems,\n value: currentValue,\n validation: assetHasBinding\n ? options.validation?.get(binding, { track: true })\n : undefined,\n dataType: assetHasBinding ? options.validation?.type(binding) : undefined,\n };\n};\n","import type {\n BeforeTransformFunction,\n TransformFunctions,\n} from \"@player-ui/player\";\nimport { composeBefore, compose } from \"@player-ui/asset-transform-plugin\";\nimport { createAsyncTransform } from \"@player-ui/async-node-plugin\";\nimport { ChatMessageAsset } from \"./types\";\n/**\n * In beforeTransform function, pass in flatten marker and call beforeResolve function.\n * Flatten default value is true.\n * input: ChatMessageAsset\n * @param asset - Asset to apply the transform to\n * @returns - transformed asset with async node and asset node\n */\nexport const transform: BeforeTransformFunction<ChatMessageAsset> =\n createAsyncTransform({\n transformAssetType: \"chat-message\",\n wrapperAssetType: \"collection\",\n getNestedAsset: (node) => node.children?.[0]?.value,\n });\n\nexport const chatMessageTransform: TransformFunctions = compose(\n composeBefore(transform),\n);\n","import type { Player, PlayerPlugin } from \"@player-ui/player\";\nimport { MetaPlugin } from \"@player-ui/meta-plugin\";\nimport { ChatUiDemoPlugin, ReferenceAssetsTransformPlugin } from \"./plugins\";\nimport {\n AsyncNodePlugin,\n AsyncNodePluginPlugin,\n} from \"@player-ui/async-node-plugin\";\n\n/**\n * A plugin to add transforms for the reference assets\n */\nexport class ReferenceAssetsPlugin implements PlayerPlugin {\n name = \"reference-assets-plugin\";\n\n private readonly metaPlugin = new MetaPlugin([\n new AsyncNodePlugin({\n plugins: [new AsyncNodePluginPlugin()],\n }),\n new ReferenceAssetsTransformPlugin(),\n new ChatUiDemoPlugin(),\n ]);\n\n apply(player: Player): void {\n player.registerPlugin(this.metaPlugin);\n }\n}\n","import { AsyncNodePlugin } from \"@player-ui/async-node-plugin\";\nimport {\n ExpressionContext,\n ExtendedPlayerPlugin,\n NodeType,\n Player,\n} from \"@player-ui/player\";\nimport { ExpressionPlugin } from \"@player-ui/expression-plugin\";\nimport { send } from \"./send\";\n\nconst createContentFromMessage = (message: string, id: string): any => ({\n asset: {\n type: \"chat-message\",\n id,\n value: {\n asset: {\n type: \"text\",\n id: `${id}-value`,\n value: message,\n },\n },\n },\n});\n\nexport class ChatUiDemoPlugin implements ExtendedPlayerPlugin<[], [], [send]> {\n public readonly name = \"chat-ui-demo-plugin\";\n\n public apply(player: Player): void {\n const asyncNodePlugin = player.findPlugin<AsyncNodePlugin>(\n AsyncNodePlugin.Symbol,\n );\n\n if (!asyncNodePlugin) {\n player.logger.warn(\n `Failed to apply '${this.name}'. Reason: Could not find AsyncNodePlugin.`,\n );\n return;\n }\n\n let deferredPromises: Record<string, (val: string) => void> = {};\n let allPromiseKeys: string[] = [];\n let counter = 0;\n\n const sendMessage: send = (\n context: ExpressionContext,\n message: string,\n nodeId?: string,\n ): void => {\n if (nodeId && !(nodeId in deferredPromises)) {\n context.logger?.warn(\n `'send' expression called with unrecognized id '${nodeId}'`,\n );\n return;\n }\n\n if (!nodeId && allPromiseKeys.length === 0) {\n context.logger?.warn(`'send' called with no waiting async nodes`);\n return;\n }\n\n // Either resolve the node by the id or resolve all of them if no id provided\n const keys = nodeId ? [nodeId] : allPromiseKeys;\n\n for (const id of keys) {\n const content = createContentFromMessage(\n message,\n `chat-demo-${counter++}`,\n );\n const resolveFunction = deferredPromises[id];\n resolveFunction?.(content);\n delete deferredPromises[id];\n }\n\n if (nodeId) {\n const index = allPromiseKeys.indexOf(nodeId);\n allPromiseKeys.splice(index, 1);\n } else {\n allPromiseKeys = [];\n }\n };\n\n asyncNodePlugin.hooks.onAsyncNode.tap(this.name, (node) => {\n // Ensure this is only used on the chat-ui.tsx mock to prevent the promise from setting up during tests.\n if (\n (node.parent?.parent?.type !== NodeType.Asset &&\n node.parent?.parent?.type !== NodeType.View) ||\n !node.parent.parent.value.id.startsWith(\"collection-async-chat-demo\")\n ) {\n return Promise.resolve(undefined);\n }\n\n return new Promise((res) => {\n deferredPromises[node.id] = res;\n allPromiseKeys.push(node.id);\n });\n });\n\n // Reset at the start of a new view.\n player.hooks.view.tap(this.name, (_) => {\n deferredPromises = {};\n allPromiseKeys = [];\n counter = 0;\n });\n\n // Register 'send' expression\n const expressionPlugin = new ExpressionPlugin(\n new Map([[\"send\", sendMessage]]),\n );\n player.registerPlugin(expressionPlugin);\n }\n}\n","import type { ExtendedPlayerPlugin, Player } from \"@player-ui/player\";\nimport { AssetTransformPlugin } from \"@player-ui/asset-transform-plugin\";\nimport {\n actionTransform,\n chatMessageTransform,\n choiceTransform,\n imageTransform,\n infoTransform,\n inputTransform,\n} from \"../assets\";\nimport type {\n ActionAsset,\n ChatMessageAsset,\n ChoiceAsset,\n CollectionAsset,\n ImageAsset,\n InfoAsset,\n InputAsset,\n TextAsset,\n} from \"../assets\";\n\nexport class ReferenceAssetsTransformPlugin\n implements\n ExtendedPlayerPlugin<\n [\n ActionAsset,\n InputAsset,\n ImageAsset,\n TextAsset,\n CollectionAsset,\n ChoiceAsset,\n ChatMessageAsset,\n ],\n [InfoAsset]\n >\n{\n name = \"reference-assets-transforms\";\n\n apply(player: Player): void {\n player.registerPlugin(\n new AssetTransformPlugin([\n [{ type: \"action\" }, actionTransform],\n [{ type: \"input\" }, inputTransform],\n [{ type: \"image\" }, imageTransform],\n [{ type: \"info\" }, infoTransform],\n [{ type: \"choice\" }, choiceTransform],\n [{ type: \"chat-message\" }, chatMessageTransform],\n ]),\n );\n }\n}\n"],"mappings":";AAMO,IAAM,iBAAkE,CAC7E,OACA,YACG;AACH,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO,KAAK;AACV,UAAI,MAAM,YAAY,QAAW;AAC/B,eAAO;AAAA,MACT;AAEA,aAAO,QAAQ,KAAK,OAAO,MAAM,SAAS,GAAG;AAAA,IAC/C;AAAA,IACA,IAAI,KAAK;AACP,UAAI,MAAM,YAAY,QAAW;AAC/B;AAAA,MACF;AAEA,aAAO,QAAQ,KAAK,MAAM,IAAI,CAAC,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG;AAAA,QACpD,WAAW;AAAA,MACb,CAAC;AAAA,IACH;AAAA,IACA,OACE,MAAM,YAAY,SACd,KACA,QAAQ,KAAK,MAAM,IAAI,M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GD,UAAM,mBAAmB,IAAI;AAAA,MAC3B,oBAAI,IAAI,CAAC,CAAC,QAAQ,WAAW,CAAC,CAAC;AAAA,IACjC;AACA,WAAO,eAAe,gBAAgB;AAAA,EACxC;AACF;;;AC7GA,SAAS,4BAA4B;AAoB9B,IAAM,iCAAN,MAcP;AAAA,EAdO;AAeL,gBAAO;AAAA;AAAA,EAEP,MAAM,QAAsB;AAC1B,WAAO;AAAA,MACL,IAAI,qBAAqB;AAAA,QACvB,CAAC,EAAE,MAAM,SAAS,GAAG,eAAe;AAAA,QACpC,CAAC,EAAE,MAAM,QAAQ,GAAG,cAAc;AAAA,QAClC,CAAC,EAAE,MAAM,QAAQ,GAAG,cAAc;AAAA,QAClC,CAAC,EAAE,MAAM,OAAO,GAAG,aAAa;AAAA,QAChC,CAAC,EAAE,MAAM,SAAS,GAAG,eAAe;AAAA,QACpC,CAAC,EAAE,MAAM,eAAe,GAAG,oBAAoB;AAAA,MACjD,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AF/CA;AAAA,EACE,mBAAAC;AAAA,EACA;AAAA,OACK;AAKA,IAAM,wBAAN,MAAoD;AAAA,EAApD;AACL,gBAAO;AAEP,SAAiB,aAAa,IAAI,WAAW;AAAA,MAC3C,IAAIA,iBAAgB;AAAA,QAClB,SAAS,CAAC,IAAI,sBAAsB,CAAC;AAAA,MACvC,CAAC;AAAA,MACD,IAAI,+BAA+B;AAAA,MACnC,IAAI,iBAAiB;AAAA,IACvB,CAAC;AAAA;AAAA,EAED,MAAM,QAAsB;AAC1B,WAAO,eAAe,KAAK,UAAU;AAAA,EACvC;AACF;","names":["composeBefore","compose","transform","AsyncNodePlugin"]}
@@ -1,5 +1,5 @@
1
1
  {
2
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/action/types.ts",
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/action/types.ts",
3
3
  "name": "ActionAsset",
4
4
  "type": "object",
5
5
  "properties": {
@@ -51,7 +51,7 @@
51
51
  "beacon": {
52
52
  "required": false,
53
53
  "node": {
54
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+beacon-plugin@0.0.0/node_modules/@player-ui/beacon-plugin/types/beacon.d.ts",
54
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+beacon-plugin@0.0.0/node_modules/@player-ui/beacon-plugin/types/beacon.d.ts",
55
55
  "name": "BeaconDataType",
56
56
  "type": "or",
57
57
  "or": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/chat-message/types.ts",
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/chat-message/types.ts",
3
3
  "name": "ChatMessageAsset",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/choice/types.ts",
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/choice/types.ts",
3
3
  "name": "ChoiceAsset",
4
4
  "type": "object",
5
5
  "properties": {
@@ -47,7 +47,7 @@
47
47
  "node": {
48
48
  "type": "array",
49
49
  "elementType": {
50
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/choice/types.ts",
50
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/choice/types.ts",
51
51
  "name": "ChoiceItem",
52
52
  "type": "object",
53
53
  "properties": {
@@ -77,7 +77,7 @@
77
77
  "value": {
78
78
  "required": false,
79
79
  "node": {
80
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/choice/types.ts",
80
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/choice/types.ts",
81
81
  "name": "ValueType",
82
82
  "type": "or",
83
83
  "or": [
@@ -125,14 +125,14 @@
125
125
  "metaData": {
126
126
  "required": false,
127
127
  "node": {
128
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+beacon-plugin@0.0.0/node_modules/@player-ui/beacon-plugin/types/beacon.d.ts",
128
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+beacon-plugin@0.0.0/node_modules/@player-ui/beacon-plugin/types/beacon.d.ts",
129
129
  "name": "BeaconMetaData",
130
130
  "type": "object",
131
131
  "properties": {
132
132
  "beacon": {
133
133
  "required": false,
134
134
  "node": {
135
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+beacon-plugin@0.0.0/node_modules/@player-ui/beacon-plugin/types/beacon.d.ts",
135
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+beacon-plugin@0.0.0/node_modules/@player-ui/beacon-plugin/types/beacon.d.ts",
136
136
  "name": "BeaconDataType",
137
137
  "type": "or",
138
138
  "or": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/collection/types.ts",
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/collection/types.ts",
3
3
  "name": "CollectionAsset",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,12 +1,12 @@
1
1
  {
2
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/image/types.ts",
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/image/types.ts",
3
3
  "name": "ImageAsset",
4
4
  "type": "object",
5
5
  "properties": {
6
6
  "metaData": {
7
7
  "required": true,
8
8
  "node": {
9
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/image/types.ts",
9
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/image/types.ts",
10
10
  "name": "ImageMetaData",
11
11
  "type": "object",
12
12
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/info/types.ts",
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/info/types.ts",
3
3
  "name": "InfoAsset",
4
4
  "type": "object",
5
5
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/input/types.ts",
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/input/types.ts",
3
3
  "name": "InputAsset",
4
4
  "type": "object",
5
5
  "properties": {
@@ -50,7 +50,7 @@
50
50
  "beacon": {
51
51
  "required": false,
52
52
  "node": {
53
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+beacon-plugin@0.0.0/node_modules/@player-ui/beacon-plugin/types/beacon.d.ts",
53
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+beacon-plugin@0.0.0/node_modules/@player-ui/beacon-plugin/types/beacon.d.ts",
54
54
  "name": "BeaconDataType",
55
55
  "type": "or",
56
56
  "or": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/text/types.ts",
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/text/types.ts",
3
3
  "name": "TextAsset",
4
4
  "type": "object",
5
5
  "properties": {
@@ -16,12 +16,12 @@
16
16
  "node": {
17
17
  "type": "array",
18
18
  "elementType": {
19
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/text/types.ts",
19
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/text/types.ts",
20
20
  "name": "TextModifier",
21
21
  "type": "or",
22
22
  "or": [
23
23
  {
24
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/text/types.ts",
24
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/text/types.ts",
25
25
  "name": "BasicTextModifier",
26
26
  "type": "object",
27
27
  "properties": {
@@ -48,7 +48,7 @@
48
48
  "title": "BasicTextModifier"
49
49
  },
50
50
  {
51
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/text/types.ts",
51
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/text/types.ts",
52
52
  "name": "LinkModifier",
53
53
  "type": "object",
54
54
  "properties": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2638/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugins/send.ts",
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2633/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/plugins/send.ts",
3
3
  "name": "send",
4
4
  "type": "ref",
5
5
  "ref": "ExpressionHandler<[string, string | undefined]>",
package/package.json CHANGED
@@ -6,14 +6,14 @@
6
6
  "types"
7
7
  ],
8
8
  "name": "@player-ui/reference-assets-plugin",
9
- "version": "0.14.1-next.1",
9
+ "version": "0.14.1-next.2",
10
10
  "main": "dist/cjs/index.cjs",
11
11
  "dependencies": {
12
- "@player-ui/asset-transform-plugin": "0.14.1-next.1",
13
- "@player-ui/beacon-plugin": "0.14.1-next.1",
14
- "@player-ui/async-node-plugin": "0.14.1-next.1",
15
- "@player-ui/expression-plugin": "0.14.1-next.1",
16
- "@player-ui/meta-plugin": "0.14.1-next.1",
12
+ "@player-ui/asset-transform-plugin": "0.14.1-next.2",
13
+ "@player-ui/beacon-plugin": "0.14.1-next.2",
14
+ "@player-ui/async-node-plugin": "0.14.1-next.2",
15
+ "@player-ui/expression-plugin": "0.14.1-next.2",
16
+ "@player-ui/meta-plugin": "0.14.1-next.2",
17
17
  "tslib": "^2.6.2"
18
18
  },
19
19
  "devDependencies": {
@@ -21,7 +21,7 @@
21
21
  "@player-ui/common-types-plugin": "workspace:*"
22
22
  },
23
23
  "peerDependencies": {
24
- "@player-ui/player": "0.14.1-next.1"
24
+ "@player-ui/player": "0.14.1-next.2"
25
25
  },
26
26
  "module": "dist/index.legacy-esm.js",
27
27
  "types": "types/index.d.ts",
@@ -12,11 +12,11 @@ const mockLogger = (): Logger => ({
12
12
  warn: vi.fn(),
13
13
  });
14
14
 
15
- const makeFlow = (asyncNodeCount: number): Flow => ({
15
+ const makeFlow = (asyncNodeCount: number, useDemoId = true): Flow => ({
16
16
  id: "flow-with-async",
17
17
  views: [
18
18
  {
19
- id: "view",
19
+ id: useDemoId ? "collection-async-chat-demo" : "view",
20
20
  type: "view",
21
21
  values: Array.from({ length: asyncNodeCount }, (_, index) => ({
22
22
  async: true,
@@ -30,7 +30,7 @@ const makeFlow = (asyncNodeCount: number): Flow => ({
30
30
  startState: "VIEW_1",
31
31
  VIEW_1: {
32
32
  state_type: "VIEW",
33
- ref: "view",
33
+ ref: useDemoId ? "collection-async-chat-demo" : "view",
34
34
  transitions: {
35
35
  "*": "END_DONE",
36
36
  },
@@ -126,11 +126,11 @@ describe("ReferenceAssetsPlugin", () => {
126
126
  {
127
127
  asset: {
128
128
  type: "collection",
129
- id: "collection-async-message-0",
129
+ id: "collection-async-chat-demo-0",
130
130
  values: [
131
131
  {
132
132
  asset: {
133
- id: "message-0-value",
133
+ id: "chat-demo-0-value",
134
134
  type: "text",
135
135
  value: "message",
136
136
  },
@@ -141,11 +141,11 @@ describe("ReferenceAssetsPlugin", () => {
141
141
  {
142
142
  asset: {
143
143
  type: "collection",
144
- id: "collection-async-message-1",
144
+ id: "collection-async-chat-demo-1",
145
145
  values: [
146
146
  {
147
147
  asset: {
148
- id: "message-1-value",
148
+ id: "chat-demo-1-value",
149
149
  type: "text",
150
150
  value: "message",
151
151
  },
@@ -192,11 +192,11 @@ describe("ReferenceAssetsPlugin", () => {
192
192
  {
193
193
  asset: {
194
194
  type: "collection",
195
- id: "collection-async-message-0",
195
+ id: "collection-async-chat-demo-0",
196
196
  values: [
197
197
  {
198
198
  asset: {
199
- id: "message-0-value",
199
+ id: "chat-demo-0-value",
200
200
  type: "text",
201
201
  value: "first resolve",
202
202
  },
@@ -230,11 +230,11 @@ describe("ReferenceAssetsPlugin", () => {
230
230
  {
231
231
  asset: {
232
232
  type: "collection",
233
- id: "collection-async-message-1",
233
+ id: "collection-async-chat-demo-1",
234
234
  values: [
235
235
  {
236
236
  asset: {
237
- id: "message-1-value",
237
+ id: "chat-demo-1-value",
238
238
  type: "text",
239
239
  value: "second resolve",
240
240
  },
@@ -245,18 +245,18 @@ describe("ReferenceAssetsPlugin", () => {
245
245
  {
246
246
  asset: {
247
247
  type: "collection",
248
- id: "collection-async-message-0",
248
+ id: "collection-async-chat-demo-0",
249
249
  values: [
250
250
  {
251
251
  asset: {
252
- id: "message-0-value",
252
+ id: "chat-demo-0-value",
253
253
  type: "text",
254
254
  value: "first resolve",
255
255
  },
256
256
  },
257
257
  {
258
258
  asset: {
259
- id: "message-2-value",
259
+ id: "chat-demo-2-value",
260
260
  type: "text",
261
261
  value: "second resolve",
262
262
  },
@@ -269,6 +269,21 @@ describe("ReferenceAssetsPlugin", () => {
269
269
  );
270
270
  });
271
271
  });
272
+
273
+ it("should not setup a deferred resolve when the parent id does not start with 'async-chat-demo'", async () => {
274
+ const asyncHookTap = vi.fn();
275
+ asyncPlugin.hooks.onAsyncNode.intercept({
276
+ context: false,
277
+ done: asyncHookTap,
278
+ });
279
+ // start player without the ids to match the chat ui demo case.
280
+ player.start(makeFlow(1, false));
281
+
282
+ // tap should complete immediately
283
+ await vi.waitFor(() => {
284
+ expect(asyncHookTap).toHaveBeenCalled();
285
+ });
286
+ });
272
287
  });
273
288
  });
274
289