@nyaruka/temba-components 0.163.0 → 0.165.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 +27 -0
- package/DEV_DATA.md +11 -11
- package/README.md +4 -4
- package/TEST_OPTIMIZATION.md +8 -11
- package/dist/locales/es.js +4 -0
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/fr.js +4 -0
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/pt.js +4 -0
- package/dist/locales/pt.js.map +1 -1
- package/dist/static/svg/index.svg +1 -1
- package/dist/temba-components.js +5266 -3031
- package/dist/temba-components.js.map +1 -1
- package/orca/setup.sh +2 -2
- package/package.json +13 -18
- package/scripts/dev-data-sync.mjs +4 -4
- package/src/Icons.ts +3 -2
- package/src/display/Chat.ts +3 -2
- package/src/display/Lightbox.ts +57 -109
- package/src/display/ProgressBar.ts +15 -2
- package/src/display/Thumbnail.ts +34 -7
- package/src/form/Compose.ts +31 -1
- package/src/form/ContactSearch.ts +229 -126
- package/src/interfaces.ts +131 -2
- package/src/layout/Card.ts +336 -0
- package/src/layout/CardLayout.ts +425 -0
- package/src/layout/CardStack.ts +131 -0
- package/src/layout/Dialog.ts +33 -24
- package/src/layout/HeaderBar.ts +41 -0
- package/src/layout/PageHeader.ts +5 -6
- package/src/layout/Resizer.ts +20 -0
- package/src/list/BroadcastList.ts +912 -0
- package/src/list/CampaignList.ts +144 -0
- package/src/list/ContactList.ts +3 -1
- package/src/list/ContentList.ts +46 -10
- package/src/list/FieldList.ts +1057 -0
- package/src/list/FlowList.ts +31 -7
- package/src/list/MsgList.ts +18 -12
- package/src/list/SortableList.ts +52 -8
- package/src/list/TembaList.ts +8 -0
- package/src/list/TembaMenu.ts +5 -38
- package/src/list/TriggerList.ts +538 -0
- package/src/live/CampaignEvents.ts +1108 -0
- package/src/live/ContactChat.ts +7 -1
- package/src/live/ContactDetails.ts +20 -14
- package/src/live/ContactFieldEditor.ts +7 -3
- package/src/live/ContactFields.ts +1 -1
- package/src/live/ContactNameFetch.ts +5 -2
- package/src/live/ContactNotepad.ts +88 -2
- package/src/live/ContactStoreElement.ts +15 -3
- package/src/live/ContactTimeline.ts +28 -7
- package/src/locales/es.ts +4 -0
- package/src/locales/fr.ts +4 -0
- package/src/locales/pt.ts +4 -0
- package/src/utils.ts +19 -0
- package/static/svg/index.svg +1 -1
- package/static/svg/packs/2-temba/star-filled.svg +3 -0
- package/static/svg/work/traced/star-filled.svg +1 -0
- package/static/svg/work/used/star-filled.svg +3 -0
- package/stress-test.js +3 -3
- package/temba-modules.ts +18 -0
- package/web-dev-server.config.mjs +54 -0
- package/web-test-runner.config.mjs +1 -1
- package/xliff/es.xlf +12 -0
- package/xliff/fr.xlf +12 -0
- package/xliff/pt.xlf +12 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M11.2827 3.45332C11.5131 2.98638 11.6284 2.75291 11.7848 2.67831C11.9209 2.61341 12.0791 2.61341 12.2152 2.67831C12.3717 2.75291 12.4869 2.98638 12.7174 3.45332L14.9041 7.88328C14.9721 8.02113 15.0061 8.09006 15.0558 8.14358C15.0999 8.19096 15.1527 8.22935 15.2113 8.25662C15.2776 8.28742 15.3536 8.29854 15.5057 8.32077L20.397 9.03571C20.9121 9.11099 21.1696 9.14863 21.2888 9.27444C21.3925 9.38389 21.4412 9.5343 21.4215 9.68377C21.3988 9.85558 21.2124 10.0372 20.8395 10.4004L17.3014 13.8464C17.1912 13.9538 17.136 14.0076 17.1004 14.0715C17.0689 14.128 17.0487 14.1902 17.0409 14.2545C17.0321 14.3271 17.0451 14.403 17.0711 14.5547L17.906 19.4221C17.994 19.9355 18.038 20.1922 17.9553 20.3445C17.8833 20.477 17.7554 20.57 17.6071 20.5975C17.4366 20.6291 17.2061 20.5078 16.7451 20.2654L12.3724 17.9658C12.2361 17.8942 12.168 17.8584 12.0962 17.8443C12.0327 17.8318 11.9673 17.8318 11.9038 17.8443C11.832 17.8584 11.7639 17.8942 11.6277 17.9658L7.25492 20.2654C6.79392 20.5078 6.56341 20.6291 6.39297 20.5975C6.24468 20.57 6.11672 20.477 6.04474 20.3445C5.962 20.1922 6.00603 19.9355 6.09407 19.4221L6.92889 14.5547C6.95491 14.403 6.96793 14.3271 6.95912 14.2545C6.95132 14.1902 6.93111 14.128 6.89961 14.0715C6.86402 14.0076 6.80888 13.9538 6.69859 13.8464L3.16056 10.4004C2.78766 10.0372 2.60121 9.85558 2.57853 9.68377C2.55879 9.5343 2.60755 9.38389 2.71125 9.27444C2.83044 9.14863 3.08797 9.11099 3.60304 9.03571L8.49431 8.32077C8.64642 8.29854 8.72248 8.28742 8.78872 8.25662C8.84736 8.22935 8.90016 8.19096 8.94419 8.14358C8.99391 8.09006 9.02793 8.02113 9.09597 7.88328L11.2827 3.45332Z" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M11.360 1.796 C 11.079 1.939,10.569 2.763,9.648 4.560 C 8.926 5.968,8.314 7.171,8.288 7.234 C 8.261 7.297,6.980 7.533,5.440 7.760 C 2.487 8.195,1.970 8.388,1.697 9.154 C 1.423 9.922,1.728 10.391,3.849 12.458 L 5.924 14.480 5.442 17.280 C 5.177 18.820,5.001 20.277,5.052 20.518 C 5.191 21.176,5.878 21.647,6.566 21.555 C 6.877 21.514,8.227 20.899,9.566 20.189 L 12.000 18.898 14.423 20.183 C 17.058 21.580,17.700 21.781,18.292 21.393 C 19.072 20.882,19.099 20.478,18.567 17.349 L 18.079 14.480 20.155 12.445 C 22.269 10.374,22.572 9.909,22.303 9.154 C 22.030 8.388,21.512 8.195,18.568 7.761 C 17.032 7.534,15.762 7.333,15.746 7.314 C 15.729 7.295,15.139 6.124,14.433 4.712 C 13.728 3.300,13.047 2.058,12.920 1.953 C 12.555 1.650,11.796 1.573,11.360 1.796 " stroke="none" fill-rule="evenodd" fill="black"></path></svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M11.2827 3.45332C11.5131 2.98638 11.6284 2.75291 11.7848 2.67831C11.9209 2.61341 12.0791 2.61341 12.2152 2.67831C12.3717 2.75291 12.4869 2.98638 12.7174 3.45332L14.9041 7.88328C14.9721 8.02113 15.0061 8.09006 15.0558 8.14358C15.0999 8.19096 15.1527 8.22935 15.2113 8.25662C15.2776 8.28742 15.3536 8.29854 15.5057 8.32077L20.397 9.03571C20.9121 9.11099 21.1696 9.14863 21.2888 9.27444C21.3925 9.38389 21.4412 9.5343 21.4215 9.68377C21.3988 9.85558 21.2124 10.0372 20.8395 10.4004L17.3014 13.8464C17.1912 13.9538 17.136 14.0076 17.1004 14.0715C17.0689 14.128 17.0487 14.1902 17.0409 14.2545C17.0321 14.3271 17.0451 14.403 17.0711 14.5547L17.906 19.4221C17.994 19.9355 18.038 20.1922 17.9553 20.3445C17.8833 20.477 17.7554 20.57 17.6071 20.5975C17.4366 20.6291 17.2061 20.5078 16.7451 20.2654L12.3724 17.9658C12.2361 17.8942 12.168 17.8584 12.0962 17.8443C12.0327 17.8318 11.9673 17.8318 11.9038 17.8443C11.832 17.8584 11.7639 17.8942 11.6277 17.9658L7.25492 20.2654C6.79392 20.5078 6.56341 20.6291 6.39297 20.5975C6.24468 20.57 6.11672 20.477 6.04474 20.3445C5.962 20.1922 6.00603 19.9355 6.09407 19.4221L6.92889 14.5547C6.95491 14.403 6.96793 14.3271 6.95912 14.2545C6.95132 14.1902 6.93111 14.128 6.89961 14.0715C6.86402 14.0076 6.80888 13.9538 6.69859 13.8464L3.16056 10.4004C2.78766 10.0372 2.60121 9.85558 2.57853 9.68377C2.55879 9.5343 2.60755 9.38389 2.71125 9.27444C2.83044 9.14863 3.08797 9.11099 3.60304 9.03571L8.49431 8.32077C8.64642 8.29854 8.72248 8.28742 8.78872 8.25662C8.84736 8.22935 8.90016 8.19096 8.94419 8.14358C8.99391 8.09006 9.02793 8.02113 9.09597 7.88328L11.2827 3.45332Z" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
</svg>
|
package/stress-test.js
CHANGED
|
@@ -27,9 +27,9 @@ for (let i = 0; i < args.length; i++) {
|
|
|
27
27
|
|
|
28
28
|
// Validate test file
|
|
29
29
|
if (!testFile) {
|
|
30
|
-
console.error('❌ Usage:
|
|
30
|
+
console.error('❌ Usage: bun run stress-test <test-file> [--runs=N]');
|
|
31
31
|
console.error(
|
|
32
|
-
' Example:
|
|
32
|
+
' Example: bun run stress-test test/temba-webchat.test.ts --runs=100'
|
|
33
33
|
);
|
|
34
34
|
process.exit(1);
|
|
35
35
|
}
|
|
@@ -60,7 +60,7 @@ try {
|
|
|
60
60
|
|
|
61
61
|
try {
|
|
62
62
|
// Run the test with minimal output
|
|
63
|
-
const result = execSync(`
|
|
63
|
+
const result = execSync(`bun run test ${testFile}`, {
|
|
64
64
|
encoding: 'utf-8',
|
|
65
65
|
stdio: ['pipe', 'pipe', 'pipe']
|
|
66
66
|
});
|
package/temba-modules.ts
CHANGED
|
@@ -32,6 +32,7 @@ import { ContactFieldEditor } from './src/live/ContactFieldEditor';
|
|
|
32
32
|
|
|
33
33
|
import { ContactBadges } from './src/live/ContactBadges';
|
|
34
34
|
import { ContactTimeline } from './src/live/ContactTimeline';
|
|
35
|
+
import { CampaignEvents } from './src/live/CampaignEvents';
|
|
35
36
|
import { TembaSlider } from './src/form/TembaSlider';
|
|
36
37
|
import { RunList } from './src/list/RunList';
|
|
37
38
|
import { FlowStoreElement } from './src/store/FlowStoreElement';
|
|
@@ -49,9 +50,14 @@ import { Thumbnail } from './src/display/Thumbnail';
|
|
|
49
50
|
import { NotificationList } from './src/list/NotificationList';
|
|
50
51
|
import { ContentList } from './src/list/ContentList';
|
|
51
52
|
import { PageHeader } from './src/layout/PageHeader';
|
|
53
|
+
import { HeaderBar } from './src/layout/HeaderBar';
|
|
52
54
|
import { MsgList } from './src/list/MsgList';
|
|
53
55
|
import { ContactList } from './src/list/ContactList';
|
|
54
56
|
import { FlowList } from './src/list/FlowList';
|
|
57
|
+
import { CampaignList } from './src/list/CampaignList';
|
|
58
|
+
import { FieldList } from './src/list/FieldList';
|
|
59
|
+
import { TriggerList } from './src/list/TriggerList';
|
|
60
|
+
import { BroadcastList } from './src/list/BroadcastList';
|
|
55
61
|
import { WebChat } from './src/webchat/WebChat';
|
|
56
62
|
import { ImagePicker } from './src/form/ImagePicker';
|
|
57
63
|
import { Mask } from './src/layout/Mask';
|
|
@@ -86,6 +92,9 @@ import { FloatingTab } from './src/display/FloatingTab';
|
|
|
86
92
|
import { FloatingWindow } from './src/layout/FloatingWindow';
|
|
87
93
|
import { Accordion } from './src/layout/Accordion';
|
|
88
94
|
import { AccordionSection } from './src/layout/AccordionSection';
|
|
95
|
+
import { Card } from './src/layout/Card';
|
|
96
|
+
import { CardStack } from './src/layout/CardStack';
|
|
97
|
+
import { CardLayout } from './src/layout/CardLayout';
|
|
89
98
|
import { Simulator } from './src/simulator/Simulator';
|
|
90
99
|
import { FlowSearch } from './src/flow/FlowSearch';
|
|
91
100
|
import { IssuesWindow } from './src/flow/IssuesWindow';
|
|
@@ -134,9 +143,14 @@ addCustomElement('temba-ticket-list', TicketList);
|
|
|
134
143
|
addCustomElement('temba-notification-list', NotificationList);
|
|
135
144
|
addCustomElement('temba-content-list', ContentList);
|
|
136
145
|
addCustomElement('temba-page-header', PageHeader);
|
|
146
|
+
addCustomElement('temba-header-bar', HeaderBar);
|
|
137
147
|
addCustomElement('temba-msg-list', MsgList);
|
|
138
148
|
addCustomElement('temba-contact-list', ContactList);
|
|
139
149
|
addCustomElement('temba-flow-list', FlowList);
|
|
150
|
+
addCustomElement('temba-campaign-list', CampaignList);
|
|
151
|
+
addCustomElement('temba-field-list', FieldList);
|
|
152
|
+
addCustomElement('temba-trigger-list', TriggerList);
|
|
153
|
+
addCustomElement('temba-broadcast-list', BroadcastList);
|
|
140
154
|
addCustomElement('temba-list', TembaList);
|
|
141
155
|
addCustomElement('temba-sortable-list', SortableList);
|
|
142
156
|
addCustomElement('temba-run-list', RunList);
|
|
@@ -150,6 +164,7 @@ addCustomElement('temba-tabs', TabPane);
|
|
|
150
164
|
addCustomElement('temba-tab', Tab);
|
|
151
165
|
addCustomElement('temba-contact-badges', ContactBadges);
|
|
152
166
|
addCustomElement('temba-contact-timeline', ContactTimeline);
|
|
167
|
+
addCustomElement('temba-campaign-events', CampaignEvents);
|
|
153
168
|
addCustomElement('temba-slider', TembaSlider);
|
|
154
169
|
addCustomElement('temba-content-menu', ContentMenu);
|
|
155
170
|
addCustomElement('temba-compose', Compose);
|
|
@@ -186,6 +201,9 @@ addCustomElement('temba-message-editor', MessageEditor);
|
|
|
186
201
|
addCustomElement('temba-rich-edit', RichEditor);
|
|
187
202
|
addCustomElement('temba-accordion', Accordion);
|
|
188
203
|
addCustomElement('temba-accordion-section', AccordionSection);
|
|
204
|
+
addCustomElement('temba-card', Card);
|
|
205
|
+
addCustomElement('temba-card-stack', CardStack);
|
|
206
|
+
addCustomElement('temba-card-layout', CardLayout);
|
|
189
207
|
addCustomElement('temba-expression-highlight', ExpressionHighlight);
|
|
190
208
|
addCustomElement('temba-floating-tab', FloatingTab);
|
|
191
209
|
addCustomElement('temba-floating-window', FloatingWindow);
|
|
@@ -450,6 +450,60 @@ export default {
|
|
|
450
450
|
return;
|
|
451
451
|
}
|
|
452
452
|
|
|
453
|
+
// Handle contact timeline (upcoming / past scheduled events).
|
|
454
|
+
// Dates are generated relative to now so the demo never goes stale.
|
|
455
|
+
if (context.request.method === 'GET' && context.path.match(/^\/contact\/timeline\/[^/]+\/$/)) {
|
|
456
|
+
const now = new Date();
|
|
457
|
+
const days = n => new Date(now.getTime() + n * 86400000).toISOString();
|
|
458
|
+
const campaign = { uuid: 'campaign-1', name: 'Customer Onboarding' };
|
|
459
|
+
context.contentType = 'application/json';
|
|
460
|
+
context.body = JSON.stringify({
|
|
461
|
+
now: now.toISOString(),
|
|
462
|
+
campaigns: [campaign],
|
|
463
|
+
future_count: 3,
|
|
464
|
+
future: [
|
|
465
|
+
{
|
|
466
|
+
type: 'campaign_event',
|
|
467
|
+
scheduled: days(2),
|
|
468
|
+
repeat_period: 'O',
|
|
469
|
+
campaign,
|
|
470
|
+
flow: { uuid: 'flow-1', name: 'Welcome Check-in' }
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
type: 'scheduled_broadcast',
|
|
474
|
+
scheduled: days(5),
|
|
475
|
+
repeat_period: 'W',
|
|
476
|
+
message: 'Weekly tips: how to get the most out of your account'
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
type: 'campaign_event',
|
|
480
|
+
scheduled: days(9),
|
|
481
|
+
repeat_period: 'O',
|
|
482
|
+
campaign,
|
|
483
|
+
flow: { uuid: 'flow-2', name: 'Satisfaction Survey' }
|
|
484
|
+
}
|
|
485
|
+
],
|
|
486
|
+
past: [
|
|
487
|
+
{
|
|
488
|
+
type: 'campaign_event',
|
|
489
|
+
scheduled: days(-3),
|
|
490
|
+
repeat_period: 'O',
|
|
491
|
+
campaign,
|
|
492
|
+
flow: { uuid: 'flow-3', name: 'Getting Started' }
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
type: 'sent_broadcast',
|
|
496
|
+
scheduled: days(-7),
|
|
497
|
+
repeat_period: 'O',
|
|
498
|
+
message: 'Welcome aboard!'
|
|
499
|
+
}
|
|
500
|
+
],
|
|
501
|
+
next_before: null,
|
|
502
|
+
next_after: null
|
|
503
|
+
});
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
|
|
453
507
|
// Serve the content-list demo messages from in-memory state
|
|
454
508
|
// so a labeling POST is reflected on the next refresh. Honors
|
|
455
509
|
// an optional `?label=<uuid>` filter for testing the filtered-
|
|
@@ -24,7 +24,7 @@ import { defaultReporter, summaryReporter } from '@web/test-runner';
|
|
|
24
24
|
//
|
|
25
25
|
// - Gated on `WTR_COVERAGE_SHIM` (defaults on when --coverage is in
|
|
26
26
|
// argv; can be force-disabled by setting it to "0") so it never
|
|
27
|
-
// runs in plain `
|
|
27
|
+
// runs in plain `bun run test`, only in the coverage path.
|
|
28
28
|
// - Sentinel is a runtime-random string, so a fixture/cached body
|
|
29
29
|
// containing the literal can't collide.
|
|
30
30
|
// - `__pendingCoverages` is cleared on every parse — matched OR not —
|
package/xliff/es.xlf
CHANGED
|
@@ -27,6 +27,18 @@
|
|
|
27
27
|
<trans-unit id="s81f17cfc89a04338">
|
|
28
28
|
<source>Interrupt flow</source>
|
|
29
29
|
</trans-unit>
|
|
30
|
+
<trans-unit id="s122d4de68bcfcdf4">
|
|
31
|
+
<source>It's okay to restart</source>
|
|
32
|
+
</trans-unit>
|
|
33
|
+
<trans-unit id="s3eb2567092b4d7c1">
|
|
34
|
+
<source>from the beginning</source>
|
|
35
|
+
</trans-unit>
|
|
36
|
+
<trans-unit id="s28f37776b3901438">
|
|
37
|
+
<source>It's okay to interrupt</source>
|
|
38
|
+
</trans-unit>
|
|
39
|
+
<trans-unit id="s6838d20b10f7512a">
|
|
40
|
+
<source>and start this one</source>
|
|
41
|
+
</trans-unit>
|
|
30
42
|
</body>
|
|
31
43
|
</file>
|
|
32
44
|
</xliff>
|
package/xliff/fr.xlf
CHANGED
|
@@ -26,6 +26,18 @@
|
|
|
26
26
|
<trans-unit id="s81f17cfc89a04338">
|
|
27
27
|
<source>Interrupt flow</source>
|
|
28
28
|
</trans-unit>
|
|
29
|
+
<trans-unit id="s122d4de68bcfcdf4">
|
|
30
|
+
<source>It's okay to restart</source>
|
|
31
|
+
</trans-unit>
|
|
32
|
+
<trans-unit id="s3eb2567092b4d7c1">
|
|
33
|
+
<source>from the beginning</source>
|
|
34
|
+
</trans-unit>
|
|
35
|
+
<trans-unit id="s28f37776b3901438">
|
|
36
|
+
<source>It's okay to interrupt</source>
|
|
37
|
+
</trans-unit>
|
|
38
|
+
<trans-unit id="s6838d20b10f7512a">
|
|
39
|
+
<source>and start this one</source>
|
|
40
|
+
</trans-unit>
|
|
29
41
|
</body>
|
|
30
42
|
</file>
|
|
31
43
|
</xliff>
|
package/xliff/pt.xlf
CHANGED
|
@@ -26,6 +26,18 @@
|
|
|
26
26
|
<trans-unit id="s81f17cfc89a04338">
|
|
27
27
|
<source>Interrupt flow</source>
|
|
28
28
|
</trans-unit>
|
|
29
|
+
<trans-unit id="s122d4de68bcfcdf4">
|
|
30
|
+
<source>It's okay to restart</source>
|
|
31
|
+
</trans-unit>
|
|
32
|
+
<trans-unit id="s3eb2567092b4d7c1">
|
|
33
|
+
<source>from the beginning</source>
|
|
34
|
+
</trans-unit>
|
|
35
|
+
<trans-unit id="s28f37776b3901438">
|
|
36
|
+
<source>It's okay to interrupt</source>
|
|
37
|
+
</trans-unit>
|
|
38
|
+
<trans-unit id="s6838d20b10f7512a">
|
|
39
|
+
<source>and start this one</source>
|
|
40
|
+
</trans-unit>
|
|
29
41
|
</body>
|
|
30
42
|
</file>
|
|
31
43
|
</xliff>
|