@meetelise/chat 1.35.0 → 1.35.1
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/dist/src/MyPubnub.d.ts +116 -0
- package/dist/src/WebComponent/FeeCalculator/components/addons/addon-item-matrix-qty-selector/addon-item-matrix-qty-selector-styles.d.ts +2 -0
- package/dist/src/WebComponent/FeeCalculator/components/addons/addon-item-matrix-qty-selector/addon-item-matrix-qty-selector.d.ts +28 -0
- package/dist/src/WebComponent/FeeCalculator/components/addons/addon-item-qty-selector/addon-item-qty-selector-styles.d.ts +2 -0
- package/dist/src/WebComponent/FeeCalculator/components/addons/addon-item-qty-selector/addon-item-qty-selector.d.ts +18 -0
- package/dist/src/WebComponent/FeeCalculator/components/addons/common-addon-styles.d.ts +2 -0
- package/dist/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector-styles.d.ts +2 -0
- package/dist/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector.d.ts +22 -0
- package/dist/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout-styles.d.ts +2 -0
- package/dist/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout.d.ts +46 -0
- package/dist/src/WebComponent/FeeCalculator/components/fee-card/fee-card-styles.d.ts +2 -0
- package/dist/src/WebComponent/FeeCalculator/components/fee-card/fee-card.d.ts +21 -0
- package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.d.ts +2 -0
- package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item.d.ts +13 -0
- package/dist/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.d.ts +2 -0
- package/dist/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.d.ts +34 -0
- package/dist/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card-styles.d.ts +2 -0
- package/dist/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card.d.ts +18 -0
- package/dist/src/WebComponent/FeeCalculator/components/incentive-banner/incentive-banner-styles.d.ts +1 -0
- package/dist/src/WebComponent/FeeCalculator/components/incentive-banner/incentive-banner.d.ts +8 -0
- package/dist/src/WebComponent/FeeCalculator/components/incentive-banner/index.d.ts +1 -0
- package/dist/src/WebComponent/FeeCalculator/components/index.d.ts +5 -0
- package/dist/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.d.ts +2 -0
- package/dist/src/WebComponent/FeeCalculator/components/promo-card/promo-card.d.ts +13 -0
- package/dist/src/WebComponent/FeeCalculator/constants.d.ts +3 -0
- package/dist/src/WebComponent/FeeCalculator/fee-calculator-styles.d.ts +1 -0
- package/dist/src/WebComponent/FeeCalculator/fee-calculator.d.ts +55 -0
- package/dist/src/WebComponent/FeeCalculator/index.d.ts +2 -0
- package/dist/src/WebComponent/FeeCalculator/model/building-fee-view.d.ts +41 -0
- package/dist/src/WebComponent/FeeCalculator/model/building-fee.d.ts +82 -0
- package/dist/src/WebComponent/FeeCalculator/model/desired-addon.d.ts +5 -0
- package/dist/src/WebComponent/FeeCalculator/model/desired-rentable-item.d.ts +4 -0
- package/dist/src/WebComponent/FeeCalculator/model/index.d.ts +13 -0
- package/dist/src/WebComponent/FeeCalculator/model/item-combination.d.ts +6 -0
- package/dist/src/WebComponent/FeeCalculator/model/item-quantity.d.ts +4 -0
- package/dist/src/WebComponent/FeeCalculator/model/pricing-matrix.d.ts +18 -0
- package/dist/src/WebComponent/FeeCalculator/model/pricing-rule.d.ts +8 -0
- package/dist/src/WebComponent/FeeCalculator/model/rent-frequency.d.ts +1 -0
- package/dist/src/WebComponent/FeeCalculator/model/rentable-item-summary.d.ts +9 -0
- package/dist/src/WebComponent/FeeCalculator/model/rentable-item.d.ts +9 -0
- package/dist/src/WebComponent/FeeCalculator/model/transaction-category.d.ts +23 -0
- package/dist/src/WebComponent/FeeCalculator/model/unit-fee-bundle.d.ts +31 -0
- package/dist/src/WebComponent/LeadSourceClient.d.ts +46 -0
- package/dist/src/WebComponent/OfficeHours.d.ts +21 -0
- package/dist/src/WebComponent/Scheduler/date-picker.d.ts +28 -0
- package/dist/src/WebComponent/Scheduler/time-picker.d.ts +16 -0
- package/dist/src/WebComponent/Scheduler/tour-scheduler.d.ts +102 -0
- package/dist/src/WebComponent/Scheduler/tour-type-option.d.ts +13 -0
- package/dist/src/WebComponent/Scheduler/tourSchedulerStyles.d.ts +1 -0
- package/dist/src/WebComponent/actions/InputStyles.d.ts +1 -0
- package/dist/src/WebComponent/actions/action-confirm-button.d.ts +13 -0
- package/dist/src/WebComponent/actions/call-us-window.d.ts +37 -0
- package/dist/src/WebComponent/actions/collapse-expand-button.d.ts +8 -0
- package/dist/src/WebComponent/actions/details-window.d.ts +14 -0
- package/dist/src/WebComponent/actions/email-us-window.d.ts +46 -0
- package/dist/src/WebComponent/actions/formatPhoneNumber.d.ts +17 -0
- package/dist/src/WebComponent/actions/minimize-expand-button.d.ts +8 -0
- package/dist/src/WebComponent/chat-additional-actions.d.ts +28 -0
- package/dist/src/WebComponent/health-chat.d.ts +47 -0
- package/dist/src/WebComponent/healthchat-styles.d.ts +1 -0
- package/dist/src/WebComponent/icons/ApplyOutlineIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/BookTourOutlineIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/CalculatorOutlineIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/ChatOutlineIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/ChevronLeftIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/ChevronRightIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/ContactResidentIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/DollarOutlineIcon.d.ts +7 -0
- package/dist/src/WebComponent/icons/EmailOutlineIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/HeyThereEmojiIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/PhoneOutlineIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/SendMessageIcon.d.ts +3 -0
- package/dist/src/WebComponent/icons/TourSelfGuidedIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/TourVirtuallyIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/TourWithAgentIcon.d.ts +2 -0
- package/dist/src/WebComponent/icons/XOutlineIcon.d.ts +2 -0
- package/dist/src/WebComponent/index.d.ts +2 -0
- package/dist/src/WebComponent/launcher/Launcher.d.ts +99 -0
- package/dist/src/WebComponent/launcher/launcherStyles.d.ts +1 -0
- package/dist/src/WebComponent/launcher/mobile-launcher.d.ts +27 -0
- package/dist/src/WebComponent/launcher/typeEmojiStyles.d.ts +1 -0
- package/dist/src/WebComponent/launcher/typeMiniStyles.d.ts +1 -0
- package/dist/src/WebComponent/launcher/typeMobileStyles.d.ts +1 -0
- package/dist/src/WebComponent/leasing-chat-styles.d.ts +1 -0
- package/dist/src/WebComponent/loaders/index.d.ts +4 -0
- package/dist/src/WebComponent/loaders/mega-loader.d.ts +7 -0
- package/dist/src/WebComponent/loaders/skeleton-card.d.ts +12 -0
- package/dist/src/WebComponent/loaders/skeleton-loader-styles.d.ts +3 -0
- package/dist/src/WebComponent/loaders/skeleton-loader.d.ts +13 -0
- package/dist/src/WebComponent/me-chat.d.ts +91 -0
- package/dist/src/WebComponent/me-select.d.ts +24 -0
- package/dist/src/WebComponent/mini-loader.d.ts +5 -0
- package/dist/src/WebComponent/pubnub-chat-styles.d.ts +1 -0
- package/dist/src/WebComponent/pubnub-chat.d.ts +48 -0
- package/dist/src/WebComponent/pubnub-media.d.ts +14 -0
- package/dist/src/WebComponent/pubnub-message-styles.d.ts +1 -0
- package/dist/src/WebComponent/pubnub-message.d.ts +39 -0
- package/dist/src/WebComponent/simple-launcher/simple-launcher-styles.d.ts +1 -0
- package/dist/src/WebComponent/simple-launcher/simple-launcher.d.ts +12 -0
- package/dist/src/WebComponent/utilities-chat.d.ts +47 -0
- package/dist/src/WebComponent/utilities-styles.d.ts +1 -0
- package/dist/src/WebComponent/utils.d.ts +31 -0
- package/dist/src/analytics.d.ts +64 -0
- package/dist/src/disclaimers.d.ts +16 -0
- package/dist/src/fetchBuildingABTestType.d.ts +8 -0
- package/dist/src/fetchBuildingInfo.d.ts +58 -0
- package/dist/src/fetchBuildingWebchatView.d.ts +124 -0
- package/dist/src/fetchFeatureFlag.d.ts +14 -0
- package/dist/src/fetchLeadSources.d.ts +4 -0
- package/dist/src/fetchPhoneNumberFromSource.d.ts +6 -0
- package/dist/src/getAvailabilities.d.ts +46 -0
- package/dist/src/getBuildingPhoneNumber.d.ts +1 -0
- package/dist/src/getShouldAllowScheduling.d.ts +1 -0
- package/dist/src/getShouldShowWebchat.d.ts +3 -0
- package/dist/src/getTimezoneString.d.ts +1 -0
- package/dist/src/globals.d.ts +2 -0
- package/dist/src/gtm.d.ts +6 -0
- package/dist/src/handleChatId.d.ts +11 -0
- package/dist/src/insertDNIIntoWebsite.d.ts +5 -0
- package/dist/src/insertLeadSourceIntoSchedulerLinks.d.ts +4 -0
- package/dist/src/main/MEChat.d.ts +74 -0
- package/dist/src/main/utils.d.ts +2 -0
- package/dist/src/postLeadSources.d.ts +3 -0
- package/dist/src/rentgrata.d.ts +4 -0
- package/dist/src/replaceSelectButtonsWithNewLink.d.ts +5 -0
- package/dist/src/services/fees/calculateQuote.d.ts +14 -0
- package/dist/src/services/fees/fetchBuildingFeesV2.d.ts +10 -0
- package/dist/src/services/fees/fetchBuildingUnits.d.ts +29 -0
- package/dist/src/services/fees/utils.d.ts +1 -0
- package/dist/src/svgIcons.d.ts +5 -0
- package/dist/src/themes.d.ts +5 -0
- package/dist/src/types/incentive-v2.d.ts +23 -0
- package/dist/src/types/rest-sdk.types.d.ts +11 -0
- package/dist/src/types/webchat-no-show-reason.d.ts +1 -0
- package/dist/src/utils/getWidgetOverrides.d.ts +39 -0
- package/dist/src/utils/queryParamBuilder.d.ts +8 -0
- package/dist/src/utils.d.ts +13 -0
- package/package.json +1 -1
- package/src/MyPubnub.ts +792 -0
- package/src/WebComponent/FeeCalculator/components/addons/addon-item-matrix-qty-selector/addon-item-matrix-qty-selector-styles.ts +35 -0
- package/src/WebComponent/FeeCalculator/components/addons/addon-item-matrix-qty-selector/addon-item-matrix-qty-selector.ts +206 -0
- package/src/WebComponent/FeeCalculator/components/addons/addon-item-qty-selector/addon-item-qty-selector-styles.ts +6 -0
- package/src/WebComponent/FeeCalculator/components/addons/addon-item-qty-selector/addon-item-qty-selector.ts +101 -0
- package/src/WebComponent/FeeCalculator/components/addons/common-addon-styles.ts +82 -0
- package/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector-styles.ts +9 -0
- package/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector.ts +124 -0
- package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout-styles.ts +142 -0
- package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout.ts +243 -0
- package/src/WebComponent/FeeCalculator/components/fee-card/fee-card-styles.ts +65 -0
- package/src/WebComponent/FeeCalculator/components/fee-card/fee-card.ts +91 -0
- package/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.ts +44 -0
- package/src/WebComponent/FeeCalculator/components/fee-item/fee-item.ts +38 -0
- package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.ts +151 -0
- package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.ts +248 -0
- package/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card-styles.ts +82 -0
- package/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card.ts +76 -0
- package/src/WebComponent/FeeCalculator/components/incentive-banner/incentive-banner-styles.ts +40 -0
- package/src/WebComponent/FeeCalculator/components/incentive-banner/incentive-banner.ts +43 -0
- package/src/WebComponent/FeeCalculator/components/incentive-banner/index.ts +1 -0
- package/src/WebComponent/FeeCalculator/components/index.ts +5 -0
- package/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.ts +39 -0
- package/src/WebComponent/FeeCalculator/components/promo-card/promo-card.ts +39 -0
- package/src/WebComponent/FeeCalculator/constants.ts +5 -0
- package/src/WebComponent/FeeCalculator/fee-calculator-styles.ts +310 -0
- package/src/WebComponent/FeeCalculator/fee-calculator.ts +341 -0
- package/src/WebComponent/FeeCalculator/index.ts +4 -0
- package/src/WebComponent/FeeCalculator/model/building-fee-view.ts +84 -0
- package/src/WebComponent/FeeCalculator/model/building-fee.ts +126 -0
- package/src/WebComponent/FeeCalculator/model/desired-addon.ts +6 -0
- package/src/WebComponent/FeeCalculator/model/desired-rentable-item.ts +4 -0
- package/src/WebComponent/FeeCalculator/model/index.ts +13 -0
- package/src/WebComponent/FeeCalculator/model/item-combination.ts +16 -0
- package/src/WebComponent/FeeCalculator/model/item-quantity.ts +4 -0
- package/src/WebComponent/FeeCalculator/model/pricing-matrix.ts +45 -0
- package/src/WebComponent/FeeCalculator/model/pricing-rule.ts +9 -0
- package/src/WebComponent/FeeCalculator/model/rent-frequency.ts +1 -0
- package/src/WebComponent/FeeCalculator/model/rentable-item-summary.ts +10 -0
- package/src/WebComponent/FeeCalculator/model/rentable-item.ts +10 -0
- package/src/WebComponent/FeeCalculator/model/transaction-category.ts +23 -0
- package/src/WebComponent/FeeCalculator/model/unit-fee-bundle.ts +54 -0
- package/src/WebComponent/LeadSourceClient.ts +332 -0
- package/src/WebComponent/MEChat.css +5 -0
- package/src/WebComponent/OfficeHours.ts +73 -0
- package/src/WebComponent/Scheduler/date-picker.ts +405 -0
- package/src/WebComponent/Scheduler/time-picker.ts +195 -0
- package/src/WebComponent/Scheduler/tour-scheduler.ts +1430 -0
- package/src/WebComponent/Scheduler/tour-type-option.ts +112 -0
- package/src/WebComponent/Scheduler/tourSchedulerStyles.ts +418 -0
- package/src/WebComponent/actions/InputStyles.ts +57 -0
- package/src/WebComponent/actions/action-confirm-button.ts +125 -0
- package/src/WebComponent/actions/call-us-window.ts +467 -0
- package/src/WebComponent/actions/collapse-expand-button.ts +65 -0
- package/src/WebComponent/actions/details-window.ts +150 -0
- package/src/WebComponent/actions/email-us-window.ts +556 -0
- package/src/WebComponent/actions/formatPhoneNumber.ts +72 -0
- package/src/WebComponent/actions/minimize-expand-button.ts +93 -0
- package/src/WebComponent/chat-additional-actions.ts +135 -0
- package/src/WebComponent/health-chat.ts +270 -0
- package/src/WebComponent/healthchat-styles.ts +119 -0
- package/src/WebComponent/icons/ApplyOutlineIcon.ts +22 -0
- package/src/WebComponent/icons/BookTourOutlineIcon.ts +13 -0
- package/src/WebComponent/icons/CalculatorOutlineIcon.ts +22 -0
- package/src/WebComponent/icons/ChatOutlineIcon.ts +10 -0
- package/src/WebComponent/icons/ChevronLeftIcon.ts +7 -0
- package/src/WebComponent/icons/ChevronRightIcon.ts +7 -0
- package/src/WebComponent/icons/ContactResidentIcon.ts +9 -0
- package/src/WebComponent/icons/DollarOutlineIcon.ts +26 -0
- package/src/WebComponent/icons/EmailOutlineIcon.ts +7 -0
- package/src/WebComponent/icons/HeyThereEmojiIcon.ts +12 -0
- package/src/WebComponent/icons/PhoneOutlineIcon.ts +7 -0
- package/src/WebComponent/icons/SendMessageIcon.ts +17 -0
- package/src/WebComponent/icons/TourSelfGuidedIcon.ts +17 -0
- package/src/WebComponent/icons/TourVirtuallyIcon.ts +17 -0
- package/src/WebComponent/icons/TourWithAgentIcon.ts +17 -0
- package/src/WebComponent/icons/XOutlineIcon.ts +8 -0
- package/src/WebComponent/index.ts +2 -0
- package/src/WebComponent/launcher/Launcher.ts +1284 -0
- package/src/WebComponent/launcher/launcherStyles.ts +500 -0
- package/src/WebComponent/launcher/mobile-launcher.ts +162 -0
- package/src/WebComponent/launcher/typeEmojiStyles.ts +161 -0
- package/src/WebComponent/launcher/typeMiniStyles.ts +60 -0
- package/src/WebComponent/launcher/typeMobileStyles.ts +50 -0
- package/src/WebComponent/leasing-chat-styles.ts +114 -0
- package/src/WebComponent/loaders/index.ts +7 -0
- package/src/WebComponent/loaders/mega-loader.ts +36 -0
- package/src/WebComponent/loaders/skeleton-card.ts +31 -0
- package/src/WebComponent/loaders/skeleton-loader-styles.ts +112 -0
- package/src/WebComponent/loaders/skeleton-loader.ts +34 -0
- package/src/WebComponent/me-chat.ts +1264 -0
- package/src/WebComponent/me-select.ts +322 -0
- package/src/WebComponent/mini-loader.ts +28 -0
- package/src/WebComponent/pubnub-chat-styles.ts +204 -0
- package/src/WebComponent/pubnub-chat.ts +771 -0
- package/src/WebComponent/pubnub-media.ts +208 -0
- package/src/WebComponent/pubnub-message-styles.ts +54 -0
- package/src/WebComponent/pubnub-message.ts +431 -0
- package/src/WebComponent/simple-launcher/simple-launcher-styles.ts +34 -0
- package/src/WebComponent/simple-launcher/simple-launcher.ts +100 -0
- package/src/WebComponent/utilities-chat.ts +270 -0
- package/src/WebComponent/utilities-styles.ts +110 -0
- package/src/WebComponent/utils.ts +82 -0
- package/src/analytics.ts +217 -0
- package/src/assetUrls.ts +6 -0
- package/src/disclaimers.ts +301 -0
- package/src/fetchBuildingABTestType.ts +21 -0
- package/src/fetchBuildingInfo.ts +88 -0
- package/src/fetchBuildingWebchatView.ts +176 -0
- package/src/fetchFeatureFlag.ts +250 -0
- package/src/fetchLeadSources.ts +98 -0
- package/src/fetchPhoneNumberFromSource.ts +31 -0
- package/src/fetchWebchatPreferences.ts +54 -0
- package/src/getAvailabilities.ts +189 -0
- package/src/getBuildingPhoneNumber.ts +26 -0
- package/src/getShouldAllowScheduling.ts +16 -0
- package/src/getShouldShowWebchat.ts +114 -0
- package/src/getTimezoneString.ts +40 -0
- package/src/globals.ts +3 -0
- package/src/gtm.ts +17 -0
- package/src/handleChatId.ts +101 -0
- package/src/insertDNIIntoWebsite.ts +146 -0
- package/src/insertLeadSourceIntoSchedulerLinks.ts +71 -0
- package/src/main/MEChat.test.ts +110 -0
- package/src/main/MEChat.ts +404 -0
- package/src/main/utils.ts +70 -0
- package/src/postLeadSources.ts +44 -0
- package/src/rentgrata.ts +74 -0
- package/src/replaceSelectButtonsWithNewLink.ts +91 -0
- package/src/services/fees/calculateQuote.ts +74 -0
- package/src/services/fees/fetchBuildingFees.ts +50 -0
- package/src/services/fees/fetchBuildingFeesV2.ts +56 -0
- package/src/services/fees/fetchBuildingFloorplans.ts +74 -0
- package/src/services/fees/fetchBuildingUnits.ts +86 -0
- package/src/services/fees/utils.ts +4 -0
- package/src/svgIcons.ts +14 -0
- package/src/themes.ts +65 -0
- package/src/types/incentive-v2.ts +24 -0
- package/src/types/rest-sdk.types.ts +13 -0
- package/src/types/webchat-no-show-reason.ts +6 -0
- package/src/utils/getWidgetOverrides.ts +91 -0
- package/src/utils/queryParamBuilder.ts +28 -0
- package/src/utils.ts +121 -0
|
@@ -0,0 +1,771 @@
|
|
|
1
|
+
import { html, LitElement, TemplateResult } from "lit";
|
|
2
|
+
import { customElement, property, query, state } from "lit/decorators.js";
|
|
3
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
4
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
5
|
+
import { Building } from "../fetchBuildingInfo";
|
|
6
|
+
import MyPubnub, {
|
|
7
|
+
SimpleMessageTypes,
|
|
8
|
+
SimpleChatMessage,
|
|
9
|
+
isSimpleMediaChatMessage,
|
|
10
|
+
isSimpleTextChatMessage,
|
|
11
|
+
} from "../MyPubnub";
|
|
12
|
+
import {
|
|
13
|
+
defaultPrimaryColor,
|
|
14
|
+
hexToAlmostWhite,
|
|
15
|
+
defaultBackgroundColor,
|
|
16
|
+
shouldUsePrimaryColorForChatFooter,
|
|
17
|
+
} from "../themes";
|
|
18
|
+
import { isMobile } from "../utils";
|
|
19
|
+
import { InputStyles } from "./actions/InputStyles";
|
|
20
|
+
import { healthChatStyles } from "./healthchat-styles";
|
|
21
|
+
import { leasingChatStyles } from "./leasing-chat-styles";
|
|
22
|
+
import { pubnubChatStyles } from "./pubnub-chat-styles";
|
|
23
|
+
import "./pubnub-message";
|
|
24
|
+
import "./pubnub-media";
|
|
25
|
+
import classNames from "classnames";
|
|
26
|
+
import { differenceInDays } from "date-fns";
|
|
27
|
+
import { WidgetType } from "../main/MEChat";
|
|
28
|
+
import { utiltiesChatStyles } from "./utilities-styles";
|
|
29
|
+
import { XOutlineIcon } from "./icons/XOutlineIcon";
|
|
30
|
+
import {
|
|
31
|
+
SendMessageLargeIcon,
|
|
32
|
+
SendMessageMediumIcon,
|
|
33
|
+
} from "./icons/SendMessageIcon";
|
|
34
|
+
import {
|
|
35
|
+
inChatThreadDisclaimer,
|
|
36
|
+
CURRENT_CONSENT_ID,
|
|
37
|
+
getConsentPreChatDisclaimer,
|
|
38
|
+
} from "../disclaimers";
|
|
39
|
+
|
|
40
|
+
@customElement("pubnub-chat")
|
|
41
|
+
export class PubnubChat extends LitElement {
|
|
42
|
+
static styles = [
|
|
43
|
+
InputStyles,
|
|
44
|
+
pubnubChatStyles,
|
|
45
|
+
leasingChatStyles,
|
|
46
|
+
healthChatStyles,
|
|
47
|
+
utiltiesChatStyles,
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
@property({ type: Number })
|
|
51
|
+
private right = undefined;
|
|
52
|
+
|
|
53
|
+
@property({ type: Number })
|
|
54
|
+
private bottom = undefined;
|
|
55
|
+
|
|
56
|
+
@property({ type: Number })
|
|
57
|
+
private top = undefined;
|
|
58
|
+
|
|
59
|
+
@property({ type: Number })
|
|
60
|
+
private left = undefined;
|
|
61
|
+
|
|
62
|
+
@property({ attribute: true })
|
|
63
|
+
onMount: () => void = () => ({});
|
|
64
|
+
|
|
65
|
+
@property({ attribute: true })
|
|
66
|
+
channel: string | undefined;
|
|
67
|
+
|
|
68
|
+
@property({ attribute: true })
|
|
69
|
+
isHealthChat = false;
|
|
70
|
+
|
|
71
|
+
@property({ attribute: true })
|
|
72
|
+
myPubnub: MyPubnub | undefined;
|
|
73
|
+
|
|
74
|
+
@property({ attribute: true })
|
|
75
|
+
orgSlug: string | undefined;
|
|
76
|
+
|
|
77
|
+
@property({ attribute: true })
|
|
78
|
+
buildingSlug: string | undefined;
|
|
79
|
+
|
|
80
|
+
@property({ attribute: true })
|
|
81
|
+
widgetType: WidgetType = WidgetType.Default;
|
|
82
|
+
|
|
83
|
+
@property({ attribute: true })
|
|
84
|
+
building: Building | undefined;
|
|
85
|
+
|
|
86
|
+
@property({ attribute: true })
|
|
87
|
+
primaryColor: string = defaultPrimaryColor;
|
|
88
|
+
|
|
89
|
+
@property({ attribute: true })
|
|
90
|
+
backgroundColor: string = defaultBackgroundColor;
|
|
91
|
+
|
|
92
|
+
@property({ attribute: true })
|
|
93
|
+
onClickExit: () => void = () => {
|
|
94
|
+
localStorage.setItem("isChatOpen", "false");
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
@property({ attribute: true })
|
|
98
|
+
requiresConsent = false;
|
|
99
|
+
|
|
100
|
+
@query("#message-input", true)
|
|
101
|
+
messageInput!: HTMLTextAreaElement;
|
|
102
|
+
|
|
103
|
+
@query("#conversation-body", true)
|
|
104
|
+
messageBody!: HTMLDivElement;
|
|
105
|
+
|
|
106
|
+
@state()
|
|
107
|
+
messages: SimpleChatMessage[] = [];
|
|
108
|
+
|
|
109
|
+
@state()
|
|
110
|
+
isLoadingMessages = false;
|
|
111
|
+
|
|
112
|
+
@state()
|
|
113
|
+
hasReceivedConsent = false;
|
|
114
|
+
|
|
115
|
+
@state()
|
|
116
|
+
privacyPolicyUrl = "http://bit.ly/me_privacy_policy";
|
|
117
|
+
|
|
118
|
+
@state()
|
|
119
|
+
websitePreviewMapping: {
|
|
120
|
+
[messageId: string]: {
|
|
121
|
+
title: string | null;
|
|
122
|
+
description: string | null;
|
|
123
|
+
image: string | null;
|
|
124
|
+
favicon: string | null;
|
|
125
|
+
isLoading: boolean;
|
|
126
|
+
}[];
|
|
127
|
+
} = {};
|
|
128
|
+
|
|
129
|
+
get consentKey(): string {
|
|
130
|
+
return `${this.orgSlug}Consent`;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
sendMessage = async (message: string): Promise<void> => {
|
|
134
|
+
if (message.length === 0) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
this.messageInput.value = "";
|
|
138
|
+
this.autoResizeMessageInput();
|
|
139
|
+
|
|
140
|
+
// The first message triggers a channel creation which can take a few seconds,
|
|
141
|
+
// so we immediately add the message to the UI to avoid a delay.
|
|
142
|
+
if (this.messages.length === 0) {
|
|
143
|
+
this.messages = [
|
|
144
|
+
{
|
|
145
|
+
timestamp: 0,
|
|
146
|
+
message,
|
|
147
|
+
isLeadMessage: true,
|
|
148
|
+
chunks: [{ text: message, order: 0, isDone: true }],
|
|
149
|
+
type: SimpleMessageTypes.text,
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
await this.myPubnub?.sendMessage(message);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
firstUpdated(): void {
|
|
157
|
+
this.messages = this.myPubnub?.simpleChatMessages || [];
|
|
158
|
+
this.myPubnub?.addChatListener(
|
|
159
|
+
(response: { messages: SimpleChatMessage[]; isLoading: boolean }) => {
|
|
160
|
+
this.messages = response.messages;
|
|
161
|
+
this.isLoadingMessages = response.isLoading;
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
this.onMount();
|
|
165
|
+
|
|
166
|
+
const rawConsentData = localStorage.getItem(this.consentKey);
|
|
167
|
+
if (!rawConsentData) {
|
|
168
|
+
this.hasReceivedConsent = false;
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const parsedConsentData = JSON.parse(rawConsentData);
|
|
172
|
+
const { timestamp, consentId } = parsedConsentData;
|
|
173
|
+
const ageInDays = differenceInDays(new Date(), new Date(timestamp));
|
|
174
|
+
const isConsentValid = ageInDays < 7;
|
|
175
|
+
const isConsentIdCurrent = consentId === CURRENT_CONSENT_ID;
|
|
176
|
+
if (isConsentValid && isConsentIdCurrent) {
|
|
177
|
+
this.hasReceivedConsent = true;
|
|
178
|
+
} else {
|
|
179
|
+
this.hasReceivedConsent = false;
|
|
180
|
+
localStorage.removeItem(this.consentKey);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
scrollToChatBottom = (): void => {
|
|
185
|
+
this.messageBody.scrollTo({
|
|
186
|
+
top: this.messageBody.scrollHeight - this.messageBody.clientHeight,
|
|
187
|
+
behavior: "smooth",
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
async updated(): Promise<void> {
|
|
192
|
+
this.scrollToChatBottom();
|
|
193
|
+
try {
|
|
194
|
+
const modal = document.getElementById("#healthchat-container");
|
|
195
|
+
if (!modal) return;
|
|
196
|
+
modal.focus();
|
|
197
|
+
} catch (e) {
|
|
198
|
+
// eslint-disable-next-line no-console
|
|
199
|
+
console.error(e);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
autoResizeMessageInput = (): void => {
|
|
204
|
+
this.messageInput.style.height = "auto";
|
|
205
|
+
this.messageInput.style.height = this.messageInput.scrollHeight + "px";
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
needsConsent = (): boolean => {
|
|
209
|
+
return this.requiresConsent && !this.hasReceivedConsent;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
render(): TemplateResult {
|
|
213
|
+
if (!this.buildingSlug) {
|
|
214
|
+
return html``; // error should be here
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const buildingId = this.building?.id;
|
|
218
|
+
let styles = {};
|
|
219
|
+
if (isMobile()) {
|
|
220
|
+
styles = {
|
|
221
|
+
top: undefined,
|
|
222
|
+
bottom: 0,
|
|
223
|
+
left: undefined,
|
|
224
|
+
right: 0,
|
|
225
|
+
};
|
|
226
|
+
} else {
|
|
227
|
+
styles = {
|
|
228
|
+
top:
|
|
229
|
+
this.top !== undefined && !isNaN(this.top)
|
|
230
|
+
? `${this.top}px`
|
|
231
|
+
: undefined,
|
|
232
|
+
bottom:
|
|
233
|
+
this.bottom !== undefined && !isNaN(this.bottom)
|
|
234
|
+
? `${this.bottom}px`
|
|
235
|
+
: "130px",
|
|
236
|
+
left:
|
|
237
|
+
this.left !== undefined && !isNaN(this.left)
|
|
238
|
+
? `${this.left}px`
|
|
239
|
+
: undefined,
|
|
240
|
+
right:
|
|
241
|
+
this.right !== undefined && !isNaN(this.right)
|
|
242
|
+
? `${this.right}px`
|
|
243
|
+
: "18px",
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* This chat window uses 'Poppins' as its font, but https://www.120ninthst.com/ seemingly installs a 'Poppins' font that is
|
|
248
|
+
* not the same as the Google Font 'Poppins'. This causes the chat window to look different from the rest of the website. This
|
|
249
|
+
* is a special case/hack to just change to a system default font for this building.
|
|
250
|
+
*/
|
|
251
|
+
if (buildingId === 22320) {
|
|
252
|
+
styles = {
|
|
253
|
+
...styles,
|
|
254
|
+
fontFamily: `"Helvetica Neue", Arial`,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (this.widgetType === WidgetType.Utilities) {
|
|
259
|
+
return html`
|
|
260
|
+
<div
|
|
261
|
+
id="utilities-container"
|
|
262
|
+
class=${classMap({
|
|
263
|
+
["pubnub-container__mobile"]: isMobile(),
|
|
264
|
+
["utilities-container__desktop"]: !isMobile(),
|
|
265
|
+
})}
|
|
266
|
+
style=${styleMap(styles)}
|
|
267
|
+
>
|
|
268
|
+
<div id="utilities-header">
|
|
269
|
+
<div>
|
|
270
|
+
<div id="header-text">Utilities Chat</div>
|
|
271
|
+
</div>
|
|
272
|
+
<button
|
|
273
|
+
id="exit-chat-bttn"
|
|
274
|
+
@click=${this.onClickExit}
|
|
275
|
+
aria-label="Close chat"
|
|
276
|
+
>
|
|
277
|
+
${XOutlineIcon("black")}
|
|
278
|
+
</button>
|
|
279
|
+
</div>
|
|
280
|
+
<div
|
|
281
|
+
class=${classMap({
|
|
282
|
+
["hidden"]: !this.needsConsent(),
|
|
283
|
+
["legal-confirmation-container"]: true,
|
|
284
|
+
})}
|
|
285
|
+
>
|
|
286
|
+
${getConsentPreChatDisclaimer(
|
|
287
|
+
this.orgSlug ?? null,
|
|
288
|
+
this.privacyPolicyUrl,
|
|
289
|
+
this.consentKey,
|
|
290
|
+
(hasConsent: boolean) => {
|
|
291
|
+
this.hasReceivedConsent = hasConsent;
|
|
292
|
+
}
|
|
293
|
+
)}
|
|
294
|
+
</div>
|
|
295
|
+
<div
|
|
296
|
+
id="conversation-body"
|
|
297
|
+
class=${classMap({
|
|
298
|
+
["hidden"]: this.needsConsent(),
|
|
299
|
+
["utilities-conversation-body-backdrop"]: true,
|
|
300
|
+
})}
|
|
301
|
+
>
|
|
302
|
+
<ul
|
|
303
|
+
id="message-thread-list"
|
|
304
|
+
class=${classMap({
|
|
305
|
+
["hidden"]: this.needsConsent(),
|
|
306
|
+
})}
|
|
307
|
+
>
|
|
308
|
+
<li class="utilities-disclaimer-message">
|
|
309
|
+
${inChatThreadDisclaimer({
|
|
310
|
+
orgSlug: this.orgSlug ?? "",
|
|
311
|
+
type: "utilities",
|
|
312
|
+
buildingState: this.building?.state ?? null,
|
|
313
|
+
})}
|
|
314
|
+
</li>
|
|
315
|
+
<li class="message-container ai-message">
|
|
316
|
+
<p
|
|
317
|
+
class=${classMap({
|
|
318
|
+
["message-text-large"]: true,
|
|
319
|
+
["webchat-font__desktop"]: !isMobile(),
|
|
320
|
+
["webchat-font__mobile"]: isMobile(),
|
|
321
|
+
})}
|
|
322
|
+
>
|
|
323
|
+
Hi I'm Elise. How can I assist you today?
|
|
324
|
+
</p>
|
|
325
|
+
</li>
|
|
326
|
+
${this.messages.map((message) => {
|
|
327
|
+
return html`
|
|
328
|
+
<li
|
|
329
|
+
class=${message.isLeadMessage
|
|
330
|
+
? "message-container lead-message"
|
|
331
|
+
: "message-container ai-message"}
|
|
332
|
+
key=${message.timestamp}
|
|
333
|
+
>
|
|
334
|
+
${isSimpleMediaChatMessage(message)
|
|
335
|
+
? html` <pubnub-media
|
|
336
|
+
.message=${message}
|
|
337
|
+
.myPubnub=${this.myPubnub}
|
|
338
|
+
.onMount=${() => this.scrollToChatBottom()}
|
|
339
|
+
>
|
|
340
|
+
</pubnub-media>`
|
|
341
|
+
: ""}
|
|
342
|
+
${isSimpleTextChatMessage(message)
|
|
343
|
+
? html` <pubnub-message
|
|
344
|
+
.message=${message}
|
|
345
|
+
.myPubnub=${this.myPubnub}
|
|
346
|
+
.onMount=${() => this.scrollToChatBottom()}
|
|
347
|
+
.isLeadMessage=${message.isLeadMessage}
|
|
348
|
+
.buildingSlug=${this.buildingSlug}
|
|
349
|
+
.widgetType=${this.widgetType}
|
|
350
|
+
>
|
|
351
|
+
</pubnub-message>`
|
|
352
|
+
: ""}
|
|
353
|
+
</li>
|
|
354
|
+
`;
|
|
355
|
+
})}
|
|
356
|
+
${this.isLoadingMessages
|
|
357
|
+
? html`
|
|
358
|
+
<li
|
|
359
|
+
id="loading-message"
|
|
360
|
+
class="message-container ai-message"
|
|
361
|
+
>
|
|
362
|
+
<div class="loading-dot dot-1"></div>
|
|
363
|
+
<div class="loading-dot dot-2"></div>
|
|
364
|
+
<div class="loading-dot dot-3"></div>
|
|
365
|
+
</li>
|
|
366
|
+
`
|
|
367
|
+
: ""}
|
|
368
|
+
</ul>
|
|
369
|
+
</div>
|
|
370
|
+
|
|
371
|
+
<div
|
|
372
|
+
id="utilities-footer"
|
|
373
|
+
class=${classMap({
|
|
374
|
+
["hidden"]: this.needsConsent(),
|
|
375
|
+
})}
|
|
376
|
+
>
|
|
377
|
+
<div id="utilities-inner-footer">
|
|
378
|
+
<textarea
|
|
379
|
+
id="message-input"
|
|
380
|
+
class=${classMap({
|
|
381
|
+
["webchat-font__desktop"]: !isMobile(),
|
|
382
|
+
["webchat-font__mobile"]: isMobile(),
|
|
383
|
+
})}
|
|
384
|
+
placeholder="Ask a Question..."
|
|
385
|
+
@keydown=${(e: KeyboardEvent) => {
|
|
386
|
+
if (e.key === "Enter") {
|
|
387
|
+
e.preventDefault();
|
|
388
|
+
this.sendMessage(this.messageInput.value);
|
|
389
|
+
}
|
|
390
|
+
}}
|
|
391
|
+
@input=${() => this.autoResizeMessageInput()}
|
|
392
|
+
rows="1"
|
|
393
|
+
tabindex="0"
|
|
394
|
+
></textarea>
|
|
395
|
+
<button
|
|
396
|
+
id="utilities-send-message-bttn"
|
|
397
|
+
class=${classMap({
|
|
398
|
+
["health-bttn-allow-access"]: isMobile(),
|
|
399
|
+
})}
|
|
400
|
+
@click=${() => this.sendMessage(this.messageInput.value)}
|
|
401
|
+
>
|
|
402
|
+
${SendMessageLargeIcon("black")}
|
|
403
|
+
</button>
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
</div>
|
|
407
|
+
`;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
if (this.widgetType === WidgetType.Healthcare) {
|
|
411
|
+
return html`
|
|
412
|
+
<div
|
|
413
|
+
id="healthchat-container"
|
|
414
|
+
class=${classMap({
|
|
415
|
+
["pubnub-container__mobile"]: isMobile(),
|
|
416
|
+
["healthchat-container__desktop"]: !isMobile(),
|
|
417
|
+
})}
|
|
418
|
+
style=${styleMap(styles)}
|
|
419
|
+
>
|
|
420
|
+
<div id="healthchat-header">
|
|
421
|
+
${this.buildingSlug === "6a9e65e5-9699-4c96-af75-1741d0df79aa"
|
|
422
|
+
? html` <div>
|
|
423
|
+
<div id="header-text">Premier Dematology</div>
|
|
424
|
+
<div id="healthchat-header-subtext">
|
|
425
|
+
Recorded by Forefront Dermatology and our vendors.
|
|
426
|
+
</div>
|
|
427
|
+
</div>`
|
|
428
|
+
: html``}
|
|
429
|
+
|
|
430
|
+
<button
|
|
431
|
+
id="exit-chat-bttn"
|
|
432
|
+
@click=${this.onClickExit}
|
|
433
|
+
aria-label="Close chat"
|
|
434
|
+
>
|
|
435
|
+
${XOutlineIcon("black")}
|
|
436
|
+
</button>
|
|
437
|
+
</div>
|
|
438
|
+
<div
|
|
439
|
+
class=${classMap({
|
|
440
|
+
["hidden"]: !this.needsConsent(),
|
|
441
|
+
["legal-confirmation-container"]: true,
|
|
442
|
+
})}
|
|
443
|
+
>
|
|
444
|
+
${getConsentPreChatDisclaimer(
|
|
445
|
+
this.orgSlug ?? null,
|
|
446
|
+
this.privacyPolicyUrl,
|
|
447
|
+
this.consentKey,
|
|
448
|
+
(hasConsent: boolean) => {
|
|
449
|
+
this.hasReceivedConsent = hasConsent;
|
|
450
|
+
}
|
|
451
|
+
)}
|
|
452
|
+
</div>
|
|
453
|
+
<div
|
|
454
|
+
id="conversation-body"
|
|
455
|
+
class=${classMap({
|
|
456
|
+
["hidden"]: this.needsConsent(),
|
|
457
|
+
["healthcare-conversation-body-backdrop"]: true,
|
|
458
|
+
})}
|
|
459
|
+
>
|
|
460
|
+
<ul
|
|
461
|
+
id="message-thread-list"
|
|
462
|
+
class=${classMap({
|
|
463
|
+
["hidden"]: this.needsConsent(),
|
|
464
|
+
})}
|
|
465
|
+
>
|
|
466
|
+
<li class="healthcare-disclaimer-message">
|
|
467
|
+
${inChatThreadDisclaimer({
|
|
468
|
+
orgSlug: this.orgSlug ?? "",
|
|
469
|
+
type: "healthcare",
|
|
470
|
+
buildingState: this.building?.state ?? null,
|
|
471
|
+
})}
|
|
472
|
+
</li>
|
|
473
|
+
<li class="message-container ai-message">
|
|
474
|
+
<p
|
|
475
|
+
class=${classMap({
|
|
476
|
+
["message-text"]: true,
|
|
477
|
+
["webchat-font__desktop"]: !isMobile(),
|
|
478
|
+
["webchat-font__mobile"]: isMobile(),
|
|
479
|
+
})}
|
|
480
|
+
>
|
|
481
|
+
Hi I'm Elise. If this is a medical emergency, please call 911.
|
|
482
|
+
How can I assist you today?
|
|
483
|
+
</p>
|
|
484
|
+
</li>
|
|
485
|
+
${this.messages.map((message) => {
|
|
486
|
+
return html`
|
|
487
|
+
<li
|
|
488
|
+
class=${message.isLeadMessage
|
|
489
|
+
? "message-container lead-message"
|
|
490
|
+
: "message-container ai-message"}
|
|
491
|
+
key=${message.timestamp}
|
|
492
|
+
>
|
|
493
|
+
${isSimpleMediaChatMessage(message)
|
|
494
|
+
? html` <pubnub-media
|
|
495
|
+
.message=${message}
|
|
496
|
+
.myPubnub=${this.myPubnub}
|
|
497
|
+
.onMount=${() => this.scrollToChatBottom()}
|
|
498
|
+
>
|
|
499
|
+
</pubnub-media>`
|
|
500
|
+
: ""}
|
|
501
|
+
${isSimpleTextChatMessage(message)
|
|
502
|
+
? html` <pubnub-message
|
|
503
|
+
.message=${message}
|
|
504
|
+
.myPubnub=${this.myPubnub}
|
|
505
|
+
.onMount=${() => this.scrollToChatBottom()}
|
|
506
|
+
.isLeadMessage=${message.isLeadMessage}
|
|
507
|
+
.buildingSlug=${this.buildingSlug}
|
|
508
|
+
.widgetType=${this.widgetType}
|
|
509
|
+
>
|
|
510
|
+
</pubnub-message>`
|
|
511
|
+
: ""}
|
|
512
|
+
</li>
|
|
513
|
+
`;
|
|
514
|
+
})}
|
|
515
|
+
${this.isLoadingMessages
|
|
516
|
+
? html`
|
|
517
|
+
<li
|
|
518
|
+
id="loading-message"
|
|
519
|
+
class="message-container ai-message"
|
|
520
|
+
>
|
|
521
|
+
<div class="loading-dot dot-1"></div>
|
|
522
|
+
<div class="loading-dot dot-2"></div>
|
|
523
|
+
<div class="loading-dot dot-3"></div>
|
|
524
|
+
</li>
|
|
525
|
+
`
|
|
526
|
+
: ""}
|
|
527
|
+
</ul>
|
|
528
|
+
</div>
|
|
529
|
+
|
|
530
|
+
<div
|
|
531
|
+
id="healthcare-footer"
|
|
532
|
+
class=${classMap({
|
|
533
|
+
["hidden"]: this.needsConsent(),
|
|
534
|
+
})}
|
|
535
|
+
>
|
|
536
|
+
<div id="healthcare-inner-footer">
|
|
537
|
+
<textarea
|
|
538
|
+
id="message-input"
|
|
539
|
+
class=${classMap({
|
|
540
|
+
["webchat-font__desktop"]: !isMobile(),
|
|
541
|
+
["webchat-font__mobile"]: isMobile(),
|
|
542
|
+
})}
|
|
543
|
+
placeholder="Ask a Question..."
|
|
544
|
+
@keydown=${(e: KeyboardEvent) => {
|
|
545
|
+
if (e.key === "Enter") {
|
|
546
|
+
e.preventDefault();
|
|
547
|
+
this.sendMessage(this.messageInput.value);
|
|
548
|
+
}
|
|
549
|
+
}}
|
|
550
|
+
@input=${() => this.autoResizeMessageInput()}
|
|
551
|
+
rows="1"
|
|
552
|
+
tabindex="0"
|
|
553
|
+
></textarea>
|
|
554
|
+
<button
|
|
555
|
+
id="healthcare-send-message-bttn"
|
|
556
|
+
class=${classMap({
|
|
557
|
+
["health-bttn-allow-access"]: isMobile(),
|
|
558
|
+
})}
|
|
559
|
+
@click=${() => this.sendMessage(this.messageInput.value)}
|
|
560
|
+
>
|
|
561
|
+
${isMobile()
|
|
562
|
+
? SendMessageLargeIcon("black")
|
|
563
|
+
: SendMessageMediumIcon("black")}
|
|
564
|
+
</button>
|
|
565
|
+
</div>
|
|
566
|
+
</div>
|
|
567
|
+
</div>
|
|
568
|
+
`;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
if (!this.building) {
|
|
572
|
+
return html``;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
const orgId = this.building.orgId;
|
|
576
|
+
return html`
|
|
577
|
+
<div
|
|
578
|
+
id="pubnub-chat-container"
|
|
579
|
+
class=${classMap({
|
|
580
|
+
["pubnub-container__mobile"]: isMobile(),
|
|
581
|
+
["pubnub-container__desktop"]: !isMobile(),
|
|
582
|
+
})}
|
|
583
|
+
style=${styleMap(styles)}
|
|
584
|
+
@keydown=${(e: KeyboardEvent) => e.stopPropagation()}
|
|
585
|
+
@keyup=${(e: KeyboardEvent) => e.stopPropagation()}
|
|
586
|
+
>
|
|
587
|
+
<div
|
|
588
|
+
id="leasing-header"
|
|
589
|
+
style=${styleMap({
|
|
590
|
+
background:
|
|
591
|
+
this.primaryColor !== defaultPrimaryColor
|
|
592
|
+
? hexToAlmostWhite(this.primaryColor, 0.6)
|
|
593
|
+
: undefined,
|
|
594
|
+
})}
|
|
595
|
+
>
|
|
596
|
+
<div id="header-text">${this.building.name}</div>
|
|
597
|
+
<button
|
|
598
|
+
id="exit-chat-bttn"
|
|
599
|
+
@click=${this.onClickExit}
|
|
600
|
+
aria-label="Close chat"
|
|
601
|
+
>
|
|
602
|
+
${XOutlineIcon("black")}
|
|
603
|
+
</button>
|
|
604
|
+
</div>
|
|
605
|
+
<div
|
|
606
|
+
class=${classMap({
|
|
607
|
+
["hidden"]: !this.needsConsent(),
|
|
608
|
+
["legal-confirmation-container"]: true,
|
|
609
|
+
})}
|
|
610
|
+
>
|
|
611
|
+
${getConsentPreChatDisclaimer(
|
|
612
|
+
this.orgSlug ?? null,
|
|
613
|
+
this.privacyPolicyUrl,
|
|
614
|
+
this.consentKey,
|
|
615
|
+
(hasConsent: boolean) => {
|
|
616
|
+
this.hasReceivedConsent = hasConsent;
|
|
617
|
+
}
|
|
618
|
+
)}
|
|
619
|
+
</div>
|
|
620
|
+
<div
|
|
621
|
+
id="conversation-body"
|
|
622
|
+
style=${styleMap({
|
|
623
|
+
background:
|
|
624
|
+
this.building.orgId === 444
|
|
625
|
+
? "rgba(229, 229, 229, 1);"
|
|
626
|
+
: undefined,
|
|
627
|
+
})}
|
|
628
|
+
class=${classMap({
|
|
629
|
+
["hidden"]: this.needsConsent(),
|
|
630
|
+
["leasing-conversation-body-backdrop"]: true,
|
|
631
|
+
})}
|
|
632
|
+
>
|
|
633
|
+
<ul
|
|
634
|
+
id="message-thread-list"
|
|
635
|
+
class=${classMap({
|
|
636
|
+
["hidden"]: this.needsConsent(),
|
|
637
|
+
})}
|
|
638
|
+
>
|
|
639
|
+
${inChatThreadDisclaimer({
|
|
640
|
+
orgSlug: this.orgSlug ?? "",
|
|
641
|
+
buildingState: this.building?.state ?? null,
|
|
642
|
+
type: "leasing",
|
|
643
|
+
})}
|
|
644
|
+
${this.building.welcomeMessage
|
|
645
|
+
? html` <li
|
|
646
|
+
class=${classMap({
|
|
647
|
+
"message-container": true,
|
|
648
|
+
"ai-message": true,
|
|
649
|
+
"with-box-shadow": orgId === 444,
|
|
650
|
+
})}
|
|
651
|
+
>
|
|
652
|
+
<p
|
|
653
|
+
class=${classMap({
|
|
654
|
+
["message-text"]: true,
|
|
655
|
+
["webchat-font__desktop"]: !isMobile(),
|
|
656
|
+
["webchat-font__mobile"]: isMobile(),
|
|
657
|
+
})}
|
|
658
|
+
>
|
|
659
|
+
${this.building.welcomeMessage
|
|
660
|
+
.split("\n")
|
|
661
|
+
.map((line) => html`${line}<br />`)}
|
|
662
|
+
</p>
|
|
663
|
+
</li>`
|
|
664
|
+
: ""}
|
|
665
|
+
${this.messages.map((message) => {
|
|
666
|
+
return html`
|
|
667
|
+
<li
|
|
668
|
+
class=${classNames("message-container", {
|
|
669
|
+
"lead-message": message.isLeadMessage,
|
|
670
|
+
"ai-message": !message.isLeadMessage,
|
|
671
|
+
"with-box-shadow": orgId === 444,
|
|
672
|
+
})}
|
|
673
|
+
key=${message.timestamp}
|
|
674
|
+
>
|
|
675
|
+
${isSimpleMediaChatMessage(message)
|
|
676
|
+
? html` <pubnub-media
|
|
677
|
+
.message=${message}
|
|
678
|
+
.myPubnub=${this.myPubnub}
|
|
679
|
+
.onMount=${() => this.scrollToChatBottom()}
|
|
680
|
+
>
|
|
681
|
+
</pubnub-media>`
|
|
682
|
+
: ""}
|
|
683
|
+
${isSimpleTextChatMessage(message)
|
|
684
|
+
? html` <pubnub-message
|
|
685
|
+
.message=${message}
|
|
686
|
+
.myPubnub=${this.myPubnub}
|
|
687
|
+
.onMount=${() => this.scrollToChatBottom()}
|
|
688
|
+
.isLeadMessage=${message.isLeadMessage}
|
|
689
|
+
.buildingSlug=${this.buildingSlug}
|
|
690
|
+
.widgetType=${this.widgetType}
|
|
691
|
+
>
|
|
692
|
+
</pubnub-message>`
|
|
693
|
+
: ""}
|
|
694
|
+
</li>
|
|
695
|
+
`;
|
|
696
|
+
})}
|
|
697
|
+
${this.isLoadingMessages
|
|
698
|
+
? html`
|
|
699
|
+
<li id="loading-message" class="message-container ai-message">
|
|
700
|
+
<div class="loading-dot dot-1"></div>
|
|
701
|
+
<div class="loading-dot dot-2"></div>
|
|
702
|
+
<div class="loading-dot dot-3"></div>
|
|
703
|
+
</li>
|
|
704
|
+
`
|
|
705
|
+
: ""}
|
|
706
|
+
</ul>
|
|
707
|
+
</div>
|
|
708
|
+
<div
|
|
709
|
+
id="footer"
|
|
710
|
+
class=${classMap({
|
|
711
|
+
["hidden"]: this.needsConsent(),
|
|
712
|
+
})}
|
|
713
|
+
style=${styleMap({
|
|
714
|
+
background:
|
|
715
|
+
shouldUsePrimaryColorForChatFooter(
|
|
716
|
+
this.building.orgId,
|
|
717
|
+
this.building.id
|
|
718
|
+
) && this.primaryColor !== defaultPrimaryColor
|
|
719
|
+
? hexToAlmostWhite(this.primaryColor, 0.6)
|
|
720
|
+
: undefined,
|
|
721
|
+
})}
|
|
722
|
+
>
|
|
723
|
+
<textarea
|
|
724
|
+
id="message-input"
|
|
725
|
+
class=${classMap({
|
|
726
|
+
["webchat-font__desktop"]: !isMobile(),
|
|
727
|
+
["webchat-font__mobile"]: isMobile(),
|
|
728
|
+
})}
|
|
729
|
+
style=${styleMap({
|
|
730
|
+
color:
|
|
731
|
+
shouldUsePrimaryColorForChatFooter(
|
|
732
|
+
this.building.orgId,
|
|
733
|
+
this.building.id
|
|
734
|
+
) && this.primaryColor !== defaultPrimaryColor
|
|
735
|
+
? "black"
|
|
736
|
+
: undefined,
|
|
737
|
+
})}
|
|
738
|
+
placeholder="Ask a question..."
|
|
739
|
+
@keydown=${(e: KeyboardEvent) => {
|
|
740
|
+
if (
|
|
741
|
+
e.key === "Enter" &&
|
|
742
|
+
!this.myPubnub?.isCurrentlyStreamingMessage
|
|
743
|
+
) {
|
|
744
|
+
e.preventDefault();
|
|
745
|
+
this.sendMessage(this.messageInput.value);
|
|
746
|
+
}
|
|
747
|
+
}}
|
|
748
|
+
@input=${() => this.autoResizeMessageInput()}
|
|
749
|
+
rows="1"
|
|
750
|
+
tabindex="0"
|
|
751
|
+
></textarea>
|
|
752
|
+
<button
|
|
753
|
+
tabindex="0"
|
|
754
|
+
id="send-message-bttn"
|
|
755
|
+
@click=${() => this.sendMessage(this.messageInput.value)}
|
|
756
|
+
?disabled=${this.myPubnub?.isCurrentlyStreamingMessage}
|
|
757
|
+
aria-label="Send message"
|
|
758
|
+
aria-describedby="Send message"
|
|
759
|
+
>
|
|
760
|
+
${shouldUsePrimaryColorForChatFooter(
|
|
761
|
+
this.building.orgId,
|
|
762
|
+
this.building.id
|
|
763
|
+
) && this.primaryColor !== defaultPrimaryColor
|
|
764
|
+
? SendMessageMediumIcon("black")
|
|
765
|
+
: SendMessageMediumIcon("white")}
|
|
766
|
+
</button>
|
|
767
|
+
</div>
|
|
768
|
+
</div>
|
|
769
|
+
`;
|
|
770
|
+
}
|
|
771
|
+
}
|