@meetelise/chat 1.34.1 → 1.34.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/package.json +1 -1
- package/dist/src/MyPubnub.d.ts +0 -116
- package/dist/src/WebComponent/FeeCalculator/components/addons/addon-item-matrix-qty-selector/addon-item-matrix-qty-selector-styles.d.ts +0 -2
- package/dist/src/WebComponent/FeeCalculator/components/addons/addon-item-matrix-qty-selector/addon-item-matrix-qty-selector.d.ts +0 -28
- package/dist/src/WebComponent/FeeCalculator/components/addons/addon-item-qty-selector/addon-item-qty-selector-styles.d.ts +0 -2
- package/dist/src/WebComponent/FeeCalculator/components/addons/addon-item-qty-selector/addon-item-qty-selector.d.ts +0 -18
- package/dist/src/WebComponent/FeeCalculator/components/addons/common-addon-styles.d.ts +0 -2
- package/dist/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector-styles.d.ts +0 -2
- package/dist/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector.d.ts +0 -22
- package/dist/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout-styles.d.ts +0 -2
- package/dist/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout.d.ts +0 -46
- package/dist/src/WebComponent/FeeCalculator/components/fee-card/fee-card-styles.d.ts +0 -2
- package/dist/src/WebComponent/FeeCalculator/components/fee-card/fee-card.d.ts +0 -21
- package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.d.ts +0 -2
- package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item.d.ts +0 -13
- package/dist/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.d.ts +0 -2
- package/dist/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.d.ts +0 -34
- package/dist/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card-styles.d.ts +0 -2
- package/dist/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card.d.ts +0 -18
- package/dist/src/WebComponent/FeeCalculator/components/incentive-banner/incentive-banner-styles.d.ts +0 -1
- package/dist/src/WebComponent/FeeCalculator/components/incentive-banner/incentive-banner.d.ts +0 -8
- package/dist/src/WebComponent/FeeCalculator/components/incentive-banner/index.d.ts +0 -1
- package/dist/src/WebComponent/FeeCalculator/components/index.d.ts +0 -5
- package/dist/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.d.ts +0 -2
- package/dist/src/WebComponent/FeeCalculator/components/promo-card/promo-card.d.ts +0 -13
- package/dist/src/WebComponent/FeeCalculator/constants.d.ts +0 -3
- package/dist/src/WebComponent/FeeCalculator/fee-calculator-styles.d.ts +0 -1
- package/dist/src/WebComponent/FeeCalculator/fee-calculator.d.ts +0 -55
- package/dist/src/WebComponent/FeeCalculator/index.d.ts +0 -2
- package/dist/src/WebComponent/FeeCalculator/model/building-fee-view.d.ts +0 -41
- package/dist/src/WebComponent/FeeCalculator/model/building-fee.d.ts +0 -82
- package/dist/src/WebComponent/FeeCalculator/model/desired-addon.d.ts +0 -5
- package/dist/src/WebComponent/FeeCalculator/model/desired-rentable-item.d.ts +0 -4
- package/dist/src/WebComponent/FeeCalculator/model/index.d.ts +0 -13
- package/dist/src/WebComponent/FeeCalculator/model/item-combination.d.ts +0 -6
- package/dist/src/WebComponent/FeeCalculator/model/item-quantity.d.ts +0 -4
- package/dist/src/WebComponent/FeeCalculator/model/pricing-matrix.d.ts +0 -18
- package/dist/src/WebComponent/FeeCalculator/model/pricing-rule.d.ts +0 -8
- package/dist/src/WebComponent/FeeCalculator/model/rent-frequency.d.ts +0 -1
- package/dist/src/WebComponent/FeeCalculator/model/rentable-item-summary.d.ts +0 -9
- package/dist/src/WebComponent/FeeCalculator/model/rentable-item.d.ts +0 -9
- package/dist/src/WebComponent/FeeCalculator/model/transaction-category.d.ts +0 -23
- package/dist/src/WebComponent/FeeCalculator/model/unit-fee-bundle.d.ts +0 -31
- package/dist/src/WebComponent/LeadSourceClient.d.ts +0 -46
- package/dist/src/WebComponent/OfficeHours.d.ts +0 -21
- package/dist/src/WebComponent/Scheduler/date-picker.d.ts +0 -28
- package/dist/src/WebComponent/Scheduler/time-picker.d.ts +0 -14
- package/dist/src/WebComponent/Scheduler/tour-scheduler.d.ts +0 -101
- package/dist/src/WebComponent/Scheduler/tour-type-option.d.ts +0 -13
- package/dist/src/WebComponent/Scheduler/tourSchedulerStyles.d.ts +0 -1
- package/dist/src/WebComponent/actions/InputStyles.d.ts +0 -1
- package/dist/src/WebComponent/actions/action-confirm-button.d.ts +0 -13
- package/dist/src/WebComponent/actions/call-us-window.d.ts +0 -37
- package/dist/src/WebComponent/actions/collapse-expand-button.d.ts +0 -8
- package/dist/src/WebComponent/actions/details-window.d.ts +0 -14
- package/dist/src/WebComponent/actions/email-us-window.d.ts +0 -46
- package/dist/src/WebComponent/actions/formatPhoneNumber.d.ts +0 -17
- package/dist/src/WebComponent/actions/minimize-expand-button.d.ts +0 -8
- package/dist/src/WebComponent/chat-additional-actions.d.ts +0 -28
- package/dist/src/WebComponent/health-chat.d.ts +0 -47
- package/dist/src/WebComponent/healthchat-styles.d.ts +0 -1
- package/dist/src/WebComponent/icons/ApplyOutlineIcon.d.ts +0 -2
- package/dist/src/WebComponent/icons/BookTourOutlineIcon.d.ts +0 -2
- package/dist/src/WebComponent/icons/CalculatorOutlineIcon.d.ts +0 -2
- package/dist/src/WebComponent/icons/ChatOutlineIcon.d.ts +0 -2
- package/dist/src/WebComponent/icons/ChevronLeftIcon.d.ts +0 -2
- package/dist/src/WebComponent/icons/ChevronRightIcon.d.ts +0 -2
- package/dist/src/WebComponent/icons/ContactResidentIcon.d.ts +0 -2
- package/dist/src/WebComponent/icons/DollarOutlineIcon.d.ts +0 -7
- package/dist/src/WebComponent/icons/EmailOutlineIcon.d.ts +0 -2
- package/dist/src/WebComponent/icons/HeyThereEmojiIcon.d.ts +0 -2
- package/dist/src/WebComponent/icons/PhoneOutlineIcon.d.ts +0 -2
- package/dist/src/WebComponent/icons/SendMessageIcon.d.ts +0 -3
- package/dist/src/WebComponent/icons/TourSelfGuidedIcon.d.ts +0 -2
- package/dist/src/WebComponent/icons/TourVirtuallyIcon.d.ts +0 -2
- package/dist/src/WebComponent/icons/TourWithAgentIcon.d.ts +0 -2
- package/dist/src/WebComponent/icons/XOutlineIcon.d.ts +0 -2
- package/dist/src/WebComponent/index.d.ts +0 -2
- package/dist/src/WebComponent/launcher/Launcher.d.ts +0 -99
- package/dist/src/WebComponent/launcher/launcherStyles.d.ts +0 -1
- package/dist/src/WebComponent/launcher/mobile-launcher.d.ts +0 -27
- package/dist/src/WebComponent/launcher/typeEmojiStyles.d.ts +0 -1
- package/dist/src/WebComponent/launcher/typeMiniStyles.d.ts +0 -1
- package/dist/src/WebComponent/launcher/typeMobileStyles.d.ts +0 -1
- package/dist/src/WebComponent/leasing-chat-styles.d.ts +0 -1
- package/dist/src/WebComponent/loaders/index.d.ts +0 -4
- package/dist/src/WebComponent/loaders/mega-loader.d.ts +0 -7
- package/dist/src/WebComponent/loaders/skeleton-card.d.ts +0 -12
- package/dist/src/WebComponent/loaders/skeleton-loader-styles.d.ts +0 -3
- package/dist/src/WebComponent/loaders/skeleton-loader.d.ts +0 -13
- package/dist/src/WebComponent/me-chat.d.ts +0 -91
- package/dist/src/WebComponent/me-select.d.ts +0 -24
- package/dist/src/WebComponent/mini-loader.d.ts +0 -5
- package/dist/src/WebComponent/pubnub-chat-styles.d.ts +0 -1
- package/dist/src/WebComponent/pubnub-chat.d.ts +0 -49
- package/dist/src/WebComponent/pubnub-media.d.ts +0 -14
- package/dist/src/WebComponent/pubnub-message-styles.d.ts +0 -1
- package/dist/src/WebComponent/pubnub-message.d.ts +0 -39
- package/dist/src/WebComponent/simple-launcher/simple-launcher-styles.d.ts +0 -1
- package/dist/src/WebComponent/simple-launcher/simple-launcher.d.ts +0 -12
- package/dist/src/WebComponent/utilities-chat.d.ts +0 -47
- package/dist/src/WebComponent/utilities-styles.d.ts +0 -1
- package/dist/src/WebComponent/utils.d.ts +0 -31
- package/dist/src/analytics.d.ts +0 -64
- package/dist/src/disclaimers.d.ts +0 -9
- package/dist/src/fetchBuildingABTestType.d.ts +0 -8
- package/dist/src/fetchBuildingInfo.d.ts +0 -57
- package/dist/src/fetchBuildingWebchatView.d.ts +0 -124
- package/dist/src/fetchFeatureFlag.d.ts +0 -14
- package/dist/src/fetchLeadSources.d.ts +0 -4
- package/dist/src/fetchPhoneNumberFromSource.d.ts +0 -6
- package/dist/src/getAvailabilities.d.ts +0 -45
- package/dist/src/getBuildingPhoneNumber.d.ts +0 -1
- package/dist/src/getShouldAllowScheduling.d.ts +0 -1
- package/dist/src/getShouldShowWebchat.d.ts +0 -3
- package/dist/src/getTimezoneString.d.ts +0 -1
- package/dist/src/globals.d.ts +0 -2
- package/dist/src/gtm.d.ts +0 -6
- package/dist/src/handleChatId.d.ts +0 -11
- package/dist/src/insertDNIIntoWebsite.d.ts +0 -5
- package/dist/src/insertLeadSourceIntoSchedulerLinks.d.ts +0 -4
- package/dist/src/main/MEChat.d.ts +0 -74
- package/dist/src/main/utils.d.ts +0 -2
- package/dist/src/postLeadSources.d.ts +0 -3
- package/dist/src/rentgrata.d.ts +0 -4
- package/dist/src/replaceSelectButtonsWithNewLink.d.ts +0 -5
- package/dist/src/services/fees/calculateQuote.d.ts +0 -14
- package/dist/src/services/fees/fetchBuildingFeesV2.d.ts +0 -10
- package/dist/src/services/fees/fetchBuildingUnits.d.ts +0 -29
- package/dist/src/services/fees/utils.d.ts +0 -1
- package/dist/src/svgIcons.d.ts +0 -5
- package/dist/src/themes.d.ts +0 -5
- package/dist/src/types/incentive-v2.d.ts +0 -23
- package/dist/src/types/rest-sdk.types.d.ts +0 -11
- package/dist/src/types/webchat-no-show-reason.d.ts +0 -1
- package/dist/src/utils/queryParamBuilder.d.ts +0 -8
- package/dist/src/utils.d.ts +0 -13
- package/src/MyPubnub.ts +0 -792
- package/src/WebComponent/FeeCalculator/components/addons/addon-item-matrix-qty-selector/addon-item-matrix-qty-selector-styles.ts +0 -35
- package/src/WebComponent/FeeCalculator/components/addons/addon-item-matrix-qty-selector/addon-item-matrix-qty-selector.ts +0 -206
- package/src/WebComponent/FeeCalculator/components/addons/addon-item-qty-selector/addon-item-qty-selector-styles.ts +0 -6
- package/src/WebComponent/FeeCalculator/components/addons/addon-item-qty-selector/addon-item-qty-selector.ts +0 -101
- package/src/WebComponent/FeeCalculator/components/addons/common-addon-styles.ts +0 -82
- package/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector-styles.ts +0 -9
- package/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector.ts +0 -124
- package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout-styles.ts +0 -142
- package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout.ts +0 -243
- package/src/WebComponent/FeeCalculator/components/fee-card/fee-card-styles.ts +0 -65
- package/src/WebComponent/FeeCalculator/components/fee-card/fee-card.ts +0 -91
- package/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.ts +0 -44
- package/src/WebComponent/FeeCalculator/components/fee-item/fee-item.ts +0 -38
- package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.ts +0 -151
- package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.ts +0 -248
- package/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card-styles.ts +0 -82
- package/src/WebComponent/FeeCalculator/components/floorplan-image-card/floorplan-image-card.ts +0 -76
- package/src/WebComponent/FeeCalculator/components/incentive-banner/incentive-banner-styles.ts +0 -40
- package/src/WebComponent/FeeCalculator/components/incentive-banner/incentive-banner.ts +0 -43
- package/src/WebComponent/FeeCalculator/components/incentive-banner/index.ts +0 -1
- package/src/WebComponent/FeeCalculator/components/index.ts +0 -5
- package/src/WebComponent/FeeCalculator/components/promo-card/promo-card-styles.ts +0 -39
- package/src/WebComponent/FeeCalculator/components/promo-card/promo-card.ts +0 -39
- package/src/WebComponent/FeeCalculator/constants.ts +0 -5
- package/src/WebComponent/FeeCalculator/fee-calculator-styles.ts +0 -310
- package/src/WebComponent/FeeCalculator/fee-calculator.ts +0 -341
- package/src/WebComponent/FeeCalculator/index.ts +0 -4
- package/src/WebComponent/FeeCalculator/model/building-fee-view.ts +0 -84
- package/src/WebComponent/FeeCalculator/model/building-fee.ts +0 -126
- package/src/WebComponent/FeeCalculator/model/desired-addon.ts +0 -6
- package/src/WebComponent/FeeCalculator/model/desired-rentable-item.ts +0 -4
- package/src/WebComponent/FeeCalculator/model/index.ts +0 -13
- package/src/WebComponent/FeeCalculator/model/item-combination.ts +0 -16
- package/src/WebComponent/FeeCalculator/model/item-quantity.ts +0 -4
- package/src/WebComponent/FeeCalculator/model/pricing-matrix.ts +0 -45
- package/src/WebComponent/FeeCalculator/model/pricing-rule.ts +0 -9
- package/src/WebComponent/FeeCalculator/model/rent-frequency.ts +0 -1
- package/src/WebComponent/FeeCalculator/model/rentable-item-summary.ts +0 -10
- package/src/WebComponent/FeeCalculator/model/rentable-item.ts +0 -10
- package/src/WebComponent/FeeCalculator/model/transaction-category.ts +0 -23
- package/src/WebComponent/FeeCalculator/model/unit-fee-bundle.ts +0 -54
- package/src/WebComponent/LeadSourceClient.ts +0 -332
- package/src/WebComponent/MEChat.css +0 -5
- package/src/WebComponent/OfficeHours.ts +0 -73
- package/src/WebComponent/Scheduler/date-picker.ts +0 -405
- package/src/WebComponent/Scheduler/time-picker.ts +0 -190
- package/src/WebComponent/Scheduler/tour-scheduler.ts +0 -1416
- package/src/WebComponent/Scheduler/tour-type-option.ts +0 -112
- package/src/WebComponent/Scheduler/tourSchedulerStyles.ts +0 -418
- package/src/WebComponent/actions/InputStyles.ts +0 -57
- package/src/WebComponent/actions/action-confirm-button.ts +0 -125
- package/src/WebComponent/actions/call-us-window.ts +0 -467
- package/src/WebComponent/actions/collapse-expand-button.ts +0 -65
- package/src/WebComponent/actions/details-window.ts +0 -150
- package/src/WebComponent/actions/email-us-window.ts +0 -556
- package/src/WebComponent/actions/formatPhoneNumber.ts +0 -72
- package/src/WebComponent/actions/minimize-expand-button.ts +0 -93
- package/src/WebComponent/chat-additional-actions.ts +0 -135
- package/src/WebComponent/health-chat.ts +0 -270
- package/src/WebComponent/healthchat-styles.ts +0 -119
- package/src/WebComponent/icons/ApplyOutlineIcon.ts +0 -22
- package/src/WebComponent/icons/BookTourOutlineIcon.ts +0 -13
- package/src/WebComponent/icons/CalculatorOutlineIcon.ts +0 -22
- package/src/WebComponent/icons/ChatOutlineIcon.ts +0 -10
- package/src/WebComponent/icons/ChevronLeftIcon.ts +0 -7
- package/src/WebComponent/icons/ChevronRightIcon.ts +0 -7
- package/src/WebComponent/icons/ContactResidentIcon.ts +0 -9
- package/src/WebComponent/icons/DollarOutlineIcon.ts +0 -26
- package/src/WebComponent/icons/EmailOutlineIcon.ts +0 -7
- package/src/WebComponent/icons/HeyThereEmojiIcon.ts +0 -12
- package/src/WebComponent/icons/PhoneOutlineIcon.ts +0 -7
- package/src/WebComponent/icons/SendMessageIcon.ts +0 -17
- package/src/WebComponent/icons/TourSelfGuidedIcon.ts +0 -17
- package/src/WebComponent/icons/TourVirtuallyIcon.ts +0 -17
- package/src/WebComponent/icons/TourWithAgentIcon.ts +0 -17
- package/src/WebComponent/icons/XOutlineIcon.ts +0 -8
- package/src/WebComponent/index.ts +0 -2
- package/src/WebComponent/launcher/Launcher.ts +0 -1284
- package/src/WebComponent/launcher/launcherStyles.ts +0 -500
- package/src/WebComponent/launcher/mobile-launcher.ts +0 -162
- package/src/WebComponent/launcher/typeEmojiStyles.ts +0 -161
- package/src/WebComponent/launcher/typeMiniStyles.ts +0 -60
- package/src/WebComponent/launcher/typeMobileStyles.ts +0 -50
- package/src/WebComponent/leasing-chat-styles.ts +0 -114
- package/src/WebComponent/loaders/index.ts +0 -7
- package/src/WebComponent/loaders/mega-loader.ts +0 -36
- package/src/WebComponent/loaders/skeleton-card.ts +0 -31
- package/src/WebComponent/loaders/skeleton-loader-styles.ts +0 -112
- package/src/WebComponent/loaders/skeleton-loader.ts +0 -34
- package/src/WebComponent/me-chat.ts +0 -1261
- package/src/WebComponent/me-select.ts +0 -322
- package/src/WebComponent/mini-loader.ts +0 -28
- package/src/WebComponent/pubnub-chat-styles.ts +0 -204
- package/src/WebComponent/pubnub-chat.ts +0 -928
- package/src/WebComponent/pubnub-media.ts +0 -208
- package/src/WebComponent/pubnub-message-styles.ts +0 -54
- package/src/WebComponent/pubnub-message.ts +0 -431
- package/src/WebComponent/simple-launcher/simple-launcher-styles.ts +0 -34
- package/src/WebComponent/simple-launcher/simple-launcher.ts +0 -100
- package/src/WebComponent/utilities-chat.ts +0 -270
- package/src/WebComponent/utilities-styles.ts +0 -110
- package/src/WebComponent/utils.ts +0 -82
- package/src/analytics.ts +0 -217
- package/src/assetUrls.ts +0 -6
- package/src/disclaimers.ts +0 -86
- package/src/fetchBuildingABTestType.ts +0 -21
- package/src/fetchBuildingInfo.ts +0 -87
- package/src/fetchBuildingWebchatView.ts +0 -176
- package/src/fetchFeatureFlag.ts +0 -250
- package/src/fetchLeadSources.ts +0 -98
- package/src/fetchPhoneNumberFromSource.ts +0 -31
- package/src/fetchWebchatPreferences.ts +0 -54
- package/src/getAvailabilities.ts +0 -179
- package/src/getBuildingPhoneNumber.ts +0 -26
- package/src/getShouldAllowScheduling.ts +0 -16
- package/src/getShouldShowWebchat.ts +0 -114
- package/src/getTimezoneString.ts +0 -39
- package/src/globals.ts +0 -3
- package/src/gtm.ts +0 -17
- package/src/handleChatId.ts +0 -101
- package/src/insertDNIIntoWebsite.ts +0 -146
- package/src/insertLeadSourceIntoSchedulerLinks.ts +0 -71
- package/src/main/MEChat.test.ts +0 -110
- package/src/main/MEChat.ts +0 -404
- package/src/main/utils.ts +0 -70
- package/src/postLeadSources.ts +0 -44
- package/src/rentgrata.ts +0 -74
- package/src/replaceSelectButtonsWithNewLink.ts +0 -90
- package/src/services/fees/calculateQuote.ts +0 -74
- package/src/services/fees/fetchBuildingFees.ts +0 -50
- package/src/services/fees/fetchBuildingFeesV2.ts +0 -56
- package/src/services/fees/fetchBuildingFloorplans.ts +0 -74
- package/src/services/fees/fetchBuildingUnits.ts +0 -86
- package/src/services/fees/utils.ts +0 -4
- package/src/svgIcons.ts +0 -14
- package/src/themes.ts +0 -65
- package/src/types/incentive-v2.ts +0 -24
- package/src/types/rest-sdk.types.ts +0 -13
- package/src/types/webchat-no-show-reason.ts +0 -6
- package/src/utils/queryParamBuilder.ts +0 -28
- package/src/utils.ts +0 -121
package/src/fetchFeatureFlag.ts
DELETED
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
|
|
3
|
-
// V1 reads from the launch darkly flag
|
|
4
|
-
// Note, in launch darkly we can define the building_id as the user filter and just need to pass
|
|
5
|
-
// the building_slug to the endpoint - we map in the backend
|
|
6
|
-
const featureFlagEndpointV1 = (buildingSlug: string): string => {
|
|
7
|
-
const host = "https://app.meetelise.com";
|
|
8
|
-
return `${host}/platformApi/webchat/${buildingSlug}/chat-ui-feature-flag`;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// V2 reads from conversation flag table (preferred)
|
|
12
|
-
const featureFlagEndpointV2 = (buildingSlug: string): string => {
|
|
13
|
-
const host = "https://app.meetelise.com";
|
|
14
|
-
return `${host}/platformApi/webchat/${buildingSlug}/v2/chat-ui-feature-flag`;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export enum FeatureFlagsShowDropdown {
|
|
18
|
-
onAttributionFailure = "on-attribution-failure",
|
|
19
|
-
never = "never", // note, the dropdown will NOT show up if there are also no lead sources (list)!
|
|
20
|
-
always = "always",
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export async function fetchFeatureFlagMaintenanceMode(
|
|
24
|
-
buildingSlug: string
|
|
25
|
-
): Promise<boolean> {
|
|
26
|
-
if (!buildingSlug) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
try {
|
|
30
|
-
const featureFlagResponse = await axios.get(
|
|
31
|
-
featureFlagEndpointV1(buildingSlug),
|
|
32
|
-
{
|
|
33
|
-
params: {
|
|
34
|
-
building_slug: buildingSlug,
|
|
35
|
-
flag_type: "bool",
|
|
36
|
-
feature_flag: "webchat-leasing-in-maintenance-mode",
|
|
37
|
-
default_str: null,
|
|
38
|
-
default_bool: false,
|
|
39
|
-
},
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
return featureFlagResponse.data;
|
|
43
|
-
} catch (_) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export async function fetchFeatureFlagShowMarketingSourceDropdown(
|
|
49
|
-
buildingSlug: string
|
|
50
|
-
): Promise<FeatureFlagsShowDropdown> {
|
|
51
|
-
if (!buildingSlug) {
|
|
52
|
-
return FeatureFlagsShowDropdown.always;
|
|
53
|
-
}
|
|
54
|
-
try {
|
|
55
|
-
const featureFlagResponse = await axios.get(
|
|
56
|
-
featureFlagEndpointV1(buildingSlug),
|
|
57
|
-
{
|
|
58
|
-
params: {
|
|
59
|
-
building_slug: buildingSlug,
|
|
60
|
-
flag_type: "string",
|
|
61
|
-
feature_flag: "webchat-marketing-source-dropdown-configuration",
|
|
62
|
-
default_str: "always",
|
|
63
|
-
default_bool: true,
|
|
64
|
-
},
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
if (featureFlagResponse.data === "on-attribution-failure") {
|
|
68
|
-
return FeatureFlagsShowDropdown.onAttributionFailure;
|
|
69
|
-
}
|
|
70
|
-
if (featureFlagResponse.data === "never") {
|
|
71
|
-
return FeatureFlagsShowDropdown.never;
|
|
72
|
-
}
|
|
73
|
-
return FeatureFlagsShowDropdown.always;
|
|
74
|
-
} catch (_) {
|
|
75
|
-
return FeatureFlagsShowDropdown.always;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export async function fetchFeatureFlagUsePhoneNumberBySource(
|
|
80
|
-
buildingSlug: string
|
|
81
|
-
): Promise<boolean> {
|
|
82
|
-
if (!buildingSlug) {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
try {
|
|
86
|
-
const featureFlagResponse = await axios.get(
|
|
87
|
-
featureFlagEndpointV1(buildingSlug),
|
|
88
|
-
{
|
|
89
|
-
params: {
|
|
90
|
-
building_slug: buildingSlug,
|
|
91
|
-
flag_type: "bool",
|
|
92
|
-
feature_flag: "webchat-use-dni-phone-number-by-source",
|
|
93
|
-
default_str: null,
|
|
94
|
-
default_bool: false,
|
|
95
|
-
},
|
|
96
|
-
}
|
|
97
|
-
);
|
|
98
|
-
return featureFlagResponse.data;
|
|
99
|
-
} catch (_) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export async function fetchFeatureFlagUseOverrideContactUsForm(
|
|
105
|
-
buildingSlug: string
|
|
106
|
-
): Promise<boolean> {
|
|
107
|
-
if (!buildingSlug) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
try {
|
|
111
|
-
const featureFlagResponse = await axios.get(
|
|
112
|
-
featureFlagEndpointV1(buildingSlug),
|
|
113
|
-
{
|
|
114
|
-
params: {
|
|
115
|
-
building_slug: buildingSlug,
|
|
116
|
-
flag_type: "bool",
|
|
117
|
-
feature_flag: "webchat-use-override-contact-us-form",
|
|
118
|
-
default_str: null,
|
|
119
|
-
default_bool: false,
|
|
120
|
-
},
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
return featureFlagResponse.data;
|
|
124
|
-
} catch (_) {
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
export async function fetchFeatureFlagUsePubnub(
|
|
129
|
-
buildingSlug?: string
|
|
130
|
-
): Promise<boolean> {
|
|
131
|
-
if (!buildingSlug) {
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
try {
|
|
135
|
-
const featureFlagResponse = await axios.get(
|
|
136
|
-
featureFlagEndpointV1(buildingSlug),
|
|
137
|
-
{
|
|
138
|
-
params: {
|
|
139
|
-
building_slug: buildingSlug,
|
|
140
|
-
flag_type: "bool",
|
|
141
|
-
feature_flag: "use-pubnub-chat-provider",
|
|
142
|
-
default_str: null,
|
|
143
|
-
default_bool: false,
|
|
144
|
-
},
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
return featureFlagResponse.data;
|
|
148
|
-
} catch (_) {
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export async function fetchFeatureFlagInsertDNIWebsite(
|
|
154
|
-
buildingSlug?: string
|
|
155
|
-
): Promise<boolean> {
|
|
156
|
-
if (!buildingSlug) {
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
try {
|
|
160
|
-
const featureFlagResponse = await axios.get(
|
|
161
|
-
featureFlagEndpointV2(buildingSlug),
|
|
162
|
-
{
|
|
163
|
-
params: {
|
|
164
|
-
building_slug: buildingSlug,
|
|
165
|
-
feature_flag_name: "insert_dni_into_website",
|
|
166
|
-
default_value: false,
|
|
167
|
-
},
|
|
168
|
-
}
|
|
169
|
-
);
|
|
170
|
-
return featureFlagResponse.data;
|
|
171
|
-
} catch (_) {
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export async function fetchFeatureFlagShowUtilities(
|
|
177
|
-
orgSlug: string
|
|
178
|
-
): Promise<boolean> {
|
|
179
|
-
if (!orgSlug) {
|
|
180
|
-
return false;
|
|
181
|
-
}
|
|
182
|
-
const buildingSlug = "e2e-test-yardi-building";
|
|
183
|
-
try {
|
|
184
|
-
const featureFlagResponse = await axios.get(
|
|
185
|
-
featureFlagEndpointV1(buildingSlug),
|
|
186
|
-
{
|
|
187
|
-
params: {
|
|
188
|
-
building_slug: buildingSlug,
|
|
189
|
-
flag_type: "bool",
|
|
190
|
-
feature_flag: "enable-show-utilities-webchat",
|
|
191
|
-
default_str: null,
|
|
192
|
-
default_bool: false,
|
|
193
|
-
},
|
|
194
|
-
}
|
|
195
|
-
);
|
|
196
|
-
return featureFlagResponse.data;
|
|
197
|
-
} catch (_) {
|
|
198
|
-
return false;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export async function fetchFeatureFlagReplaceScheduleTourCtaWebsite(
|
|
203
|
-
buildingSlug: string
|
|
204
|
-
): Promise<boolean> {
|
|
205
|
-
if (!buildingSlug) {
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
try {
|
|
209
|
-
const featureFlagResponse = await axios.get(
|
|
210
|
-
featureFlagEndpointV1(buildingSlug),
|
|
211
|
-
{
|
|
212
|
-
params: {
|
|
213
|
-
building_slug: buildingSlug,
|
|
214
|
-
flag_type: "bool",
|
|
215
|
-
feature_flag: "webchat-replace-any-schedule-tour-cta-website",
|
|
216
|
-
default_str: null,
|
|
217
|
-
default_bool: false,
|
|
218
|
-
},
|
|
219
|
-
}
|
|
220
|
-
);
|
|
221
|
-
return featureFlagResponse.data;
|
|
222
|
-
} catch (_) {
|
|
223
|
-
return false;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
export async function fetchFeatureFlagUseApplicationsLinkReplacement(
|
|
228
|
-
buildingSlug: string
|
|
229
|
-
): Promise<boolean> {
|
|
230
|
-
if (!buildingSlug) {
|
|
231
|
-
return false;
|
|
232
|
-
}
|
|
233
|
-
try {
|
|
234
|
-
const featureFlagResponse = await axios.get(
|
|
235
|
-
featureFlagEndpointV1(buildingSlug),
|
|
236
|
-
{
|
|
237
|
-
params: {
|
|
238
|
-
building_slug: buildingSlug,
|
|
239
|
-
flag_type: "bool",
|
|
240
|
-
feature_flag: "webchat-use-applications-link-replacement",
|
|
241
|
-
default_str: null,
|
|
242
|
-
default_bool: false,
|
|
243
|
-
},
|
|
244
|
-
}
|
|
245
|
-
);
|
|
246
|
-
return featureFlagResponse.data;
|
|
247
|
-
} catch (_) {
|
|
248
|
-
return false;
|
|
249
|
-
}
|
|
250
|
-
}
|
package/src/fetchLeadSources.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
export interface BuildingABType {
|
|
3
|
-
abTestType: string;
|
|
4
|
-
}
|
|
5
|
-
export default async function fetchLeadSources(
|
|
6
|
-
orgSlug: string,
|
|
7
|
-
buildingSlug: string
|
|
8
|
-
): Promise<string[]> {
|
|
9
|
-
const host = "https://app.meetelise.com";
|
|
10
|
-
try {
|
|
11
|
-
const leadSourcesResponse = await axios.get(
|
|
12
|
-
`${host}/platformApi/webchat/${buildingSlug}/lead-sources`
|
|
13
|
-
);
|
|
14
|
-
if (leadSourcesResponse.data) {
|
|
15
|
-
if (orgSlug === "7e352741-1120-4ccf-9929-5dc99193a908") {
|
|
16
|
-
const onlyIncludeSources = [
|
|
17
|
-
"Zillow",
|
|
18
|
-
"Apartments.com",
|
|
19
|
-
"Google PPC",
|
|
20
|
-
"Google Maps",
|
|
21
|
-
"Apple Maps",
|
|
22
|
-
"Social Media",
|
|
23
|
-
"Print Marketing",
|
|
24
|
-
];
|
|
25
|
-
return leadSourcesResponse.data.filter((source: string) =>
|
|
26
|
-
onlyIncludeSources.includes(source)
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
return filterOutBuildingSpecificLeadSources(
|
|
30
|
-
leadSourcesResponse.data,
|
|
31
|
-
buildingSlug
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
return [];
|
|
35
|
-
} catch (_) {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const filterOutBuildingSpecificLeadSources = (
|
|
41
|
-
leadSources: string[],
|
|
42
|
-
buildingSlug: string
|
|
43
|
-
): string[] => {
|
|
44
|
-
// Dinerstien asked to filter out some sources based on their buildings
|
|
45
|
-
let removeLeadSources: string[] = [];
|
|
46
|
-
switch (buildingSlug) {
|
|
47
|
-
case "d41619ec-0f79-11ee-8439-93855926ad58": // Infinity Lofts in the Gulch
|
|
48
|
-
removeLeadSources = [
|
|
49
|
-
"Forthea - PPC",
|
|
50
|
-
"HotPads",
|
|
51
|
-
"Forthea",
|
|
52
|
-
"Locator",
|
|
53
|
-
"Website-apartmentguide.com",
|
|
54
|
-
"Forthea - organic search",
|
|
55
|
-
"Tdc employee",
|
|
56
|
-
"University newspaper",
|
|
57
|
-
"Nashville apartment locators",
|
|
58
|
-
"Forthea - paid social",
|
|
59
|
-
"Apartment list",
|
|
60
|
-
"Off campus partners",
|
|
61
|
-
"Waze ads",
|
|
62
|
-
"Athletic event",
|
|
63
|
-
"Website-apartment guide",
|
|
64
|
-
];
|
|
65
|
-
break;
|
|
66
|
-
case "d4160560-0f79-11ee-8438-fba837bf3a46": // Sawyer on Lincoln
|
|
67
|
-
removeLeadSources = [
|
|
68
|
-
"Forthea - PPC",
|
|
69
|
-
"Rentgrata",
|
|
70
|
-
"Website-ApartmentFinder.com",
|
|
71
|
-
"Word of Mouth",
|
|
72
|
-
"Texas A&M A-Frame on Campus",
|
|
73
|
-
"Rent.com",
|
|
74
|
-
"Website-craigslist",
|
|
75
|
-
"Apartment List",
|
|
76
|
-
"Website-apartments.com",
|
|
77
|
-
"Forthea - paid social",
|
|
78
|
-
"Forthea - organic search",
|
|
79
|
-
"Website-apartmentguide.com",
|
|
80
|
-
"Forthea",
|
|
81
|
-
"Uhomes",
|
|
82
|
-
"Phone book",
|
|
83
|
-
"Property - website",
|
|
84
|
-
];
|
|
85
|
-
break;
|
|
86
|
-
default:
|
|
87
|
-
removeLeadSources = [];
|
|
88
|
-
}
|
|
89
|
-
leadSources.sort();
|
|
90
|
-
return leadSources.filter((leadSource) => {
|
|
91
|
-
const lowerCaseLeadSource = leadSource.toLowerCase();
|
|
92
|
-
const lowerCaseRemoveLeadSources = removeLeadSources.map((source) =>
|
|
93
|
-
source.toLowerCase()
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
return !lowerCaseRemoveLeadSources.includes(lowerCaseLeadSource);
|
|
97
|
-
});
|
|
98
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { formatPhoneNumber } from "./WebComponent/actions/formatPhoneNumber";
|
|
3
|
-
|
|
4
|
-
export interface NumberForSelectedSource {
|
|
5
|
-
number: string;
|
|
6
|
-
isMatch: boolean;
|
|
7
|
-
isPropertyWebsiteCatchall: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default async function fetchPhoneNumberFromSource(
|
|
11
|
-
buildingSlug: string,
|
|
12
|
-
source: string | null
|
|
13
|
-
): Promise<NumberForSelectedSource | null> {
|
|
14
|
-
const host = "https://app.meetelise.com";
|
|
15
|
-
try {
|
|
16
|
-
const phoneNumberResponse = await axios.get(
|
|
17
|
-
`${host}/platformApi/webchat/${buildingSlug}/phone-number-by-source?source=${source}`
|
|
18
|
-
);
|
|
19
|
-
if (phoneNumberResponse.data) {
|
|
20
|
-
return {
|
|
21
|
-
number: formatPhoneNumber(phoneNumberResponse.data.number),
|
|
22
|
-
isMatch: phoneNumberResponse.data.match,
|
|
23
|
-
isPropertyWebsiteCatchall:
|
|
24
|
-
phoneNumberResponse.data.isPropertyWebsiteCatchall,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
return null;
|
|
28
|
-
} catch (_) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { camelize } from "./utils";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Use BuildingWebchatView instead.
|
|
6
|
-
*/
|
|
7
|
-
export interface WebchatSettings {
|
|
8
|
-
config: WebchatConfigurationPreferences;
|
|
9
|
-
isInheriting: boolean;
|
|
10
|
-
isGlobalDefault: boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated Use BuildingWebchatView instead.
|
|
14
|
-
*/
|
|
15
|
-
export interface WebchatConfigurationPreferences {
|
|
16
|
-
autoOpenChat: boolean;
|
|
17
|
-
shouldShowChat: boolean;
|
|
18
|
-
shouldShowChatDesktop: boolean;
|
|
19
|
-
shouldShowChatMobile: boolean;
|
|
20
|
-
shouldShowTextDesktop: boolean;
|
|
21
|
-
shouldShowTextMobile: boolean;
|
|
22
|
-
shouldShowPhoneDesktop: boolean;
|
|
23
|
-
shouldShowPhoneMobile: boolean;
|
|
24
|
-
shouldShowEmailDesktop: boolean;
|
|
25
|
-
shouldShowEmailMobile: boolean;
|
|
26
|
-
shouldShowSstDesktop: boolean;
|
|
27
|
-
shouldShowSstMobile: boolean;
|
|
28
|
-
requiresConsentForChat: boolean;
|
|
29
|
-
privacyPolicyUrlForChat: string | null;
|
|
30
|
-
collapseMobileFeatures: boolean;
|
|
31
|
-
isInheritingFromOrg: boolean;
|
|
32
|
-
isGlobalDefault: boolean;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated Use BuildingWebchatView instead.
|
|
37
|
-
*/
|
|
38
|
-
export default async function fetchWebchatPreferences(
|
|
39
|
-
buildingId: number
|
|
40
|
-
): Promise<WebchatSettings | null> {
|
|
41
|
-
const host = "https://app.meetelise.com";
|
|
42
|
-
try {
|
|
43
|
-
const webchatPreferencesResponse = await axios.get(
|
|
44
|
-
`${host}/eliseCrmApi/webchat/config/v2/building/${buildingId}`
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
if (webchatPreferencesResponse.data) {
|
|
48
|
-
return camelize<WebchatSettings>(webchatPreferencesResponse.data);
|
|
49
|
-
}
|
|
50
|
-
} catch (_) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
return null;
|
|
54
|
-
}
|
package/src/getAvailabilities.ts
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import formatISO from "date-fns/formatISO";
|
|
2
|
-
import startOfToday from "date-fns/startOfToday";
|
|
3
|
-
import endOfDay from "date-fns/endOfDay";
|
|
4
|
-
import addDays from "date-fns/addDays";
|
|
5
|
-
import format from "date-fns/format";
|
|
6
|
-
import axios from "axios";
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
TourAvailabilityResponse,
|
|
10
|
-
TourAvailabilityResponseRankOrderedSupportedTourTypesEnum,
|
|
11
|
-
} from "./types/rest-sdk.types";
|
|
12
|
-
import groupBy from "lodash/groupBy";
|
|
13
|
-
import { TourType } from "./WebComponent/Scheduler/tour-scheduler";
|
|
14
|
-
import isPast from "date-fns/isPast";
|
|
15
|
-
import parseISO from "date-fns/parseISO";
|
|
16
|
-
import isValid from "date-fns/isValid";
|
|
17
|
-
|
|
18
|
-
const availabilitiesCache: {
|
|
19
|
-
buildingId?: number | null;
|
|
20
|
-
availabilities: { [buildingId: number]: TourAvailabilityResponse };
|
|
21
|
-
} = { buildingId: null, availabilities: {} };
|
|
22
|
-
|
|
23
|
-
export const resetAvailabilitiesCache = (): void => {
|
|
24
|
-
availabilitiesCache.buildingId = null;
|
|
25
|
-
availabilitiesCache.availabilities = {};
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Returns the raw availabilities.
|
|
30
|
-
*
|
|
31
|
-
* If no `buildingId` is provided, it will use a cached buildingId from the previous call.
|
|
32
|
-
* If there is none cached, it will throw an error.
|
|
33
|
-
*/
|
|
34
|
-
export const getRawAvailabilities = async (
|
|
35
|
-
buildingId?: number
|
|
36
|
-
): Promise<TourAvailabilityResponse> => {
|
|
37
|
-
if (buildingId) {
|
|
38
|
-
availabilitiesCache.buildingId = buildingId;
|
|
39
|
-
}
|
|
40
|
-
const buildingIdToUse = availabilitiesCache.buildingId;
|
|
41
|
-
if (!buildingIdToUse) {
|
|
42
|
-
throw new Error(
|
|
43
|
-
"No buildingId was provided to getRawAvailabilities and there is no buildingId cached."
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
const availabilities = availabilitiesCache.availabilities;
|
|
47
|
-
if (availabilities[buildingIdToUse]) {
|
|
48
|
-
return availabilities[buildingIdToUse];
|
|
49
|
-
}
|
|
50
|
-
const startTime = startOfToday();
|
|
51
|
-
const endTime = formatISO(endOfDay(addDays(startTime, 30)));
|
|
52
|
-
|
|
53
|
-
// We MUST encode the URI components because a positive timezone offset counts as a space in urls!
|
|
54
|
-
const timeParams = `startTime=${encodeURIComponent(
|
|
55
|
-
formatISO(startTime)
|
|
56
|
-
)}&endTime=${encodeURIComponent(endTime)}`;
|
|
57
|
-
const url = `https://app.meetelise.com/api/pub/v1/buildings/${buildingIdToUse}/tour/availabilities?${timeParams}`;
|
|
58
|
-
|
|
59
|
-
const result = await axios.get<TourAvailabilityResponse>(url);
|
|
60
|
-
availabilitiesCache.availabilities[buildingIdToUse] = result.data;
|
|
61
|
-
// The endpoint INCORRECTLY states that these are returned as dates. They are, in fact, strings.
|
|
62
|
-
return result.data;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const getAvailabilitiesForTourType = async (
|
|
66
|
-
tourType: TourAvailabilityResponseRankOrderedSupportedTourTypesEnum,
|
|
67
|
-
buildingId?: number
|
|
68
|
-
): Promise<{
|
|
69
|
-
/**
|
|
70
|
-
*
|
|
71
|
-
* @type {number}
|
|
72
|
-
* @memberof TourTypeAvailability
|
|
73
|
-
*/
|
|
74
|
-
tourDurationInMinutes?: number;
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
* @type {Array<string>}
|
|
78
|
-
* @memberof TourTypeAvailability
|
|
79
|
-
*/
|
|
80
|
-
availableTourStartTimes?: Array<string>;
|
|
81
|
-
} | null> => {
|
|
82
|
-
// The endpoint INCORRECTLY states that these are returned as dates. They are, in fact, strings.
|
|
83
|
-
const availabilities = await getRawAvailabilities(buildingId);
|
|
84
|
-
const availableTimes = availabilities.availability?.[tourType]
|
|
85
|
-
? (availabilities.availability?.[tourType]
|
|
86
|
-
.availableTourStartTimes as unknown as string[])
|
|
87
|
-
: [];
|
|
88
|
-
return availabilities.availability
|
|
89
|
-
? {
|
|
90
|
-
...availabilities.availability[tourType],
|
|
91
|
-
availableTourStartTimes: availableTimes,
|
|
92
|
-
}
|
|
93
|
-
: null;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export interface DateWithTimeZoneOffset {
|
|
97
|
-
datetime: string;
|
|
98
|
-
offset: string;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Returns an object that reveals whether each tour type supported by
|
|
103
|
-
* `tour-scheduler` has availabilities (time slots available for scheduling) in
|
|
104
|
-
* the time window of interest.
|
|
105
|
-
*
|
|
106
|
-
* Note that the existence of current availabilities is distinct from the
|
|
107
|
-
* question of whether the community supports the tour type at all. The first
|
|
108
|
-
* implies the second but not vice versa.
|
|
109
|
-
*/
|
|
110
|
-
export const getExistenceOfAvailabilitiesByTourType = async (): Promise<{
|
|
111
|
-
[TourType.Guided]: boolean;
|
|
112
|
-
[TourType.Self]: boolean;
|
|
113
|
-
[TourType.Virtual]: boolean;
|
|
114
|
-
}> => {
|
|
115
|
-
return {
|
|
116
|
-
[TourType.Guided]: !!(
|
|
117
|
-
await getAvailabilitiesForTourType(
|
|
118
|
-
TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent
|
|
119
|
-
)
|
|
120
|
-
)?.availableTourStartTimes?.length,
|
|
121
|
-
[TourType.Self]: !!(
|
|
122
|
-
await getAvailabilitiesForTourType(
|
|
123
|
-
TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided
|
|
124
|
-
)
|
|
125
|
-
)?.availableTourStartTimes?.length,
|
|
126
|
-
[TourType.Virtual]: !!(
|
|
127
|
-
await getAvailabilitiesForTourType(
|
|
128
|
-
TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing
|
|
129
|
-
)
|
|
130
|
-
)?.availableTourStartTimes?.length,
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export const getAvailabilitiesGroupedByDay = async (
|
|
135
|
-
tourType: TourAvailabilityResponseRankOrderedSupportedTourTypesEnum,
|
|
136
|
-
buildingId?: number
|
|
137
|
-
): Promise<{ [day: string]: DateWithTimeZoneOffset[] }> => {
|
|
138
|
-
const availabilitiesForTourTypeRaw = await getAvailabilitiesForTourType(
|
|
139
|
-
tourType,
|
|
140
|
-
buildingId
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
if (!availabilitiesForTourTypeRaw) {
|
|
144
|
-
return {};
|
|
145
|
-
}
|
|
146
|
-
// Specify offset for each datetime in case availabilities span a daylight savings boundary, when offset will change.
|
|
147
|
-
// Cast availableTourStartTimes to string[], since the Date[] typing of the API is incorrect
|
|
148
|
-
const availabilitiesForTourType: {
|
|
149
|
-
availableTourStartTimes: DateWithTimeZoneOffset[] | undefined;
|
|
150
|
-
} = {
|
|
151
|
-
availableTourStartTimes:
|
|
152
|
-
(availabilitiesForTourTypeRaw.availableTourStartTimes
|
|
153
|
-
? (
|
|
154
|
-
availabilitiesForTourTypeRaw.availableTourStartTimes as unknown as string[]
|
|
155
|
-
).filter((dt) => isValid(parseISO(dt)) && !isPast(parseISO(dt)))
|
|
156
|
-
: []
|
|
157
|
-
)?.map((dateString) => dateStringToDateWithTimeZoneOffset(dateString)),
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
return groupBy(
|
|
161
|
-
availabilitiesForTourType.availableTourStartTimes ?? [],
|
|
162
|
-
(startTime) => format(new Date(startTime.datetime), "yyyy-MM-dd")
|
|
163
|
-
);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Takes an ISO 8601 date string with time zone offset and returns
|
|
168
|
-
* an object of our custom type DateWithTimeZoneOffset.
|
|
169
|
-
*
|
|
170
|
-
* @example
|
|
171
|
-
* // returns { datetime: '2022-06-27T09:00:00', offset: '-07:00' }
|
|
172
|
-
* dateStringToDateWithTimeZoneOffset('2022-06-27T09:00:00-07:00')
|
|
173
|
-
* */
|
|
174
|
-
const dateStringToDateWithTimeZoneOffset = (
|
|
175
|
-
dateString: string
|
|
176
|
-
): DateWithTimeZoneOffset => ({
|
|
177
|
-
datetime: dateString.slice(0, 19),
|
|
178
|
-
offset: dateString.slice(19),
|
|
179
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { LogType, sendLoggingEvent } from "./analytics";
|
|
3
|
-
|
|
4
|
-
export const getBuildingPhoneNumber = async (
|
|
5
|
-
buildingSlug: string
|
|
6
|
-
): Promise<string | null> => {
|
|
7
|
-
try {
|
|
8
|
-
const host = "https://app.meetelise.com";
|
|
9
|
-
const webchatPreferencesResponse = await axios.get(
|
|
10
|
-
`${host}/platformApi/webchat/${buildingSlug}/phone-number`
|
|
11
|
-
);
|
|
12
|
-
if (webchatPreferencesResponse.data) {
|
|
13
|
-
return webchatPreferencesResponse.data;
|
|
14
|
-
}
|
|
15
|
-
} catch (error) {
|
|
16
|
-
sendLoggingEvent({
|
|
17
|
-
logType: LogType.error,
|
|
18
|
-
buildingSlug,
|
|
19
|
-
logTitle: "[ERROR_GETTING_PHONE_NUMBERS]",
|
|
20
|
-
logData: { error },
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
|
|
3
|
-
export const getShouldAllowScheduling = async (
|
|
4
|
-
buildingId: number,
|
|
5
|
-
isDynamicSchedulingEnabled = false
|
|
6
|
-
): Promise<boolean> => {
|
|
7
|
-
const host = "https://app.meetelise.com";
|
|
8
|
-
const url = `${host}/eliseCrmApi/building/${buildingId}/scheduling_status?observe_dynamic_scheduling=${isDynamicSchedulingEnabled}`;
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
const response = await axios.get(url);
|
|
12
|
-
return response.data.is_enabled;
|
|
13
|
-
} catch (e) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
};
|