@nyaruka/temba-components 0.102.2 → 0.104.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 (109) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/temba-components.js +172 -70
  3. package/dist/temba-components.js.map +1 -1
  4. package/out-tsc/src/contacts/ContactChat.js +22 -8
  5. package/out-tsc/src/contacts/ContactChat.js.map +1 -1
  6. package/out-tsc/src/contacts/ContactFields.js +5 -0
  7. package/out-tsc/src/contacts/ContactFields.js.map +1 -1
  8. package/out-tsc/src/contacts/ContactNotepad.js +129 -0
  9. package/out-tsc/src/contacts/ContactNotepad.js.map +1 -0
  10. package/out-tsc/src/contacts/ContactPending.js +7 -2
  11. package/out-tsc/src/contacts/ContactPending.js.map +1 -1
  12. package/out-tsc/src/contacts/ContactStoreElement.js +11 -2
  13. package/out-tsc/src/contacts/ContactStoreElement.js.map +1 -1
  14. package/out-tsc/src/contacts/ContactTickets.js +7 -2
  15. package/out-tsc/src/contacts/ContactTickets.js.map +1 -1
  16. package/out-tsc/src/contacts/events.js.map +1 -1
  17. package/out-tsc/src/contacts/helpers.js +3 -0
  18. package/out-tsc/src/contacts/helpers.js.map +1 -1
  19. package/out-tsc/src/fields/FieldManager.js +2 -2
  20. package/out-tsc/src/fields/FieldManager.js.map +1 -1
  21. package/out-tsc/src/flow/FlowStoreElement.js +2 -2
  22. package/out-tsc/src/flow/FlowStoreElement.js.map +1 -1
  23. package/out-tsc/src/interfaces.js +1 -0
  24. package/out-tsc/src/interfaces.js.map +1 -1
  25. package/out-tsc/src/list/TembaMenu.js +10 -0
  26. package/out-tsc/src/list/TembaMenu.js.map +1 -1
  27. package/out-tsc/src/store/{StoreElement.js → EndpointMonitorElement.js} +5 -5
  28. package/out-tsc/src/store/EndpointMonitorElement.js.map +1 -0
  29. package/out-tsc/src/store/Store.js +22 -0
  30. package/out-tsc/src/store/Store.js.map +1 -1
  31. package/out-tsc/src/store/StoreMonitorElement.js +22 -0
  32. package/out-tsc/src/store/StoreMonitorElement.js.map +1 -1
  33. package/out-tsc/src/tabpane/Tab.js +33 -0
  34. package/out-tsc/src/tabpane/Tab.js.map +1 -1
  35. package/out-tsc/src/tabpane/TabPane.js +53 -15
  36. package/out-tsc/src/tabpane/TabPane.js.map +1 -1
  37. package/out-tsc/src/vectoricon/index.js +1 -0
  38. package/out-tsc/src/vectoricon/index.js.map +1 -1
  39. package/out-tsc/temba-modules.js +2 -0
  40. package/out-tsc/temba-modules.js.map +1 -1
  41. package/package.json +1 -1
  42. package/screenshots/truth/compose/attachments-and-send-button.png +0 -0
  43. package/screenshots/truth/compose/attachments-no-send-button.png +0 -0
  44. package/screenshots/truth/compose/attachments-with-all-files-and-click-send.png +0 -0
  45. package/screenshots/truth/compose/attachments-with-all-files.png +0 -0
  46. package/screenshots/truth/compose/attachments-with-failure-files.png +0 -0
  47. package/screenshots/truth/compose/attachments-with-success-files-and-click-send.png +0 -0
  48. package/screenshots/truth/compose/attachments-with-success-files.png +0 -0
  49. package/screenshots/truth/compose/chatbox-attachments-counter-and-send-button.png +0 -0
  50. package/screenshots/truth/compose/chatbox-attachments-counter-no-send-button.png +0 -0
  51. package/screenshots/truth/compose/chatbox-attachments-no-counter-and-send-button.png +0 -0
  52. package/screenshots/truth/compose/chatbox-attachments-no-counter-no-send-button.png +0 -0
  53. package/screenshots/truth/compose/chatbox-counter-and-send-button.png +0 -0
  54. package/screenshots/truth/compose/chatbox-counter-no-send-button.png +0 -0
  55. package/screenshots/truth/compose/chatbox-no-counter-and-send-button.png +0 -0
  56. package/screenshots/truth/compose/chatbox-no-counter-no-send-button.png +0 -0
  57. package/screenshots/truth/compose/chatbox-no-text-attachments-with-all-files-and-click-send.png +0 -0
  58. package/screenshots/truth/compose/chatbox-no-text-attachments-with-all-files.png +0 -0
  59. package/screenshots/truth/compose/chatbox-no-text-attachments-with-failure-files.png +0 -0
  60. package/screenshots/truth/compose/chatbox-no-text-attachments-with-success-files-and-click-send.png +0 -0
  61. package/screenshots/truth/compose/chatbox-no-text-attachments-with-success-files.png +0 -0
  62. package/screenshots/truth/compose/chatbox-with-text-and-click-send.png +0 -0
  63. package/screenshots/truth/compose/chatbox-with-text-and-hit-enter.png +0 -0
  64. package/screenshots/truth/compose/chatbox-with-text-and-spaces.png +0 -0
  65. package/screenshots/truth/compose/chatbox-with-text-and-url.png +0 -0
  66. package/screenshots/truth/compose/chatbox-with-text-attachments-no-files-and-click-send.png +0 -0
  67. package/screenshots/truth/compose/chatbox-with-text-attachments-no-files-and-hit-enter.png +0 -0
  68. package/screenshots/truth/compose/chatbox-with-text-attachments-no-files.png +0 -0
  69. package/screenshots/truth/compose/chatbox-with-text-attachments-with-all-files-and-click-send.png +0 -0
  70. package/screenshots/truth/compose/chatbox-with-text-attachments-with-all-files-and-hit-enter.png +0 -0
  71. package/screenshots/truth/compose/chatbox-with-text-attachments-with-all-files.png +0 -0
  72. package/screenshots/truth/compose/chatbox-with-text-attachments-with-failure-files.png +0 -0
  73. package/screenshots/truth/compose/chatbox-with-text-attachments-with-success-files-and-click-send.png +0 -0
  74. package/screenshots/truth/compose/chatbox-with-text-attachments-with-success-files-and-hit-enter.png +0 -0
  75. package/screenshots/truth/compose/chatbox-with-text-attachments-with-success-files.png +0 -0
  76. package/screenshots/truth/compose/chatbox-with-text-no-spaces.png +0 -0
  77. package/screenshots/truth/compose/chatbox-with-text.png +0 -0
  78. package/screenshots/truth/contacts/compose-attachments-no-text-failure.png +0 -0
  79. package/screenshots/truth/contacts/compose-attachments-no-text-success.png +0 -0
  80. package/screenshots/truth/contacts/compose-text-and-attachments-failure-attachments.png +0 -0
  81. package/screenshots/truth/contacts/compose-text-and-attachments-failure-generic.png +0 -0
  82. package/screenshots/truth/contacts/compose-text-and-attachments-failure-text-and-attachments.png +0 -0
  83. package/screenshots/truth/contacts/compose-text-and-attachments-failure-text.png +0 -0
  84. package/screenshots/truth/contacts/compose-text-and-attachments-success.png +0 -0
  85. package/screenshots/truth/contacts/compose-text-no-attachments-failure.png +0 -0
  86. package/screenshots/truth/contacts/compose-text-no-attachments-success.png +0 -0
  87. package/screenshots/truth/contacts/contact-active-default.png +0 -0
  88. package/screenshots/truth/contacts/contact-active-show-chatbox.png +0 -0
  89. package/src/contacts/ContactChat.ts +21 -10
  90. package/src/contacts/ContactFields.ts +7 -0
  91. package/src/contacts/ContactNotepad.ts +133 -0
  92. package/src/contacts/ContactPending.ts +8 -2
  93. package/src/contacts/ContactStoreElement.ts +12 -2
  94. package/src/contacts/ContactTickets.ts +9 -2
  95. package/src/contacts/events.ts +0 -1
  96. package/src/contacts/helpers.ts +5 -1
  97. package/src/fields/FieldManager.ts +2 -2
  98. package/src/flow/FlowStoreElement.ts +2 -2
  99. package/src/interfaces.ts +13 -1
  100. package/src/list/TembaMenu.ts +12 -0
  101. package/src/store/{StoreElement.ts → EndpointMonitorElement.ts} +1 -4
  102. package/src/store/Store.ts +31 -0
  103. package/src/store/StoreMonitorElement.ts +24 -0
  104. package/src/tabpane/Tab.ts +29 -0
  105. package/src/tabpane/TabPane.ts +54 -15
  106. package/src/vectoricon/index.ts +1 -0
  107. package/temba-modules.ts +2 -0
  108. package/out-tsc/src/store/StoreElement.js.map +0 -1
  109. package/screenshots/truth/contacts/history.png +0 -0
