@nyaruka/temba-components 0.134.6 → 0.136.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 (76) hide show
  1. package/.github/workflows/publish.yml +16 -8
  2. package/CHANGELOG.md +84 -0
  3. package/demo/components/webchat/example.html +4 -2
  4. package/dist/static/svg/index.svg +1 -1
  5. package/dist/temba-components.js +1346 -334
  6. package/dist/temba-components.js.map +1 -1
  7. package/out-tsc/src/Icons.js +2 -1
  8. package/out-tsc/src/Icons.js.map +1 -1
  9. package/out-tsc/src/display/Chat.js +7 -2
  10. package/out-tsc/src/display/Chat.js.map +1 -1
  11. package/out-tsc/src/display/Thumbnail.js +65 -8
  12. package/out-tsc/src/display/Thumbnail.js.map +1 -1
  13. package/out-tsc/src/flow/CanvasNode.js +11 -0
  14. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  15. package/out-tsc/src/flow/Editor.js +224 -2
  16. package/out-tsc/src/flow/Editor.js.map +1 -1
  17. package/out-tsc/src/flow/Plumber.js +320 -1
  18. package/out-tsc/src/flow/Plumber.js.map +1 -1
  19. package/out-tsc/src/interfaces.js +1 -0
  20. package/out-tsc/src/interfaces.js.map +1 -1
  21. package/out-tsc/src/layout/FloatingWindow.js +30 -8
  22. package/out-tsc/src/layout/FloatingWindow.js.map +1 -1
  23. package/out-tsc/src/simulator/Simulator.js +1827 -0
  24. package/out-tsc/src/simulator/Simulator.js.map +1 -0
  25. package/out-tsc/src/store/AppState.js +33 -0
  26. package/out-tsc/src/store/AppState.js.map +1 -1
  27. package/out-tsc/src/utils.js +55 -6
  28. package/out-tsc/src/utils.js.map +1 -1
  29. package/out-tsc/temba-modules.js +2 -0
  30. package/out-tsc/temba-modules.js.map +1 -1
  31. package/out-tsc/test/temba-flow-editor.test.js +1 -1
  32. package/out-tsc/test/temba-flow-editor.test.js.map +1 -1
  33. package/out-tsc/test/temba-flow-plumber-connections.test.js +3 -1
  34. package/out-tsc/test/temba-flow-plumber-connections.test.js.map +1 -1
  35. package/out-tsc/test/temba-flow-plumber.test.js +3 -1
  36. package/out-tsc/test/temba-flow-plumber.test.js.map +1 -1
  37. package/out-tsc/test/temba-simulator.test.js +642 -0
  38. package/out-tsc/test/temba-simulator.test.js.map +1 -0
  39. package/out-tsc/test/temba-thumbnail.test.js +120 -0
  40. package/out-tsc/test/temba-thumbnail.test.js.map +1 -0
  41. package/out-tsc/test/temba-utils-index.test.js +12 -6
  42. package/out-tsc/test/temba-utils-index.test.js.map +1 -1
  43. package/out-tsc/test/utils.test.js +1 -1
  44. package/out-tsc/test/utils.test.js.map +1 -1
  45. package/package.json +1 -1
  46. package/screenshots/truth/simulator/after-message-sent.png +0 -0
  47. package/screenshots/truth/simulator/after-reset.png +0 -0
  48. package/screenshots/truth/simulator/attachment-menu.png +0 -0
  49. package/screenshots/truth/simulator/context-expanded.png +0 -0
  50. package/screenshots/truth/simulator/context-explorer-open.png +0 -0
  51. package/screenshots/truth/simulator/event-info.png +0 -0
  52. package/screenshots/truth/simulator/image-attachment.png +0 -0
  53. package/screenshots/truth/simulator/open-initial.png +0 -0
  54. package/screenshots/truth/simulator/quick-replies.png +0 -0
  55. package/src/Icons.ts +2 -1
  56. package/src/display/Chat.ts +10 -1
  57. package/src/display/Thumbnail.ts +67 -8
  58. package/src/flow/CanvasNode.ts +12 -0
  59. package/src/flow/Editor.ts +240 -1
  60. package/src/flow/Plumber.ts +371 -2
  61. package/src/interfaces.ts +2 -1
  62. package/src/layout/FloatingWindow.ts +36 -11
  63. package/src/simulator/Simulator.ts +2008 -0
  64. package/src/store/AppState.ts +53 -0
  65. package/src/utils.ts +59 -6
  66. package/static/svg/index.svg +1 -1
  67. package/static/svg/work/traced/route.svg +1 -0
  68. package/static/svg/work/used/route.svg +3 -0
  69. package/temba-modules.ts +2 -0
  70. package/test/temba-flow-editor.test.ts +1 -1
  71. package/test/temba-flow-plumber-connections.test.ts +4 -1
  72. package/test/temba-flow-plumber.test.ts +4 -1
  73. package/test/temba-simulator.test.ts +866 -0
  74. package/test/temba-thumbnail.test.ts +150 -0
  75. package/test/temba-utils-index.test.ts +14 -6
  76. package/test/utils.test.ts +1 -1
