@nyaruka/temba-components 0.130.3 → 0.130.5

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 (99) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/demo/sortable-rules-demo.html +155 -0
  3. package/dist/temba-components.js +133 -143
  4. package/dist/temba-components.js.map +1 -1
  5. package/out-tsc/src/events.js.map +1 -1
  6. package/out-tsc/src/flow/CanvasNode.js +13 -7
  7. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  8. package/out-tsc/src/flow/actions/send_msg.js +1 -0
  9. package/out-tsc/src/flow/actions/send_msg.js.map +1 -1
  10. package/out-tsc/src/flow/nodes/split_by_groups.js +149 -1
  11. package/out-tsc/src/flow/nodes/split_by_groups.js.map +1 -1
  12. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +1 -0
  13. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -1
  14. package/out-tsc/src/flow/nodes/wait_for_response.js +81 -75
  15. package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
  16. package/out-tsc/src/form/ArrayEditor.js +106 -28
  17. package/out-tsc/src/form/ArrayEditor.js.map +1 -1
  18. package/out-tsc/src/form/select/Select.js +21 -25
  19. package/out-tsc/src/form/select/Select.js.map +1 -1
  20. package/out-tsc/src/list/SortableList.js +214 -140
  21. package/out-tsc/src/list/SortableList.js.map +1 -1
  22. package/out-tsc/src/live/ContactChat.js +18 -13
  23. package/out-tsc/src/live/ContactChat.js.map +1 -1
  24. package/out-tsc/test/nodes/split_by_groups.test.js +130 -0
  25. package/out-tsc/test/nodes/split_by_groups.test.js.map +1 -0
  26. package/out-tsc/test/nodes/wait_for_response.test.js +149 -0
  27. package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -1
  28. package/out-tsc/test/temba-field-config.test.js +56 -0
  29. package/out-tsc/test/temba-field-config.test.js.map +1 -1
  30. package/package.json +1 -1
  31. package/screenshots/truth/actions/add_contact_groups/render/descriptive-group-names.png +0 -0
  32. package/screenshots/truth/actions/add_contact_groups/render/long-group-names.png +0 -0
  33. package/screenshots/truth/actions/add_contact_groups/render/many-groups.png +0 -0
  34. package/screenshots/truth/actions/add_contact_groups/render/multiple-groups.png +0 -0
  35. package/screenshots/truth/actions/add_contact_groups/render/single-group.png +0 -0
  36. package/screenshots/truth/actions/remove_contact_groups/render/cleanup-groups.png +0 -0
  37. package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
  38. package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
  39. package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
  40. package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
  41. package/screenshots/truth/actions/remove_contact_groups/render/single-group.png +0 -0
  42. package/screenshots/truth/actions/send_email/render/complex-business-email.png +0 -0
  43. package/screenshots/truth/actions/send_email/render/empty-body.png +0 -0
  44. package/screenshots/truth/actions/send_email/render/empty-subject.png +0 -0
  45. package/screenshots/truth/actions/send_email/render/multiline-body.png +0 -0
  46. package/screenshots/truth/actions/send_email/render/multiple-recipients.png +0 -0
  47. package/screenshots/truth/actions/send_email/render/simple-email.png +0 -0
  48. package/screenshots/truth/actions/send_email/render/with-expressions.png +0 -0
  49. package/screenshots/truth/actions/send_msg/render/long-quick-replies.png +0 -0
  50. package/screenshots/truth/actions/send_msg/render/multiline-text-with-replies.png +0 -0
  51. package/screenshots/truth/actions/send_msg/render/simple-text.png +0 -0
  52. package/screenshots/truth/actions/send_msg/render/text-with-linebreaks.png +0 -0
  53. package/screenshots/truth/actions/send_msg/render/text-with-many-quick-replies.png +0 -0
  54. package/screenshots/truth/actions/send_msg/render/text-with-quick-replies.png +0 -0
  55. package/screenshots/truth/actions/send_msg/render/text-without-quick-replies.png +0 -0
  56. package/screenshots/truth/contacts/chat-failure.png +0 -0
  57. package/screenshots/truth/contacts/chat-for-archived-contact.png +0 -0
  58. package/screenshots/truth/contacts/chat-for-blocked-contact.png +0 -0
  59. package/screenshots/truth/contacts/chat-for-stopped-contact.png +0 -0
  60. package/screenshots/truth/contacts/chat-sends-attachments-only.png +0 -0
  61. package/screenshots/truth/contacts/chat-sends-text-and-attachments.png +0 -0
  62. package/screenshots/truth/contacts/chat-sends-text-only.png +0 -0
  63. package/screenshots/truth/editor/wait.png +0 -0
  64. package/screenshots/truth/field-renderer/select-with-label.png +0 -0
  65. package/screenshots/truth/list/fields-dragging.png +0 -0
  66. package/screenshots/truth/list/sortable-dragging.png +0 -0
  67. package/screenshots/truth/nodes/split_by_llm/editor/information-extraction.png +0 -0
  68. package/screenshots/truth/nodes/split_by_llm/editor/sentiment-analysis.png +0 -0
  69. package/screenshots/truth/nodes/split_by_llm/editor/summarization.png +0 -0
  70. package/screenshots/truth/nodes/split_by_llm/editor/translation-task.png +0 -0
  71. package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
  72. package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
  73. package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
  74. package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
  75. package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
  76. package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
  77. package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
  78. package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
  79. package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
  80. package/screenshots/truth/select/search-enabled.png +0 -0
  81. package/screenshots/truth/select/search-selected-focus.png +0 -0
  82. package/screenshots/truth/select/search-selected.png +0 -0
  83. package/screenshots/truth/templates/default.png +0 -0
  84. package/screenshots/truth/templates/unapproved.png +0 -0
  85. package/src/events.ts +6 -6
  86. package/src/flow/CanvasNode.ts +15 -13
  87. package/src/flow/actions/send_msg.ts +1 -0
  88. package/src/flow/nodes/split_by_groups.ts +190 -1
  89. package/src/flow/nodes/split_by_llm_categorize.ts +1 -0
  90. package/src/flow/nodes/wait_for_response.ts +98 -74
  91. package/src/form/ArrayEditor.ts +112 -28
  92. package/src/form/select/Select.ts +24 -25
  93. package/src/list/SortableList.ts +250 -149
  94. package/src/live/ContactChat.ts +20 -13
  95. package/test/nodes/split_by_groups.test.ts +165 -0
  96. package/test/nodes/wait_for_response.test.ts +182 -0
  97. package/test/temba-field-config.test.ts +69 -0
  98. package/test-assets/contacts/history.json +37 -35
  99. package/screenshots/truth/contacts/chat-for-active-contact.png +0 -0