@@ -26,12 +26,14 @@ export class TabPane extends RapidElement {
26
26
  margin: 0em 0em;
27
27
  cursor: pointer;
28
28
  display: flex;
29
- font-size: 1.01em;
29
+ font-size: 1.1em;
30
30
  align-items: center;
31
+ border: 1px inset transparent;
32
+ border-bottom: 0px;
31
33
  border-radius: var(--curvature);
32
34
  border-bottom-right-radius: 0px;
33
35
  border-bottom-left-radius: 0px;
34
- border: 0px solid rgba(0, 0, 0, 0.45);
36
+
35
37
  color: var(--color-text-dark);
36
38
  --icon-color: var(--color-text-dark);
37
39
  white-space: nowrap;
@@ -95,9 +97,9 @@ export class TabPane extends RapidElement {
95
97
  }
96
98
 
97
99
  .tab {
98
- transform: scale(0.9) translate(0em, -0.05em);
99
- --icon-color: #aaa;
100
- color: #aaa;
100
+ transform: scale(0.9) translateY(0em);
101
+ --icon-color: rgba(0, 0, 0, 0.5);
102
+ color: rgba(0, 0, 0, 0.5);
101
103
  }
102
104
 
103
105
  .tab.selected {
@@ -107,10 +109,22 @@ export class TabPane extends RapidElement {
107
109
  .tab.selected:hover {
108
110
  cursor: default;
109
111
  box-shadow: 0px -3px 3px 1px rgba(0, 0, 0, 0.02);
112
+
110
113
  background: var(--focused-tab-color, #fff);
111
- transform: scale(1) translateY(0em);
114
+ transform: scale(1) translateY(1px);
112
115
  --icon-color: #666;
113
116
  color: #666;
117
+ border: 1px inset rgba(0, 0, 0, 0.15);
118
+ border-bottom: 0px;
119
+ }
120
+
121
+ .embedded .tab.selected {
122
+ border: none;
123
+ transform: none;
124
+ }
125
+
126
+ .tab.selected .dot {
127
+ display: none;
114
128
  }
115
129
 
116
130
  .bottom .tab.selected {
@@ -130,6 +144,10 @@ export class TabPane extends RapidElement {
130
144
  background: rgba(0, 0, 0, 0.02);
131
145
  }
132
146
 
147
+ .tab.dirty {
148
+ font-weight: 500;
149
+ }
150
+
133
151
  .pane {
134
152
  display: flex;
135
153
  flex-direction: column;
@@ -154,15 +172,22 @@ export class TabPane extends RapidElement {
154
172
 
155
173
  .count {
156
174
  border-radius: 99px;
157
- background: rgba(0, 0, 0, 0.05);
175
+ background: rgba(0, 0, 0, 0.1);
158
176
  color: rgba(0, 0, 0, 0.5);
159
- font-size: 0.6em;
160
- font-weight: 400;
161
- padding: 0.1em 0.4em;
162
- min-width: 1em;
177
+ font-size: 0.7em;
178
+ font-weight: 500;
179
+ min-width: 1.5em;
163
180
  text-align: center;
164
181
  }
165
182
 
183
+ .dot {
184
+ height: 0.5em;
185
+ width: 0.5em;
186
+ margin-left: 0.2em;
187
+ background: var(--color-primary-dark);
188
+ border-radius: 99px;
189
+ }
190
+
166
191
  .notify .count {
167
192
  background: var(--color-alert);
168
193
  color: #fff;
@@ -336,7 +361,12 @@ export class TabPane extends RapidElement {
336
361
  this.requestUpdate();
337
362
  }
338
363
 
364
+ public handleTabDetailsChanged() {
365
+ this.requestUpdate();
366
+ }
367
+
339
368
  public render(): TemplateResult {
369
+ const activeTab = this.tabs[this.index];
340
370
  return html`
341
371
  ${this.bottom
342
372
  ? html`<div
@@ -371,7 +401,8 @@ export class TabPane extends RapidElement {
371
401
  selected: index == this.index,
372
402
  hidden: tab.hidden,
373
403
  notify: tab.notify,
374
- alert: tab.alert
404
+ alert: tab.alert,
405
+ dirty: tab.dirty
375
406
  })}"
376
407
  style="${tab.selectionColor && index == this.index
377
408
  ? `color:${tab.selectionColor};--icon-color:${tab.selectionColor};`
@@ -380,15 +411,21 @@ export class TabPane extends RapidElement {
380
411
  : ''}"
381
412
  >
382
413
  ${tab.icon ? html`<temba-icon name=${tab.icon} />` : null}
383
- <div class="name">${tab.name}</div>
414
+ <div class="name">${tab.name} ${tab.dirty ? ` *` : ``}</div>
384
415
  ${tab.hasBadge()
385
416
  ? html`
386
417
  <div class="badge">
387
- ${tab.count > 0
418
+ ${tab.count > 0 && !tab.activity
388
419
  ? html`<div class="count">
389
- ${tab.count.toLocaleString()}
420
+ ${tab.activity ? '' : tab.count.toLocaleString()}
390
421
  </div>`
391
422
  : null}
423
+ ${tab.activity && tab.count > 0 && !tab.dirty
424
+ ? html`<div
425
+ class="dot"
426
+ style="background:${tab.activityColor}"
427
+ ></div>`
428
+ : null}
392
429
  </div>
393
430
  `
394
431
  : null}
@@ -406,6 +443,8 @@ export class TabPane extends RapidElement {
406
443
  </div>
407
444
  ${!this.bottom
408
445
  ? html`<div
446
+ @temba-details-changed=${this.handleTabDetailsChanged}
447
+ style="border: 1px solid ${activeTab?.borderColor};background:${activeTab?.selectionBackground}"
409
448
  class="pane ${getClasses({
410
449
  first: this.index == 0,
411
450
  embedded: this.embedded,
@@ -108,6 +108,7 @@ export enum Icon {
108
108
  missed_call = 'phone-x',
109
109
  new = 'plus',
110
110
  next_schedule = 'alarm-clock',
111
+ notes = 'edit-03',
111
112
  notification = 'bell-01',
112
113
  number = 'hash-01',
113
114
  optin_requested = 'message-notification-circle',
package/temba-modules.ts CHANGED
@@ -57,6 +57,7 @@ import { TemplateEditor } from './src/templates/TemplateEditor';
57
57
  import { Toast } from './src/toast/Toast';
58
58
  import { Chat } from './src/chat/Chat';
59
59
  import { MediaPicker } from './src/mediapicker/MediaPicker';
60
+ import { ContactNotepad } from './src/contacts/ContactNotepad';
60
61
 
61
62
  export function addCustomElement(name: string, comp: any) {
62
63
  if (!window.customElements.get(name)) {
@@ -124,3 +125,4 @@ addCustomElement('temba-template-editor', TemplateEditor);
124
125
  addCustomElement('temba-toast', Toast);
125
126
  addCustomElement('temba-chat', Chat);
126
127
  addCustomElement('temba-media-picker', MediaPicker);
128
+ addCustomElement('temba-contact-notepad', ContactNotepad);
@@ -1 +0,0 @@
1
- {"version":3,"file":"StoreElement.js","sourceRoot":"","sources":["../../../src/store/StoreElement.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,mBAAmB;IAArD;;QAKE,gBAAW,GAAG,KAAK,CAAC;IA8CtB,CAAC;IAvCC,WAAW,CAAC,IAAS;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;IACL,CAAC;IAES,YAAY,CAAC,KAAkB;QACvC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC;YAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;YAC3B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;YAC9B,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,SAAS,EAAE;gBAC9C,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;gBACvB,QAAQ;aACT,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAES,OAAO,CACf,UAA6D;QAE7D,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC1B,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YACtE,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACnB,CAAC;QACH,CAAC;IACH,CAAC;IAED,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;CACF;AAjDC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCACf;AAGZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDACR;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;0CACnC","sourcesContent":["import { PropertyValueMap } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { CustomEventType } from '../interfaces';\n\nimport { Store } from './Store';\nimport { StoreMonitorElement } from './StoreMonitorElement';\n\n/**\n * StoreElement is a listener for a given endpoint that re-renders\n * when the underlying store element changes\n */\nexport class StoreElement extends StoreMonitorElement {\n @property({ type: String })\n url: string;\n\n @property({ type: Boolean })\n showLoading = false;\n\n @property({ type: Object, attribute: false })\n data: any;\n\n store: Store;\n\n prepareData(data: any): any {\n return data;\n }\n\n public refresh() {\n this.store.makeRequest(this.url, {\n prepareData: this.prepareData,\n force: true\n });\n }\n\n protected storeUpdated(event: CustomEvent) {\n if (event.detail.url === this.url) {\n const previous = this.data;\n this.data = event.detail.data;\n this.fireCustomEvent(CustomEventType.Refreshed, {\n data: event.detail.data,\n previous\n });\n }\n }\n\n protected updated(\n properties: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.updated(properties);\n if (properties.has('url')) {\n if (this.url) {\n this.store.makeRequest(this.url, { prepareData: this.prepareData });\n } else {\n this.data = null;\n }\n }\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.prepareData = this.prepareData.bind(this);\n }\n}\n"]}