@meetelise/chat 1.22.67 → 1.22.69

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.
@@ -0,0 +1,148 @@
1
+ import axios from "axios";
2
+
3
+ export enum DesignConcepts {
4
+ EMOJI = "emoji",
5
+ PILLS = "pills",
6
+ MINIMIZED = "minimized", // this is also mobile
7
+ }
8
+
9
+ enum TourType {
10
+ UNKNOWN = "UNKNOWN",
11
+ SELF_GUIDED = "SELF_GUIDED",
12
+ VIRTUAL_SHOWING = "VIRTUAL_SHOWING",
13
+ WITH_AGENT = "WITH_AGENT",
14
+ MEDIA_TOUR = "MEDIA_TOUR",
15
+ OPEN_HOUSE_STUDIO = "OPEN_HOUSE_STUDIO",
16
+ OPEN_HOUSE_1BR = "OPEN_HOUSE_1BR",
17
+ OPEN_HOUSE_2BR = "OPEN_HOUSE_2BR",
18
+ OPEN_HOUSE_3BR = "OPEN_HOUSE_3BR",
19
+ OPEN_HOUSE_4BR = "OPEN_HOUSE_4BR",
20
+ OPEN_HOUSE_5BR = "OPEN_HOUSE_5BR",
21
+ }
22
+
23
+ enum TourAccessType {
24
+ LINK = "link",
25
+ CLIENT_SCHEDULED = "client_scheduled",
26
+ SCHEDULED_BY_ME_MANAGED_BY_ME = "scheduled_by_ME_managed_by_ME",
27
+ SCHEDULED_BY_ME_MANAGED_BY_CLIENT = "scheduled_by_ME_managed_by_client",
28
+ SCHEDULED_BY_ME_MANAGED_BY_CONCIERGE = "scheduled_by_ME_managed_by_concierge",
29
+ }
30
+
31
+ interface LayoutOption {
32
+ id: number;
33
+ name: string;
34
+ }
35
+
36
+ interface TourTypeOption {
37
+ value: TourType;
38
+ label: string;
39
+ }
40
+
41
+ export interface BuildingWebchatView {
42
+ id: number;
43
+ orgId: number;
44
+ name: string;
45
+ userId: number | null;
46
+ active: number | null;
47
+ userFirstName: string;
48
+ userLastName: string | null;
49
+ primaryColor: string | null;
50
+ backgroundColor: string | null;
51
+ logoSrc: string | null;
52
+ welcomeMessage: string | null;
53
+ systemWelcomeMessage: string | null;
54
+ chatTitle: string | null;
55
+ chatSubtitle: string | null;
56
+ bannerColor: string | null;
57
+ bannerTextColor: string | null;
58
+ messageColor: string | null;
59
+ messageTextColor: string | null;
60
+ launchButtonColor: string | null;
61
+ launchButtonIconColor: string | null;
62
+ launchButtonSize: string | null;
63
+ avatarType: "image" | "initials" | null;
64
+ avatarSrc: string | null;
65
+ avatarInitials: string | null;
66
+ themeId: string;
67
+ chatCallUsHeader?: string;
68
+ googleMapsUrl: string | null;
69
+ chatWidgets?: string[] | null;
70
+ streetAddress: string | null;
71
+ postalCode: string | null;
72
+ state: string | null;
73
+ phoneNumber: string;
74
+ textWithUsPhoneNumber: string | null;
75
+ layoutOptions: LayoutOption[];
76
+ tourTypeOptions: TourTypeOption[];
77
+ conversationMaintenanceMode: boolean;
78
+ sgtUrl: string;
79
+ escortedToursLink: string;
80
+ virtualToursLink: string;
81
+ isVirtualTourEnabled: boolean;
82
+ isEscortedTourEnabled: boolean;
83
+ isSelfGuidedTourEnabled: boolean;
84
+ escortedToursTypeOffered: TourAccessType;
85
+ virtualToursTypeOffered: TourAccessType;
86
+ selfGuidedToursTypeOffered: TourAccessType;
87
+ usesDynamicScheduling: boolean;
88
+ numAvailableUnits: number;
89
+ isSchedulingDisabled: boolean;
90
+ shouldBuildingScheduleTours: boolean;
91
+ orgLegalName: string;
92
+ launchedDateTime: Date | null;
93
+ webchatScopeConfigured: boolean;
94
+ displayStyle: DesignConcepts;
95
+ secondaryColor: string | null;
96
+ foregroundColorOnPrimaryBackgroundColor: string | null;
97
+ foregroundColorOnSecondaryBackgroundColor: string | null;
98
+ shouldShowChatDesktop: boolean | null;
99
+ shouldShowChatMobile: boolean | null;
100
+ shouldShowTextDesktop: boolean | null;
101
+ shouldShowTextMobile: boolean | null;
102
+ shouldShowPhoneDesktop: boolean | null;
103
+ shouldShowPhoneMobile: boolean | null;
104
+ shouldShowEmailDesktop: boolean | null;
105
+ shouldShowEmailMobile: boolean | null;
106
+ shouldShowSstDesktop: boolean | null;
107
+ shouldShowSstMobile: boolean | null;
108
+ requiresConsentForChat: boolean | null;
109
+ privacyPolicyUrlForChat: string | null;
110
+ collapseMobileFeatures: boolean | null;
111
+ autoOpenChat: boolean | null;
112
+ isInheritingFromOrg: boolean | null;
113
+ isGlobalDefault: boolean | null;
114
+ }
115
+
116
+ /**
117
+ * Load the publicly-available info for a building.
118
+ *
119
+ * @param orgSlug - The org slug, e.g. "big-prop-co"
120
+ * @param buildingSlug - The buidling slug, e.g. "gravity-falls"
121
+ * @returns The building's ID, name, theme, and agent.
122
+ */
123
+ export default async function fetchBuildingWebchatView(
124
+ orgSlug: string,
125
+ buildingSlug: string
126
+ ): Promise<BuildingWebchatView> {
127
+ const host = "https://app.meetelise.com";
128
+ const buildingUrl = `${host}/api/pub/v1/organization/${orgSlug}/building/${buildingSlug}/v2`;
129
+
130
+ const buildingResponse = await axios.get(buildingUrl);
131
+
132
+ const buildingWebchatView: BuildingWebchatView = buildingResponse.data;
133
+ try {
134
+ buildingWebchatView.welcomeMessage = replaceName(
135
+ buildingWebchatView.welcomeMessage ?? "",
136
+ buildingWebchatView.userFirstName
137
+ );
138
+ } catch (e) {
139
+ // eslint-disable-next-line no-console
140
+ console.error(e);
141
+ }
142
+ return buildingWebchatView;
143
+ }
144
+
145
+ const replaceName = (originalText: string, newName: string) => {
146
+ const regex = /elise/gi;
147
+ return originalText.replace(regex, newName);
148
+ };
@@ -1,15 +1,20 @@
1
1
  import axios from "axios";
