@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
@@ -0,0 +1,156 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { wait_for_audio } from '../../src/flow/nodes/wait_for_audio';
3
+ import { NodeTest } from '../NodeHelper';
4
+ /**
5
+ * Test suite for the wait_for_audio node configuration.
6
+ */
7
+ describe('wait_for_audio node config', () => {
8
+ const helper = new NodeTest(wait_for_audio, 'wait_for_audio');
9
+ describe('basic properties', () => {
10
+ helper.testBasicProperties();
11
+ it('has correct name', () => {
12
+ expect(wait_for_audio.name).to.equal('Make Recording');
13
+ });
14
+ it('has correct type', () => {
15
+ expect(wait_for_audio.type).to.equal('wait_for_audio');
16
+ });
17
+ it('is voice-only', () => {
18
+ expect(wait_for_audio.flowTypes).to.deep.equal(['voice']);
19
+ });
20
+ it('has form with result_name field', () => {
21
+ expect(wait_for_audio.form).to.exist;
22
+ expect(wait_for_audio.form.result_name).to.exist;
23
+ });
24
+ it('has layout', () => {
25
+ expect(wait_for_audio.layout).to.deep.equal(['result_name']);
26
+ });
27
+ });
28
+ describe('node scenarios', () => {
29
+ it('renders basic audio wait', async () => {
30
+ await helper.testNode({
31
+ uuid: 'test-audio-node-1',
32
+ actions: [],
33
+ router: {
34
+ type: 'switch',
35
+ operand: '@input',
36
+ wait: {
37
+ type: 'msg',
38
+ hint: { type: 'audio' }
39
+ },
40
+ result_name: 'recording',
41
+ default_category_uuid: 'all-cat-1',
42
+ cases: [],
43
+ categories: [
44
+ {
45
+ uuid: 'all-cat-1',
46
+ name: 'All Responses',
47
+ exit_uuid: 'all-exit-1'
48
+ }
49
+ ]
50
+ },
51
+ exits: [{ uuid: 'all-exit-1', destination_uuid: null }]
52
+ }, { type: 'wait_for_audio' }, 'basic-audio-wait');
53
+ });
54
+ });
55
+ describe('data transformation', () => {
56
+ it('converts node to form data', () => {
57
+ const node = {
58
+ uuid: 'test-node',
59
+ actions: [],
60
+ router: {
61
+ type: 'switch',
62
+ result_name: 'my_recording',
63
+ categories: []
64
+ },
65
+ exits: []
66
+ };
67
+ const formData = wait_for_audio.toFormData(node);
68
+ expect(formData.uuid).to.equal('test-node');
69
+ expect(formData.result_name).to.equal('my_recording');
70
+ });
71
+ it('handles missing result_name', () => {
72
+ const node = {
73
+ uuid: 'test-node',
74
+ actions: [],
75
+ router: {
76
+ type: 'switch',
77
+ categories: []
78
+ },
79
+ exits: []
80
+ };
81
+ const formData = wait_for_audio.toFormData(node);
82
+ expect(formData.result_name).to.equal('');
83
+ });
84
+ it('creates node with All Responses category', () => {
85
+ var _a, _b, _c, _d, _e, _f, _g, _h;
86
+ const formData = {
87
+ uuid: 'test-node',
88
+ result_name: 'recording'
89
+ };
90
+ const originalNode = {
91
+ uuid: 'test-node',
92
+ actions: [],
93
+ exits: [],
94
+ router: {
95
+ type: 'switch',
96
+ categories: []
97
+ }
98
+ };
99
+ const result = wait_for_audio.fromFormData(formData, originalNode);
100
+ expect((_a = result.router) === null || _a === void 0 ? void 0 : _a.categories).to.have.length(1);
101
+ expect((_b = result.router) === null || _b === void 0 ? void 0 : _b.categories[0].name).to.equal('All Responses');
102
+ expect((_d = (_c = result.router) === null || _c === void 0 ? void 0 : _c.wait) === null || _d === void 0 ? void 0 : _d.type).to.equal('msg');
103
+ expect((_g = (_f = (_e = result.router) === null || _e === void 0 ? void 0 : _e.wait) === null || _f === void 0 ? void 0 : _f.hint) === null || _g === void 0 ? void 0 : _g.type).to.equal('audio');
104
+ expect((_h = result.router) === null || _h === void 0 ? void 0 : _h.result_name).to.equal('recording');
105
+ expect(result.exits).to.have.length(1);
106
+ });
107
+ it('preserves existing All Responses category UUID', () => {
108
+ var _a, _b;
109
+ const formData = {
110
+ uuid: 'test-node',
111
+ result_name: 'recording'
112
+ };
113
+ const originalNode = {
114
+ uuid: 'test-node',
115
+ actions: [],
116
+ router: {
117
+ type: 'switch',
118
+ categories: [
119
+ {
120
+ uuid: 'existing-cat-uuid',
121
+ name: 'All Responses',
122
+ exit_uuid: 'existing-exit-uuid'
123
+ }
124
+ ]
125
+ },
126
+ exits: [
127
+ {
128
+ uuid: 'existing-exit-uuid',
129
+ destination_uuid: 'some-destination'
130
+ }
131
+ ]
132
+ };
133
+ const result = wait_for_audio.fromFormData(formData, originalNode);
134
+ expect((_a = result.router) === null || _a === void 0 ? void 0 : _a.categories[0].uuid).to.equal('existing-cat-uuid');
135
+ expect((_b = result.router) === null || _b === void 0 ? void 0 : _b.categories[0].exit_uuid).to.equal('existing-exit-uuid');
136
+ expect(result.exits[0].uuid).to.equal('existing-exit-uuid');
137
+ expect(result.exits[0].destination_uuid).to.equal('some-destination');
138
+ });
139
+ it('omits result_name when empty', () => {
140
+ var _a;
141
+ const formData = {
142
+ uuid: 'test-node',
143
+ result_name: ''
144
+ };
145
+ const originalNode = {
146
+ uuid: 'test-node',
147
+ actions: [],
148
+ exits: [],
149
+ router: { type: 'switch', categories: [] }
150
+ };
151
+ const result = wait_for_audio.fromFormData(formData, originalNode);
152
+ expect((_a = result.router) === null || _a === void 0 ? void 0 : _a.result_name).to.be.undefined;
153
+ });
154
+ });
155
+ });
156
+ //# sourceMappingURL=wait_for_audio.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait_for_audio.test.js","sourceRoot":"","sources":["../../../test/nodes/wait_for_audio.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;IAE9D,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAE7B,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,EAAE,CAA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B,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,EAAE;gBACX,KAAK,EAAE,EAAE;gBACT,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;aAC3C,CAAC;YAEF,MAAM,MAAM,GAAG,cAAc,CAAC,YAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YACpE,MAAM,CAAC,MAAA,MAAM,CAAC,MAAM,0CAAE,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;QACrD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { wait_for_audio } from '../../src/flow/nodes/wait_for_audio';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the wait_for_audio node configuration.\n */\ndescribe('wait_for_audio node config', () => {\n const helper = new NodeTest(wait_for_audio, 'wait_for_audio');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(wait_for_audio.name).to.equal('Make Recording');\n });\n\n it('has correct type', () => {\n expect(wait_for_audio.type).to.equal('wait_for_audio');\n });\n\n it('is voice-only', () => {\n expect(wait_for_audio.flowTypes).to.deep.equal(['voice']);\n });\n\n it('has form with result_name field', () => {\n expect(wait_for_audio.form).to.exist;\n expect(wait_for_audio.form!.result_name).to.exist;\n });\n\n it('has layout', () => {\n expect(wait_for_audio.layout).to.deep.equal(['result_name']);\n });\n });\n\n describe('node scenarios', () => {\n it('renders basic audio wait', async () => {\n await helper.testNode(\n {\n uuid: 'test-audio-node-1',\n actions: [],\n router: {\n type: 'switch',\n operand: '@input',\n wait: {\n type: 'msg',\n hint: { type: 'audio' }\n },\n result_name: 'recording',\n default_category_uuid: 'all-cat-1',\n cases: [],\n categories: [\n {\n uuid: 'all-cat-1',\n name: 'All Responses',\n exit_uuid: 'all-exit-1'\n }\n ]\n },\n exits: [{ uuid: 'all-exit-1', destination_uuid: null }]\n } as Node,\n { type: 'wait_for_audio' },\n 'basic-audio-wait'\n );\n });\n });\n\n describe('data transformation', () => {\n it('converts node to form data', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n result_name: 'my_recording',\n categories: []\n },\n exits: []\n };\n\n const formData = wait_for_audio.toFormData!(node);\n expect(formData.uuid).to.equal('test-node');\n expect(formData.result_name).to.equal('my_recording');\n });\n\n it('handles missing result_name', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n categories: []\n },\n exits: []\n };\n\n const formData = wait_for_audio.toFormData!(node);\n expect(formData.result_name).to.equal('');\n });\n\n it('creates node with All Responses category', () => {\n const formData = {\n uuid: 'test-node',\n result_name: 'recording'\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: {\n type: 'switch',\n categories: []\n }\n };\n\n const result = wait_for_audio.fromFormData!(formData, originalNode);\n\n expect(result.router?.categories).to.have.length(1);\n expect(result.router?.categories[0].name).to.equal('All Responses');\n expect(result.router?.wait?.type).to.equal('msg');\n expect(result.router?.wait?.hint?.type).to.equal('audio');\n expect(result.router?.result_name).to.equal('recording');\n expect(result.exits).to.have.length(1);\n });\n\n it('preserves existing All Responses category UUID', () => {\n const formData = {\n uuid: 'test-node',\n result_name: 'recording'\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n categories: [\n {\n uuid: 'existing-cat-uuid',\n name: 'All Responses',\n exit_uuid: 'existing-exit-uuid'\n }\n ]\n },\n exits: [\n {\n uuid: 'existing-exit-uuid',\n destination_uuid: 'some-destination'\n }\n ]\n };\n\n const result = wait_for_audio.fromFormData!(formData, originalNode);\n\n expect(result.router?.categories[0].uuid).to.equal('existing-cat-uuid');\n expect(result.router?.categories[0].exit_uuid).to.equal(\n 'existing-exit-uuid'\n );\n expect(result.exits[0].uuid).to.equal('existing-exit-uuid');\n expect(result.exits[0].destination_uuid).to.equal('some-destination');\n });\n\n it('omits result_name when empty', () => {\n const formData = {\n uuid: 'test-node',\n result_name: ''\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: { type: 'switch', categories: [] }\n };\n\n const result = wait_for_audio.fromFormData!(formData, originalNode);\n expect(result.router?.result_name).to.be.undefined;\n });\n });\n});\n"]}
@@ -0,0 +1,336 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { wait_for_dial } from '../../src/flow/nodes/wait_for_dial';
3
+ import { NodeTest } from '../NodeHelper';
4
+ /**
5
+ * Test suite for the wait_for_dial node configuration.
6
+ */
7
+ describe('wait_for_dial node config', () => {
8
+ const helper = new NodeTest(wait_for_dial, 'wait_for_dial');
9
+ describe('basic properties', () => {
10
+ helper.testBasicProperties();
11
+ it('has correct name', () => {
12
+ expect(wait_for_dial.name).to.equal('Redirect Call');
13
+ });
14
+ it('has correct type', () => {
15
+ expect(wait_for_dial.type).to.equal('wait_for_dial');
16
+ });
17
+ it('is voice-only', () => {
18
+ expect(wait_for_dial.flowTypes).to.deep.equal(['voice']);
19
+ });
20
+ it('has form with phone and limit fields', () => {
21
+ expect(wait_for_dial.form).to.exist;
22
+ expect(wait_for_dial.form.phone).to.exist;
23
+ expect(wait_for_dial.form.dial_limit_seconds).to.exist;
24
+ expect(wait_for_dial.form.call_limit_seconds).to.exist;
25
+ expect(wait_for_dial.form.result_name).to.exist;
26
+ });
27
+ it('has fixed router rules', () => {
28
+ expect(wait_for_dial.router).to.exist;
29
+ expect(wait_for_dial.router.type).to.equal('switch');
30
+ expect(wait_for_dial.router.defaultCategory).to.equal('Failed');
31
+ expect(wait_for_dial.router.rules).to.have.length(3);
32
+ });
33
+ });
34
+ describe('node scenarios', () => {
35
+ it('renders basic dial', async () => {
36
+ await helper.testNode({
37
+ uuid: 'test-dial-node-1',
38
+ actions: [],
39
+ router: {
40
+ type: 'switch',
41
+ operand: '@(default(resume.dial.status, ""))',
42
+ wait: {
43
+ type: 'dial',
44
+ phone: '+12065551234'
45
+ },
46
+ result_name: 'dial_result',
47
+ default_category_uuid: 'failed-cat',
48
+ cases: [
49
+ {
50
+ uuid: 'case-answered',
51
+ type: 'has_only_text',
52
+ arguments: ['answered'],
53
+ category_uuid: 'answered-cat'
54
+ },
55
+ {
56
+ uuid: 'case-no-answer',
57
+ type: 'has_only_text',
58
+ arguments: ['no_answer'],
59
+ category_uuid: 'no-answer-cat'
60
+ },
61
+ {
62
+ uuid: 'case-busy',
63
+ type: 'has_only_text',
64
+ arguments: ['busy'],
65
+ category_uuid: 'busy-cat'
66
+ }
67
+ ],
68
+ categories: [
69
+ {
70
+ uuid: 'answered-cat',
71
+ name: 'Answered',
72
+ exit_uuid: 'answered-exit'
73
+ },
74
+ {
75
+ uuid: 'no-answer-cat',
76
+ name: 'No Answer',
77
+ exit_uuid: 'no-answer-exit'
78
+ },
79
+ {
80
+ uuid: 'busy-cat',
81
+ name: 'Busy',
82
+ exit_uuid: 'busy-exit'
83
+ },
84
+ {
85
+ uuid: 'failed-cat',
86
+ name: 'Failed',
87
+ exit_uuid: 'failed-exit'
88
+ }
89
+ ]
90
+ },
91
+ exits: [
92
+ { uuid: 'answered-exit', destination_uuid: null },
93
+ { uuid: 'no-answer-exit', destination_uuid: null },
94
+ { uuid: 'busy-exit', destination_uuid: null },
95
+ { uuid: 'failed-exit', destination_uuid: null }
96
+ ]
97
+ }, { type: 'wait_for_dial' }, 'basic-dial');
98
+ });
99
+ it('renders dial with limits', async () => {
100
+ await helper.testNode({
101
+ uuid: 'test-dial-node-2',
102
+ actions: [],
103
+ router: {
104
+ type: 'switch',
105
+ operand: '@(default(resume.dial.status, ""))',
106
+ wait: {
107
+ type: 'dial',
108
+ phone: '@contact.phone',
109
+ dial_limit_seconds: 30,
110
+ call_limit_seconds: 3600
111
+ },
112
+ default_category_uuid: 'failed-cat',
113
+ cases: [
114
+ {
115
+ uuid: 'case-answered',
116
+ type: 'has_only_text',
117
+ arguments: ['answered'],
118
+ category_uuid: 'answered-cat'
119
+ },
120
+ {
121
+ uuid: 'case-no-answer',
122
+ type: 'has_only_text',
123
+ arguments: ['no_answer'],
124
+ category_uuid: 'no-answer-cat'
125
+ },
126
+ {
127
+ uuid: 'case-busy',
128
+ type: 'has_only_text',
129
+ arguments: ['busy'],
130
+ category_uuid: 'busy-cat'
131
+ }
132
+ ],
133
+ categories: [
134
+ {
135
+ uuid: 'answered-cat',
136
+ name: 'Answered',
137
+ exit_uuid: 'answered-exit'
138
+ },
139
+ {
140
+ uuid: 'no-answer-cat',
141
+ name: 'No Answer',
142
+ exit_uuid: 'no-answer-exit'
143
+ },
144
+ {
145
+ uuid: 'busy-cat',
146
+ name: 'Busy',
147
+ exit_uuid: 'busy-exit'
148
+ },
149
+ {
150
+ uuid: 'failed-cat',
151
+ name: 'Failed',
152
+ exit_uuid: 'failed-exit'
153
+ }
154
+ ]
155
+ },
156
+ exits: [
157
+ { uuid: 'answered-exit', destination_uuid: null },
158
+ { uuid: 'no-answer-exit', destination_uuid: null },
159
+ { uuid: 'busy-exit', destination_uuid: null },
160
+ { uuid: 'failed-exit', destination_uuid: null }
161
+ ]
162
+ }, { type: 'wait_for_dial' }, 'dial-with-limits');
163
+ });
164
+ });
165
+ describe('data transformation', () => {
166
+ it('converts node to form data', () => {
167
+ const node = {
168
+ uuid: 'test-node',
169
+ actions: [],
170
+ router: {
171
+ type: 'switch',
172
+ result_name: 'dial_result',
173
+ wait: {
174
+ type: 'dial',
175
+ phone: '+12065551234',
176
+ dial_limit_seconds: 60,
177
+ call_limit_seconds: 7200
178
+ },
179
+ categories: []
180
+ },
181
+ exits: []
182
+ };
183
+ const formData = wait_for_dial.toFormData(node);
184
+ expect(formData.uuid).to.equal('test-node');
185
+ expect(formData.phone).to.equal('+12065551234');
186
+ expect(formData.dial_limit_seconds).to.equal('60');
187
+ expect(formData.call_limit_seconds).to.equal('7200');
188
+ expect(formData.result_name).to.equal('dial_result');
189
+ });
190
+ it('handles missing wait config', () => {
191
+ const node = {
192
+ uuid: 'test-node',
193
+ actions: [],
194
+ router: {
195
+ type: 'switch',
196
+ categories: []
197
+ },
198
+ exits: []
199
+ };
200
+ const formData = wait_for_dial.toFormData(node);
201
+ expect(formData.phone).to.equal('');
202
+ expect(formData.dial_limit_seconds).to.equal('');
203
+ expect(formData.call_limit_seconds).to.equal('');
204
+ });
205
+ it('creates node with fixed dial categories', () => {
206
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
207
+ const formData = {
208
+ uuid: 'test-node',
209
+ phone: '+12065551234',
210
+ dial_limit_seconds: '60',
211
+ call_limit_seconds: '7200',
212
+ result_name: 'dial_result'
213
+ };
214
+ const originalNode = {
215
+ uuid: 'test-node',
216
+ actions: [],
217
+ exits: [],
218
+ router: { type: 'switch', categories: [] }
219
+ };
220
+ const result = wait_for_dial.fromFormData(formData, originalNode);
221
+ // Should have 4 fixed categories
222
+ expect((_a = result.router) === null || _a === void 0 ? void 0 : _a.categories).to.have.length(4);
223
+ const names = result.router.categories.map((c) => c.name);
224
+ expect(names).to.deep.equal(['Answered', 'No Answer', 'Busy', 'Failed']);
225
+ // Should have 3 cases (Failed is default, no case needed)
226
+ expect((_b = result.router) === null || _b === void 0 ? void 0 : _b.cases).to.have.length(3);
227
+ // Check wait config
228
+ expect((_d = (_c = result.router) === null || _c === void 0 ? void 0 : _c.wait) === null || _d === void 0 ? void 0 : _d.type).to.equal('dial');
229
+ expect((_f = (_e = result.router) === null || _e === void 0 ? void 0 : _e.wait) === null || _f === void 0 ? void 0 : _f.phone).to.equal('+12065551234');
230
+ expect((_h = (_g = result.router) === null || _g === void 0 ? void 0 : _g.wait) === null || _h === void 0 ? void 0 : _h.dial_limit_seconds).to.equal(60);
231
+ expect((_k = (_j = result.router) === null || _j === void 0 ? void 0 : _j.wait) === null || _k === void 0 ? void 0 : _k.call_limit_seconds).to.equal(7200);
232
+ // Check operand
233
+ expect((_l = result.router) === null || _l === void 0 ? void 0 : _l.operand).to.equal('@(default(resume.dial.status, ""))');
234
+ // Check result name
235
+ expect((_m = result.router) === null || _m === void 0 ? void 0 : _m.result_name).to.equal('dial_result');
236
+ // Should have 4 exits
237
+ expect(result.exits).to.have.length(4);
238
+ });
239
+ it('omits limits when empty', () => {
240
+ var _a, _b, _c, _d, _e;
241
+ const formData = {
242
+ uuid: 'test-node',
243
+ phone: '+12065551234',
244
+ dial_limit_seconds: '',
245
+ call_limit_seconds: '',
246
+ result_name: ''
247
+ };
248
+ const originalNode = {
249
+ uuid: 'test-node',
250
+ actions: [],
251
+ exits: [],
252
+ router: { type: 'switch', categories: [] }
253
+ };
254
+ const result = wait_for_dial.fromFormData(formData, originalNode);
255
+ expect((_b = (_a = result.router) === null || _a === void 0 ? void 0 : _a.wait) === null || _b === void 0 ? void 0 : _b.dial_limit_seconds).to.be.undefined;
256
+ expect((_d = (_c = result.router) === null || _c === void 0 ? void 0 : _c.wait) === null || _d === void 0 ? void 0 : _d.call_limit_seconds).to.be.undefined;
257
+ expect((_e = result.router) === null || _e === void 0 ? void 0 : _e.result_name).to.be.undefined;
258
+ });
259
+ it('preserves existing category UUIDs', () => {
260
+ const formData = {
261
+ uuid: 'test-node',
262
+ phone: '+12065551234',
263
+ dial_limit_seconds: '',
264
+ call_limit_seconds: '',
265
+ result_name: ''
266
+ };
267
+ const originalNode = {
268
+ uuid: 'test-node',
269
+ actions: [],
270
+ router: {
271
+ type: 'switch',
272
+ categories: [
273
+ {
274
+ uuid: 'orig-answered',
275
+ name: 'Answered',
276
+ exit_uuid: 'orig-answered-exit'
277
+ },
278
+ {
279
+ uuid: 'orig-no-answer',
280
+ name: 'No Answer',
281
+ exit_uuid: 'orig-no-answer-exit'
282
+ },
283
+ {
284
+ uuid: 'orig-busy',
285
+ name: 'Busy',
286
+ exit_uuid: 'orig-busy-exit'
287
+ },
288
+ {
289
+ uuid: 'orig-failed',
290
+ name: 'Failed',
291
+ exit_uuid: 'orig-failed-exit'
292
+ }
293
+ ],
294
+ cases: [
295
+ {
296
+ uuid: 'orig-case-answered',
297
+ type: 'has_only_text',
298
+ arguments: ['answered'],
299
+ category_uuid: 'orig-answered'
300
+ },
301
+ {
302
+ uuid: 'orig-case-no-answer',
303
+ type: 'has_only_text',
304
+ arguments: ['no_answer'],
305
+ category_uuid: 'orig-no-answer'
306
+ },
307
+ {
308
+ uuid: 'orig-case-busy',
309
+ type: 'has_only_text',
310
+ arguments: ['busy'],
311
+ category_uuid: 'orig-busy'
312
+ }
313
+ ]
314
+ },
315
+ exits: [
316
+ { uuid: 'orig-answered-exit', destination_uuid: 'dest-1' },
317
+ { uuid: 'orig-no-answer-exit', destination_uuid: 'dest-2' },
318
+ { uuid: 'orig-busy-exit', destination_uuid: null },
319
+ { uuid: 'orig-failed-exit', destination_uuid: null }
320
+ ]
321
+ };
322
+ const result = wait_for_dial.fromFormData(formData, originalNode);
323
+ // Category UUIDs should be preserved
324
+ const answered = result.router.categories.find((c) => c.name === 'Answered');
325
+ expect(answered === null || answered === void 0 ? void 0 : answered.uuid).to.equal('orig-answered');
326
+ expect(answered === null || answered === void 0 ? void 0 : answered.exit_uuid).to.equal('orig-answered-exit');
327
+ // Exit destinations should be preserved
328
+ const answeredExit = result.exits.find((e) => e.uuid === 'orig-answered-exit');
329
+ expect(answeredExit === null || answeredExit === void 0 ? void 0 : answeredExit.destination_uuid).to.equal('dest-1');
330
+ // Case UUIDs should be preserved
331
+ const answeredCase = result.router.cases.find((c) => c.arguments[0] === 'answered');
332
+ expect(answeredCase === null || answeredCase === void 0 ? void 0 : answeredCase.uuid).to.equal('orig-case-answered');
333
+ });
334
+ });
335
+ });
336
+ //# sourceMappingURL=wait_for_dial.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait_for_dial.test.js","sourceRoot":"","sources":["../../../test/nodes/wait_for_dial.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,a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YACjD,MAAM,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YAE3D,wCAAwC;YACxC,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CACpC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,oBAAoB,CACvC,CAAC;YACF,MAAM,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAE1D,iCAAiC;YACjC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAO,CAAC,KAAK,CAAC,IAAI,CAC5C,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,UAAU,CAC1C,CAAC;YACF,MAAM,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { wait_for_dial } from '../../src/flow/nodes/wait_for_dial';\nimport { Node } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the wait_for_dial node configuration.\n */\ndescribe('wait_for_dial node config', () => {\n const helper = new NodeTest(wait_for_dial, 'wait_for_dial');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(wait_for_dial.name).to.equal('Redirect Call');\n });\n\n it('has correct type', () => {\n expect(wait_for_dial.type).to.equal('wait_for_dial');\n });\n\n it('is voice-only', () => {\n expect(wait_for_dial.flowTypes).to.deep.equal(['voice']);\n });\n\n it('has form with phone and limit fields', () => {\n expect(wait_for_dial.form).to.exist;\n expect(wait_for_dial.form!.phone).to.exist;\n expect(wait_for_dial.form!.dial_limit_seconds).to.exist;\n expect(wait_for_dial.form!.call_limit_seconds).to.exist;\n expect(wait_for_dial.form!.result_name).to.exist;\n });\n\n it('has fixed router rules', () => {\n expect(wait_for_dial.router).to.exist;\n expect(wait_for_dial.router!.type).to.equal('switch');\n expect(wait_for_dial.router!.defaultCategory).to.equal('Failed');\n expect(wait_for_dial.router!.rules).to.have.length(3);\n });\n });\n\n describe('node scenarios', () => {\n it('renders basic dial', async () => {\n await helper.testNode(\n {\n uuid: 'test-dial-node-1',\n actions: [],\n router: {\n type: 'switch',\n operand: '@(default(resume.dial.status, \"\"))',\n wait: {\n type: 'dial',\n phone: '+12065551234'\n },\n result_name: 'dial_result',\n default_category_uuid: 'failed-cat',\n cases: [\n {\n uuid: 'case-answered',\n type: 'has_only_text',\n arguments: ['answered'],\n category_uuid: 'answered-cat'\n },\n {\n uuid: 'case-no-answer',\n type: 'has_only_text',\n arguments: ['no_answer'],\n category_uuid: 'no-answer-cat'\n },\n {\n uuid: 'case-busy',\n type: 'has_only_text',\n arguments: ['busy'],\n category_uuid: 'busy-cat'\n }\n ],\n categories: [\n {\n uuid: 'answered-cat',\n name: 'Answered',\n exit_uuid: 'answered-exit'\n },\n {\n uuid: 'no-answer-cat',\n name: 'No Answer',\n exit_uuid: 'no-answer-exit'\n },\n {\n uuid: 'busy-cat',\n name: 'Busy',\n exit_uuid: 'busy-exit'\n },\n {\n uuid: 'failed-cat',\n name: 'Failed',\n exit_uuid: 'failed-exit'\n }\n ]\n },\n exits: [\n { uuid: 'answered-exit', destination_uuid: null },\n { uuid: 'no-answer-exit', destination_uuid: null },\n { uuid: 'busy-exit', destination_uuid: null },\n { uuid: 'failed-exit', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_dial' },\n 'basic-dial'\n );\n });\n\n it('renders dial with limits', async () => {\n await helper.testNode(\n {\n uuid: 'test-dial-node-2',\n actions: [],\n router: {\n type: 'switch',\n operand: '@(default(resume.dial.status, \"\"))',\n wait: {\n type: 'dial',\n phone: '@contact.phone',\n dial_limit_seconds: 30,\n call_limit_seconds: 3600\n },\n default_category_uuid: 'failed-cat',\n cases: [\n {\n uuid: 'case-answered',\n type: 'has_only_text',\n arguments: ['answered'],\n category_uuid: 'answered-cat'\n },\n {\n uuid: 'case-no-answer',\n type: 'has_only_text',\n arguments: ['no_answer'],\n category_uuid: 'no-answer-cat'\n },\n {\n uuid: 'case-busy',\n type: 'has_only_text',\n arguments: ['busy'],\n category_uuid: 'busy-cat'\n }\n ],\n categories: [\n {\n uuid: 'answered-cat',\n name: 'Answered',\n exit_uuid: 'answered-exit'\n },\n {\n uuid: 'no-answer-cat',\n name: 'No Answer',\n exit_uuid: 'no-answer-exit'\n },\n {\n uuid: 'busy-cat',\n name: 'Busy',\n exit_uuid: 'busy-exit'\n },\n {\n uuid: 'failed-cat',\n name: 'Failed',\n exit_uuid: 'failed-exit'\n }\n ]\n },\n exits: [\n { uuid: 'answered-exit', destination_uuid: null },\n { uuid: 'no-answer-exit', destination_uuid: null },\n { uuid: 'busy-exit', destination_uuid: null },\n { uuid: 'failed-exit', destination_uuid: null }\n ]\n } as Node,\n { type: 'wait_for_dial' },\n 'dial-with-limits'\n );\n });\n });\n\n describe('data transformation', () => {\n it('converts node to form data', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n result_name: 'dial_result',\n wait: {\n type: 'dial',\n phone: '+12065551234',\n dial_limit_seconds: 60,\n call_limit_seconds: 7200\n },\n categories: []\n },\n exits: []\n };\n\n const formData = wait_for_dial.toFormData!(node);\n expect(formData.uuid).to.equal('test-node');\n expect(formData.phone).to.equal('+12065551234');\n expect(formData.dial_limit_seconds).to.equal('60');\n expect(formData.call_limit_seconds).to.equal('7200');\n expect(formData.result_name).to.equal('dial_result');\n });\n\n it('handles missing wait config', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n categories: []\n },\n exits: []\n };\n\n const formData = wait_for_dial.toFormData!(node);\n expect(formData.phone).to.equal('');\n expect(formData.dial_limit_seconds).to.equal('');\n expect(formData.call_limit_seconds).to.equal('');\n });\n\n it('creates node with fixed dial categories', () => {\n const formData = {\n uuid: 'test-node',\n phone: '+12065551234',\n dial_limit_seconds: '60',\n call_limit_seconds: '7200',\n result_name: 'dial_result'\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: { type: 'switch', categories: [] }\n };\n\n const result = wait_for_dial.fromFormData!(formData, originalNode);\n\n // Should have 4 fixed categories\n expect(result.router?.categories).to.have.length(4);\n const names = result.router!.categories.map((c) => c.name);\n expect(names).to.deep.equal(['Answered', 'No Answer', 'Busy', 'Failed']);\n\n // Should have 3 cases (Failed is default, no case needed)\n expect(result.router?.cases).to.have.length(3);\n\n // Check wait config\n expect(result.router?.wait?.type).to.equal('dial');\n expect(result.router?.wait?.phone).to.equal('+12065551234');\n expect(result.router?.wait?.dial_limit_seconds).to.equal(60);\n expect(result.router?.wait?.call_limit_seconds).to.equal(7200);\n\n // Check operand\n expect(result.router?.operand).to.equal(\n '@(default(resume.dial.status, \"\"))'\n );\n\n // Check result name\n expect(result.router?.result_name).to.equal('dial_result');\n\n // Should have 4 exits\n expect(result.exits).to.have.length(4);\n });\n\n it('omits limits when empty', () => {\n const formData = {\n uuid: 'test-node',\n phone: '+12065551234',\n dial_limit_seconds: '',\n call_limit_seconds: '',\n result_name: ''\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: [],\n router: { type: 'switch', categories: [] }\n };\n\n const result = wait_for_dial.fromFormData!(formData, originalNode);\n\n expect(result.router?.wait?.dial_limit_seconds).to.be.undefined;\n expect(result.router?.wait?.call_limit_seconds).to.be.undefined;\n expect(result.router?.result_name).to.be.undefined;\n });\n\n it('preserves existing category UUIDs', () => {\n const formData = {\n uuid: 'test-node',\n phone: '+12065551234',\n dial_limit_seconds: '',\n call_limit_seconds: '',\n result_name: ''\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n router: {\n type: 'switch',\n categories: [\n {\n uuid: 'orig-answered',\n name: 'Answered',\n exit_uuid: 'orig-answered-exit'\n },\n {\n uuid: 'orig-no-answer',\n name: 'No Answer',\n exit_uuid: 'orig-no-answer-exit'\n },\n {\n uuid: 'orig-busy',\n name: 'Busy',\n exit_uuid: 'orig-busy-exit'\n },\n {\n uuid: 'orig-failed',\n name: 'Failed',\n exit_uuid: 'orig-failed-exit'\n }\n ],\n cases: [\n {\n uuid: 'orig-case-answered',\n type: 'has_only_text',\n arguments: ['answered'],\n category_uuid: 'orig-answered'\n },\n {\n uuid: 'orig-case-no-answer',\n type: 'has_only_text',\n arguments: ['no_answer'],\n category_uuid: 'orig-no-answer'\n },\n {\n uuid: 'orig-case-busy',\n type: 'has_only_text',\n arguments: ['busy'],\n category_uuid: 'orig-busy'\n }\n ]\n },\n exits: [\n { uuid: 'orig-answered-exit', destination_uuid: 'dest-1' },\n { uuid: 'orig-no-answer-exit', destination_uuid: 'dest-2' },\n { uuid: 'orig-busy-exit', destination_uuid: null },\n { uuid: 'orig-failed-exit', destination_uuid: null }\n ]\n };\n\n const result = wait_for_dial.fromFormData!(formData, originalNode);\n\n // Category UUIDs should be preserved\n const answered = result.router!.categories.find(\n (c) => c.name === 'Answered'\n );\n expect(answered?.uuid).to.equal('orig-answered');\n expect(answered?.exit_uuid).to.equal('orig-answered-exit');\n\n // Exit destinations should be preserved\n const answeredExit = result.exits.find(\n (e) => e.uuid === 'orig-answered-exit'\n );\n expect(answeredExit?.destination_uuid).to.equal('dest-1');\n\n // Case UUIDs should be preserved\n const answeredCase = result.router!.cases.find(\n (c: any) => c.arguments[0] === 'answered'\n );\n expect(answeredCase?.uuid).to.equal('orig-case-answered');\n });\n });\n});\n"]}