@nyaruka/temba-components 0.29.0 → 0.30.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 (170) hide show
  1. package/.eslintrc.js +1 -0
  2. package/.yarnrc +1 -1
  3. package/.yarnrc.yml +1 -0
  4. package/CHANGELOG.md +105 -57
  5. package/dist/{64e63814.js → dd72d92e.js} +305 -148
  6. package/dist/index.js +305 -148
  7. package/dist/static/icons/symbol-defs.svg +10 -20
  8. package/dist/sw.js +1 -1
  9. package/dist/sw.js.map +1 -1
  10. package/dist/templates/components-body.html +1 -1
  11. package/dist/templates/components-head.html +1 -1
  12. package/dist/workbox-80efdfd1.js.map +1 -1
  13. package/out-tsc/src/contacts/ContactBadges.js +2 -9
  14. package/out-tsc/src/contacts/ContactBadges.js.map +1 -1
  15. package/out-tsc/src/contacts/ContactChat.js +3 -0
  16. package/out-tsc/src/contacts/ContactChat.js.map +1 -1
  17. package/out-tsc/src/contacts/ContactName.js +19 -16
  18. package/out-tsc/src/contacts/ContactName.js.map +1 -1
  19. package/out-tsc/src/contacts/ContactNameFetch.js +36 -0
  20. package/out-tsc/src/contacts/ContactNameFetch.js.map +1 -0
  21. package/out-tsc/src/contacts/ContactStoreElement.js +9 -2
  22. package/out-tsc/src/contacts/ContactStoreElement.js.map +1 -1
  23. package/out-tsc/src/contacts/ContactUrn.js +12 -1
  24. package/out-tsc/src/contacts/ContactUrn.js.map +1 -1
  25. package/out-tsc/src/contacts/events.js +0 -3
  26. package/out-tsc/src/contacts/events.js.map +1 -1
  27. package/out-tsc/src/flow/FlowStoreElement.js +43 -0
  28. package/out-tsc/src/flow/FlowStoreElement.js.map +1 -0
  29. package/out-tsc/src/interfaces.js.map +1 -1
  30. package/out-tsc/src/label/Label.js +29 -42
  31. package/out-tsc/src/label/Label.js.map +1 -1
  32. package/out-tsc/src/list/RunList.js +317 -0
  33. package/out-tsc/src/list/RunList.js.map +1 -0
  34. package/out-tsc/src/list/TembaList.js +38 -14
  35. package/out-tsc/src/list/TembaList.js.map +1 -1
  36. package/out-tsc/src/options/Options.js +18 -2
  37. package/out-tsc/src/options/Options.js.map +1 -1
  38. package/out-tsc/src/slider/TembaSlider.js +9 -1
  39. package/out-tsc/src/slider/TembaSlider.js.map +1 -1
  40. package/out-tsc/src/sms/gsmvalidator.js +9 -138
  41. package/out-tsc/src/sms/gsmvalidator.js.map +1 -1
  42. package/out-tsc/src/store/Store.js +13 -3
  43. package/out-tsc/src/store/Store.js.map +1 -1
  44. package/out-tsc/src/tabpane/TabPane.js +3 -1
  45. package/out-tsc/src/tabpane/TabPane.js.map +1 -1
  46. package/out-tsc/src/utils/index.js +1 -0
  47. package/out-tsc/src/utils/index.js.map +1 -1
  48. package/out-tsc/src/vectoricon/VectorIcon.js +6 -11
  49. package/out-tsc/src/vectoricon/VectorIcon.js.map +1 -1
  50. package/out-tsc/temba-components.js +1 -2
  51. package/out-tsc/temba-components.js.map +1 -1
  52. package/out-tsc/temba-modules.js +7 -1
  53. package/out-tsc/temba-modules.js.map +1 -1
  54. package/out-tsc/test/MouseHelper.js +47 -0
  55. package/out-tsc/test/MouseHelper.js.map +1 -0
  56. package/out-tsc/test/temba-contact-badges.test.js +23 -0
  57. package/out-tsc/test/temba-contact-badges.test.js.map +1 -0
  58. package/out-tsc/test/temba-contact-chat.test.js +111 -7
  59. package/out-tsc/test/temba-contact-chat.test.js.map +1 -1
  60. package/out-tsc/test/temba-contact-history.test.js +6 -6
  61. package/out-tsc/test/temba-contact-history.test.js.map +1 -1
  62. package/out-tsc/test/temba-dialog.test.js +1 -1
  63. package/out-tsc/test/temba-dialog.test.js.map +1 -1
  64. package/out-tsc/test/temba-label.test.js +66 -0
  65. package/out-tsc/test/temba-label.test.js.map +1 -0
  66. package/out-tsc/test/temba-list.test.js +1 -1
  67. package/out-tsc/test/temba-list.test.js.map +1 -1
  68. package/out-tsc/test/temba-menu.test.js +1 -1
  69. package/out-tsc/test/temba-menu.test.js.map +1 -1
  70. package/out-tsc/test/temba-select.test.js +1 -6
  71. package/out-tsc/test/temba-select.test.js.map +1 -1
  72. package/out-tsc/test/temba-slider.test.js +151 -8
  73. package/out-tsc/test/temba-slider.test.js.map +1 -1
  74. package/out-tsc/test/temba-textinput.test.js +3 -4
  75. package/out-tsc/test/temba-textinput.test.js.map +1 -1
  76. package/out-tsc/test/temba-tip.test.js +1 -1
  77. package/out-tsc/test/temba-tip.test.js.map +1 -1
  78. package/out-tsc/test/utils.test.js +26 -14
  79. package/out-tsc/test/utils.test.js.map +1 -1
  80. package/package.json +5 -4
  81. package/screenshots/truth/contacts/badges.png +0 -0
  82. package/screenshots/truth/contacts/contact-active-default.png +0 -0
  83. package/screenshots/truth/contacts/contact-active-show-chat-history.png +0 -0
  84. package/screenshots/truth/contacts/contact-active-show-chat-msg.png +0 -0
  85. package/screenshots/truth/contacts/contact-archived-hide-chat-msg.png +0 -0
  86. package/screenshots/truth/contacts/contact-archived-show-chat-history.png +0 -0
  87. package/screenshots/truth/contacts/contact-blocked-hide-chat-msg.png +0 -0
  88. package/screenshots/truth/contacts/contact-blocked-show-chat-history.png +0 -0
  89. package/screenshots/truth/contacts/contact-stopped-hide-chat-msg.png +0 -0
  90. package/screenshots/truth/contacts/contact-stopped-show-chat-history.png +0 -0
  91. package/screenshots/truth/contacts/history-expanded.png +0 -0
  92. package/screenshots/truth/contacts/history.png +0 -0
  93. package/screenshots/truth/label/custom.png +0 -0
  94. package/screenshots/truth/label/danger.png +0 -0
  95. package/screenshots/truth/label/dark.png +0 -0
  96. package/screenshots/truth/label/default-icon.png +0 -0
  97. package/screenshots/truth/label/no-icon.png +0 -0
  98. package/screenshots/truth/label/primary.png +0 -0
  99. package/screenshots/truth/label/secondary.png +0 -0
  100. package/screenshots/truth/label/shadow.png +0 -0
  101. package/screenshots/truth/label/tertiary.png +0 -0
  102. package/screenshots/truth/slider/custom-min-custom-max-valid-value.png +0 -0
  103. package/screenshots/truth/slider/custom-min-default-max-no-value.png +0 -0
  104. package/screenshots/truth/slider/default-min-custom-max-no-value.png +0 -0
  105. package/screenshots/truth/slider/default-min-default-max-invalid-value.png +0 -0
  106. package/screenshots/truth/slider/default-min-default-max-valid-value.png +0 -0
  107. package/screenshots/truth/slider/default.png +0 -0
  108. package/screenshots/truth/slider/no-visible-range-invalid-value.png +0 -0
  109. package/screenshots/truth/slider/no-visible-range-no-value.png +0 -0
  110. package/screenshots/truth/slider/no-visible-range-valid-value.png +0 -0
  111. package/screenshots/truth/slider/update-slider-on-circle-dragged.png +0 -0
  112. package/screenshots/truth/slider/update-slider-on-track-clicked.png +0 -0
  113. package/screenshots/truth/slider/update-slider-on-value-change.png +0 -0
  114. package/src/contacts/ContactBadges.ts +2 -9
  115. package/src/contacts/ContactChat.ts +3 -0
  116. package/src/contacts/ContactName.ts +19 -17
  117. package/src/contacts/ContactNameFetch.ts +32 -0
  118. package/src/contacts/ContactStoreElement.ts +5 -2
  119. package/src/contacts/ContactUrn.ts +12 -1
  120. package/src/contacts/events.ts +0 -3
  121. package/src/flow/FlowStoreElement.ts +42 -0
  122. package/src/interfaces.ts +19 -0
  123. package/src/label/Label.ts +31 -43
  124. package/src/list/RunList.ts +353 -0
  125. package/src/list/TembaList.ts +50 -14
  126. package/src/options/Options.ts +17 -2
  127. package/src/slider/TembaSlider.ts +8 -1
  128. package/src/sms/gsmvalidator.ts +9 -138
  129. package/src/store/Store.ts +20 -3
  130. package/src/tabpane/TabPane.ts +3 -1
  131. package/src/untyped.d.ts +3 -0
  132. package/src/utils/index.ts +3 -0
  133. package/src/vectoricon/VectorIcon.ts +5 -10
  134. package/static/css/temba-components.css +4 -9
  135. package/static/icons/Read Me.txt +15 -15
  136. package/static/icons/SVG/credits.svg +5 -0
  137. package/static/icons/SVG/hourglass.svg +5 -0
  138. package/static/icons/demo-external-svg.html +142 -157
  139. package/static/icons/demo-files/demo.css +4 -4
  140. package/static/icons/demo.html +152 -177
  141. package/static/icons/selection.json +396 -339
  142. package/static/icons/style.css +0 -4
  143. package/static/icons/symbol-defs.svg +10 -20
  144. package/temba-components.ts +1 -2
  145. package/temba-modules.ts +7 -1
  146. package/test/MouseHelper.ts +47 -0
  147. package/test/temba-contact-badges.test.ts +33 -0
  148. package/test/temba-contact-chat.test.ts +202 -6
  149. package/test/temba-contact-history.test.ts +6 -6
  150. package/test/temba-dialog.test.ts +1 -1
  151. package/test/temba-label.test.ts +75 -0
  152. package/test/temba-list.test.ts +1 -1
  153. package/test/temba-menu.test.ts +1 -0
  154. package/test/temba-select.test.ts +6 -10
  155. package/test/temba-slider.test.ts +204 -8
  156. package/test/temba-textinput.test.ts +3 -4
  157. package/test/temba-tip.test.ts +1 -1
  158. package/test/utils.test.ts +34 -16
  159. package/test-assets/contacts/contact-barak-archived +40 -0
  160. package/test-assets/contacts/contact-dave-active +52 -0
  161. package/test-assets/contacts/contact-michelle-blocked +40 -0
  162. package/test-assets/contacts/contact-tim-stopped +52 -0
  163. package/test-assets/store/groups.json +29 -0
  164. package/test-assets/store/languages.json +290 -0
  165. package/test-assets/style.css +2 -0
  166. package/web-test-runner.config.mjs +16 -0
  167. package/.yarn/releases/yarn-1.22.10.cjs +0 -147392
  168. package/out-tsc/src/contacts/ContactGroups.js +0 -40
  169. package/out-tsc/src/contacts/ContactGroups.js.map +0 -1
  170. package/src/contacts/ContactGroups.ts +0 -42
