@nyaruka/temba-components 0.129.6 → 0.129.8

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 (177) hide show
  1. package/.devcontainer/Dockerfile +11 -4
  2. package/.devcontainer/devcontainer.json +3 -2
  3. package/.github/workflows/build.yml +4 -14
  4. package/CHANGELOG.md +25 -1
  5. package/demo/components/flow/example.html +9 -2
  6. package/demo/components/flow/index.html +206 -0
  7. package/demo/components/message-editor/example.html +125 -0
  8. package/demo/components/textinput/completion.html +1 -0
  9. package/demo/data/flows/food-order.json +132 -0
  10. package/demo/data/flows/sample-flow.json +40 -24
  11. package/demo/index.html +1 -1
  12. package/dist/temba-components.js +518 -220
  13. package/dist/temba-components.js.map +1 -1
  14. package/out-tsc/src/display/Thumbnail.js +2 -1
  15. package/out-tsc/src/display/Thumbnail.js.map +1 -1
  16. package/out-tsc/src/events.js.map +1 -1
  17. package/out-tsc/src/flow/CanvasNode.js +10 -2
  18. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  19. package/out-tsc/src/flow/NodeEditor.js +245 -22
  20. package/out-tsc/src/flow/NodeEditor.js.map +1 -1
  21. package/out-tsc/src/flow/StickyNote.js +1 -1
  22. package/out-tsc/src/flow/StickyNote.js.map +1 -1
  23. package/out-tsc/src/flow/actions/call_webhook.js +26 -17
  24. package/out-tsc/src/flow/actions/call_webhook.js.map +1 -1
  25. package/out-tsc/src/flow/actions/send_email.js +1 -2
  26. package/out-tsc/src/flow/actions/send_email.js.map +1 -1
  27. package/out-tsc/src/flow/actions/send_msg.js +155 -7
  28. package/out-tsc/src/flow/actions/send_msg.js.map +1 -1
  29. package/out-tsc/src/flow/types.js.map +1 -1
  30. package/out-tsc/src/form/ArrayEditor.js +111 -38
  31. package/out-tsc/src/form/ArrayEditor.js.map +1 -1
  32. package/out-tsc/src/form/BaseListEditor.js +19 -4
  33. package/out-tsc/src/form/BaseListEditor.js.map +1 -1
  34. package/out-tsc/src/form/FormField.js +1 -1
  35. package/out-tsc/src/form/FormField.js.map +1 -1
  36. package/out-tsc/src/form/KeyValueEditor.js +1 -1
  37. package/out-tsc/src/form/KeyValueEditor.js.map +1 -1
  38. package/out-tsc/src/form/MediaPicker.js +13 -1
  39. package/out-tsc/src/form/MediaPicker.js.map +1 -1
  40. package/out-tsc/src/form/MessageEditor.js +422 -0
  41. package/out-tsc/src/form/MessageEditor.js.map +1 -0
  42. package/out-tsc/src/form/TextInput.js +12 -5
  43. package/out-tsc/src/form/TextInput.js.map +1 -1
  44. package/out-tsc/src/form/select/Select.js +4 -4
  45. package/out-tsc/src/form/select/Select.js.map +1 -1
  46. package/out-tsc/src/live/ContactChat.js +29 -4
  47. package/out-tsc/src/live/ContactChat.js.map +1 -1
  48. package/out-tsc/temba-modules.js +2 -0
  49. package/out-tsc/temba-modules.js.map +1 -1
  50. package/out-tsc/test/temba-field-config.test.js +4 -2
  51. package/out-tsc/test/temba-field-config.test.js.map +1 -1
  52. package/out-tsc/test/temba-message-editor.test.js +194 -0
  53. package/out-tsc/test/temba-message-editor.test.js.map +1 -0
  54. package/out-tsc/test/temba-node-editor.test.js +71 -0
  55. package/out-tsc/test/temba-node-editor.test.js.map +1 -1
  56. package/out-tsc/test/temba-select.test.js +1 -1
  57. package/out-tsc/test/temba-select.test.js.map +1 -1
  58. package/out-tsc/test/temba-textinput.test.js +16 -0
  59. package/out-tsc/test/temba-textinput.test.js.map +1 -1
  60. package/out-tsc/test/temba-webchat.test.js +4 -0
  61. package/out-tsc/test/temba-webchat.test.js.map +1 -1
  62. package/out-tsc/test/utils.test.js +2 -8
  63. package/out-tsc/test/utils.test.js.map +1 -1
  64. package/package.json +7 -4
  65. package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
  66. package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
  67. package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
  68. package/screenshots/truth/actions/add_contact_groups/editor/multiple-groups.png +0 -0
  69. package/screenshots/truth/actions/add_contact_groups/editor/single-group.png +0 -0
  70. package/screenshots/truth/actions/add_contact_groups/render/descriptive-group-names.png +0 -0
  71. package/screenshots/truth/actions/add_contact_groups/render/long-group-names.png +0 -0
  72. package/screenshots/truth/actions/add_contact_groups/render/many-groups.png +0 -0
  73. package/screenshots/truth/actions/add_contact_groups/render/multiple-groups.png +0 -0
  74. package/screenshots/truth/actions/add_contact_groups/render/single-group.png +0 -0
  75. package/screenshots/truth/actions/remove_contact_groups/editor/cleanup-groups.png +0 -0
  76. package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
  77. package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
  78. package/screenshots/truth/actions/remove_contact_groups/editor/multiple-groups.png +0 -0
  79. package/screenshots/truth/actions/remove_contact_groups/editor/single-group.png +0 -0
  80. package/screenshots/truth/actions/remove_contact_groups/render/cleanup-groups.png +0 -0
  81. package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
  82. package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
  83. package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
  84. package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
  85. package/screenshots/truth/actions/remove_contact_groups/render/single-group.png +0 -0
  86. package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
  87. package/screenshots/truth/actions/send_email/editor/empty-body.png +0 -0
  88. package/screenshots/truth/actions/send_email/editor/empty-subject.png +0 -0
  89. package/screenshots/truth/actions/send_email/editor/long-subject.png +0 -0
  90. package/screenshots/truth/actions/send_email/editor/multiline-body.png +0 -0
  91. package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
  92. package/screenshots/truth/actions/send_email/editor/simple-email.png +0 -0
  93. package/screenshots/truth/actions/send_email/editor/with-expressions.png +0 -0
  94. package/screenshots/truth/actions/send_email/render/complex-business-email.png +0 -0
  95. package/screenshots/truth/actions/send_email/render/empty-body.png +0 -0
  96. package/screenshots/truth/actions/send_email/render/empty-subject.png +0 -0
  97. package/screenshots/truth/actions/send_email/render/long-subject.png +0 -0
  98. package/screenshots/truth/actions/send_email/render/multiline-body.png +0 -0
  99. package/screenshots/truth/actions/send_email/render/multiple-recipients.png +0 -0
  100. package/screenshots/truth/actions/send_email/render/simple-email.png +0 -0
  101. package/screenshots/truth/actions/send_email/render/with-expressions.png +0 -0
  102. package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
  103. package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
  104. package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
  105. package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
  106. package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
  107. package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
  108. package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
  109. package/screenshots/truth/actions/send_msg/render/long-quick-replies.png +0 -0
  110. package/screenshots/truth/actions/send_msg/render/multiline-text-with-replies.png +0 -0
  111. package/screenshots/truth/actions/send_msg/render/simple-text.png +0 -0
  112. package/screenshots/truth/actions/send_msg/render/text-with-linebreaks.png +0 -0
  113. package/screenshots/truth/actions/send_msg/render/text-with-many-quick-replies.png +0 -0
  114. package/screenshots/truth/actions/send_msg/render/text-with-quick-replies.png +0 -0
  115. package/screenshots/truth/actions/send_msg/render/text-without-quick-replies.png +0 -0
  116. package/screenshots/truth/editor/send_msg.png +0 -0
  117. package/screenshots/truth/editor/set_contact_language.png +0 -0
  118. package/screenshots/truth/editor/set_contact_name.png +0 -0
  119. package/screenshots/truth/editor/set_run_result.png +0 -0
  120. package/screenshots/truth/formfield/markdown-errors.png +0 -0
  121. package/screenshots/truth/formfield/no-errors.png +0 -0
  122. package/screenshots/truth/formfield/plain-text-errors.png +0 -0
  123. package/screenshots/truth/message-editor/autogrow-initial-content.png +0 -0
  124. package/screenshots/truth/message-editor/default.png +0 -0
  125. package/screenshots/truth/message-editor/drag-highlight.png +0 -0
  126. package/screenshots/truth/message-editor/filtered-attachments.png +0 -0
  127. package/screenshots/truth/message-editor/with-completion.png +0 -0
  128. package/screenshots/truth/message-editor/with-properties.png +0 -0
  129. package/screenshots/truth/sticky-note/blue-color.png +0 -0
  130. package/screenshots/truth/sticky-note/blue.png +0 -0
  131. package/screenshots/truth/sticky-note/color-picker-expanded.png +0 -0
  132. package/screenshots/truth/sticky-note/default.png +0 -0
  133. package/screenshots/truth/sticky-note/gray-color.png +0 -0
  134. package/screenshots/truth/sticky-note/gray.png +0 -0
  135. package/screenshots/truth/sticky-note/green-color.png +0 -0
  136. package/screenshots/truth/sticky-note/green.png +0 -0
  137. package/screenshots/truth/sticky-note/pink-color.png +0 -0
  138. package/screenshots/truth/sticky-note/pink.png +0 -0
  139. package/screenshots/truth/sticky-note/yellow-color.png +0 -0
  140. package/screenshots/truth/sticky-note/yellow.png +0 -0
  141. package/screenshots/truth/textinput/autogrow-initial.png +0 -0
  142. package/screenshots/truth/textinput/input-form.png +0 -0
  143. package/src/display/Thumbnail.ts +2 -1
  144. package/src/events.ts +6 -2
  145. package/src/flow/CanvasNode.ts +10 -2
  146. package/src/flow/NodeEditor.ts +269 -23
  147. package/src/flow/StickyNote.ts +1 -1
  148. package/src/flow/actions/call_webhook.ts +28 -18
  149. package/src/flow/actions/send_email.ts +1 -2
  150. package/src/flow/actions/send_msg.ts +178 -7
  151. package/src/flow/types.ts +21 -2
  152. package/src/form/ArrayEditor.ts +120 -42
  153. package/src/form/BaseListEditor.ts +22 -6
  154. package/src/form/FormField.ts +1 -1
  155. package/src/form/KeyValueEditor.ts +1 -1
  156. package/src/form/MediaPicker.ts +13 -1
  157. package/src/form/MessageEditor.ts +449 -0
  158. package/src/form/TextInput.ts +15 -7
  159. package/src/form/select/Select.ts +4 -4
  160. package/src/live/ContactChat.ts +32 -6
  161. package/src/store/flow-definition.d.ts +25 -4
  162. package/static/css/temba-components.css +2 -0
  163. package/static/mr/docs/en-us/editor.json +2588 -0
  164. package/stress-test.js +138 -0
  165. package/temba-modules.ts +2 -0
  166. package/test/temba-field-config.test.ts +4 -2
  167. package/test/temba-message-editor.test.ts +300 -0
  168. package/test/temba-node-editor.test.ts +94 -0
  169. package/test/temba-select.test.ts +1 -1
  170. package/test/temba-textinput.test.ts +26 -0
  171. package/test/temba-webchat.test.ts +5 -0
  172. package/test/utils.test.ts +2 -13
  173. package/test-assets/contacts/history.json +20 -2
  174. package/test-assets/style.css +2 -0
  175. package/web-dev-mock.mjs +433 -0
  176. package/web-dev-server.config.mjs +71 -6
  177. package/web-test-runner.config.mjs +9 -4
