@meetelise/chat 1.30.0 → 1.30.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/addon-item/addon-item-styles.d.ts +2 -0
- package/dist/src/WebComponent/FeeCalculator/components/addon-item/addon-item.d.ts +22 -0
- package/dist/src/WebComponent/FeeCalculator/components/addon-item/index.d.ts +1 -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 +34 -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 +33 -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/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 +2 -0
- package/dist/src/WebComponent/FeeCalculator/fee-calculator-styles.d.ts +1 -0
- package/dist/src/WebComponent/FeeCalculator/fee-calculator.d.ts +59 -0
- package/dist/src/WebComponent/FeeCalculator/index.d.ts +2 -0
- package/dist/src/WebComponent/FeeCalculator/model/building-fee.d.ts +80 -0
- package/dist/src/WebComponent/FeeCalculator/model/transaction-category.d.ts +23 -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 +14 -0
- package/dist/src/WebComponent/Scheduler/tour-scheduler.d.ts +100 -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 +3 -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 +98 -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/me-chat.d.ts +91 -0
- package/dist/src/WebComponent/me-select.d.ts +24 -0
- package/dist/src/WebComponent/mega-loader.d.ts +7 -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 +49 -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 +8 -0
- package/dist/src/fetchBuildingABTestType.d.ts +8 -0
- package/dist/src/fetchBuildingInfo.d.ts +57 -0
- package/dist/src/fetchBuildingWebchatView.d.ts +123 -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 +45 -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 +1 -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 +52 -0
- package/dist/src/services/fees/fetchBuildingFees.d.ts +24 -0
- package/dist/src/services/fees/fetchBuildingFloorplans.d.ts +21 -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/rest-sdk.types.d.ts +11 -0
- package/dist/src/types/webchat-no-show-reason.d.ts +1 -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/addon-item/addon-item-styles.ts +79 -0
- package/src/WebComponent/FeeCalculator/components/addon-item/addon-item.ts +121 -0
- package/src/WebComponent/FeeCalculator/components/addon-item/index.ts +1 -0
- package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout-styles.ts +127 -0
- package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout.ts +191 -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 +144 -0
- package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.ts +241 -0
- package/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card-styles.ts +74 -0
- package/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card.ts +72 -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 +3 -0
- package/src/WebComponent/FeeCalculator/fee-calculator-styles.ts +334 -0
- package/src/WebComponent/FeeCalculator/fee-calculator.ts +369 -0
- package/src/WebComponent/FeeCalculator/index.ts +4 -0
- package/src/WebComponent/FeeCalculator/model/building-fee.ts +120 -0
- package/src/WebComponent/FeeCalculator/model/transaction-category.ts +23 -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 +190 -0
- package/src/WebComponent/Scheduler/tour-scheduler.ts +1373 -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 +445 -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 +555 -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 +18 -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 +1282 -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/me-chat.ts +1262 -0
- package/src/WebComponent/me-select.ts +322 -0
- package/src/WebComponent/mega-loader.ts +36 -0
- package/src/WebComponent/mini-loader.ts +28 -0
- package/src/WebComponent/pubnub-chat-styles.ts +204 -0
- package/src/WebComponent/pubnub-chat.ts +928 -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 +58 -0
- package/src/fetchBuildingABTestType.ts +21 -0
- package/src/fetchBuildingInfo.ts +87 -0
- package/src/fetchBuildingWebchatView.ts +156 -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 +179 -0
- package/src/getBuildingPhoneNumber.ts +26 -0
- package/src/getShouldAllowScheduling.ts +16 -0
- package/src/getShouldShowWebchat.ts +114 -0
- package/src/getTimezoneString.ts +39 -0
- package/src/globals.ts +1 -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 +69 -0
- package/src/services/fees/calculateQuote.ts +135 -0
- package/src/services/fees/fetchBuildingFees.ts +63 -0
- package/src/services/fees/fetchBuildingFloorplans.ts +74 -0
- package/src/services/fees/utils.ts +4 -0
- package/src/svgIcons.ts +14 -0
- package/src/themes.ts +65 -0
- package/src/types/rest-sdk.types.ts +13 -0
- package/src/types/webchat-no-show-reason.ts +6 -0
- package/src/utils.ts +121 -0
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
import { css, 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 { createRef, ref, Ref } from "lit/directives/ref.js";
|
|
5
|
+
import { installActionConfirmButton } from "./action-confirm-button";
|
|
6
|
+
import { installDetailsWindow } from "./details-window";
|
|
7
|
+
import "../me-select.ts";
|
|
8
|
+
import { MESelect } from "../me-select";
|
|
9
|
+
import {
|
|
10
|
+
formatToPhoneInput,
|
|
11
|
+
isModifierKey,
|
|
12
|
+
isNumericInput,
|
|
13
|
+
} from "./formatPhoneNumber";
|
|
14
|
+
import { InputStyles } from "./InputStyles";
|
|
15
|
+
import axios from "axios";
|
|
16
|
+
import { FeatureFlagsShowDropdown } from "../../fetchFeatureFlag";
|
|
17
|
+
import { pushGtmEvent } from "../../gtm";
|
|
18
|
+
import disclaimer from "../../disclaimers";
|
|
19
|
+
import { isMobile } from "../../utils";
|
|
20
|
+
import LeadSourceClient, {
|
|
21
|
+
getDefaultLeadSourceAttribution,
|
|
22
|
+
} from "../LeadSourceClient";
|
|
23
|
+
|
|
24
|
+
@customElement("email-us-window")
|
|
25
|
+
export class EmailUsWindow extends LitElement {
|
|
26
|
+
static styles = [
|
|
27
|
+
css`
|
|
28
|
+
.email-us__name-input,
|
|
29
|
+
.email-us__contact_input,
|
|
30
|
+
.email-us_message-input {
|
|
31
|
+
white-space: nowrap;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
text-overflow: ellipsis;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.email-us__name-input {
|
|
37
|
+
width: 50%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.email-us__name-wrapper {
|
|
41
|
+
display: flex;
|
|
42
|
+
gap: 4px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.email-us__contact-input {
|
|
46
|
+
width: 100%;
|
|
47
|
+
width: -webkit-fill-available;
|
|
48
|
+
width: -moz-available;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.email-us__vertical-spacer {
|
|
52
|
+
margin-top: 8px;
|
|
53
|
+
margin-bottom: 8px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.action-bttn-container {
|
|
57
|
+
margin-top: 19px;
|
|
58
|
+
display: flex;
|
|
59
|
+
justify-content: flex-end;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.email-us__message-input {
|
|
63
|
+
resize: none;
|
|
64
|
+
width: 100%;
|
|
65
|
+
width: -webkit-fill-available;
|
|
66
|
+
width: -moz-available;
|
|
67
|
+
height: 159px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.email-us__submitted-info {
|
|
71
|
+
font-size: 18px;
|
|
72
|
+
line-height: 24px;
|
|
73
|
+
color: #202020;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.email-us__error-text {
|
|
77
|
+
margin-top: 4px;
|
|
78
|
+
font-family: "Helvetica", Arial;
|
|
79
|
+
font-style: normal;
|
|
80
|
+
font-weight: 400;
|
|
81
|
+
font-size: 12px;
|
|
82
|
+
line-height: 14px;
|
|
83
|
+
|
|
84
|
+
color: rgb(235, 64, 52);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.email-us__center_icon {
|
|
88
|
+
display: flex;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@media screen and (max-width: 767px) {
|
|
93
|
+
.email-us__name-input {
|
|
94
|
+
width: 50%;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`,
|
|
98
|
+
InputStyles,
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
@property({ attribute: false })
|
|
102
|
+
leadSources: string[] = [];
|
|
103
|
+
|
|
104
|
+
@property({ attribute: false })
|
|
105
|
+
onCloseClicked?: (e: MouseEvent) => void;
|
|
106
|
+
|
|
107
|
+
@property({ attribute: true })
|
|
108
|
+
chatId = "";
|
|
109
|
+
@property({ attribute: false })
|
|
110
|
+
buildingId = 0;
|
|
111
|
+
@property({ attribute: true })
|
|
112
|
+
buildingSlug = "";
|
|
113
|
+
@property({ attribute: true })
|
|
114
|
+
orgSlug = "";
|
|
115
|
+
@property({ attribute: true })
|
|
116
|
+
buildingName = "";
|
|
117
|
+
@property({ attribute: true })
|
|
118
|
+
orgLegalName = "";
|
|
119
|
+
|
|
120
|
+
@property({ attribute: true })
|
|
121
|
+
private leadSourceClient: LeadSourceClient | null = null;
|
|
122
|
+
|
|
123
|
+
@property({ attribute: true })
|
|
124
|
+
featureFlagShowDropdown = "";
|
|
125
|
+
|
|
126
|
+
phoneNumberInputRef: Ref<HTMLInputElement> = createRef();
|
|
127
|
+
|
|
128
|
+
@property()
|
|
129
|
+
privatePolicyUrl = "https://www.meetelise.com/privacy";
|
|
130
|
+
@property()
|
|
131
|
+
termsOfServiceUrl = "_blank";
|
|
132
|
+
|
|
133
|
+
@state()
|
|
134
|
+
firstName = "";
|
|
135
|
+
@state()
|
|
136
|
+
lastName = "";
|
|
137
|
+
@state()
|
|
138
|
+
email = "";
|
|
139
|
+
@state()
|
|
140
|
+
phoneNumber = "";
|
|
141
|
+
@state()
|
|
142
|
+
message = "";
|
|
143
|
+
|
|
144
|
+
@query("me-select#leadSource")
|
|
145
|
+
selectedLeadSource!: MESelect;
|
|
146
|
+
|
|
147
|
+
@property({ attribute: true })
|
|
148
|
+
currentLeadSource = ""; // the default lead source based on referrer and query params
|
|
149
|
+
|
|
150
|
+
@state()
|
|
151
|
+
hasNameError = false;
|
|
152
|
+
@state()
|
|
153
|
+
hasEmailError = false;
|
|
154
|
+
@state()
|
|
155
|
+
hasPhoneNumberError = false;
|
|
156
|
+
@state()
|
|
157
|
+
hasMessageError = false;
|
|
158
|
+
@state()
|
|
159
|
+
hasSubmittedForm = false;
|
|
160
|
+
@state()
|
|
161
|
+
windowHeight = 525;
|
|
162
|
+
@state()
|
|
163
|
+
hasSubmissionError = false;
|
|
164
|
+
@state()
|
|
165
|
+
isSubmitting = false;
|
|
166
|
+
|
|
167
|
+
onChangeFirstName = (e: Event): void => {
|
|
168
|
+
if (!e.target) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
this.firstName = (e.target as HTMLInputElement).value;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
onChangeLastName = (e: Event): void => {
|
|
176
|
+
if (!e.target) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
this.lastName = (e.target as HTMLInputElement).value;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
onChangeEmail = (e: Event): void => {
|
|
184
|
+
if (!e.target) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
this.email = (e.target as HTMLInputElement).value;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
onChangePhoneNumber = (e: Event): void => {
|
|
192
|
+
if (!e.target || !this.phoneNumberInputRef.value) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (isModifierKey(e as KeyboardEvent)) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const inputElement = e.target as HTMLInputElement;
|
|
199
|
+
|
|
200
|
+
this.phoneNumber = formatToPhoneInput(inputElement.value);
|
|
201
|
+
|
|
202
|
+
this.phoneNumberInputRef.value.value = this.phoneNumber;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
onChangeMessage = (e: Event): void => {
|
|
206
|
+
if (!e.target) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
this.message = (e.target as HTMLTextAreaElement).value;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
enforceFormat = (e: KeyboardEvent): void => {
|
|
214
|
+
if (!isNumericInput(e) && !isModifierKey(e)) {
|
|
215
|
+
e.preventDefault();
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
validateFormFields = (): void => {
|
|
220
|
+
this.hasNameError = false;
|
|
221
|
+
this.hasEmailError = false;
|
|
222
|
+
this.hasPhoneNumberError = false;
|
|
223
|
+
this.hasMessageError = false;
|
|
224
|
+
this.hasSubmissionError = false;
|
|
225
|
+
if (!this.firstName || !this.lastName) {
|
|
226
|
+
this.hasNameError = true;
|
|
227
|
+
}
|
|
228
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
229
|
+
if (!this.email || !emailRegex.test(this.email)) {
|
|
230
|
+
this.hasEmailError = true;
|
|
231
|
+
}
|
|
232
|
+
if (!this.phoneNumber || this.phoneNumber.length !== 14) {
|
|
233
|
+
this.hasPhoneNumberError = true;
|
|
234
|
+
}
|
|
235
|
+
this.windowHeight = 525 + 30 * this.getNumErrors();
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
onClick = async (): Promise<void> => {
|
|
239
|
+
if (this.isSubmitting) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
this.validateFormFields();
|
|
243
|
+
if (
|
|
244
|
+
this.hasNameError ||
|
|
245
|
+
this.hasEmailError ||
|
|
246
|
+
this.hasPhoneNumberError ||
|
|
247
|
+
this.hasMessageError
|
|
248
|
+
) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
try {
|
|
252
|
+
this.isSubmitting = true;
|
|
253
|
+
// Height of the button when it's in the loading state
|
|
254
|
+
this.windowHeight = 525 + 60;
|
|
255
|
+
const parsedLeadSource =
|
|
256
|
+
this.selectedLeadSource && this.selectedLeadSource.value
|
|
257
|
+
? this.selectedLeadSource.value
|
|
258
|
+
: this.currentLeadSource;
|
|
259
|
+
await createEmail(
|
|
260
|
+
this.firstName,
|
|
261
|
+
this.lastName,
|
|
262
|
+
this.email,
|
|
263
|
+
this.phoneNumber,
|
|
264
|
+
this.message,
|
|
265
|
+
this.buildingId,
|
|
266
|
+
this.orgSlug,
|
|
267
|
+
this.buildingSlug,
|
|
268
|
+
[
|
|
269
|
+
...new Set(
|
|
270
|
+
parsedLeadSource
|
|
271
|
+
? [
|
|
272
|
+
parsedLeadSource,
|
|
273
|
+
getDefaultLeadSourceAttribution(this.orgSlug),
|
|
274
|
+
]
|
|
275
|
+
: [getDefaultLeadSourceAttribution(this.orgSlug)]
|
|
276
|
+
),
|
|
277
|
+
],
|
|
278
|
+
this.leadSourceClient?.chatId
|
|
279
|
+
);
|
|
280
|
+
this.leadSourceClient?.checkAndHandleForLogLeadSource({
|
|
281
|
+
webchatAction: "email-us",
|
|
282
|
+
stateId: null,
|
|
283
|
+
});
|
|
284
|
+
this.hasSubmittedForm = true;
|
|
285
|
+
this.isSubmitting = false;
|
|
286
|
+
// Remove the height of the button when it leaves the loading state
|
|
287
|
+
this.windowHeight = 525;
|
|
288
|
+
} catch (e) {
|
|
289
|
+
this.hasSubmissionError = true;
|
|
290
|
+
this.isSubmitting = false;
|
|
291
|
+
// Remove the height of the button when it leaves the loading state
|
|
292
|
+
this.windowHeight = 525;
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
getNumErrors = (): number => {
|
|
297
|
+
return [
|
|
298
|
+
this.hasNameError,
|
|
299
|
+
this.hasEmailError,
|
|
300
|
+
this.hasPhoneNumberError,
|
|
301
|
+
this.hasMessageError,
|
|
302
|
+
this.hasSubmissionError,
|
|
303
|
+
].filter((v) => v).length;
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
render = (): TemplateResult => {
|
|
307
|
+
installDetailsWindow();
|
|
308
|
+
installActionConfirmButton();
|
|
309
|
+
|
|
310
|
+
if (this.hasSubmittedForm) {
|
|
311
|
+
return html`
|
|
312
|
+
<details-window
|
|
313
|
+
id="details-window"
|
|
314
|
+
headerText=""
|
|
315
|
+
useGradientDesign="true"
|
|
316
|
+
.onCloseClick=${this.onCloseClicked}
|
|
317
|
+
>
|
|
318
|
+
<div class="email-us-wrapper">
|
|
319
|
+
<div class="email-us__vertical-spacer"></div>
|
|
320
|
+
<div class="email-us__center_icon">
|
|
321
|
+
<svg
|
|
322
|
+
width="22"
|
|
323
|
+
height="18"
|
|
324
|
+
viewBox="0 0 22 18"
|
|
325
|
+
fill="none"
|
|
326
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
327
|
+
>
|
|
328
|
+
<path
|
|
329
|
+
d="M22 17.007C21.9982 17.2696 21.8931 17.521 21.7075 17.7068C21.5219 17.8926 21.2706 17.9979 21.008 18H2.992C2.72881 17.9997 2.4765 17.895 2.29049 17.7088C2.10448 17.5226 2 17.2702 2 17.007V16H20V4.3L12 11.5L2 2.5V1C2 0.734784 2.10536 0.48043 2.29289 0.292893C2.48043 0.105357 2.73478 0 3 0H21C21.2652 0 21.5196 0.105357 21.7071 0.292893C21.8946 0.48043 22 0.734784 22 1V17.007ZM4.434 2L12 8.81L19.566 2H4.434ZM0 12H8V14H0V12ZM0 7H5V9H0V7Z"
|
|
330
|
+
fill="#202020"
|
|
331
|
+
/>
|
|
332
|
+
</svg>
|
|
333
|
+
</div>
|
|
334
|
+
<div class="email-us__vertical-spacer"></div>
|
|
335
|
+
<div class="email-us__submitted-info">
|
|
336
|
+
Thank you for your message. A member of our leasing team will
|
|
337
|
+
contact you.
|
|
338
|
+
</div>
|
|
339
|
+
</div>
|
|
340
|
+
</details-window>
|
|
341
|
+
`;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
return html`
|
|
345
|
+
<details-window
|
|
346
|
+
id="details-window"
|
|
347
|
+
headerText="Email Our Leasing Team"
|
|
348
|
+
.onCloseClick=${this.onCloseClicked}
|
|
349
|
+
height="${this.windowHeight}px"
|
|
350
|
+
>
|
|
351
|
+
<div class="email-us-wrapper" id="email-us-form">
|
|
352
|
+
<div class="email-us__name-wrapper">
|
|
353
|
+
<input
|
|
354
|
+
type="text"
|
|
355
|
+
class=${classMap({
|
|
356
|
+
["webchat-input"]: true,
|
|
357
|
+
["email-us__name-input"]: true,
|
|
358
|
+
["webchat-font__desktop"]: !isMobile(),
|
|
359
|
+
["webchat-font__mobile"]: isMobile(),
|
|
360
|
+
})}
|
|
361
|
+
placeholder="First name"
|
|
362
|
+
autocomplete="given-name"
|
|
363
|
+
value="${this.firstName}"
|
|
364
|
+
@keyup=${this.onChangeFirstName}
|
|
365
|
+
/>
|
|
366
|
+
<div class="email-us__horizontal-spacer"></div>
|
|
367
|
+
<input
|
|
368
|
+
type="text"
|
|
369
|
+
class=${classMap({
|
|
370
|
+
["webchat-input"]: true,
|
|
371
|
+
["email-us__name-input"]: true,
|
|
372
|
+
["webchat-font__desktop"]: !isMobile(),
|
|
373
|
+
["webchat-font__mobile"]: isMobile(),
|
|
374
|
+
})}
|
|
375
|
+
placeholder="Last name"
|
|
376
|
+
autocomplete="family-name"
|
|
377
|
+
value="${this.lastName}"
|
|
378
|
+
@keyup=${this.onChangeLastName}
|
|
379
|
+
/>
|
|
380
|
+
</div>
|
|
381
|
+
${this.hasNameError
|
|
382
|
+
? html`
|
|
383
|
+
<div class="email-us__error-text">Enter your full name</div>
|
|
384
|
+
`
|
|
385
|
+
: ""}
|
|
386
|
+
<div class="email-us__vertical-spacer"></div>
|
|
387
|
+
<input
|
|
388
|
+
type="email"
|
|
389
|
+
placeholder="Email"
|
|
390
|
+
autocomplete="email"
|
|
391
|
+
class=${classMap({
|
|
392
|
+
["webchat-input"]: true,
|
|
393
|
+
["email-us__contact-input"]: true,
|
|
394
|
+
["webchat-font__desktop"]: !isMobile(),
|
|
395
|
+
["webchat-font__mobile"]: isMobile(),
|
|
396
|
+
})}
|
|
397
|
+
.value=${this.email}
|
|
398
|
+
@keyup=${this.onChangeEmail}
|
|
399
|
+
/>
|
|
400
|
+
${this.hasEmailError
|
|
401
|
+
? html`
|
|
402
|
+
<div class="email-us__error-text">
|
|
403
|
+
Enter valid email address
|
|
404
|
+
</div>
|
|
405
|
+
`
|
|
406
|
+
: ""}
|
|
407
|
+
<div class="email-us__vertical-spacer"></div>
|
|
408
|
+
<input
|
|
409
|
+
${ref(this.phoneNumberInputRef)}
|
|
410
|
+
type="text"
|
|
411
|
+
placeholder="Phone"
|
|
412
|
+
autocomplete="tel-national"
|
|
413
|
+
inputmode="tel"
|
|
414
|
+
class=${classMap({
|
|
415
|
+
["webchat-input"]: true,
|
|
416
|
+
["email-us__contact-input"]: true,
|
|
417
|
+
["webchat-font__desktop"]: !isMobile(),
|
|
418
|
+
["webchat-font__mobile"]: isMobile(),
|
|
419
|
+
})}
|
|
420
|
+
.value=${this.phoneNumber}
|
|
421
|
+
maxlength="14"
|
|
422
|
+
@keydown=${this.enforceFormat}
|
|
423
|
+
@keyup=${this.onChangePhoneNumber}
|
|
424
|
+
/>
|
|
425
|
+
${this.hasPhoneNumberError
|
|
426
|
+
? html`
|
|
427
|
+
<div class="email-us__error-text">
|
|
428
|
+
Enter a valid phone number
|
|
429
|
+
</div>
|
|
430
|
+
`
|
|
431
|
+
: ""}
|
|
432
|
+
<div class="email-us__vertical-spacer"></div>
|
|
433
|
+
${this.leadSources.length > 0 &&
|
|
434
|
+
(this.featureFlagShowDropdown === FeatureFlagsShowDropdown.always ||
|
|
435
|
+
(this.featureFlagShowDropdown ===
|
|
436
|
+
FeatureFlagsShowDropdown.onAttributionFailure &&
|
|
437
|
+
this.currentLeadSource.length === 0))
|
|
438
|
+
? html`
|
|
439
|
+
<me-select
|
|
440
|
+
id="leadSource"
|
|
441
|
+
placeholder="How did you hear about us?"
|
|
442
|
+
value="${this.currentLeadSource}"
|
|
443
|
+
.options="${this.leadSources.map((i) => ({
|
|
444
|
+
label: i,
|
|
445
|
+
value: i,
|
|
446
|
+
}))}"
|
|
447
|
+
@change=${() => {
|
|
448
|
+
this.requestUpdate();
|
|
449
|
+
}}
|
|
450
|
+
>
|
|
451
|
+
</me-select>
|
|
452
|
+
`
|
|
453
|
+
: ""}
|
|
454
|
+
<div class="email-us__vertical-spacer"></div>
|
|
455
|
+
<textarea
|
|
456
|
+
placeholder="Your message..."
|
|
457
|
+
.value=${this.message}
|
|
458
|
+
class=${classMap({
|
|
459
|
+
["email-us__message-input"]: true,
|
|
460
|
+
["webchat-input"]: true,
|
|
461
|
+
["webchat-textarea"]: true,
|
|
462
|
+
["webchat-font__desktop"]: !isMobile(),
|
|
463
|
+
["webchat-font__mobile"]: isMobile(),
|
|
464
|
+
})}
|
|
465
|
+
@keyup=${this.onChangeMessage}
|
|
466
|
+
></textarea>
|
|
467
|
+
${this.hasMessageError
|
|
468
|
+
? html` <div class="email-us__error-text">Include a message</div> `
|
|
469
|
+
: ""}
|
|
470
|
+
<div class="action-bttn-container">
|
|
471
|
+
<action-confirm-button
|
|
472
|
+
.onClick=${this.onClick}
|
|
473
|
+
.isLoading=${this.isSubmitting}
|
|
474
|
+
text="SEND"
|
|
475
|
+
></action-confirm-button>
|
|
476
|
+
</div>
|
|
477
|
+
${this.hasSubmissionError
|
|
478
|
+
? html`
|
|
479
|
+
<div class="email-us__error-text">Error submitting message</div>
|
|
480
|
+
`
|
|
481
|
+
: ""}
|
|
482
|
+
</div>
|
|
483
|
+
|
|
484
|
+
${disclaimer({
|
|
485
|
+
buildingName: this.buildingName,
|
|
486
|
+
phoneNumberInput: this.phoneNumber,
|
|
487
|
+
emailInput: this.email,
|
|
488
|
+
orgLegalName: this.orgLegalName,
|
|
489
|
+
})}
|
|
490
|
+
</details-window>
|
|
491
|
+
`;
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export const installEmailUsWindow = (): void => {
|
|
496
|
+
if (!window.customElements.get("email-us-window")) {
|
|
497
|
+
window.customElements.define("email-us-window", EmailUsWindow);
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
const createEmail = async (
|
|
502
|
+
firstName: string,
|
|
503
|
+
lastName: string,
|
|
504
|
+
email: string,
|
|
505
|
+
rawPhoneNumber: string,
|
|
506
|
+
message: string,
|
|
507
|
+
buildingId: number,
|
|
508
|
+
orgSlug: string,
|
|
509
|
+
buildingSlug: string,
|
|
510
|
+
leadSources: string[],
|
|
511
|
+
chatId?: string | null
|
|
512
|
+
) => {
|
|
513
|
+
const formattedPhoneNumber =
|
|
514
|
+
"+1" +
|
|
515
|
+
rawPhoneNumber
|
|
516
|
+
.replace("(", "")
|
|
517
|
+
.replace(")", "")
|
|
518
|
+
.replace(" ", "")
|
|
519
|
+
.replace("-", "");
|
|
520
|
+
const queryParams = new URLSearchParams(window.location.search);
|
|
521
|
+
const requestBody = {
|
|
522
|
+
email_address: email,
|
|
523
|
+
building_id: buildingId,
|
|
524
|
+
lead_sources: leadSources,
|
|
525
|
+
first_message: message,
|
|
526
|
+
first_name: firstName,
|
|
527
|
+
last_name: lastName,
|
|
528
|
+
phone_number: formattedPhoneNumber,
|
|
529
|
+
referrer: document.referrer,
|
|
530
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
531
|
+
// @ts-ignore
|
|
532
|
+
query_params: Object.fromEntries(queryParams.entries()),
|
|
533
|
+
conversation_tracking_id: chatId,
|
|
534
|
+
};
|
|
535
|
+
pushGtmEvent("emailUsSubmitted", {
|
|
536
|
+
firstName,
|
|
537
|
+
lastName,
|
|
538
|
+
email,
|
|
539
|
+
phone: formattedPhoneNumber,
|
|
540
|
+
message,
|
|
541
|
+
originatingSource:
|
|
542
|
+
leadSources.find((i) => i !== "property-website") || null,
|
|
543
|
+
});
|
|
544
|
+
await axios.post(
|
|
545
|
+
"https://app.meetelise.com/platformApi/state/create/emailMe",
|
|
546
|
+
requestBody,
|
|
547
|
+
{
|
|
548
|
+
headers: {
|
|
549
|
+
["building-slug"]: buildingSlug,
|
|
550
|
+
["org-slug"]: orgSlug,
|
|
551
|
+
["X-SecurityKey"]: "JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG",
|
|
552
|
+
},
|
|
553
|
+
}
|
|
554
|
+
);
|
|
555
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* For now, only handles the US phone number case.....
|
|
3
|
+
* Formats into phone number as you type
|
|
4
|
+
*/
|
|
5
|
+
export const formatToPhoneInput = (phoneNumber: string): string => {
|
|
6
|
+
const input = phoneNumber.replace(/\D/g, "").substring(0, 10);
|
|
7
|
+
const areaCode = input.substring(0, 3);
|
|
8
|
+
const middle = input.substring(3, 6);
|
|
9
|
+
const last = input.substring(6, 10);
|
|
10
|
+
|
|
11
|
+
if (input.length > 5) {
|
|
12
|
+
return `(${areaCode}) ${middle}-${last}`;
|
|
13
|
+
}
|
|
14
|
+
if (input.length > 2) {
|
|
15
|
+
return `(${areaCode}) ${middle}`;
|
|
16
|
+
}
|
|
17
|
+
if (input.length > 0) {
|
|
18
|
+
return `(${areaCode}`;
|
|
19
|
+
}
|
|
20
|
+
return "";
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Formats a phone number into a human-readable format.
|
|
25
|
+
*/
|
|
26
|
+
export const formatPhoneNumber = (phoneNumberString: string): string => {
|
|
27
|
+
const cleaned = ("" + phoneNumberString).replace(/\D/g, "");
|
|
28
|
+
const match = cleaned.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/);
|
|
29
|
+
if (match) {
|
|
30
|
+
const intlCode = match[1] ? "+1 " : "";
|
|
31
|
+
return [intlCode, "(", match[2], ") ", match[3], "-", match[4]].join("");
|
|
32
|
+
}
|
|
33
|
+
return phoneNumberString;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const isNumericInput = (event: KeyboardEvent): boolean => {
|
|
37
|
+
const key = event.keyCode;
|
|
38
|
+
return (key >= 48 && key <= 57) || (key >= 96 && key <= 105);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const isPrintableCharacter = (event: KeyboardEvent): boolean =>
|
|
42
|
+
event.key.length === 1;
|
|
43
|
+
|
|
44
|
+
/** Returns true if any key is pressed whose only function when typing text would be as part of a keyboard shortcut.
|
|
45
|
+
* For example, `Shift` or `f` would not suffice, because these are used for typing text.
|
|
46
|
+
* But `Command` or `Control` would.
|
|
47
|
+
*/
|
|
48
|
+
export const shortcutKeyIsPressed = (event: KeyboardEvent): boolean =>
|
|
49
|
+
event.altKey || event.ctrlKey || event.metaKey;
|
|
50
|
+
|
|
51
|
+
export const isModifierKey = (event: KeyboardEvent): boolean => {
|
|
52
|
+
const key = event.keyCode;
|
|
53
|
+
// TODO: whitelisting specific keyboard shortcuts is brittle (e.g. this is missing Cmd + R to reload)
|
|
54
|
+
// Allow left, up, right, down, Backspace, Tab, Enter, Delete, Ctrl/Command + A,C,L,V,X,Z, Shift, Home, End
|
|
55
|
+
return (
|
|
56
|
+
event.shiftKey ||
|
|
57
|
+
key === 35 ||
|
|
58
|
+
key === 36 || // Allow
|
|
59
|
+
key === 8 ||
|
|
60
|
+
key === 9 ||
|
|
61
|
+
key === 13 ||
|
|
62
|
+
key === 46 ||
|
|
63
|
+
(key > 36 && key < 41) ||
|
|
64
|
+
((event.ctrlKey || event.metaKey) &&
|
|
65
|
+
(key === 65 ||
|
|
66
|
+
key === 67 ||
|
|
67
|
+
key === 76 ||
|
|
68
|
+
key === 86 ||
|
|
69
|
+
key === 88 ||
|
|
70
|
+
key === 90))
|
|
71
|
+
);
|
|
72
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { css, html, LitElement, TemplateResult } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
4
|
+
import { defaultPrimaryColor } from "../../themes";
|
|
5
|
+
import { ChevronRightIcon } from "../icons/ChevronRightIcon";
|
|
6
|
+
import { XOutlineIcon } from "../icons/XOutlineIcon";
|
|
7
|
+
|
|
8
|
+
@customElement("minimize-expand-button")
|
|
9
|
+
export class MinimizeExpandButton extends LitElement {
|
|
10
|
+
static styles = [
|
|
11
|
+
css`
|
|
12
|
+
.button-container {
|
|
13
|
+
width: 56px;
|
|
14
|
+
height: 56px;
|
|
15
|
+
|
|
16
|
+
background: #ffffff;
|
|
17
|
+
border: 1px solid rgba(95, 95, 95, 0.2);
|
|
18
|
+
border-radius: 1000px;
|
|
19
|
+
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
align-items: center;
|
|
23
|
+
}
|
|
24
|
+
.mini {
|
|
25
|
+
width: 36px;
|
|
26
|
+
height: 36px;
|
|
27
|
+
}
|
|
28
|
+
.inner-container {
|
|
29
|
+
width: 46px;
|
|
30
|
+
height: 46px;
|
|
31
|
+
|
|
32
|
+
border-radius: 1000px;
|
|
33
|
+
border: 1px solid rgba(255, 255, 255, 0.7);
|
|
34
|
+
|
|
35
|
+
display: flex;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
align-items: center;
|
|
38
|
+
text-align: center;
|
|
39
|
+
}
|
|
40
|
+
.mini > .inner-container {
|
|
41
|
+
width: 30px;
|
|
42
|
+
height: 30px;
|
|
43
|
+
}
|
|
44
|
+
.x-icon,
|
|
45
|
+
.chevron-up {
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
display: flex;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
align-items: center;
|
|
51
|
+
border-radius: 1000px;
|
|
52
|
+
}
|
|
53
|
+
.chevron-up {
|
|
54
|
+
transform: rotate(-90deg);
|
|
55
|
+
}
|
|
56
|
+
.button-container:hover {
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
filter: brightness(90%);
|
|
59
|
+
}
|
|
60
|
+
`,
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
@property({ attribute: true })
|
|
64
|
+
onClick: () => void = () => {
|
|
65
|
+
return;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
@property({ attribute: true })
|
|
69
|
+
primaryColor: string = defaultPrimaryColor;
|
|
70
|
+
|
|
71
|
+
@property({ attribute: true })
|
|
72
|
+
toExpand = false;
|
|
73
|
+
|
|
74
|
+
render(): TemplateResult {
|
|
75
|
+
return html`
|
|
76
|
+
<div
|
|
77
|
+
class=${this.toExpand ? "button-container mini" : "button-container"}
|
|
78
|
+
@click=${this.onClick}
|
|
79
|
+
>
|
|
80
|
+
<div
|
|
81
|
+
class="inner-container"
|
|
82
|
+
style=${styleMap({
|
|
83
|
+
background: this.primaryColor,
|
|
84
|
+
})}
|
|
85
|
+
>
|
|
86
|
+
${this.toExpand
|
|
87
|
+
? html`<div class="chevron-up">${ChevronRightIcon("white")}</div>`
|
|
88
|
+
: html` <div class="x-icon">${XOutlineIcon("white")}</div>`}
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
`;
|
|
92
|
+
}
|
|
93
|
+
}
|