@nyaruka/temba-components 0.131.2 → 0.131.3
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 +14 -0
- package/demo/components/floating-tabs/example.html +400 -0
- package/demo/components/flow/index.html +1 -1
- package/demo/data/flows/sample-flow.json +41 -2
- package/demo/data/flows/voicemail.json +613 -0
- package/demo/index.html +6 -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 +1109 -535
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/display/FloatingTab.js +167 -0
- package/out-tsc/src/display/FloatingTab.js.map +1 -0
- package/out-tsc/src/display/ProgressBar.js +22 -2
- package/out-tsc/src/display/ProgressBar.js.map +1 -1
- package/out-tsc/src/events.js.map +1 -1
- package/out-tsc/src/flow/CanvasNode.js +165 -31
- package/out-tsc/src/flow/CanvasNode.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +857 -3
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/NodeEditor.js +239 -19
- package/out-tsc/src/flow/NodeEditor.js.map +1 -1
- package/out-tsc/src/flow/NodeTypeSelector.js +44 -3
- package/out-tsc/src/flow/NodeTypeSelector.js.map +1 -1
- package/out-tsc/src/flow/StickyNote.js +12 -3
- package/out-tsc/src/flow/StickyNote.js.map +1 -1
- package/out-tsc/src/flow/actions/add_contact_groups.js +2 -1
- package/out-tsc/src/flow/actions/add_contact_groups.js.map +1 -1
- package/out-tsc/src/flow/actions/add_contact_urn.js +2 -1
- package/out-tsc/src/flow/actions/add_contact_urn.js.map +1 -1
- package/out-tsc/src/flow/actions/add_input_labels.js +2 -1
- package/out-tsc/src/flow/actions/add_input_labels.js.map +1 -1
- package/out-tsc/src/flow/actions/play_audio.js +2 -1
- package/out-tsc/src/flow/actions/play_audio.js.map +1 -1
- package/out-tsc/src/flow/actions/remove_contact_groups.js +2 -1
- package/out-tsc/src/flow/actions/remove_contact_groups.js.map +1 -1
- package/out-tsc/src/flow/actions/request_optin.js +1 -0
- package/out-tsc/src/flow/actions/request_optin.js.map +1 -1
- package/out-tsc/src/flow/actions/say_msg.js +2 -1
- package/out-tsc/src/flow/actions/say_msg.js.map +1 -1
- package/out-tsc/src/flow/actions/send_broadcast.js +2 -1
- package/out-tsc/src/flow/actions/send_broadcast.js.map +1 -1
- package/out-tsc/src/flow/actions/send_email.js +2 -1
- package/out-tsc/src/flow/actions/send_email.js.map +1 -1
- package/out-tsc/src/flow/actions/send_msg.js +93 -3
- package/out-tsc/src/flow/actions/send_msg.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_channel.js +2 -1
- package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_field.js +2 -1
- package/out-tsc/src/flow/actions/set_contact_field.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_language.js +2 -1
- package/out-tsc/src/flow/actions/set_contact_language.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_name.js +2 -1
- package/out-tsc/src/flow/actions/set_contact_name.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_status.js +2 -1
- package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
- package/out-tsc/src/flow/actions/set_run_result.js +2 -1
- package/out-tsc/src/flow/actions/set_run_result.js.map +1 -1
- package/out-tsc/src/flow/actions/start_session.js +2 -1
- package/out-tsc/src/flow/actions/start_session.js.map +1 -1
- package/out-tsc/src/flow/config.js +2 -10
- package/out-tsc/src/flow/config.js.map +1 -1
- package/out-tsc/src/flow/nodes/shared.js +54 -0
- package/out-tsc/src/flow/nodes/shared.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_airtime.js +9 -3
- package/out-tsc/src/flow/nodes/split_by_airtime.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_contact_field.js +8 -3
- package/out-tsc/src/flow/nodes/split_by_contact_field.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_expression.js +8 -3
- package/out-tsc/src/flow/nodes/split_by_expression.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_groups.js +8 -3
- package/out-tsc/src/flow/nodes/split_by_groups.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_intent.js +3 -2
- package/out-tsc/src/flow/nodes/split_by_intent.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_llm.js +9 -2
- package/out-tsc/src/flow/nodes/split_by_llm.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +9 -2
- package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_random.js +8 -2
- package/out-tsc/src/flow/nodes/split_by_random.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_resthook.js +8 -3
- package/out-tsc/src/flow/nodes/split_by_resthook.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_run_result.js +8 -3
- package/out-tsc/src/flow/nodes/split_by_run_result.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_scheme.js +8 -3
- package/out-tsc/src/flow/nodes/split_by_scheme.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_subflow.js +8 -2
- package/out-tsc/src/flow/nodes/split_by_subflow.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_ticket.js +8 -2
- package/out-tsc/src/flow/nodes/split_by_ticket.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_webhook.js +8 -2
- package/out-tsc/src/flow/nodes/split_by_webhook.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_digits.js +3 -2
- package/out-tsc/src/flow/nodes/wait_for_digits.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_menu.js +3 -2
- package/out-tsc/src/flow/nodes/wait_for_menu.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_response.js +8 -3
- package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
- package/out-tsc/src/flow/types.js +15 -0
- package/out-tsc/src/flow/types.js.map +1 -1
- package/out-tsc/src/layout/FloatingWindow.js +346 -0
- package/out-tsc/src/layout/FloatingWindow.js.map +1 -0
- package/out-tsc/src/live/ContactChat.js +3 -19
- package/out-tsc/src/live/ContactChat.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 +67 -0
- package/out-tsc/src/store/AppState.js.map +1 -1
- package/out-tsc/temba-modules.js +4 -0
- package/out-tsc/temba-modules.js.map +1 -1
- package/out-tsc/test/temba-floating-tab.test.js +91 -0
- package/out-tsc/test/temba-floating-tab.test.js.map +1 -0
- package/out-tsc/test/temba-floating-window.test.js +301 -0
- package/out-tsc/test/temba-floating-window.test.js.map +1 -0
- package/out-tsc/test/temba-flow-editor-node.test.js +117 -0
- package/out-tsc/test/temba-flow-editor-node.test.js.map +1 -1
- package/out-tsc/test/temba-localization.test.js +471 -0
- package/out-tsc/test/temba-localization.test.js.map +1 -0
- package/out-tsc/test/temba-node-type-selector.test.js +150 -0
- package/out-tsc/test/temba-node-type-selector.test.js.map +1 -1
- package/out-tsc/test/utils.test.js +18 -0
- package/out-tsc/test/utils.test.js.map +1 -1
- package/package.json +1 -1
- package/screenshots/truth/floating-tab/default.png +0 -0
- package/screenshots/truth/floating-tab/gray.png +0 -0
- package/screenshots/truth/floating-tab/green.png +0 -0
- package/screenshots/truth/floating-tab/hidden.png +0 -0
- package/screenshots/truth/floating-tab/hover.png +0 -0
- package/screenshots/truth/floating-tab/purple.png +0 -0
- package/screenshots/truth/floating-window/chromeless.png +0 -0
- package/screenshots/truth/floating-window/custom-size.png +0 -0
- package/screenshots/truth/floating-window/default.png +0 -0
- package/screenshots/truth/floating-window/with-header.png +0 -0
- package/screenshots/truth/node-type-selector/action-mode.png +0 -0
- package/screenshots/truth/node-type-selector/split-mode.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
- package/src/display/FloatingTab.ts +174 -0
- package/src/display/ProgressBar.ts +22 -2
- package/src/events.ts +2 -4
- package/src/flow/CanvasNode.ts +190 -32
- package/src/flow/Editor.ts +1040 -3
- package/src/flow/NodeEditor.ts +317 -19
- package/src/flow/NodeTypeSelector.ts +47 -3
- package/src/flow/StickyNote.ts +12 -3
- package/src/flow/actions/add_contact_groups.ts +2 -1
- package/src/flow/actions/add_contact_urn.ts +3 -1
- package/src/flow/actions/add_input_labels.ts +2 -1
- package/src/flow/actions/play_audio.ts +2 -1
- package/src/flow/actions/remove_contact_groups.ts +3 -1
- package/src/flow/actions/request_optin.ts +1 -0
- package/src/flow/actions/say_msg.ts +2 -1
- package/src/flow/actions/send_broadcast.ts +2 -1
- package/src/flow/actions/send_email.ts +3 -1
- package/src/flow/actions/send_msg.ts +134 -3
- package/src/flow/actions/set_contact_channel.ts +2 -1
- package/src/flow/actions/set_contact_field.ts +2 -1
- package/src/flow/actions/set_contact_language.ts +3 -1
- package/src/flow/actions/set_contact_name.ts +2 -1
- package/src/flow/actions/set_contact_status.ts +2 -1
- package/src/flow/actions/set_run_result.ts +2 -1
- package/src/flow/actions/start_session.ts +3 -1
- package/src/flow/config.ts +2 -12
- package/src/flow/nodes/shared.ts +70 -1
- package/src/flow/nodes/split_by_airtime.ts +20 -3
- package/src/flow/nodes/split_by_contact_field.ts +13 -3
- package/src/flow/nodes/split_by_expression.ts +13 -3
- package/src/flow/nodes/split_by_groups.ts +13 -3
- package/src/flow/nodes/split_by_intent.ts +3 -2
- package/src/flow/nodes/split_by_llm.ts +19 -2
- package/src/flow/nodes/split_by_llm_categorize.ts +19 -2
- package/src/flow/nodes/split_by_random.ts +12 -2
- package/src/flow/nodes/split_by_resthook.ts +13 -3
- package/src/flow/nodes/split_by_run_result.ts +13 -3
- package/src/flow/nodes/split_by_scheme.ts +13 -3
- package/src/flow/nodes/split_by_subflow.ts +12 -2
- package/src/flow/nodes/split_by_ticket.ts +12 -2
- package/src/flow/nodes/split_by_webhook.ts +12 -2
- package/src/flow/nodes/wait_for_digits.ts +3 -2
- package/src/flow/nodes/wait_for_menu.ts +3 -2
- package/src/flow/nodes/wait_for_response.ts +13 -3
- package/src/flow/types.ts +47 -0
- package/src/layout/FloatingWindow.ts +386 -0
- package/src/live/ContactChat.ts +4 -19
- 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 +104 -0
- package/static/api/llms.json +18 -0
- package/temba-modules.ts +4 -0
- package/test/temba-floating-tab.test.ts +110 -0
- package/test/temba-floating-window.test.ts +477 -0
- package/test/temba-flow-editor-node.test.ts +144 -0
- package/test/temba-localization.test.ts +611 -0
- package/test/temba-node-type-selector.test.ts +203 -0
- package/test/utils.test.ts +20 -0
- package/test-assets/contacts/history.json +5 -6
- package/test-assets/select/llms.json +2 -2
- package/web-dev-server.config.mjs +47 -1
- package/web-test-runner.config.mjs +0 -1
- package/out-tsc/src/flow/nodes/wait_for_audio.js +0 -7
- package/out-tsc/src/flow/nodes/wait_for_audio.js.map +0 -1
- package/out-tsc/src/flow/nodes/wait_for_image.js +0 -7
- package/out-tsc/src/flow/nodes/wait_for_image.js.map +0 -1
- package/out-tsc/src/flow/nodes/wait_for_location.js +0 -7
- package/out-tsc/src/flow/nodes/wait_for_location.js.map +0 -1
- package/out-tsc/src/flow/nodes/wait_for_video.js +0 -7
- package/out-tsc/src/flow/nodes/wait_for_video.js.map +0 -1
- package/src/flow/nodes/wait_for_audio.ts +0 -7
- package/src/flow/nodes/wait_for_image.ts +0 -7
- package/src/flow/nodes/wait_for_location.ts +0 -7
- package/src/flow/nodes/wait_for_video.ts +0 -7
|
@@ -1299,4 +1299,148 @@ describe('EditorNode', () => {
|
|
|
1299
1299
|
expect(rendered).to.exist;
|
|
1300
1300
|
});
|
|
1301
1301
|
});
|
|
1302
|
+
|
|
1303
|
+
describe('router section graying', () => {
|
|
1304
|
+
it('grays out split nodes when categories not included in translation', async () => {
|
|
1305
|
+
const mockNode: Node = {
|
|
1306
|
+
uuid: 'split-node-1',
|
|
1307
|
+
actions: [],
|
|
1308
|
+
exits: [
|
|
1309
|
+
{ uuid: 'exit-1', destination_uuid: null },
|
|
1310
|
+
{ uuid: 'exit-2', destination_uuid: null }
|
|
1311
|
+
],
|
|
1312
|
+
router: {
|
|
1313
|
+
type: 'switch',
|
|
1314
|
+
result_name: 'Response',
|
|
1315
|
+
categories: [
|
|
1316
|
+
{ uuid: 'cat-1', name: 'Category 1', exit_uuid: 'exit-1' },
|
|
1317
|
+
{ uuid: 'cat-2', name: 'Category 2', exit_uuid: 'exit-2' }
|
|
1318
|
+
]
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
|
|
1322
|
+
const mockUI: NodeUI = {
|
|
1323
|
+
position: { left: 0, top: 0 },
|
|
1324
|
+
type: 'split_by_groups'
|
|
1325
|
+
};
|
|
1326
|
+
|
|
1327
|
+
// Create node
|
|
1328
|
+
const editorNode: CanvasNode = await fixture(
|
|
1329
|
+
html`<temba-flow-node
|
|
1330
|
+
.node=${mockNode}
|
|
1331
|
+
.ui=${mockUI}
|
|
1332
|
+
></temba-flow-node>`
|
|
1333
|
+
);
|
|
1334
|
+
|
|
1335
|
+
// Set fromStore properties directly
|
|
1336
|
+
(editorNode as any).isTranslating = true;
|
|
1337
|
+
(editorNode as any).includeCategoriesInTranslation = false;
|
|
1338
|
+
(editorNode as any).languageCode = 'spa';
|
|
1339
|
+
|
|
1340
|
+
// Force re-render
|
|
1341
|
+
editorNode.requestUpdate('isTranslating');
|
|
1342
|
+
editorNode.requestUpdate('includeCategoriesInTranslation');
|
|
1343
|
+
await editorNode.updateComplete;
|
|
1344
|
+
|
|
1345
|
+
// Find the node element
|
|
1346
|
+
const nodeElement = editorNode.querySelector('.node');
|
|
1347
|
+
expect(nodeElement).to.exist;
|
|
1348
|
+
|
|
1349
|
+
// Verify it has the non-localizable class
|
|
1350
|
+
expect(nodeElement?.classList.contains('non-localizable')).to.be.true;
|
|
1351
|
+
});
|
|
1352
|
+
|
|
1353
|
+
it('does not gray out split nodes when categories are included in translation', async () => {
|
|
1354
|
+
const mockNode: Node = {
|
|
1355
|
+
uuid: 'split-node-2',
|
|
1356
|
+
actions: [],
|
|
1357
|
+
exits: [
|
|
1358
|
+
{ uuid: 'exit-1', destination_uuid: null },
|
|
1359
|
+
{ uuid: 'exit-2', destination_uuid: null }
|
|
1360
|
+
],
|
|
1361
|
+
router: {
|
|
1362
|
+
type: 'switch',
|
|
1363
|
+
result_name: 'Response',
|
|
1364
|
+
categories: [
|
|
1365
|
+
{ uuid: 'cat-1', name: 'Category 1', exit_uuid: 'exit-1' },
|
|
1366
|
+
{ uuid: 'cat-2', name: 'Category 2', exit_uuid: 'exit-2' }
|
|
1367
|
+
]
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
|
|
1371
|
+
const mockUI: NodeUI = {
|
|
1372
|
+
position: { left: 0, top: 0 },
|
|
1373
|
+
type: 'split_by_groups'
|
|
1374
|
+
};
|
|
1375
|
+
|
|
1376
|
+
// Create node
|
|
1377
|
+
const editorNode: CanvasNode = await fixture(
|
|
1378
|
+
html`<temba-flow-node
|
|
1379
|
+
.node=${mockNode}
|
|
1380
|
+
.ui=${mockUI}
|
|
1381
|
+
></temba-flow-node>`
|
|
1382
|
+
);
|
|
1383
|
+
|
|
1384
|
+
// Set fromStore properties directly
|
|
1385
|
+
(editorNode as any).isTranslating = true;
|
|
1386
|
+
(editorNode as any).includeCategoriesInTranslation = true;
|
|
1387
|
+
(editorNode as any).languageCode = 'spa';
|
|
1388
|
+
|
|
1389
|
+
await editorNode.requestUpdate();
|
|
1390
|
+
await editorNode.updateComplete;
|
|
1391
|
+
|
|
1392
|
+
// Find the node element
|
|
1393
|
+
const nodeElement = editorNode.querySelector('.node');
|
|
1394
|
+
expect(nodeElement).to.exist;
|
|
1395
|
+
|
|
1396
|
+
// Verify it does NOT have the non-localizable class
|
|
1397
|
+
expect(nodeElement?.classList.contains('non-localizable')).to.be.false;
|
|
1398
|
+
});
|
|
1399
|
+
|
|
1400
|
+
it('does not gray out split nodes when not translating', async () => {
|
|
1401
|
+
const mockNode: Node = {
|
|
1402
|
+
uuid: 'split-node-3',
|
|
1403
|
+
actions: [],
|
|
1404
|
+
exits: [
|
|
1405
|
+
{ uuid: 'exit-1', destination_uuid: null },
|
|
1406
|
+
{ uuid: 'exit-2', destination_uuid: null }
|
|
1407
|
+
],
|
|
1408
|
+
router: {
|
|
1409
|
+
type: 'switch',
|
|
1410
|
+
result_name: 'Response',
|
|
1411
|
+
categories: [
|
|
1412
|
+
{ uuid: 'cat-1', name: 'Category 1', exit_uuid: 'exit-1' },
|
|
1413
|
+
{ uuid: 'cat-2', name: 'Category 2', exit_uuid: 'exit-2' }
|
|
1414
|
+
]
|
|
1415
|
+
}
|
|
1416
|
+
};
|
|
1417
|
+
|
|
1418
|
+
const mockUI: NodeUI = {
|
|
1419
|
+
position: { left: 0, top: 0 },
|
|
1420
|
+
type: 'split_by_groups'
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1423
|
+
// Create node
|
|
1424
|
+
const editorNode: CanvasNode = await fixture(
|
|
1425
|
+
html`<temba-flow-node
|
|
1426
|
+
.node=${mockNode}
|
|
1427
|
+
.ui=${mockUI}
|
|
1428
|
+
></temba-flow-node>`
|
|
1429
|
+
);
|
|
1430
|
+
|
|
1431
|
+
// Set fromStore properties directly
|
|
1432
|
+
(editorNode as any).isTranslating = false;
|
|
1433
|
+
(editorNode as any).languageCode = 'eng';
|
|
1434
|
+
|
|
1435
|
+
await editorNode.requestUpdate();
|
|
1436
|
+
await editorNode.updateComplete;
|
|
1437
|
+
|
|
1438
|
+
// Find the node element
|
|
1439
|
+
const nodeElement = editorNode.querySelector('.node');
|
|
1440
|
+
expect(nodeElement).to.exist;
|
|
1441
|
+
|
|
1442
|
+
// Verify it does NOT have the non-localizable class
|
|
1443
|
+
expect(nodeElement?.classList.contains('non-localizable')).to.be.false;
|
|
1444
|
+
});
|
|
1445
|
+
});
|
|
1302
1446
|
});
|