@@ -10,17 +10,27 @@
10
10
  "uuid": "a229fa3c-16bb-440b-9ae8-b7ee7a723f44",
11
11
  "actions": [
12
12
  {
13
+ "uuid": "3d56e4cf-1e88-499a-b0b4-ff48385fc9a5",
14
+ "type": "send_msg",
15
+ "text": "What is your favorite color?! @contact.uuid. It works.",
13
16
  "attachments": [
14
- "image:http://google.com/logo.png"
17
+ "image/jpeg:http://localhost:9000/temba-attachments/c4e84ebf-fdd7-439b-a2ca-aeb5e54dfc1d-IMG_3245.jpeg",
18
+ "image/jpeg:http://localhost:9000/temba-attachments/e7d4d3cd-ec89-45c2-bc0b-4f652f1f7fde-IMG_3262.jpeg",
19
+ "image/jpeg:http://localhost:9000/temba-attachments/ae831575-0d23-40b7-ae0c-531b8775a6bc-IMG_3282.jpeg",
20
+ "image/jpeg:http://localhost:9000/temba-attachments/837ac13b-e524-4a4c-9385-81873c5df138-IMG_3290.jpeg",
21
+ "image/jpeg:http://localhost:9000/temba-attachments/761e6345-3a19-49da-8a53-5c772d7739bc-IMG_3339.jpeg",
22
+ "image/jpeg:http://localhost:9000/temba-attachments/ea6b336d-4389-4d32-b58a-e5a138d13c84-IMG_3237.jpeg"
15
23
  ],
16
- "text": "What is your favorite color?",
17
- "type": "send_msg",
18
24
  "quick_replies": [
19
25
  "Red",
20
26
  "Green",
21
- "Blue"
22
- ],
23
- "uuid": "3d56e4cf-1e88-499a-b0b4-ff48385fc9a5"
27
+ "Blue",
28
+ "Yellow",
29
+ "Purple",
30
+ "@contact.first_name",
31
+ "@contact.uuid",
32
+ "@contact.last_name"
33
+ ]
24
34
  }