2
2
  import { camelize } from "./utils";
3
3
 
4
+ /**
5
+ * @deprecated Use BuildingWebchatView instead.
6
+ */
4
7
  export interface WebchatSettings {
5
- id: number;
6
- orgId: number | null;
7
- buildingId: number | null;
8
- displayStyle: DesignConcepts | null;
9
- primaryColor: string | null;
10
- secondaryColor: string | null;
11
- foregroundColorOnPrimaryBackgroundColor: string | null;
12
- foregroundColorOnSecondaryBackgroundColor: string | null;
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;
13
18
  shouldShowChatDesktop: boolean;
14
19
  shouldShowChatMobile: boolean;
15
20
  shouldShowTextDesktop: boolean;
@@ -23,17 +28,13 @@ export interface WebchatSettings {
23
28
  requiresConsentForChat: boolean;
24
29
  privacyPolicyUrlForChat: string | null;
25
30
  collapseMobileFeatures: boolean;
26
- autoOpenChat: boolean;
27
31
  isInheritingFromOrg: boolean;
28
32
  isGlobalDefault: boolean;
29
33
  }
30
34
 
31
- export enum DesignConcepts {
32
- EMOJI = "emoji",
33
- PILLS = "pills",
34
- MINIMIZED = "minimized", // this is also mobile
35
- }
36
-
35
+ /**
36
+ * @deprecated Use BuildingWebchatView instead.
37
+ */
37
38
  export default async function fetchWebchatPreferences(
38
39
  buildingId: number
39
40
  ): Promise<WebchatSettings | null> {
package/src/themes.ts CHANGED
@@ -1,4 +1,4 @@
1
- export const defaultPrimaryColor = "#636889"; // we have a brand color defined in the BE too, but this is a fallback
1
+ export const defaultPrimaryColor = "#646987"; // we have a brand color defined in the BE too, but this is a fallback
2
2
  export const defaultBackgroundColor = "#ffffff"; // default background color for the chat widget
3
3
 
4
4
  export const tintColor = (