@nyaruka/temba-components 0.130.1 → 0.130.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 +34 -4
- package/DEV_DATA.md +89 -0
- package/demo/data/flows/food-order.json +4 -4
- package/demo/data/flows/sample-flow.json +132 -147
- package/dist/temba-components.js +787 -659
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/display/Chat.js +5 -3
- package/out-tsc/src/display/Chat.js.map +1 -1
- package/out-tsc/src/events.js.map +1 -1
- package/out-tsc/src/flow/CanvasNode.js +83 -78
- package/out-tsc/src/flow/CanvasNode.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +1 -0
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/NodeEditor.js +47 -3
- package/out-tsc/src/flow/NodeEditor.js.map +1 -1
- package/out-tsc/src/flow/actions/add_contact_urn.js +1 -1
- package/out-tsc/src/flow/actions/add_contact_urn.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 +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 +3 -1
- package/out-tsc/src/flow/actions/set_contact_language.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_name.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_name.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_status.js +17 -14
- package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
- package/out-tsc/src/flow/actions/set_run_result.js +1 -1
- package/out-tsc/src/flow/actions/set_run_result.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_llm.js +12 -12
- package/out-tsc/src/flow/nodes/split_by_llm.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_response.js +609 -6
- package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
- package/out-tsc/src/flow/operators.js +194 -0
- package/out-tsc/src/flow/operators.js.map +1 -0
- package/out-tsc/src/flow/types.js.map +1 -1
- package/out-tsc/src/form/ArrayEditor.js +84 -19
- package/out-tsc/src/form/ArrayEditor.js.map +1 -1
- package/out-tsc/src/form/Checkbox.js +12 -0
- package/out-tsc/src/form/Checkbox.js.map +1 -1
- package/out-tsc/src/form/FieldRenderer.js +13 -3
- package/out-tsc/src/form/FieldRenderer.js.map +1 -1
- package/out-tsc/src/form/TextInput.js +20 -1
- package/out-tsc/src/form/TextInput.js.map +1 -1
- package/out-tsc/src/form/select/Select.js +7 -0
- package/out-tsc/src/form/select/Select.js.map +1 -1
- package/out-tsc/src/interfaces.js.map +1 -1
- package/out-tsc/src/layout/Dialog.js +3 -4
- package/out-tsc/src/layout/Dialog.js.map +1 -1
- package/out-tsc/src/list/RunList.js +2 -2
- package/out-tsc/src/list/RunList.js.map +1 -1
- package/out-tsc/src/live/ContactChat.js +101 -44
- package/out-tsc/src/live/ContactChat.js.map +1 -1
- package/out-tsc/src/live/ContactDetails.js +7 -0
- package/out-tsc/src/live/ContactDetails.js.map +1 -1
- package/out-tsc/src/live/ContactNameFetch.js +1 -1
- package/out-tsc/src/live/ContactNameFetch.js.map +1 -1
- package/out-tsc/src/webchat/index.js +0 -11
- package/out-tsc/src/webchat/index.js.map +1 -1
- package/out-tsc/test/NodeHelper.js +25 -27
- package/out-tsc/test/NodeHelper.js.map +1 -1
- package/out-tsc/test/nodes/split_by_llm.test.js +12 -4
- package/out-tsc/test/nodes/split_by_llm.test.js.map +1 -1
- package/out-tsc/test/nodes/split_by_llm_categorize.test.js +101 -91
- package/out-tsc/test/nodes/split_by_llm_categorize.test.js.map +1 -1
- package/out-tsc/test/nodes/split_by_random.test.js +120 -112
- package/out-tsc/test/nodes/split_by_random.test.js.map +1 -1
- package/out-tsc/test/nodes/wait_for_digits.test.js +131 -111
- package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -1
- package/out-tsc/test/nodes/wait_for_response.test.js +549 -85
- package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -1
- package/out-tsc/test/temba-checkbox.test.js +32 -32
- package/out-tsc/test/temba-checkbox.test.js.map +1 -1
- package/out-tsc/test/temba-contact-chat.test.js +2 -1
- package/out-tsc/test/temba-contact-chat.test.js.map +1 -1
- package/out-tsc/test/temba-dropdown.test.js +0 -4
- package/out-tsc/test/temba-dropdown.test.js.map +1 -1
- package/out-tsc/test/temba-flow-editor-node.test.js +9 -4
- package/out-tsc/test/temba-flow-editor-node.test.js.map +1 -1
- package/out-tsc/test/temba-integration-markdown.test.js +13 -15
- package/out-tsc/test/temba-integration-markdown.test.js.map +1 -1
- package/out-tsc/test/temba-node-editor.test.js +5 -38
- package/out-tsc/test/temba-node-editor.test.js.map +1 -1
- package/out-tsc/test/temba-run-list.test.js +2 -2
- package/out-tsc/test/temba-run-list.test.js.map +1 -1
- package/out-tsc/test/utils.test.js +2 -1
- package/out-tsc/test/utils.test.js.map +1 -1
- package/package.json +6 -2
- 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/add_contact_groups/render/descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/long-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/many-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/multiple-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/render/single-group.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/remove_contact_groups/render/cleanup-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/long-descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/many-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/multiple-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/remove-from-all-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/render/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_email/render/complex-business-email.png +0 -0
- package/screenshots/truth/actions/send_email/render/empty-body.png +0 -0
- package/screenshots/truth/actions/send_email/render/empty-subject.png +0 -0
- package/screenshots/truth/actions/send_email/render/long-subject.png +0 -0
- package/screenshots/truth/actions/send_email/render/multiline-body.png +0 -0
- package/screenshots/truth/actions/send_email/render/multiple-recipients.png +0 -0
- package/screenshots/truth/actions/send_email/render/simple-email.png +0 -0
- package/screenshots/truth/actions/send_email/render/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/actions/send_msg/render/long-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/multiline-text-with-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/simple-text.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-linebreaks.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-many-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-with-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/render/text-without-quick-replies.png +0 -0
- package/screenshots/truth/checkbox/checkbox-label-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/editor/wait.png +0 -0
- package/screenshots/truth/integration/textinput-markdown-errors.png +0 -0
- package/screenshots/truth/lightbox/img-zoomed.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_llm_categorize/render/basic-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/custom-input-and-result-name.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/feedback-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/many-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/render/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/split_by_random/render/ab-test-multiple-variants.png +0 -0
- package/screenshots/truth/nodes/split_by_random/render/sampling-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/render/three-way-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/render/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_digits/render/basic-digits-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/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/nodes/wait_for_response/render/basic-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
- package/screenshots/truth/run-list/basic.png +0 -0
- package/screenshots/truth/templates/default.png +0 -0
- package/screenshots/truth/wait-for-response/rules-editor.png +0 -0
- package/screenshots/truth/wait-for-response/timeout-editor-unchecked.png +0 -0
- package/screenshots/truth/wait-for-response/timeout-editor.png +0 -0
- package/scripts/dev-data-sync.mjs +182 -0
- package/src/display/Chat.ts +6 -4
- package/src/events.ts +6 -6
- package/src/flow/CanvasNode.ts +89 -79
- package/src/flow/Editor.ts +1 -0
- package/src/flow/NodeEditor.ts +55 -3
- package/src/flow/actions/add_contact_urn.ts +1 -1
- package/src/flow/actions/set_contact_channel.ts +1 -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 +1 -1
- package/src/flow/actions/set_contact_status.ts +18 -18
- package/src/flow/actions/set_run_result.ts +1 -1
- package/src/flow/nodes/split_by_llm.ts +14 -13
- package/src/flow/nodes/wait_for_response.ts +717 -5
- package/src/flow/operators.ts +215 -0
- package/src/flow/types.ts +10 -2
- package/src/form/ArrayEditor.ts +117 -37
- package/src/form/Checkbox.ts +12 -0
- package/src/form/FieldRenderer.ts +24 -3
- package/src/form/TextInput.ts +19 -1
- package/src/form/select/Select.ts +7 -0
- package/src/interfaces.ts +1 -1
- package/src/layout/Dialog.ts +4 -4
- package/src/list/RunList.ts +2 -2
- package/src/live/ContactChat.ts +128 -67
- package/src/live/ContactDetails.ts +7 -0
- package/src/live/ContactNameFetch.ts +1 -1
- package/src/webchat/index.ts +0 -16
- package/static/api/labels.json +6 -1
- package/test/NodeHelper.ts +38 -40
- package/test/nodes/split_by_llm.test.ts +43 -32
- package/test/nodes/split_by_llm_categorize.test.ts +130 -120
- package/test/nodes/split_by_random.test.ts +136 -128
- package/test/nodes/wait_for_digits.test.ts +147 -127
- package/test/nodes/wait_for_response.test.ts +657 -104
- package/test/temba-checkbox.test.ts +36 -32
- package/test/temba-contact-chat.test.ts +2 -1
- package/test/temba-dropdown.test.ts +0 -12
- package/test/temba-flow-editor-node.test.ts +11 -4
- package/test/temba-integration-markdown.test.ts +16 -17
- package/test/temba-node-editor.test.ts +5 -43
- package/test/temba-run-list.test.ts +2 -2
- package/test/utils.test.ts +2 -1
- package/test-assets/contacts/history.json +4 -7
- package/test-assets/list/runs.json +8 -8
- package/web-dev-mock.mjs +86 -30
- package/web-dev-server.config.mjs +272 -31
- package/screenshots/truth/dropdown/bottom-edge-collision.png +0 -0
- package/screenshots/truth/dropdown/right-edge-collision.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/integration/checkbox-markdown-errors.png +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactChat.js","sourceRoot":"","sources":["../../../src/live/ContactChat.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAoC,MAAM,KAAK,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAEL,eAAe,EAIhB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,EAER,MAAM,UAAU,CAAC;AAClB,OAAO,EA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Q,IAAkB,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,OAAO,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;IAChD,CAAC;IAED,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,OAAO,IAAI,CAAC,KAAK,CAAC;AACpB,CAAC,CAAC;AACF,MAAM,CAAC,IAAI,eAAe,GAAsB,EAAE,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-this-alias */\nimport { css, html, PropertyValueMap, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport {\n Contact,\n CustomEventType,\n NamedUser,\n Ticket,\n User\n} from '../interfaces';\nimport {\n fetchResults,\n getUrl,\n oxfordFn,\n postJSON,\n postUrl,\n WebResponse\n} from '../utils';\nimport { ContactStoreElement } from './ContactStoreElement';\nimport { Compose, ComposeValue } from '../form/Compose';\nimport {\n AirtimeTransferredEvent,\n CallEvent,\n ChannelEvent,\n ChatStartedEvent,\n ContactEvent,\n ContactGroupsEvent,\n ContactHistoryPage,\n ContactLanguageChangedEvent,\n ContactStatusChangedEvent,\n MsgEvent,\n NameChangedEvent,\n OptInEvent,\n RunEvent,\n TicketEvent,\n UpdateFieldEvent,\n URNsChangedEvent\n} from '../events';\nimport { Chat, ChatEvent, MessageType } from '../display/Chat';\nimport { getUserDisplay } from '../webchat';\nimport { DEFAULT_AVATAR } from '../webchat/assets';\nimport { UserSelect } from '../form/select/UserSelect';\nimport { Select } from '../form/select/Select';\nimport { Store } from '../store/Store';\n\n/*\nexport const SCROLL_THRESHOLD = 100;\nexport const SIMULATED_WEB_SLOWNESS = 0;\nexport const MAX_CHAT_REFRESH = 10000;\nexport const MIN_CHAT_REFRESH = 500;\nexport const BODY_SNIPPET_LENGTH = 250;\n*/\n\nexport enum Events {\n AIRTIME_TRANSFERRED = 'airtime_transferred',\n BROADCAST_CREATED = 'broadcast_created',\n CALL_CREATED = 'call_created',\n CALL_MISSED = 'call_missed',\n CALL_RECEIVED = 'call_received',\n CHAT_STARTED = 'chat_started',\n CONTACT_FIELD_CHANGED = 'contact_field_changed',\n CONTACT_GROUPS_CHANGED = 'contact_groups_changed',\n CONTACT_LANGUAGE_CHANGED = 'contact_language_changed',\n CONTACT_NAME_CHANGED = 'contact_name_changed',\n CONTACT_STATUS_CHANGED = 'contact_status_changed',\n CONTACT_URNS_CHANGED = 'contact_urns_changed',\n IVR_CREATED = 'ivr_created',\n MSG_CREATED = 'msg_created',\n MSG_RECEIVED = 'msg_received',\n NOTE_CREATED = 'note_created',\n OPTIN_REQUESTED = 'optin_requested',\n OPTIN_STARTED = 'optin_started',\n OPTIN_STOPPED = 'optin_stopped',\n RUN_ENDED = 'run_ended',\n RUN_STARTED = 'run_started',\n TICKET_ASSIGNED = 'ticket_assigned',\n TICKET_CLOSED = 'ticket_closed',\n TICKET_NOTE_ADDED = 'ticket_note_added',\n TICKET_OPENED = 'ticket_opened',\n TICKET_REOPENED = 'ticket_reopened',\n TICKET_TOPIC_CHANGED = 'ticket_topic_changed',\n\n // deprecated\n CHANNEL_EVENT = 'channel_event'\n}\n\nconst renderInfoList = (singular: string, plural: string, items: any[]) => {\n if (items.length === 1) {\n return `${singular} **${items[0].name}**`;\n } else {\n const list = items.map((item) => `**${item.name}**`);\n if (list.length === 2) {\n return `${plural} ${list.join(' and ')}`;\n } else {\n const last = list.pop();\n return `${plural} ${list.join(', ')}, and ${last}`;\n }\n }\n};\n\nconst renderChannelEvent = (event: ChannelEvent): string => {\n if (event.channel_event_type === 'welcome_message') {\n return 'Welcome message sent';\n } else if (event.event.type === 'stop_contact') {\n return 'Stopped';\n }\n};\n\nconst renderRunEvent = (event: RunEvent): string => {\n let verb = 'Started';\n if (event.type === Events.RUN_ENDED) {\n if (event.status === 'completed') {\n verb = 'Completed';\n } else if (event.status === 'expired') {\n verb = 'Expired from';\n } else {\n verb = 'Interrupted';\n }\n }\n\n return `${verb} [**${event.flow.name}**](/flow/editor/${event.flow.uuid}/)`;\n};\n\nconst renderChatStartedEvent = (event: ChatStartedEvent): string => {\n if (event.params) {\n return `Chat referral`;\n } else {\n return `Chat started`;\n }\n};\n\nconst renderUpdateEvent = (event: UpdateFieldEvent): string => {\n return event.value\n ? `Updated **${event.field.name}** to **${event.value.text}**`\n : `Cleared **${event.field.name}**`;\n};\n\nconst renderNameChanged = (event: NameChangedEvent): string => {\n return `Updated **Contact Name** to **${event.name}**`;\n};\n\nconst renderContactURNsChanged = (event: URNsChangedEvent): string => {\n return `Updated **URNs** to ${oxfordFn(\n event.urns,\n (urn: string) => `**${urn.split(':')[1].split('?')[0]}**`\n )}`;\n};\n\nexport const renderTicketAction = (\n event: TicketEvent,\n action: string\n): string => {\n if (event.created_by) {\n return `**${getUserDisplay(\n event.created_by\n )}** ${action} a **[ticket](/ticket/all/closed/${event.ticket.uuid}/)**`;\n }\n return `A **[ticket](/ticket/all/closed/${event.ticket.uuid}/)** was **${action}**`;\n};\n\nexport const renderTicketAssigned = (event: TicketEvent): string => {\n return event.assignee\n ? event.assignee.id === event.created_by.id\n ? `**${getDisplayName(event.created_by)}** took this ticket`\n : `${getDisplayName(\n event.created_by\n )} assigned this ticket to **${getDisplayName(event.assignee)}**`\n : `**${getDisplayName(event.created_by)}** unassigned this ticket`;\n};\n\nexport const renderContactGroupsEvent = (event: ContactGroupsEvent): string => {\n const groupsEvent = event as ContactGroupsEvent;\n if (groupsEvent.groups_added) {\n return renderInfoList(\n 'Added to group',\n 'Added to groups',\n groupsEvent.groups_added\n );\n } else if (groupsEvent.groups_removed) {\n return renderInfoList(\n 'Removed from group',\n 'Removed from groups',\n groupsEvent.groups_removed\n );\n }\n};\n\nexport const renderTicketOpened = (event: TicketEvent): string => {\n return `${event.ticket.topic.name} ticket was opened`;\n};\n\nexport const renderAirtimeTransferredEvent = (\n event: AirtimeTransferredEvent\n): string => {\n if (parseFloat(event.amount) === 0) {\n return `Airtime transfer failed`;\n }\n return `Transferred **${event.amount}** ${event.currency} of airtime`;\n};\n\nexport const renderContactLanguageChangedEvent = (\n event: ContactLanguageChangedEvent\n): string => {\n return `Language updated to **${event.language}**`;\n};\n\nexport const renderContactStatusChangedEvent = (\n event: ContactStatusChangedEvent\n): string => {\n return `Status updated to **${event.status}**`;\n};\n\nexport const renderCallEvent = (event: CallEvent): string => {\n if (event.type === Events.CALL_CREATED) {\n return `Call started`;\n } else if (event.type === Events.CALL_MISSED) {\n return `Call missed`;\n } else if (event.type === Events.CALL_RECEIVED) {\n return `Call answered`;\n }\n};\n\nexport const renderOptInEvent = (event: OptInEvent): string => {\n if (event.type === Events.OPTIN_REQUESTED) {\n return `Requested opt-in for **${event.optin.name}**`;\n } else if (event.type === Events.OPTIN_STARTED) {\n return `Opted in to **${event.optin.name}**`;\n } else if (event.type === Events.OPTIN_STOPPED) {\n return `Opted out of **${event.optin.name}**`;\n }\n};\n\nexport class ContactChat extends ContactStoreElement {\n public static get styles() {\n return css`\n :host {\n flex-grow: 1;\n display: flex;\n flex-direction: row;\n min-height: 0;\n --compose-shadow: none;\n --compose-border: none;\n --compose-padding: 3px;\n --compose-curvature: none;\n border-top: 1px inset rgba(0, 0, 0, 0.05);\n\n\n }\n\n .chat-wrapper {\n display: flex;\n flex-grow: 1;\n flex-direction: column;\n min-height: 0;\n background: #f9f9f9;\n }\n\n temba-contact-history {\n border-bottom: 1px solid #f6f6f6;\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n min-height: 0;\n }\n\n .compose {\n background: #fff;\n display: flex;\n flex-direction: column;\n --textarea-min-height: 8em;\n --textarea-height: 0.5em;\n --widget-box-shadow-focused: none;\n --compose-curvature: 0px;\n overflow: hidden;\n }\n\n .closed-footer {\n padding: 1em;\n background: #f2f2f2;\n border-top: 3px solid #e1e1e1;\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n\n a {\n color: var(--color-link-primary);\n }\n\n a:hover {\n text-decoration: underline;\n color: var(--color-link-primary-hover);\n }\n\n temba-button {\n margin: 0.1em 0.25em;\n }\n\n temba-completion {\n --widget-box-shadow: none;\n --color-widget-border: transparent;\n --widget-box-shadow-focused: none;\n --color-focus: transparent;\n --color-widget-bg-focused: transparent;\n }\n\n .border {\n }\n\n temba-compose {\n border-top-right-radius: 0;\n border-top-left-radius: 0;\n --temba-tabs-options-padding: 0.5em 0.5em 0 0.5em;\n --temba-tabs-border-left: none;\n --temba-tabs-border-right: none;\n --temba-tabs-border-bottom: none;\n }\n\n .error-gutter {\n display: flex;\n padding: 0.5em 1em;\n background: #f9f9f9;\n item-align: center;\n }\n\n .error-message {\n color: var(--color-error);\n padding-right: 1em;\n flex-grow: 1;\n align-self: center;\n }\n\n temba-chat {\n border-bottom: 1px solid #ddd;\n background: linear-gradient(0deg, #fff, #fff);\n --chat-border-in: 1px solid #eee;\n --color-chat-out: var(--color-message)\n );\n }\n\n .action-bar {\n }\n\n .in-flow {\n border-radius: 0.8em;\n align-items: center;\n background: #666;\n padding: 0.5em 1em;\n margin: 1em;\n margin-right: 2em;\n display: inline-flex;\n opacity: 0.9;\n }\n\n .in-flow:hover {\n opacity: 1;\n }\n\n .in-flow .flow-name {\n display: flex;\n color: #fff;\n }\n\n .in-flow a {\n font-weight: bold;\n color: #fff;\n }\n\n .in-flow .interrupt-button {\n margin-left: 1em;\n }\n\n .in-flow .interrupt {\n text-align: center;\n align-self: stretch;\n display: flex;\n align-items: center;\n cursor: pointer;\n justify-content: center;\n padding: 0.5em 1em;\n font-weight: bold;\n }\n\n .in-flow .interrupt:hover {\n background: rgba(var(--error-rgb), 0.92);\n }\n\n .in-flow temba-icon,\n .in-ticket temba-icon {\n margin-right: 0.5em;\n }\n\n .in-ticket-wrapper {\n }\n\n .in-ticket {\n box-shadow: none;\n padding: 0.5em 0.5em;\n text-align: center;\n align-items: center;\n border-bottom: 1px solid #ddd;\n display: flex;\n box-shadow: none;\n margin: 0em;\n background: rgba(0, 0, 0, 0.03);\n }\n\n temba-user {\n border: 1px solid #ddd;\n padding: 0.2em 0.5em;\n border-radius: var(--curvature);\n min-width: 10em;\n background: #fff;\n }\n\n temba-user:hover {\n border: 1px solid #ddd;\n background: #f9f9f9;\n }\n\n .assign-button {\n --button-mask: #ebebeb;\n color: #333;\n margin: 0.25em;\n }\n\n temba-user-select {\n width: 250px;\n }\n\n temba-button {\n --button-border: 1px solid #ddd;\n }\n `;\n }\n\n @property({ type: String, attribute: 'ticket' })\n ticketUUID: string;\n\n @property({ type: String })\n contactsEndpoint = '/api/v2/contacts.json';\n\n @property({ type: String })\n currentNote = '';\n\n @property({ type: Boolean })\n showDetails = true;\n\n @property({ type: Object })\n currentTicket: Ticket = null;\n\n @property({ type: Object })\n currentContact: Contact = null;\n\n @property({ type: String })\n agent = '';\n\n @property({ type: Boolean })\n blockFetching = false;\n\n @property({ type: Boolean })\n showInterrupt = false;\n\n @property({ type: String })\n avatar = DEFAULT_AVATAR;\n\n @property({ type: String })\n errorMessage: string;\n\n // http promise to monitor for completeness\n public httpComplete: Promise<void>;\n private chat: Chat;\n\n ticket = null;\n lastEventTime = null;\n newestEventTime = null;\n refreshId = null;\n polling = false;\n\n constructor() {\n super();\n }\n\n public firstUpdated(\n changed: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.firstUpdated(changed);\n }\n\n public connectedCallback() {\n super.connectedCallback();\n this.chat = this.shadowRoot.querySelector('temba-chat');\n }\n\n public disconnectedCallback() {\n super.disconnectedCallback();\n if (this.refreshId) {\n clearInterval(this.refreshId);\n }\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n // if we don't have an endpoint infer one\n if (\n changedProperties.has('data') ||\n changedProperties.has('currentContact')\n ) {\n // unschedule any previous refreshes\n if (this.refreshId) {\n clearTimeout(this.refreshId);\n this.refreshId = null;\n }\n\n this.currentContact = this.data;\n }\n\n if (changedProperties.has('currentContact')) {\n this.chat = this.shadowRoot.querySelector('temba-chat');\n this.reset();\n this.fetchPreviousMessages();\n }\n }\n\n private reset() {\n if (this.chat) {\n this.chat.reset();\n }\n this.blockFetching = false;\n this.ticket = null;\n this.lastEventTime = null;\n this.newestEventTime = null;\n this.refreshId = null;\n this.polling = false;\n this.errorMessage = null;\n\n const compose = this.shadowRoot.querySelector('temba-compose') as Compose;\n if (compose) {\n compose.reset();\n }\n }\n\n private handleInterrupt() {\n this.fireCustomEvent(CustomEventType.Interrupt, {\n contact: this.currentContact\n });\n }\n\n private handleRetry() {\n const compose = this.shadowRoot.querySelector('temba-compose') as Compose;\n compose.triggerSend();\n }\n\n private handleSend(evt: CustomEvent) {\n this.errorMessage = null;\n const composeEle = evt.currentTarget as Compose;\n const compose = evt.detail.langValues['und'] as ComposeValue;\n\n const payload = {\n contact: this.currentContact.uuid\n };\n\n const text = compose.text;\n if (text && text.length > 0) {\n payload['text'] = text;\n }\n const attachments = compose.attachments;\n if (attachments && attachments.length > 0) {\n const attachment_uuids = attachments.map((attachment) => attachment.uuid);\n payload['attachments'] = attachment_uuids;\n }\n\n if (this.currentTicket) {\n payload['ticket'] = this.currentTicket.uuid;\n }\n\n const genericError = 'Send failed, please try again.';\n postJSON(`/api/v2/messages.json`, payload)\n .then((response) => {\n if (response.status < 400) {\n this.checkForNewMessages();\n composeEle.reset();\n this.fireCustomEvent(CustomEventType.MessageSent, { msg: payload });\n } else {\n this.errorMessage = genericError;\n }\n })\n .catch(() => {\n this.errorMessage = genericError;\n });\n }\n\n private getEndpoint() {\n if (this.contact) {\n return `/contact/history/${this.contact}/?_format=json`;\n }\n return null;\n }\n\n private scheduleRefresh() {\n // knock five seconds off the newest event time so we are\n // a little more aggressive about refreshing short term\n let window = new Date().getTime() - this.newestEventTime / 1000 - 5000;\n\n if (this.refreshId) {\n clearTimeout(this.refreshId);\n this.refreshId = null;\n }\n\n // wait no longer than 15 seconds\n window = Math.min(window, 15000);\n\n // wait at least 2 seconds\n window = Math.max(window, 2000);\n\n this.refreshId = setTimeout(() => {\n this.checkForNewMessages();\n }, window);\n }\n\n public getEventMessage(event: ContactEvent): ChatEvent {\n let message = null;\n switch (event.type) {\n case Events.AIRTIME_TRANSFERRED:\n message = {\n type: MessageType.Inline,\n text: renderAirtimeTransferredEvent(event as AirtimeTransferredEvent)\n };\n break;\n case Events.CALL_CREATED:\n case Events.CALL_MISSED:\n case Events.CALL_RECEIVED:\n message = {\n type: MessageType.Inline,\n text: renderCallEvent(event as CallEvent)\n };\n break;\n case Events.CHAT_STARTED:\n message = {\n type: MessageType.Inline,\n text: renderChatStartedEvent(event as ChatStartedEvent)\n };\n break;\n case Events.CONTACT_FIELD_CHANGED:\n message = {\n type: MessageType.Inline,\n text: renderUpdateEvent(event as UpdateFieldEvent)\n };\n break;\n case Events.CONTACT_GROUPS_CHANGED:\n message = {\n type: MessageType.Inline,\n text: renderContactGroupsEvent(event as ContactGroupsEvent)\n };\n break;\n case Events.CONTACT_LANGUAGE_CHANGED:\n message = {\n type: MessageType.Inline,\n text: renderContactLanguageChangedEvent(\n event as ContactLanguageChangedEvent\n )\n };\n break;\n case Events.CONTACT_NAME_CHANGED:\n message = {\n type: MessageType.Inline,\n text: renderNameChanged(event as NameChangedEvent)\n };\n break;\n case Events.CONTACT_STATUS_CHANGED:\n message = {\n type: MessageType.Inline,\n text: renderContactStatusChangedEvent(\n event as ContactStatusChangedEvent\n )\n };\n break;\n case Events.CONTACT_URNS_CHANGED:\n message = {\n type: MessageType.Inline,\n text: renderContactURNsChanged(event as URNsChangedEvent)\n };\n break;\n case Events.OPTIN_REQUESTED:\n case Events.OPTIN_STARTED:\n case Events.OPTIN_STOPPED:\n message = {\n type: MessageType.Inline,\n text: renderOptInEvent(event as OptInEvent)\n };\n break;\n case Events.RUN_STARTED:\n case Events.RUN_ENDED:\n message = {\n type: MessageType.Inline,\n text: renderRunEvent(event as RunEvent)\n };\n break;\n case Events.TICKET_ASSIGNED:\n message = {\n type: MessageType.Inline,\n text: renderTicketAssigned(event as TicketEvent)\n };\n break;\n case Events.TICKET_CLOSED:\n message = {\n type: MessageType.Inline,\n text: renderTicketAction(event as TicketEvent, 'closed')\n };\n break;\n case Events.TICKET_OPENED:\n message = {\n type: MessageType.Inline,\n text: renderTicketAction(event as TicketEvent, 'opened')\n };\n break;\n case Events.TICKET_REOPENED:\n message = {\n type: MessageType.Inline,\n text: renderTicketAction(event as TicketEvent, 'reopened')\n };\n break;\n case Events.TICKET_TOPIC_CHANGED:\n message = {\n type: MessageType.Inline,\n text: `Topic changed to **${(event as TicketEvent).topic.name}**`\n };\n break;\n case Events.CHANNEL_EVENT: // deprecated\n message = {\n type: MessageType.Inline,\n text: renderChannelEvent(event as ChannelEvent)\n };\n break;\n }\n\n if (message && event.created_on) {\n message.date = new Date(event.created_on);\n } else {\n console.error('Unknown event type', event);\n }\n\n return message;\n }\n\n private getUserForEvent(event: MsgEvent | TicketEvent) {\n let user = null;\n if (event.type === 'msg_received') {\n user = {\n name: this.currentContact.name\n };\n } else if (event.created_by) {\n user = {\n email: event.created_by.email,\n name: `${event.created_by.first_name} ${event.created_by.last_name}`.trim(),\n avatar: event.created_by.avatar\n };\n }\n return user;\n }\n\n private createMessages(page: ContactHistoryPage): ChatEvent[] {\n if (page.events) {\n let messages = [];\n page.events.forEach((event) => {\n const ts = new Date(event.created_on).getTime() * 1000;\n if (ts > this.newestEventTime) {\n this.newestEventTime = ts;\n }\n\n if (event.type === 'ticket_note_added') {\n const ticketEvent = event as TicketEvent;\n messages.push({\n type: MessageType.Note,\n id: event.created_on + event.type,\n user: this.getUserForEvent(ticketEvent),\n date: new Date(ticketEvent.created_on),\n text: ticketEvent.note\n });\n } else if (event.type === 'ticket_opened') {\n // ticket open events can have a note attached\n const ticketEvent = event as TicketEvent;\n messages.push({\n type: MessageType.Note,\n id: event.created_on + event.type + '_note',\n user: this.getUserForEvent(ticketEvent),\n date: new Date(ticketEvent.created_on),\n text: ticketEvent.note\n });\n\n // but the opening of the ticket is a normal event\n messages.push(this.getEventMessage(event));\n } else if (\n event.type === 'msg_created' ||\n event.type === 'msg_received' ||\n event.type === 'broadcast_created'\n ) {\n const msgEvent = event as MsgEvent;\n messages.push({\n id: event.uuid,\n type: msgEvent.type === 'msg_received' ? 'msg_in' : 'msg_out',\n user: this.getUserForEvent(msgEvent),\n date: new Date(msgEvent.created_on),\n attachments: msgEvent.msg.attachments,\n text: msgEvent.msg.text,\n sendError: msgEvent.status === 'E' || msgEvent.status === 'F',\n popup: html`<div\n style=\"display: flex; flex-direction: row; align-items:center; justify-content: space-between;font-size:0.9em;line-height:1em;min-width:10em\"\n >\n <div style=\"justify-content:left;text-align:left\">\n <temba-date\n value=${msgEvent.created_on}\n display=\"duration\"\n ></temba-date>\n\n ${msgEvent.optin\n ? html`<div style=\"font-size:0.9em;color:#aaa\">\n ${msgEvent.optin.name}\n </div>`\n : null}\n ${msgEvent.failed_reason_display\n ? html`\n <div\n style=\"margin-top:0.2em;margin-right: 0.5em;min-width:10em;max-width:15em;color:var(--color-error);font-size:0.9em\"\n >\n ${msgEvent.failed_reason_display}\n </div>\n `\n : null}\n </div>\n ${msgEvent.logs_url\n ? html`<a style=\"margin-left:0.5em\" href=\"${msgEvent.logs_url}\"\n ><temba-icon name=\"log\"></temba-icon\n ></a>`\n : null}\n </div> `\n });\n } else {\n messages.push(this.getEventMessage(event));\n }\n });\n\n // remove any messages we don't recognize\n messages = messages.filter((msg) => !!msg);\n return messages as ChatEvent[];\n }\n return [];\n }\n\n private checkForNewMessages() {\n // we are already working on it\n if (this.polling) {\n return;\n }\n\n const chat = this.chat;\n const contactChat = this;\n if (this.currentContact && this.newestEventTime) {\n this.polling = true;\n const endpoint = this.getEndpoint();\n if (!endpoint) {\n return;\n }\n\n const fetchContact = this.currentContact.uuid;\n\n fetchContactHistory(\n false,\n endpoint,\n this.currentTicket?.uuid,\n null,\n this.newestEventTime\n ).then((page: ContactHistoryPage) => {\n if (fetchContact === this.currentContact.uuid) {\n this.lastEventTime = page.next_before;\n const messages = this.createMessages(page);\n if (messages.length === 0) {\n contactChat.blockFetching = true;\n }\n messages.reverse();\n chat.addMessages(messages, null, true);\n }\n this.polling = false;\n this.scheduleRefresh();\n });\n }\n }\n\n private fetchPreviousMessages() {\n const chat = this.chat;\n const contactChat = this;\n if (!chat || chat.fetching || contactChat.blockFetching) {\n return;\n }\n\n chat.fetching = true;\n if (this.currentContact) {\n const endpoint = this.getEndpoint();\n if (!endpoint) {\n return;\n }\n\n fetchContactHistory(\n false,\n endpoint,\n this.currentTicket?.uuid,\n this.lastEventTime\n ).then((page: ContactHistoryPage) => {\n this.lastEventTime = page.next_before;\n const messages = this.createMessages(page);\n messages.reverse();\n\n if (messages.length === 0) {\n contactChat.blockFetching = true;\n }\n chat.addMessages(messages);\n this.scheduleRefresh();\n });\n }\n }\n\n private fetchComplete() {\n if (this.chat) {\n this.chat.fetching = false;\n }\n }\n\n private getTembaCompose(): TemplateResult {\n if (this.currentTicket) {\n if (this.currentContact && this.currentContact.status !== 'active') {\n //no chatbox for archived, blocked, or stopped contacts\n return null;\n } else {\n if (!this.currentTicket.closed_on) {\n //chatbox for active contacts with an open ticket\n return this.getCompose();\n } else {\n return null;\n }\n }\n }\n\n if (this.currentContact && this.currentContact.status !== 'active') {\n //no chatbox for archived, blocked, or stopped contacts\n return null;\n } else {\n //chatbox for active contacts\n return this.getCompose();\n }\n }\n\n private getCompose(): TemplateResult {\n return html`<div class=\"border\"></div>\n <div class=\"compose\">\n <temba-compose\n attachments\n counter\n autogrow\n shortcuts\n ?embeddedTabs=${!this.currentTicket}\n @temba-submitted=${this.handleSend.bind(this)}\n >\n </temba-compose>\n ${this.errorMessage\n ? html` <div class=\"error-gutter\">\n <div class=\"error-message\">${this.errorMessage}</div>\n <temba-button\n name=\"Retry\"\n @click=${this.handleRetry}\n ></temba-button>\n </div>`\n : null}\n </div>`;\n }\n\n private handleAssignmentChanged(evt: CustomEvent) {\n const users = evt.currentTarget as UserSelect;\n const assignee = users.values[0];\n\n this.assignTicket(assignee ? assignee.email : null);\n users.blur();\n }\n\n private handleTopicChanged(evt: CustomEvent) {\n const select = evt.target as Select<any>;\n const topic = select.values[0];\n\n if (this.currentTicket.topic.uuid !== topic.uuid) {\n postJSON(`/api/v2/ticket_actions.json`, {\n tickets: [this.currentTicket.uuid],\n action: 'change_topic',\n topic: topic.uuid\n })\n .then(() => {\n this.refreshTicket();\n })\n .catch((response: any) => {\n console.error(response);\n });\n }\n }\n\n public assignTicket(email: string) {\n // if its already assigned to use, it's a noop\n if (\n (this.currentTicket.assignee &&\n this.currentTicket.assignee.email === email) ||\n (this.currentTicket.assignee === null && email === null)\n ) {\n return;\n }\n\n postJSON(`/api/v2/ticket_actions.json`, {\n tickets: [this.currentTicket.uuid],\n action: 'assign',\n assignee: email\n })\n .then(() => {\n this.refreshTicket();\n })\n .catch((response: any) => {\n console.error(response);\n });\n return true;\n }\n\n public refreshTicket() {\n if (this.currentTicket) {\n fetchResults(`/api/v2/tickets.json?uuid=${this.currentTicket.uuid}`).then(\n (values) => {\n this.store.resolveUsers(values, ['assignee']).then(() => {\n if (values.length > 0) {\n this.fireCustomEvent(CustomEventType.TicketUpdated, {\n ticket: values[0],\n previous: this.currentTicket\n });\n this.currentTicket = values[0];\n }\n });\n }\n );\n }\n }\n\n private handleReopen() {\n const uuid = this.currentTicket.uuid;\n postJSON(`/api/v2/ticket_actions.json`, {\n tickets: [uuid],\n action: 'reopen'\n })\n .then(() => {\n this.refreshTicket();\n })\n .catch((response: any) => {\n console.error(response);\n });\n }\n\n private handleClose() {\n const uuid = this.currentTicket.uuid;\n postJSON(`/api/v2/ticket_actions.json`, {\n tickets: [uuid],\n action: 'close'\n })\n .then(() => {\n this.refreshTicket();\n })\n .catch((response: any) => {\n console.error(response);\n });\n }\n\n public render(): TemplateResult {\n const inFlow = this.currentContact && this.currentContact.flow;\n\n const inTicket = this.currentTicket;\n const ticketClosed = this.currentTicket && this.currentTicket.closed_on;\n\n return html`<div class=\"chat-wrapper\">\n ${this.currentContact\n ? html`<temba-chat\n @temba-scroll-threshold=${this.fetchPreviousMessages}\n @temba-fetch-complete=${this.fetchComplete}\n avatar=${this.avatar}\n agent\n >\n ${inFlow\n ? html`\n <div slot=\"footer\" style=\"text-align:center;\">\n <div class=\"in-flow\">\n <div class=\"flow-name\">\n <temba-icon name=\"flow\" size=\"1.2\"></temba-icon>\n <div>\n Currently in\n <a\n href=\"/flow/editor/${this.currentContact.flow\n .uuid}/\"\n >${this.currentContact.flow.name}</a\n >\n </div>\n </div>\n ${this.showInterrupt\n ? html`<temba-button\n class=\"interrupt-button\"\n destructive\n small\n @click=${this.handleInterrupt}\n name=\"Interrupt\"\n >\n </temba-button>`\n : null}\n </div>\n </div>\n `\n : null}\n <div slot=\"footer\"></div>\n </temba-chat>\n ${inTicket\n ? html`<div class=\"in-ticket-wrapper\">\n <div class=\"in-ticket\">\n <temba-user-select\n placeholder=\"Assign to..\"\n searchable\n searchOnFocus\n clearable\n .values=${this.currentTicket.assignee\n ? [this.currentTicket.assignee]\n : []}\n @change=${this.handleAssignmentChanged}\n ?disabled=${ticketClosed}\n ></temba-user-select>\n\n <temba-select\n style=\"margin:0 0.5em; flex-grow:1\"\n endpoint=\"/api/v2/topics.json\"\n searchable\n valuekey=\"uuid\"\n .values=${[this.currentTicket.topic]}\n @change=${this.handleTopicChanged}\n ?disabled=${ticketClosed}\n ></temba-select>\n\n ${this.currentTicket.closed_on\n ? html`\n <temba-button\n name=\"Reopen\"\n @click=${this.handleReopen}\n ></temba-button>\n `\n : html`\n <temba-button\n name=\"Close\"\n destructive\n @click=${this.handleClose}\n ></temba-button>\n `}\n </div>\n </div> `\n : null}\n ${this.getTembaCompose()}`\n : null}\n </div>`;\n }\n}\nexport const closeTicket = (uuid: string): Promise<WebResponse> => {\n const formData = new FormData();\n formData.append('status', 'C');\n return postUrl(`/ticket/update/${uuid}/?_format=json`, formData);\n};\nexport const fetchContact = (endpoint: string): Promise<Contact> => {\n return new Promise<Contact>((resolve, reject) => {\n fetchResults(endpoint).then((contacts: Contact[]) => {\n if (contacts && contacts.length === 1) {\n resolve(contacts[0]);\n } else {\n reject('No contact found');\n }\n });\n });\n};\nexport const fetchContactHistory = (\n reset: boolean,\n endpoint: string,\n ticket: string,\n before: number = undefined,\n after: number = undefined\n): Promise<ContactHistoryPage> => {\n if (reset) {\n pendingRequests.forEach((controller) => {\n controller.abort();\n });\n pendingRequests = [];\n }\n\n return new Promise<ContactHistoryPage>((resolve) => {\n const controller = new AbortController();\n pendingRequests.push(controller);\n\n let url = endpoint;\n if (before) {\n url += `&before=${before}`;\n }\n\n if (after) {\n url += `&after=${after}`;\n }\n\n if (ticket) {\n url += `&ticket=${ticket}`;\n }\n\n const store = document.querySelector('temba-store') as Store;\n\n getUrl(url, controller)\n .then((response: WebResponse) => {\n // on success, remove our abort controller\n pendingRequests = pendingRequests.filter(\n (controller: AbortController) => {\n return response.controller === controller;\n }\n );\n\n const page = response.json as ContactHistoryPage;\n store.resolveUsers(page.events, ['created_by']).then(() => {\n resolve(page);\n });\n })\n .catch(() => {\n // canceled\n });\n });\n};\nexport const getDisplayName = (user: User) => {\n if (!user) {\n return 'Somebody';\n }\n\n if ((user as NamedUser).name) {\n return (user as NamedUser).name;\n }\n\n if (user.first_name && user.last_name) {\n return `${user.first_name} ${user.last_name}`;\n }\n\n if (user.first_name) {\n return user.first_name;\n }\n\n return user.email;\n};\nexport let pendingRequests: AbortController[] = [];\n"]}
|
|
1
|
+
{"version":3,"file":"ContactChat.js","sourceRoot":"","sources":["../../../src/live/ContactChat.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAoC,MAAM,KAAK,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAEL,eAAe,EAIhB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,EAER,MAAM,UAAU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,CAAC;IAED,OAAO,IAAI,CAAC,KAAK,CAAC;AACpB,CAAC,CAAC;AACF,MAAM,CAAC,IAAI,eAAe,GAAsB,EAAE,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-this-alias */\nimport { css, html, PropertyValueMap, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport {\n Contact,\n CustomEventType,\n NamedUser,\n Ticket,\n User\n} from '../interfaces';\nimport {\n fetchResults,\n getUrl,\n oxfordFn,\n postJSON,\n postUrl,\n WebResponse\n} from '../utils';\nimport { ContactStoreElement } from './ContactStoreElement';\nimport { Compose, ComposeValue } from '../form/Compose';\nimport {\n AirtimeTransferredEvent,\n CallEvent,\n ChannelEvent,\n ChatStartedEvent,\n ContactEvent,\n ContactGroupsEvent,\n ContactHistoryPage,\n ContactLanguageChangedEvent,\n ContactStatusChangedEvent,\n MsgEvent,\n NameChangedEvent,\n OptInEvent,\n RunEvent,\n TicketEvent,\n UpdateFieldEvent,\n URNsChangedEvent\n} from '../events';\nimport { Chat, ChatEvent, MessageType } from '../display/Chat';\nimport { DEFAULT_AVATAR } from '../webchat/assets';\nimport { UserSelect } from '../form/select/UserSelect';\nimport { Select } from '../form/select/Select';\nimport { Store } from '../store/Store';\n\n/*\nexport const SCROLL_THRESHOLD = 100;\nexport const SIMULATED_WEB_SLOWNESS = 0;\nexport const MAX_CHAT_REFRESH = 10000;\nexport const MIN_CHAT_REFRESH = 500;\nexport const BODY_SNIPPET_LENGTH = 250;\n*/\n\nexport enum Events {\n AIRTIME_TRANSFERRED = 'airtime_transferred',\n BROADCAST_CREATED = 'broadcast_created',\n CALL_CREATED = 'call_created',\n CALL_MISSED = 'call_missed',\n CALL_RECEIVED = 'call_received',\n CHAT_STARTED = 'chat_started',\n CONTACT_FIELD_CHANGED = 'contact_field_changed',\n CONTACT_GROUPS_CHANGED = 'contact_groups_changed',\n CONTACT_LANGUAGE_CHANGED = 'contact_language_changed',\n CONTACT_NAME_CHANGED = 'contact_name_changed',\n CONTACT_STATUS_CHANGED = 'contact_status_changed',\n CONTACT_URNS_CHANGED = 'contact_urns_changed',\n IVR_CREATED = 'ivr_created',\n MSG_CREATED = 'msg_created',\n MSG_RECEIVED = 'msg_received',\n NOTE_CREATED = 'note_created',\n OPTIN_REQUESTED = 'optin_requested',\n OPTIN_STARTED = 'optin_started',\n OPTIN_STOPPED = 'optin_stopped',\n RUN_ENDED = 'run_ended',\n RUN_STARTED = 'run_started',\n TICKET_ASSIGNEE_CHANGED = 'ticket_assignee_changed',\n TICKET_CLOSED = 'ticket_closed',\n TICKET_NOTE_ADDED = 'ticket_note_added',\n TICKET_OPENED = 'ticket_opened',\n TICKET_REOPENED = 'ticket_reopened',\n TICKET_TOPIC_CHANGED = 'ticket_topic_changed',\n\n // deprecated\n CHANNEL_EVENT = 'channel_event',\n TICKET_ASSIGNED = 'ticket_assigned'\n}\n\nconst renderInfoList = (\n singular: string,\n plural: string,\n items: any[]\n): TemplateResult => {\n if (items.length === 1) {\n return html`<div>${singular} <strong>${items[0].name}</strong></div>`;\n } else {\n const list = items.map((item) => item.name);\n if (list.length === 2) {\n return html`<div>\n ${plural} <strong>${list[0]}</strong> and <strong>${list[1]}</strong>\n </div>`;\n } else {\n const last = list.pop();\n const middle = list.map(\n (name, index) =>\n html`<strong>${name}</strong>${index < list.length - 1 ? ', ' : ''}`\n );\n return html`<div>${plural} ${middle}, and <strong>${last}</strong></div>`;\n }\n }\n};\n\nconst renderChannelEvent = (event: ChannelEvent): TemplateResult => {\n if (event.channel_event_type === 'welcome_message') {\n return html`<div>Welcome message sent</div>`;\n } else if (event.event.type === 'stop_contact') {\n return html`<div>Stopped</div>`;\n }\n};\n\nconst renderRunEvent = (event: RunEvent): TemplateResult => {\n let verb = 'Started';\n if (event.type === Events.RUN_ENDED) {\n if (event.status === 'completed') {\n verb = 'Completed';\n } else if (event.status === 'expired') {\n verb = 'Expired from';\n } else {\n verb = 'Interrupted';\n }\n }\n\n return html`<div>\n ${verb}\n <a href=\"/flow/editor/${event.flow.uuid}/\"\n ><strong>${event.flow.name}</strong></a\n >\n </div>`;\n};\n\nconst renderChatStartedEvent = (event: ChatStartedEvent): TemplateResult => {\n if (event.params) {\n return html`<div>Chat referral</div>`;\n } else {\n return html`<div>Chat started</div>`;\n }\n};\n\nconst renderUpdateEvent = (event: UpdateFieldEvent): TemplateResult => {\n return event.value\n ? html`<div>\n Updated <strong>${event.field.name}</strong> to\n <strong>${event.value.text}</strong>\n </div>`\n : html`<div>Cleared <strong>${event.field.name}</strong></div>`;\n};\n\nconst renderNameChanged = (event: NameChangedEvent): TemplateResult => {\n return html`<div>\n Updated <strong>name</strong> to <strong>${event.name}</strong>\n </div>`;\n};\n\nconst renderContactURNsChanged = (event: URNsChangedEvent): TemplateResult => {\n return html`<div>\n Updated <strong>URNs</strong> to\n ${oxfordFn(\n event.urns,\n (urn: string) => html`<strong>${urn.split(':')[1].split('?')[0]}</strong>`\n )}\n </div>`;\n};\n\nexport const renderTicketAction = (\n event: TicketEvent,\n action: string\n): TemplateResult => {\n const ticketUUID = event.ticket?.uuid || event.ticket_uuid;\n\n if (event._user) {\n return html`<div>\n <strong>${event._user.name}</strong> ${action} a\n <strong><a href=\"/ticket/all/closed/${ticketUUID}/\">ticket</a></strong>\n </div>`;\n }\n return html`<div>\n A\n <strong><a href=\"/ticket/all/closed/${ticketUUID}/\">ticket</a></strong> was\n <strong>${action}</strong>\n </div>`;\n};\n\nexport const renderTicketAssigneeChanged = (\n event: TicketEvent\n): TemplateResult => {\n if (event._user) {\n if (event.assignee) {\n return html`<div>\n <strong>${event._user.name}</strong> assigned this ticket to\n <strong>${event.assignee.name}</strong>\n </div>`;\n } else {\n return html`<div>\n <strong>${event._user.name}</strong> unassigned this ticket\n </div>`;\n }\n } else {\n if (event.assignee) {\n return html`<div>\n This ticket was assigned to <strong>${event.assignee.name}</strong>\n </div>`;\n } else {\n return html`<div>This ticket was unassigned</div>`;\n }\n }\n};\n\nexport const renderTicketOpened = (event: TicketEvent): TemplateResult => {\n return html`<div>${event.ticket.topic.name} ticket was opened</div>`;\n};\n\nexport const renderContactGroupsEvent = (\n event: ContactGroupsEvent\n): TemplateResult => {\n const groupsEvent = event as ContactGroupsEvent;\n if (groupsEvent.groups_added) {\n return renderInfoList(\n 'Added to group',\n 'Added to groups',\n groupsEvent.groups_added\n );\n } else if (groupsEvent.groups_removed) {\n return renderInfoList(\n 'Removed from group',\n 'Removed from groups',\n groupsEvent.groups_removed\n );\n }\n};\n\nexport const renderAirtimeTransferredEvent = (\n event: AirtimeTransferredEvent\n): TemplateResult => {\n if (parseFloat(event.amount) === 0) {\n return html`<div>Airtime transfer failed</div>`;\n }\n return html`<div>\n Transferred <strong>${event.amount}</strong> ${event.currency} of airtime\n </div>`;\n};\n\nexport const renderContactLanguageChangedEvent = (\n event: ContactLanguageChangedEvent\n): TemplateResult => {\n return html`<div>\n Language updated to <strong>${event.language}</strong>\n </div>`;\n};\n\nexport const renderContactStatusChangedEvent = (\n event: ContactStatusChangedEvent\n): TemplateResult => {\n return html`<div>Status updated to <strong>${event.status}</strong></div>`;\n};\n\nexport const renderCallEvent = (event: CallEvent): TemplateResult => {\n if (event.type === Events.CALL_CREATED) {\n return html`<div>Call started</div>`;\n } else if (event.type === Events.CALL_MISSED) {\n return html`<div>Call missed</div>`;\n } else if (event.type === Events.CALL_RECEIVED) {\n return html`<div>Call answered</div>`;\n }\n};\n\nexport const renderOptInEvent = (event: OptInEvent): TemplateResult => {\n if (event.type === Events.OPTIN_REQUESTED) {\n return html`<div>\n Requested opt-in for <strong>${event.optin.name}</strong>\n </div>`;\n } else if (event.type === Events.OPTIN_STARTED) {\n return html`<div>Opted in to <strong>${event.optin.name}</strong></div>`;\n } else if (event.type === Events.OPTIN_STOPPED) {\n return html`<div>Opted out of <strong>${event.optin.name}</strong></div>`;\n }\n};\n\nexport class ContactChat extends ContactStoreElement {\n public static get styles() {\n return css`\n :host {\n flex-grow: 1;\n display: flex;\n flex-direction: row;\n min-height: 0;\n --compose-shadow: none;\n --compose-border: none;\n --compose-padding: 3px;\n --compose-curvature: none;\n border-top: 1px inset rgba(0, 0, 0, 0.05);\n\n\n }\n\n .chat-wrapper {\n display: flex;\n flex-grow: 1;\n flex-direction: column;\n min-height: 0;\n background: #f9f9f9;\n }\n\n temba-contact-history {\n border-bottom: 1px solid #f6f6f6;\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n min-height: 0;\n }\n\n .compose {\n background: #fff;\n display: flex;\n flex-direction: column;\n --textarea-min-height: 8em;\n --textarea-height: 0.5em;\n --widget-box-shadow-focused: none;\n --compose-curvature: 0px;\n overflow: hidden;\n }\n\n .closed-footer {\n padding: 1em;\n background: #f2f2f2;\n border-top: 3px solid #e1e1e1;\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n\n a {\n color: var(--color-link-primary);\n }\n\n a:hover {\n text-decoration: underline;\n color: var(--color-link-primary-hover);\n }\n\n temba-button {\n margin: 0.1em 0.25em;\n }\n\n temba-completion {\n --widget-box-shadow: none;\n --color-widget-border: transparent;\n --widget-box-shadow-focused: none;\n --color-focus: transparent;\n --color-widget-bg-focused: transparent;\n }\n\n .border {\n }\n\n temba-compose {\n border-top-right-radius: 0;\n border-top-left-radius: 0;\n --temba-tabs-options-padding: 0.5em 0.5em 0 0.5em;\n --temba-tabs-border-left: none;\n --temba-tabs-border-right: none;\n --temba-tabs-border-bottom: none;\n }\n\n .error-gutter {\n display: flex;\n padding: 0.5em 1em;\n background: #f9f9f9;\n item-align: center;\n }\n\n .error-message {\n color: var(--color-error);\n padding-right: 1em;\n flex-grow: 1;\n align-self: center;\n }\n\n temba-chat {\n border-bottom: 1px solid #ddd;\n background: linear-gradient(0deg, #fff, #fff);\n --chat-border-in: 1px solid #eee;\n --color-chat-out: var(--color-message)\n );\n }\n\n .action-bar {\n }\n\n .in-flow {\n border-radius: 0.8em;\n align-items: center;\n background: #666;\n padding: 0.5em 1em;\n margin: 1em;\n margin-right: 2em;\n display: inline-flex;\n opacity: 0.9;\n }\n\n .in-flow:hover {\n opacity: 1;\n }\n\n .in-flow .flow-name {\n display: flex;\n color: #fff;\n }\n\n .in-flow a {\n font-weight: bold;\n color: #fff;\n }\n\n .in-flow .interrupt-button {\n margin-left: 1em;\n }\n\n .in-flow .interrupt {\n text-align: center;\n align-self: stretch;\n display: flex;\n align-items: center;\n cursor: pointer;\n justify-content: center;\n padding: 0.5em 1em;\n font-weight: bold;\n }\n\n .in-flow .interrupt:hover {\n background: rgba(var(--error-rgb), 0.92);\n }\n\n .in-flow temba-icon,\n .in-ticket temba-icon {\n margin-right: 0.5em;\n }\n\n .in-ticket-wrapper {\n }\n\n .in-ticket {\n box-shadow: none;\n padding: 0.5em 0.5em;\n text-align: center;\n align-items: center;\n border-bottom: 1px solid #ddd;\n display: flex;\n box-shadow: none;\n margin: 0em;\n background: rgba(0, 0, 0, 0.03);\n }\n\n temba-user {\n border: 1px solid #ddd;\n padding: 0.2em 0.5em;\n border-radius: var(--curvature);\n min-width: 10em;\n background: #fff;\n }\n\n temba-user:hover {\n border: 1px solid #ddd;\n background: #f9f9f9;\n }\n\n .assign-button {\n --button-mask: #ebebeb;\n color: #333;\n margin: 0.25em;\n }\n\n temba-user-select {\n width: 250px;\n }\n\n temba-button {\n --button-border: 1px solid #ddd;\n }\n `;\n }\n\n @property({ type: String, attribute: 'ticket' })\n ticketUUID: string;\n\n @property({ type: String })\n contactsEndpoint = '/api/v2/contacts.json';\n\n @property({ type: String })\n currentNote = '';\n\n @property({ type: Boolean })\n showDetails = true;\n\n @property({ type: Object })\n currentTicket: Ticket = null;\n\n @property({ type: Object })\n currentContact: Contact = null;\n\n @property({ type: String })\n agent = '';\n\n @property({ type: Boolean })\n blockFetching = false;\n\n @property({ type: Boolean })\n showInterrupt = false;\n\n @property({ type: String })\n avatar = DEFAULT_AVATAR;\n\n @property({ type: String })\n errorMessage: string;\n\n // http promise to monitor for completeness\n public httpComplete: Promise<void>;\n private chat: Chat;\n\n ticket = null;\n lastEventTime = null;\n newestEventTime = null;\n refreshId = null;\n polling = false;\n\n constructor() {\n super();\n }\n\n public firstUpdated(\n changed: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.firstUpdated(changed);\n }\n\n public connectedCallback() {\n super.connectedCallback();\n this.chat = this.shadowRoot.querySelector('temba-chat');\n }\n\n public disconnectedCallback() {\n super.disconnectedCallback();\n if (this.refreshId) {\n clearInterval(this.refreshId);\n }\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n // if we don't have an endpoint infer one\n if (\n changedProperties.has('data') ||\n changedProperties.has('currentContact')\n ) {\n // unschedule any previous refreshes\n if (this.refreshId) {\n clearTimeout(this.refreshId);\n this.refreshId = null;\n }\n\n this.currentContact = this.data;\n }\n\n if (changedProperties.has('currentContact')) {\n this.chat = this.shadowRoot.querySelector('temba-chat');\n this.reset();\n this.fetchPreviousMessages();\n }\n }\n\n private reset() {\n if (this.chat) {\n this.chat.reset();\n }\n this.blockFetching = false;\n this.ticket = null;\n this.lastEventTime = null;\n this.newestEventTime = null;\n this.refreshId = null;\n this.polling = false;\n this.errorMessage = null;\n\n const compose = this.shadowRoot.querySelector('temba-compose') as Compose;\n if (compose) {\n compose.reset();\n }\n }\n\n private handleInterrupt() {\n this.fireCustomEvent(CustomEventType.Interrupt, {\n contact: this.currentContact\n });\n }\n\n private handleRetry() {\n const compose = this.shadowRoot.querySelector('temba-compose') as Compose;\n compose.triggerSend();\n }\n\n private handleSend(evt: CustomEvent) {\n this.errorMessage = null;\n const composeEle = evt.currentTarget as Compose;\n const compose = evt.detail.langValues['und'] as ComposeValue;\n\n const payload = {\n contact: this.currentContact.uuid\n };\n\n const text = compose.text;\n if (text && text.length > 0) {\n payload['text'] = text;\n }\n const attachments = compose.attachments;\n if (attachments && attachments.length > 0) {\n const attachment_uuids = attachments.map((attachment) => attachment.uuid);\n payload['attachments'] = attachment_uuids;\n }\n\n if (this.currentTicket) {\n payload['ticket'] = this.currentTicket.uuid;\n }\n\n const genericError = 'Send failed, please try again.';\n postJSON(`/api/v2/messages.json`, payload)\n .then((response) => {\n if (response.status < 400) {\n this.checkForNewMessages();\n composeEle.reset();\n this.fireCustomEvent(CustomEventType.MessageSent, { msg: payload });\n } else {\n this.errorMessage = genericError;\n }\n })\n .catch(() => {\n this.errorMessage = genericError;\n });\n }\n\n private getEndpoint() {\n if (this.contact) {\n return `/contact/history/${this.contact}/?_format=json`;\n }\n return null;\n }\n\n private scheduleRefresh() {\n // knock five seconds off the newest event time so we are\n // a little more aggressive about refreshing short term\n let window = new Date().getTime() - this.newestEventTime / 1000 - 5000;\n\n if (this.refreshId) {\n clearTimeout(this.refreshId);\n this.refreshId = null;\n }\n\n // wait no longer than 15 seconds\n window = Math.min(window, 15000);\n\n // wait at least 2 seconds\n window = Math.max(window, 2000);\n\n this.refreshId = setTimeout(() => {\n this.checkForNewMessages();\n }, window);\n }\n\n public getEventMessage(event: ContactEvent): ChatEvent {\n let message = null;\n switch (event.type) {\n case Events.AIRTIME_TRANSFERRED:\n message = {\n type: MessageType.Inline,\n text: renderAirtimeTransferredEvent(event as AirtimeTransferredEvent)\n };\n break;\n case Events.CALL_CREATED:\n case Events.CALL_MISSED:\n case Events.CALL_RECEIVED:\n message = {\n type: MessageType.Inline,\n text: renderCallEvent(event as CallEvent)\n };\n break;\n case Events.CHAT_STARTED:\n message = {\n type: MessageType.Inline,\n text: renderChatStartedEvent(event as ChatStartedEvent)\n };\n break;\n case Events.CONTACT_FIELD_CHANGED:\n message = {\n type: MessageType.Inline,\n text: renderUpdateEvent(event as UpdateFieldEvent)\n };\n break;\n case Events.CONTACT_GROUPS_CHANGED:\n message = {\n type: MessageType.Inline,\n text: renderContactGroupsEvent(event as ContactGroupsEvent)\n };\n break;\n case Events.CONTACT_LANGUAGE_CHANGED:\n message = {\n type: MessageType.Inline,\n text: renderContactLanguageChangedEvent(\n event as ContactLanguageChangedEvent\n )\n };\n break;\n case Events.CONTACT_NAME_CHANGED:\n message = {\n type: MessageType.Inline,\n text: renderNameChanged(event as NameChangedEvent)\n };\n break;\n case Events.CONTACT_STATUS_CHANGED:\n message = {\n type: MessageType.Inline,\n text: renderContactStatusChangedEvent(\n event as ContactStatusChangedEvent\n )\n };\n break;\n case Events.CONTACT_URNS_CHANGED:\n message = {\n type: MessageType.Inline,\n text: renderContactURNsChanged(event as URNsChangedEvent)\n };\n break;\n case Events.OPTIN_REQUESTED:\n case Events.OPTIN_STARTED:\n case Events.OPTIN_STOPPED:\n message = {\n type: MessageType.Inline,\n text: renderOptInEvent(event as OptInEvent)\n };\n break;\n case Events.RUN_STARTED:\n case Events.RUN_ENDED:\n message = {\n type: MessageType.Inline,\n text: renderRunEvent(event as RunEvent)\n };\n break;\n case Events.TICKET_ASSIGNEE_CHANGED:\n message = {\n type: MessageType.Inline,\n text: renderTicketAssigneeChanged(event as TicketEvent)\n };\n break;\n case Events.TICKET_CLOSED:\n message = {\n type: MessageType.Inline,\n text: renderTicketAction(event as TicketEvent, 'closed')\n };\n break;\n case Events.TICKET_OPENED:\n message = {\n type: MessageType.Inline,\n text: renderTicketAction(event as TicketEvent, 'opened')\n };\n break;\n case Events.TICKET_REOPENED:\n message = {\n type: MessageType.Inline,\n text: renderTicketAction(event as TicketEvent, 'reopened')\n };\n break;\n case Events.TICKET_TOPIC_CHANGED:\n message = {\n type: MessageType.Inline,\n text: html`<div>\n Topic changed to\n <strong>${(event as TicketEvent).topic.name}</strong>\n </div>`\n };\n break;\n case Events.CHANNEL_EVENT: // deprecated\n message = {\n type: MessageType.Inline,\n text: renderChannelEvent(event as ChannelEvent)\n };\n break;\n }\n\n if (message && event.created_on) {\n message.date = new Date(event.created_on);\n } else {\n console.error('Unknown event type', event);\n }\n\n if (!message.id) {\n message.id = event.uuid || event.type + '@' + event.created_on;\n }\n\n return message;\n }\n\n private getUserForEvent(event: MsgEvent | TicketEvent) {\n if (event.type === 'msg_received') {\n return {\n name: this.currentContact.name\n };\n } else if (event._user) {\n return event._user;\n } else if (event.created_by) {\n return {\n email: event.created_by.email,\n name: `${event.created_by.first_name} ${event.created_by.last_name}`.trim(),\n avatar: event.created_by.avatar\n };\n }\n return null;\n }\n\n private createMessages(page: ContactHistoryPage): ChatEvent[] {\n if (page.events) {\n let messages = [];\n page.events.forEach((event) => {\n const ts = new Date(event.created_on).getTime() * 1000;\n if (ts > this.newestEventTime) {\n this.newestEventTime = ts;\n }\n\n if (event.type === 'ticket_note_added') {\n const ticketEvent = event as TicketEvent;\n messages.push({\n type: MessageType.Note,\n id: event.created_on + event.type,\n user: this.getUserForEvent(ticketEvent),\n date: new Date(ticketEvent.created_on),\n text: ticketEvent.note\n });\n } else if (event.type === 'ticket_opened') {\n // ticket open events can have a note attached\n const ticketEvent = event as TicketEvent;\n messages.push({\n type: MessageType.Note,\n id: event.created_on + event.type + '_note',\n user: this.getUserForEvent(ticketEvent),\n date: new Date(ticketEvent.created_on),\n text: ticketEvent.note\n });\n\n // but the opening of the ticket is a normal event\n messages.push(this.getEventMessage(event));\n } else if (\n event.type === 'msg_created' ||\n event.type === 'msg_received' ||\n event.type === 'broadcast_created'\n ) {\n const msgEvent = event as MsgEvent;\n messages.push({\n id: event.uuid,\n type: msgEvent.type === 'msg_received' ? 'msg_in' : 'msg_out',\n user: this.getUserForEvent(msgEvent),\n date: new Date(msgEvent.created_on),\n attachments: msgEvent.msg.attachments,\n text: msgEvent.msg.text,\n sendError: msgEvent.status === 'E' || msgEvent.status === 'F',\n popup: html`<div\n style=\"display: flex; flex-direction: row; align-items:center; justify-content: space-between;font-size:0.9em;line-height:1em;min-width:10em\"\n >\n <div style=\"justify-content:left;text-align:left\">\n <temba-date\n value=${msgEvent.created_on}\n display=\"duration\"\n ></temba-date>\n\n ${msgEvent.optin\n ? html`<div style=\"font-size:0.9em;color:#aaa\">\n ${msgEvent.optin.name}\n </div>`\n : null}\n ${msgEvent.failed_reason_display\n ? html`\n <div\n style=\"margin-top:0.2em;margin-right: 0.5em;min-width:10em;max-width:15em;color:var(--color-error);font-size:0.9em\"\n >\n ${msgEvent.failed_reason_display}\n </div>\n `\n : null}\n </div>\n ${msgEvent.logs_url\n ? html`<a style=\"margin-left:0.5em\" href=\"${msgEvent.logs_url}\"\n ><temba-icon name=\"log\"></temba-icon\n ></a>`\n : null}\n </div> `\n });\n } else {\n messages.push(this.getEventMessage(event));\n }\n });\n\n // remove any messages we don't recognize\n messages = messages.filter((msg) => !!msg);\n return messages as ChatEvent[];\n }\n return [];\n }\n\n private checkForNewMessages() {\n // we are already working on it\n if (this.polling) {\n return;\n }\n\n const chat = this.chat;\n const contactChat = this;\n if (this.currentContact && this.newestEventTime) {\n this.polling = true;\n const endpoint = this.getEndpoint();\n if (!endpoint) {\n return;\n }\n\n const fetchContact = this.currentContact.uuid;\n\n fetchContactHistory(\n false,\n endpoint,\n this.currentTicket?.uuid,\n null,\n this.newestEventTime\n ).then((page: ContactHistoryPage) => {\n if (fetchContact === this.currentContact.uuid) {\n this.lastEventTime = page.next_before;\n const messages = this.createMessages(page);\n if (messages.length === 0) {\n contactChat.blockFetching = true;\n }\n messages.reverse();\n chat.addMessages(messages, null, true);\n }\n this.polling = false;\n this.scheduleRefresh();\n });\n }\n }\n\n private fetchPreviousMessages() {\n const chat = this.chat;\n const contactChat = this;\n if (!chat || chat.fetching || contactChat.blockFetching) {\n return;\n }\n\n chat.fetching = true;\n if (this.currentContact) {\n const endpoint = this.getEndpoint();\n if (!endpoint) {\n return;\n }\n\n fetchContactHistory(\n false,\n endpoint,\n this.currentTicket?.uuid,\n this.lastEventTime\n ).then((page: ContactHistoryPage) => {\n this.lastEventTime = page.next_before;\n const messages = this.createMessages(page);\n messages.reverse();\n\n if (messages.length === 0) {\n contactChat.blockFetching = true;\n }\n chat.addMessages(messages);\n this.scheduleRefresh();\n });\n }\n }\n\n private fetchComplete() {\n if (this.chat) {\n this.chat.fetching = false;\n }\n }\n\n private getTembaCompose(): TemplateResult {\n if (this.currentTicket) {\n if (this.currentContact && this.currentContact.status !== 'active') {\n //no chatbox for archived, blocked, or stopped contacts\n return null;\n } else {\n if (!this.currentTicket.closed_on) {\n //chatbox for active contacts with an open ticket\n return this.getCompose();\n } else {\n return null;\n }\n }\n }\n\n if (this.currentContact && this.currentContact.status !== 'active') {\n //no chatbox for archived, blocked, or stopped contacts\n return null;\n } else {\n //chatbox for active contacts\n return this.getCompose();\n }\n }\n\n private getCompose(): TemplateResult {\n return html`<div class=\"border\"></div>\n <div class=\"compose\">\n <temba-compose\n attachments\n counter\n autogrow\n shortcuts\n ?embeddedTabs=${!this.currentTicket}\n @temba-submitted=${this.handleSend.bind(this)}\n >\n </temba-compose>\n ${this.errorMessage\n ? html` <div class=\"error-gutter\">\n <div class=\"error-message\">${this.errorMessage}</div>\n <temba-button\n name=\"Retry\"\n @click=${this.handleRetry}\n ></temba-button>\n </div>`\n : null}\n </div>`;\n }\n\n private handleAssignmentChanged(evt: CustomEvent) {\n const users = evt.currentTarget as UserSelect;\n const assignee = users.values[0];\n\n this.assignTicket(assignee ? assignee.email : null);\n users.blur();\n }\n\n private handleTopicChanged(evt: CustomEvent) {\n const select = evt.target as Select<any>;\n const topic = select.values[0];\n\n if (this.currentTicket.topic.uuid !== topic.uuid) {\n postJSON(`/api/v2/ticket_actions.json`, {\n tickets: [this.currentTicket.uuid],\n action: 'change_topic',\n topic: topic.uuid\n })\n .then(() => {\n this.refreshTicket();\n })\n .catch((response: any) => {\n console.error(response);\n });\n }\n }\n\n public assignTicket(email: string) {\n // if its already assigned to use, it's a noop\n if (\n (this.currentTicket.assignee &&\n this.currentTicket.assignee.email === email) ||\n (this.currentTicket.assignee === null && email === null)\n ) {\n return;\n }\n\n postJSON(`/api/v2/ticket_actions.json`, {\n tickets: [this.currentTicket.uuid],\n action: 'assign',\n assignee: email\n })\n .then(() => {\n this.refreshTicket();\n })\n .catch((response: any) => {\n console.error(response);\n });\n return true;\n }\n\n public refreshTicket() {\n if (this.currentTicket) {\n fetchResults(`/api/v2/tickets.json?uuid=${this.currentTicket.uuid}`).then(\n (values) => {\n this.store.resolveUsers(values, ['assignee']).then(() => {\n if (values.length > 0) {\n this.fireCustomEvent(CustomEventType.TicketUpdated, {\n ticket: values[0],\n previous: this.currentTicket\n });\n this.currentTicket = values[0];\n }\n });\n }\n );\n }\n }\n\n private handleReopen() {\n const uuid = this.currentTicket.uuid;\n postJSON(`/api/v2/ticket_actions.json`, {\n tickets: [uuid],\n action: 'reopen'\n })\n .then(() => {\n this.refreshTicket();\n })\n .catch((response: any) => {\n console.error(response);\n });\n }\n\n private handleClose() {\n const uuid = this.currentTicket.uuid;\n postJSON(`/api/v2/ticket_actions.json`, {\n tickets: [uuid],\n action: 'close'\n })\n .then(() => {\n this.refreshTicket();\n })\n .catch((response: any) => {\n console.error(response);\n });\n }\n\n public render(): TemplateResult {\n const inFlow = this.currentContact && this.currentContact.flow;\n\n const inTicket = this.currentTicket;\n const ticketClosed = this.currentTicket && this.currentTicket.closed_on;\n\n return html`<div class=\"chat-wrapper\">\n ${this.currentContact\n ? html`<temba-chat\n @temba-scroll-threshold=${this.fetchPreviousMessages}\n @temba-fetch-complete=${this.fetchComplete}\n avatar=${this.avatar}\n agent\n >\n ${inFlow\n ? html`\n <div slot=\"footer\" style=\"text-align:center;\">\n <div class=\"in-flow\">\n <div class=\"flow-name\">\n <temba-icon name=\"flow\" size=\"1.2\"></temba-icon>\n <div>\n Currently in\n <a\n href=\"/flow/editor/${this.currentContact.flow\n .uuid}/\"\n >${this.currentContact.flow.name}</a\n >\n </div>\n </div>\n ${this.showInterrupt\n ? html`<temba-button\n class=\"interrupt-button\"\n destructive\n small\n @click=${this.handleInterrupt}\n name=\"Interrupt\"\n >\n </temba-button>`\n : null}\n </div>\n </div>\n `\n : null}\n <div slot=\"footer\"></div>\n </temba-chat>\n ${inTicket\n ? html`<div class=\"in-ticket-wrapper\">\n <div class=\"in-ticket\">\n <temba-user-select\n placeholder=\"Assign to..\"\n searchable\n searchOnFocus\n clearable\n .values=${this.currentTicket.assignee\n ? [this.currentTicket.assignee]\n : []}\n @change=${this.handleAssignmentChanged}\n ?disabled=${ticketClosed}\n ></temba-user-select>\n\n <temba-select\n style=\"margin:0 0.5em; flex-grow:1\"\n endpoint=\"/api/v2/topics.json\"\n searchable\n valuekey=\"uuid\"\n .values=${[this.currentTicket.topic]}\n @change=${this.handleTopicChanged}\n ?disabled=${ticketClosed}\n ></temba-select>\n\n ${this.currentTicket.closed_on\n ? html`\n <temba-button\n name=\"Reopen\"\n @click=${this.handleReopen}\n ></temba-button>\n `\n : html`\n <temba-button\n name=\"Close\"\n destructive\n @click=${this.handleClose}\n ></temba-button>\n `}\n </div>\n </div> `\n : null}\n ${this.getTembaCompose()}`\n : null}\n </div>`;\n }\n}\nexport const closeTicket = (uuid: string): Promise<WebResponse> => {\n const formData = new FormData();\n formData.append('status', 'C');\n return postUrl(`/ticket/update/${uuid}/?_format=json`, formData);\n};\nexport const fetchContact = (endpoint: string): Promise<Contact> => {\n return new Promise<Contact>((resolve, reject) => {\n fetchResults(endpoint).then((contacts: Contact[]) => {\n if (contacts && contacts.length === 1) {\n resolve(contacts[0]);\n } else {\n reject('No contact found');\n }\n });\n });\n};\nexport const fetchContactHistory = (\n reset: boolean,\n endpoint: string,\n ticket: string,\n before: number = undefined,\n after: number = undefined\n): Promise<ContactHistoryPage> => {\n if (reset) {\n pendingRequests.forEach((controller) => {\n controller.abort();\n });\n pendingRequests = [];\n }\n\n return new Promise<ContactHistoryPage>((resolve) => {\n const controller = new AbortController();\n pendingRequests.push(controller);\n\n let url = endpoint;\n if (before) {\n url += `&before=${before}`;\n }\n\n if (after) {\n url += `&after=${after}`;\n }\n\n if (ticket) {\n url += `&ticket=${ticket}`;\n }\n\n const store = document.querySelector('temba-store') as Store;\n\n getUrl(url, controller)\n .then((response: WebResponse) => {\n // on success, remove our abort controller\n pendingRequests = pendingRequests.filter(\n (controller: AbortController) => {\n return response.controller === controller;\n }\n );\n\n const page = response.json as ContactHistoryPage;\n store.resolveUsers(page.events, ['created_by']).then(() => {\n resolve(page);\n });\n })\n .catch(() => {\n // canceled\n });\n });\n};\nexport const getDisplayName = (user: User) => {\n if (!user) {\n return 'Somebody';\n }\n\n if ((user as NamedUser).name) {\n return (user as NamedUser).name;\n }\n\n if (user.first_name && user.last_name) {\n return `${user.first_name} ${user.last_name}`;\n }\n\n if (user.first_name) {\n return user.first_name;\n }\n\n return user.email;\n};\nexport let pendingRequests: AbortController[] = [];\n"]}
|
|
@@ -87,6 +87,13 @@ export class ContactDetails extends ContactStoreElement {
|
|
|
87
87
|
disabled
|
|
88
88
|
></temba-contact-field>`;
|
|
89
89
|
})}
|
|
90
|
+
${this.data.ref
|
|
91
|
+
? html `<temba-contact-field
|
|
92
|
+
name="Ref"
|
|
93
|
+
value=${this.data.ref}
|
|
94
|
+
disabled
|
|
95
|
+
></temba-contact-field>`
|
|
96
|
+
: null}
|
|
90
97
|
|
|
91
98
|
<temba-contact-field
|
|
92
99
|
name="Status"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactDetails.js","sourceRoot":"","sources":["../../../src/live/ContactDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,MAAM,GAAG;IACb,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF,MAAM,OAAO,GAAG;IACd,GAAG,EAAE,OAAO;IACZ,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,0BAA0B;IAC/B,OAAO,EAAE,SAAS;CACnB,CAAC;AAEF,MAAM,OAAO,cAAe,SAAQ,mBAAmB;IACrD,MAAM,KAAK,MAAM;QACf,OAAO,G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C,IAAI;+BACC,CAAC;YAClB,CAAC,CAAC;mBACG;YACT,CAAC,CAAC,IAAI;UACN,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAC3B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAQ,CAAC,CAAC;YACvC,CAAC;YACD,OAAO,IAAI,CAAA;mBACF,MAAM;oBACL,KAAK,CAAC,CAAC,CAAC;;kCAEM,CAAC;QAC3B,CAAC,CAAC;UACA,IAAI,CAAC,IAAI,CAAC,GAAG;YACb,CAAC,CAAC,IAAI,CAAA;;sBAEM,IAAI,CAAC,IAAI,CAAC,GAAG;;oCAEC;YAC1B,CAAC,CAAC,IAAI;;;;kBAIE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;;;UAGhC,IAAI;YACJ,CAAC,CAAC,IAAI,CAAA;;sBAEM,IAAI;;oCAEU;YAC1B,CAAC,CAAC,IAAI;;;;kBAIE,IAAI,CAAC,IAAI,CAAC,UAAU;;;;;;kBAMpB,IAAI,CAAC,IAAI,CAAC,YAAY;;;;;KAKnC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { css, html, TemplateResult } from 'lit';\nimport { ContactStoreElement } from './ContactStoreElement';\nimport { Icon } from '../Icons';\nimport { capitalize } from '../utils';\n\nconst STATUS = {\n active: 'Active',\n blocked: 'Blocked',\n stopped: 'Stopped',\n archived: 'Archived'\n};\n\nconst SCHEMES = {\n tel: 'Phone',\n whatsapp: 'WhatsApp',\n fcm: 'Firebase Cloud Messaging',\n twitter: 'Twitter'\n};\n\nexport class ContactDetails extends ContactStoreElement {\n static get styles() {\n return css`\n .urn {\n display: flex;\n padding: 0.4em 1em 0.8em 1em;\n border-bottom: 1px solid #e6e6e6;\n margin-bottom: 0.5em;\n }\n\n .urn .path {\n margin-left: 0.2em;\n }\n\n .wrapper {\n padding-top: 0em;\n }\n\n .groups {\n padding: 0.4em 0.5em 0.6em 0.5em;\n border-bottom: 1px solid #e6e6e6;\n margin-bottom: 0.4em;\n }\n .group {\n margin-right: 0.7em;\n margin-bottom: 0.7em;\n }\n\n .label {\n font-size: 0.8em;\n color: rgb(136, 136, 136);\n margin-left: 0.5em;\n margin-bottom: 0.4em;\n }\n `;\n }\n\n // Not sure if we want to include name here or not, so hold onto this for the moment\n // ${this.data.name ? html`<temba-contact-field name=\"Name\" value=${this.data.name} disabled></temba-contact-field>`:null}\n\n public render(): TemplateResult {\n if (!this.data) {\n return;\n }\n\n const lang = this.store.getLanguageName(this.data.language);\n\n return html`\n <div class=\"wrapper\">\n ${this.data.groups.length > 0\n ? html` <div class=\"groups\">\n <div class=\"label\">Groups</div>\n ${this.data.groups.map((group) => {\n return html`<temba-label\n class=\"group\"\n onclick=\"goto(event)\"\n href=\"/contact/group/${group.uuid}/\"\n icon=${group.is_dynamic ? Icon.group_smart : Icon.group}\n clickable\n >\n ${group.name}\n </temba-label>`;\n })}\n </div>`\n : null}\n ${this.data.urns.map((urn) => {\n const parts = urn.split(':');\n let scheme = SCHEMES[parts[0]];\n if (!scheme) {\n scheme = capitalize(parts[0] as any);\n }\n return html`<temba-contact-field\n name=${scheme}\n value=${parts[1]}\n disabled\n ></temba-contact-field>`;\n })}\n ${this.data.ref\n ? html`<temba-contact-field\n name=\"Ref\"\n value=${this.data.ref}\n disabled\n ></temba-contact-field>`\n : null}\n\n <temba-contact-field\n name=\"Status\"\n value=${STATUS[this.data.status]}\n disabled\n ></temba-contact-field>\n ${lang\n ? html`<temba-contact-field\n name=\"Language\"\n value=${lang}\n disabled\n ></temba-contact-field>`\n : null}\n\n <temba-contact-field\n name=\"Created\"\n value=${this.data.created_on}\n type=\"datetime\"\n disabled\n ></temba-contact-field>\n <temba-contact-field\n name=\"Last Seen\"\n value=${this.data.last_seen_on}\n type=\"datetime\"\n disabled\n ></temba-contact-field>\n </div>\n `;\n }\n}\n"]}
|
|
@@ -22,7 +22,7 @@ export class ContactNameFetch extends ContactStoreElement {
|
|
|
22
22
|
render() {
|
|
23
23
|
if (this.data) {
|
|
24
24
|
return html ` <temba-contact-name
|
|
25
|
-
name=${this.data.name || this.data.
|
|
25
|
+
name=${this.data.name || this.data.ref}
|
|
26
26
|
urn=${this.data.urns.length > 0 ? this.data.urns[0] : null}
|
|
27
27
|
></temba-contact-name>
|
|
28
28
|
<slot></slot>`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactNameFetch.js","sourceRoot":"","sources":["../../../src/live/ContactNameFetch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,OAAO,gBAAiB,SAAQ,mBAAmB;IAAzD;;QAEE,SAAI,GAAG,EAAE,CAAC;IAyBZ,CAAC;IAvBC,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;KAST,CAAC;IACJ,CAAC;IAEM,MAAM;QACX,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,OAAO,IAAI,CAAA;iBACA,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"ContactNameFetch.js","sourceRoot":"","sources":["../../../src/live/ContactNameFetch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,OAAO,gBAAiB,SAAQ,mBAAmB;IAAzD;;QAEE,SAAI,GAAG,EAAE,CAAC;IAyBZ,CAAC;IAvBC,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;KAST,CAAC;IACJ,CAAC;IAEM,MAAM;QACX,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,OAAO,IAAI,CAAA;iBACA,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG;gBAChC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;;sBAE9C,CAAC;QACnB,CAAC;QACD,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;IACxB,CAAC;CACF;AAzBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;8CACzC","sourcesContent":["import { css, html, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { ContactStoreElement } from './ContactStoreElement';\n\nexport class ContactNameFetch extends ContactStoreElement {\n @property({ type: Number, attribute: 'icon-size' })\n size = 20;\n\n static get styles() {\n return css`\n :host {\n display: flex;\n }\n\n temba-urn {\n margin-right: 0.2em;\n margin-top: 2px;\n }\n `;\n }\n\n public render(): TemplateResult {\n if (this.data) {\n return html` <temba-contact-name\n name=${this.data.name || this.data.ref}\n urn=${this.data.urns.length > 0 ? this.data.urns[0] : null}\n ></temba-contact-name>\n <slot></slot>`;\n }\n return super.render();\n }\n}\n"]}
|
|
@@ -10,15 +10,4 @@ export var WebChatIcon;
|
|
|
10
10
|
WebChatIcon["attachment_location"] = "marker-pin-01";
|
|
11
11
|
WebChatIcon["attachment_video"] = "video-recorder";
|
|
12
12
|
})(WebChatIcon || (WebChatIcon = {}));
|
|
13
|
-
export const getUserDisplay = (user) => {
|
|
14
|
-
if (user) {
|
|
15
|
-
if (user.first_name && user.last_name) {
|
|
16
|
-
return `${user.first_name} ${user.last_name}`;
|
|
17
|
-
}
|
|
18
|
-
if (user.first_name) {
|
|
19
|
-
return user.first_name;
|
|
20
|
-
}
|
|
21
|
-
return user.email;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/webchat/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/webchat/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,kCAAkC,CAAC;AAElE,sBAAsB;AACtB,MAAM,CAAN,IAAY,WAQX;AARD,WAAY,WAAW;IACrB,+BAAgB,CAAA;IAChB,uCAAwB,CAAA;IACxB,8CAA+B,CAAA;IAC/B,8CAA+B,CAAA;IAC/B,4CAA6B,CAAA;IAC7B,oDAAqC,CAAA;IACrC,kDAAmC,CAAA;AACrC,CAAC,EARW,WAAW,KAAX,WAAW,QAQtB","sourcesContent":["export const SVG_FINGERPRINT = 'febafb41c2fd60efa2bdaead993c7087';\n\n// webchat spritesheet\nexport enum WebChatIcon {\n send = 'send-03',\n attachment = 'paperclip',\n attachment_audio = 'volume-min',\n attachment_document = 'file-06',\n attachment_image = 'image-01',\n attachment_location = 'marker-pin-01',\n attachment_video = 'video-recorder'\n}\n"]}
|
|
@@ -76,33 +76,31 @@ export class NodeTest {
|
|
|
76
76
|
* 3. Simulates save and validates round-trip conversion
|
|
77
77
|
*/
|
|
78
78
|
async testNode(node, nodeUI, testName) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
});
|
|
79
|
+
var _a;
|
|
80
|
+
// Step 1: Render node in flow node
|
|
81
|
+
const flowNode = await this.renderNode(node, nodeUI);
|
|
82
|
+
// For execute_actions nodes, check for .body, for router nodes check for .router or .categories
|
|
83
|
+
const hasContent = flowNode.querySelector('.body') ||
|
|
84
|
+
flowNode.querySelector('.router') ||
|
|
85
|
+
flowNode.querySelector('.categories') ||
|
|
86
|
+
flowNode.querySelector('.action') ||
|
|
87
|
+
((_a = flowNode.textContent) === null || _a === void 0 ? void 0 : _a.trim());
|
|
88
|
+
expect(hasContent).to.exist;
|
|
89
|
+
await assertScreenshot(`nodes/${this.nodeName}/render/${testName}`, getClip(flowNode));
|
|
90
|
+
// Step 2: Open node editor
|
|
91
|
+
const nodeEditor = await this.openNodeEditor(node, nodeUI);
|
|
92
|
+
await this.assertDialogScreenshot(nodeEditor, `nodes/${this.nodeName}/editor/${testName}`);
|
|
93
|
+
// Step 3: Test round-trip conversion (simulates save workflow)
|
|
94
|
+
if (this.nodeConfig.toFormData && this.nodeConfig.fromFormData) {
|
|
95
|
+
const formData = this.nodeConfig.toFormData(node);
|
|
96
|
+
const convertedNode = this.nodeConfig.fromFormData(formData, node);
|
|
97
|
+
// Validate the round trip worked
|
|
98
|
+
expect(convertedNode.uuid).to.equal(node.uuid);
|
|
99
|
+
// Validate the converted node has expected structure
|
|
100
|
+
expect(convertedNode).to.have.property('actions');
|
|
101
|
+
expect(convertedNode).to.have.property('exits');
|
|
102
|
+
expect(convertedNode).to.deep.equal(node);
|
|
103
|
+
}
|
|
106
104
|
}
|
|
107
105
|
/**
|
|
108
106
|
* Run basic property tests
|
|
@@ -1 +1 @@
|
|
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AAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;YACnD,CAAC;YAED,4BAA4B;YAC5B,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;gBAC3B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;gBAClD,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;YAC/C,CAAC;YAED,8BAA8B;YAC9B,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;gBAC3B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YACrD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { fixture, expect } from '@open-wc/testing';\nimport { html } from 'lit';\nimport { Node } from '../src/store/flow-definition';\nimport { assertScreenshot, getClip } from './utils.test';\nimport { Editor } from '../src/flow/Editor';\nimport '../temba-modules';\n\n/**\n * Generic node test framework\n * Tests the complete node lifecycle: render → edit → save → validate\n *\n * This is the node configuration equivalent of ActionHelper.ts for action configurations.\n * It provides uniform testing for all types of nodes: simple wait nodes, router-based\n * split nodes, and complex form-configured nodes.\n */\nexport class NodeTest<T extends Node> {\n constructor(private nodeConfig: any, private nodeName: string) {}\n\n /**\n * Renders a node in the flow editor and returns the flow node\n */\n private async renderNode(node: T, nodeUI: any): Promise<HTMLElement> {\n const mockDefinition = {\n nodes: [node],\n _ui: {\n nodes: {\n [node.uuid]: {\n type: nodeUI.type,\n position: { left: 50, top: 50 },\n ...nodeUI\n }\n }\n }\n };\n\n const editor = (await fixture(html`\n <temba-flow-editor>\n <div id=\"canvas\"></div>\n </temba-flow-editor>\n `)) as Editor;\n\n (editor as any).definition = mockDefinition;\n (editor as any).canvasSize = { width: 400, height: 300 };\n await editor.updateComplete;\n\n const flowNode = editor.querySelector('temba-flow-node') as HTMLElement;\n expect(flowNode).to.exist;\n\n return flowNode;\n }\n\n /**\n * Opens the node editor for a node and returns the editor element\n */\n private async openNodeEditor(node: T, nodeUI: any): Promise<HTMLElement> {\n const nodeEditor = (await fixture(html`\n <temba-node-editor\n .node=${node}\n .nodeUI=${nodeUI}\n .isOpen=${true}\n ></temba-node-editor>\n `)) as HTMLElement;\n\n await (nodeEditor as any).updateComplete;\n\n // Wait for form data initialization if needed\n await new Promise((resolve) => setTimeout(resolve, 200));\n await (nodeEditor as any).updateComplete;\n\n expect(nodeEditor).to.exist;\n\n return nodeEditor;\n }\n\n /**\n * Takes a screenshot of the dialog container within a node editor\n */\n private async assertDialogScreenshot(\n el: HTMLElement,\n screenshotName: string\n ) {\n const dialog = el.shadowRoot\n ?.querySelector('temba-dialog')\n ?.shadowRoot?.querySelector('.dialog-container') as HTMLElement;\n await assertScreenshot(screenshotName, getClip(dialog));\n }\n\n /**\n * Complete test for a node configuration\n * 1. Renders the node in a flow node (with screenshot)\n * 2. Opens the node editor (with screenshot)\n * 3. Simulates save and validates round-trip conversion\n */\n async testNode(node: T, nodeUI: any, testName: string) {\n it(`${testName}`, async () => {\n // Step 1: Render node in flow node\n const flowNode = await this.renderNode(node, nodeUI);\n\n // For execute_actions nodes, check for .body, for router nodes check for .router or .categories\n const hasContent =\n flowNode.querySelector('.body') ||\n flowNode.querySelector('.router') ||\n flowNode.querySelector('.categories') ||\n flowNode.querySelector('.action') ||\n flowNode.textContent?.trim();\n\n expect(hasContent).to.exist;\n await assertScreenshot(\n `nodes/${this.nodeName}/render/${testName}`,\n getClip(flowNode)\n );\n\n // Step 2: Open node editor\n const nodeEditor = await this.openNodeEditor(node, nodeUI);\n await this.assertDialogScreenshot(\n nodeEditor,\n `nodes/${this.nodeName}/editor/${testName}`\n );\n\n // Step 3: Test round-trip conversion (simulates save workflow)\n if (this.nodeConfig.toFormData && this.nodeConfig.fromFormData) {\n const formData = this.nodeConfig.toFormData(node);\n const convertedNode = this.nodeConfig.fromFormData(formData, node) as T;\n\n // Validate the round trip worked\n expect(convertedNode.uuid).to.equal(node.uuid);\n\n // Validate the converted node has expected structure\n expect(convertedNode).to.have.property('actions');\n expect(convertedNode).to.have.property('exits');\n\n expect(convertedNode).to.deep.equal(node);\n }\n });\n }\n\n /**\n * Run basic property tests\n */\n testBasicProperties() {\n it('has correct basic properties', () => {\n expect(this.nodeConfig.type).to.be.a('string');\n\n // Name is optional - only some node configs have it\n if (this.nodeConfig.name) {\n expect(this.nodeConfig.name).to.be.a('string');\n }\n\n // Color is optional\n if (this.nodeConfig.color) {\n expect(this.nodeConfig.color).to.be.a('string');\n }\n\n // toFormData and fromFormData are optional - only needed for complex data transformations\n if (this.nodeConfig.toFormData) {\n expect(this.nodeConfig.toFormData).to.be.a('function');\n }\n if (this.nodeConfig.fromFormData) {\n expect(this.nodeConfig.fromFormData).to.be.a('function');\n }\n\n // Form configuration is optional\n if (this.nodeConfig.form) {\n expect(this.nodeConfig.form).to.be.an('object');\n }\n\n // Layout is optional\n if (this.nodeConfig.layout) {\n expect(this.nodeConfig.layout).to.be.an('array');\n }\n\n // Router config is optional\n if (this.nodeConfig.router) {\n expect(this.nodeConfig.router).to.be.an('object');\n expect(this.nodeConfig.router.type).to.exist;\n }\n\n // Render function is optional\n if (this.nodeConfig.render) {\n expect(this.nodeConfig.render).to.be.a('function');\n }\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"NodeHelper.js","sourceRoot":"","sources":["../../test/NodeHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,kBAAkB,C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ED,8BAA8B;YAC9B,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;gBAC3B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YACrD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { fixture, expect } from '@open-wc/testing';\nimport { html } from 'lit';\nimport { Node } from '../src/store/flow-definition';\nimport { assertScreenshot, getClip } from './utils.test';\nimport { Editor } from '../src/flow/Editor';\nimport '../temba-modules';\n\n/**\n * Generic node test framework\n * Tests the complete node lifecycle: render → edit → save → validate\n *\n * This is the node configuration equivalent of ActionHelper.ts for action configurations.\n * It provides uniform testing for all types of nodes: simple wait nodes, router-based\n * split nodes, and complex form-configured nodes.\n */\nexport class NodeTest<T extends Node> {\n constructor(private nodeConfig: any, private nodeName: string) {}\n\n /**\n * Renders a node in the flow editor and returns the flow node\n */\n private async renderNode(node: T, nodeUI: any): Promise<HTMLElement> {\n const mockDefinition = {\n nodes: [node],\n _ui: {\n nodes: {\n [node.uuid]: {\n type: nodeUI.type,\n position: { left: 50, top: 50 },\n ...nodeUI\n }\n }\n }\n };\n\n const editor = (await fixture(html`\n <temba-flow-editor>\n <div id=\"canvas\"></div>\n </temba-flow-editor>\n `)) as Editor;\n\n (editor as any).definition = mockDefinition;\n (editor as any).canvasSize = { width: 400, height: 300 };\n await editor.updateComplete;\n\n const flowNode = editor.querySelector('temba-flow-node') as HTMLElement;\n expect(flowNode).to.exist;\n\n return flowNode;\n }\n\n /**\n * Opens the node editor for a node and returns the editor element\n */\n private async openNodeEditor(node: T, nodeUI: any): Promise<HTMLElement> {\n const nodeEditor = (await fixture(html`\n <temba-node-editor\n .node=${node}\n .nodeUI=${nodeUI}\n .isOpen=${true}\n ></temba-node-editor>\n `)) as HTMLElement;\n\n await (nodeEditor as any).updateComplete;\n\n // Wait for form data initialization if needed\n await new Promise((resolve) => setTimeout(resolve, 200));\n await (nodeEditor as any).updateComplete;\n\n expect(nodeEditor).to.exist;\n\n return nodeEditor;\n }\n\n /**\n * Takes a screenshot of the dialog container within a node editor\n */\n private async assertDialogScreenshot(\n el: HTMLElement,\n screenshotName: string\n ) {\n const dialog = el.shadowRoot\n ?.querySelector('temba-dialog')\n ?.shadowRoot?.querySelector('.dialog-container') as HTMLElement;\n await assertScreenshot(screenshotName, getClip(dialog));\n }\n\n /**\n * Complete test for a node configuration\n * 1. Renders the node in a flow node (with screenshot)\n * 2. Opens the node editor (with screenshot)\n * 3. Simulates save and validates round-trip conversion\n */\n async testNode(node: T, nodeUI: any, testName: string) {\n // Step 1: Render node in flow node\n const flowNode = await this.renderNode(node, nodeUI);\n\n // For execute_actions nodes, check for .body, for router nodes check for .router or .categories\n const hasContent =\n flowNode.querySelector('.body') ||\n flowNode.querySelector('.router') ||\n flowNode.querySelector('.categories') ||\n flowNode.querySelector('.action') ||\n flowNode.textContent?.trim();\n\n expect(hasContent).to.exist;\n await assertScreenshot(\n `nodes/${this.nodeName}/render/${testName}`,\n getClip(flowNode)\n );\n\n // Step 2: Open node editor\n const nodeEditor = await this.openNodeEditor(node, nodeUI);\n await this.assertDialogScreenshot(\n nodeEditor,\n `nodes/${this.nodeName}/editor/${testName}`\n );\n\n // Step 3: Test round-trip conversion (simulates save workflow)\n if (this.nodeConfig.toFormData && this.nodeConfig.fromFormData) {\n const formData = this.nodeConfig.toFormData(node);\n const convertedNode = this.nodeConfig.fromFormData(formData, node) as T;\n\n // Validate the round trip worked\n expect(convertedNode.uuid).to.equal(node.uuid);\n\n // Validate the converted node has expected structure\n expect(convertedNode).to.have.property('actions');\n expect(convertedNode).to.have.property('exits');\n\n expect(convertedNode).to.deep.equal(node);\n }\n }\n\n /**\n * Run basic property tests\n */\n testBasicProperties() {\n it('has correct basic properties', () => {\n expect(this.nodeConfig.type).to.be.a('string');\n\n // Name is optional - only some node configs have it\n if (this.nodeConfig.name) {\n expect(this.nodeConfig.name).to.be.a('string');\n }\n\n // Color is optional\n if (this.nodeConfig.color) {\n expect(this.nodeConfig.color).to.be.a('string');\n }\n\n // toFormData and fromFormData are optional - only needed for complex data transformations\n if (this.nodeConfig.toFormData) {\n expect(this.nodeConfig.toFormData).to.be.a('function');\n }\n if (this.nodeConfig.fromFormData) {\n expect(this.nodeConfig.fromFormData).to.be.a('function');\n }\n\n // Form configuration is optional\n if (this.nodeConfig.form) {\n expect(this.nodeConfig.form).to.be.an('object');\n }\n\n // Layout is optional\n if (this.nodeConfig.layout) {\n expect(this.nodeConfig.layout).to.be.an('array');\n }\n\n // Router config is optional\n if (this.nodeConfig.router) {\n expect(this.nodeConfig.router).to.be.an('object');\n expect(this.nodeConfig.router.type).to.exist;\n }\n\n // Render function is optional\n if (this.nodeConfig.render) {\n expect(this.nodeConfig.render).to.be.a('function');\n }\n });\n }\n}\n"]}
|
|
@@ -165,10 +165,18 @@ describe('split_by_llm node config', () => {
|
|
|
165
165
|
type: 'split_by_llm',
|
|
166
166
|
position: { left: 50, top: 50 }
|
|
167
167
|
};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
it('renders translation task', async () => {
|
|
169
|
+
await helper.testNode(createTestNode({ uuid: 'gpt-4', name: 'GPT 4.1' }, 'Translate to French'), nodeUI, 'translation-task');
|
|
170
|
+
});
|
|
171
|
+
it('renders sentiment analysis', async () => {
|
|
172
|
+
await helper.testNode(createTestNode({ uuid: 'gpt-5', name: 'GPT 5' }, 'Analyze the sentiment of the following message and classify it as positive, negative, or neutral. Provide a brief explanation for your classification.'), nodeUI, 'sentiment-analysis');
|
|
173
|
+
});
|
|
174
|
+
it('renders summarization', async () => {
|
|
175
|
+
await helper.testNode(createTestNode({ uuid: 'gpt-4', name: 'GPT 4.1' }, 'Summarize the key points from the conversation above in bullet format.'), nodeUI, 'summarization');
|
|
176
|
+
});
|
|
177
|
+
it('renders information extraction', async () => {
|
|
178
|
+
await helper.testNode(createTestNode({ uuid: 'gpt-5', name: 'GPT 5' }, 'Extract any contact information (phone numbers, email addresses) from the text and format them as a JSON object.'), nodeUI, 'information-extraction');
|
|
179
|
+
});
|
|
172
180
|
});
|
|
173
181
|
});
|
|
174
182
|
//# sourceMappingURL=split_by_llm.test.js.map
|