@@ -19,10 +19,6 @@ Single-colored icons can be modified like so:
19
19
  width: 1.125em;
20
20
  }
21
21
 
22
- .icon-users1 {
23
- width: 1.125em;
24
- }
25
-
26
22
  .icon-channel-kannel {
27
23
  width: 0.7734375em;
28
24
  }
@@ -1,7 +1,7 @@
1
1
  <svg aria-hidden="true" style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
2
  <defs>
3
- <symbol id="icon-language" viewBox="0 0 20 20">
4
- <path d="M19.753 10.909c-0.624-1.707-2.366-2.726-4.661-2.726-0.090 0-0.176 0.002-0.262 0.006l-0.016-2.063c0 0 3.41-0.588 3.525-0.607s0.133-0.119 0.109-0.231c-0.023-0.111-0.167-0.883-0.188-0.976-0.027-0.131-0.102-0.127-0.207-0.109s-3.25 0.461-3.25 0.461-0.012-1.953-0.013-2.078c-0.001-0.125-0.069-0.158-0.194-0.156s-0.92 0.014-1.025 0.016c-0.105 0.002-0.164 0.049-0.162 0.148s0.033 2.307 0.033 2.307-3.061 0.527-3.144 0.543c-0.084 0.014-0.17 0.053-0.151 0.143s0.19 1.094 0.208 1.172c0.018 0.080 0.072 0.129 0.188 0.107 0.115-0.019 2.924-0.504 2.924-0.504l0.035 2.018c-1.077 0.281-1.801 0.824-2.256 1.303-0.768 0.807-1.207 1.887-1.207 2.963 0 1.586 0.971 2.529 2.328 2.695 3.162 0.387 5.119-3.060 5.769-4.715 1.097 1.506 0.256 4.354-2.094 5.98-0.043 0.029-0.098 0.129-0.033 0.207s0.541 0.662 0.619 0.756c0.080 0.096 0.206 0.059 0.256 0.023 2.51-1.73 3.661-4.515 2.869-6.683zM12.367 14.097c-0.966-0.121-0.944-0.914-0.944-1.453 0-0.773 0.327-1.58 0.876-2.156 0.335-0.354 0.75-0.621 1.229-0.799l0.082 4.277c-0.385 0.131-0.799 0.185-1.243 0.131zM14.794 13.544l0.046-4.109c0.084-0.004 0.166-0.010 0.252-0.010 0.773 0 1.494 0.145 1.885 0.361s-1.023 2.713-2.183 3.758zM5.844 5.876c-0.030-0.094-0.103-0.145-0.196-0.145h-1.95c-0.093 0-0.165 0.051-0.194 0.144-0.412 1.299-3.48 10.99-3.496 11.041s-0.011 0.076 0.062 0.076h1.733c0.075 0 0.099-0.023 0.114-0.072 0.015-0.051 1.008-3.318 1.008-3.318h3.496c0 0 0.992 3.268 1.008 3.318s0.039 0.072 0.113 0.072h1.734c0.072 0 0.078-0.025 0.062-0.076-0.014-0.050-3.083-9.741-3.494-11.040zM3.226 12.194l1.447-5.25 1.447 5.25h-2.894z"></path>
3
+ <symbol id="icon-hourglass" viewBox="0 0 24 24">
4
+ <path d="M12 11.484l3.984-3.984v-3.516h-7.969v3.516zM15.984 16.5l-3.984-3.984-3.984 3.984v3.516h7.969v-3.516zM6 2.016h12v6l-3.984 3.984 3.984 3.984v6h-12v-6l3.984-3.984-3.984-3.984v-6z"></path>
5
5
  </symbol>
