@nyaruka/temba-components 0.86.0 → 0.87.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 (285) hide show
  1. package/.eslintrc.js +3 -3
  2. package/.prettierrc +6 -0
  3. package/.storybook/main.js +3 -3
  4. package/.storybook/preview.js +2 -2
  5. package/CHANGELOG.md +14 -0
  6. package/CreateIncludesPlugin.js +2 -2
  7. package/demo/index.html +1 -0
  8. package/dist/locales/es.js +1 -1
  9. package/dist/locales/es.js.map +1 -1
  10. package/dist/locales/fr.js +1 -1
  11. package/dist/locales/fr.js.map +1 -1
  12. package/dist/locales/pt.js +1 -1
  13. package/dist/locales/pt.js.map +1 -1
  14. package/dist/temba-components.js +296 -277
  15. package/dist/temba-components.js.map +1 -1
  16. package/out-tsc/src/RapidElement.js +3 -3
  17. package/out-tsc/src/RapidElement.js.map +1 -1
  18. package/out-tsc/src/ResizeElement.js +2 -2
  19. package/out-tsc/src/ResizeElement.js.map +1 -1
  20. package/out-tsc/src/aliaseditor/AliasEditor.js +1 -1
  21. package/out-tsc/src/aliaseditor/AliasEditor.js.map +1 -1
  22. package/out-tsc/src/button/Button.js +1 -1
  23. package/out-tsc/src/button/Button.js.map +1 -1
  24. package/out-tsc/src/charcount/helpers.js +1 -1
  25. package/out-tsc/src/charcount/helpers.js.map +1 -1
  26. package/out-tsc/src/colorpicker/ColorPicker.js +4 -4
  27. package/out-tsc/src/colorpicker/ColorPicker.js.map +1 -1
  28. package/out-tsc/src/completion/Completion.js +2 -2
  29. package/out-tsc/src/completion/Completion.js.map +1 -1
  30. package/out-tsc/src/completion/ExcellentParser.js +1 -1
  31. package/out-tsc/src/completion/ExcellentParser.js.map +1 -1
  32. package/out-tsc/src/completion/helpers.js +8 -8
  33. package/out-tsc/src/completion/helpers.js.map +1 -1
  34. package/out-tsc/src/compose/Compose.js +14 -14
  35. package/out-tsc/src/compose/Compose.js.map +1 -1
  36. package/out-tsc/src/contacts/ContactBadges.js +2 -2
  37. package/out-tsc/src/contacts/ContactBadges.js.map +1 -1
  38. package/out-tsc/src/contacts/ContactChat.js +4 -4
  39. package/out-tsc/src/contacts/ContactChat.js.map +1 -1
  40. package/out-tsc/src/contacts/ContactDetails.js +4 -4
  41. package/out-tsc/src/contacts/ContactDetails.js.map +1 -1
  42. package/out-tsc/src/contacts/ContactFieldEditor.js +3 -3
  43. package/out-tsc/src/contacts/ContactFieldEditor.js.map +1 -1
  44. package/out-tsc/src/contacts/ContactFields.js +2 -2
  45. package/out-tsc/src/contacts/ContactFields.js.map +1 -1
  46. package/out-tsc/src/contacts/ContactHistory.js +21 -19
  47. package/out-tsc/src/contacts/ContactHistory.js.map +1 -1
  48. package/out-tsc/src/contacts/ContactPending.js +4 -4
  49. package/out-tsc/src/contacts/ContactPending.js.map +1 -1
  50. package/out-tsc/src/contacts/ContactTickets.js +8 -8
  51. package/out-tsc/src/contacts/ContactTickets.js.map +1 -1
  52. package/out-tsc/src/contacts/events.js +2 -2
  53. package/out-tsc/src/contacts/events.js.map +1 -1
  54. package/out-tsc/src/contacts/helpers.js +2 -2
  55. package/out-tsc/src/contacts/helpers.js.map +1 -1
  56. package/out-tsc/src/contactsearch/ContactSearch.js +7 -7
  57. package/out-tsc/src/contactsearch/ContactSearch.js.map +1 -1
  58. package/out-tsc/src/date/TembaDate.js +1 -1
  59. package/out-tsc/src/date/TembaDate.js.map +1 -1
  60. package/out-tsc/src/datepicker/DatePicker.js +1 -1
  61. package/out-tsc/src/datepicker/DatePicker.js.map +1 -1
  62. package/out-tsc/src/dialog/Dialog.js +5 -5
  63. package/out-tsc/src/dialog/Dialog.js.map +1 -1
  64. package/out-tsc/src/dialog/Modax.js +8 -8
  65. package/out-tsc/src/dialog/Modax.js.map +1 -1
  66. package/out-tsc/src/dropdown/Dropdown.js +1 -1
  67. package/out-tsc/src/dropdown/Dropdown.js.map +1 -1
  68. package/out-tsc/src/fields/FieldManager.js +6 -6
  69. package/out-tsc/src/fields/FieldManager.js.map +1 -1
  70. package/out-tsc/src/imagepicker/ImagePicker.js +4 -4
  71. package/out-tsc/src/imagepicker/ImagePicker.js.map +1 -1
  72. package/out-tsc/src/interfaces.js.map +1 -1
  73. package/out-tsc/src/label/Label.js +1 -1
  74. package/out-tsc/src/label/Label.js.map +1 -1
  75. package/out-tsc/src/leafletmap/LeafletMap.js +6 -6
  76. package/out-tsc/src/leafletmap/LeafletMap.js.map +1 -1
  77. package/out-tsc/src/leafletmap/helpers.js +2 -2
  78. package/out-tsc/src/leafletmap/helpers.js.map +1 -1
  79. package/out-tsc/src/lightbox/Lightbox.js +2 -2
  80. package/out-tsc/src/lightbox/Lightbox.js.map +1 -1
  81. package/out-tsc/src/list/ContentMenu.js +8 -8
  82. package/out-tsc/src/list/ContentMenu.js.map +1 -1
  83. package/out-tsc/src/list/NotificationList.js +7 -3
  84. package/out-tsc/src/list/NotificationList.js.map +1 -1
  85. package/out-tsc/src/list/RunList.js +1 -1
  86. package/out-tsc/src/list/RunList.js.map +1 -1
  87. package/out-tsc/src/list/SortableList.js +6 -6
  88. package/out-tsc/src/list/SortableList.js.map +1 -1
  89. package/out-tsc/src/list/TembaList.js +5 -5
  90. package/out-tsc/src/list/TembaList.js.map +1 -1
  91. package/out-tsc/src/list/TembaMenu.js +22 -22
  92. package/out-tsc/src/list/TembaMenu.js.map +1 -1
  93. package/out-tsc/src/loading/Loading.js +1 -1
  94. package/out-tsc/src/loading/Loading.js.map +1 -1
  95. package/out-tsc/src/locales/es.js +1 -1
  96. package/out-tsc/src/locales/es.js.map +1 -1
  97. package/out-tsc/src/locales/fr.js +1 -1
  98. package/out-tsc/src/locales/fr.js.map +1 -1
  99. package/out-tsc/src/locales/pt.js +1 -1
  100. package/out-tsc/src/locales/pt.js.map +1 -1
  101. package/out-tsc/src/omnibox/Omnibox.js +1 -1
  102. package/out-tsc/src/omnibox/Omnibox.js.map +1 -1
  103. package/out-tsc/src/options/Options.js +9 -9
  104. package/out-tsc/src/options/Options.js.map +1 -1
  105. package/out-tsc/src/remote/Remote.js +1 -1
  106. package/out-tsc/src/remote/Remote.js.map +1 -1
  107. package/out-tsc/src/select/Select.js +18 -18
  108. package/out-tsc/src/select/Select.js.map +1 -1
  109. package/out-tsc/src/sms/gsmsplitter.js +8 -8
  110. package/out-tsc/src/sms/gsmsplitter.js.map +1 -1
  111. package/out-tsc/src/sms/gsmvalidator.js +1 -1
  112. package/out-tsc/src/sms/gsmvalidator.js.map +1 -1
  113. package/out-tsc/src/sms/index.js +2 -2
  114. package/out-tsc/src/sms/index.js.map +1 -1
  115. package/out-tsc/src/sms/unicodesplitter.js +8 -8
  116. package/out-tsc/src/sms/unicodesplitter.js.map +1 -1
  117. package/out-tsc/src/store/Store.js +10 -10
  118. package/out-tsc/src/store/Store.js.map +1 -1
  119. package/out-tsc/src/store/StoreElement.js +2 -2
  120. package/out-tsc/src/store/StoreElement.js.map +1 -1
  121. package/out-tsc/src/tabpane/TabPane.js +4 -4
  122. package/out-tsc/src/tabpane/TabPane.js.map +1 -1
  123. package/out-tsc/src/templates/TemplateEditor.js +9 -9
  124. package/out-tsc/src/templates/TemplateEditor.js.map +1 -1
  125. package/out-tsc/src/textinput/TextInput.js +1 -1
  126. package/out-tsc/src/textinput/TextInput.js.map +1 -1
  127. package/out-tsc/src/thumbnail/Thumbnail.js +5 -5
  128. package/out-tsc/src/thumbnail/Thumbnail.js.map +1 -1
  129. package/out-tsc/src/tip/Tip.js +3 -3
  130. package/out-tsc/src/tip/Tip.js.map +1 -1
  131. package/out-tsc/src/utils/index.js +21 -21
  132. package/out-tsc/src/utils/index.js.map +1 -1
  133. package/out-tsc/src/vectoricon/VectorIcon.js +2 -2
  134. package/out-tsc/src/vectoricon/VectorIcon.js.map +1 -1
  135. package/out-tsc/src/vectoricon/index.js +2 -0
  136. package/out-tsc/src/vectoricon/index.js.map +1 -1
  137. package/out-tsc/src/webchat/WebChat.js +234 -81
  138. package/out-tsc/src/webchat/WebChat.js.map +1 -1
  139. package/out-tsc/src/webchat/assets.js +2 -0
  140. package/out-tsc/src/webchat/assets.js.map +1 -0
  141. package/out-tsc/src/webchat/index.js.map +1 -1
  142. package/out-tsc/test/temba-alert.test.js +1 -1
  143. package/out-tsc/test/temba-alert.test.js.map +1 -1
  144. package/out-tsc/test/temba-checkbox.test.js.map +1 -1
  145. package/out-tsc/test/temba-color-picker.test.js +4 -4
  146. package/out-tsc/test/temba-color-picker.test.js.map +1 -1
  147. package/out-tsc/test/temba-compose.test.js +50 -54
  148. package/out-tsc/test/temba-compose.test.js.map +1 -1
  149. package/out-tsc/test/temba-contact-badges.test.js +2 -2
  150. package/out-tsc/test/temba-contact-badges.test.js.map +1 -1
  151. package/out-tsc/test/temba-contact-chat.test.js +25 -38
  152. package/out-tsc/test/temba-contact-chat.test.js.map +1 -1
  153. package/out-tsc/test/temba-contact-details.test.js +2 -2
  154. package/out-tsc/test/temba-contact-details.test.js.map +1 -1
  155. package/out-tsc/test/temba-contact-fields.test.js +4 -4
  156. package/out-tsc/test/temba-contact-fields.test.js.map +1 -1
  157. package/out-tsc/test/temba-contact-history.test.js +3 -3
  158. package/out-tsc/test/temba-contact-history.test.js.map +1 -1
  159. package/out-tsc/test/temba-contact-search.test.js +7 -7
  160. package/out-tsc/test/temba-contact-search.test.js.map +1 -1
  161. package/out-tsc/test/temba-contact-tickets.test.js +3 -3
  162. package/out-tsc/test/temba-contact-tickets.test.js.map +1 -1
  163. package/out-tsc/test/temba-content-menu.test.js +7 -7
  164. package/out-tsc/test/temba-content-menu.test.js.map +1 -1
  165. package/out-tsc/test/temba-date.test.js +3 -3
  166. package/out-tsc/test/temba-date.test.js.map +1 -1
  167. package/out-tsc/test/temba-datepicker.test.js +1 -1
  168. package/out-tsc/test/temba-datepicker.test.js.map +1 -1
  169. package/out-tsc/test/temba-field-manager.test.js +1 -3
  170. package/out-tsc/test/temba-field-manager.test.js.map +1 -1
  171. package/out-tsc/test/temba-label.test.js +6 -6
  172. package/out-tsc/test/temba-label.test.js.map +1 -1
  173. package/out-tsc/test/temba-lightbox.test.js +2 -2
  174. package/out-tsc/test/temba-lightbox.test.js.map +1 -1
  175. package/out-tsc/test/temba-list.test.js +6 -6
  176. package/out-tsc/test/temba-list.test.js.map +1 -1
  177. package/out-tsc/test/temba-menu.test.js +4 -5
  178. package/out-tsc/test/temba-menu.test.js.map +1 -1
  179. package/out-tsc/test/temba-modax.test.js +3 -3
  180. package/out-tsc/test/temba-modax.test.js.map +1 -1
  181. package/out-tsc/test/temba-options.test.js +1 -1
  182. package/out-tsc/test/temba-options.test.js.map +1 -1
  183. package/out-tsc/test/temba-select.test.js +17 -17
  184. package/out-tsc/test/temba-select.test.js.map +1 -1
  185. package/out-tsc/test/temba-sortable-list.test.js +1 -1
  186. package/out-tsc/test/temba-sortable-list.test.js.map +1 -1
  187. package/out-tsc/test/temba-textinput.test.js +2 -2
  188. package/out-tsc/test/temba-textinput.test.js.map +1 -1
  189. package/out-tsc/test/temba-tip.test.js +4 -4
  190. package/out-tsc/test/temba-tip.test.js.map +1 -1
  191. package/out-tsc/test/utils.test.js +8 -8
  192. package/out-tsc/test/utils.test.js.map +1 -1
  193. package/package.json +6 -15
  194. package/src/RapidElement.ts +3 -3
  195. package/src/ResizeElement.ts +2 -2
  196. package/src/aliaseditor/AliasEditor.ts +1 -2
  197. package/src/button/Button.ts +1 -1
  198. package/src/charcount/helpers.ts +1 -1
  199. package/src/colorpicker/ColorPicker.ts +4 -4
  200. package/src/completion/Completion.ts +2 -2
  201. package/src/completion/ExcellentParser.ts +1 -1
  202. package/src/completion/helpers.ts +9 -9
  203. package/src/compose/Compose.ts +18 -16
  204. package/src/contacts/ContactBadges.ts +2 -2
  205. package/src/contacts/ContactChat.ts +4 -4
  206. package/src/contacts/ContactDetails.ts +4 -4
  207. package/src/contacts/ContactFieldEditor.ts +4 -4
  208. package/src/contacts/ContactFields.ts +2 -2
  209. package/src/contacts/ContactHistory.ts +25 -22
  210. package/src/contacts/ContactPending.ts +4 -4
  211. package/src/contacts/ContactTickets.ts +9 -9
  212. package/src/contacts/events.ts +3 -3
  213. package/src/contacts/helpers.ts +2 -2
  214. package/src/contactsearch/ContactSearch.ts +9 -9
  215. package/src/date/TembaDate.ts +1 -1
  216. package/src/datepicker/DatePicker.ts +1 -1
  217. package/src/dialog/Dialog.ts +6 -6
  218. package/src/dialog/Modax.ts +8 -8
  219. package/src/dropdown/Dropdown.ts +1 -2
  220. package/src/emojis.json +1882 -1
  221. package/src/fields/FieldManager.ts +6 -7
  222. package/src/imagepicker/ImagePicker.ts +4 -4
  223. package/src/interfaces.ts +4 -4
  224. package/src/label/Label.ts +1 -1
  225. package/src/leafletmap/LeafletMap.ts +6 -6
  226. package/src/leafletmap/helpers.ts +2 -2
  227. package/src/lightbox/Lightbox.ts +2 -2
  228. package/src/list/ContentMenu.ts +9 -9
  229. package/src/list/NotificationList.ts +7 -3
  230. package/src/list/RunList.ts +1 -1
  231. package/src/list/SortableList.ts +6 -6
  232. package/src/list/TembaList.ts +5 -5
  233. package/src/list/TembaMenu.ts +23 -23
  234. package/src/loading/Loading.ts +1 -1
  235. package/src/locales/es.ts +1 -1
  236. package/src/locales/fr.ts +1 -1
  237. package/src/locales/pt.ts +1 -1
  238. package/src/omnibox/Omnibox.ts +2 -2
  239. package/src/options/Options.ts +9 -9
  240. package/src/remote/Remote.ts +1 -1
  241. package/src/select/Select.ts +19 -19
  242. package/src/sms/gsmsplitter.ts +8 -8
  243. package/src/sms/gsmvalidator.ts +1 -1
  244. package/src/sms/index.ts +2 -2
  245. package/src/sms/unicodesplitter.ts +8 -8
  246. package/src/store/Store.ts +10 -10
  247. package/src/store/StoreElement.ts +2 -2
  248. package/src/tabpane/TabPane.ts +4 -4
  249. package/src/templates/TemplateEditor.ts +9 -9
  250. package/src/textinput/TextInput.ts +2 -2
  251. package/src/thumbnail/Thumbnail.ts +5 -5
  252. package/src/tip/Tip.ts +3 -3
  253. package/src/utils/index.ts +24 -24
  254. package/src/vectoricon/VectorIcon.ts +2 -2
  255. package/src/vectoricon/index.ts +3 -1
  256. package/src/webchat/WebChat.ts +272 -87
  257. package/src/webchat/assets.ts +2 -0
  258. package/src/webchat/index.ts +1 -1
  259. package/svg.js +28 -29
  260. package/test/temba-alert.test.ts +1 -1
  261. package/test/temba-checkbox.test.ts +1 -1
  262. package/test/temba-color-picker.test.ts +4 -4
  263. package/test/temba-compose.test.ts +50 -55
  264. package/test/temba-contact-badges.test.ts +2 -2
  265. package/test/temba-contact-chat.test.ts +26 -46
  266. package/test/temba-contact-details.test.ts +2 -8
  267. package/test/temba-contact-fields.test.ts +4 -11
  268. package/test/temba-contact-history.test.ts +3 -3
  269. package/test/temba-contact-search.test.ts +7 -13
  270. package/test/temba-contact-tickets.test.ts +3 -3
  271. package/test/temba-content-menu.test.ts +7 -7
  272. package/test/temba-date.test.ts +3 -3
  273. package/test/temba-datepicker.test.ts +1 -1
  274. package/test/temba-field-manager.test.ts +1 -4
  275. package/test/temba-label.test.ts +6 -6
  276. package/test/temba-lightbox.test.ts +2 -2
  277. package/test/temba-list.test.ts +6 -6
  278. package/test/temba-menu.test.ts +4 -5
  279. package/test/temba-modax.test.ts +3 -3
  280. package/test/temba-options.test.ts +1 -1
  281. package/test/temba-select.test.ts +17 -17
  282. package/test/temba-sortable-list.test.ts +1 -1
  283. package/test/temba-textinput.test.ts +2 -2
  284. package/test/temba-tip.test.ts +5 -5
  285. package/test/utils.test.ts +8 -9
