@nyaruka/temba-components 0.129.10 → 0.129.11
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 +13 -0
- package/demo/data/flows/sample-flow.json +96 -56
- package/dist/temba-components.js +278 -268
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/events.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +9 -6
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_channel.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_field.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_field.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_language.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_language.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_status.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
- package/out-tsc/src/flow/config.js +2 -8
- package/out-tsc/src/flow/config.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_llm.js +101 -0
- package/out-tsc/src/flow/nodes/split_by_llm.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +4 -89
- package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_subflow.js +123 -3
- package/out-tsc/src/flow/nodes/split_by_subflow.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_ticket.js +115 -13
- package/out-tsc/src/flow/nodes/split_by_ticket.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_webhook.js +160 -12
- package/out-tsc/src/flow/nodes/split_by_webhook.js.map +1 -1
- package/out-tsc/src/live/ContactChat.js +48 -66
- package/out-tsc/src/live/ContactChat.js.map +1 -1
- package/out-tsc/src/utils.js +115 -0
- package/out-tsc/src/utils.js.map +1 -1
- package/out-tsc/test/nodes/split_by_llm.test.js +174 -0
- package/out-tsc/test/nodes/split_by_llm.test.js.map +1 -0
- package/package.json +1 -1
- package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/multiple-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/single-group.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/information-extraction.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/sentiment-analysis.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/summarization.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/translation-task.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/cleanup-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/multiple-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/single-group.png +0 -0
- package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
- package/screenshots/truth/actions/send_email/editor/empty-body.png +0 -0
- package/screenshots/truth/actions/send_email/editor/empty-subject.png +0 -0
- package/screenshots/truth/actions/send_email/editor/long-subject.png +0 -0
- package/screenshots/truth/actions/send_email/editor/multiline-body.png +0 -0
- package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
- package/screenshots/truth/actions/send_email/editor/simple-email.png +0 -0
- package/screenshots/truth/actions/send_email/editor/with-expressions.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
- package/screenshots/truth/checkbox/checkbox-label-background-hover.png +0 -0
- package/screenshots/truth/checkbox/checkbox-no-label-no-background-hover.png +0 -0
- package/screenshots/truth/checkbox/checkbox-whitespace-label-no-background-hover.png +0 -0
- package/screenshots/truth/checkbox/checkbox-with-help-text.png +0 -0
- package/screenshots/truth/checkbox/checked.png +0 -0
- package/screenshots/truth/checkbox/default.png +0 -0
- package/screenshots/truth/colorpicker/default.png +0 -0
- package/screenshots/truth/colorpicker/focused.png +0 -0
- package/screenshots/truth/colorpicker/initialized.png +0 -0
- package/screenshots/truth/colorpicker/selected.png +0 -0
- package/screenshots/truth/compose/attachments-tab.png +0 -0
- package/screenshots/truth/compose/attachments-with-files.png +0 -0
- package/screenshots/truth/compose/intial-text.png +0 -0
- package/screenshots/truth/compose/no-counter.png +0 -0
- package/screenshots/truth/compose/wraps-text-and-spaces.png +0 -0
- package/screenshots/truth/compose/wraps-text-and-url.png +0 -0
- package/screenshots/truth/compose/wraps-text-no-spaces.png +0 -0
- package/screenshots/truth/contacts/chat-failure.png +0 -0
- package/screenshots/truth/contacts/chat-for-active-contact.png +0 -0
- package/screenshots/truth/contacts/chat-sends-attachments-only.png +0 -0
- package/screenshots/truth/contacts/chat-sends-text-and-attachments.png +0 -0
- package/screenshots/truth/contacts/chat-sends-text-only.png +0 -0
- package/screenshots/truth/counter/summary.png +0 -0
- package/screenshots/truth/counter/text.png +0 -0
- package/screenshots/truth/counter/unicode-variables.png +0 -0
- package/screenshots/truth/counter/unicode.png +0 -0
- package/screenshots/truth/counter/variable.png +0 -0
- package/screenshots/truth/datepicker/date-truncated-time.png +0 -0
- package/screenshots/truth/datepicker/date.png +0 -0
- package/screenshots/truth/datepicker/initial-timezone.png +0 -0
- package/screenshots/truth/datepicker/range-picker-editing-start.png +0 -0
- package/screenshots/truth/datepicker/updated-keyboard-date.png +0 -0
- package/screenshots/truth/dialog/focused.png +0 -0
- package/screenshots/truth/dropdown/right-edge-collision.png +0 -0
- package/screenshots/truth/editor/router.png +0 -0
- package/screenshots/truth/editor/send_msg.png +0 -0
- package/screenshots/truth/editor/set_contact_language.png +0 -0
- package/screenshots/truth/editor/set_contact_name.png +0 -0
- package/screenshots/truth/editor/set_run_result.png +0 -0
- package/screenshots/truth/editor/wait.png +0 -0
- package/screenshots/truth/field-renderer/checkbox-checked.png +0 -0
- package/screenshots/truth/field-renderer/checkbox-unchecked.png +0 -0
- package/screenshots/truth/field-renderer/checkbox-with-errors.png +0 -0
- package/screenshots/truth/field-renderer/context-comparison.png +0 -0
- package/screenshots/truth/field-renderer/key-value-with-label.png +0 -0
- package/screenshots/truth/field-renderer/message-editor-with-label.png +0 -0
- package/screenshots/truth/field-renderer/select-multi.png +0 -0
- package/screenshots/truth/field-renderer/select-no-label.png +0 -0
- package/screenshots/truth/field-renderer/select-with-label.png +0 -0
- package/screenshots/truth/field-renderer/text-evaluated.png +0 -0
- package/screenshots/truth/field-renderer/text-no-label.png +0 -0
- package/screenshots/truth/field-renderer/text-with-errors.png +0 -0
- package/screenshots/truth/field-renderer/text-with-label.png +0 -0
- package/screenshots/truth/field-renderer/textarea-evaluated.png +0 -0
- package/screenshots/truth/field-renderer/textarea-with-label.png +0 -0
- package/screenshots/truth/integration/checkbox-markdown-errors.png +0 -0
- package/screenshots/truth/list/fields-dragging.png +0 -0
- package/screenshots/truth/list/fields-filtered.png +0 -0
- package/screenshots/truth/list/fields-hovered.png +0 -0
- package/screenshots/truth/list/fields.png +0 -0
- package/screenshots/truth/list/items-selected.png +0 -0
- package/screenshots/truth/list/items-updated.png +0 -0
- package/screenshots/truth/list/items.png +0 -0
- package/screenshots/truth/menu/menu-focused-with items.png +0 -0
- package/screenshots/truth/menu/menu-refresh-1.png +0 -0
- package/screenshots/truth/menu/menu-refresh-2.png +0 -0
- package/screenshots/truth/menu/menu-submenu.png +0 -0
- package/screenshots/truth/menu/menu-tasks-nextup.png +0 -0
- package/screenshots/truth/menu/menu-tasks.png +0 -0
- package/screenshots/truth/message-editor/autogrow-initial-content.png +0 -0
- package/screenshots/truth/message-editor/default.png +0 -0
- package/screenshots/truth/message-editor/drag-highlight.png +0 -0
- package/screenshots/truth/message-editor/filtered-attachments.png +0 -0
- package/screenshots/truth/message-editor/with-completion.png +0 -0
- package/screenshots/truth/message-editor/with-properties.png +0 -0
- package/screenshots/truth/modax/form.png +0 -0
- package/screenshots/truth/modax/simple.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/information-extraction.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/sentiment-analysis.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/summarization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/translation-task.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/information-extraction.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/sentiment-analysis.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/summarization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/translation-task.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
- package/screenshots/truth/omnibox/selected.png +0 -0
- package/screenshots/truth/options/block.png +0 -0
- package/screenshots/truth/run-list/basic.png +0 -0
- package/screenshots/truth/select/disabled-multi-selection.png +0 -0
- package/screenshots/truth/select/disabled-selection.png +0 -0
- package/screenshots/truth/select/disabled.png +0 -0
- package/screenshots/truth/select/embedded.png +0 -0
- package/screenshots/truth/select/empty-options.png +0 -0
- package/screenshots/truth/select/expression-selected.png +0 -0
- package/screenshots/truth/select/expressions.png +0 -0
- package/screenshots/truth/select/functions.png +0 -0
- package/screenshots/truth/select/local-options.png +0 -0
- package/screenshots/truth/select/multi-with-endpoint.png +0 -0
- package/screenshots/truth/select/multiple-initial-values.png +0 -0
- package/screenshots/truth/select/remote-options.png +0 -0
- package/screenshots/truth/select/search-enabled.png +0 -0
- package/screenshots/truth/select/search-multi-no-matches.png +0 -0
- package/screenshots/truth/select/search-selected-focus.png +0 -0
- package/screenshots/truth/select/search-selected.png +0 -0
- package/screenshots/truth/select/search-with-selected.png +0 -0
- package/screenshots/truth/select/searching.png +0 -0
- package/screenshots/truth/select/selected-multi-maxitems-reached.png +0 -0
- package/screenshots/truth/select/selected-multi.png +0 -0
- package/screenshots/truth/select/selected-single.png +0 -0
- package/screenshots/truth/select/selection-clearable.png +0 -0
- package/screenshots/truth/select/static-initial-value.png +0 -0
- package/screenshots/truth/select/static-initial-via-selected.png +0 -0
- package/screenshots/truth/select/truncated-selection.png +0 -0
- package/screenshots/truth/select/with-placeholder.png +0 -0
- package/screenshots/truth/select/without-placeholder.png +0 -0
- package/screenshots/truth/slider/update-slider-on-circle-dragged.png +0 -0
- package/screenshots/truth/templates/default.png +0 -0
- package/screenshots/truth/templates/unapproved.png +0 -0
- package/screenshots/truth/textinput/autogrow-initial.png +0 -0
- package/screenshots/truth/textinput/input-disabled.png +0 -0
- package/screenshots/truth/textinput/input-focused.png +0 -0
- package/screenshots/truth/textinput/input-form.png +0 -0
- package/screenshots/truth/textinput/input-inserted.png +0 -0
- package/screenshots/truth/textinput/input-placeholder.png +0 -0
- package/screenshots/truth/textinput/input-updated.png +0 -0
- package/screenshots/truth/textinput/input.png +0 -0
- package/screenshots/truth/textinput/textarea-focused.png +0 -0
- package/screenshots/truth/textinput/textarea.png +0 -0
- package/src/events.ts +4 -2
- package/src/flow/Editor.ts +6 -3
- package/src/flow/actions/set_contact_channel.ts +1 -1
- package/src/flow/actions/set_contact_field.ts +1 -1
- package/src/flow/actions/set_contact_language.ts +1 -1
- package/src/flow/actions/set_contact_status.ts +1 -1
- package/src/flow/config.ts +2 -8
- package/src/flow/nodes/split_by_llm.ts +119 -0
- package/src/flow/nodes/split_by_llm_categorize.ts +13 -116
- package/src/flow/nodes/split_by_subflow.ts +153 -3
- package/src/flow/nodes/split_by_ticket.ts +135 -12
- package/src/flow/nodes/split_by_webhook.ts +187 -12
- package/src/live/ContactChat.ts +56 -58
- package/src/store/flow-definition.d.ts +2 -1
- package/src/utils.ts +192 -0
- package/test/nodes/split_by_llm.test.ts +232 -0
- package/test-assets/style.css +36 -234
- package/web-dev-server.config.mjs +26 -0
- package/web-test-runner.config.mjs +1 -1
- package/out-tsc/src/flow/actions/call_llm.js +0 -64
- package/out-tsc/src/flow/actions/call_llm.js.map +0 -1
- package/out-tsc/src/flow/actions/call_webhook.js +0 -131
- package/out-tsc/src/flow/actions/call_webhook.js.map +0 -1
- package/out-tsc/src/flow/actions/enter_flow.js +0 -14
- package/out-tsc/src/flow/actions/enter_flow.js.map +0 -1
- package/out-tsc/src/flow/actions/open_ticket.js +0 -73
- package/out-tsc/src/flow/actions/open_ticket.js.map +0 -1
- package/out-tsc/test/actions/call_llm.test.js +0 -103
- package/out-tsc/test/actions/call_llm.test.js.map +0 -1
- package/src/flow/actions/call_llm.ts +0 -66
- package/src/flow/actions/call_webhook.ts +0 -143
- package/src/flow/actions/enter_flow.ts +0 -15
- package/src/flow/actions/open_ticket.ts +0 -83
- package/test/actions/call_llm.test.ts +0 -137
package/test-assets/style.css
CHANGED
|
@@ -1,236 +1,3 @@
|
|
|
1
|
-
#mocha {
|
|
2
|
-
display: none;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
temba-dialog,
|
|
6
|
-
temba-modax,
|
|
7
|
-
temba-contact-history,
|
|
8
|
-
temba-menu,
|
|
9
|
-
temba-select {
|
|
10
|
-
--transition-speed: 0ms !important;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
body {
|
|
14
|
-
padding: 20px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
html input {
|
|
18
|
-
|
|
19
|
-
caret-color: transparent;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
temba-input,
|
|
23
|
-
temba-modax,
|
|
24
|
-
temba-dialog {
|
|
25
|
-
caret-color: transparent;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/* Disable CSS animations for deterministic screenshots */
|
|
29
|
-
*,
|
|
30
|
-
*::before,
|
|
31
|
-
*::after {
|
|
32
|
-
animation-duration: 0s !important;
|
|
33
|
-
animation-delay: 0s !important;
|
|
34
|
-
transition-duration: 0s !important;
|
|
35
|
-
transition-delay: 0s !important;
|
|
36
|
-
animation-iteration-count: 1 !important;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/* Override CSS custom properties for animation control in tests */
|
|
40
|
-
:root {
|
|
41
|
-
--test-animation-duration: 0s !important;
|
|
42
|
-
--test-animation-play-state: paused !important;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/* Force disable spin animations by overriding keyframes - this pierces shadow DOM */
|
|
46
|
-
@keyframes spin {
|
|
47
|
-
from { transform: rotate(0deg); }
|
|
48
|
-
to { transform: rotate(0deg); }
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
html {
|
|
52
|
-
--transition-speed: 0ms !important;
|
|
53
|
-
--input-caret: transparent !important;
|
|
54
|
-
--font-family: 'Roboto';
|
|
55
|
-
--primary-rgb: 35, 135, 202;
|
|
56
|
-
--secondary-rgb: 140, 51, 140;
|
|
57
|
-
--tertiary-rgb: 135, 202, 35;
|
|
58
|
-
|
|
59
|
-
--focus-rgb: 82, 168, 236;
|
|
60
|
-
--error-rgb: 255, 99, 71;
|
|
61
|
-
--success-rgb: 102, 186, 104;
|
|
62
|
-
|
|
63
|
-
--color-label: #333;
|
|
64
|
-
|
|
65
|
-
--selection-light-rgb: 240, 240, 240;
|
|
66
|
-
--selection-dark-rgb: 180, 180, 180;
|
|
67
|
-
|
|
68
|
-
--select-input-height: inherit;
|
|
69
|
-
|
|
70
|
-
--curvature: 6px;
|
|
71
|
-
--curvature-widget: 6px;
|
|
72
|
-
--color-focus: #a4cafe;
|
|
73
|
-
--color-widget-bg: #fff;
|
|
74
|
-
--color-widget-bg-focused: #fff;
|
|
75
|
-
--color-widget-border: rgb(225, 225, 225);
|
|
76
|
-
|
|
77
|
-
/* primary colors, should be dark */
|
|
78
|
-
--color-selection: #f0f6ff;
|
|
79
|
-
|
|
80
|
-
--widget-box-shadow-focused: 0 0 0 3px rgba(164, 202, 254, .45);
|
|
81
|
-
--widget-box-shadow-focused-error: 0 0 0 3px rgba(var(--error-rgb), 0.3);
|
|
82
|
-
|
|
83
|
-
--shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
|
84
|
-
|
|
85
|
-
/* page text, borders, widgets */
|
|
86
|
-
--color-text: #555;
|
|
87
|
-
--color-widget-text: #555;
|
|
88
|
-
--color-borders: rgba(0, 0, 0, 0.07);
|
|
89
|
-
--color-placeholder: #ccc;
|
|
90
|
-
|
|
91
|
-
/* light colors, panel backgrounds, selection, etc */
|
|
92
|
-
--color-primary-light: #eee;
|
|
93
|
-
--color-secondary-light: #ccc;
|
|
94
|
-
|
|
95
|
-
/* dark colors, nav bar, buttons, etc */
|
|
96
|
-
--color-primary-dark: rgb(var(--primary-rgb));
|
|
97
|
-
--color-secondary-dark: rgb(var(--secondary-rgb));
|
|
98
|
-
|
|
99
|
-
/* light text goes over dark, dark over lights */
|
|
100
|
-
--color-text-light: rgba(255, 255, 255, 1);
|
|
101
|
-
--color-text-dark: rgba(0, 0, 0, 0.5);
|
|
102
|
-
--color-text-dark-secondary: rgba(0, 0, 0, 0.25);
|
|
103
|
-
--color-text-help: rgba(0, 0, 0, 0.35);
|
|
104
|
-
|
|
105
|
-
--color-tertiary: rgb(var(--tertiary-rgb));
|
|
106
|
-
|
|
107
|
-
/* solid overlays with text */
|
|
108
|
-
--color-overlay-dark: rgba(0, 0, 0, 0.2);
|
|
109
|
-
--color-overlay-dark-text: rgba(255, 255, 255, 0.9);
|
|
110
|
-
--color-overlay-light: rgba(0, 0, 0, 0.05);
|
|
111
|
-
--color-overlay-light-text: rgba(0, 0, 0, 0.6);
|
|
112
|
-
|
|
113
|
-
/* links, buttons, and label badges */
|
|
114
|
-
--color-link-primary: rgba(var(--primary-rgb), 0.8);
|
|
115
|
-
--color-link-primary-hover: rgba(var(--primary-rgb), 0.9);
|
|
116
|
-
--color-link-secondary: rgba(var(--secondary-rgb), 0.8);
|
|
117
|
-
--color-link-secondary-hover: rgba(var(--secondary-rgb), 0.9);
|
|
118
|
-
--color-button-primary: var(--color-primary-dark);
|
|
119
|
-
--color-button-primary-text: var(--color-text-light);
|
|
120
|
-
--color-button-light: rgb(246, 248, 250);
|
|
121
|
-
--color-button-light-text: rgb(36, 41, 47);
|
|
122
|
-
--color-button-secondary: var(--color-secondary-light);
|
|
123
|
-
--color-button-secondary-text: var(--color-text-dark);
|
|
124
|
-
|
|
125
|
-
--color-button-destructive: rgb(var(--error-rgb));
|
|
126
|
-
--color-button-destructive-text: var(--color-text-light);
|
|
127
|
-
|
|
128
|
-
--color-button-attention: #2ecc71;
|
|
129
|
-
|
|
130
|
-
--color-label-primary: var(--color-primary-dark);
|
|
131
|
-
--color-label-primary-text: var(--color-text-light);
|
|
132
|
-
--color-label-secondary: rgba(0, 0, 0, 0.2);
|
|
133
|
-
--color-label-secondary-text: rgba(255, 255, 255, 0.9);
|
|
134
|
-
|
|
135
|
-
--color-nav-unselected: #fff;
|
|
136
|
-
--color-nav-selected-bg: #fff;
|
|
137
|
-
--color-nav-selected-text: var(--color-primary-dark);
|
|
138
|
-
--color-info: rgb(238, 246, 255);
|
|
139
|
-
--color-info-border: rgb(74, 163, 223);
|
|
140
|
-
|
|
141
|
-
--color-warning: rgb(255, 253, 218);
|
|
142
|
-
--color-warning-border: rgb(251, 246, 176);
|
|
143
|
-
--color-error: rgb(var(--error-rgb));
|
|
144
|
-
--font-size: 14px;
|
|
145
|
-
--button-font-size: 1.125rem;
|
|
146
|
-
|
|
147
|
-
--header-bg: var(--color-primary-dark);
|
|
148
|
-
--header-text: var(--color-text-light);
|
|
149
|
-
|
|
150
|
-
--temba-textinput-padding: 9px;
|
|
151
|
-
--temba-textinput-font-size: 13px;
|
|
152
|
-
|
|
153
|
-
--options-block-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
|
|
154
|
-
--options-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
155
|
-
|
|
156
|
-
font-size: var(--font-size);
|
|
157
|
-
font-weight: 400;
|
|
158
|
-
font-family: var(--font-family);
|
|
159
|
-
--dropdown-shadow: rgb(0 0 0 / 30%) 0px 0px 60px, rgb(0 0 0 / 12%) 0px 6px 12px;
|
|
160
|
-
|
|
161
|
-
--icon-color: var(--text-color);
|
|
162
|
-
--icon-color-hover: var(--icon-color);
|
|
163
|
-
--event-padding: 0.5em 1em;
|
|
164
|
-
--temba-select-selected-padding: 9px;
|
|
165
|
-
--temba-select-selected-line-height: 16px;
|
|
166
|
-
--temba-select-selected-font-size: 13px;
|
|
167
|
-
|
|
168
|
-
--help-text-margin-top: 0px;
|
|
169
|
-
--help-text-margin-left: 0.3em;
|
|
170
|
-
--help-text-size: 0.85em;
|
|
171
|
-
--color-text-help: rgb(120, 120, 120);
|
|
172
|
-
--label-size: 14px;
|
|
173
|
-
|
|
174
|
-
--button-y: 6px;
|
|
175
|
-
--button-x: 14px;
|
|
176
|
-
|
|
177
|
-
--menu-padding: 1em;
|
|
178
|
-
--color-automated: rgb(78, 205, 106);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
temba-button {
|
|
182
|
-
--button-bg: var(--color-primary-dark);
|
|
183
|
-
--button-text: var(--color-text-light);
|
|
184
|
-
--button-border: none;
|
|
185
|
-
--button-shadow: var(--widget-box-shadow);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
temba-button:hover {
|
|
189
|
-
--button-bg-img: linear-gradient(to bottom, rgba(var(--primary-rgb), .1), transparent, transparent);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
temba-button.active {
|
|
193
|
-
--button-bg-img: linear-gradient(to bottom, transparent, rgba(0, 0, 0, .05));
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
temba-button.light {
|
|
197
|
-
--button-bg: #fff;
|
|
198
|
-
--button-text: #999;
|
|
199
|
-
--button-border: none;
|
|
200
|
-
--button-shadow: var(--widget-box-shadow);
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
temba-button.light:hover {
|
|
205
|
-
--button-bg-img: linear-gradient(to bottom, transparent, rgba(0, 0, 0, .001));
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
temba-button.light.active {
|
|
209
|
-
--button-bg-img: linear-gradient(to bottom, transparent, rgba(0, 0, 0, .02));
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
temba-contact-history {
|
|
213
|
-
min-height: 0;
|
|
214
|
-
display: flex;
|
|
215
|
-
flex-grow: 1;
|
|
216
|
-
flex-direction: column;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
temba-select:focus {
|
|
220
|
-
outline: none;
|
|
221
|
-
box-shadow: none;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
temba-datepicker {
|
|
225
|
-
margin: 1em;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
.flatpickr-calendar {
|
|
229
|
-
margin-top: 28px;
|
|
230
|
-
margin-bottom: 28px;
|
|
231
|
-
margin-left: -13px;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
1
|
@font-face {
|
|
235
2
|
font-family: 'Roboto Mono';
|
|
236
3
|
font-style: normal;
|
|
@@ -288,4 +55,39 @@ temba-datepicker {
|
|
|
288
55
|
/* Chrome 26+, Opera 23+, Firefox 39+ */
|
|
289
56
|
url('./fonts/roboto-v20-latin-500.woff') format('woff');
|
|
290
57
|
/* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
|
291
|
-
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Force disable spin animations by overriding keyframes - this pierces shadow DOM */
|
|
61
|
+
@keyframes spin {
|
|
62
|
+
from { transform: rotate(0deg); }
|
|
63
|
+
to { transform: rotate(0deg); }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#mocha {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* Disable transitions and carets for deterministic screenshots */
|
|
71
|
+
*,
|
|
72
|
+
*::before,
|
|
73
|
+
*::after {
|
|
74
|
+
animation-duration: 0s !important;
|
|
75
|
+
animation-delay: 0s !important;
|
|
76
|
+
transition-duration: 0s !important;
|
|
77
|
+
transition-delay: 0s !important;
|
|
78
|
+
animation-iteration-count: 1 !important;
|
|
79
|
+
--transition-speed: 0ms !important;
|
|
80
|
+
--test-animation-duration: 0s !important;
|
|
81
|
+
--test-animation-play-state: paused !important;
|
|
82
|
+
caret-color: transparent;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
Without this body styling our screenshots don't have the proper dpi,
|
|
87
|
+
perhaps triggers a different rendering path for puppeteer? The styling
|
|
88
|
+
appears like it could be anything.
|
|
89
|
+
Unsure.
|
|
90
|
+
**/
|
|
91
|
+
body {
|
|
92
|
+
padding: 20px;
|
|
93
|
+
}
|
|
@@ -56,6 +56,32 @@ export default {
|
|
|
56
56
|
context.body = fs.readFileSync(path.resolve(staticFile), 'utf-8');
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
// Handle dynamic flows endpoint
|
|
61
|
+
if (basePath === '/api/v2/flows.json') {
|
|
62
|
+
const flowsDir = path.resolve('./demo/data/flows');
|
|
63
|
+
|
|
64
|
+
if (fs.existsSync(flowsDir)) {
|
|
65
|
+
const files = fs.readdirSync(flowsDir).filter(file => file.endsWith('.json'));
|
|
66
|
+
const flows = files.map(file => {
|
|
67
|
+
try {
|
|
68
|
+
const filePath = path.join(flowsDir, file);
|
|
69
|
+
const flowData = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
|
70
|
+
return {
|
|
71
|
+
uuid: flowData.definition.uuid,
|
|
72
|
+
name: flowData.definition.name
|
|
73
|
+
};
|
|
74
|
+
} catch (e) {
|
|
75
|
+
console.warn(`Error reading flow file ${file}:`, e.message);
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}).filter(Boolean);
|
|
79
|
+
|
|
80
|
+
context.contentType = 'application/json';
|
|
81
|
+
context.body = JSON.stringify({ results: flows });
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
59
85
|
}
|
|
60
86
|
|
|
61
87
|
// Handle minio file uploads for media
|
|
@@ -329,7 +329,7 @@ export default {
|
|
|
329
329
|
return {
|
|
330
330
|
body: context.body.replace(
|
|
331
331
|
/<head>/,
|
|
332
|
-
`<head><link rel="stylesheet" href="/test-assets/style.css"
|
|
332
|
+
`<head><link rel="stylesheet" href="/test-assets/temba-components.css"/><link rel="stylesheet" href="/test-assets/style.css"/>`
|
|
333
333
|
),
|
|
334
334
|
};
|
|
335
335
|
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-html';
|
|
2
|
-
import { COLORS } from '../types';
|
|
3
|
-
export const call_llm = {
|
|
4
|
-
name: 'Call AI',
|
|
5
|
-
color: COLORS.call,
|
|
6
|
-
render: (_node, action) => {
|
|
7
|
-
return html `<div
|
|
8
|
-
style="word-wrap: break-word; overflow-wrap: break-word; hyphens: auto; max-width: 180px; max-height: 100px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;"
|
|
9
|
-
>
|
|
10
|
-
${action.instructions}
|
|
11
|
-
</div>`;
|
|
12
|
-
},
|
|
13
|
-
form: {
|
|
14
|
-
llm: {
|
|
15
|
-
type: 'select',
|
|
16
|
-
required: true,
|
|
17
|
-
options: [],
|
|
18
|
-
endpoint: '/test-assets/select/llms.json',
|
|
19
|
-
searchable: true,
|
|
20
|
-
valueKey: 'uuid',
|
|
21
|
-
nameKey: 'name'
|
|
22
|
-
},
|
|
23
|
-
input: {
|
|
24
|
-
type: 'text',
|
|
25
|
-
required: true,
|
|
26
|
-
label: 'The input the AI will process',
|
|
27
|
-
evaluated: true,
|
|
28
|
-
placeholder: '@input'
|
|
29
|
-
},
|
|
30
|
-
instructions: {
|
|
31
|
-
type: 'textarea',
|
|
32
|
-
required: true,
|
|
33
|
-
label: 'Tell the AI what to do with the input',
|
|
34
|
-
evaluated: true,
|
|
35
|
-
placeholder: 'Enter instructions for the AI model...',
|
|
36
|
-
minHeight: 130,
|
|
37
|
-
helpText: 'The result can be referenced as **`@locals._llm_output`**'
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
layout: ['llm', 'input', 'instructions'],
|
|
41
|
-
toFormData: (action) => {
|
|
42
|
-
return {
|
|
43
|
-
uuid: action.uuid,
|
|
44
|
-
llm: action.llm
|
|
45
|
-
? [{ value: action.llm.uuid, name: action.llm.name }]
|
|
46
|
-
: [],
|
|
47
|
-
input: action.input || '@input',
|
|
48
|
-
instructions: action.instructions || ''
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
fromFormData: (data) => {
|
|
52
|
-
const llmSelection = Array.isArray(data.llm) && data.llm.length > 0 ? data.llm[0] : null;
|
|
53
|
-
return {
|
|
54
|
-
uuid: data.uuid,
|
|
55
|
-
type: 'call_llm',
|
|
56
|
-
input: data.input || '@input',
|
|
57
|
-
llm: llmSelection
|
|
58
|
-
? { uuid: llmSelection.value, name: llmSelection.name }
|
|
59
|
-
: { uuid: '', name: '' },
|
|
60
|
-
instructions: data.instructions || ''
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=call_llm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"call_llm.js","sourceRoot":"","sources":["../../../../src/flow/actions/call_llm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,CAAC,MAAM,QAAQ,GAAiB;IACpC,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,MAAM,CAAC,IAAI;IAClB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAe,EAAE,EAAE;QACvC,OAAO,IAAI,CAAA;;;QAGP,MAAM,CAAC,YAAY;WAChB,CAAC;IACV,CAAC;IACD,IAAI,EAAE;QACJ,GAAG,EAAE;YACH,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,+BAA+B;YAC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AAC,KAAK,IAAI,QAAQ;YAC7B,GAAG,EAAE,YAAY;gBACf,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE;gBACvD,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAC1B,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,EAAE;SAC3B,CAAC;IACf,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, CallLLM } from '../../store/flow-definition';\n\nexport const call_llm: ActionConfig = {\n name: 'Call AI',\n color: COLORS.call,\n render: (_node: Node, action: CallLLM) => {\n return html`<div\n style=\"word-wrap: break-word; overflow-wrap: break-word; hyphens: auto; max-width: 180px; max-height: 100px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;\"\n >\n ${action.instructions}\n </div>`;\n },\n form: {\n llm: {\n type: 'select',\n required: true,\n options: [],\n endpoint: '/test-assets/select/llms.json',\n searchable: true,\n valueKey: 'uuid',\n nameKey: 'name'\n },\n input: {\n type: 'text',\n required: true,\n label: 'The input the AI will process',\n evaluated: true,\n placeholder: '@input'\n },\n instructions: {\n type: 'textarea',\n required: true,\n label: 'Tell the AI what to do with the input',\n evaluated: true,\n placeholder: 'Enter instructions for the AI model...',\n minHeight: 130,\n helpText: 'The result can be referenced as **`@locals._llm_output`**'\n }\n },\n layout: ['llm', 'input', 'instructions'],\n toFormData: (action: CallLLM) => {\n return {\n uuid: action.uuid,\n llm: action.llm\n ? [{ value: action.llm.uuid, name: action.llm.name }]\n : [],\n input: action.input || '@input',\n instructions: action.instructions || ''\n };\n },\n fromFormData: (data: Record<string, any>) => {\n const llmSelection =\n Array.isArray(data.llm) && data.llm.length > 0 ? data.llm[0] : null;\n return {\n uuid: data.uuid,\n type: 'call_llm',\n input: data.input || '@input',\n llm: llmSelection\n ? { uuid: llmSelection.value, name: llmSelection.name }\n : { uuid: '', name: '' },\n instructions: data.instructions || ''\n } as CallLLM;\n }\n};\n"]}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-html';
|
|
2
|
-
import { COLORS } from '../types';
|
|
3
|
-
const defaultPost = `@(json(object(
|
|
4
|
-
"contact", object(
|
|
5
|
-
"uuid", contact.uuid,
|
|
6
|
-
"name", contact.name,
|
|
7
|
-
"urn", contact.urn
|
|
8
|
-
),
|
|
9
|
-
"flow", object(
|
|
10
|
-
"uuid", run.flow.uuid,
|
|
11
|
-
"name", run.flow.name
|
|
12
|
-
),
|
|
13
|
-
"results", foreach_value(results, extract_object, "value", "category")
|
|
14
|
-
)))`;
|
|
15
|
-
export const call_webhook = {
|
|
16
|
-
name: 'Call Webhook',
|
|
17
|
-
color: COLORS.call,
|
|
18
|
-
render: (_node, action) => {
|
|
19
|
-
return html `<div
|
|
20
|
-
style="word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;"
|
|
21
|
-
>
|
|
22
|
-
${action.url}
|
|
23
|
-
</div>`;
|
|
24
|
-
},
|
|
25
|
-
evaluated: ['url', 'headers', 'body'], // keep for backward compatibility
|
|
26
|
-
form: {
|
|
27
|
-
method: {
|
|
28
|
-
type: 'select',
|
|
29
|
-
required: true,
|
|
30
|
-
options: ['GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'PATCH'],
|
|
31
|
-
maxWidth: '120px',
|
|
32
|
-
searchable: false
|
|
33
|
-
},
|
|
34
|
-
url: {
|
|
35
|
-
type: 'text',
|
|
36
|
-
required: true,
|
|
37
|
-
evaluated: true,
|
|
38
|
-
placeholder: 'https://example.com/webhook'
|
|
39
|
-
},
|
|
40
|
-
headers: {
|
|
41
|
-
type: 'key-value',
|
|
42
|
-
sortable: true,
|
|
43
|
-
keyPlaceholder: 'Header name',
|
|
44
|
-
valuePlaceholder: 'Header value',
|
|
45
|
-
minRows: 0
|
|
46
|
-
},
|
|
47
|
-
body: {
|
|
48
|
-
type: 'textarea',
|
|
49
|
-
evaluated: true,
|
|
50
|
-
placeholder: 'Request body content (JSON, XML, etc.)',
|
|
51
|
-
minHeight: 200,
|
|
52
|
-
dependsOn: ['method'],
|
|
53
|
-
computeValue: (values, currentValue, originalValues) => {
|
|
54
|
-
// Check if method is POST (handle both string and select object formats)
|
|
55
|
-
const method = Array.isArray(values.method) && values.method.length > 0
|
|
56
|
-
? values.method[0].value || values.method[0].name
|
|
57
|
-
: values.method;
|
|
58
|
-
if (method === 'POST') {
|
|
59
|
-
// For POST, provide the template if body is empty or was never set by user
|
|
60
|
-
if (!currentValue || currentValue.trim() === '') {
|
|
61
|
-
return defaultPost;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
// For non-POST methods, clear the body if it was auto-generated or empty
|
|
66
|
-
// Check if the original body was empty (user never specified a body)
|
|
67
|
-
const originalBody = (originalValues === null || originalValues === void 0 ? void 0 : originalValues.body) || '';
|
|
68
|
-
const isOriginallyEmpty = !originalBody || originalBody.trim() === '';
|
|
69
|
-
// Clear if: originally empty, contains default template, or is currently empty
|
|
70
|
-
if (isOriginallyEmpty ||
|
|
71
|
-
!currentValue ||
|
|
72
|
-
currentValue.trim() === '' ||
|
|
73
|
-
currentValue.trim() === defaultPost.trim()) {
|
|
74
|
-
return '';
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return currentValue; // Keep existing value if user has customized it
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
layout: [
|
|
82
|
-
// Row with method and URL side by side
|
|
83
|
-
{ type: 'row', items: ['method', 'url'] },
|
|
84
|
-
// Advanced group with nested layouts
|
|
85
|
-
{
|
|
86
|
-
type: 'group',
|
|
87
|
-
label: 'Headers',
|
|
88
|
-
items: ['headers'],
|
|
89
|
-
collapsible: true,
|
|
90
|
-
collapsed: true,
|
|
91
|
-
helpText: 'Configure authentication or custom headers',
|
|
92
|
-
getGroupValueCount: (formData) => {
|
|
93
|
-
var _a;
|
|
94
|
-
return ((_a = formData.headers) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
type: 'group',
|
|
99
|
-
label: 'Body',
|
|
100
|
-
items: ['body'],
|
|
101
|
-
collapsible: true,
|
|
102
|
-
collapsed: true,
|
|
103
|
-
helpText: 'Configure the request payload',
|
|
104
|
-
getGroupValueCount: (formData) => {
|
|
105
|
-
return !!(formData.body &&
|
|
106
|
-
formData.body.trim() !== '' &&
|
|
107
|
-
formData.body !== defaultPost);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
],
|
|
111
|
-
toFormData: (action) => {
|
|
112
|
-
return {
|
|
113
|
-
uuid: action.uuid,
|
|
114
|
-
url: action.url || '',
|
|
115
|
-
method: [{ value: action.method, name: action.method }],
|
|
116
|
-
headers: action.headers || [],
|
|
117
|
-
body: action.body || ''
|
|
118
|
-
};
|
|
119
|
-
},
|
|
120
|
-
fromFormData: (data) => {
|
|
121
|
-
return {
|
|
122
|
-
uuid: data.uuid,
|
|
123
|
-
type: 'call_webhook',
|
|
124
|
-
url: data.url,
|
|
125
|
-
method: data.method[0].value,
|
|
126
|
-
headers: data.headers || [],
|
|
127
|
-
body: data.body || ''
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
//# sourceMappingURL=call_webhook.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"call_webhook.js","sourceRoot":"","sources":["../../../../src/flow/actions/call_webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,WAAW,GAAG;;;;;;;;;;;IAWhB,CAAC;AAEL,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,IAAI,EAAE,cAAc;IACp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AM,CAAC;YACf,WAAW,EAAE,IAAI;YACjB,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,+BAA+B;YACzC,kBAAkB,EAAE,CAAC,QAAa,EAAE,EAAE;gBACpC,OAAO,CAAC,CAAC,CACP,QAAQ,CAAC,IAAI;oBACb,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;oBAC3B,QAAQ,CAAC,IAAI,KAAK,WAAW,CAC9B,CAAC;YACJ,CAAC;SACF;KACF;IACD,UAAU,EAAE,CAAC,MAAmB,EAAE,EAAE;QAClC,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,EAAE;YACrB,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;YACvD,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE;YAC7B,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;SACxB,CAAC;IACJ,CAAC;IACD,YAAY,EAAE,CAAC,IAAyB,EAAE,EAAE;QAC1C,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,cAAc;YACpB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK;YAC5B,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE;YAC3B,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE;SACP,CAAC;IACnB,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, CallWebhook } from '../../store/flow-definition';\n\nconst defaultPost = `@(json(object(\n \"contact\", object(\n \"uuid\", contact.uuid, \n \"name\", contact.name, \n \"urn\", contact.urn\n ),\n \"flow\", object(\n \"uuid\", run.flow.uuid, \n \"name\", run.flow.name\n ),\n \"results\", foreach_value(results, extract_object, \"value\", \"category\")\n)))`;\n\nexport const call_webhook: ActionConfig = {\n name: 'Call Webhook',\n color: COLORS.call,\n render: (_node: Node, action: CallWebhook) => {\n return html`<div\n style=\"word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;\"\n >\n ${action.url}\n </div>`;\n },\n evaluated: ['url', 'headers', 'body'], // keep for backward compatibility\n form: {\n method: {\n type: 'select',\n required: true,\n options: ['GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'PATCH'],\n maxWidth: '120px',\n searchable: false\n },\n url: {\n type: 'text',\n required: true,\n evaluated: true,\n placeholder: 'https://example.com/webhook'\n },\n headers: {\n type: 'key-value',\n sortable: true,\n keyPlaceholder: 'Header name',\n valuePlaceholder: 'Header value',\n minRows: 0\n },\n body: {\n type: 'textarea',\n evaluated: true,\n placeholder: 'Request body content (JSON, XML, etc.)',\n minHeight: 200,\n dependsOn: ['method'],\n computeValue: (\n values: Record<string, any>,\n currentValue: any,\n originalValues?: Record<string, any>\n ) => {\n // Check if method is POST (handle both string and select object formats)\n const method =\n Array.isArray(values.method) && values.method.length > 0\n ? values.method[0].value || values.method[0].name\n : values.method;\n\n if (method === 'POST') {\n // For POST, provide the template if body is empty or was never set by user\n if (!currentValue || currentValue.trim() === '') {\n return defaultPost;\n }\n } else {\n // For non-POST methods, clear the body if it was auto-generated or empty\n // Check if the original body was empty (user never specified a body)\n const originalBody = originalValues?.body || '';\n const isOriginallyEmpty = !originalBody || originalBody.trim() === '';\n\n // Clear if: originally empty, contains default template, or is currently empty\n if (\n isOriginallyEmpty ||\n !currentValue ||\n currentValue.trim() === '' ||\n currentValue.trim() === defaultPost.trim()\n ) {\n return '';\n }\n }\n\n return currentValue; // Keep existing value if user has customized it\n }\n }\n },\n layout: [\n // Row with method and URL side by side\n { type: 'row', items: ['method', 'url'] },\n // Advanced group with nested layouts\n {\n type: 'group',\n label: 'Headers',\n items: ['headers'],\n collapsible: true,\n collapsed: true,\n helpText: 'Configure authentication or custom headers',\n getGroupValueCount: (formData: any) => {\n return formData.headers?.length || 0;\n }\n },\n {\n type: 'group',\n label: 'Body',\n items: ['body'],\n collapsible: true,\n collapsed: true,\n helpText: 'Configure the request payload',\n getGroupValueCount: (formData: any) => {\n return !!(\n formData.body &&\n formData.body.trim() !== '' &&\n formData.body !== defaultPost\n );\n }\n }\n ],\n toFormData: (action: CallWebhook) => {\n return {\n uuid: action.uuid,\n url: action.url || '',\n method: [{ value: action.method, name: action.method }],\n headers: action.headers || [],\n body: action.body || ''\n };\n },\n fromFormData: (data: Record<string, any>) => {\n return {\n uuid: data.uuid,\n type: 'call_webhook',\n url: data.url,\n method: data.method[0].value,\n headers: data.headers || [],\n body: data.body || ''\n } as CallWebhook;\n }\n};\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-html';
|
|
2
|
-
import { COLORS } from '../types';
|
|
3
|
-
export const enter_flow = {
|
|
4
|
-
name: 'Enter a Flow',
|
|
5
|
-
color: COLORS.execute,
|
|
6
|
-
render: (_node, action) => {
|
|
7
|
-
return html `<div
|
|
8
|
-
style="word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;"
|
|
9
|
-
>
|
|
10
|
-
Enter <b>${action.flow.name}</b>
|
|
11
|
-
</div>`;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=enter_flow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enter_flow.js","sourceRoot":"","sources":["../../../../src/flow/actions/enter_flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,CAAC,MAAM,UAAU,GAAiB;IACtC,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,MAAM,CAAC,OAAO;IACrB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAiB,EAAE,EAAE;QACzC,OAAO,IAAI,CAAA;;;iBAGE,MAAM,CAAC,IAAI,CAAC,IAAI;WACtB,CAAC;IACV,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, EnterFlow } from '../../store/flow-definition';\n\nexport const enter_flow: ActionConfig = {\n name: 'Enter a Flow',\n color: COLORS.execute,\n render: (_node: Node, action: EnterFlow) => {\n return html`<div\n style=\"word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;\"\n >\n Enter <b>${action.flow.name}</b>\n </div>`;\n }\n};\n"]}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-html';
|
|
2
|
-
import { COLORS } from '../types';
|
|
3
|
-
export const open_ticket = {
|
|
4
|
-
name: 'Open Ticket',
|
|
5
|
-
color: COLORS.create,
|
|
6
|
-
render: (_node, action) => {
|
|
7
|
-
return html `<div>${action.topic.name}</div>`;
|
|
8
|
-
},
|
|
9
|
-
form: {
|
|
10
|
-
topic: {
|
|
11
|
-
type: 'select',
|
|
12
|
-
required: true,
|
|
13
|
-
placeholder: 'Select a topic',
|
|
14
|
-
options: [],
|
|
15
|
-
endpoint: '/api/v2/topics.json',
|
|
16
|
-
valueKey: 'uuid',
|
|
17
|
-
nameKey: 'name',
|
|
18
|
-
maxWidth: '200px'
|
|
19
|
-
},
|
|
20
|
-
assignee: {
|
|
21
|
-
type: 'select',
|
|
22
|
-
required: false,
|
|
23
|
-
placeholder: 'Select an agent (optional)',
|
|
24
|
-
options: [],
|
|
25
|
-
endpoint: '/api/v2/users.json',
|
|
26
|
-
valueKey: 'uuid',
|
|
27
|
-
getName: (item) => {
|
|
28
|
-
return item.name || [item.first_name, item.last_name].join(' ');
|
|
29
|
-
},
|
|
30
|
-
clearable: true
|
|
31
|
-
},
|
|
32
|
-
note: {
|
|
33
|
-
type: 'textarea',
|
|
34
|
-
required: false,
|
|
35
|
-
placeholder: 'Enter a note for the ticket (optional)',
|
|
36
|
-
minHeight: 100
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
layout: [{ type: 'row', items: ['topic', 'assignee'] }, 'note'],
|
|
40
|
-
toFormData: (action) => {
|
|
41
|
-
return {
|
|
42
|
-
uuid: action.uuid,
|
|
43
|
-
topic: action.topic
|
|
44
|
-
? [{ uuid: action.topic.uuid, name: action.topic.name }]
|
|
45
|
-
: [],
|
|
46
|
-
assignee: action.assignee
|
|
47
|
-
? [{ uuid: action.assignee.uuid, name: action.assignee.name }]
|
|
48
|
-
: [],
|
|
49
|
-
note: action.note || ''
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
fromFormData: (data) => {
|
|
53
|
-
return {
|
|
54
|
-
uuid: data.uuid,
|
|
55
|
-
type: 'open_ticket',
|
|
56
|
-
topic: data.topic && data.topic.length > 0
|
|
57
|
-
? {
|
|
58
|
-
uuid: data.topic[0].uuid,
|
|
59
|
-
name: data.topic[0].name
|
|
60
|
-
}
|
|
61
|
-
: undefined,
|
|
62
|
-
assignee: data.assignee && data.assignee.length > 0
|
|
63
|
-
? {
|
|
64
|
-
uuid: data.assignee[0].uuid,
|
|
65
|
-
name: data.assignee[0].name ||
|
|
66
|
-
[data.assignee[0].first_name, data.assignee[0].last_name].join(' ')
|
|
67
|
-
}
|
|
68
|
-
: undefined,
|
|
69
|
-
note: data.note || ''
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
//# sourceMappingURL=open_ticket.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"open_ticket.js","sourceRoot":"","sources":["../../../../src/flow/actions/open_ticket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,MAAM,CAAC,M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":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, OpenTicket } from '../../store/flow-definition';\n\nexport const open_ticket: ActionConfig = {\n name: 'Open Ticket',\n color: COLORS.create,\n render: (_node: Node, action: OpenTicket) => {\n return html`<div>${action.topic.name}</div>`;\n },\n form: {\n topic: {\n type: 'select',\n required: true,\n placeholder: 'Select a topic',\n options: [],\n endpoint: '/api/v2/topics.json',\n valueKey: 'uuid',\n nameKey: 'name',\n maxWidth: '200px'\n },\n assignee: {\n type: 'select',\n required: false,\n placeholder: 'Select an agent (optional)',\n options: [],\n endpoint: '/api/v2/users.json',\n valueKey: 'uuid',\n getName: (item: {\n first_name?: string;\n last_name?: string;\n name?: string;\n }) => {\n return item.name || [item.first_name, item.last_name].join(' ');\n },\n clearable: true\n },\n note: {\n type: 'textarea',\n required: false,\n placeholder: 'Enter a note for the ticket (optional)',\n minHeight: 100\n }\n },\n layout: [{ type: 'row', items: ['topic', 'assignee'] }, 'note'],\n toFormData: (action: OpenTicket) => {\n return {\n uuid: action.uuid,\n topic: action.topic\n ? [{ uuid: action.topic.uuid, name: action.topic.name }]\n : [],\n assignee: action.assignee\n ? [{ uuid: action.assignee.uuid, name: action.assignee.name }]\n : [],\n note: action.note || ''\n };\n },\n fromFormData: (data: Record<string, any>) => {\n return {\n uuid: data.uuid,\n type: 'open_ticket',\n topic:\n data.topic && data.topic.length > 0\n ? {\n uuid: data.topic[0].uuid,\n name: data.topic[0].name\n }\n : undefined,\n assignee:\n data.assignee && data.assignee.length > 0\n ? {\n uuid: data.assignee[0].uuid,\n name:\n data.assignee[0].name ||\n [data.assignee[0].first_name, data.assignee[0].last_name].join(\n ' '\n )\n }\n : undefined,\n note: data.note || ''\n } as OpenTicket;\n }\n};\n"]}
|