6
6
  <symbol id="icon-bookmark-filled" viewBox="0 0 24 24">
7
7
  <path d="M17.016 3q0.797 0 1.383 0.609t0.586 1.406v15.984l-6.984-3-6.984 3v-15.984q0-0.797 0.586-1.406t1.383-0.609h10.031z"></path>
@@ -363,24 +363,8 @@
363
363
  <symbol id="icon-send-mobile" viewBox="0 0 24 24">
364
364
  <path d="M17.016 17.016h1.969v3.984q0 0.844-0.586 1.43t-1.383 0.586h-10.031q-0.797 0-1.383-0.586t-0.586-1.43v-18q0-0.844 0.586-1.406t1.383-0.563l10.031-0.047q0.797 0 1.383 0.586t0.586 1.43v3.984h-1.969v-0.984h-10.031v12h10.031v-0.984zM21.984 12l-3.984-3.984v3h-5.016v1.969h5.016v3z"></path>
365
365
  </symbol>
366
- <symbol id="icon-zapier" viewBox="0 0 32 32">
367
- <path fill="#ff4a00" style="fill: var(--color1, #ff4a00)" d="M20 16.005c0 1.191-0.22 2.328-0.615 3.38-1.049 0.396-2.191 0.615-3.38 0.615h-0.012c-1.191 0-2.327-0.22-3.379-0.615-0.396-1.052-0.615-2.191-0.615-3.38v-0.012c0-1.191 0.219-2.327 0.615-3.379 1.052-0.396 2.189-0.615 3.379-0.615h0.012c1.191 0 2.331 0.219 3.38 0.616 0.396 1.051 0.615 2.188 0.615 3.38zM31.78 13.333h-9.34l6.597-6.603c-0.52-0.731-1.093-1.413-1.727-2.044-0.631-0.632-1.313-1.209-2.040-1.728l-6.605 6.599v-9.337c-0.865-0.139-1.751-0.22-2.66-0.22h-0.013c-0.907 0-1.795 0.081-2.66 0.22v9.34l-6.6-6.599c-0.732 0.515-1.413 1.095-2.045 1.725-0.632 0.632-1.211 1.316-1.728 2.044l6.599 6.603h-9.337c0 0-0.22 1.755-0.22 2.66v0.012c0 0.907 0.081 1.797 0.22 2.66h9.34l-6.599 6.603c1.036 1.461 2.311 2.735 3.769 3.773l6.603-6.6v9.339c0.864 0.14 1.751 0.22 2.655 0.22h0.023c0.905 0 1.792-0.080 2.655-0.22v-9.339l6.603 6.6c0.731-0.5 1.413-1.083 2.039-1.72h0.007c0.631-0.62 1.208-1.301 1.728-2.041l-6.6-6.599h9.339c0.14-0.86 0.22-1.739 0.22-2.64v-0.041c0-0.904-0.080-1.791-0.22-2.653z"></path>
368
- </symbol>
369
- <symbol id="icon-users1" viewBox="0 0 36 32">
370
- <path d="M24 24.082v-1.649c2.203-1.241 4-4.337 4-7.432 0-4.971 0-9-6-9s-6 4.029-6 9c0 3.096 1.797 6.191 4 7.432v1.649c-6.784 0.555-12 3.888-12 7.918h28c0-4.030-5.216-7.364-12-7.918z"></path>
371
- <path d="M10.225 24.854c1.728-1.13 3.877-1.989 6.243-2.513-0.47-0.556-0.897-1.176-1.265-1.844-0.95-1.726-1.453-3.627-1.453-5.497 0-2.689 0-5.228 0.956-7.305 0.928-2.016 2.598-3.265 4.976-3.734-0.529-2.39-1.936-3.961-5.682-3.961-6 0-6 4.029-6 9 0 3.096 1.797 6.191 4 7.432v1.649c-6.784 0.555-12 3.888-12 7.918h8.719c0.454-0.403 0.956-0.787 1.506-1.146z"></path>
372
- </symbol>
373
- <symbol id="icon-lock2" viewBox="0 0 32 32">
374
- <path d="M26 14h-2v-6c0-4.418-3.582-8-8-8s-8 3.582-8 8v6h-2c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h20c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2zM16 26c-1.105 0-2-0.895-2-2s0.895-2 2-2 2 0.895 2 2-0.895 2-2 2zM20 14h-8v-6c0-2.206 1.794-4 4-4s4 1.794 4 4v6z"></path>
375
- </symbol>
376
- <symbol id="icon-atom" viewBox="0 0 32 32">
377
- <path d="M25.998 6.46v0 0zM26.064 16c3.262-3.119 4.846-6.174 3.792-8-0.602-1.042-1.98-1.54-3.859-1.54v1.5c1.317 0 2.274 0.296 2.56 0.79 0.226 0.391 0.1 0.992-0.045 1.427-0.278 0.835-0.884 1.833-1.751 2.888-0.526 0.64-1.133 1.285-1.809 1.926-0.93-0.803-1.965-1.602-3.087-2.377-0.11-1.359-0.284-2.654-0.514-3.86 1.756-0.521 3.35-0.794 4.646-0.794l0.001-1.5c-0 0-0.001 0-0.001 0-1.412 0-3.106 0.282-4.965 0.825-1.070-4.385-2.924-7.285-5.032-7.285s-3.962 2.9-5.032 7.284c-1.859-0.543-3.553-0.825-4.965-0.825-1.879 0-3.258 0.498-3.86 1.541-1.054 1.826 0.53 4.881 3.792 8-3.262 3.119-4.846 6.174-3.792 8 0.602 1.043 1.98 1.54 3.86 1.54 1.412 0 3.106-0.282 4.965-0.825 1.070 4.385 2.924 7.285 5.032 7.285s3.962-2.9 5.032-7.284c1.859 0.543 3.553 0.825 4.965 0.825 1.879 0 3.258-0.498 3.86-1.541 1.054-1.826-0.53-4.881-3.792-8zM23.829 16c-0.582 0.496-1.202 0.987-1.855 1.468 0.017-0.484 0.025-0.973 0.025-1.468s-0.009-0.985-0.025-1.468c0.653 0.481 1.273 0.972 1.855 1.468zM19.915 22.777c-0.72-0.256-1.455-0.547-2.196-0.871 0.426-0.227 0.853-0.463 1.28-0.71 0.429-0.248 0.848-0.5 1.259-0.756-0.090 0.805-0.205 1.586-0.344 2.337zM18.25 19.897c-0.743 0.429-1.496 0.832-2.25 1.207-0.754-0.374-1.507-0.778-2.25-1.207-0.749-0.433-1.475-0.882-2.172-1.344-0.052-0.835-0.078-1.688-0.078-2.553s0.027-1.718 0.078-2.553c0.697-0.462 1.423-0.912 2.172-1.344 0.743-0.429 1.496-0.832 2.25-1.207 0.754 0.374 1.507 0.778 2.25 1.207 0.749 0.433 1.475 0.882 2.172 1.344 0.052 0.835 0.078 1.688 0.078 2.553s-0.027 1.718-0.078 2.553c-0.697 0.462-1.423 0.912-2.172 1.344zM11.741 20.44c0.411 0.256 0.83 0.509 1.259 0.756 0.428 0.247 0.855 0.483 1.28 0.71-0.741 0.323-1.475 0.615-2.196 0.871-0.138-0.751-0.254-1.532-0.344-2.337zM10.025 17.468c-0.653-0.481-1.273-0.972-1.855-1.468 0.582-0.496 1.202-0.987 1.855-1.468-0.017 0.484-0.025 0.973-0.025 1.468s0.009 0.985 0.025 1.468zM12.085 9.223c0.72 0.256 1.455 0.547 2.196 0.871-0.426 0.227-0.853 0.463-1.28 0.71-0.429 0.248-0.848 0.5-1.259 0.756 0.090-0.805 0.205-1.586 0.344-2.337zM19 10.804c-0.427-0.247-0.855-0.483-1.28-0.71 0.741-0.323 1.475-0.615 2.196-0.871 0.138 0.751 0.253 1.532 0.344 2.337-0.411-0.256-0.83-0.509-1.259-0.756zM13.162 5.213c0.479-1.278 1.041-2.302 1.625-2.961 0.304-0.343 0.762-0.752 1.213-0.752s0.909 0.409 1.213 0.752c0.584 0.658 1.146 1.682 1.625 2.961 0.291 0.776 0.546 1.624 0.764 2.53-1.161 0.404-2.37 0.901-3.602 1.485-1.232-0.585-2.442-1.082-3.602-1.486 0.218-0.905 0.473-1.754 0.764-2.53zM5.239 13.064c-0.867-1.054-1.473-2.053-1.751-2.888-0.145-0.435-0.271-1.036-0.045-1.427 0.286-0.495 1.243-0.79 2.561-0.79h0c1.297 0 2.89 0.274 4.646 0.794-0.23 1.206-0.404 2.501-0.514 3.86-1.123 0.775-2.157 1.574-3.088 2.377-0.675-0.641-1.282-1.286-1.809-1.926zM6.003 24.040c-1.318 0-2.275-0.296-2.561-0.79-0.226-0.391-0.1-0.992 0.045-1.427 0.278-0.835 0.884-1.833 1.751-2.888 0.527-0.64 1.133-1.285 1.809-1.926 0.93 0.803 1.965 1.602 3.087 2.377 0.11 1.359 0.284 2.654 0.514 3.86-1.756 0.521-3.349 0.794-4.646 0.794zM18.838 26.787c-0.479 1.278-1.041 2.302-1.625 2.961-0.304 0.343-0.762 0.752-1.213 0.752s-0.909-0.409-1.213-0.752c-0.584-0.658-1.146-1.682-1.625-2.96-0.291-0.776-0.546-1.624-0.764-2.53 1.161-0.404 2.37-0.901 3.602-1.485 1.232 0.585 2.442 1.082 3.602 1.486-0.218 0.905-0.473 1.754-0.764 2.53zM28.512 21.823c0.145 0.435 0.271 1.036 0.045 1.427-0.286 0.495-1.243 0.791-2.561 0.791-1.297 0-2.89-0.273-4.646-0.794 0.23-1.206 0.404-2.501 0.514-3.86 1.122-0.775 2.157-1.574 3.087-2.377 0.675 0.641 1.282 1.286 1.809 1.926 0.867 1.054 1.473 2.053 1.751 2.888z"></path>
378
- </symbol>
379
- <symbol id="icon-paperplane" viewBox="0 0 32 32">
380
- <path d="M14 22l12.301 4.39 5.699-24.917zM10 20.622l22-19.149-32 15.827zM14 24.124v7.876l5.805-5.805z"></path>
381
- </symbol>
382
- <symbol id="icon-cancel" viewBox="0 0 32 32">
383
- <path d="M23 0h-14l-9 9v14l9 9h14l9-9v-14l-9-9zM25 22l-3 3-6-6-6 6-3-3 6-6-6-6 3-3 6 6 6-6 3 3-6 6 6 6z"></path>
366
+ <symbol id="icon-credits" viewBox="0 0 16 16">
367
+ <path d="M10.479 4.958c-0.364 0-0.72 0.036-1.064 0.103-0.027-0.021-0.055-0.041-0.084-0.061 0.425-0.294 0.669-0.636 0.669-1v-1c0-1.105-2.239-2-5-2s-5 0.895-5 2v1c0 0.364 0.244 0.706 0.669 1-0.425 0.294-0.669 0.636-0.669 1v1c0 0.364 0.244 0.706 0.669 1-0.425 0.294-0.669 0.636-0.669 1v1c0 0.364 0.244 0.706 0.669 1-0.425 0.294-0.669 0.636-0.669 1v1c0 1.105 2.239 2 5 2 0.738 0 1.438-0.064 2.069-0.179 0.939 0.739 2.123 1.179 3.41 1.179 3.049 0 5.521-2.472 5.521-5.521s-2.472-5.521-5.521-5.521zM0.5 3c0-0.298 0.451-0.671 1.15-0.95 0.887-0.355 2.076-0.55 3.35-0.55s2.463 0.195 3.35 0.55c0.699 0.279 1.15 0.652 1.15 0.95s-0.451 0.671-1.15 0.95c-0.288 0.115-0.609 0.214-0.954 0.294-0.716 0.167-1.536 0.256-2.396 0.256s-1.68-0.089-2.396-0.256c-0.345-0.080-0.666-0.179-0.954-0.294-0.699-0.279-1.15-0.652-1.15-0.95zM0.5 9c0-0.221 0.249-0.483 0.663-0.718 0.917 0.439 2.296 0.718 3.837 0.718 0.053 0 0.106-0.001 0.159-0.001-0.131 0.471-0.201 0.968-0.201 1.481 0 0.007 0 0.014 0 0.021-0.844-0.003-1.65-0.091-2.354-0.256-0.345-0.080-0.666-0.179-0.954-0.294-0.699-0.279-1.15-0.652-1.15-0.95zM5 13.5c-1.273 0-2.463-0.195-3.35-0.55-0.699-0.279-1.15-0.652-1.15-0.95 0-0.221 0.249-0.483 0.663-0.718 0.917 0.439 2.296 0.718 3.837 0.718 0.057 0 0.114-0.001 0.17-0.002 0.151 0.527 0.378 1.022 0.668 1.472-0.274 0.019-0.554 0.029-0.839 0.029zM5 7.5c-0.859 0-1.68-0.089-2.396-0.256-0.345-0.080-0.666-0.179-0.954-0.294-0.699-0.279-1.15-0.652-1.15-0.95 0-0.221 0.249-0.483 0.663-0.718 0.917 0.439 2.296 0.718 3.837 0.718 1.030 0 1.987-0.125 2.782-0.339-0.781 0.438-1.444 1.060-1.932 1.808-0.278 0.020-0.562 0.030-0.85 0.030zM10.479 14.996c-2.495 0-4.517-2.022-4.517-4.517s2.022-4.517 4.517-4.517c2.495 0 4.517 2.022 4.517 4.517s-2.022 4.517-4.517 4.517zM11 7h-1v1h-2v3h2v1h-2v1h2v1h1v-1h2v-3h-2v-1h2v-1h-2v-1zM10 10h-1v-1h1v1zM12 11v1h-1v-1h1z"></path>
384
368
  </symbol>