@@ -171,7 +171,7 @@ export class ContactChat extends ContactStoreElement {
171
171
  const buttonName = evt.detail.name;
172
172
  if (buttonName === 'Send') {
173
173
  const payload = {
174
- contact: this.currentContact.uuid,
174
+ contact: this.currentContact.uuid
175
175
  };
176
176
  const compose = evt.currentTarget as Compose;
177
177
  if (compose) {
@@ -182,7 +182,7 @@ export class ContactChat extends ContactStoreElement {
182
182
  const attachments = compose.currentAttachments;
183
183
  if (attachments && attachments.length > 0) {
184
184
  const attachment_uuids = attachments.map(
185
- attachment => attachment.uuid
185
+ (attachment) => attachment.uuid
186
186
  );
187
187
  payload['attachments'] = attachment_uuids;
188
188
  }
@@ -194,7 +194,7 @@ export class ContactChat extends ContactStoreElement {
194
194
  const genericError = buttonName + ' failed, please try again.';
195
195
 
196
196
  postJSON(`/api/v2/messages.json`, payload)
197
- .then(response => {
197
+ .then((response) => {
198
198
  if (response.status < 400) {
199
199
  compose.reset();
200
200
  this.refresh(true);
@@ -231,7 +231,7 @@ export class ContactChat extends ContactStoreElement {
231
231
  compose.buttonError = genericError;
232
232
  }
233
233
  })
234
- .catch(error => {
234
+ .catch((error) => {
235
235
  console.error(error);
236
236
  compose.buttonError = genericError;
237
237
  });
@@ -7,14 +7,14 @@ const STATUS = {
7
7
  active: 'Active',
8
8
  blocked: 'Blocked',
9
9
  stopped: 'Stopped',
10
- archived: 'Archived',
10
+ archived: 'Archived'
11
11
  };
12
12
 
13
13
  const SCHEMES = {
14
14
  tel: 'Phone',
15
15
  whatsapp: 'WhatsApp',
16
16
  fcm: 'Firebase Cloud Messaging',
17
- twitter: 'Twitter',
17
+ twitter: 'Twitter'
18
18
  };
19
19
 
20
20
  export class ContactDetails extends ContactStoreElement {
@@ -69,7 +69,7 @@ export class ContactDetails extends ContactStoreElement {
69
69
  ${this.data.groups.length > 0
70
70
  ? html` <div class="groups">
71
71
  <div class="label">Groups</div>
72
- ${this.data.groups.map(group => {
72
+ ${this.data.groups.map((group) => {
73
73
  return html`<temba-label
74
74
  class="group"
75
75
  onclick="goto(event)"
@@ -82,7 +82,7 @@ export class ContactDetails extends ContactStoreElement {
82
82
  })}
83
83
  </div>`
84
84
  : null}
85
- ${this.data.urns.map(urn => {
85
+ ${this.data.urns.map((urn) => {
86
86
  const parts = urn.split(':');
87
87
  let scheme = SCHEMES[parts[0]];
88
88
  if (!scheme) {
@@ -11,7 +11,7 @@ enum Status {
11
11
  Success = 'success',
12
12
  Failure = 'failure',
13
13
  Saving = 'saving',
14
- Ready = 'ready',
14
+ Ready = 'ready'
15
15
  }
16
16
 
17
17
  export class ContactFieldEditor extends RapidElement {
@@ -318,7 +318,7 @@ export class ContactFieldEditor extends RapidElement {
318
318
  if (icon === 'search') {
319
319
  this.fireCustomEvent(CustomEventType.ButtonClicked, {
320
320
  key: this.key,
321
- value: this.value,
321
+ value: this.value
322
322
  });
323
323
  }
324
324
 
@@ -393,7 +393,7 @@ export class ContactFieldEditor extends RapidElement {
393
393
  unset: !this.value,
394
394
  disabled: this.disabled,
395
395
  mutable: !this.disabled,
396
- dirty: this.dirty,
396
+ dirty: this.dirty
397
397
  })}
398
398
  >
399
399
  <div class="label"><div class="name">${this.name}</div></div>
@@ -444,7 +444,7 @@ export class ContactFieldEditor extends RapidElement {
444
444
  unset: !this.value,
445
445
  disabled: this.disabled,
446
446
  mutable: !this.disabled,
447
- dirty: this.dirty,
447
+ dirty: this.dirty
448
448
  })}
449
449
  >
450
450
  ${this.type === 'datetime'
@@ -111,7 +111,7 @@ export class ContactFields extends ContactStoreElement {
111
111
  const field = evt.currentTarget as ContactFieldEditor;
112
112
  const value = field.value;
113
113
  postJSON('/api/v2/contacts.json?uuid=' + this.data.uuid, {
114
- fields: { [field.key]: value },
114
+ fields: { [field.key]: value }
115
115
  })
116
116
  .then((response: any) => {
117
117
  field.handleResponse(response);
@@ -119,7 +119,7 @@ export class ContactFields extends ContactStoreElement {
119
119
  // returns a single contact with latest updates
120
120
  this.setContact(response.json);
121
121
  })
122
- .catch(error => {
122
+ .catch((error) => {
123
123
  field.handleResponse(error);
124
124
  });
125
125
  }
@@ -1,7 +1,7 @@
1
1
  import { css } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
3
  import { html, TemplateResult } from 'lit-html';
4
- import { Contact, CustomEventType, Msg, Ticket } from '../interfaces';
4
+ import { Contact, CustomEventType, Ticket } from '../interfaces';
5
5
  import { RapidElement } from '../RapidElement';
6
6
  import { Asset, getAssets, getClasses, postJSON, throttle } from '../utils';
7
7
 
@@ -42,20 +42,19 @@ import {
42
42
  renderResultEvent,
43
43
  renderTicketAction,
44
44
  renderTicketAssigned,
45
- renderTicketOpened,
46
45
  renderUpdateEvent,
47
46
  renderWebhookEvent,
48
47
  TicketEvent,
49
48
  UpdateFieldEvent,
50
49
  UpdateResultEvent,
51
50
  URNsChangedEvent,
52
- WebhookEvent,
51
+ WebhookEvent
53
52
  } from './events';
54
53
  import {
55
54
  fetchContactHistory,
56
55
  MAX_CHAT_REFRESH,
57
56
  MIN_CHAT_REFRESH,
58
- SCROLL_THRESHOLD,
57
+ SCROLL_THRESHOLD
59
58
  } from './helpers';
60
59
  import { Lightbox } from '../lightbox/Lightbox';
61
60
  import { Store } from '../store/Store';
@@ -100,7 +99,7 @@ export class ContactHistory extends RapidElement {
100
99
  }
101
100
 
102
101
  private getTicket(uuid: string) {
103
- return (this.tickets || []).find(ticket => ticket.uuid === uuid);
102
+ return (this.tickets || []).find((ticket) => ticket.uuid === uuid);
104
103
  }
105
104
 
106
105
  static get styles() {
@@ -313,11 +312,11 @@ export class ContactHistory extends RapidElement {
313
312
  // dedupe any events we get from the server
314
313
  // TODO: perhaps make this a little less crazy
315
314
  let removed = 0;
316
- this.eventGroups.forEach(g => {
315
+ this.eventGroups.forEach((g) => {
317
316
  const before = g.events.length;
318
317
  g.events = g.events.filter(
319
- prev =>
320
- !fetchedEvents.find(fetched => {
318
+ (prev) =>
319
+ !fetchedEvents.find((fetched) => {
321
320
  return (
322
321
  prev.created_on == fetched.created_on &&
323
322
  prev.type === fetched.type
@@ -339,7 +338,9 @@ export class ContactHistory extends RapidElement {
339
338
  )[0];
340
339
 
341
340
  forceOpen = sliced.open;
342
- fetchedEvents.splice(0, 0, ...sliced.events);
341
+ if (sliced.events.length > 0) {
342
+ fetchedEvents.splice(0, 0, ...sliced.events);
343
+ }
343
344
  }
344
345
 
345
346
  const grouped = this.getEventGroups(fetchedEvents);
@@ -347,7 +348,9 @@ export class ContactHistory extends RapidElement {
347
348
  if (forceOpen) {
348
349
  grouped[grouped.length - 1].open = forceOpen;
349
350
  }
350
- this.eventGroups = [...previousGroups, ...grouped];
351
+ this.eventGroups = [...previousGroups, ...grouped].filter(
352
+ (group) => group.events.length > 0
353
+ );
351
354
  }
352
355
  this.refreshing = false;
353
356
  this.scheduleRefresh();
@@ -491,14 +494,14 @@ export class ContactHistory extends RapidElement {
491
494
  const events = this.getEventsPane();
492
495
  events.scrollTo({
493
496
  top: events.scrollHeight,
494
- behavior: smooth ? 'smooth' : 'auto',
497
+ behavior: smooth ? 'smooth' : 'auto'
495
498
  });
496
499
  this.showMessageAlert = false;
497
500
 
498
501
  window.setTimeout(() => {
499
502
  events.scrollTo({
500
503
  top: events.scrollHeight,
501
- behavior: smooth ? 'smooth' : 'auto',
504
+ behavior: smooth ? 'smooth' : 'auto'
502
505
  });
503
506
  }, 0);
504
507
  }
@@ -521,7 +524,7 @@ export class ContactHistory extends RapidElement {
521
524
  eventGroup = {
522
525
  open: false,
523
526
  events: [event],
524
- type: currentEventGroupType,
527
+ type: currentEventGroupType
525
528
  };
526
529
  } else {
527
530
  // our event matches the current group, stuff it in there
@@ -716,13 +719,13 @@ export class ContactHistory extends RapidElement {
716
719
  private handleClose(uuid: string) {
717
720
  this.httpComplete = postJSON(`/api/v2/ticket_actions.json`, {
718
721
  tickets: [uuid],
719
- action: 'close',
722
+ action: 'close'
720
723
  })
721
724
  .then(() => {
722
725
  this.refreshTickets();
723
726
  this.refresh();
724
727
  this.fireCustomEvent(CustomEventType.ContentChanged, {
725
- ticket: { uuid, status: 'closed' },
728
+ ticket: { uuid, status: 'closed' }
726
729
  });
727
730
  })
728
731
  .catch((response: any) => {
@@ -738,14 +741,14 @@ export class ContactHistory extends RapidElement {
738
741
  const ticket = assets[0] as Ticket;
739
742
  if (ticket.assignee && ticket.assignee.email === agent) {
740
743
  this.fireCustomEvent(CustomEventType.ContentChanged, {
741
- ticket: { uuid: this.ticket, assigned: 'self' },
744
+ ticket: { uuid: this.ticket, assigned: 'self' }
742
745
  });
743
746
  } else {
744
747
  this.fireCustomEvent(CustomEventType.ContentChanged, {
745
748
  ticket: {
746
749
  uuid: this.ticket,
747
- assigned: ticket.assignee ? ticket.assignee : null,
748
- },
750
+ assigned: ticket.assignee ? ticket.assignee : null
751
+ }
749
752
  });
750
753
  }
751
754
  }
@@ -756,8 +759,8 @@ export class ContactHistory extends RapidElement {
756
759
  return [
757
760
  {
758
761
  event: 'scroll',
759
- method: throttle(this.handleScroll, 50),
760
- },
762
+ method: throttle(this.handleScroll, 50)
763
+ }
761
764
  ];
762
765
  }
763
766
 
@@ -805,7 +808,7 @@ export class ContactHistory extends RapidElement {
805
808
  const classes = getClasses({
806
809
  grouping: true,
807
810
  [grouping]: true,
808
- expanded: eventGroup.open,
811
+ expanded: eventGroup.open
809
812
  });
810
813
  return html`<div class="${classes}">
811
814
  ${grouping === 'verbose'
@@ -857,7 +860,7 @@ export class ContactHistory extends RapidElement {
857
860
  this.scrollToBottom(true);
858
861
  }}
859
862
  class="new-messages ${getClasses({
860
- expanded: this.showMessageAlert,
863
+ expanded: this.showMessageAlert
861
864
  })}"
862
865
  >
863
866
  New Messages
@@ -3,7 +3,7 @@ import { property } from 'lit/decorators.js';
3
3
  import {
4
4
  CustomEventType,
5
5
  ScheduledEvent,
6
- ScheduledEventType,
6
+ ScheduledEventType
7
7
  } from '../interfaces';
8
8
  import { StoreElement } from '../store/StoreElement';
9
9
  import { Icon } from '../vectoricon';
@@ -11,7 +11,7 @@ import { Icon } from '../vectoricon';
11
11
  const ICONS = {
12
12
  [ScheduledEventType.CampaignEvent]: Icon.campaign,
13
13
  [ScheduledEventType.ScheduledBroadcast]: Icon.message,
14
- [ScheduledEventType.ScheduledTrigger]: Icon.trigger,
14
+ [ScheduledEventType.ScheduledTrigger]: Icon.trigger
15
15
  };
16
16
 
17
17
  export class ContactPending extends StoreElement {
@@ -33,7 +33,7 @@ export class ContactPending extends StoreElement {
33
33
  REPEAT_PERIOD = {
34
34
  O: this.lang_once,
35
35
  D: this.lang_daily,
36
- W: this.lang_weekly,
36
+ W: this.lang_weekly
37
37
  };
38
38
 
39
39
  static get styles() {
@@ -226,7 +226,7 @@ export class ContactPending extends StoreElement {
226
226
  if (this.data) {
227
227
  if (this.data.length > 0) {
228
228
  return html`
229
- ${this.data.map(event => {
229
+ ${this.data.map((event) => {
230
230
  return this.renderEvent(event);
231
231
  })}
232
232
  `;
@@ -1,6 +1,6 @@
1
1
  import { css, html, PropertyValueMap, TemplateResult } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
- import { CustomEventType, Ticket, TicketStatus, User } from '../interfaces';
3
+ import { CustomEventType, Ticket, TicketStatus } from '../interfaces';
4
4
  import { StoreElement } from '../store/StoreElement';
5
5
  import { getClasses, postJSON, stopEvent } from '../utils';
6
6
  import { Icon } from '../vectoricon';
@@ -244,7 +244,7 @@ export class ContactTickets extends StoreElement {
244
244
  private handleClose(uuid: string) {
245
245
  postJSON(`/api/v2/ticket_actions.json`, {
246
246
  tickets: [uuid],
247
- action: 'close',
247
+ action: 'close'
248
248
  })
249
249
  .then(() => {
250
250
  this.refresh();
@@ -257,7 +257,7 @@ export class ContactTickets extends StoreElement {
257
257
  private handleReopen(uuid: string) {
258
258
  postJSON(`/api/v2/ticket_actions.json`, {
259
259
  tickets: [uuid],
260
- action: 'reopen',
260
+ action: 'reopen'
261
261
  })
262
262
  .then(() => {
263
263
  this.refresh();
@@ -269,7 +269,7 @@ export class ContactTickets extends StoreElement {
269
269
 
270
270
  public handleTicketAssignment(uuid: string, email: string) {
271
271
  // if its already assigned to use, it's a noop
272
- const ticket = this.data.find(ticket => ticket.uuid === uuid);
272
+ const ticket = this.data.find((ticket) => ticket.uuid === uuid);
273
273
  if (ticket.assignee && ticket.assignee.email === email) {
274
274
  return;
275
275
  }
@@ -278,7 +278,7 @@ export class ContactTickets extends StoreElement {
278
278
  postJSON(`/api/v2/ticket_actions.json`, {
279
279
  tickets: [uuid],
280
280
  action: 'assign',
281
- assignee: email,
281
+ assignee: email
282
282
  })
283
283
  .then(() => {
284
284
  this.refresh();
@@ -292,7 +292,7 @@ export class ContactTickets extends StoreElement {
292
292
  public renderTicket(ticket: Ticket) {
293
293
  const date = ticket.opened_on;
294
294
  const users = this.store.getAssignableUsers();
295
- const agent = users.find(user => user.email === this.agent);
295
+ const agent = users.find((user) => user.email === this.agent);
296
296
  return html`
297
297
  <div
298
298
  @click=${() => {
@@ -305,7 +305,7 @@ export class ContactTickets extends StoreElement {
305
305
  class="ticket ${ticket.status} ${getClasses({
306
306
  clickable: this.clickable,
307
307
  expandable: this.expandable,
308
- expanded: this.expanded,
308
+ expanded: this.expanded
309
309
  })}"
310
310
  >
311
311
  <div class="header">
@@ -414,7 +414,7 @@ export class ContactTickets extends StoreElement {
414
414
  : null}
415
415
 
416
416
  <div class="options option-group">
417
- ${this.store.getAssignableUsers().map(user => {
417
+ ${this.store.getAssignableUsers().map((user) => {
418
418
  if (
419
419
  ticket.assignee &&
420
420
  user.email === ticket.assignee.email
@@ -472,7 +472,7 @@ export class ContactTickets extends StoreElement {
472
472
 
473
473
  public render(): TemplateResult {
474
474
  if (this.data && this.data.length > 0) {
475
- const tickets = this.data.map(ticket => {
475
+ const tickets = this.data.map((ticket) => {
476
476
  return this.renderTicket(ticket);
477
477
  });
478
478
  return html`${tickets}`;
@@ -515,7 +515,7 @@ export enum Events {
515
515
  TICKET_REOPENED = 'ticket_reopened',
516
516
  OPTIN_REQUESTED = 'optin_requested',
517
517
  ERROR = 'error',
518
- FAILURE = 'failure',
518
+ FAILURE = 'failure'
519
519
  }
520
520
 
521
521
  export interface ContactEvent {
@@ -830,7 +830,7 @@ export const renderMsgEvent = (event: MsgEvent): TemplateResult => {
830
830
  event.msg.attachments || []
831
831
  ).length} ${getClasses({
832
832
  msg: true,
833
- automated: !isInbound && !event.created_by,
833
+ automated: !isInbound && !event.created_by
834
834
  })}"
835
835
  >
836
836
  ${event.msg.text
@@ -839,7 +839,7 @@ export const renderMsgEvent = (event: MsgEvent): TemplateResult => {
839
839
  ${event.msg.attachments
840
840
  ? html`<div class="attachments">
841
841
  ${event.msg.attachments.map(
842
- attachment =>
842
+ (attachment) =>
843
843
  html` <div class="attachment">
844
844
  ${renderAttachment(attachment)}
845
845
  </div>`
@@ -36,13 +36,13 @@ export const fetchContactHistory = (
36
36
  after: number = undefined
37
37
  ): Promise<ContactHistoryPage> => {
38
38
  if (reset) {
39
- pendingRequests.forEach(controller => {
39
+ pendingRequests.forEach((controller) => {
40
40
  controller.abort();
41
41
  });
42
42
  pendingRequests = [];
43
43
  }
44
44
 
45
- return new Promise<ContactHistoryPage>(resolve => {
45
+ return new Promise<ContactHistoryPage>((resolve) => {
46
46
  const controller = new AbortController();
47
47
  pendingRequests.push(controller);
48
48
 
@@ -1,4 +1,4 @@
1
- import { TemplateResult, html, css, PropertyValueMap } from 'lit';
1
+ import { TemplateResult, html, css } from 'lit';
2
2
  import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
3
3
  import { property } from 'lit/decorators.js';
4
4
  import { getClasses, postJSON, stopEvent, WebResponse } from '../utils';
@@ -8,7 +8,7 @@ import { Contact, CustomEventType } from '../interfaces';
8
8
  import { FormElement } from '../FormElement';
9
9
  import { Checkbox } from '../checkbox/Checkbox';
10
10
  import { msg } from '@lit/localize';
11
- import { OmniOption, Omnibox } from '../omnibox/Omnibox';
11
+ import { OmniOption } from '../omnibox/Omnibox';
12
12
 
13
13
  const QUEIT_MILLIS = 2000;
14
14
 
@@ -303,7 +303,7 @@ export class ContactSearch extends FormElement {
303
303
  ? { query: this.query }
304
304
  : { contact_uuids, group_uuids },
305
305
 
306
- exclude: this.exclusions,
306
+ exclude: this.exclusions
307
307
  }).then((response: WebResponse) => {
308
308
  this.fetching = false;
309
309
  if (response.status === 200) {
@@ -315,7 +315,7 @@ export class ContactSearch extends FormElement {
315
315
  advanced: this.advanced,
316
316
  query: this.query,
317
317
  exclusions: this.exclusions,
318
- recipients: this.recipients,
318
+ recipients: this.recipients
319
319
  });
320
320
 
321
321
  if (this.summary.error) {
@@ -351,7 +351,7 @@ export class ContactSearch extends FormElement {
351
351
  advanced: this.advanced,
352
352
  query: this.query,
353
353
  exclusions: this.exclusions,
354
- recipients: this.recipients,
354
+ recipients: this.recipients
355
355
  });
356
356
  }
357
357
 
@@ -360,7 +360,7 @@ export class ContactSearch extends FormElement {
360
360
  this.query = input.inputElement.value;
361
361
  }
362
362
 
363
- private handleRecipientsChanged(evt: any) {
363
+ private handleRecipientsChanged() {
364
364
  if (this.refreshKey !== '0' || this.initialized) {
365
365
  this.refresh();
366
366
  } else {
@@ -441,7 +441,7 @@ export class ContactSearch extends FormElement {
441
441
  this.summary.blockers.length > 0
442
442
  ) {
443
443
  return html`${this.summary.blockers.map(
444
- error =>
444
+ (error) =>
445
445
  html`<temba-alert level="error">${unsafeHTML(error)}</temba-alert>`
446
446
  )}`;
447
447
  }
@@ -520,7 +520,7 @@ export class ContactSearch extends FormElement {
520
520
  initialized: this.initialized || this.fetching,
521
521
  empty:
522
522
  ((this.summary && this.summary.error) || !this.summary) &&
523
- !this.fetching,
523
+ !this.fetching
524
524
  })}"
525
525
  >
526
526
  <temba-loading units="6" size="8"></temba-loading>
@@ -529,7 +529,7 @@ export class ContactSearch extends FormElement {
529
529
 
530
530
  ${this.summary && this.summary.warnings
531
531
  ? this.summary.warnings.map(
532
- warning =>
532
+ (warning) =>
533
533
  html`<temba-alert level="warning"
534
534
  >${unsafeHTML(warning)}</temba-alert
535
535
  >`
@@ -11,7 +11,7 @@ export const Display = {
11
11
  timedate: 'timedate',
12
12
  duration: 'duration',
13
13
  relative: 'relative',
14
- day: 'LLL d',
14
+ day: 'LLL d'
15
15
  };
16
16
 
17
17
  export class TembaDate extends RapidElement {
@@ -186,7 +186,7 @@ export default class DatePicker extends FormElement {
186
186
  event.stopPropagation();
187
187
  if (this.time) {
188
188
  this.datetime = DateTime.fromISO(event.target.value, {
189
- zone: this.timezone,
189
+ zone: this.timezone
190
190
  });
191
191
  this.value = this.datetime.toUTC().toISO();
192
192
  } else {
@@ -9,7 +9,7 @@ import { ResizeElement } from '../ResizeElement';
9
9
  export enum ButtonType {
10
10
  PRIMARY = 'primary',
11
11
  SECONDARY = 'secondary',
12
- DESTRUCTIVE = 'destructive',
12
+ DESTRUCTIVE = 'destructive'
13
13
  }
14
14
  export class DialogButton {
15
15
  name?: string;
@@ -24,7 +24,7 @@ export class Dialog extends ResizeElement {
24
24
  return {
25
25
  small: '400px',
26
26
  medium: '600px',
27
- large: '655px',
27
+ large: '655px'
28
28
  };
29
29
  }
30
30
 
@@ -265,14 +265,14 @@ export class Dialog extends ResizeElement {
265
265
  this.buttons.push({
266
266
  name: this.cancelButtonName,
267
267
  type: ButtonType.SECONDARY,
268
- closes: true,
268
+ closes: true
269
269
  });
270
270
  }
271
271
 
272
272
  if (changes.has('primaryButtonName') && this.primaryButtonName) {
273
273
  this.buttons.push({
274
274
  name: this.primaryButtonName,
275
- type: ButtonType.PRIMARY,
275
+ type: ButtonType.PRIMARY
276
276
  });
277
277
  }
278
278
  }
@@ -409,7 +409,7 @@ export class Dialog extends ResizeElement {
409
409
  const dialogStyle = {
410
410
  width: this.width,
411
411
  minWidth: '250px',
412
- maxWidth: '600px',
412
+ maxWidth: '600px'
413
413
  };
414
414
  if (!this.width) {
415
415
  dialogStyle['width'] = Dialog.widths[this.size];
@@ -440,7 +440,7 @@ export class Dialog extends ResizeElement {
440
440
  'dialog-loading': this.loading,
441
441
  'dialog-animation-end': this.animationEnd,
442
442
  'dialog-ready': this.ready,
443
- mobile: this.isMobile(),
443
+ mobile: this.isMobile()
444
444
  })}"
445
445
  >
446
446
  <div style="position: absolute; width: 100%;">
@@ -206,11 +206,11 @@ export class Modax extends RapidElement {
206
206
  if (submitButton) {
207
207
  this.buttons = [
208
208
  { type: ButtonType.SECONDARY, name: 'Cancel', closes: true },
209
- { type: ButtonType.PRIMARY, name: submitButton.value },
209
+ { type: ButtonType.PRIMARY, name: submitButton.value }
210
210
  ];
211
211
  } else {
212
212
  this.buttons = [
213
- { type: ButtonType.SECONDARY, name: 'Ok', closes: true },
213
+ { type: ButtonType.SECONDARY, name: 'Ok', closes: true }
214
214
  ];
215
215
  }
216
216
  this.submitting = false;
@@ -289,7 +289,7 @@ export class Modax extends RapidElement {
289
289
  this.updateComplete.then(() => {
290
290
  this.updatePrimaryButton();
291
291
  this.fireCustomEvent(CustomEventType.Loaded, {
292
- body: this.getBody(),
292
+ body: this.getBody()
293
293
  });
294
294
  });
295
295
  }
@@ -303,7 +303,7 @@ export class Modax extends RapidElement {
303
303
 
304
304
  let postData = form ? serialize(form) : '';
305
305
  if (extra) {
306
- Object.keys(extra).forEach(key => {
306
+ Object.keys(extra).forEach((key) => {
307
307
  postData +=
308
308
  (postData.length > 1 ? '&' : '') +
309
309
  encodeURIComponent(key) +
@@ -337,7 +337,7 @@ export class Modax extends RapidElement {
337
337
  });
338
338
  } else {
339
339
  this.fireCustomEvent(CustomEventType.Redirected, {
340
- url: redirect,
340
+ url: redirect
341
341
  });
342
342
  this.open = false;
343
343
  }
@@ -351,7 +351,7 @@ export class Modax extends RapidElement {
351
351
  }
352
352
  }, 1000);
353
353
  })
354
- .catch(error => {
354
+ .catch((error) => {
355
355
  console.error(error);
356
356
  });
357
357
  }
@@ -404,7 +404,7 @@ export class Modax extends RapidElement {
404
404
  if (wizard) {
405
405
  const completed = (wizard.getAttribute('data-completed') || '')
406
406
  .split(',')
407
- .filter(step => step.length > 0);
407
+ .filter((step) => step.length > 0);
408
408
 
409
409
  for (let i = 0; i < this.wizardStepCount; i++) {
410
410
  wizardStepBalls.push(
@@ -414,7 +414,7 @@ export class Modax extends RapidElement {
414
414
  class="${getClasses({
415
415
  'step-ball': true,
416
416
  active: this.wizardStep - 1 === i,
417
- complete: i < completed.length,
417
+ complete: i < completed.length
418
418
  })}"
419
419
  ></div>`
420
420
  );
@@ -2,7 +2,6 @@ import { css, html, TemplateResult } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
3
  import { RapidElement } from '../RapidElement';
4
4
  import { getClasses } from '../utils';
5
- import { ContactStoreElement } from '../contacts/ContactStoreElement';
6
5
 
7
6
  export class Dropdown extends RapidElement {
8
7
  static get styles() {
@@ -249,7 +248,7 @@ export class Dropdown extends RapidElement {
249
248
  right: this.right,
250
249
  left: this.left,
251
250
  top: this.top,
252
- bottom: this.bottom,
251
+ bottom: this.bottom
253
252
  })}"
254
253
  tabindex="0"
255
254
  @mousedown=${this.handleDropdownMouseDown}