package/CHANGELOG.md CHANGED
@@ -4,8 +4,30 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v0.130.5](https://github.com/nyaruka/temba-components/compare/v0.130.4...v0.130.5)
8
+
9
+ - Tweak msg event payload for chat history [`#704`](https://github.com/nyaruka/temba-components/pull/704)
10
+ - Add split by groups [`#699`](https://github.com/nyaruka/temba-components/pull/699)
11
+ - Some tweaks for smoother dragging [`#701`](https://github.com/nyaruka/temba-components/pull/701)
12
+ - Switch to cloned dragged items [`#700`](https://github.com/nyaruka/temba-components/pull/700)
13
+ - Show select fetching status [`#698`](https://github.com/nyaruka/temba-components/pull/698)
14
+ - Add sorting for wait for response [`#695`](https://github.com/nyaruka/temba-components/pull/695)
15
+ - Sortable rules wip [`f1af831`](https://github.com/nyaruka/temba-components/commit/f1af8312a136d0c3437e37ef75bee5dcdb9bd670)
16
+ - Use the original element for dragging [`54e1cae`](https://github.com/nyaruka/temba-components/commit/54e1cae6da0ce57cd0821a9e4815efbb0c4dddbc)
17
+ - Maintain order for like-named categories [`7149dc7`](https://github.com/nyaruka/temba-components/commit/7149dc778b54ddd1f8d25eddebeb442faef02b92)
18
+
19
+ #### [v0.130.4](https://github.com/nyaruka/temba-components/compare/v0.130.3...v0.130.4)
20
+
21
+ > 24 September 2025
22
+
23
+ - Fix rendering of `ivr_created` events [`#697`](https://github.com/nyaruka/temba-components/pull/697)
24
+ - Update chat history test with more realistic event data [`#696`](https://github.com/nyaruka/temba-components/pull/696)
25
+ - Fix rendering of ivr_created events in chat history [`261f082`](https://github.com/nyaruka/temba-components/commit/261f082a6d8fbdc2244a1e59fa07a49f33439c36)
26
+
7
27
  #### [v0.130.3](https://github.com/nyaruka/temba-components/compare/v0.130.2...v0.130.3)
8
28
 
29
+ > 23 September 2025
30
+
9
31
  - Remove support for legacy ticket events [`#694`](https://github.com/nyaruka/temba-components/pull/694)
10
32
 
11
33
  #### [v0.130.2](https://github.com/nyaruka/temba-components/compare/v0.130.1...v0.130.2)
@@ -0,0 +1,155 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Sortable Rules Demo</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ max-width: 800px;
11
+ margin: 0 auto;
12
+ padding: 20px;
13
+ }
14
+ .demo-section {
15
+ margin: 20px 0;
16
+ padding: 20px;
17
+ border: 1px solid #ddd;
18
+ border-radius: 8px;
19
+ }
20
+ </style>
21
+ </head>
22
+ <body>
23
+ <h1>Sortable Rules Demo</h1>
24
+
25
+ <div class="demo-section">
26
+ <h2>Sortable Array Editor</h2>
27
+ <p>
28
+ This demonstrates sortable functionality in array editor with drag and
29
+ drop support:
30
+ </p>
31
+
32
+ <temba-array-editor
33
+ itemLabel="Rule"
34
+ sortable="true"
35
+ maintainEmptyItem="true"
36
+ ></temba-array-editor>
37
+
38
+ <script>
39
+ // Set up the array editor with initial data and item config
40
+ const arrayEditor = document.querySelector('temba-array-editor');
41
+
42
+ arrayEditor.itemConfig = {
43
+ operator: {
44
+ type: 'select',
45
+ required: true,
46
+ multi: false,
47
+ options: [
48
+ { value: 'has_any_word', name: 'has any of the words' },
49
+ { value: 'has_phrase', name: 'has the phrase' },
50
+ { value: 'has_only_phrase', name: 'has only the phrase' },
51
+ { value: 'has_number', name: 'has a number' },
52
+ { value: 'has_number_lt', name: 'has a number below' },
53
+ { value: 'has_number_eq', name: 'has a number equal to' },
54
+ { value: 'has_number_gt', name: 'has a number above' }
55
+ ],
56
+ flavor: 'xsmall',
57
+ width: '200px'
58
+ },
59
+ value1: {
60
+ type: 'text',
61
+ flavor: 'xsmall'
62
+ },
63
+ category: {
64
+ type: 'text',
65
+ placeholder: 'Category',
66
+ required: true,
67
+ maxWidth: '120px',
68
+ flavor: 'xsmall'
69
+ }
70
+ };
71
+
72
+ arrayEditor.value = [
73
+ {
74
+ operator: { value: 'has_any_word', name: 'has any of the words' },
75
+ value1: 'yes sure',
76
+ category: 'Yes'
77
+ },
78
+ {
79
+ operator: { value: 'has_any_word', name: 'has any of the words' },
80
+ value1: 'no never',
81
+ category: 'No'
82
+ },
83
+ {
84
+ operator: { value: 'has_number', name: 'has a number' },
85
+ value1: '',
86
+ category: 'Numbers'
87
+ }
88
+ ];
89
+
90
+ arrayEditor.addEventListener('change', (e) => {
91
+ console.log('Array changed:', e.detail.value);
92
+ });
93
+ </script>
94
+ </div>
95
+
96
+ <div class="demo-section">
97
+ <h2>Non-Sortable Array Editor (for comparison)</h2>
98
+ <p>This is the same array editor without sortable functionality:</p>
99
+
100
+ <temba-array-editor
101
+ itemLabel="Rule"
102
+ sortable="false"
103
+ maintainEmptyItem="true"
104
+ ></temba-array-editor>
105
+
106
+ <script>
107
+ // Set up the non-sortable array editor
108
+ const nonSortableEditor =
109
+ document.querySelectorAll('temba-array-editor')[1];
110
+
111
+ nonSortableEditor.itemConfig = {
112
+ operator: {
113
+ type: 'select',
114
+ required: true,
115
+ multi: false,
116
+ options: [
117
+ { value: 'has_any_word', name: 'has any of the words' },
118
+ { value: 'has_phrase', name: 'has the phrase' },
119
+ { value: 'has_only_phrase', name: 'has only the phrase' },
120
+ { value: 'has_number', name: 'has a number' }
121
+ ],
122
+ flavor: 'xsmall',
123
+ width: '200px'
124
+ },
125
+ value1: {
126
+ type: 'text',
127
+ flavor: 'xsmall'
128
+ },
129
+ category: {
130
+ type: 'text',
131
+ placeholder: 'Category',
132
+ required: true,
133
+ maxWidth: '120px',
134
+ flavor: 'xsmall'
135
+ }
136
+ };
137
+
138
+ nonSortableEditor.value = [
139
+ {
140
+ operator: { value: 'has_any_word', name: 'has any of the words' },
141
+ value1: 'yes sure',
142
+ category: 'Yes'
143
+ },
144
+ {
145
+ operator: { value: 'has_any_word', name: 'has any of the words' },
146
+ value1: 'no never',
147
+ category: 'No'
148
+ }
149
+ ];
150
+ </script>
151
+ </div>
152
+
153
+ <script type="module" src="../src/temba-components.js"></script>
154
+ </body>
155
+ </html>