385
369
  <symbol id="icon-channel" viewBox="0 0 16 16">
386
370
  <path d="M0 11l5-8 5 5 6-4-5 9-5-5z"></path>
@@ -401,6 +385,12 @@
401
385
  <symbol id="icon-cancel" viewBox="0 0 16 16">
402
386
  <path d="M11.5 0h-7l-4.5 4.5v7l4.5 4.5h7l4.5-4.5v-7l-4.5-4.5zM12.5 11l-1.5 1.5-3-3-3 3-1.5-1.5 3-3-3-3 1.5-1.5 3 3 3-3 1.5 1.5-3 3 3 3z"></path>
403
387
  </symbol>
388
+ <symbol id="icon-language" viewBox="0 0 20 20">
389
+ <path d="M19.753 10.909c-0.624-1.707-2.366-2.726-4.661-2.726-0.090 0-0.176 0.002-0.262 0.006l-0.016-2.063c0 0 3.41-0.588 3.525-0.607s0.133-0.119 0.109-0.231c-0.023-0.111-0.167-0.883-0.188-0.976-0.027-0.131-0.102-0.127-0.207-0.109s-3.25 0.461-3.25 0.461-0.012-1.953-0.013-2.078c-0.001-0.125-0.069-0.158-0.194-0.156s-0.92 0.014-1.025 0.016c-0.105 0.002-0.164 0.049-0.162 0.148s0.033 2.307 0.033 2.307-3.061 0.527-3.144 0.543c-0.084 0.014-0.17 0.053-0.151 0.143s0.19 1.094 0.208 1.172c0.018 0.080 0.072 0.129 0.188 0.107 0.115-0.019 2.924-0.504 2.924-0.504l0.035 2.018c-1.077 0.281-1.801 0.824-2.256 1.303-0.768 0.807-1.207 1.887-1.207 2.963 0 1.586 0.971 2.529 2.328 2.695 3.162 0.387 5.119-3.060 5.769-4.715 1.097 1.506 0.256 4.354-2.094 5.98-0.043 0.029-0.098 0.129-0.033 0.207s0.541 0.662 0.619 0.756c0.080 0.096 0.206 0.059 0.256 0.023 2.51-1.73 3.661-4.515 2.869-6.683zM12.367 14.097c-0.966-0.121-0.944-0.914-0.944-1.453 0-0.773 0.327-1.58 0.876-2.156 0.335-0.354 0.75-0.621 1.229-0.799l0.082 4.277c-0.385 0.131-0.799 0.185-1.243 0.131zM14.794 13.544l0.046-4.109c0.084-0.004 0.166-0.010 0.252-0.010 0.773 0 1.494 0.145 1.885 0.361s-1.023 2.713-2.183 3.758zM5.844 5.876c-0.030-0.094-0.103-0.145-0.196-0.145h-1.95c-0.093 0-0.165 0.051-0.194 0.144-0.412 1.299-3.48 10.99-3.496 11.041s-0.011 0.076 0.062 0.076h1.733c0.075 0 0.099-0.023 0.114-0.072 0.015-0.051 1.008-3.318 1.008-3.318h3.496c0 0 0.992 3.268 1.008 3.318s0.039 0.072 0.113 0.072h1.734c0.072 0 0.078-0.025 0.062-0.076-0.014-0.050-3.083-9.741-3.494-11.040zM3.226 12.194l1.447-5.25 1.447 5.25h-2.894z"></path>
390
+ </symbol>
391
+ <symbol id="icon-zapier" viewBox="0 0 32 32">
392
+ <path fill="#ff4a00" style="fill: var(--color1, #ff4a00)" d="M20 16.005c0 1.191-0.22 2.328-0.615 3.38-1.049 0.396-2.191 0.615-3.38 0.615h-0.012c-1.191 0-2.327-0.22-3.379-0.615-0.396-1.052-0.615-2.191-0.615-3.38v-0.012c0-1.191 0.219-2.327 0.615-3.379 1.052-0.396 2.189-0.615 3.379-0.615h0.012c1.191 0 2.331 0.219 3.38 0.616 0.396 1.051 0.615 2.188 0.615 3.38zM31.78 13.333h-9.34l6.597-6.603c-0.52-0.731-1.093-1.413-1.727-2.044-0.631-0.632-1.313-1.209-2.040-1.728l-6.605 6.599v-9.337c-0.865-0.139-1.751-0.22-2.66-0.22h-0.013c-0.907 0-1.795 0.081-2.66 0.22v9.34l-6.6-6.599c-0.732 0.515-1.413 1.095-2.045 1.725-0.632 0.632-1.211 1.316-1.728 2.044l6.599 6.603h-9.337c0 0-0.22 1.755-0.22 2.66v0.012c0 0.907 0.081 1.797 0.22 2.66h9.34l-6.599 6.603c1.036 1.461 2.311 2.735 3.769 3.773l6.603-6.6v9.339c0.864 0.14 1.751 0.22 2.655 0.22h0.023c0.905 0 1.792-0.080 2.655-0.22v-9.339l6.603 6.6c0.731-0.5 1.413-1.083 2.039-1.72h0.007c0.631-0.62 1.208-1.301 1.728-2.041l-6.6-6.599h9.339c0.14-0.86 0.22-1.739 0.22-2.64v-0.041c0-0.904-0.080-1.791-0.22-2.653z"></path>
393
+ </symbol>
404
394
  <symbol id="icon-cord" viewBox="0 0 32 32">
