@nyaruka/temba-components 0.138.0 → 0.138.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/.devcontainer/Dockerfile +0 -9
  2. package/.devcontainer/devcontainer.json +8 -3
  3. package/.github/workflows/build.yml +6 -1
  4. package/.github/workflows/cla.yml +1 -1
  5. package/.github/workflows/publish.yml +6 -1
  6. package/CHANGELOG.md +39 -0
  7. package/dist/locales/es.js +5 -5
  8. package/dist/locales/es.js.map +1 -1
  9. package/dist/locales/fr.js +5 -5
  10. package/dist/locales/fr.js.map +1 -1
  11. package/dist/locales/locale-codes.js +11 -2
  12. package/dist/locales/locale-codes.js.map +1 -1
  13. package/dist/locales/pt.js +5 -5
  14. package/dist/locales/pt.js.map +1 -1
  15. package/dist/temba-components.js +131 -98
  16. package/dist/temba-components.js.map +1 -1
  17. package/out-tsc/src/display/FloatingTab.js +16 -8
  18. package/out-tsc/src/display/FloatingTab.js.map +1 -1
  19. package/out-tsc/src/flow/CanvasMenu.js +33 -15
  20. package/out-tsc/src/flow/CanvasMenu.js.map +1 -1
  21. package/out-tsc/src/flow/CanvasNode.js +4 -0
  22. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  23. package/out-tsc/src/flow/Editor.js +279 -55
  24. package/out-tsc/src/flow/Editor.js.map +1 -1
  25. package/out-tsc/src/flow/NodeTypeSelector.js +13 -11
  26. package/out-tsc/src/flow/NodeTypeSelector.js.map +1 -1
  27. package/out-tsc/src/flow/Plumber.js +1 -1
  28. package/out-tsc/src/flow/Plumber.js.map +1 -1
  29. package/out-tsc/src/flow/actions/set_contact_field.js +5 -1
  30. package/out-tsc/src/flow/actions/set_contact_field.js.map +1 -1
  31. package/out-tsc/src/list/RunList.js +2 -1
  32. package/out-tsc/src/list/RunList.js.map +1 -1
  33. package/out-tsc/src/list/TicketList.js +2 -1
  34. package/out-tsc/src/list/TicketList.js.map +1 -1
  35. package/out-tsc/src/live/ContactChat.js +18 -1
  36. package/out-tsc/src/live/ContactChat.js.map +1 -1
  37. package/out-tsc/src/locales/es.js +5 -5
  38. package/out-tsc/src/locales/es.js.map +1 -1
  39. package/out-tsc/src/locales/fr.js +5 -5
  40. package/out-tsc/src/locales/fr.js.map +1 -1
  41. package/out-tsc/src/locales/locale-codes.js +11 -2
  42. package/out-tsc/src/locales/locale-codes.js.map +1 -1
  43. package/out-tsc/src/locales/pt.js +5 -5
  44. package/out-tsc/src/locales/pt.js.map +1 -1
  45. package/out-tsc/src/store/AppState.js +5 -0
  46. package/out-tsc/src/store/AppState.js.map +1 -1
  47. package/out-tsc/test/temba-contact-fields.test.js +3 -3
  48. package/out-tsc/test/temba-contact-fields.test.js.map +1 -1
  49. package/out-tsc/test/temba-flow-editor-node.test.js +2 -1
  50. package/out-tsc/test/temba-flow-editor-node.test.js.map +1 -1
  51. package/out-tsc/test/temba-select.test.js +1 -0
  52. package/out-tsc/test/temba-select.test.js.map +1 -1
  53. package/package.json +1 -1
  54. package/screenshots/truth/floating-tab/gray.png +0 -0
  55. package/screenshots/truth/floating-tab/green.png +0 -0
  56. package/screenshots/truth/floating-tab/purple.png +0 -0
  57. package/screenshots/truth/node-type-selector/action-mode.png +0 -0
  58. package/screenshots/truth/node-type-selector/split-mode.png +0 -0
  59. package/src/display/FloatingTab.ts +18 -8
  60. package/src/flow/CanvasMenu.ts +38 -16
  61. package/src/flow/CanvasNode.ts +8 -0
  62. package/src/flow/Editor.ts +343 -58
  63. package/src/flow/NodeTypeSelector.ts +13 -11
  64. package/src/flow/Plumber.ts +1 -1
  65. package/src/flow/actions/set_contact_field.ts +5 -1
  66. package/src/list/RunList.ts +2 -1
  67. package/src/list/TicketList.ts +2 -1
  68. package/src/live/ContactChat.ts +19 -1
  69. package/src/locales/es.ts +18 -13
  70. package/src/locales/fr.ts +18 -13
  71. package/src/locales/locale-codes.ts +11 -2
  72. package/src/locales/pt.ts +18 -13
  73. package/src/store/AppState.ts +5 -0
  74. package/test/temba-contact-fields.test.ts +8 -3
  75. package/test/temba-flow-editor-node.test.ts +2 -1
  76. package/test/temba-select.test.ts +1 -0
