@nyaruka/temba-components 0.138.6 → 0.140.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.
Files changed (196) hide show
  1. package/.github/workflows/cla.yml +1 -1
  2. package/.github/workflows/copilot-setup-steps.yml +6 -1
  3. package/CHANGELOG.md +26 -0
  4. package/demo/data/flows/sample-flow.json +24 -0
  5. package/dist/locales/es.js +5 -5
  6. package/dist/locales/es.js.map +1 -1
  7. package/dist/locales/fr.js +5 -5
  8. package/dist/locales/fr.js.map +1 -1
  9. package/dist/locales/locale-codes.js +2 -11
  10. package/dist/locales/locale-codes.js.map +1 -1
  11. package/dist/locales/pt.js +5 -5
  12. package/dist/locales/pt.js.map +1 -1
  13. package/dist/temba-components.js +1112 -882
  14. package/dist/temba-components.js.map +1 -1
  15. package/out-tsc/src/display/Chat.js +10 -7
  16. package/out-tsc/src/display/Chat.js.map +1 -1
  17. package/out-tsc/src/display/Dropdown.js +3 -1
  18. package/out-tsc/src/display/Dropdown.js.map +1 -1
  19. package/out-tsc/src/display/FloatingTab.js +25 -32
  20. package/out-tsc/src/display/FloatingTab.js.map +1 -1
  21. package/out-tsc/src/display/Thumbnail.js +163 -5
  22. package/out-tsc/src/display/Thumbnail.js.map +1 -1
  23. package/out-tsc/src/flow/CanvasMenu.js +5 -3
  24. package/out-tsc/src/flow/CanvasMenu.js.map +1 -1
  25. package/out-tsc/src/flow/CanvasNode.js +70 -29
  26. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  27. package/out-tsc/src/flow/Editor.js +290 -239
  28. package/out-tsc/src/flow/Editor.js.map +1 -1
  29. package/out-tsc/src/flow/NodeEditor.js +118 -10
  30. package/out-tsc/src/flow/NodeEditor.js.map +1 -1
  31. package/out-tsc/src/flow/Plumber.js +757 -403
  32. package/out-tsc/src/flow/Plumber.js.map +1 -1
  33. package/out-tsc/src/flow/StickyNote.js +13 -4
  34. package/out-tsc/src/flow/StickyNote.js.map +1 -1
  35. package/out-tsc/src/flow/actions/audio-player.js +112 -0
  36. package/out-tsc/src/flow/actions/audio-player.js.map +1 -0
  37. package/out-tsc/src/flow/actions/enter_flow.js +43 -0
  38. package/out-tsc/src/flow/actions/enter_flow.js.map +1 -0
  39. package/out-tsc/src/flow/actions/play_audio.js +57 -4
  40. package/out-tsc/src/flow/actions/play_audio.js.map +1 -1
  41. package/out-tsc/src/flow/actions/say_msg.js +86 -3
  42. package/out-tsc/src/flow/actions/say_msg.js.map +1 -1
  43. package/out-tsc/src/flow/config.js +11 -3
  44. package/out-tsc/src/flow/config.js.map +1 -1
  45. package/out-tsc/src/flow/nodes/shared-rules.js +1 -1
  46. package/out-tsc/src/flow/nodes/shared-rules.js.map +1 -1
  47. package/out-tsc/src/flow/nodes/terminal.js +7 -0
  48. package/out-tsc/src/flow/nodes/terminal.js.map +1 -0
  49. package/out-tsc/src/flow/nodes/wait_for_audio.js +77 -0
  50. package/out-tsc/src/flow/nodes/wait_for_audio.js.map +1 -0
  51. package/out-tsc/src/flow/nodes/wait_for_dial.js +151 -0
  52. package/out-tsc/src/flow/nodes/wait_for_dial.js.map +1 -0
  53. package/out-tsc/src/flow/nodes/wait_for_digits.js +61 -1
  54. package/out-tsc/src/flow/nodes/wait_for_digits.js.map +1 -1
  55. package/out-tsc/src/flow/nodes/wait_for_menu.js +173 -2
  56. package/out-tsc/src/flow/nodes/wait_for_menu.js.map +1 -1
  57. package/out-tsc/src/flow/operators.js +21 -5
  58. package/out-tsc/src/flow/operators.js.map +1 -1
  59. package/out-tsc/src/flow/types.js.map +1 -1
  60. package/out-tsc/src/flow/utils.js +213 -65
  61. package/out-tsc/src/flow/utils.js.map +1 -1
  62. package/out-tsc/src/form/ArrayEditor.js +4 -2
  63. package/out-tsc/src/form/ArrayEditor.js.map +1 -1
  64. package/out-tsc/src/form/FieldRenderer.js +49 -0
  65. package/out-tsc/src/form/FieldRenderer.js.map +1 -1
  66. package/out-tsc/src/interfaces.js +2 -0
  67. package/out-tsc/src/interfaces.js.map +1 -1
  68. package/out-tsc/src/layout/Dialog.js +52 -7
  69. package/out-tsc/src/layout/Dialog.js.map +1 -1
  70. package/out-tsc/src/list/TicketList.js +4 -1
  71. package/out-tsc/src/list/TicketList.js.map +1 -1
  72. package/out-tsc/src/live/TembaChart.js.map +1 -1
  73. package/out-tsc/src/locales/es.js +5 -5
  74. package/out-tsc/src/locales/es.js.map +1 -1
  75. package/out-tsc/src/locales/fr.js +5 -5
  76. package/out-tsc/src/locales/fr.js.map +1 -1
  77. package/out-tsc/src/locales/locale-codes.js +2 -11
  78. package/out-tsc/src/locales/locale-codes.js.map +1 -1
  79. package/out-tsc/src/locales/pt.js +5 -5
  80. package/out-tsc/src/locales/pt.js.map +1 -1
  81. package/out-tsc/src/simulator/Simulator.js +10 -3
  82. package/out-tsc/src/simulator/Simulator.js.map +1 -1
  83. package/out-tsc/src/store/AppState.js +89 -3
  84. package/out-tsc/src/store/AppState.js.map +1 -1
  85. package/out-tsc/test/actions/play_audio.test.js +118 -0
  86. package/out-tsc/test/actions/play_audio.test.js.map +1 -0
  87. package/out-tsc/test/actions/say_msg.test.js +158 -0
  88. package/out-tsc/test/actions/say_msg.test.js.map +1 -0
  89. package/out-tsc/test/nodes/wait_for_audio.test.js +156 -0
  90. package/out-tsc/test/nodes/wait_for_audio.test.js.map +1 -0
  91. package/out-tsc/test/nodes/wait_for_dial.test.js +336 -0
  92. package/out-tsc/test/nodes/wait_for_dial.test.js.map +1 -0
  93. package/out-tsc/test/nodes/wait_for_digits.test.js +198 -84
  94. package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -1
  95. package/out-tsc/test/nodes/wait_for_menu.test.js +340 -0
  96. package/out-tsc/test/nodes/wait_for_menu.test.js.map +1 -0
  97. package/out-tsc/test/temba-floating-tab.test.js +4 -6
  98. package/out-tsc/test/temba-floating-tab.test.js.map +1 -1
  99. package/out-tsc/test/temba-flow-collision.test.js +473 -220
  100. package/out-tsc/test/temba-flow-collision.test.js.map +1 -1
  101. package/out-tsc/test/temba-flow-editor.test.js +0 -2
  102. package/out-tsc/test/temba-flow-editor.test.js.map +1 -1
  103. package/out-tsc/test/temba-flow-plumber-connections.test.js +83 -84
  104. package/out-tsc/test/temba-flow-plumber-connections.test.js.map +1 -1
  105. package/out-tsc/test/temba-flow-plumber.test.js +102 -93
  106. package/out-tsc/test/temba-flow-plumber.test.js.map +1 -1
  107. package/out-tsc/test/temba-node-type-selector.test.js +6 -6
  108. package/out-tsc/test/temba-node-type-selector.test.js.map +1 -1
  109. package/package.json +1 -1
  110. package/screenshots/truth/actions/play_audio/editor/expression-url.png +0 -0
  111. package/screenshots/truth/actions/play_audio/editor/static-url.png +0 -0
  112. package/screenshots/truth/actions/play_audio/render/expression-url.png +0 -0
  113. package/screenshots/truth/actions/play_audio/render/static-url.png +0 -0
  114. package/screenshots/truth/actions/say_msg/editor/multiline-text.png +0 -0
  115. package/screenshots/truth/actions/say_msg/editor/simple-text.png +0 -0
  116. package/screenshots/truth/actions/say_msg/editor/text-with-audio-url.png +0 -0
  117. package/screenshots/truth/actions/say_msg/render/multiline-text.png +0 -0
  118. package/screenshots/truth/actions/say_msg/render/simple-text.png +0 -0
  119. package/screenshots/truth/actions/say_msg/render/text-with-audio-url.png +0 -0
  120. package/screenshots/truth/editor/router.png +0 -0
  121. package/screenshots/truth/editor/wait.png +0 -0
  122. package/screenshots/truth/nodes/wait_for_audio/editor/basic-audio-wait.png +0 -0
  123. package/screenshots/truth/nodes/wait_for_audio/render/basic-audio-wait.png +0 -0
  124. package/screenshots/truth/nodes/wait_for_dial/editor/basic-dial.png +0 -0
  125. package/screenshots/truth/nodes/wait_for_dial/editor/dial-with-limits.png +0 -0
  126. package/screenshots/truth/nodes/wait_for_dial/render/basic-dial.png +0 -0
  127. package/screenshots/truth/nodes/wait_for_dial/render/dial-with-limits.png +0 -0
  128. package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
  129. package/screenshots/truth/nodes/wait_for_digits/editor/digits-with-rules.png +0 -0
  130. package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
  131. package/screenshots/truth/nodes/wait_for_digits/render/digits-with-rules.png +0 -0
  132. package/screenshots/truth/nodes/wait_for_menu/editor/menu-with-digits.png +0 -0
  133. package/screenshots/truth/nodes/wait_for_menu/render/menu-with-digits.png +0 -0
  134. package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
  135. package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
  136. package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
  137. package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
  138. package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
  139. package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
  140. package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
  141. package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
  142. package/src/display/Chat.ts +13 -7
  143. package/src/display/Dropdown.ts +3 -1
  144. package/src/display/FloatingTab.ts +24 -33
  145. package/src/display/Thumbnail.ts +162 -2
  146. package/src/flow/CanvasMenu.ts +8 -3
  147. package/src/flow/CanvasNode.ts +75 -30
  148. package/src/flow/Editor.ts +336 -288
  149. package/src/flow/NodeEditor.ts +137 -9
  150. package/src/flow/Plumber.ts +1011 -457
  151. package/src/flow/StickyNote.ts +14 -4
  152. package/src/flow/actions/audio-player.ts +127 -0
  153. package/src/flow/actions/enter_flow.ts +44 -0
  154. package/src/flow/actions/play_audio.ts +64 -5
  155. package/src/flow/actions/say_msg.ts +94 -4
  156. package/src/flow/config.ts +11 -3
  157. package/src/flow/nodes/shared-rules.ts +1 -1
  158. package/src/flow/nodes/terminal.ts +9 -0
  159. package/src/flow/nodes/wait_for_audio.ts +88 -0
  160. package/src/flow/nodes/wait_for_dial.ts +176 -0
  161. package/src/flow/nodes/wait_for_digits.ts +86 -2
  162. package/src/flow/nodes/wait_for_menu.ts +209 -3
  163. package/src/flow/operators.ts +23 -5
  164. package/src/flow/types.ts +23 -1
  165. package/src/flow/utils.ts +238 -81
  166. package/src/form/ArrayEditor.ts +4 -2
  167. package/src/form/FieldRenderer.ts +64 -1
  168. package/src/interfaces.ts +3 -1
  169. package/src/layout/Dialog.ts +53 -7
  170. package/src/list/TicketList.ts +4 -1
  171. package/src/live/TembaChart.ts +1 -1
  172. package/src/locales/es.ts +13 -18
  173. package/src/locales/fr.ts +13 -18
  174. package/src/locales/locale-codes.ts +2 -11
  175. package/src/locales/pt.ts +13 -18
  176. package/src/simulator/Simulator.ts +13 -3
  177. package/src/store/AppState.ts +105 -1
  178. package/src/store/flow-definition.d.ts +2 -0
  179. package/test/actions/play_audio.test.ts +155 -0
  180. package/test/actions/say_msg.test.ts +196 -0
  181. package/test/nodes/wait_for_audio.test.ts +182 -0
  182. package/test/nodes/wait_for_dial.test.ts +382 -0
  183. package/test/nodes/wait_for_digits.test.ts +233 -109
  184. package/test/nodes/wait_for_menu.test.ts +383 -0
  185. package/test/temba-floating-tab.test.ts +4 -6
  186. package/test/temba-flow-collision.test.ts +495 -293
  187. package/test/temba-flow-editor.test.ts +0 -2
  188. package/test/temba-flow-plumber-connections.test.ts +97 -97
  189. package/test/temba-flow-plumber.test.ts +116 -103
  190. package/test/temba-node-type-selector.test.ts +6 -6
  191. package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
  192. package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
  193. package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
  194. package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
  195. package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
  196. package/screenshots/truth/nodes/wait_for_digits/render/verification-code.png +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"AppState.js","sourceRoot":"","sources":["../../../src/store/AppState.ts"],"names":[],"mappings":"A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,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YAExC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,GAAM,EAAE,EAAE;gBACpE,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;YACnB,CAAC,CAAC,CAAC;YAEH,IAAI,aAAa;gBAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC,CAAC;QAEF,KAAK,CAAC,eAAe,CAAC,GAAG;;YACvB,MAAA,MAAA,IAAI,CAAC,mBAAmB,0CAAG,IAAI,CAAC,kDAAI,CAAC;YACrC,IAAI,gBAAgB;gBAAE,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpD,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { createStore, StoreApi } from 'zustand/vanilla';\nimport { fetchResults, generateUUID } from '../utils';\nimport {\n Action,\n Exit,\n FlowDefinition,\n FlowPosition,\n Node,\n NodeUI,\n Router,\n StickyNote\n} from './flow-definition';\nimport { immer } from 'zustand/middleware/immer';\nimport { subscribeWithSelector } from 'zustand/middleware';\nimport { property } from 'lit/decorators.js';\nimport { produce } from 'immer';\n\nexport const FLOW_SPEC_VERSION = '14.3';\nconst CANVAS_PADDING = 800;\n\n/**\n * Sorts nodes by their position - first by y (top), then by x (left)\n */\nfunction sortNodesByPosition(\n nodes: Node[],\n nodePositions: Record<string, NodeUI>\n): void {\n nodes.sort((a, b) => {\n const posA = nodePositions[a.uuid]?.position;\n const posB = nodePositions[b.uuid]?.position;\n\n // if either position is missing, maintain current order\n if (!posA || !posB) {\n return 0;\n }\n\n // sort by y (top) first\n if (posA.top !== posB.top) {\n return posA.top - posB.top;\n }\n\n // if y is same, sort by x (left)\n return posA.left - posB.left;\n });\n}\n\nexport interface InfoResult {\n key: string;\n name: string;\n categories: string[];\n node_uuids: string[];\n}\n\nexport interface ObjectRef {\n uuid: string;\n name: string;\n}\n\nexport interface TypedObjectRef extends ObjectRef {\n type: string;\n}\n\nexport interface Language {\n code: string;\n name: string;\n}\n\nexport interface FlowInfo {\n results: InfoResult[];\n dependencies: TypedObjectRef[];\n counts: { nodes: number; languages: number };\n locals: string[];\n}\n\nexport interface FlowContents {\n definition: FlowDefinition;\n info: FlowInfo;\n}\n\nexport interface Workspace {\n anon: boolean;\n country: string;\n date_style: string;\n languages: string[];\n name: string;\n primary_language: string;\n timezone: string;\n uuid: string;\n}\n\nexport interface CanvasPositions {\n [uuid: string]: FlowPosition;\n}\n\nexport interface Activity {\n segments: { [exitToDestinationKey: string]: number };\n nodes: { [nodeUuid: string]: number };\n}\n\nexport interface AppState {\n flowDefinition: FlowDefinition;\n flowInfo: FlowInfo;\n\n languageCode: string;\n languageNames: { [code: string]: Language };\n workspace: Workspace;\n isTranslating: boolean;\n viewingRevision: boolean;\n\n dirtyDate: Date | null;\n\n canvasSize: { width: number; height: number };\n activity: Activity | null;\n simulatorActivity: Activity | null;\n activityEndpoint: string | null;\n simulatorActive: boolean;\n\n getCurrentActivity: () => Activity | null;\n fetchRevision: (endpoint: string, id?: string) => void;\n fetchWorkspace: (endpoint: string) => Promise<void>;\n fetchAllLanguages: (endpoint: string) => Promise<void>;\n fetchActivity: (endpoint: string) => Promise<void>;\n setActivityEndpoint: (endpoint: string) => void;\n updateActivity: (activity: Activity) => void;\n updateSimulatorActivity: (activity: Activity) => void;\n setSimulatorActive: (active: boolean) => void;\n\n getFlowResults: () => InfoResult[];\n getResultByKey(id: any): InfoResult;\n\n setFlowContents: (flow: FlowContents) => void;\n setFlowInfo: (info: FlowInfo) => void;\n setRevision: (revision: number) => void;\n setLanguageCode: (languageCode: string) => void;\n setDirtyDate: (date: Date) => void;\n expandCanvas: (width: number, height: number) => void;\n\n updateNode(\n uuid: string,\n node: { actions: Action[]; uuid: string; exits: Exit[]; router?: Router }\n ): unknown;\n updateNodeUIConfig(uuid: string, config: Record<string, any>): unknown;\n updateConnection(\n nodeUuid: string,\n exitUuid: string,\n destinationNodeUuid: string\n ): unknown;\n updateCanvasPositions: (positions: CanvasPositions) => void;\n removeNodes: (uuids: string[]) => void;\n removeStickyNotes: (uuids: string[]) => void;\n updateStickyNote(uuid: string, sticky: StickyNote): void;\n createStickyNote(position: FlowPosition): string;\n createNode(nodeType: string, position: FlowPosition): string;\n addNode(node: Node, nodeUI: NodeUI): void;\n updateLocalization(\n languageCode: string,\n actionUuid: string,\n localizationData: Record<string, any>\n ): void;\n setTranslationFilters: (filters: { categories: boolean }) => void;\n markAutoTranslated: (\n languageCode: string,\n uuid: string,\n attributes: string[]\n ) => void;\n}\n\nexport const zustand = createStore<AppState>()(\n subscribeWithSelector(\n immer((set, get) => ({\n languageNames: {},\n canvasSize: { width: 0, height: 0 },\n languageCode: '',\n workspace: null,\n flowDefinition: null,\n flowInfo: null,\n isTranslating: false,\n viewingRevision: false,\n dirtyDate: null,\n activity: null,\n simulatorActivity: null,\n activityEndpoint: null,\n simulatorActive: false,\n\n setDirtyDate: (date: Date) => {\n set((state: AppState) => {\n state.dirtyDate = date;\n });\n },\n\n fetchRevision: async (endpoint: string, id: string = null) => {\n const viewingRevision = !!id && id !== 'latest';\n if (!id) {\n id = 'latest';\n }\n const response = await fetch(\n `${endpoint}/${id}/?version=${FLOW_SPEC_VERSION}`\n );\n\n if (!response.ok) {\n throw new Error('Network response was not ok');\n }\n const data = (await response.json()) as FlowContents;\n set({\n flowInfo: data.info,\n flowDefinition: data.definition,\n viewingRevision\n });\n },\n\n fetchWorkspace: async (endpoint) => {\n const response = await fetch(endpoint);\n if (!response.ok) {\n throw new Error('Network response was not ok');\n }\n const data = await response.json();\n set({ workspace: data });\n },\n\n fetchAllLanguages: async (endpoint) => {\n const results = await fetchResults(endpoint);\n\n // convert array to map for easier lookup\n const allLanguages = results.reduce(function (\n languages: any,\n result: any\n ) {\n languages[result.value] = result.name;\n return languages;\n },\n {});\n\n set({ languageNames: allLanguages });\n },\n\n setActivityEndpoint: (endpoint: string) => {\n set({ activityEndpoint: endpoint });\n },\n\n fetchActivity: async (endpoint: string) => {\n try {\n const response = await fetch(endpoint);\n if (!response.ok) {\n return;\n }\n const data = await response.json();\n set({ activity: data });\n } catch (error) {\n console.error('Failed to fetch activity:', error);\n }\n },\n\n updateActivity: (activity: Activity) => {\n set({ activity });\n },\n\n updateSimulatorActivity: (activity: Activity) => {\n set({ simulatorActivity: activity });\n },\n\n setSimulatorActive: (active: boolean) => {\n set({ simulatorActive: active });\n },\n\n getCurrentActivity: () => {\n const state = get();\n return state.simulatorActive ? state.simulatorActivity : state.activity;\n },\n\n getFlowResults: () => {\n const state = get();\n return state.flowInfo.results;\n },\n\n getResultByKey: (id: any) => {\n const state = get();\n const results = state.flowInfo.results;\n return results.find((result) => result.key === id);\n },\n\n getLanguage: () => {\n const state = get();\n const languageCode = state.languageCode;\n const languageNames = state.languageNames;\n return { name: languageNames[languageCode], code: languageCode };\n },\n\n // todo: eventually we should be doing the fetching\n setFlowContents: (flow: FlowContents) => {\n set((state: AppState) => {\n const flowLang = flow.definition.language;\n // Clone to ensure mutable for sorting\n state.flowDefinition = {\n ...flow.definition,\n nodes: [...(flow.definition.nodes || [])]\n };\n state.flowInfo = flow.info;\n // Reset to the flow's default language when loading a new flow\n state.languageCode = flowLang;\n state.isTranslating = false;\n\n // Sort nodes by position when loading flow\n if (state.flowDefinition?.nodes && state.flowDefinition?._ui?.nodes) {\n sortNodesByPosition(\n state.flowDefinition.nodes,\n state.flowDefinition._ui.nodes\n );\n }\n });\n },\n\n setFlowInfo: (info: FlowInfo) => {\n set((state: AppState) => {\n state.flowInfo = info;\n });\n },\n\n setRevision: (revision: number) => {\n set((state: AppState) => {\n state.flowDefinition.revision = revision;\n });\n },\n\n setLanguageCode: (languageCode: string) => {\n set((state: AppState) => {\n state.languageCode = languageCode;\n state.isTranslating = state.flowDefinition.language !== languageCode;\n });\n },\n\n expandCanvas: (width: number, height: number) => {\n set((state: AppState) => {\n const minWidth = Math.max(\n state.canvasSize.width,\n width + CANVAS_PADDING\n );\n const minHeight = Math.max(\n state.canvasSize.height,\n height + CANVAS_PADDING\n );\n\n state.canvasSize.width = minWidth;\n state.canvasSize.height = minHeight;\n });\n },\n\n updateCanvasPositions: (positions: CanvasPositions) => {\n set((state: AppState) => {\n for (const uuid in positions) {\n // todo: add nodes that are created and then moved, for now ignore\n if (state.flowDefinition._ui.nodes[uuid]) {\n state.flowDefinition._ui.nodes[uuid].position = positions[uuid];\n }\n\n // otherwise, it might be a sticky\n else if (state.flowDefinition._ui.stickies[uuid]) {\n state.flowDefinition._ui.stickies[uuid].position =\n positions[uuid];\n }\n }\n\n // Sort nodes by position since positions may have changed\n sortNodesByPosition(\n state.flowDefinition.nodes,\n state.flowDefinition._ui.nodes\n );\n\n state.dirtyDate = new Date();\n });\n },\n\n removeNodes: (uuids: string[]) => {\n set((state: AppState) => {\n for (const uuid of uuids) {\n delete state.flowDefinition._ui.nodes[uuid];\n }\n\n state.flowDefinition = produce(state.flowDefinition, (draft) => {\n // For each node being removed, check if we should reroute connections\n uuids.forEach((removedUuid) => {\n const removedNode = draft.nodes.find(\n (n) => n.uuid === removedUuid\n );\n\n if (!removedNode || !removedNode.exits.length) return;\n\n // Get all destinations (filter out null/undefined)\n const destinations = removedNode.exits\n .map((exit) => exit.destination_uuid)\n .filter((dest) => dest);\n\n // Only proceed if all exits have destinations and they all point to the same place\n if (\n destinations.length === removedNode.exits.length &&\n destinations.every((dest) => dest === destinations[0])\n ) {\n const targetDestination = destinations[0];\n // Don't reroute if the target is also being removed\n if (uuids.includes(targetDestination)) return;\n\n // Find all nodes with exits pointing to the node being removed\n draft.nodes.forEach((node) => {\n node.exits.forEach((exit) => {\n if (exit.destination_uuid === removedUuid) {\n // Reroute to the same destination the removed node was going to\n exit.destination_uuid = targetDestination;\n }\n });\n });\n }\n });\n\n // Remove the nodes\n draft.nodes = draft.nodes.filter(\n (node) => !uuids.includes(node.uuid)\n );\n\n // Clear any remaining connections to removed nodes that weren't rerouted\n draft.nodes.forEach((node) => {\n node.exits.forEach((exit) => {\n if (uuids.includes(exit.destination_uuid)) {\n exit.destination_uuid = null;\n }\n });\n });\n\n // Sort nodes by position\n sortNodesByPosition(draft.nodes, draft._ui.nodes);\n });\n\n state.dirtyDate = new Date();\n });\n },\n\n removeStickyNotes: (uuids: string[]) => {\n set((state: AppState) => {\n if (state.flowDefinition._ui?.stickies) {\n for (const uuid of uuids) {\n delete state.flowDefinition._ui.stickies[uuid];\n }\n }\n state.dirtyDate = new Date();\n });\n },\n\n updateNode: (uuid: string, newNode: Node) => {\n set((state: AppState) => {\n const node = state.flowDefinition?.nodes.find((n) => n.uuid === uuid);\n if (node) {\n node.actions = newNode.actions;\n node.uuid = newNode.uuid;\n node.exits = newNode.exits;\n node.router = newNode.router;\n }\n state.dirtyDate = new Date();\n });\n },\n\n updateNodeUIConfig: (uuid: string, config: Record<string, any>) => {\n set((state: AppState) => {\n if (state.flowDefinition._ui.nodes[uuid]) {\n // Handle type separately if provided\n if (config.type !== undefined) {\n state.flowDefinition._ui.nodes[uuid].type = config.type;\n }\n\n // Update config (excluding type)\n if (!state.flowDefinition._ui.nodes[uuid].config) {\n state.flowDefinition._ui.nodes[uuid].config = {};\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { type, ...configWithoutType } = config;\n Object.assign(\n state.flowDefinition._ui.nodes[uuid].config,\n configWithoutType\n );\n }\n state.dirtyDate = new Date();\n });\n },\n\n updateConnection: (\n nodeUuid: string,\n exitUuid: string,\n destinationNodeUuid: string\n ) => {\n /* console.log('Upating connection:', {\n nodeUuid,\n exitUuid,\n destinationNodeUuid\n });*/\n set((state: AppState) => {\n // Find the exit with this UUID\n const node = state.flowDefinition.nodes.find(\n (node) => node.uuid === nodeUuid\n );\n\n const exit = node?.exits.find((e) => e.uuid === exitUuid);\n if (exit) {\n // Update the destination\n exit.destination_uuid = destinationNodeUuid;\n state.dirtyDate = new Date();\n }\n });\n },\n\n updateStickyNote: (uuid: string, sticky: StickyNote) => {\n set((state: AppState) => {\n if (!state.flowDefinition._ui.stickies) {\n state.flowDefinition._ui.stickies = {};\n }\n state.flowDefinition._ui.stickies[uuid] = sticky;\n state.dirtyDate = new Date();\n });\n },\n\n createStickyNote: (position: FlowPosition): string => {\n const uuid = generateUUID();\n set((state: AppState) => {\n if (!state.flowDefinition._ui.stickies) {\n state.flowDefinition._ui.stickies = {};\n }\n\n const newSticky: StickyNote = {\n position,\n title: '',\n body: '',\n color: 'yellow'\n };\n\n state.flowDefinition._ui.stickies[uuid] = newSticky;\n state.dirtyDate = new Date();\n });\n return uuid;\n },\n\n createNode: (nodeType: string, position: FlowPosition): string => {\n const uuid = generateUUID();\n const exitUuid = generateUUID();\n\n set((state: AppState) => {\n // Create a basic node with a single exit\n const newNode: Node = {\n uuid,\n actions: [],\n exits: [\n {\n uuid: exitUuid,\n destination_uuid: null\n }\n ]\n };\n\n // Add the node to the flow definition\n state.flowDefinition.nodes.push(newNode);\n\n // Set up UI for the node\n if (!state.flowDefinition._ui.nodes) {\n state.flowDefinition._ui.nodes = {};\n }\n\n state.flowDefinition._ui.nodes[uuid] = {\n position,\n type: nodeType as any,\n config: {}\n };\n\n // Sort nodes by position\n sortNodesByPosition(\n state.flowDefinition.nodes,\n state.flowDefinition._ui.nodes\n );\n\n state.dirtyDate = new Date();\n });\n\n return uuid;\n },\n\n addNode: (node: Node, nodeUI: NodeUI) => {\n set((state: AppState) => {\n // Add the node to the flow definition\n state.flowDefinition.nodes.push(node);\n\n // Set up UI for the node\n if (!state.flowDefinition._ui.nodes) {\n state.flowDefinition._ui.nodes = {};\n }\n\n state.flowDefinition._ui.nodes[node.uuid] = nodeUI;\n\n // Sort nodes by position\n sortNodesByPosition(\n state.flowDefinition.nodes,\n state.flowDefinition._ui.nodes\n );\n\n state.dirtyDate = new Date();\n });\n },\n\n updateLocalization: (\n languageCode: string,\n actionUuid: string,\n localizationData: Record<string, any>\n ) => {\n set((state: AppState) => {\n // Initialize localization structure if it doesn't exist\n if (!state.flowDefinition.localization) {\n state.flowDefinition.localization = {};\n }\n\n if (!state.flowDefinition.localization[languageCode]) {\n state.flowDefinition.localization[languageCode] = {};\n }\n\n // Update or remove the localization for this action\n if (Object.keys(localizationData).length > 0) {\n state.flowDefinition.localization[languageCode][actionUuid] =\n localizationData;\n } else {\n // If no localized values, remove the entry\n delete state.flowDefinition.localization[languageCode][actionUuid];\n }\n\n // Clean up empty language sections\n if (\n Object.keys(state.flowDefinition.localization[languageCode])\n .length === 0\n ) {\n delete state.flowDefinition.localization[languageCode];\n }\n\n // Clean up empty localization object\n if (Object.keys(state.flowDefinition.localization).length === 0) {\n delete state.flowDefinition.localization;\n }\n\n state.dirtyDate = new Date();\n });\n },\n\n setTranslationFilters: (filters: { categories: boolean }) => {\n set((state: AppState) => {\n if (!state.flowDefinition?._ui) {\n return;\n }\n\n const currentFilters = state.flowDefinition._ui\n .translation_filters || {\n categories: false\n };\n\n state.flowDefinition._ui.translation_filters = {\n ...currentFilters,\n categories: !!filters.categories\n };\n\n state.dirtyDate = new Date();\n });\n },\n\n markAutoTranslated: (\n languageCode: string,\n uuid: string,\n attributes: string[]\n ) => {\n set((state: AppState) => {\n if (!state.flowDefinition?._ui) {\n return;\n }\n\n if (!state.flowDefinition._ui.auto_translations) {\n state.flowDefinition._ui.auto_translations = {};\n }\n\n if (!state.flowDefinition._ui.auto_translations[languageCode]) {\n state.flowDefinition._ui.auto_translations[languageCode] = {};\n }\n\n const existing =\n state.flowDefinition._ui.auto_translations[languageCode][uuid] ||\n [];\n\n const merged = Array.from(\n new Set([...existing, ...(attributes || [])])\n );\n\n state.flowDefinition._ui.auto_translations[languageCode][uuid] =\n merged;\n state.dirtyDate = new Date();\n });\n }\n }))\n )\n);\n\ntype SelectorAwareStoreApi<S extends object> = StoreApi<S> & {\n subscribe: <U>(\n selector: (state: S) => U,\n listener: (value: U, previous: U) => void\n ) => () => void;\n};\n\n/**\n * Custom Lit property decorator that binds a property to a Zustand store subscription.\n *\n * @param store - The Zustand store to subscribe to.\n * @param selector - A function selecting the slice of state to bind to the property.\n */\nexport function fromStore<S extends object, V = unknown>(\n store: SelectorAwareStoreApi<S>,\n selector: (state: S) => V\n): PropertyDecorator {\n return (proto: any, name: string | symbol) => {\n property()(proto, name as string);\n\n const connectedKey = 'connectedCallback';\n const disconnectedKey = 'disconnectedCallback';\n\n const userConnected = proto[connectedKey];\n const userDisconnected = proto[disconnectedKey];\n\n proto[connectedKey] = function () {\n this._zustandUnsubscribe ??= {};\n this[name] = selector(store.getState());\n\n this._zustandUnsubscribe[name] = store.subscribe(selector, (val: V) => {\n this[name] = val;\n });\n\n if (userConnected) userConnected.call(this);\n };\n\n proto[disconnectedKey] = function () {\n this._zustandUnsubscribe?.[name]?.();\n if (userDisconnected) userDisconnected.call(this);\n };\n };\n}\n"]}
