@nyaruka/temba-components 0.126.0 → 0.128.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.
- package/CHANGELOG.md +23 -0
- package/demo/chart/example.html +18 -1
- package/demo/data/flows/sample-flow.json +127 -100
- package/demo/data/server/opened-tickets-long.json +53 -0
- package/demo/sticky-note-demo.html +152 -0
- package/dist/locales/es.js +5 -5
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/fr.js +5 -5
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/locale-codes.js +11 -2
- package/dist/locales/locale-codes.js.map +1 -1
- package/dist/locales/pt.js +5 -5
- package/dist/locales/pt.js.map +1 -1
- package/dist/temba-components.js +346 -86
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/chart/TembaChart.js +44 -5
- package/out-tsc/src/chart/TembaChart.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +210 -1
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/EditorNode.js +98 -142
- package/out-tsc/src/flow/EditorNode.js.map +1 -1
- package/out-tsc/src/flow/StickyNote.js +272 -0
- package/out-tsc/src/flow/StickyNote.js.map +1 -0
- package/out-tsc/src/list/RunList.js +2 -1
- package/out-tsc/src/list/RunList.js.map +1 -1
- package/out-tsc/src/list/SortableList.js +9 -0
- package/out-tsc/src/list/SortableList.js.map +1 -1
- package/out-tsc/src/locales/es.js +5 -5
- package/out-tsc/src/locales/es.js.map +1 -1
- package/out-tsc/src/locales/fr.js +5 -5
- package/out-tsc/src/locales/fr.js.map +1 -1
- package/out-tsc/src/locales/locale-codes.js +11 -2
- package/out-tsc/src/locales/locale-codes.js.map +1 -1
- package/out-tsc/src/locales/pt.js +5 -5
- package/out-tsc/src/locales/pt.js.map +1 -1
- package/out-tsc/src/store/AppState.js +33 -0
- package/out-tsc/src/store/AppState.js.map +1 -1
- package/out-tsc/src/vectoricon/index.js +2 -1
- package/out-tsc/src/vectoricon/index.js.map +1 -1
- package/out-tsc/temba-modules.js +2 -0
- package/out-tsc/temba-modules.js.map +1 -1
- package/out-tsc/test/temba-flow-editor-node.test.js +249 -5
- package/out-tsc/test/temba-flow-editor-node.test.js.map +1 -1
- package/out-tsc/test/temba-select.test.js +9 -14
- package/out-tsc/test/temba-select.test.js.map +1 -1
- package/out-tsc/test/utils.test.js +62 -0
- package/out-tsc/test/utils.test.js.map +1 -1
- package/package.json +1 -1
- package/screenshots/truth/sticky-note/blue.png +0 -0
- package/screenshots/truth/sticky-note/gray.png +0 -0
- package/screenshots/truth/sticky-note/green.png +0 -0
- package/screenshots/truth/sticky-note/pink.png +0 -0
- package/screenshots/truth/sticky-note/yellow.png +0 -0
- package/src/chart/TembaChart.ts +47 -5
- package/src/flow/Editor.ts +252 -2
- package/src/flow/EditorNode.ts +98 -160
- package/src/flow/StickyNote.ts +284 -0
- package/src/list/RunList.ts +2 -1
- package/src/list/SortableList.ts +11 -0
- package/src/locales/es.ts +18 -13
- package/src/locales/fr.ts +18 -13
- package/src/locales/locale-codes.ts +11 -2
- package/src/locales/pt.ts +18 -13
- package/src/store/AppState.ts +51 -1
- package/src/store/flow-definition.d.ts +8 -0
- package/src/vectoricon/index.ts +2 -1
- package/static/svg/index.pdf +137 -0
- package/temba-modules.ts +2 -0
- package/test/temba-flow-editor-node.test.ts +322 -6
- package/test/temba-select.test.ts +10 -17
- package/test/utils.test.ts +98 -0
- package/web-dev-server.config.mjs +30 -22
package/src/locales/fr.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 = [
|
|
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 = [
|
|
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
|
-
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
|
package/src/store/AppState.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { createStore, StoreApi } from 'zustand/vanilla';
|
|
2
2
|
import { fetchResults } from '../utils';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Action,
|
|
5
|
+
Exit,
|
|
6
|
+
FlowDefinition,
|
|
7
|
+
FlowPosition,
|
|
8
|
+
Node,
|
|
9
|
+
Router,
|
|
10
|
+
StickyNote
|
|
11
|
+
} from './flow-definition';
|
|
4
12
|
import { immer } from 'zustand/middleware/immer';
|
|
5
13
|
import { subscribeWithSelector } from 'zustand/middleware';
|
|
6
14
|
import { property } from 'lit/decorators.js';
|
|
@@ -82,9 +90,16 @@ export interface AppState {
|
|
|
82
90
|
setDirtyDate: (date: Date) => void;
|
|
83
91
|
expandCanvas: (width: number, height: number) => void;
|
|
84
92
|
|
|
93
|
+
updateNode(
|
|
94
|
+
uuid: string,
|
|
95
|
+
node: { actions: Action[]; uuid: string; exits: Exit[]; router?: Router }
|
|
96
|
+
): unknown;
|
|
85
97
|
updateCanvasPositions: (positions: CanvasPositions) => void;
|
|
86
98
|
updateNodePosition(uuid: string, newPosition: FlowPosition): void;
|
|
87
99
|
removeNodes: (uuids: string[]) => void;
|
|
100
|
+
|
|
101
|
+
updateStickyPosition(uuid: string, newPosition: FlowPosition): void;
|
|
102
|
+
updateStickyNote(uuid: string, sticky: StickyNote): void;
|
|
88
103
|
}
|
|
89
104
|
|
|
90
105
|
export const zustand = createStore<AppState>()(
|
|
@@ -242,6 +257,41 @@ export const zustand = createStore<AppState>()(
|
|
|
242
257
|
(node) => !uuids.includes(node.uuid)
|
|
243
258
|
);
|
|
244
259
|
});
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
updateStickyPosition: (uuid: string, newPosition: FlowPosition) => {
|
|
263
|
+
set((state: AppState) => {
|
|
264
|
+
if (!state.flowDefinition._ui.stickies) {
|
|
265
|
+
state.flowDefinition._ui.stickies = {};
|
|
266
|
+
}
|
|
267
|
+
if (state.flowDefinition._ui.stickies[uuid]) {
|
|
268
|
+
state.flowDefinition._ui.stickies[uuid].position = newPosition;
|
|
269
|
+
state.dirtyDate = new Date();
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
updateNode: (uuid: string, newNode: Node) => {
|
|
275
|
+
set((state: AppState) => {
|
|
276
|
+
const node = state.flowDefinition?.nodes.find((n) => n.uuid === uuid);
|
|
277
|
+
if (node) {
|
|
278
|
+
node.actions = newNode.actions;
|
|
279
|
+
node.uuid = newNode.uuid;
|
|
280
|
+
node.exits = newNode.exits;
|
|
281
|
+
node.router = newNode.router;
|
|
282
|
+
}
|
|
283
|
+
state.dirtyDate = new Date();
|
|
284
|
+
});
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
updateStickyNote: (uuid: string, sticky: StickyNote) => {
|
|
288
|
+
set((state: AppState) => {
|
|
289
|
+
if (!state.flowDefinition._ui.stickies) {
|
|
290
|
+
state.flowDefinition._ui.stickies = {};
|
|
291
|
+
}
|
|
292
|
+
state.flowDefinition._ui.stickies[uuid] = sticky;
|
|
293
|
+
state.dirtyDate = new Date();
|
|
294
|
+
});
|
|
245
295
|
}
|
|
246
296
|
}))
|
|
247
297
|
)
|
|
@@ -154,8 +154,16 @@ export interface NodeUI {
|
|
|
154
154
|
config?: Record<string, any>;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
export interface StickyNote {
|
|
158
|
+
position: FlowPosition;
|
|
159
|
+
title: string;
|
|
160
|
+
body: string;
|
|
161
|
+
color: 'yellow' | 'blue' | 'pink' | 'green' | 'gray';
|
|
162
|
+
}
|
|
163
|
+
|
|
157
164
|
export interface FlowUI {
|
|
158
165
|
nodes: Record<string, NodeUI>;
|
|
166
|
+
stickies?: Record<string, StickyNote>;
|
|
159
167
|
languages: Record<string, string>[];
|
|
160
168
|
translation_filters?: { categories: boolean };
|
|
161
169
|
auto_translations?: Record<string, Record<string, string[]>>;
|
package/src/vectoricon/index.ts
CHANGED
package/static/svg/index.pdf
CHANGED
|
@@ -679392,3 +679392,140 @@ trailer
|
|
|
679392
679392
|
startxref
|
|
679393
679393
|
23884040
|
|
679394
679394
|
%%EOF
|
|
679395
|
+
428 0 obj
|
|
679396
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 2180 ] /Resources 425 0 R
|
|
679397
|
+
/Parent 5607 0 R /Rotate 0 /Contents 426 0 R >>
|
|
679398
|
+
endobj
|
|
679399
|
+
744 0 obj
|
|
679400
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 1140 ] /Resources 741 0 R
|
|
679401
|
+
/Parent 5607 0 R /Rotate 0 /Contents 742 0 R >>
|
|
679402
|
+
endobj
|
|
679403
|
+
1114 0 obj
|
|
679404
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 740 ] /Resources 1111 0 R
|
|
679405
|
+
/Parent 5607 0 R /Rotate 0 /Contents 1112 0 R >>
|
|
679406
|
+
endobj
|
|
679407
|
+
1344 0 obj
|
|
679408
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 660 ] /Resources 1341 0 R
|
|
679409
|
+
/Parent 5607 0 R /Rotate 0 /Contents 1342 0 R >>
|
|
679410
|
+
endobj
|
|
679411
|
+
1612 0 obj
|
|
679412
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 820 ] /Resources 1609 0 R
|
|
679413
|
+
/Parent 5607 0 R /Rotate 0 /Contents 1610 0 R >>
|
|
679414
|
+
endobj
|
|
679415
|
+
1972 0 obj
|
|
679416
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 860 ] /Resources 1969 0 R
|
|
679417
|
+
/Parent 5607 0 R /Rotate 0 /Contents 1970 0 R >>
|
|
679418
|
+
endobj
|
|
679419
|
+
2206 0 obj
|
|
679420
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 500 ] /Resources 2203 0 R
|
|
679421
|
+
/Parent 5607 0 R /Rotate 0 /Contents 2204 0 R >>
|
|
679422
|
+
endobj
|
|
679423
|
+
2408 0 obj
|
|
679424
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 500 ] /Resources 2405 0 R
|
|
679425
|
+
/Parent 5607 0 R /Rotate 0 /Contents 2406 0 R >>
|
|
679426
|
+
endobj
|
|
679427
|
+
2718 0 obj
|
|
679428
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 1300 ] /Resources 2715 0 R
|
|
679429
|
+
/Parent 5607 0 R /Rotate 0 /Contents 2716 0 R >>
|
|
679430
|
+
endobj
|
|
679431
|
+
3060 0 obj
|
|
679432
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 820 ] /Resources 3057 0 R
|
|
679433
|
+
/Parent 5607 0 R /Rotate 0 /Contents 3058 0 R >>
|
|
679434
|
+
endobj
|
|
679435
|
+
3370 0 obj
|
|
679436
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 820 ] /Resources 3367 0 R
|
|
679437
|
+
/Parent 5607 0 R /Rotate 0 /Contents 3368 0 R >>
|
|
679438
|
+
endobj
|
|
679439
|
+
3586 0 obj
|
|
679440
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 580 ] /Resources 3583 0 R
|
|
679441
|
+
/Parent 5607 0 R /Rotate 0 /Contents 3584 0 R >>
|
|
679442
|
+
endobj
|
|
679443
|
+
3920 0 obj
|
|
679444
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 1020 ] /Resources 3917 0 R
|
|
679445
|
+
/Parent 5607 0 R /Rotate 0 /Contents 3918 0 R >>
|
|
679446
|
+
endobj
|
|
679447
|
+
4180 0 obj
|
|
679448
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 540 ] /Resources 4177 0 R
|
|
679449
|
+
/Parent 5607 0 R /Rotate 0 /Contents 4178 0 R >>
|
|
679450
|
+
endobj
|
|
679451
|
+
4484 0 obj
|
|
679452
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 500 ] /Resources 4481 0 R
|
|
679453
|
+
/Parent 5607 0 R /Rotate 0 /Contents 4482 0 R >>
|
|
679454
|
+
endobj
|
|
679455
|
+
4786 0 obj
|
|
679456
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 1260 ] /Resources 4783 0 R
|
|
679457
|
+
/Parent 5607 0 R /Rotate 0 /Contents 4784 0 R >>
|
|
679458
|
+
endobj
|
|
679459
|
+
5004 0 obj
|
|
679460
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 660 ] /Resources 5001 0 R
|
|
679461
|
+
/Parent 5607 0 R /Rotate 0 /Contents 5002 0 R >>
|
|
679462
|
+
endobj
|
|
679463
|
+
5334 0 obj
|
|
679464
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 740 ] /Resources 5331 0 R
|
|
679465
|
+
/Parent 5607 0 R /Rotate 0 /Contents 5332 0 R >>
|
|
679466
|
+
endobj
|
|
679467
|
+
5606 0 obj
|
|
679468
|
+
<< /Annots [ ] /Type /Page /MediaBox [ 0 0 1144 540 ] /Resources 5603 0 R
|
|
679469
|
+
/Parent 5607 0 R /Rotate 0 /Contents 5604 0 R >>
|
|
679470
|
+
endobj
|
|
679471
|
+
5608 0 obj
|
|
679472
|
+
<< /Info 5618 0 R /Pages 5607 0 R /Type /Catalog >>
|
|
679473
|
+
endobj
|
|
679474
|
+
5617 0 obj
|
|
679475
|
+
<< /Producer (macOS Version 15.5 \(Build 24F74\) Quartz PDFContext, AppendMode 1.1)
|
|
679476
|
+
/ModDate (D:20250620015519Z00'00') >>
|
|
679477
|
+
endobj
|
|
679478
|
+
5618 0 obj
|
|
679479
|
+
5617 0 R
|
|
679480
|
+
endobj
|
|
679481
|
+
xref
|
|
679482
|
+
0 1
|
|
679483
|
+
0000000000 65535 f
|
|
679484
|
+
428 1
|
|
679485
|
+
0023884787 00000 n
|
|
679486
|
+
744 1
|
|
679487
|
+
0023884926 00000 n
|
|
679488
|
+
1114 1
|
|
679489
|
+
0023885065 00000 n
|
|
679490
|
+
1344 1
|
|
679491
|
+
0023885206 00000 n
|
|
679492
|
+
1612 1
|
|
679493
|
+
0023885347 00000 n
|
|
679494
|
+
1972 1
|
|
679495
|
+
0023885488 00000 n
|
|
679496
|
+
2206 1
|
|
679497
|
+
0023885629 00000 n
|
|
679498
|
+
2408 1
|
|
679499
|
+
0023885770 00000 n
|
|
679500
|
+
2718 1
|
|
679501
|
+
0023885911 00000 n
|
|
679502
|
+
3060 1
|
|
679503
|
+
0023886053 00000 n
|
|
679504
|
+
3370 1
|
|
679505
|
+
0023886194 00000 n
|
|
679506
|
+
3586 1
|
|
679507
|
+
0023886335 00000 n
|
|
679508
|
+
3920 1
|
|
679509
|
+
0023886476 00000 n
|
|
679510
|
+
4180 1
|
|
679511
|
+
0023886618 00000 n
|
|
679512
|
+
4484 1
|
|
679513
|
+
0023886759 00000 n
|
|
679514
|
+
4786 1
|
|
679515
|
+
0023886900 00000 n
|
|
679516
|
+
5004 1
|
|
679517
|
+
0023887042 00000 n
|
|
679518
|
+
5334 1
|
|
679519
|
+
0023887183 00000 n
|
|
679520
|
+
5606 1
|
|
679521
|
+
0023887324 00000 n
|
|
679522
|
+
5608 1
|
|
679523
|
+
0023887465 00000 n
|
|
679524
|
+
5617 2
|
|
679525
|
+
0023887535 00000 n
|
|
679526
|
+
0023887675 00000 n
|
|
679527
|
+
trailer
|
|
679528
|
+
<< /ID [<736F6D65><6182B425B6660962C43AF789544507B2> ] /Root 5608 0 R /Size 5619 /Prev 23884040 >>
|
|
679529
|
+
startxref
|
|
679530
|
+
23887702
|
|
679531
|
+
%%EOF
|
package/temba-modules.ts
CHANGED
|
@@ -57,6 +57,7 @@ import { Chat } from './src/chat/Chat';
|
|
|
57
57
|
import { MediaPicker } from './src/mediapicker/MediaPicker';
|
|
58
58
|
import { Editor } from './src/flow/Editor';
|
|
59
59
|
import { EditorNode } from './src/flow/EditorNode';
|
|
60
|
+
import { StickyNote } from './src/flow/StickyNote';
|
|
60
61
|
import { ContactNotepad } from './src/contacts/ContactNotepad';
|
|
61
62
|
import { ProgressBar } from './src/progress/ProgressBar';
|
|
62
63
|
import { StartProgress } from './src/progress/StartProgress';
|
|
@@ -132,6 +133,7 @@ addCustomElement('temba-chat', Chat);
|
|
|
132
133
|
addCustomElement('temba-media-picker', MediaPicker);
|
|
133
134
|
addCustomElement('temba-flow-editor', Editor);
|
|
134
135
|
addCustomElement('temba-flow-node', EditorNode);
|
|
136
|
+
addCustomElement('temba-sticky-note', StickyNote);
|
|
135
137
|
addCustomElement('temba-contact-notepad', ContactNotepad);
|
|
136
138
|
addCustomElement('temba-progress', ProgressBar);
|
|
137
139
|
addCustomElement('temba-start-progress', StartProgress);
|