@nyaruka/temba-components 0.156.2 → 0.156.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 +10 -0
- package/dist/temba-components.js +191 -131
- package/dist/temba-components.js.map +1 -1
- package/package.json +1 -1
- package/src/display/Chat.ts +19 -17
- package/src/events/eventRenderers.ts +6 -1
- package/src/flow/CanvasNode.ts +49 -2
- package/src/flow/Editor.ts +25 -33
- package/src/flow/FlowSearch.ts +42 -10
- package/src/flow/MessageTable.ts +332 -122
- package/src/flow/NodeEditor.ts +29 -4
- package/src/flow/actions/say_msg.ts +1 -0
- package/src/flow/actions/send_broadcast.ts +48 -0
- package/src/flow/actions/send_email.ts +42 -1
- package/src/flow/actions/send_msg.ts +1 -0
- package/src/flow/actions/set_run_result.ts +1 -0
- package/src/flow/nodes/shared-rules.ts +1 -0
- package/src/flow/nodes/shared.ts +1 -0
- package/src/flow/nodes/wait_for_audio.ts +1 -0
- package/src/simulator/Simulator.ts +17 -12
- package/web-test-runner.config.mjs +2 -0
|
@@ -45,12 +45,13 @@ export const send_email: ActionConfig = {
|
|
|
45
45
|
required: true,
|
|
46
46
|
evaluated: true,
|
|
47
47
|
placeholder: 'Enter email subject',
|
|
48
|
-
maxLength:
|
|
48
|
+
maxLength: 1000
|
|
49
49
|
},
|
|
50
50
|
body: {
|
|
51
51
|
type: 'textarea',
|
|
52
52
|
required: true,
|
|
53
53
|
evaluated: true,
|
|
54
|
+
maxLength: 10000,
|
|
54
55
|
minHeight: 175
|
|
55
56
|
}
|
|
56
57
|
},
|
|
@@ -65,6 +66,46 @@ export const send_email: ActionConfig = {
|
|
|
65
66
|
body: formData.body
|
|
66
67
|
};
|
|
67
68
|
},
|
|
69
|
+
localizable: ['subject', 'body'],
|
|
70
|
+
toLocalizationFormData: (
|
|
71
|
+
action: SendEmail,
|
|
72
|
+
localization: Record<string, any>
|
|
73
|
+
) => {
|
|
74
|
+
const formData: FormData = {
|
|
75
|
+
uuid: action.uuid
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
if (localization.subject && Array.isArray(localization.subject)) {
|
|
79
|
+
formData.subject = localization.subject[0] || '';
|
|
80
|
+
} else {
|
|
81
|
+
formData.subject = '';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (localization.body && Array.isArray(localization.body)) {
|
|
85
|
+
formData.body = localization.body[0] || '';
|
|
86
|
+
} else {
|
|
87
|
+
formData.body = '';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return formData;
|
|
91
|
+
},
|
|
92
|
+
fromLocalizationFormData: (formData: FormData, action: SendEmail) => {
|
|
93
|
+
const localization: Record<string, any> = {};
|
|
94
|
+
|
|
95
|
+
if (formData.subject && formData.subject.trim() !== '') {
|
|
96
|
+
if (formData.subject !== action.subject) {
|
|
97
|
+
localization.subject = [formData.subject];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (formData.body && formData.body.trim() !== '') {
|
|
102
|
+
if (formData.body !== action.body) {
|
|
103
|
+
localization.body = [formData.body];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return localization;
|
|
108
|
+
},
|
|
68
109
|
validate: (formData: FormData): ValidationResult => {
|
|
69
110
|
const errors: { [key: string]: string } = {};
|
|
70
111
|
|
package/src/flow/nodes/shared.ts
CHANGED
|
@@ -34,6 +34,9 @@ const TEST_LOCATIONS = [
|
|
|
34
34
|
'geo:-1.9536,30.0606' // Kigali
|
|
35
35
|
];
|
|
36
36
|
|
|
37
|
+
const truncateUrl = (url: string, maxLen = 50): string =>
|
|
38
|
+
url && url.length > maxLen ? url.slice(0, maxLen) + '…' : url;
|
|
39
|
+
|
|
37
40
|
interface Contact {
|
|
38
41
|
uuid: string;
|
|
39
42
|
name?: string;
|
|
@@ -1472,18 +1475,20 @@ export class Simulator extends RapidElement {
|
|
|
1472
1475
|
const renderedEvent =
|
|
1473
1476
|
event.type === Events.WEBHOOK_CALLED && this.hasWebhookDetails(event)
|
|
1474
1477
|
? html`<div class="webhook-event">
|
|
1475
|
-
<div class="webhook-event-text"
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1478
|
+
<div class="webhook-event-text">
|
|
1479
|
+
Called
|
|
1480
|
+
<a
|
|
1481
|
+
href="#"
|
|
1482
|
+
class="webhook-event-url"
|
|
1483
|
+
data-webhook-details="true"
|
|
1484
|
+
title="View webhook call details"
|
|
1485
|
+
@click=${(clickEvent: MouseEvent) => {
|
|
1486
|
+
clickEvent.preventDefault();
|
|
1487
|
+
this.handleWebhookDetailsClick(event, clickEvent);
|
|
1488
|
+
}}
|
|
1489
|
+
>${truncateUrl((event as any).url)}</a
|
|
1490
|
+
>
|
|
1491
|
+
</div>
|
|
1487
1492
|
</div>`
|
|
1488
1493
|
: rendered;
|
|
1489
1494
|
|
|
@@ -282,6 +282,8 @@ const wireScreenshots = async (page, context, wait, replaceScreenshots) => {
|
|
|
282
282
|
|
|
283
283
|
await page.exposeFunction('click', async (element) => {
|
|
284
284
|
if (page.isClosed()) return;
|
|
285
|
+
// reset mouse state to avoid "already pressed" errors
|
|
286
|
+
await page.mouse.up().catch(() => {});
|
|
285
287
|
const frame = await page.frames().find((f) => {
|
|
286
288
|
return true;
|
|
287
289
|
});
|