405
395
  <path d="M27.59 12.41c-0.464-0.464-1.216-0.464-1.679 0l-4.91 4.91-6.321-6.321 4.91-4.91c0.464-0.464 0.464-1.216 0-1.679s-1.216-0.464-1.679 0l-4.91 4.91-2.91-2.91c-0.464-0.464-1.216-0.464-1.679 0s-0.464 1.216 0 1.679l2.093 2.093-4.16 4.16c-2.636 2.636-3.048 6.653-1.236 9.721l-4.521 4.521c-0.781 0.781-0.781 2.047 0 2.828 0.391 0.391 0.902 0.586 1.414 0.586s1.024-0.195 1.414-0.586l4.521-4.521c3.068 1.812 7.085 1.4 9.721-1.236l4.16-4.16 2.093 2.093c0.232 0.232 0.536 0.348 0.84 0.348s0.608-0.116 0.84-0.348c0.464-0.464 0.464-1.216 0-1.679l-2.91-2.91 4.91-4.91c0.464-0.464 0.464-1.216 0-1.679z"></path>
406
396
  </symbol>
@@ -1,10 +1,9 @@
1
- import './temba-modules';
1
+ import { addCustomElement } from './temba-modules';
2
2
 
3
3
  // we import and declare the alias editor seperately since