25
35
  ],
26
36
  "exits": [
@@ -135,7 +145,7 @@
135
145
  "Content-Type": "application/json",
136
146
  "Authorization": "Bearer token here"
137
147
  },
138
- "body": "@(json(object(\n \"contact\", object(\n \"uuid\", contact.uuid, \n \"name\", contact.name, \n \"urn\", contact.urn\n ),\n \"flow\", object(\n \"uuid\", run.flow.uuid, \n \"name\", run.flow.name\n ),\n \"results\", foreach_value(results, extract_object, \"value\", \"category\")\n)))"
148
+ "body": "@(json(object(\n \"contact\", object(\n \"uuid\", contact.uuid, \n \"name\", contact.name, \n \"urn\", contact.urn\n ),\n \"flow\", object(\n \"uuid\", run.flow.uuid, \n \"name\", run.flow.name\n ),\n \"results\", foreach_value(results, extract_object, \"value\", \"category\")\n)))ast"
139
149
  }
140
150
  ],
141
151
  "router": {
@@ -185,9 +195,15 @@
185
195
  "uuid": "9963160a-a007-4c7b-8c9e-7325e1b69ed8",
186
196
  "type": "send_msg",
187
197
  "text": "Excellent choices.",
198
+ "attachments": [
199
+ "audio:http://arst",
200
+ "image:@contact.first_name"
201
+ ],
188
202
  "quick_replies": [
189
- "blooooop",
190
- "bleep"
203
+ "Red",
204
+ "Green",
205
+ "Blue",
206
+ "@contact.name"
191
207
  ]
192
208
  },
