@meetelise/chat 1.25.1 → 1.25.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/.prettierignore +0 -2
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -79
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -111
- package/coverage/lcov-report/index.js.html +0 -17093
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -170
- package/coverage/lcov.info +0 -9986
- package/dist/src/MyPubnub.d.ts +0 -116
- package/dist/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section-styles.d.ts +0 -2
- package/dist/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section.d.ts +0 -20
- 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 -14
- 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 -17
- package/dist/src/WebComponent/FeeCalculator/components/index.d.ts +0 -3
- 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/fee-calculator-styles.d.ts +0 -1
- package/dist/src/WebComponent/FeeCalculator/fee-calculator.d.ts +0 -31
- package/dist/src/WebComponent/FeeCalculator/index.d.ts +0 -2
- package/dist/src/WebComponent/FeeCalculator/model/building-fee.d.ts +0 -75
- package/dist/src/WebComponent/FeeCalculator/model/transaction-category.d.ts +0 -23
- 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 -99
- 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 -3
- 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 -98
- package/dist/src/WebComponent/launcher/launcherStyles.d.ts +0 -1
- package/dist/src/WebComponent/launcher/mobile-launcher.d.ts +0 -26
- 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/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 -8
- package/dist/src/fetchBuildingABTestType.d.ts +0 -8
- package/dist/src/fetchBuildingInfo.d.ts +0 -57
- package/dist/src/fetchBuildingWebchatView.d.ts +0 -122
- 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 -44
- 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 -1
- 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/fetchBuildingFees.d.ts +0 -3
- package/dist/src/svgIcons.d.ts +0 -5
- package/dist/src/themes.d.ts +0 -5
- 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.d.ts +0 -13
- package/public/demo/index.html +0 -347
- package/public/demo/secret.html +0 -63
- package/src/MyPubnub.ts +0 -792
- package/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section-styles.ts +0 -86
- package/src/WebComponent/FeeCalculator/components/collapsible-fee-section/collapsible-fee-section.ts +0 -94
- package/src/WebComponent/FeeCalculator/components/fee-item/fee-item-styles.ts +0 -47
- package/src/WebComponent/FeeCalculator/components/fee-item/fee-item.ts +0 -50
- package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector-styles.ts +0 -46
- package/src/WebComponent/FeeCalculator/components/floor-plan-selector/floor-plan-selector.ts +0 -70
- package/src/WebComponent/FeeCalculator/components/index.ts +0 -3
- 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/fee-calculator-styles.ts +0 -280
- package/src/WebComponent/FeeCalculator/fee-calculator.ts +0 -256
- package/src/WebComponent/FeeCalculator/index.ts +0 -4
- package/src/WebComponent/FeeCalculator/model/building-fee.ts +0 -83
- package/src/WebComponent/FeeCalculator/model/transaction-category.ts +0 -23
- 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 -1352
- 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 -445
- 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 -555
- 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 -18
- 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 -1193
- package/src/WebComponent/launcher/launcherStyles.ts +0 -500
- package/src/WebComponent/launcher/mobile-launcher.ts +0 -159
- 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/me-chat.ts +0 -1257
- 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 -58
- package/src/fetchBuildingABTestType.ts +0 -21
- package/src/fetchBuildingInfo.ts +0 -87
- package/src/fetchBuildingWebchatView.ts +0 -154
- 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 -174
- 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 -1
- 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 -68
- package/src/services/fees/fetchBuildingFees.ts +0 -28
- package/src/svgIcons.ts +0 -14
- package/src/themes.ts +0 -65
- package/src/types/rest-sdk.types.ts +0 -13
- package/src/types/webchat-no-show-reason.ts +0 -6
- package/src/utils.ts +0 -121
- package/tsconfig.json +0 -84
package/src/themes.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
export const defaultPrimaryColor = "#646987"; // we have a brand color defined in the BE too, but this is a fallback
|
|
2
|
-
export const defaultBackgroundColor = "#ffffff"; // default background color for the chat widget
|
|
3
|
-
|
|
4
|
-
export const tintColor = (
|
|
5
|
-
originalColor: string,
|
|
6
|
-
tintOpacity: number
|
|
7
|
-
): string => {
|
|
8
|
-
const originalRgb = hexToRgb(originalColor);
|
|
9
|
-
const tintRgb = { r: 0, g: 0, b: 0 };
|
|
10
|
-
|
|
11
|
-
const newRgb = {
|
|
12
|
-
r: originalRgb.r + Math.round((tintRgb.r - originalRgb.r) * tintOpacity),
|
|
13
|
-
g: originalRgb.g + Math.round((tintRgb.g - originalRgb.g) * tintOpacity),
|
|
14
|
-
b: originalRgb.b + Math.round((tintRgb.b - originalRgb.b) * tintOpacity),
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return rgbToHex(newRgb.r, newRgb.g, newRgb.b);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const hexToRgb = (hex: string): { r: number; g: number; b: number } => {
|
|
21
|
-
const r = parseInt(hex.substring(1, 3), 16);
|
|
22
|
-
const g = parseInt(hex.substring(3, 5), 16);
|
|
23
|
-
const b = parseInt(hex.substring(5, 7), 16);
|
|
24
|
-
return { r, g, b };
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const rgbToHex = (r: number, g: number, b: number): string => {
|
|
28
|
-
return (
|
|
29
|
-
"#" +
|
|
30
|
-
[r, g, b]
|
|
31
|
-
.map((c) => {
|
|
32
|
-
const hex = c.toString(16);
|
|
33
|
-
return hex.length === 1 ? "0" + hex : hex;
|
|
34
|
-
})
|
|
35
|
-
.join("")
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const hexToAlmostWhite = (hexColor: string, ratio: number): string => {
|
|
40
|
-
let r = parseInt(hexColor.substr(1, 2), 16);
|
|
41
|
-
let g = parseInt(hexColor.substr(3, 2), 16);
|
|
42
|
-
let b = parseInt(hexColor.substr(5, 2), 16);
|
|
43
|
-
|
|
44
|
-
// the ratio of white to add (1 = white, 0 = no change)
|
|
45
|
-
r = Math.round(r * (1 - ratio) + 255 * ratio);
|
|
46
|
-
g = Math.round(g * (1 - ratio) + 255 * ratio);
|
|
47
|
-
b = Math.round(b * (1 - ratio) + 255 * ratio);
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
"#" +
|
|
51
|
-
r.toString(16).padStart(2, "0") +
|
|
52
|
-
g.toString(16).padStart(2, "0") +
|
|
53
|
-
b.toString(16).padStart(2, "0")
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export const shouldUsePrimaryColorForChatFooter = (
|
|
58
|
-
orgId: number,
|
|
59
|
-
buildingId: number
|
|
60
|
-
): boolean => {
|
|
61
|
-
// Some clients are complaining that we are NOT ADA compliant with our black, default chat footer
|
|
62
|
-
// So we are temporarily adding this flag to allow them to use their brand color for the chat footer
|
|
63
|
-
// Don't want to suddenly change it for our clients so added this flag
|
|
64
|
-
return orgId === 2 || buildingId === 70392;
|
|
65
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Redeclare enum from rest-sdk to avoid pulling in entire module.
|
|
3
|
-
*/
|
|
4
|
-
export enum TourAvailabilityResponseRankOrderedSupportedTourTypesEnum {
|
|
5
|
-
Unknown = "UNKNOWN",
|
|
6
|
-
SelfGuided = "SELF_GUIDED",
|
|
7
|
-
VirtualShowing = "VIRTUAL_SHOWING",
|
|
8
|
-
WithAgent = "WITH_AGENT",
|
|
9
|
-
MediaTour = "MEDIA_TOUR",
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Types are safe to re-export as they are not included in runtime code.
|
|
13
|
-
export type { TourAvailabilityResponse } from "@meetelise/rest-sdk";
|
package/src/utils.ts
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import camelCase from "lodash/camelCase";
|
|
2
|
-
import snakeCase from "lodash/snakeCase";
|
|
3
|
-
import isArray from "lodash/isArray";
|
|
4
|
-
import isObject from "lodash/isObject";
|
|
5
|
-
import transform from "lodash/transform";
|
|
6
|
-
import addHours from "date-fns/addHours";
|
|
7
|
-
import isBefore from "date-fns/isBefore";
|
|
8
|
-
import { BASE_DOMAIN } from "./globals";
|
|
9
|
-
|
|
10
|
-
export const camelize = <T>(
|
|
11
|
-
snakeCasedObject: Record<string, unknown>,
|
|
12
|
-
keysToExclude?: (string | number | symbol)[]
|
|
13
|
-
): T =>
|
|
14
|
-
transform(
|
|
15
|
-
snakeCasedObject,
|
|
16
|
-
(acc: Record<string, unknown>, value, key, target) => {
|
|
17
|
-
const camelKey = keysToExclude?.includes(key)
|
|
18
|
-
? key
|
|
19
|
-
: isArray(target)
|
|
20
|
-
? key
|
|
21
|
-
: camelCase(String(key));
|
|
22
|
-
|
|
23
|
-
acc[camelKey] = isObject(value)
|
|
24
|
-
? camelize(value as Record<string, unknown>, keysToExclude)
|
|
25
|
-
: value;
|
|
26
|
-
}
|
|
27
|
-
) as T;
|
|
28
|
-
|
|
29
|
-
export const snakify = <T>(
|
|
30
|
-
snakeCasedObject: Record<string, unknown>,
|
|
31
|
-
keysToExclude?: (string | number | symbol)[]
|
|
32
|
-
): T =>
|
|
33
|
-
transform(
|
|
34
|
-
snakeCasedObject,
|
|
35
|
-
(acc: Record<string, unknown>, value, key, target) => {
|
|
36
|
-
const snakeKey = keysToExclude?.includes(key)
|
|
37
|
-
? key
|
|
38
|
-
: isArray(target)
|
|
39
|
-
? key
|
|
40
|
-
: snakeCase(String(key));
|
|
41
|
-
|
|
42
|
-
acc[snakeKey] = isObject(value)
|
|
43
|
-
? snakify(value as Record<string, unknown>, keysToExclude)
|
|
44
|
-
: value;
|
|
45
|
-
}
|
|
46
|
-
) as T;
|
|
47
|
-
|
|
48
|
-
export const isMobile = (): boolean =>
|
|
49
|
-
window.matchMedia("(max-width: 767px)").matches ||
|
|
50
|
-
window.matchMedia("(max-height: 400px)").matches;
|
|
51
|
-
|
|
52
|
-
export const isTimestampExpired = (
|
|
53
|
-
timestamp: Date,
|
|
54
|
-
ttlHours: number
|
|
55
|
-
): boolean => {
|
|
56
|
-
const expirationDate = addHours(timestamp, ttlHours);
|
|
57
|
-
return isBefore(expirationDate, Date.now());
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const getCookieValue = (name: string): string | null => {
|
|
61
|
-
try {
|
|
62
|
-
const cookies = document.cookie.split("; ");
|
|
63
|
-
const cookiePair = cookies
|
|
64
|
-
.map((cookie) => cookie.split("="))
|
|
65
|
-
.find(([cookieName]) => cookieName === name);
|
|
66
|
-
|
|
67
|
-
return cookiePair ? decodeURIComponent(cookiePair[1]) : null;
|
|
68
|
-
} catch (e) {
|
|
69
|
-
// For debugging purposes if something happens on a client website
|
|
70
|
-
// eslint-disable-next-line no-console
|
|
71
|
-
console.warn(`Error getting cookie value for name=${name}`, e);
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const isValidPhoneNumber = (phoneNumber: string): boolean => {
|
|
77
|
-
const phoneNumberRegex = /^\([2-9][0-8][0-9]\) [2-9][0-9][0-9]-[0-9]{4}$/;
|
|
78
|
-
return phoneNumberRegex.test(phoneNumber);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export const isContainingEmail = (message: string): boolean => {
|
|
82
|
-
try {
|
|
83
|
-
const emailRegex = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b/;
|
|
84
|
-
return emailRegex.test(message);
|
|
85
|
-
} catch (e) {
|
|
86
|
-
// eslint-disable-next-line no-console
|
|
87
|
-
console.warn(`Error checking if message contains email`, e);
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* FooBarBizzBazz -> Foo Bar Bizz Bazz
|
|
94
|
-
*/
|
|
95
|
-
export const sentenceTitleCase = (str: string): string => {
|
|
96
|
-
const spaced = str.replace(/([A-Z])/g, " $1").trim();
|
|
97
|
-
return spaced
|
|
98
|
-
.split(" ")
|
|
99
|
-
.map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase())
|
|
100
|
-
.join(" ");
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export const formatCurrency = (
|
|
104
|
-
amount: number,
|
|
105
|
-
maximumFractionDigits = 0
|
|
106
|
-
): string => {
|
|
107
|
-
return Intl.NumberFormat("en-US", {
|
|
108
|
-
style: "currency",
|
|
109
|
-
currency: "USD",
|
|
110
|
-
minimumFractionDigits: 0,
|
|
111
|
-
maximumFractionDigits,
|
|
112
|
-
}).format(amount ?? 0);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export const isTestEnv = (): boolean => {
|
|
116
|
-
const href = location.href;
|
|
117
|
-
if (href.startsWith(BASE_DOMAIN + "/settings/widgets")) return true;
|
|
118
|
-
if (href.startsWith(BASE_DOMAIN + "/demo")) return true;
|
|
119
|
-
if (href.startsWith("http://localhost")) return true;
|
|
120
|
-
return false;
|
|
121
|
-
};
|
package/tsconfig.json
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Basic Options */
|
|
6
|
-
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
-
"target": "es2019" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */,
|
|
8
|
-
"module": "esnext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
|
9
|
-
"lib": [
|
|
10
|
-
"esnext",
|
|
11
|
-
"dom",
|
|
12
|
-
"dom.iterable"
|
|
13
|
-
] /* Specify library files to be included in the compilation. */,
|
|
14
|
-
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
15
|
-
// "checkJs": true, /* Report errors in .js files. */
|
|
16
|
-
"jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */,
|
|
17
|
-
"declaration": true /* Generates corresponding '.d.ts' file. */,
|
|
18
|
-
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
19
|
-
"sourceMap": true /* Generates corresponding '.map' file. */,
|
|
20
|
-
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
21
|
-
"outDir": "./dist" /* Redirect output structure to the directory. */,
|
|
22
|
-
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
23
|
-
// "composite": true, /* Enable project compilation */
|
|
24
|
-
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
25
|
-
// "removeComments": true, /* Do not emit comments to output. */
|
|
26
|
-
// "noEmit": true, /* Do not emit outputs. */
|
|
27
|
-
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
28
|
-
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
29
|
-
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
30
|
-
|
|
31
|
-
/* Strict Type-Checking Options */
|
|
32
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
33
|
-
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
34
|
-
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
35
|
-
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
36
|
-
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
37
|
-
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
38
|
-
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
39
|
-
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
40
|
-
|
|
41
|
-
/* Additional Checks */
|
|
42
|
-
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
43
|
-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
44
|
-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
45
|
-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
46
|
-
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
47
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */
|
|
48
|
-
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
|
|
49
|
-
|
|
50
|
-
/* Module Resolution Options */
|
|
51
|
-
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
|
|
52
|
-
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
53
|
-
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
54
|
-
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
55
|
-
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
56
|
-
// "types": [], /* Type declaration files to be included in compilation. */
|
|
57
|
-
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
58
|
-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
|
59
|
-
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
60
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
61
|
-
|
|
62
|
-
/* Source Map Options */
|
|
63
|
-
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
64
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
65
|
-
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
66
|
-
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
67
|
-
|
|
68
|
-
/* Experimental Options */
|
|
69
|
-
"experimentalDecorators": true /* Required for Lit: https://lit.dev/docs/components/decorators/#decorators-typescript */,
|
|
70
|
-
"useDefineForClassFields": false /* Required for Lit: https://lit.dev/docs/components/decorators/#decorators-typescript */,
|
|
71
|
-
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
72
|
-
|
|
73
|
-
/* Advanced Options */
|
|
74
|
-
"skipLibCheck": true /* Skip type checking of declaration files. */,
|
|
75
|
-
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
|
|
76
|
-
"plugins": [{ "name": "typescript-plugin-css-modules" }]
|
|
77
|
-
},
|
|
78
|
-
"include": [
|
|
79
|
-
"src/main/MEChat.ts",
|
|
80
|
-
"declarations.d.ts",
|
|
81
|
-
"index.ts",
|
|
82
|
-
"./src/WebComponent/"
|
|
83
|
-
]
|
|
84
|
-
}
|