4
4
  // leaflet-map doesn't work in dev mode
5
5
  import { AliasEditor } from './src/aliaseditor/AliasEditor';
6
6
  import { LeafletMap } from './src/leafletmap/LeafletMap';
7
- import { addCustomElement } from './temba-modules';
8
7
 
9
8
  addCustomElement('leaflet-map', LeafletMap);
10
9
  addCustomElement('alias-editor', AliasEditor);
package/temba-modules.ts CHANGED
@@ -35,6 +35,9 @@ import { ContactBadges } from './src/contacts/ContactBadges';
35
35
  import { ContactPending } from './src/contacts/ContactPending';
36
36
  import { ContactTickets } from './src/contacts/ContactTickets';
37
37
  import { TembaSlider } from './src/slider/TembaSlider';
38
+ import { RunList } from './src/list/RunList';
39
+ import { FlowStoreElement } from './src/flow/FlowStoreElement';
40
+ import { ContactNameFetch } from './src/contacts/ContactNameFetch';
38
41
 
39
42
  export function addCustomElement(name: string, comp: any) {
40
43
  if (!window.customElements.get(name)) {
@@ -55,6 +58,7 @@ addCustomElement('temba-button', Button);
55
58
  addCustomElement('temba-omnibox', Omnibox);
56
59
  addCustomElement('temba-tip', Tip);
57
60
  addCustomElement('temba-contact-name', ContactName);
61
+ addCustomElement('temba-contact-name-fetch', ContactNameFetch);
58
62
  addCustomElement('temba-contact-field', ContactFieldEditor);
59
63
  addCustomElement('temba-contact-fields', ContactFields);
60
64
  addCustomElement('temba-urn', ContactUrn);
@@ -68,6 +72,8 @@ addCustomElement('temba-contact-chat', ContactChat);
68
72
  addCustomElement('temba-contact-details', ContactDetails);
69
73
  addCustomElement('temba-ticket-list', TicketList);
70
74
  addCustomElement('temba-list', TembaList);
75
+ addCustomElement('temba-run-list', RunList);
76
+ addCustomElement('temba-flow-details', FlowStoreElement);
71
77
  addCustomElement('temba-label', Label);
72
78
  addCustomElement('temba-menu', TembaMenu);
73
79
  addCustomElement('temba-contact-search', ContactSearch);
@@ -75,7 +81,7 @@ addCustomElement('temba-icon', VectorIcon);
75
81
  addCustomElement('temba-dropdown', Dropdown);
76
82
  addCustomElement('temba-tabs', TabPane);
77
83
  addCustomElement('temba-tab', Tab);
78
- addCustomElement('temba-contact-groups', ContactBadges);
84
+ addCustomElement('temba-contact-badges', ContactBadges);
79
85
  addCustomElement('temba-contact-pending', ContactPending);
80
86
  addCustomElement('temba-contact-tickets', ContactTickets);
81
87
  addCustomElement('temba-slider', TembaSlider);
@@ -0,0 +1,47 @@
1
+ import { css, html, TemplateResult } from 'lit';
2
+ import { customElement } from 'lit/decorators';
3
+ import { RapidElement } from '../src/RapidElement';
4
+
5
+ @customElement('mouse-helper')
6
+ export default class MouseHelper extends RapidElement {
7
+ static get styles() {
8
+ return css`
9
+ :host {
10
+ position: absolute;
11
+ }
12
+
13
+ .pointer {
14
+ position: absolute;
15
+ width: 6px;
16
+ height: 6px;
17
+ z-index: 1000;
18
+ background: rgba(0, 250, 0, 0.3);
19
+ border-radius: 20px;
20
+ margin-left: -3px;
21
+ margin-top: -3px;
22
+ pointer-events: none;
23
+ }
24
+ `;
25
+ }
26
+
27
+ connectedCallback(): void {
28
+ super.connectedCallback();
29
+ this.updateCursor = this.updateCursor.bind(this);
30
+ document.addEventListener('mousemove', this.updateCursor);
31
+ }
32
+
33
+ disconnectedCallback(): void {
34
+ super.disconnectedCallback();
35
+ document.removeEventListener('mousemove', this.updateCursor);
36
+ }
37
+
38
+ public updateCursor(event: MouseEvent) {
39
+ const pointer = this.shadowRoot.querySelector('.pointer') as HTMLDivElement;
40
+ pointer.style.left = event.offsetX + 'px';
41
+ pointer.style.top = event.offsetY + 'px';
42
+ }
43
+
44
+ public render(): TemplateResult {
45
+ return html`<div class="pointer"></div>`;
46
+ }
47
+ }
@@ -0,0 +1,33 @@
1
+ import { assert } from '@open-wc/testing';
2
+ import { ContactBadges } from '../src/contacts/ContactBadges';
3
+ import {
4
+ assertScreenshot,
5
+ delay,
6
+ getClip,
7
+ getComponent,
8
+ loadStore,
9
+ } from './utils.test';
10
+
11
+ const TAG = 'temba-contact-badges';
12
+ const getBadges = async (attrs: any = {}) => {
13
+ attrs['endpoint'] = '/test-assets/contacts/';
14
+ const badges = (await getComponent(TAG, attrs, '', 400)) as ContactBadges;
15
+
16
+ // wait for our contact to load
17
+ await delay(100);
18
+
19
+ return badges;
20
+ };
21
+
22
+ describe('temba-contact-badges', () => {
23
+ it('renders default', async () => {
24
+ // we are a StoreElement, so load a store first
25
+ await loadStore();
26
+
27
+ const badges: ContactBadges = await getBadges({
28
+ contact: 'contact-dave-active',
29
+ });
30
+ assert.instanceOf(badges, ContactBadges);
31
+ await assertScreenshot('contacts/badges', getClip(badges));
32
+ });
33
+ });
@@ -1,13 +1,209 @@
1
- import { fixture, assert } from '@open-wc/testing';
1
+ import { expect } from '@open-wc/testing';
2
2
  import { ContactChat } from '../src/contacts/ContactChat';
3
- import { getHTML } from '../test/utils.test';
4
- import './utils.test';
3
+ import {
4
+ assertScreenshot,
5
+ delay,
6
+ getClip,
7
+ getComponent,
8
+ loadStore,
9
+ mockGET,
10
+ } from '../test/utils.test';
5
11
 
6
- const getChatHTML = (attrs: any = {}) => getHTML('temba-contact-chat', attrs);
12
+ const TAG = 'temba-contact-chat';
13
+
14
+ const getContactChat = async (attrs: any = {}) => {
15
+ attrs['endpoint'] = '/test-assets/contacts/';
16
+
17
+ // add some sizes and styles to force our chat history to scroll
18
+ const chat = (await getComponent(
19
+ TAG,
20
+ attrs,
21
+ '',
22
+ 500,
23
+ 500,
24
+ 'display:flex;flex-direction:column;flex-grow:1;min-height:0;'
25
+ )) as ContactChat;
26
+
27
+ // wait for our contact to load
28
+ await delay(100);
29
+
30
+ return chat;
31
+ };
7
32
 
8
33
  describe('temba-contact-chat', () => {
34
+ // map requests for contact history and ticket api to our static files
35
+ // we'll just us the same history and ticket list for everybody for now
36
+ beforeEach(() => {
37
+ mockGET(
38
+ /\/contact\/history\/contact-.*/,
39
+ '/test-assets/contacts/history.json'
40
+ );
41
+
42
+ mockGET(
43
+ /\/api\/v2\/tickets\.json\?contact=contact-.*/,
44
+ '/test-assets/api/tickets.json'
45
+ );
46
+ });
47
+
9
48
  it('can be created', async () => {
10
- const chat: ContactChat = await fixture(getChatHTML());
11
- assert.instanceOf(chat, ContactChat);
49
+ // we are a StoreElement, so load a store first
50
+ await loadStore();
51
+ const chat: ContactChat = await getContactChat({
52
+ contact: 'contact-dave-active',
53
+ });
54
+
55
+ await assertScreenshot('contacts/contact-active-default', getClip(chat));
56
+ });
57
+
58
+ it('can send chat msg if contact is active', async () => {
59
+ // we are a StoreElement, so load a store first
60
+ await loadStore();
61
+ const chat: ContactChat = await getContactChat({
62
+ contact: 'contact-dave-active',
63
+ });
64
+
65
+ const chatboxDivEl = chat.shadowRoot.querySelector(
66
+ '.chatbox'
67
+ ) as HTMLDivElement;
68
+ const displayVal = chatboxDivEl.style.display;
69
+ expect(displayVal).to.equal('');
70
+
71
+ await assertScreenshot(
72
+ 'contacts/contact-active-show-chat-msg',
73
+ getClip(chat)
74
+ );
75
+ });
76
+
77
+ it('can see chat history if contact is active', async () => {
78
+ // we are a StoreElement, so load a store first
79
+ await loadStore();
80
+ const chat: ContactChat = await getContactChat({
81
+ contact: 'contact-dave-active',
82
+ });
83
+
84
+ const chatHistoryEl = chat.shadowRoot.querySelector(
85
+ 'temba-contact-history'
86
+ ) as HTMLDivElement;
87
+ const displayVal = chatHistoryEl.style.display;
88
+ expect(displayVal).to.equal('');
89
+
90
+ await assertScreenshot(
91
+ 'contacts/contact-active-show-chat-history',
92
+ getClip(chat)
93
+ );
94
+ });
95
+
96
+ it('cannot send chat msg if contact is archived', async () => {
97
+ // we are a StoreElement, so load a store first
98
+ await loadStore();
99
+ const chat: ContactChat = await getContactChat({
100
+ contact: 'contact-barak-archived',
101
+ });
102
+
103
+ const chatboxDivEl = chat.shadowRoot.querySelector(
104
+ '.chatbox'
105
+ ) as HTMLDivElement;
106
+ const displayVal = chatboxDivEl.style.display;
107
+ expect(displayVal).to.equal('none');
108
+
109
+ await assertScreenshot(
110
+ 'contacts/contact-archived-hide-chat-msg',
111
+ getClip(chat)
112
+ );
113
+ });
114
+
115
+ it('can see chat history if contact is archived', async () => {
116
+ // we are a StoreElement, so load a store first
117
+ await loadStore();
118
+ const chat: ContactChat = await getContactChat({
119
+ contact: 'contact-barak-archived',
120
+ });
121
+
122
+ const chatHistoryEl = chat.shadowRoot.querySelector(
123
+ 'temba-contact-history'
124
+ ) as HTMLDivElement;
125
+ const displayVal = chatHistoryEl.style.display;
126
+ expect(displayVal).to.equal('');
127
+
128
+ await assertScreenshot(
129
+ 'contacts/contact-archived-show-chat-history',
130
+ getClip(chat)
131
+ );
132
+ });
133
+
134
+ it('cannot send chat msg if contact is blocked', async () => {
135
+ // we are a StoreElement, so load a store first
136
+ await loadStore();
137
+ const chat: ContactChat = await getContactChat({
138
+ contact: 'contact-michelle-blocked',
139
+ });
140
+
141
+ const chatboxDivEl = chat.shadowRoot.querySelector(
142
+ '.chatbox'
143
+ ) as HTMLDivElement;
144
+ const displayVal = chatboxDivEl.style.display;
145
+ expect(displayVal).to.equal('none');
146
+
147
+ await assertScreenshot(
148
+ 'contacts/contact-blocked-hide-chat-msg',
149
+ getClip(chat)
150
+ );
151
+ });
152
+
153
+ it('can see chat history if contact is blocked', async () => {
154
+ // we are a StoreElement, so load a store first
155
+ await loadStore();
156
+ const chat: ContactChat = await getContactChat({
157
+ contact: 'contact-michelle-blocked',
158
+ });
159
+
160
+ const chatHistoryEl = chat.shadowRoot.querySelector(
161
+ 'temba-contact-history'
162
+ ) as HTMLDivElement;
163
+ const displayVal = chatHistoryEl.style.display;
164
+ expect(displayVal).to.equal('');
165
+
166
+ await assertScreenshot(
167
+ 'contacts/contact-blocked-show-chat-history',
168
+ getClip(chat)
169
+ );
170
+ });
171
+
172
+ it('cannot send chat msg if contact is stopped', async () => {
173
+ // we are a StoreElement, so load a store first
174
+ await loadStore();
175
+ const chat: ContactChat = await getContactChat({
176
+ contact: 'contact-tim-stopped',
177
+ });
178
+
179
+ const chatboxDivEl = chat.shadowRoot.querySelector(
180
+ '.chatbox'
181
+ ) as HTMLDivElement;
182
+ const displayVal = chatboxDivEl.style.display;
183
+ expect(displayVal).to.equal('none');
184
+
185
+ await assertScreenshot(
186
+ 'contacts/contact-stopped-hide-chat-msg',
187
+ getClip(chat)
188
+ );
189
+ });
190
+
191
+ it('can see chat history if contact is stopped', async () => {
192
+ // we are a StoreElement, so load a store first
193
+ await loadStore();
194
+ const chat: ContactChat = await getContactChat({
195
+ contact: 'contact-tim-stopped',
196
+ });
197
+
198
+ const chatHistoryEl = chat.shadowRoot.querySelector(
199
+ 'temba-contact-history'
200
+ ) as HTMLDivElement;
201
+ const displayVal = chatHistoryEl.style.display;
202
+ expect(displayVal).to.equal('');
203
+
204
+ await assertScreenshot(
205
+ 'contacts/contact-stopped-show-chat-history',
206
+ getClip(chat)
207
+ );
12
208
  });
13
209
  });
@@ -1,5 +1,5 @@
1
1
  import { fixture, assert, expect } from '@open-wc/testing';
2
- import sinon from 'sinon';
2
+ import * as sinon from 'sinon';
3
3
  import { ContactHistory } from '../src/contacts/ContactHistory';
4
4
  import { stubbable } from '../src/utils';
5
5
  import {
@@ -48,12 +48,12 @@ sinon.stub(stubbable, 'getCurrentDate').callsFake(() => {
48
48
  describe('temba-contact-history', () => {
49
49
  beforeEach(() => {
50
50
  mockGET(
51
- /\/contact\/history\/1234\/.*/,
51
+ /\/contact\/history\/contact-dave-active\/.*/,
52
52
  '/test-assets/contacts/history.json'
53
53
  );
54
54
 
55
55
  mockGET(
56
- /\/api\/v2\/tickets\.json\?contact=1234/,
56
+ /\/api\/v2\/tickets\.json\?contact=contact-dave-active/,
57
57
  '/test-assets/api/tickets.json'
58
58
  );
59
59
  });
@@ -66,7 +66,7 @@ describe('temba-contact-history', () => {
66
66
  it('renders history', async () => {
67
67
  const history = await createHistory(
68
68
  getHistoryHTML({
69
- uuid: '1234',
69
+ uuid: 'contact-dave-active',
70
70
  })
71
71
  );
72
72
 
@@ -76,7 +76,7 @@ describe('temba-contact-history', () => {
76
76
  const events = history.shadowRoot.querySelector('.events');
77
77
  const top = events.scrollHeight - events.getBoundingClientRect().height;
78
78
 
79
- expect(top).to.equal(533);
79
+ expect(top).to.equal(520);
80
80
 
81
81
  // make sure we actually scrolled to there
82
82
  expect(events.scrollTop).to.equal(top);
@@ -87,7 +87,7 @@ describe('temba-contact-history', () => {
87
87
  it('expands event groups', async () => {
88
88
  const history = await createHistory(
89
89
  getHistoryHTML({
90
- uuid: '1234',
90
+ uuid: 'contact-dave-active',
91
91
  })
92
92
  );
93
93
 
@@ -1,5 +1,5 @@
1
1
  import { assert, expect, fixture } from '@open-wc/testing';
2
- import sinon from 'sinon';
2
+ import * as sinon from 'sinon';
3
3
  import { Dialog } from '../src/dialog/Dialog';
4
4
  import { assertScreenshot, getClip } from './utils.test';
5
5
 
@@ -0,0 +1,75 @@
1
+ import { assert } from '@open-wc/testing';
2
+ import Label from '../src/label/Label';
3
+ import { assertScreenshot, getClip, getComponent } from './utils.test';
4
+
5
+ const TAG = 'temba-label';
6
+ const getLabel = async (slot, attrs: any = {}) => {
7
+ return (await getComponent(TAG, attrs, slot)) as Label;
8
+ };
9
+
10
+ describe('temba-label', () => {
11
+ it('renders default', async () => {
12
+ const label: Label = await getLabel('Default');
13
+ assert.instanceOf(label, Label);
14
+ await assertScreenshot('label/no-icon', getClip(label));
15
+ });
16
+
17
+ it('renders icon', async () => {
18
+ const label: Label = await getLabel('Default', { icon: 'home' });
19
+ await assertScreenshot('label/default-icon', getClip(label));
20
+ });
21
+
22
+ it('renders shadow', async () => {
23
+ const label: Label = await getLabel('Shadow', {
24
+ icon: 'loader',
25
+ shadow: true,
26
+ });
27
+ await assertScreenshot('label/shadow', getClip(label));
28
+ });
29
+
30
+ it('renders primary', async () => {
31
+ const label: Label = await getLabel('Primary', {
32
+ icon: 'check',
33
+ primary: true,
34
+ });
35
+ await assertScreenshot('label/primary', getClip(label));
36
+ });
37
+
38
+ it('renders secondary', async () => {
39
+ const label: Label = await getLabel('Secondary', {
40
+ icon: 'check',
41
+ secondary: true,
42
+ });
43
+ await assertScreenshot('label/secondary', getClip(label));
44
+ });
45
+
46
+ it('renders tertiary', async () => {
47
+ const label: Label = await getLabel('Tertiary', {
48
+ icon: 'check',
49
+ tertiary: true,
50
+ });
51
+ await assertScreenshot('label/tertiary', getClip(label));
52
+ });
53
+
54
+ it('renders dark', async () => {
55
+ const label: Label = await getLabel('Dark', { icon: 'check', dark: true });
56
+ await assertScreenshot('label/dark', getClip(label));
57
+ });
58
+
59
+ it('renders danger', async () => {
60
+ const label: Label = await getLabel('Danger', {
61
+ icon: 'alert-triangle',
62
+ danger: true,
63
+ });
64
+ await assertScreenshot('label/danger', getClip(label));
65
+ });
66
+
67
+ it('renders custom', async () => {
68
+ const label: Label = await getLabel('Custom Orange', {
69
+ icon: 'tool',
70
+ backgroundColor: 'rgb(240, 176, 29)',
71
+ textColor: '#ffff',
72
+ });
73
+ await assertScreenshot('label/custom', getClip(label));
74
+ });
75
+ });
@@ -1,5 +1,5 @@
1
1
  import { assert, expect } from '@open-wc/testing';
2
- import sinon from 'sinon';
2
+ import * as sinon from 'sinon';
3
3
  import { TembaList } from '../src/list/TembaList';
4
4
  import { assertScreenshot, getClip, getComponent } from './utils.test';
5
5
 
@@ -10,6 +10,7 @@ const getMenu = async (attrs: any = {}, width = 0) => {
10
10
  attrs,
11
11
  '',
12
12
  width,
13
+ 0,
13
14
  'display:inline-block'
14
15
  )) as TembaMenu;
15
16
 
@@ -2,9 +2,13 @@ import { fixture, expect, assert } from '@open-wc/testing';
2
2
  import { useFakeTimers } from 'sinon';
3
3
  import { Options } from '../src/options/Options';
4
4
  import { Select } from '../src/select/Select';
5
- import { assertScreenshot, checkTimers, getClip } from './utils.test';
5
+ import {
6
+ assertScreenshot,
7
+ checkTimers,
8
+ getClip,
9
+ loadStore,
10
+ } from './utils.test';
6
11
  import { range } from '../src/utils';
7
- import { Store } from '../src/store/Store';
8
12
 
9
13
  let clock: any;
10
14
 
@@ -121,14 +125,6 @@ const getClipWithOptions = (select: Select) => {
121
125
  return selectClip;
122
126
  };
123
127
 
124
- const loadStore = async () => {
125
- const store: Store = await fixture(
126
- "<temba-store completion='/test-assets/store/editor.json'></temba-store>"
127
- );
128
- await store.httpComplete;
129
- return store;
130
- };
131
-
132
128
  describe('temba-select', () => {
133
129
  beforeEach(function () {
134
130
  clock = useFakeTimers();