@@ -271,6 +271,12 @@ export class ContactChat extends ContactStoreElement {
271
271
  @property({ type: Boolean })
272
272
  showInterrupt = false;
273
273
 
274
+ @property({ type: Boolean })
275
+ disableAssign = false;
276
+
277
+ @property({ type: Boolean })
278
+ disableReply = false;
279
+
274
280
  @property({ type: String })
275
281
  avatar = DEFAULT_AVATAR;
276
282
 
@@ -607,6 +613,14 @@ export class ContactChat extends ContactStoreElement {
607
613
  return null;
608
614
  } else {
609
615
  if (!this.currentTicket.closed_on) {
616
+ // hide compose if agent can't reply to unassigned tickets
617
+ if (
618
+ this.disableReply &&
619
+ (!this.currentTicket.assignee ||
620
+ this.currentTicket.assignee.email !== this.agent)
621
+ ) {
622
+ return null;
623
+ }
610
624
  //chatbox for active contacts with an open ticket
611
625
  return this.getCompose();
612
626
  } else {
@@ -676,6 +690,10 @@ export class ContactChat extends ContactStoreElement {
676
690
  }
677
691
 
678
692
  public assignTicket(email: string) {
693
+ if (this.disableAssign) {
694
+ return;
695
+ }
696
+
679
697
  // if its already assigned to use, it's a noop
680
698
  if (
681
699
  (this.currentTicket.assignee &&
@@ -803,7 +821,7 @@ export class ContactChat extends ContactStoreElement {
803
821
  ? [this.currentTicket.assignee]
804
822
  : []}
805
823
  @change=${this.handleAssignmentChanged}
806
- ?disabled=${ticketClosed}
824
+ ?disabled=${ticketClosed || this.disableAssign}
807
825
  ></temba-user-select>
808
826
 
809
827
  <temba-select
package/src/locales/es.ts CHANGED
@@ -1,13 +1,18 @@
1
- // Do not modify this file by hand!
2
- // Re-generate this file by running lit-localize
3
-
4
- /* eslint-disable no-irregular-whitespace */
5
- /* eslint-disable @typescript-eslint/no-explicit-any */
6
-
7
- export const templates = {
8
- scf1453991c986b25: `Tab para completar, enter para seleccionar`,
9
- s73b4d70c02f4b4e0: `No options`,
10
- s8f02e3a18ffc083a: `Are not currently in a flow`,
11
- s638236250662c6b3: `Have sent a message in the last`,
12
- s4788ee206c4570c7: `Have not started this flow in the last 90 days`
13
- };
1
+
2
+ // Do not modify this file by hand!
3
+ // Re-generate this file by running lit-localize
4
+
5
+
6
+
7
+
8
+ /* eslint-disable no-irregular-whitespace */
9
+ /* eslint-disable @typescript-eslint/no-explicit-any */
10
+
11
+ export const templates = {
12
+ 'scf1453991c986b25': `Tab para completar, enter para seleccionar`,
13
+ 's73b4d70c02f4b4e0': `No options`,
14
+ 's8f02e3a18ffc083a': `Are not currently in a flow`,
15
+ 's638236250662c6b3': `Have sent a message in the last`,
16
+ 's4788ee206c4570c7': `Have not started this flow in the last 90 days`,
17
+ };
18
+
package/src/locales/fr.ts CHANGED
@@ -1,13 +1,18 @@
1
- // Do not modify this file by hand!
2
- // Re-generate this file by running lit-localize
3
-
4
- /* eslint-disable no-irregular-whitespace */
5
- /* eslint-disable @typescript-eslint/no-explicit-any */
6
-
7
- export const templates = {
8
- s73b4d70c02f4b4e0: `No options`,
9
- scf1453991c986b25: `Tab to complete, enter to select`,
10
- s8f02e3a18ffc083a: `Are not currently in a flow`,
11
- s638236250662c6b3: `Have sent a message in the last`,
12
- s4788ee206c4570c7: `Have not started this flow in the last 90 days`
13
- };
1
+
2
+ // Do not modify this file by hand!
3
+ // Re-generate this file by running lit-localize
4
+
5
+
6
+
7
+
8
+ /* eslint-disable no-irregular-whitespace */
9
+ /* eslint-disable @typescript-eslint/no-explicit-any */
10
+
11
+ export const templates = {
12
+ 's73b4d70c02f4b4e0': `No options`,
13
+ 'scf1453991c986b25': `Tab to complete, enter to select`,
14
+ 's8f02e3a18ffc083a': `Are not currently in a flow`,
15
+ 's638236250662c6b3': `Have sent a message in the last`,
16
+ 's4788ee206c4570c7': `Have not started this flow in the last 90 days`,
17
+ };
18
+
@@ -10,9 +10,18 @@ export const sourceLocale = `en`;
10
10
  * The other locale codes that this application is localized into. Sorted
11
11
  * lexicographically.
12
12
  */
13
- export const targetLocales = [`es`, `fr`, `pt`] as const;
13
+ export const targetLocales = [
14
+ `es`,
15
+ `fr`,
16
+ `pt`,
17
+ ] as const;
14
18
 
15
19
  /**
16
20
  * All valid project locale codes. Sorted lexicographically.
17
21
  */
18
- export const allLocales = [`en`, `es`, `fr`, `pt`] as const;
22
+ export const allLocales = [
23
+ `en`,
24
+ `es`,
25
+ `fr`,
26
+ `pt`,
27
+ ] as const;
package/src/locales/pt.ts CHANGED
@@ -1,13 +1,18 @@
1
- // Do not modify this file by hand!
2
- // Re-generate this file by running lit-localize
3
-
4
- /* eslint-disable no-irregular-whitespace */
5
- /* eslint-disable @typescript-eslint/no-explicit-any */
6
-
7
- export const templates = {
8
- s73b4d70c02f4b4e0: `No options`,
9
- scf1453991c986b25: `Tab to complete, enter to select`,
10
- s8f02e3a18ffc083a: `Are not currently in a flow`,
11
- s638236250662c6b3: `Have sent a message in the last`,
12
- s4788ee206c4570c7: `Have not started this flow in the last 90 days`
13
- };
1
+
2
+ // Do not modify this file by hand!
3
+ // Re-generate this file by running lit-localize
4
+
5
+
6
+
7
+
8
+ /* eslint-disable no-irregular-whitespace */
9
+ /* eslint-disable @typescript-eslint/no-explicit-any */
10
+
11
+ export const templates = {
12
+ 's73b4d70c02f4b4e0': `No options`,
13
+ 'scf1453991c986b25': `Tab to complete, enter to select`,
14
+ 's8f02e3a18ffc083a': `Are not currently in a flow`,
15
+ 's638236250662c6b3': `Have sent a message in the last`,
16
+ 's4788ee206c4570c7': `Have not started this flow in the last 90 days`,
17
+ };
18
+
@@ -484,6 +484,11 @@ export const zustand = createStore<AppState>()(
484
484
  exitUuid: string,
485
485
  destinationNodeUuid: string
486
486
  ) => {
487
+ /* console.log('Upating connection:', {
488
+ nodeUuid,
489
+ exitUuid,
490
+ destinationNodeUuid
491
+ });*/
487
492
  set((state: AppState) => {
488
493
  // Find the exit with this UUID
489
494
  const node = state.flowDefinition.nodes.find(
@@ -1,14 +1,19 @@
1
1
  import { assert, expect } from '@open-wc/testing';
2
2
  import { ContactFields } from '../src/live/ContactFields';
3
- import { delay, getComponent, loadStore, mockPOST } from './utils.test';
3
+ import {
4
+ getComponent,
5
+ loadStore,
6
+ mockPOST,
7
+ waitForCondition
8
+ } from './utils.test';
4
9
 
5
10
  const TAG = 'temba-contact-fields';
6
11
  const getFields = async (attrs: any = {}) => {
7
12
  attrs['endpoint'] = '/test-assets/contacts/';
8
13
  const fields = (await getComponent(TAG, attrs, '', 600)) as ContactFields;
9
14
 
10
- // wait for our contact to load
11
- await delay(100);
15
+ // wait for our contact data to load
16
+ await waitForCondition(() => fields.data !== undefined);
12
17
 
13
18
  return fields;
14
19
  };
@@ -836,7 +836,8 @@ describe('EditorNode', () => {
836
836
  makeSource: stub(),
837
837
  connectIds: stub(),
838
838
  removeExitConnection: stub(),
839
- forgetNode: stub()
839
+ forgetNode: stub(),
840
+ removeNodeConnections: stub()
840
841
  };
841
842
  editorNode['plumber'] = mockPlumber;
842
843
  });
@@ -855,6 +855,7 @@ describe('temba-select', () => {
855
855
  })
856
856
  );
857
857
 
858
+ await openSelect(clock, select);
858
859
  await typeInto('temba-select', 're', false);
859
860
  await openSelect(clock, select);
860
861
  assert.equal(select.visibleOptions.length, 2);