193
209
  {
@@ -798,7 +814,7 @@
798
814
  "nodes": {
799
815
  "a229fa3c-16bb-440b-9ae8-b7ee7a723f44": {
800
816
  "position": {
801
- "left": 260,
817
+ "left": 240,
802
818
  "top": 0
803
819
  },
804
820
  "type": "execute_actions"
@@ -806,8 +822,8 @@
806
822
  "ef1a5b06-1331-4c0d-9f46-58b1e5baf671": {
807
823
  "type": "wait_for_response",
808
824
  "position": {
809
- "left": 260,
810
- "top": 160
825
+ "left": 220,
826
+ "top": 260
811
827
  },
812
828
  "config": {
813
829
  "cases": {}
@@ -816,15 +832,15 @@
816
832
  "e1f22e97-a170-44b4-a79b-98ab916f4c34": {
817
833
  "type": "split_by_webhook",
818
834
  "position": {
819
- "left": 800,
820
- "top": 0
835
+ "left": 700,
836
+ "top": 20
821
837
  },
822
838
  "config": {}
823
839
  },
824
840
  "4efc49e0-ebfe-454d-a1a0-900a911dd5ef": {
825
841
  "position": {
826
- "left": 240,
827
- "top": 340
842
+ "left": 220,
843
+ "top": 440
828
844
  },
829
845
  "type": "execute_actions"
830
846
  },
@@ -887,8 +903,8 @@
887
903
  "5f1394c1-4b8c-4357-8863-db24817b2aa3": {
888
904
  "type": "split_by_groups",
889
905
  "position": {
890
- "left": 500,
891
- "top": 360
906
+ "left": 520,
907
+ "top": 380
892
908
  },
893
909
  "config": {
894
910
  "cases": {}
@@ -907,14 +923,14 @@
907
923
  "3dfe9cf2-72d1-496f-8d20-d5743af0f9c8": {
908
924
  "type": "split_by_llm",
909
925
  "position": {
910
- "left": 580,
911
- "top": 1040
926
+ "left": 520,
927
+ "top": 1020
912
928
  },
913
929
  "config": {}
914
930
  },
915
931
  "425c4757-bead-440f-92aa-a1cc3fcd7d35": {
916
932
  "position": {
917
- "left": 620,
933
+ "left": 760,
918
934
  "top": 840
919
935
  },
920
936
  "type": "execute_actions"
@@ -922,8 +938,8 @@
922
938
  "21ff86c2-5276-4448-afb6-54d1f832ba0c": {
923
939
  "type": "split_by_ticket",
924
940
  "position": {
925
- "left": 920,
926
- "top": 900
941
+ "left": 820,
942
+ "top": 980
927
943
  },
928
944
  "config": {}
929
945
  }
@@ -950,7 +966,7 @@
950
966
  "598a87e4-f20b-48ba-aac5-bb365d8f1501": {
951
967
  "position": {
952
968
  "left": 0,
953
- "top": 720
969
+ "top": 780
954
970
  },
955
971
  "title": "Green Note",
956
972
  "body": "They also come in green, do I like them better? Maybe I do. There is a standard height, they will have to get used to it.",
package/demo/index.html CHANGED
@@ -175,7 +175,7 @@
175
175
  A work in progress editor for RapidPro flows to replace existing
176
176
  react editor.
177
177
  </p>
178
- <a href="components/flow/example.html">Example</a>
178
+ <a href="components/flow/index.html">Examples</a>
179
179
  </div>
180
180
 
181
181
  <div class="component-card">