1
+ {"version":3,"file":"AppState.js","sourceRoot":"","sources":["../../../src/store/AppState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAY,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAWtD,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACxC,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B;;;;;GAKG;AACH,SAAS,uBAAuB,CAAC,UAA0B;;IACzD,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAA,IAAI,CAAC,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CA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C,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAc,CAAC,CAAC;QAElC,MAAM,YAAY,GAAG,mBAAmB,CAAC;QACzC,MAAM,eAAe,GAAG,sBAAsB,CAAC;QAE/C,MAAM,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;QAC1C,MAAM,gBAAgB,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;QAEhD,KAAK,CAAC,YAAY,CAAC,GAAG;;YACpB,MAAA,IAAI,CAAC,mBAAmB,oCAAxB,IAAI,CAAC,mBAAmB,GAAK,EAAE,EAAC;YAChC,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YAExC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,GAAM,EAAE,EAAE;gBACpE,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;YACnB,CAAC,CAAC,CAAC;YAEH,IAAI,aAAa;gBAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC,CAAC;QAEF,KAAK,CAAC,eAAe,CAAC,GAAG;;YACvB,MAAA,MAAA,IAAI,CAAC,mBAAmB,0CAAG,IAAI,CAAC,kDAAI,CAAC;YACrC,IAAI,gBAAgB;gBAAE,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpD,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { createStore, StoreApi } from 'zustand/vanilla';\nimport { fetchResults, generateUUID } from '../utils';\nimport {\n Action,\n Exit,\n FlowDefinition,\n FlowPosition,\n Node,\n NodeUI,\n Router,\n StickyNote\n} from './flow-definition';\nimport { immer } from 'zustand/middleware/immer';\nimport { subscribeWithSelector } from 'zustand/middleware';\nimport { property } from 'lit/decorators.js';\nimport { produce } from 'immer';\n\nexport const FLOW_SPEC_VERSION = '14.3';\nconst CANVAS_PADDING = 800;\n\n/**\n * Temporary: Reclassify nodes based on whether they contain terminal actions.\n * - execute_actions nodes with a terminal action become \"terminal\"\n * - terminal nodes that no longer have a terminal action become \"execute_actions\"\n * This can be removed once we stop supporting terminal nodes.\n */\nfunction reclassifyTerminalNodes(definition: FlowDefinition): void {\n if (!definition?.nodes || !definition?._ui?.nodes) return;\n\n for (const node of definition.nodes) {\n const nodeUI = definition._ui.nodes[node.uuid];\n if (!nodeUI) continue;\n\n const hasTerminalAction = node.actions?.some(\n (action) => (action as any).terminal === true\n );\n\n if (nodeUI.type === 'execute_actions' && hasTerminalAction) {\n nodeUI.type = 'terminal' as any;\n } else if (nodeUI.type === ('terminal' as any) && !hasTerminalAction) {\n nodeUI.type = 'execute_actions';\n }\n }\n}\n\n/**\n * Reclassify wait_for_response nodes that are actually voice-specific wait types.\n * The server stores all voice waits as wait_for_response, but we detect the specific\n * type from the router's wait hint:\n * - hint.type === 'digits' && hint.count === 1 → wait_for_menu\n * - hint.type === 'digits' (no count) → wait_for_digits\n * - hint.type === 'audio' → wait_for_audio\n */\nfunction reclassifyVoiceWaitNodes(definition: FlowDefinition): void {\n if (!definition?.nodes || !definition?._ui?.nodes) return;\n\n for (const node of definition.nodes) {\n const nodeUI = definition._ui.nodes[node.uuid];\n if (!nodeUI || nodeUI.type !== 'wait_for_response') continue;\n\n const hint = node.router?.wait?.hint;\n if (!hint) continue;\n\n if (hint.type === 'digits' && hint.count === 1) {\n nodeUI.type = 'wait_for_menu' as any;\n } else if (hint.type === 'digits') {\n nodeUI.type = 'wait_for_digits' as any;\n } else if (hint.type === 'audio') {\n nodeUI.type = 'wait_for_audio' as any;\n }\n }\n}\n\n/**\n * Sorts nodes by their position - first by y (top), then by x (left)\n */\nfunction sortNodesByPosition(\n nodes: Node[],\n nodePositions: Record<string, NodeUI>\n): void {\n nodes.sort((a, b) => {\n const posA = nodePositions[a.uuid]?.position;\n const posB = nodePositions[b.uuid]?.position;\n\n // if either position is missing, maintain current order\n if (!posA || !posB) {\n return 0;\n }\n\n // sort by y (top) first\n if (posA.top !== posB.top) {\n return posA.top - posB.top;\n }\n\n // if y is same, sort by x (left)\n return posA.left - posB.left;\n });\n}\n\nexport interface InfoResult {\n key: string;\n name: string;\n categories: string[];\n node_uuids: string[];\n}\n\nexport interface ObjectRef {\n uuid: string;\n name: string;\n}\n\nexport interface TypedObjectRef extends ObjectRef {\n type: string;\n}\n\nexport interface Language {\n code: string;\n name: string;\n}\n\nexport interface FlowIssue {\n type: string;\n node_uuid: string;\n action_uuid?: string;\n description: string;\n dependency?: {\n key: string;\n name: string;\n type: string;\n };\n}\n\nexport interface FlowInfo {\n results: InfoResult[];\n dependencies: TypedObjectRef[];\n counts: { nodes: number; languages: number };\n locals: string[];\n issues?: FlowIssue[];\n}\n\nfunction buildIssueMaps(issues: FlowIssue[] = []): {\n byNode: Map<string, FlowIssue[]>;\n byAction: Map<string, FlowIssue[]>;\n} {\n const byNode = new Map<string, FlowIssue[]>();\n const byAction = new Map<string, FlowIssue[]>();\n for (const issue of issues) {\n if (issue.action_uuid) {\n const actionList = byAction.get(issue.action_uuid) || [];\n actionList.push(issue);\n byAction.set(issue.action_uuid, actionList);\n } else {\n const nodeList = byNode.get(issue.node_uuid) || [];\n nodeList.push(issue);\n byNode.set(issue.node_uuid, nodeList);\n }\n }\n return { byNode, byAction };\n}\n\nexport interface FlowContents {\n definition: FlowDefinition;\n info: FlowInfo;\n}\n\nexport interface Workspace {\n anon: boolean;\n country: string;\n date_style: string;\n languages: string[];\n name: string;\n primary_language: string;\n timezone: string;\n uuid: string;\n}\n\nexport interface CanvasPositions {\n [uuid: string]: FlowPosition;\n}\n\nexport interface Activity {\n segments: { [exitToDestinationKey: string]: number };\n nodes: { [nodeUuid: string]: number };\n}\n\nexport interface AppState {\n flowDefinition: FlowDefinition;\n flowInfo: FlowInfo;\n issuesByNode: Map<string, FlowIssue[]>;\n issuesByAction: Map<string, FlowIssue[]>;\n\n languageCode: string;\n languageNames: { [code: string]: Language };\n workspace: Workspace;\n isTranslating: boolean;\n viewingRevision: boolean;\n\n dirtyDate: Date | null;\n\n canvasSize: { width: number; height: number };\n activity: Activity | null;\n simulatorActivity: Activity | null;\n activityEndpoint: string | null;\n simulatorActive: boolean;\n\n getCurrentActivity: () => Activity | null;\n fetchRevision: (endpoint: string, id?: string) => void;\n fetchWorkspace: (endpoint: string) => Promise<void>;\n fetchAllLanguages: (endpoint: string) => Promise<void>;\n fetchActivity: (endpoint: string) => Promise<void>;\n setActivityEndpoint: (endpoint: string) => void;\n updateActivity: (activity: Activity) => void;\n updateSimulatorActivity: (activity: Activity) => void;\n setSimulatorActive: (active: boolean) => void;\n\n getFlowResults: () => InfoResult[];\n getResultByKey(id: any): InfoResult;\n\n setFlowContents: (flow: FlowContents) => void;\n setFlowInfo: (info: FlowInfo) => void;\n setRevision: (revision: number) => void;\n setLanguageCode: (languageCode: string) => void;\n setDirtyDate: (date: Date) => void;\n expandCanvas: (width: number, height: number) => void;\n\n updateNode(\n uuid: string,\n node: { actions: Action[]; uuid: string; exits: Exit[]; router?: Router }\n ): unknown;\n updateNodeUIConfig(uuid: string, config: Record<string, any>): unknown;\n updateConnection(\n nodeUuid: string,\n exitUuid: string,\n destinationNodeUuid: string\n ): unknown;\n updateCanvasPositions: (positions: CanvasPositions) => void;\n removeNodes: (uuids: string[]) => void;\n removeStickyNotes: (uuids: string[]) => void;\n updateStickyNote(uuid: string, sticky: StickyNote): void;\n createStickyNote(position: FlowPosition): string;\n createNode(nodeType: string, position: FlowPosition): string;\n addNode(node: Node, nodeUI: NodeUI): void;\n updateLocalization(\n languageCode: string,\n actionUuid: string,\n localizationData: Record<string, any>\n ): void;\n setTranslationFilters: (filters: { categories: boolean }) => void;\n markAutoTranslated: (\n languageCode: string,\n uuid: string,\n attributes: string[]\n ) => void;\n}\n\nexport const zustand = createStore<AppState>()(\n subscribeWithSelector(\n immer((set, get) => ({\n languageNames: {},\n canvasSize: { width: 0, height: 0 },\n languageCode: '',\n workspace: null,\n flowDefinition: null,\n flowInfo: null,\n issuesByNode: new Map(),\n issuesByAction: new Map(),\n isTranslating: false,\n viewingRevision: false,\n dirtyDate: null,\n activity: null,\n simulatorActivity: null,\n activityEndpoint: null,\n simulatorActive: false,\n\n setDirtyDate: (date: Date) => {\n set((state: AppState) => {\n state.dirtyDate = date;\n });\n },\n\n fetchRevision: async (endpoint: string, id: string = null) => {\n const viewingRevision = !!id && id !== 'latest';\n if (!id) {\n id = 'latest';\n }\n const response = await fetch(\n `${endpoint}/${id}/?version=${FLOW_SPEC_VERSION}`\n );\n\n if (!response.ok) {\n throw new Error('Network response was not ok');\n }\n const data = (await response.json()) as FlowContents;\n reclassifyTerminalNodes(data.definition);\n reclassifyVoiceWaitNodes(data.definition);\n const issueMaps = buildIssueMaps(data.info?.issues);\n set({\n flowInfo: data.info,\n flowDefinition: data.definition,\n viewingRevision,\n issuesByNode: issueMaps.byNode,\n issuesByAction: issueMaps.byAction\n });\n },\n\n fetchWorkspace: async (endpoint) => {\n const response = await fetch(endpoint);\n if (!response.ok) {\n throw new Error('Network response was not ok');\n }\n const data = await response.json();\n set({ workspace: data });\n },\n\n fetchAllLanguages: async (endpoint) => {\n const results = await fetchResults(endpoint);\n\n // convert array to map for easier lookup\n const allLanguages = results.reduce(function (\n languages: any,\n result: any\n ) {\n languages[result.value] = result.name;\n return languages;\n },\n {});\n\n set({ languageNames: allLanguages });\n },\n\n setActivityEndpoint: (endpoint: string) => {\n set({ activityEndpoint: endpoint });\n },\n\n fetchActivity: async (endpoint: string) => {\n try {\n const response = await fetch(endpoint);\n if (!response.ok) {\n return;\n }\n const data = await response.json();\n set({ activity: data });\n } catch (error) {\n console.error('Failed to fetch activity:', error);\n }\n },\n\n updateActivity: (activity: Activity) => {\n set({ activity });\n },\n\n updateSimulatorActivity: (activity: Activity) => {\n set({ simulatorActivity: activity });\n },\n\n setSimulatorActive: (active: boolean) => {\n set({ simulatorActive: active });\n },\n\n getCurrentActivity: () => {\n const state = get();\n return state.simulatorActive ? state.simulatorActivity : state.activity;\n },\n\n getFlowResults: () => {\n const state = get();\n return state.flowInfo.results;\n },\n\n getResultByKey: (id: any) => {\n const state = get();\n const results = state.flowInfo.results;\n return results.find((result) => result.key === id);\n },\n\n getLanguage: () => {\n const state = get();\n const languageCode = state.languageCode;\n const languageNames = state.languageNames;\n return { name: languageNames[languageCode], code: languageCode };\n },\n\n // todo: eventually we should be doing the fetching\n setFlowContents: (flow: FlowContents) => {\n set((state: AppState) => {\n const flowLang = flow.definition.language;\n // Clone to ensure mutable for sorting\n state.flowDefinition = {\n ...flow.definition,\n nodes: [...(flow.definition.nodes || [])]\n };\n state.flowInfo = flow.info;\n const issueMaps = buildIssueMaps(flow.info?.issues);\n state.issuesByNode = issueMaps.byNode;\n state.issuesByAction = issueMaps.byAction;\n // Reset to the flow's default language when loading a new flow\n state.languageCode = flowLang;\n state.isTranslating = false;\n\n reclassifyTerminalNodes(state.flowDefinition);\n reclassifyVoiceWaitNodes(state.flowDefinition);\n\n // Sort nodes by position when loading flow\n if (state.flowDefinition?.nodes && state.flowDefinition?._ui?.nodes) {\n sortNodesByPosition(\n state.flowDefinition.nodes,\n state.flowDefinition._ui.nodes\n );\n }\n });\n },\n\n setFlowInfo: (info: FlowInfo) => {\n set((state: AppState) => {\n state.flowInfo = info;\n const issueMaps = buildIssueMaps(info?.issues);\n state.issuesByNode = issueMaps.byNode;\n state.issuesByAction = issueMaps.byAction;\n });\n },\n\n setRevision: (revision: number) => {\n set((state: AppState) => {\n state.flowDefinition.revision = revision;\n });\n },\n\n setLanguageCode: (languageCode: string) => {\n set((state: AppState) => {\n state.languageCode = languageCode;\n state.isTranslating = state.flowDefinition.language !== languageCode;\n });\n },\n\n expandCanvas: (width: number, height: number) => {\n set((state: AppState) => {\n const minWidth = Math.max(\n state.canvasSize.width,\n width + CANVAS_PADDING\n );\n const minHeight = Math.max(\n state.canvasSize.height,\n height + CANVAS_PADDING\n );\n\n state.canvasSize.width = minWidth;\n state.canvasSize.height = minHeight;\n });\n },\n\n updateCanvasPositions: (positions: CanvasPositions) => {\n set((state: AppState) => {\n for (const uuid in positions) {\n // todo: add nodes that are created and then moved, for now ignore\n if (state.flowDefinition._ui.nodes[uuid]) {\n state.flowDefinition._ui.nodes[uuid].position = positions[uuid];\n }\n\n // otherwise, it might be a sticky\n else if (state.flowDefinition._ui.stickies[uuid]) {\n state.flowDefinition._ui.stickies[uuid].position =\n positions[uuid];\n }\n }\n\n // Sort nodes by position since positions may have changed\n sortNodesByPosition(\n state.flowDefinition.nodes,\n state.flowDefinition._ui.nodes\n );\n\n state.dirtyDate = new Date();\n });\n },\n\n removeNodes: (uuids: string[]) => {\n set((state: AppState) => {\n for (const uuid of uuids) {\n delete state.flowDefinition._ui.nodes[uuid];\n }\n\n state.flowDefinition = produce(state.flowDefinition, (draft) => {\n // For each node being removed, check if we should reroute connections\n uuids.forEach((removedUuid) => {\n const removedNode = draft.nodes.find(\n (n) => n.uuid === removedUuid\n );\n\n if (!removedNode || !removedNode.exits.length) return;\n\n // Get all destinations (filter out null/undefined)\n const destinations = removedNode.exits\n .map((exit) => exit.destination_uuid)\n .filter((dest) => dest);\n\n // Only proceed if all exits have destinations and they all point to the same place\n if (\n destinations.length === removedNode.exits.length &&\n destinations.every((dest) => dest === destinations[0])\n ) {\n const targetDestination = destinations[0];\n // Don't reroute if the target is also being removed\n if (uuids.includes(targetDestination)) return;\n\n // Find all nodes with exits pointing to the node being removed\n draft.nodes.forEach((node) => {\n node.exits.forEach((exit) => {\n if (exit.destination_uuid === removedUuid) {\n // Reroute to the same destination the removed node was going to\n exit.destination_uuid = targetDestination;\n }\n });\n });\n }\n });\n\n // Remove the nodes\n draft.nodes = draft.nodes.filter(\n (node) => !uuids.includes(node.uuid)\n );\n\n // Clear any remaining connections to removed nodes that weren't rerouted\n draft.nodes.forEach((node) => {\n node.exits.forEach((exit) => {\n if (uuids.includes(exit.destination_uuid)) {\n exit.destination_uuid = null;\n }\n });\n });\n\n // Sort nodes by position\n sortNodesByPosition(draft.nodes, draft._ui.nodes);\n });\n\n state.dirtyDate = new Date();\n });\n },\n\n removeStickyNotes: (uuids: string[]) => {\n set((state: AppState) => {\n if (state.flowDefinition._ui?.stickies) {\n for (const uuid of uuids) {\n delete state.flowDefinition._ui.stickies[uuid];\n }\n }\n state.dirtyDate = new Date();\n });\n },\n\n updateNode: (uuid: string, newNode: Node) => {\n set((state: AppState) => {\n const node = state.flowDefinition?.nodes.find((n) => n.uuid === uuid);\n if (node) {\n node.actions = newNode.actions;\n node.uuid = newNode.uuid;\n node.exits = newNode.exits;\n node.router = newNode.router;\n }\n state.dirtyDate = new Date();\n });\n },\n\n updateNodeUIConfig: (uuid: string, config: Record<string, any>) => {\n set((state: AppState) => {\n if (state.flowDefinition._ui.nodes[uuid]) {\n // Handle type separately if provided\n if (config.type !== undefined) {\n state.flowDefinition._ui.nodes[uuid].type = config.type;\n }\n\n // Update config (excluding type)\n if (!state.flowDefinition._ui.nodes[uuid].config) {\n state.flowDefinition._ui.nodes[uuid].config = {};\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { type, ...configWithoutType } = config;\n Object.assign(\n state.flowDefinition._ui.nodes[uuid].config,\n configWithoutType\n );\n }\n state.dirtyDate = new Date();\n });\n },\n\n updateConnection: (\n nodeUuid: string,\n exitUuid: string,\n destinationNodeUuid: string\n ) => {\n /* console.log('Upating connection:', {\n nodeUuid,\n exitUuid,\n destinationNodeUuid\n });*/\n set((state: AppState) => {\n // Find the exit with this UUID\n const node = state.flowDefinition.nodes.find(\n (node) => node.uuid === nodeUuid\n );\n\n const exit = node?.exits.find((e) => e.uuid === exitUuid);\n if (exit) {\n // Update the destination\n exit.destination_uuid = destinationNodeUuid;\n state.dirtyDate = new Date();\n }\n });\n },\n\n updateStickyNote: (uuid: string, sticky: StickyNote) => {\n set((state: AppState) => {\n if (!state.flowDefinition._ui.stickies) {\n state.flowDefinition._ui.stickies = {};\n }\n state.flowDefinition._ui.stickies[uuid] = sticky;\n state.dirtyDate = new Date();\n });\n },\n\n createStickyNote: (position: FlowPosition): string => {\n const uuid = generateUUID();\n set((state: AppState) => {\n if (!state.flowDefinition._ui.stickies) {\n state.flowDefinition._ui.stickies = {};\n }\n\n const newSticky: StickyNote = {\n position,\n title: '',\n body: '',\n color: 'yellow'\n };\n\n state.flowDefinition._ui.stickies[uuid] = newSticky;\n state.dirtyDate = new Date();\n });\n return uuid;\n },\n\n createNode: (nodeType: string, position: FlowPosition): string => {\n const uuid = generateUUID();\n const exitUuid = generateUUID();\n\n set((state: AppState) => {\n // Create a basic node with a single exit\n const newNode: Node = {\n uuid,\n actions: [],\n exits: [\n {\n uuid: exitUuid,\n destination_uuid: null\n }\n ]\n };\n\n // Add the node to the flow definition\n state.flowDefinition.nodes.push(newNode);\n\n // Set up UI for the node\n if (!state.flowDefinition._ui.nodes) {\n state.flowDefinition._ui.nodes = {};\n }\n\n state.flowDefinition._ui.nodes[uuid] = {\n position,\n type: nodeType as any,\n config: {}\n };\n\n // Sort nodes by position\n sortNodesByPosition(\n state.flowDefinition.nodes,\n state.flowDefinition._ui.nodes\n );\n\n state.dirtyDate = new Date();\n });\n\n return uuid;\n },\n\n addNode: (node: Node, nodeUI: NodeUI) => {\n set((state: AppState) => {\n // Add the node to the flow definition\n state.flowDefinition.nodes.push(node);\n\n // Set up UI for the node\n if (!state.flowDefinition._ui.nodes) {\n state.flowDefinition._ui.nodes = {};\n }\n\n state.flowDefinition._ui.nodes[node.uuid] = nodeUI;\n\n // Sort nodes by position\n sortNodesByPosition(\n state.flowDefinition.nodes,\n state.flowDefinition._ui.nodes\n );\n\n state.dirtyDate = new Date();\n });\n },\n\n updateLocalization: (\n languageCode: string,\n actionUuid: string,\n localizationData: Record<string, any>\n ) => {\n set((state: AppState) => {\n // Initialize localization structure if it doesn't exist\n if (!state.flowDefinition.localization) {\n state.flowDefinition.localization = {};\n }\n\n if (!state.flowDefinition.localization[languageCode]) {\n state.flowDefinition.localization[languageCode] = {};\n }\n\n // Update or remove the localization for this action\n if (Object.keys(localizationData).length > 0) {\n state.flowDefinition.localization[languageCode][actionUuid] =\n localizationData;\n } else {\n // If no localized values, remove the entry\n delete state.flowDefinition.localization[languageCode][actionUuid];\n }\n\n // Clean up empty language sections\n if (\n Object.keys(state.flowDefinition.localization[languageCode])\n .length === 0\n ) {\n delete state.flowDefinition.localization[languageCode];\n }\n\n // Clean up empty localization object\n if (Object.keys(state.flowDefinition.localization).length === 0) {\n delete state.flowDefinition.localization;\n }\n\n state.dirtyDate = new Date();\n });\n },\n\n setTranslationFilters: (filters: { categories: boolean }) => {\n set((state: AppState) => {\n if (!state.flowDefinition?._ui) {\n return;\n }\n\n const currentFilters = state.flowDefinition._ui\n .translation_filters || {\n categories: false\n };\n\n state.flowDefinition._ui.translation_filters = {\n ...currentFilters,\n categories: !!filters.categories\n };\n\n state.dirtyDate = new Date();\n });\n },\n\n markAutoTranslated: (\n languageCode: string,\n uuid: string,\n attributes: string[]\n ) => {\n set((state: AppState) => {\n if (!state.flowDefinition?._ui) {\n return;\n }\n\n if (!state.flowDefinition._ui.auto_translations) {\n state.flowDefinition._ui.auto_translations = {};\n }\n\n if (!state.flowDefinition._ui.auto_translations[languageCode]) {\n state.flowDefinition._ui.auto_translations[languageCode] = {};\n }\n\n const existing =\n state.flowDefinition._ui.auto_translations[languageCode][uuid] ||\n [];\n\n const merged = Array.from(\n new Set([...existing, ...(attributes || [])])\n );\n\n state.flowDefinition._ui.auto_translations[languageCode][uuid] =\n merged;\n state.dirtyDate = new Date();\n });\n }\n }))\n )\n);\n\ntype SelectorAwareStoreApi<S extends object> = StoreApi<S> & {\n subscribe: <U>(\n selector: (state: S) => U,\n listener: (value: U, previous: U) => void\n ) => () => void;\n};\n\n/**\n * Custom Lit property decorator that binds a property to a Zustand store subscription.\n *\n * @param store - The Zustand store to subscribe to.\n * @param selector - A function selecting the slice of state to bind to the property.\n */\nexport function fromStore<S extends object, V = unknown>(\n store: SelectorAwareStoreApi<S>,\n selector: (state: S) => V\n): PropertyDecorator {\n return (proto: any, name: string | symbol) => {\n property()(proto, name as string);\n\n const connectedKey = 'connectedCallback';\n const disconnectedKey = 'disconnectedCallback';\n\n const userConnected = proto[connectedKey];\n const userDisconnected = proto[disconnectedKey];\n\n proto[connectedKey] = function () {\n this._zustandUnsubscribe ??= {};\n this[name] = selector(store.getState());\n\n this._zustandUnsubscribe[name] = store.subscribe(selector, (val: V) => {\n this[name] = val;\n });\n\n if (userConnected) userConnected.call(this);\n };\n\n proto[disconnectedKey] = function () {\n this._zustandUnsubscribe?.[name]?.();\n if (userDisconnected) userDisconnected.call(this);\n };\n };\n}\n"]}
@@ -0,0 +1,118 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { play_audio } from '../../src/flow/actions/play_audio';
3
+ import { ActionTest } from '../ActionHelper';
4
+ /**
5
+ * Test suite for the play_audio action configuration.
6
+ */
7
+ describe('play_audio action config', () => {
8
+ const helper = new ActionTest(play_audio, 'play_audio');
9
+ describe('basic properties', () => {
10
+ helper.testBasicProperties();
11
+ it('has correct name', () => {
12
+ expect(play_audio.name).to.equal('Play Recording');
13
+ });
14
+ it('is voice-only', () => {
15
+ expect(play_audio.flowTypes).to.deep.equal(['voice']);
16
+ });
17
+ });
18
+ describe('action scenarios', () => {
19
+ helper.testAction({
20
+ uuid: 'test-play-1',
21
+ type: 'play_audio',
22
+ audio_url: '@results.voicemail'
23
+ }, 'expression-url');
24
+ helper.testAction({
25
+ uuid: 'test-play-2',
26
+ type: 'play_audio',
27
+ audio_url: 'https://example.com/greeting.mp3'
28
+ }, 'static-url');
29
+ });
30
+ describe('data transformation', () => {
31
+ it('converts action to form data', () => {
32
+ const action = {
33
+ uuid: 'test-action',
34
+ type: 'play_audio',
35
+ audio_url: '@results.voicemail'
36
+ };
37
+ const formData = play_audio.toFormData(action);
38
+ expect(formData.uuid).to.equal('test-action');
39
+ expect(formData.audio_url).to.equal('@results.voicemail');
40
+ });
41
+ it('handles missing audio_url', () => {
42
+ const action = {
43
+ uuid: 'test-action',
44
+ type: 'play_audio'
45
+ };
46
+ const formData = play_audio.toFormData(action);
47
+ expect(formData.audio_url).to.equal('');
48
+ });
49
+ it('converts form data to action', () => {
50
+ const formData = {
51
+ uuid: 'test-action',
52
+ audio_url: '@results.voicemail'
53
+ };
54
+ const action = play_audio.fromFormData(formData);
55
+ expect(action.uuid).to.equal('test-action');
56
+ expect(action.type).to.equal('play_audio');
57
+ expect(action.audio_url).to.equal('@results.voicemail');
58
+ });
59
+ it('trims whitespace from audio_url', () => {
60
+ const formData = {
61
+ uuid: 'test-action',
62
+ audio_url: ' @results.voicemail '
63
+ };
64
+ const action = play_audio.fromFormData(formData);
65
+ expect(action.audio_url).to.equal('@results.voicemail');
66
+ });
67
+ });
68
+ describe('localization', () => {
69
+ it('converts localization to form data', () => {
70
+ const action = {
71
+ uuid: 'test-action',
72
+ type: 'play_audio',
73
+ audio_url: '@results.voicemail'
74
+ };
75
+ const localization = {
76
+ audio_url: ['@results.voicemail_es']
77
+ };
78
+ const formData = play_audio.toLocalizationFormData(action, localization);
79
+ expect(formData.audio_url).to.equal('@results.voicemail_es');
80
+ });
81
+ it('handles missing localization', () => {
82
+ const action = {
83
+ uuid: 'test-action',
84
+ type: 'play_audio',
85
+ audio_url: '@results.voicemail'
86
+ };
87
+ const formData = play_audio.toLocalizationFormData(action, {});
88
+ expect(formData.audio_url).to.equal('');
89
+ });
90
+ it('converts form data to localization', () => {
91
+ const action = {
92
+ uuid: 'test-action',
93
+ type: 'play_audio',
94
+ audio_url: '@results.voicemail'
95
+ };
96
+ const formData = {
97
+ uuid: 'test-action',
98
+ audio_url: '@results.voicemail_es'
99
+ };
100
+ const localization = play_audio.fromLocalizationFormData(formData, action);
101
+ expect(localization.audio_url).to.deep.equal(['@results.voicemail_es']);
102
+ });
103
+ it('omits unchanged localization', () => {
104
+ const action = {
105
+ uuid: 'test-action',
106
+ type: 'play_audio',
107
+ audio_url: '@results.voicemail'
108
+ };
109
+ const formData = {
110
+ uuid: 'test-action',
111
+ audio_url: '@results.voicemail' // same as original
112
+ };
113
+ const localization = play_audio.fromLocalizationFormData(formData, action);
114
+ expect(localization.audio_url).to.be.undefined;
115
+ });
116
+ });
117
+ });
118
+ //# sourceMappingURL=play_audio.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"play_audio.test.js","sourceRoot":"","sources":["../../../test/actions/play_audio.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;GAEG;AACH,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAExD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAE7B,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;YACvB,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,UAAU,CACf;YACE,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,YAAY;YAClB,SAAS,EAAE,oBAAoB;SACnB,EACd,gBAAgB,CACjB,CAAC;QAEF,MAAM,CAAC,UAAU,CACf;YACE,IAAI,EAAE,aA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,CAAC;YAChE,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,MAAM,MAAM,GAAc;gBACxB,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,YAAY;gBAClB,SAAS,EAAE,oBAAoB;aAChC,CAAC;YAEF,MAAM,QAAQ,GAAG;gBACf,IAAI,EAAE,aAAa;gBACnB,SAAS,EAAE,uBAAuB;aACnC,CAAC;YAEF,MAAM,YAAY,GAAG,UAAU,CAAC,wBAAyB,CACvD,QAAQ,EACR,MAAM,CACP,CAAC;YACF,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;YACtC,MAAM,MAAM,GAAc;gBACxB,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,YAAY;gBAClB,SAAS,EAAE,oBAAoB;aAChC,CAAC;YAEF,MAAM,QAAQ,GAAG;gBACf,IAAI,EAAE,aAAa;gBACnB,SAAS,EAAE,oBAAoB,CAAC,mBAAmB;aACpD,CAAC;YAEF,MAAM,YAAY,GAAG,UAAU,CAAC,wBAAyB,CACvD,QAAQ,EACR,MAAM,CACP,CAAC;YACF,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { play_audio } from '../../src/flow/actions/play_audio';\nimport { PlayAudio } from '../../src/store/flow-definition';\nimport { ActionTest } from '../ActionHelper';\n\n/**\n * Test suite for the play_audio action configuration.\n */\ndescribe('play_audio action config', () => {\n const helper = new ActionTest(play_audio, 'play_audio');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(play_audio.name).to.equal('Play Recording');\n });\n\n it('is voice-only', () => {\n expect(play_audio.flowTypes).to.deep.equal(['voice']);\n });\n });\n\n describe('action scenarios', () => {\n helper.testAction(\n {\n uuid: 'test-play-1',\n type: 'play_audio',\n audio_url: '@results.voicemail'\n } as PlayAudio,\n 'expression-url'\n );\n\n helper.testAction(\n {\n uuid: 'test-play-2',\n type: 'play_audio',\n audio_url: 'https://example.com/greeting.mp3'\n } as PlayAudio,\n 'static-url'\n );\n });\n\n describe('data transformation', () => {\n it('converts action to form data', () => {\n const action: PlayAudio = {\n uuid: 'test-action',\n type: 'play_audio',\n audio_url: '@results.voicemail'\n };\n\n const formData = play_audio.toFormData!(action);\n expect(formData.uuid).to.equal('test-action');\n expect(formData.audio_url).to.equal('@results.voicemail');\n });\n\n it('handles missing audio_url', () => {\n const action = {\n uuid: 'test-action',\n type: 'play_audio'\n } as PlayAudio;\n\n const formData = play_audio.toFormData!(action);\n expect(formData.audio_url).to.equal('');\n });\n\n it('converts form data to action', () => {\n const formData = {\n uuid: 'test-action',\n audio_url: '@results.voicemail'\n };\n\n const action = play_audio.fromFormData!(formData) as PlayAudio;\n expect(action.uuid).to.equal('test-action');\n expect(action.type).to.equal('play_audio');\n expect(action.audio_url).to.equal('@results.voicemail');\n });\n\n it('trims whitespace from audio_url', () => {\n const formData = {\n uuid: 'test-action',\n audio_url: ' @results.voicemail '\n };\n\n const action = play_audio.fromFormData!(formData) as PlayAudio;\n expect(action.audio_url).to.equal('@results.voicemail');\n });\n });\n\n describe('localization', () => {\n it('converts localization to form data', () => {\n const action: PlayAudio = {\n uuid: 'test-action',\n type: 'play_audio',\n audio_url: '@results.voicemail'\n };\n\n const localization = {\n audio_url: ['@results.voicemail_es']\n };\n\n const formData = play_audio.toLocalizationFormData!(action, localization);\n expect(formData.audio_url).to.equal('@results.voicemail_es');\n });\n\n it('handles missing localization', () => {\n const action: PlayAudio = {\n uuid: 'test-action',\n type: 'play_audio',\n audio_url: '@results.voicemail'\n };\n\n const formData = play_audio.toLocalizationFormData!(action, {});\n expect(formData.audio_url).to.equal('');\n });\n\n it('converts form data to localization', () => {\n const action: PlayAudio = {\n uuid: 'test-action',\n type: 'play_audio',\n audio_url: '@results.voicemail'\n };\n\n const formData = {\n uuid: 'test-action',\n audio_url: '@results.voicemail_es'\n };\n\n const localization = play_audio.fromLocalizationFormData!(\n formData,\n action\n );\n expect(localization.audio_url).to.deep.equal(['@results.voicemail_es']);\n });\n\n it('omits unchanged localization', () => {\n const action: PlayAudio = {\n uuid: 'test-action',\n type: 'play_audio',\n audio_url: '@results.voicemail'\n };\n\n const formData = {\n uuid: 'test-action',\n audio_url: '@results.voicemail' // same as original\n };\n\n const localization = play_audio.fromLocalizationFormData!(\n formData,\n action\n );\n expect(localization.audio_url).to.be.undefined;\n });\n });\n});\n"]}
@@ -0,0 +1,158 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { say_msg } from '../../src/flow/actions/say_msg';
3
+ import { ActionTest } from '../ActionHelper';
4
+ /**
5
+ * Test suite for the say_msg action configuration.
6
+ */
7
+ describe('say_msg action config', () => {
8
+ const helper = new ActionTest(say_msg, 'say_msg');
9
+ describe('basic properties', () => {
10
+ helper.testBasicProperties();
11
+ it('has correct name', () => {
12
+ expect(say_msg.name).to.equal('Say Message');
13
+ });
14
+ it('is voice-only', () => {
15
+ expect(say_msg.flowTypes).to.deep.equal(['voice']);
16
+ });
17
+ });
18
+ describe('action scenarios', () => {
19
+ helper.testAction({
20
+ uuid: 'test-say-1',
21
+ type: 'say_msg',
22
+ text: 'Hello, welcome to our service.'
23
+ }, 'simple-text');
24
+ helper.testAction({
25
+ uuid: 'test-say-2',
26
+ type: 'say_msg',
27
+ text: 'Press 1 for sales.\nPress 2 for support.\nPress 3 to leave a message.'
28
+ }, 'multiline-text');
29
+ helper.testAction({
30
+ uuid: 'test-say-3',
31
+ type: 'say_msg',
32
+ text: 'Please listen to the following recording.',
33
+ audio_url: 'https://example.com/greeting.mp3'
34
+ }, 'text-with-audio-url');
35
+ });
36
+ describe('data transformation', () => {
37
+ it('converts action to form data', () => {
38
+ const action = {
39
+ uuid: 'test-action',
40
+ type: 'say_msg',
41
+ text: 'Hello world',
42
+ audio_url: 'https://example.com/audio.mp3'
43
+ };
44
+ const formData = say_msg.toFormData(action);
45
+ expect(formData.uuid).to.equal('test-action');
46
+ expect(formData.text).to.equal('Hello world');
47
+ expect(formData.audio_url).to.equal('https://example.com/audio.mp3');
48
+ });
49
+ it('handles missing audio_url in toFormData', () => {
50
+ const action = {
51
+ uuid: 'test-action',
52
+ type: 'say_msg',
53
+ text: 'Hello'
54
+ };
55
+ const formData = say_msg.toFormData(action);
56
+ expect(formData.audio_url).to.equal('');
57
+ });
58
+ it('converts form data to action', () => {
59
+ const formData = {
60
+ uuid: 'test-action',
61
+ text: 'Hello world',
62
+ audio_url: 'https://example.com/audio.mp3'
63
+ };
64
+ const action = say_msg.fromFormData(formData);
65
+ expect(action.uuid).to.equal('test-action');
66
+ expect(action.type).to.equal('say_msg');
67
+ expect(action.text).to.equal('Hello world');
68
+ expect(action.audio_url).to.equal('https://example.com/audio.mp3');
69
+ });
70
+ it('omits empty audio_url in fromFormData', () => {
71
+ const formData = {
72
+ uuid: 'test-action',
73
+ text: 'Hello world',
74
+ audio_url: ''
75
+ };
76
+ const action = say_msg.fromFormData(formData);
77
+ expect(action.audio_url).to.be.undefined;
78
+ });
79
+ it('trims whitespace from audio_url', () => {
80
+ const formData = {
81
+ uuid: 'test-action',
82
+ text: 'Hello',
83
+ audio_url: ' https://example.com/audio.mp3 '
84
+ };
85
+ const action = say_msg.fromFormData(formData);
86
+ expect(action.audio_url).to.equal('https://example.com/audio.mp3');
87
+ });
88
+ });
89
+ describe('sanitize', () => {
90
+ it('trims text whitespace', () => {
91
+ const formData = { text: ' Hello world ' };
92
+ say_msg.sanitize(formData);
93
+ expect(formData.text).to.equal('Hello world');
94
+ });
95
+ });
96
+ describe('localization', () => {
97
+ it('converts localization to form data', () => {
98
+ const action = {
99
+ uuid: 'test-action',
100
+ type: 'say_msg',
101
+ text: 'Hello',
102
+ audio_url: 'https://example.com/en.mp3'
103
+ };
104
+ const localization = {
105
+ text: ['Hola'],
106
+ audio_url: ['https://example.com/es.mp3']
107
+ };
108
+ const formData = say_msg.toLocalizationFormData(action, localization);
109
+ expect(formData.text).to.equal('Hola');
110
+ expect(formData.audio_url).to.equal('https://example.com/es.mp3');
111
+ });
112
+ it('handles missing localization fields', () => {
113
+ const action = {
114
+ uuid: 'test-action',
115
+ type: 'say_msg',
116
+ text: 'Hello'
117
+ };
118
+ const formData = say_msg.toLocalizationFormData(action, {});
119
+ expect(formData.text).to.equal('');
120
+ expect(formData.audio_url).to.equal('');
121
+ });
122
+ it('converts form data to localization', () => {
123
+ const action = {
124
+ uuid: 'test-action',
125
+ type: 'say_msg',
126
+ text: 'Hello',
127
+ audio_url: 'https://example.com/en.mp3'
128
+ };
129
+ const formData = {
130
+ uuid: 'test-action',
131
+ text: 'Hola',
132
+ audio_url: 'https://example.com/es.mp3'
133
+ };
134
+ const localization = say_msg.fromLocalizationFormData(formData, action);
135
+ expect(localization.text).to.deep.equal(['Hola']);
136
+ expect(localization.audio_url).to.deep.equal([
137
+ 'https://example.com/es.mp3'
138
+ ]);
139
+ });
140
+ it('omits unchanged localization fields', () => {
141
+ const action = {
142
+ uuid: 'test-action',
143
+ type: 'say_msg',
144
+ text: 'Hello',
145
+ audio_url: 'https://example.com/en.mp3'
146
+ };
147
+ const formData = {
148
+ uuid: 'test-action',
149
+ text: 'Hello', // same as original
150
+ audio_url: 'https://example.com/en.mp3' // same as original
151
+ };
152
+ const localization = say_msg.fromLocalizationFormData(formData, action);
153
+ expect(localization.text).to.be.undefined;
154
+ expect(localization.audio_url).to.be.undefined;
155
+ });
156
+ });
157
+ });
158
+ //# sourceM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,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { say_msg } from '../../src/flow/actions/say_msg';\nimport { SayMsg } from '../../src/store/flow-definition';\nimport { ActionTest } from '../ActionHelper';\n\n/**\n * Test suite for the say_msg action configuration.\n */\ndescribe('say_msg action config', () => {\n const helper = new ActionTest(say_msg, 'say_msg');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(say_msg.name).to.equal('Say Message');\n });\n\n it('is voice-only', () => {\n expect(say_msg.flowTypes).to.deep.equal(['voice']);\n });\n });\n\n describe('action scenarios', () => {\n helper.testAction(\n {\n uuid: 'test-say-1',\n type: 'say_msg',\n text: 'Hello, welcome to our service.'\n } as SayMsg,\n 'simple-text'\n );\n\n helper.testAction(\n {\n uuid: 'test-say-2',\n type: 'say_msg',\n text: 'Press 1 for sales.\\nPress 2 for support.\\nPress 3 to leave a message.'\n } as SayMsg,\n 'multiline-text'\n );\n\n helper.testAction(\n {\n uuid: 'test-say-3',\n type: 'say_msg',\n text: 'Please listen to the following recording.',\n audio_url: 'https://example.com/greeting.mp3'\n } as SayMsg,\n 'text-with-audio-url'\n );\n });\n\n describe('data transformation', () => {\n it('converts action to form data', () => {\n const action: SayMsg = {\n uuid: 'test-action',\n type: 'say_msg',\n text: 'Hello world',\n audio_url: 'https://example.com/audio.mp3'\n };\n\n const formData = say_msg.toFormData!(action);\n expect(formData.uuid).to.equal('test-action');\n expect(formData.text).to.equal('Hello world');\n expect(formData.audio_url).to.equal('https://example.com/audio.mp3');\n });\n\n it('handles missing audio_url in toFormData', () => {\n const action: SayMsg = {\n uuid: 'test-action',\n type: 'say_msg',\n text: 'Hello'\n } as SayMsg;\n\n const formData = say_msg.toFormData!(action);\n expect(formData.audio_url).to.equal('');\n });\n\n it('converts form data to action', () => {\n const formData = {\n uuid: 'test-action',\n text: 'Hello world',\n audio_url: 'https://example.com/audio.mp3'\n };\n\n const action = say_msg.fromFormData!(formData) as SayMsg;\n expect(action.uuid).to.equal('test-action');\n expect(action.type).to.equal('say_msg');\n expect(action.text).to.equal('Hello world');\n expect(action.audio_url).to.equal('https://example.com/audio.mp3');\n });\n\n it('omits empty audio_url in fromFormData', () => {\n const formData = {\n uuid: 'test-action',\n text: 'Hello world',\n audio_url: ''\n };\n\n const action = say_msg.fromFormData!(formData) as SayMsg;\n expect(action.audio_url).to.be.undefined;\n });\n\n it('trims whitespace from audio_url', () => {\n const formData = {\n uuid: 'test-action',\n text: 'Hello',\n audio_url: ' https://example.com/audio.mp3 '\n };\n\n const action = say_msg.fromFormData!(formData) as SayMsg;\n expect(action.audio_url).to.equal('https://example.com/audio.mp3');\n });\n });\n\n describe('sanitize', () => {\n it('trims text whitespace', () => {\n const formData = { text: ' Hello world ' };\n say_msg.sanitize!(formData);\n expect(formData.text).to.equal('Hello world');\n });\n });\n\n describe('localization', () => {\n it('converts localization to form data', () => {\n const action: SayMsg = {\n uuid: 'test-action',\n type: 'say_msg',\n text: 'Hello',\n audio_url: 'https://example.com/en.mp3'\n };\n\n const localization = {\n text: ['Hola'],\n audio_url: ['https://example.com/es.mp3']\n };\n\n const formData = say_msg.toLocalizationFormData!(action, localization);\n expect(formData.text).to.equal('Hola');\n expect(formData.audio_url).to.equal('https://example.com/es.mp3');\n });\n\n it('handles missing localization fields', () => {\n const action: SayMsg = {\n uuid: 'test-action',\n type: 'say_msg',\n text: 'Hello'\n } as SayMsg;\n\n const formData = say_msg.toLocalizationFormData!(action, {});\n expect(formData.text).to.equal('');\n expect(formData.audio_url).to.equal('');\n });\n\n it('converts form data to localization', () => {\n const action: SayMsg = {\n uuid: 'test-action',\n type: 'say_msg',\n text: 'Hello',\n audio_url: 'https://example.com/en.mp3'\n };\n\n const formData = {\n uuid: 'test-action',\n text: 'Hola',\n audio_url: 'https://example.com/es.mp3'\n };\n\n const localization = say_msg.fromLocalizationFormData!(formData, action);\n expect(localization.text).to.deep.equal(['Hola']);\n expect(localization.audio_url).to.deep.equal([\n 'https://example.com/es.mp3'\n ]);\n });\n\n it('omits unchanged localization fields', () => {\n const action: SayMsg = {\n uuid: 'test-action',\n type: 'say_msg',\n text: 'Hello',\n audio_url: 'https://example.com/en.mp3'\n };\n\n const formData = {\n uuid: 'test-action',\n text: 'Hello', // same as original\n audio_url: 'https://example.com/en.mp3' // same as original\n };\n\n const localization = say_msg.fromLocalizationFormData!(formData, action);\n expect(localization.text).to.be.undefined;\n expect(localization.audio_url).to.be.undefined;\n });\n });\n});\n"]}