@@ -0,0 +1 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.115 1.133 C 2.696 1.471,1.633 2.478,1.181 3.914 C 0.936 4.690,0.923 4.940,1.088 5.726 C 1.460 7.499,2.897 8.803,4.614 8.927 C 6.021 9.029,6.796 8.745,7.768 7.773 C 8.690 6.851,8.958 6.199,8.959 4.871 C 8.961 3.418,7.848 1.809,6.480 1.286 C 5.895 1.062,4.728 0.987,4.115 1.133 M6.096 3.406 C 7.120 4.095,7.251 5.524,6.372 6.404 C 5.480 7.295,4.019 7.123,3.364 6.050 C 2.244 4.213,4.316 2.208,6.096 3.406 M10.920 4.236 C 10.375 4.633,10.456 5.444,11.091 5.942 C 11.107 5.955,12.293 6.009,13.726 6.062 C 16.491 6.166,16.632 6.211,16.638 6.988 C 16.641 7.448,15.690 8.236,11.840 10.960 C 5.191 15.664,4.940 15.895,4.836 17.416 C 4.781 18.216,4.831 18.405,5.272 19.065 C 6.043 20.217,6.559 20.369,9.970 20.447 C 12.518 20.505,12.853 20.482,13.130 20.231 C 13.504 19.892,13.534 19.157,13.189 18.811 C 12.991 18.614,12.553 18.558,11.149 18.552 C 8.766 18.541,7.214 18.359,7.031 18.070 C 6.729 17.594,6.883 17.143,7.537 16.582 C 7.898 16.273,10.113 14.651,12.459 12.978 C 14.805 11.304,17.032 9.672,17.408 9.350 C 18.968 8.015,19.151 6.319,17.877 4.998 C 17.180 4.276,16.607 4.144,13.760 4.053 C 11.631 3.985,11.229 4.011,10.920 4.236 M17.840 15.168 C 16.626 15.596,15.476 16.734,15.192 17.789 C 14.564 20.122,15.936 22.423,18.241 22.904 C 21.670 23.620,24.304 19.567,22.260 16.721 C 21.521 15.692,20.481 15.135,19.219 15.092 C 18.637 15.072,18.016 15.106,17.840 15.168 M19.762 17.190 C 20.837 17.640,21.287 19.101,20.649 20.069 C 19.758 21.421,17.803 21.227,17.175 19.725 C 16.644 18.454,17.522 17.139,19.005 16.982 C 19.118 16.970,19.458 17.064,19.762 17.190 " stroke="none" fill-rule="evenodd" fill="black"></path></svg>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M11.5 5H11.9344C14.9816 5 16.5053 5 17.0836 5.54729C17.5836 6.02037 17.8051 6.71728 17.6702 7.39221C17.514 8.17302 16.2701 9.05285 13.7823 10.8125L9.71772 13.6875C7.2299 15.4471 5.98599 16.327 5.82984 17.1078C5.69486 17.7827 5.91642 18.4796 6.41636 18.9527C6.99474 19.5 8.51836 19.5 11.5656 19.5H12.5M8 5C8 6.65685 6.65685 8 5 8C3.34315 8 2 6.65685 2 5C2 3.34315 3.34315 2 5 2C6.65685 2 8 3.34315 8 5ZM22 19C22 20.6569 20.6569 22 19 22C17.3431 22 16 20.6569 16 19C16 17.3431 17.3431 16 19 16C20.6569 16 22 17.3431 22 19Z" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
package/temba-modules.ts CHANGED
@@ -76,6 +76,7 @@ import { MessageEditor } from './src/form/MessageEditor';
76
76
  import './src/form/BaseListEditor'; // Import base class
77
77
  import { FloatingTab } from './src/display/FloatingTab';
78
78
  import { FloatingWindow } from './src/layout/FloatingWindow';
79
+ import { Simulator } from './src/simulator/Simulator';
79
80
 
80
81
  export function addCustomElement(name: string, comp: any) {
81
82
  if (!window.customElements.get(name)) {
@@ -162,3 +163,4 @@ addCustomElement('temba-array-editor', TembaArrayEditor);
162
163
  addCustomElement('temba-message-editor', MessageEditor);
163
164
  addCustomElement('temba-floating-tab', FloatingTab);
164
165
  addCustomElement('temba-floating-window', FloatingWindow);
166
+ addCustomElement('temba-simulator', Simulator);
@@ -79,7 +79,7 @@ describe('Editor', () => {
79
79
  // Test that calling firstUpdated doesn't throw (without getStore)
80
80
  expect(() => {
81
81
  // Only test the plumber initialization part
82
- (editor as any).plumber = new Plumber(mockCanvas);
82
+ (editor as any).plumber = new Plumber(mockCanvas, editor);
83
83
  }).to.not.throw();
84
84
  });
85
85
 
@@ -16,8 +16,11 @@ describe('Plumber - Connection Management', () => {
16
16
  const mockElement = document.createElement('div');
17
17
  stub(document, 'getElementById').returns(mockElement);
18
18
 
19
+ // Create a mock editor with fireCustomEvent
20
+ const mockEditor = { fireCustomEvent: stub() };
21
+
19
22
  // Create a new plumber instance
20
- plumber = new Plumber(mockCanvas);
23
+ plumber = new Plumber(mockCanvas, mockEditor);
21
24
 
22
25
  // Replace the internal jsPlumb instance with mocks
23
26
  (plumber as any).jsPlumb = {
@@ -17,8 +17,11 @@ describe('Plumber', () => {
17
17
  const mockElement = document.createElement('div');
18
18
  stub(document, 'getElementById').returns(mockElement);
19
19
 
20
+ // Create a mock editor with fireCustomEvent
21
+ const mockEditor = { fireCustomEvent: stub() };
22
+
20
23
  // Create a new plumber instance
21
- plumber = new Plumber(mockCanvas);
24
+ plumber = new Plumber(mockCanvas, mockEditor);
22
25
 
23
26
  // Replace the internal jsPlumb instance with mocks
24
27
  mockJsPlumb = {