@nyaruka/temba-components 0.164.0 → 0.166.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 (55) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/DEV_DATA.md +11 -11
  3. package/README.md +4 -4
  4. package/TEST_OPTIMIZATION.md +8 -11
  5. package/dist/locales/es.js +4 -0
  6. package/dist/locales/es.js.map +1 -1
  7. package/dist/locales/fr.js +4 -0
  8. package/dist/locales/fr.js.map +1 -1
  9. package/dist/locales/pt.js +4 -0
  10. package/dist/locales/pt.js.map +1 -1
  11. package/dist/static/svg/index.svg +1 -1
  12. package/dist/temba-components.js +1983 -865
  13. package/dist/temba-components.js.map +1 -1
  14. package/orca/setup.sh +2 -2
  15. package/package.json +13 -18
  16. package/scripts/dev-data-sync.mjs +4 -4
  17. package/src/Icons.ts +3 -2
  18. package/src/display/Chat.ts +232 -18
  19. package/src/display/ProgressBar.ts +15 -2
  20. package/src/form/Compose.ts +31 -1
  21. package/src/form/ContactSearch.ts +229 -126
  22. package/src/interfaces.ts +73 -0
  23. package/src/layout/Card.ts +25 -0
  24. package/src/layout/CardLayout.ts +3 -3
  25. package/src/layout/HeaderBar.ts +4 -1
  26. package/src/list/BroadcastList.ts +912 -0
  27. package/src/list/ContentList.ts +46 -10
  28. package/src/list/FieldList.ts +1057 -0
  29. package/src/list/NotificationList.ts +131 -21
  30. package/src/list/SortableList.ts +7 -2
  31. package/src/list/TembaList.ts +19 -5
  32. package/src/list/TembaMenu.ts +47 -46
  33. package/src/live/CampaignEvents.ts +33 -19
  34. package/src/live/ContactChat.ts +190 -18
  35. package/src/live/ContactDetails.ts +20 -13
  36. package/src/live/ContactFieldEditor.ts +7 -3
  37. package/src/live/ContactStoreElement.ts +3 -1
  38. package/src/live/ContactTimeline.ts +28 -7
  39. package/src/live/Realtime.ts +133 -0
  40. package/src/live/SocketService.ts +24 -0
  41. package/src/locales/es.ts +4 -0
  42. package/src/locales/fr.ts +4 -0
  43. package/src/locales/pt.ts +4 -0
  44. package/src/store/Store.ts +12 -0
  45. package/src/utils.ts +4 -0
  46. package/static/svg/index.svg +1 -1
  47. package/static/svg/packs/2-temba/star-filled.svg +3 -0
  48. package/static/svg/work/traced/star-filled.svg +1 -0
  49. package/static/svg/work/used/star-filled.svg +3 -0
  50. package/stress-test.js +3 -3
  51. package/temba-modules.ts +4 -0
  52. package/web-test-runner.config.mjs +1 -1
  53. package/xliff/es.xlf +12 -0
  54. package/xliff/fr.xlf +12 -0
  55. package/xliff/pt.xlf +12 -0
package/src/locales/pt.ts CHANGED
@@ -13,6 +13,10 @@
13
13
  'scf1453991c986b25': `Tab to complete, enter to select`,
14
14
  'sbc913d7dc0f33877': `to add`,
15
15
  's81f17cfc89a04338': `Interrupt flow`,
16
+ 's122d4de68bcfcdf4': `It's okay to restart`,
17
+ 's3eb2567092b4d7c1': `from the beginning`,
18
+ 's28f37776b3901438': `It's okay to interrupt`,
19
+ 's6838d20b10f7512a': `and start this one`,
16
20
  's8f02e3a18ffc083a': `Are not currently in a flow`,
17
21
  's638236250662c6b3': `Have sent a message in the last`,
18
22
  's4788ee206c4570c7': `Have not started this flow in the last 90 days`,
@@ -22,6 +22,7 @@ import {
22
22
  DirtyTrackable
23
23
  } from '../interfaces';
24
24
  import { RapidElement } from '../RapidElement';
25
+ import { setRealtimeContext } from '../live/Realtime';
25
26
  import { lru } from 'tiny-lru';
26
27
  import { DateTime } from 'luxon';
27
28
  import { css, html } from 'lit';
@@ -108,6 +109,14 @@ export class Store extends RapidElement {
108
109
  @property({ type: String, attribute: 'shortcuts' })
109
110
  shortcutsEndpoint: string;
110
111
 
112
+ // current workspace and user uuids, used to address user-scoped realtime
113
+ // channels - hydrated by the page template
114
+ @property({ type: String })
115
+ org: string;
116
+
117
+ @property({ type: String })
118
+ user: string;
119
+
111
120
  @property({ type: String })
112
121
  brand = '';
113
122
 
@@ -266,6 +275,9 @@ export class Store extends RapidElement {
266
275
  }
267
276
 
268
277
  public firstUpdated() {
278
+ if (this.org && this.user) {
279
+ setRealtimeContext({ org: this.org, user: this.user });
280
+ }
269
281
  this.reset();
270
282
  }
271
283
 
package/src/utils.ts CHANGED
@@ -339,6 +339,10 @@ export const postJSON = (url: string, payload: any): Promise<WebResponse> => {
339
339
  return postUrl(url, JSON.stringify(payload), false, 'application/json');
340
340
  };
341
341
 
342
+ export const deleteRequest = (url: string): Promise<Response> => {
343
+ return fetch(url, { method: 'DELETE', headers: getHeaders() });
344
+ };
345
+
342
346
  export const postFormData = (
343
347
  url: string,
344
348
  formData: FormData,