@meetelise/chat 1.9.1 → 1.12.0
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/.eslintrc.cjs +1 -0
- package/.github/workflows/release.yml +1 -0
- package/.vscode/settings.json +6 -1
- package/CONTRIBUTING.md +8 -0
- package/package.json +9 -10
- package/public/demo/index.html +78 -11
- package/public/dist/index.js +1714 -1
- package/public/dist/index.js.LICENSE.txt +26 -14
- package/public/index.html +2 -1
- package/src/MEChat.test.ts +5 -5
- package/src/MEChat.ts +53 -0
- package/src/WebComponent/InHouseLauncher.ts +446 -0
- package/src/WebComponent/MEChat.css +5 -0
- package/src/WebComponent/MEChat.ts +282 -0
- package/src/WebComponent/OfficeHours.ts +73 -0
- package/src/WebComponent/Scheduler/date-picker.ts +320 -0
- package/src/WebComponent/Scheduler/me-select.ts +244 -0
- package/src/WebComponent/Scheduler/time-picker.ts +101 -0
- package/src/WebComponent/Scheduler/tour-scheduler.ts +383 -0
- package/src/WebComponent/Scheduler/tour-type-option.ts +92 -0
- package/src/WebComponent/actions/ActionConfirmButton.ts +94 -0
- package/src/WebComponent/actions/CallUsWindow.ts +110 -0
- package/src/WebComponent/actions/DetailsWindow.ts +109 -0
- package/src/WebComponent/actions/EmailUsWindow.ts +432 -0
- package/src/WebComponent/actions/InputStyles.ts +31 -0
- package/src/WebComponent/actions/TextUsWindow.ts +226 -0
- package/src/WebComponent/actions/formatPhoneNumber.ts +42 -0
- package/src/WebComponent/inHouseLauncherStyles.ts +300 -0
- package/src/WebComponent/index.ts +2 -0
- package/src/WebComponent/utils.ts +82 -0
- package/src/analytics.ts +48 -15
- package/src/assetUrls.ts +4 -0
- package/src/fetchBuildingInfo.ts +1 -0
- package/src/getAvailabilities.ts +71 -0
- package/src/themes.ts +5 -3
- package/tsconfig.json +9 -3
- package/web-test-runner.config.js +0 -6
- package/webpack.config.cjs +8 -25
- package/public/dist/index.d.ts +0 -1
- package/public/dist/src/ChatButton.d.ts +0 -9
- package/public/dist/src/ChatIcon.d.ts +0 -6
- package/public/dist/src/InHouseLauncher.d.ts +0 -11
- package/public/dist/src/MEChat.d.ts +0 -73
- package/public/dist/src/analytics.d.ts +0 -18
- package/public/dist/src/chatID.d.ts +0 -11
- package/public/dist/src/createConversation.d.ts +0 -4
- package/public/dist/src/fetchBuildingInfo.d.ts +0 -25
- package/public/dist/src/themes.d.ts +0 -52
- package/public/dist/src/utils.d.ts +0 -2
- package/src/ChatButton.module.scss +0 -52
- package/src/ChatButton.tsx +0 -26
- package/src/ChatIcon.tsx +0 -26
- package/src/DemoApp.tsx +0 -113
- package/src/InHouseLauncher.module.scss +0 -140
- package/src/InHouseLauncher.tsx +0 -65
- package/src/MEChat.module.scss +0 -22
- package/src/MEChat.tsx +0 -293
package/src/analytics.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
RCTPCampaign?: { CampaignDetails: { Source: string } };
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface CampaignSources {
|
|
8
|
+
entrataCampaignSource: string | null;
|
|
9
|
+
yardiCampaignSource: string | null;
|
|
10
|
+
realpageCampaignSource: string | null;
|
|
11
|
+
utmCampaignSource: string | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
1
14
|
/**
|
|
2
15
|
* A connection to the MeetElise API to send analytics events.
|
|
3
16
|
*/
|
|
@@ -24,24 +37,44 @@ export default class Analytics {
|
|
|
24
37
|
};
|
|
25
38
|
}
|
|
26
39
|
|
|
40
|
+
campaignSources(): CampaignSources {
|
|
41
|
+
const queryParams = new URL(window.location.href).searchParams;
|
|
42
|
+
const yardiCampaignSource =
|
|
43
|
+
window.RCTPCampaign?.CampaignDetails?.Source ?? null;
|
|
44
|
+
const entrataCampaignSource = queryParams.get("switch_cls[id]");
|
|
45
|
+
const realpageCampaignSource = queryParams.get("ilm");
|
|
46
|
+
const utmCampaignSource = queryParams.get("utm_source");
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
entrataCampaignSource,
|
|
50
|
+
realpageCampaignSource,
|
|
51
|
+
utmCampaignSource,
|
|
52
|
+
yardiCampaignSource,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
27
56
|
/**
|
|
28
57
|
* Send an event. Takes one argument, the event type name.
|
|
29
58
|
*/
|
|
30
59
|
ping(eventType: string): void {
|
|
31
|
-
fetch(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
60
|
+
fetch(
|
|
61
|
+
"https://app.meetelise.com/platformApi/connectors/talk_js/analytics",
|
|
62
|
+
{
|
|
63
|
+
method: "POST",
|
|
64
|
+
credentials: "omit", // Necessary for successful CORS
|
|
65
|
+
keepalive: true, // Analytics should not abort after browser close
|
|
66
|
+
headers: { "content-type": "application/json; charset=UTF-8" },
|
|
67
|
+
body: JSON.stringify({
|
|
68
|
+
eventType,
|
|
69
|
+
chatId: this.chatId,
|
|
70
|
+
url: location.href,
|
|
71
|
+
org: this.org,
|
|
72
|
+
building: this.building,
|
|
73
|
+
referrer: document.referrer,
|
|
74
|
+
featureFlags: this.featureFlags,
|
|
75
|
+
campaignSources: this.campaignSources(),
|
|
76
|
+
}),
|
|
77
|
+
}
|
|
78
|
+
);
|
|
46
79
|
}
|
|
47
80
|
}
|
package/src/assetUrls.ts
ADDED
package/src/fetchBuildingInfo.ts
CHANGED
|
@@ -0,0 +1,71 @@
|
|
|
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 parseISO from "date-fns/parseISO";
|
|
6
|
+
import format from "date-fns/format";
|
|
7
|
+
import axios from "axios";
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
TourAvailabilityResponse,
|
|
11
|
+
TourAvailabilityResponseRankOrderedSupportedTourTypesEnum,
|
|
12
|
+
TourTypeAvailability,
|
|
13
|
+
} from "@meetelise/rest-sdk";
|
|
14
|
+
import groupBy from "lodash/groupBy";
|
|
15
|
+
|
|
16
|
+
const availabilitiesCache: {
|
|
17
|
+
[buildingId: number]: TourAvailabilityResponse;
|
|
18
|
+
} = {};
|
|
19
|
+
|
|
20
|
+
export const getRawAvailabilities = async (
|
|
21
|
+
buildingId: number
|
|
22
|
+
): Promise<TourAvailabilityResponse> => {
|
|
23
|
+
if (availabilitiesCache[buildingId]) {
|
|
24
|
+
return availabilitiesCache[buildingId];
|
|
25
|
+
}
|
|
26
|
+
const startTime = startOfToday();
|
|
27
|
+
const endTime = formatISO(endOfDay(addDays(startTime, 30)));
|
|
28
|
+
const url = `https://app.meetelise.com/api/pub/v1/buildings/${buildingId}/tour/availabilities?startTime=${formatISO(
|
|
29
|
+
startTime
|
|
30
|
+
)}&endTime=${endTime}`;
|
|
31
|
+
const result = await axios.get<TourAvailabilityResponse>(url);
|
|
32
|
+
availabilitiesCache[buildingId] = result.data;
|
|
33
|
+
// The endpoint INCORRECTLY states that these are returned as dates. They are, in fact, strings.
|
|
34
|
+
return result.data;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const getAvailabilitiesForTourType = async (
|
|
38
|
+
buildingId: number,
|
|
39
|
+
tourType: TourAvailabilityResponseRankOrderedSupportedTourTypesEnum
|
|
40
|
+
): Promise<TourTypeAvailability | null> => {
|
|
41
|
+
// The endpoint INCORRECTLY states that these are returned as dates. They are, in fact, strings.
|
|
42
|
+
const availabilities = await getRawAvailabilities(buildingId);
|
|
43
|
+
const availableTimes = availabilities.availability?.[tourType]
|
|
44
|
+
? availabilities.availability?.[tourType].availableTourStartTimes?.map(
|
|
45
|
+
(startTime) => parseISO(startTime as unknown as string)
|
|
46
|
+
)
|
|
47
|
+
: [];
|
|
48
|
+
return availabilities.availability
|
|
49
|
+
? {
|
|
50
|
+
...availabilities.availability[tourType],
|
|
51
|
+
availableTourStartTimes: availableTimes,
|
|
52
|
+
}
|
|
53
|
+
: null;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const getAvailabilitiesGroupedByDay = async (
|
|
57
|
+
buildingId: number,
|
|
58
|
+
tourType: TourAvailabilityResponseRankOrderedSupportedTourTypesEnum
|
|
59
|
+
): Promise<{ [day: string]: Date[] }> => {
|
|
60
|
+
const availabilitiesForTourType = await getAvailabilitiesForTourType(
|
|
61
|
+
buildingId,
|
|
62
|
+
tourType
|
|
63
|
+
);
|
|
64
|
+
if (!availabilitiesForTourType) {
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
67
|
+
return groupBy(
|
|
68
|
+
availabilitiesForTourType.availableTourStartTimes ?? [],
|
|
69
|
+
(startTime) => format(startTime, "yyyy-MM-dd")
|
|
70
|
+
);
|
|
71
|
+
};
|
package/src/themes.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const white = "#FFFFFF";
|
|
2
2
|
const darkGray = "#202020";
|
|
3
3
|
const lightGray = "#83818E";
|
|
4
|
+
const lightBlue = "#1990FF";
|
|
5
|
+
const offBlack = "#1E1E1E";
|
|
4
6
|
|
|
5
7
|
export const enum ThemeId {
|
|
6
8
|
Light = "Light",
|
|
@@ -36,8 +38,8 @@ export interface Theme {
|
|
|
36
38
|
export const defaultThemeId = ThemeId.Light;
|
|
37
39
|
|
|
38
40
|
export const lightMessage = {
|
|
39
|
-
user: { textColor: white, backgroundColor:
|
|
40
|
-
agent: { textColor:
|
|
41
|
+
user: { textColor: white, backgroundColor: lightBlue },
|
|
42
|
+
agent: { textColor: white, backgroundColor: offBlack },
|
|
41
43
|
};
|
|
42
44
|
export const darkMessage = {
|
|
43
45
|
user: { textColor: white, backgroundColor: lightGray },
|
|
@@ -50,7 +52,7 @@ const themesById = {
|
|
|
50
52
|
textColor: darkGray,
|
|
51
53
|
},
|
|
52
54
|
chatPaneBackgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
53
|
-
message:
|
|
55
|
+
message: lightMessage,
|
|
54
56
|
},
|
|
55
57
|
[ThemeId.Dark]: {
|
|
56
58
|
chatHeader: {
|
package/tsconfig.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
18
18
|
"sourceMap": true /* Generates corresponding '.map' file. */,
|
|
19
19
|
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
20
|
-
"outDir": "./
|
|
20
|
+
"outDir": "./dist" /* Redirect output structure to the directory. */,
|
|
21
21
|
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
22
22
|
// "composite": true, /* Enable project compilation */
|
|
23
23
|
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
@@ -65,7 +65,8 @@
|
|
|
65
65
|
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
66
66
|
|
|
67
67
|
/* Experimental Options */
|
|
68
|
-
|
|
68
|
+
"experimentalDecorators": true /* Required for Lit: https://lit.dev/docs/components/decorators/#decorators-typescript */,
|
|
69
|
+
"useDefineForClassFields": false /* Required for Lit: https://lit.dev/docs/components/decorators/#decorators-typescript */,
|
|
69
70
|
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
70
71
|
|
|
71
72
|
/* Advanced Options */
|
|
@@ -73,5 +74,10 @@
|
|
|
73
74
|
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
|
|
74
75
|
"plugins": [{ "name": "typescript-plugin-css-modules" }]
|
|
75
76
|
},
|
|
76
|
-
"include": [
|
|
77
|
+
"include": [
|
|
78
|
+
"./src/MEChat.ts",
|
|
79
|
+
"declarations.d.ts",
|
|
80
|
+
"index.ts",
|
|
81
|
+
"./src/WebComponent/"
|
|
82
|
+
]
|
|
77
83
|
}
|
package/webpack.config.cjs
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
2
|
const path = require("path");
|
|
3
|
-
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
4
3
|
const Dotenv = require("dotenv-webpack");
|
|
5
4
|
const { EnvironmentPlugin } = require("webpack");
|
|
6
5
|
|
|
7
|
-
module.exports = (
|
|
6
|
+
module.exports = () => {
|
|
8
7
|
return {
|
|
9
8
|
devServer: {
|
|
10
9
|
static: "./public/demo",
|
|
11
10
|
hot: true,
|
|
12
11
|
port: 8000,
|
|
13
12
|
},
|
|
14
|
-
entry:
|
|
13
|
+
entry: "./src/MEChat.ts",
|
|
15
14
|
module: {
|
|
16
15
|
rules: [
|
|
17
16
|
{
|
|
@@ -21,13 +20,7 @@ module.exports = (env) => {
|
|
|
21
20
|
},
|
|
22
21
|
{
|
|
23
22
|
test: /\.(c|sa|sc)ss$/,
|
|
24
|
-
use: [
|
|
25
|
-
"style-loader",
|
|
26
|
-
// Emits TypeScript declaration files matching your CSS Modules
|
|
27
|
-
"css-modules-typescript-loader",
|
|
28
|
-
"css-loader",
|
|
29
|
-
"sass-loader",
|
|
30
|
-
],
|
|
23
|
+
use: ["style-loader", "css-loader"],
|
|
31
24
|
},
|
|
32
25
|
],
|
|
33
26
|
},
|
|
@@ -35,29 +28,19 @@ module.exports = (env) => {
|
|
|
35
28
|
extensions: [".tsx", ".ts", ".js", ".css", ".scss"],
|
|
36
29
|
},
|
|
37
30
|
experiments: {
|
|
38
|
-
outputModule:
|
|
31
|
+
outputModule: true,
|
|
39
32
|
},
|
|
40
33
|
output: {
|
|
41
34
|
filename: "index.js",
|
|
42
35
|
sourceMapFilename: "index.js.map",
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
: {
|
|
48
|
-
path: path.resolve(__dirname, "public/dist"),
|
|
49
|
-
library: {
|
|
50
|
-
type: "module",
|
|
51
|
-
},
|
|
52
|
-
}),
|
|
36
|
+
path: path.resolve(__dirname, "public/dist"),
|
|
37
|
+
library: {
|
|
38
|
+
type: "module",
|
|
39
|
+
},
|
|
53
40
|
},
|
|
54
41
|
plugins: [
|
|
55
|
-
...(env.isDemoApp
|
|
56
|
-
? [new HtmlWebpackPlugin({ template: "./public/demo/index.html" })]
|
|
57
|
-
: []),
|
|
58
42
|
new Dotenv(),
|
|
59
43
|
new EnvironmentPlugin({
|
|
60
|
-
IS_DEMO_APP: !!env.isDemoApp,
|
|
61
44
|
LAUNCHDARKLY_CLIENT_ID: "6119b3a2ceeceb24f45c7e66",
|
|
62
45
|
}),
|
|
63
46
|
],
|
package/public/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./src/MEChat";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface ChatButtonProps {
|
|
3
|
-
text: string;
|
|
4
|
-
onClick?: React.MouseEventHandler;
|
|
5
|
-
className?: string;
|
|
6
|
-
useGlowingBorder?: boolean;
|
|
7
|
-
}
|
|
8
|
-
declare const ChatButton: React.FunctionComponent<ChatButtonProps>;
|
|
9
|
-
export default ChatButton;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface InHouseLauncherProps {
|
|
3
|
-
onChatTapped: () => void;
|
|
4
|
-
mobile: boolean;
|
|
5
|
-
firstMount: boolean;
|
|
6
|
-
backgroundColor: string;
|
|
7
|
-
textColor: string;
|
|
8
|
-
mini: boolean;
|
|
9
|
-
}
|
|
10
|
-
declare const InHouseLauncher: React.FunctionComponent<InHouseLauncherProps>;
|
|
11
|
-
export default InHouseLauncher;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import Talk from "talkjs";
|
|
2
|
-
import { Theme, ThemeIdString } from "./themes";
|
|
3
|
-
/**
|
|
4
|
-
* The interface to MeetElise chat.
|
|
5
|
-
*
|
|
6
|
-
* To add meetelise chat to the screen, call its static method
|
|
7
|
-
* `start()` with your building and organization slug.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* MEChat.start({
|
|
11
|
-
* organization: 'the-jacobson-group',
|
|
12
|
-
* building: 'twin-rivers-pointe'
|
|
13
|
-
* });
|
|
14
|
-
*/
|
|
15
|
-
export default class MEChat {
|
|
16
|
-
static session: Promise<Talk.Session>;
|
|
17
|
-
/**
|
|
18
|
-
* Start an instance of MeetElise chat and add to the web page.
|
|
19
|
-
*
|
|
20
|
-
* @param opts The organization, building, and theme overrides.
|
|
21
|
-
* @returns An instance of MeetElise chat.
|
|
22
|
-
*/
|
|
23
|
-
static start(opts: Options): MEChat;
|
|
24
|
-
/**
|
|
25
|
-
* Remove the instance from the screen.
|
|
26
|
-
*
|
|
27
|
-
* Chat will be unusable after this. If you just need to hide the
|
|
28
|
-
* chat button, use {@link MEChat#hide} instead.
|
|
29
|
-
*/
|
|
30
|
-
remove(): void;
|
|
31
|
-
/**
|
|
32
|
-
* Clear all messages from the window and start a new conversation.
|
|
33
|
-
*/
|
|
34
|
-
restartConversation(): void;
|
|
35
|
-
/**
|
|
36
|
-
* Update the theme of the running chat instance.
|
|
37
|
-
*
|
|
38
|
-
* @param theme The updated theme
|
|
39
|
-
*/
|
|
40
|
-
setTheme(newTheme: Partial<Theme>): void;
|
|
41
|
-
/** Open the messages window */
|
|
42
|
-
open(): void;
|
|
43
|
-
/** Close the messages window */
|
|
44
|
-
close(): void;
|
|
45
|
-
/** Show the chat button on the screen if it was previously hidden. */
|
|
46
|
-
show(): void;
|
|
47
|
-
/** Hide the chat button from the screen (but don't remove from the DOM). */
|
|
48
|
-
hide(): void;
|
|
49
|
-
/** Show a custom launcher designed in-house instead of the default TalkJS launcher. */
|
|
50
|
-
private mountInHouseLauncher;
|
|
51
|
-
private getInHouseLauncher;
|
|
52
|
-
private buildingSlug;
|
|
53
|
-
private orgSlug;
|
|
54
|
-
private popup;
|
|
55
|
-
private launcher;
|
|
56
|
-
private building;
|
|
57
|
-
private themeId?;
|
|
58
|
-
private theme;
|
|
59
|
-
private avatarSrc?;
|
|
60
|
-
private chatId;
|
|
61
|
-
private analytics;
|
|
62
|
-
private useInHouseLauncher;
|
|
63
|
-
private useMiniWidget;
|
|
64
|
-
private isMobile;
|
|
65
|
-
private constructor();
|
|
66
|
-
}
|
|
67
|
-
export interface Options {
|
|
68
|
-
building: string;
|
|
69
|
-
organization: string;
|
|
70
|
-
themeId?: ThemeIdString;
|
|
71
|
-
avatarSrc?: string;
|
|
72
|
-
mini?: boolean;
|
|
73
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A connection to the MeetElise API to send analytics events.
|
|
3
|
-
*/
|
|
4
|
-
export default class Analytics {
|
|
5
|
-
private org;
|
|
6
|
-
private building;
|
|
7
|
-
private featureFlags?;
|
|
8
|
-
chatId: string;
|
|
9
|
-
constructor(org: string, building: string, chatId: string);
|
|
10
|
-
/**
|
|
11
|
-
* Store feature flag value(s) on the Analytics object to be sent with future pings. If `featureFlags` object is already present, the argument is merged into it.
|
|
12
|
-
*/
|
|
13
|
-
setFeatureFlags(featureFlags: Record<string, boolean>): void;
|
|
14
|
-
/**
|
|
15
|
-
* Send an event. Takes one argument, the event type name.
|
|
16
|
-
*/
|
|
17
|
-
ping(eventType: string): void;
|
|
18
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get or create a UUID that is the same between browser sessions.
|
|
3
|
-
* If the UUID is past its expiration time, create a new one.
|
|
4
|
-
*
|
|
5
|
-
* @returns the chat ID.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getChatID(org: string, building: string): string;
|
|
8
|
-
/**
|
|
9
|
-
* Create a new chat ID, discard any old one, and record the time it was issued.
|
|
10
|
-
*/
|
|
11
|
-
export declare function createChatID(org: string, building: string): string;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import Talk from "talkjs";
|
|
2
|
-
import { Building } from "./fetchBuildingInfo";
|
|
3
|
-
import { Theme } from "./themes";
|
|
4
|
-
export default function createConversation(session: Talk.Session, building: Building, theme: Theme, avatarSrc: Building["avatarSrc"], chatID: string, isMobile: boolean): Talk.ConversationBuilder;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The response from the API.
|
|
3
|
-
*/
|
|
4
|
-
export interface Building {
|
|
5
|
-
id: number;
|
|
6
|
-
themeId: string;
|
|
7
|
-
avatarSrc: string | null;
|
|
8
|
-
avatarType: "image" | "initials" | null;
|
|
9
|
-
chatSubtitle: string | null;
|
|
10
|
-
chatTitle: string | null;
|
|
11
|
-
name: string;
|
|
12
|
-
userFirstName: string;
|
|
13
|
-
userId: number;
|
|
14
|
-
welcomeMessage: string | null;
|
|
15
|
-
conversationMaintenanceMode: boolean;
|
|
16
|
-
orgId: number;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Load the publicly-available info for a building.
|
|
20
|
-
*
|
|
21
|
-
* @param orgSlug - The org slug, e.g. "big-prop-co"
|
|
22
|
-
* @param buildingSlug - The buidling slug, e.g. "gravity-falls"
|
|
23
|
-
* @returns The building's ID, name, theme, and agent.
|
|
24
|
-
*/
|
|
25
|
-
export default function fetchBuildingInfo(orgSlug: string, buildingSlug: string): Promise<Building>;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export declare const enum ThemeId {
|
|
2
|
-
Light = "Light",
|
|
3
|
-
Dark = "Dark",
|
|
4
|
-
Purple = "Purple",
|
|
5
|
-
Blue = "Blue",
|
|
6
|
-
Teal = "Teal",
|
|
7
|
-
Green = "Green",
|
|
8
|
-
Yellow = "Yellow",
|
|
9
|
-
Orange = "Orange",
|
|
10
|
-
Pink = "Pink"
|
|
11
|
-
}
|
|
12
|
-
export declare type ThemeIdString = `${ThemeId}`;
|
|
13
|
-
export interface Theme {
|
|
14
|
-
chatHeader: {
|
|
15
|
-
backgroundColor: string;
|
|
16
|
-
textColor: string;
|
|
17
|
-
};
|
|
18
|
-
chatPaneBackgroundColor: string;
|
|
19
|
-
message: {
|
|
20
|
-
user: {
|
|
21
|
-
textColor: string;
|
|
22
|
-
backgroundColor: string;
|
|
23
|
-
};
|
|
24
|
-
agent: {
|
|
25
|
-
textColor: string;
|
|
26
|
-
backgroundColor: string;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export declare const defaultThemeId = ThemeId.Light;
|
|
31
|
-
export declare const lightMessage: {
|
|
32
|
-
user: {
|
|
33
|
-
textColor: string;
|
|
34
|
-
backgroundColor: string;
|
|
35
|
-
};
|
|
36
|
-
agent: {
|
|
37
|
-
textColor: string;
|
|
38
|
-
backgroundColor: string;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
export declare const darkMessage: {
|
|
42
|
-
user: {
|
|
43
|
-
textColor: string;
|
|
44
|
-
backgroundColor: string;
|
|
45
|
-
};
|
|
46
|
-
agent: {
|
|
47
|
-
textColor: string;
|
|
48
|
-
backgroundColor: string;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
/** If `themeId` is a valid `ThemeId`, returns the corresponding theme. Otherwise returns the default theme. */
|
|
52
|
-
export declare const getTheme: (themeId?: string | undefined) => Theme;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;900&display=swap");
|
|
2
|
-
|
|
3
|
-
$borderRadius: 40px;
|
|
4
|
-
$glowBarGif: url("https://s3.us-west-2.amazonaws.com/meetelise.com/HorizontalBar-Shadow.gif");
|
|
5
|
-
|
|
6
|
-
.chatButton {
|
|
7
|
-
// CSS reset
|
|
8
|
-
all: unset;
|
|
9
|
-
/* `all:revert` does stuff to SVG properties that is maybe explained here (https://stackoverflow.com/a/46760690).
|
|
10
|
-
In our case it prevents the chat icon from being white. */
|
|
11
|
-
*:not(svg, svg *) {
|
|
12
|
-
all: revert;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
font-family: Poppins;
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
background-color: #202020;
|
|
19
|
-
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5);
|
|
20
|
-
border: 2px solid white;
|
|
21
|
-
border-radius: $borderRadius;
|
|
22
|
-
color: white;
|
|
23
|
-
font-weight: 700;
|
|
24
|
-
font-size: 20px;
|
|
25
|
-
padding: 2px 15px;
|
|
26
|
-
margin-right: 7px;
|
|
27
|
-
user-select: none;
|
|
28
|
-
position: relative;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// TODO: the CSS reset undoes these styles. Figure out a better solution than !important on everything
|
|
32
|
-
// Possibly a specificity issue: things were working before commit 03f8503 split ChatButton out from InHouseLauncher
|
|
33
|
-
.chatButtonGlowingBorder {
|
|
34
|
-
position: absolute !important;
|
|
35
|
-
top: 50% !important;
|
|
36
|
-
left: 50% !important;
|
|
37
|
-
transform: translate(-50%, -50%) !important;
|
|
38
|
-
z-index: -1 !important;
|
|
39
|
-
background-image: $glowBarGif !important;
|
|
40
|
-
border-radius: $borderRadius !important;
|
|
41
|
-
height: 125% !important;
|
|
42
|
-
width: 108% !important;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.chatButtonWord {
|
|
46
|
-
margin-left: 7px !important;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.headerText {
|
|
50
|
-
font-weight: 600 !important;
|
|
51
|
-
font-size: 20px !important;
|
|
52
|
-
}
|
package/src/ChatButton.tsx
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import ChatIcon from "./ChatIcon";
|
|
3
|
-
import styles from "./ChatButton.module.scss";
|
|
4
|
-
import classnames from "classnames";
|
|
5
|
-
|
|
6
|
-
interface ChatButtonProps {
|
|
7
|
-
text: string;
|
|
8
|
-
onClick?: React.MouseEventHandler;
|
|
9
|
-
className?: string;
|
|
10
|
-
useGlowingBorder?: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const ChatButton: React.FunctionComponent<ChatButtonProps> = ({
|
|
14
|
-
text,
|
|
15
|
-
onClick,
|
|
16
|
-
className,
|
|
17
|
-
useGlowingBorder = false,
|
|
18
|
-
}: ChatButtonProps) => (
|
|
19
|
-
<div className={classnames(styles.chatButton, className)} onClick={onClick}>
|
|
20
|
-
{useGlowingBorder && <div className={styles.chatButtonGlowingBorder}></div>}
|
|
21
|
-
<ChatIcon />
|
|
22
|
-
<span className={styles.chatButtonWord}>{text}</span>
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
export default ChatButton;
|
package/src/ChatIcon.tsx
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
interface ChatIconProps {
|
|
4
|
-
className?: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const ChatIcon: React.FunctionComponent<ChatIconProps> = ({
|
|
8
|
-
className,
|
|
9
|
-
}: ChatIconProps) => (
|
|
10
|
-
<svg
|
|
11
|
-
className={className}
|
|
12
|
-
style={{ height: "14px" }}
|
|
13
|
-
width="24"
|
|
14
|
-
height="24"
|
|
15
|
-
viewBox="0 0 24 24"
|
|
16
|
-
fill="none"
|
|
17
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
-
>
|
|
19
|
-
<path
|
|
20
|
-
d="M13.2 10.8H6C5.68174 10.8 5.37652 10.9264 5.15147 11.1515C4.92643 11.3765 4.8 11.6817 4.8 12C4.8 12.3183 4.92643 12.6235 5.15147 12.8485C5.37652 13.0736 5.68174 13.2 6 13.2H13.2C13.5183 13.2 13.8235 13.0736 14.0485 12.8485C14.2736 12.6235 14.4 12.3183 14.4 12C14.4 11.6817 14.2736 11.3765 14.0485 11.1515C13.8235 10.9264 13.5183 10.8 13.2 10.8ZM18 6H6C5.68174 6 5.37652 6.12643 5.15147 6.35147C4.92643 6.57652 4.8 6.88174 4.8 7.2C4.8 7.51826 4.92643 7.82348 5.15147 8.04853C5.37652 8.27357 5.68174 8.4 6 8.4H18C18.3183 8.4 18.6235 8.27357 18.8485 8.04853C19.0736 7.82348 19.2 7.51826 19.2 7.2C19.2 6.88174 19.0736 6.57652 18.8485 6.35147C18.6235 6.12643 18.3183 6 18 6ZM20.4 0H3.6C2.64522 0 1.72955 0.379285 1.05442 1.05442C0.379285 1.72955 0 2.64522 0 3.6V15.6C0 16.5548 0.379285 17.4705 1.05442 18.1456C1.72955 18.8207 2.64522 19.2 3.6 19.2H17.508L21.948 23.652C22.0601 23.7632 22.1931 23.8512 22.3393 23.9109C22.4855 23.9706 22.6421 24.0009 22.8 24C22.9574 24.0041 23.1136 23.9712 23.256 23.904C23.4751 23.814 23.6627 23.6611 23.7951 23.4646C23.9275 23.2682 23.9988 23.0369 24 22.8V3.6C24 2.64522 23.6207 1.72955 22.9456 1.05442C22.2705 0.379285 21.3548 0 20.4 0ZM21.6 19.908L18.852 17.148C18.7399 17.0368 18.6069 16.9488 18.4607 16.8891C18.3145 16.8294 18.1579 16.7991 18 16.8H3.6C3.28174 16.8 2.97652 16.6736 2.75147 16.4485C2.52643 16.2235 2.4 15.9183 2.4 15.6V3.6C2.4 3.28174 2.52643 2.97652 2.75147 2.75147C2.97652 2.52643 3.28174 2.4 3.6 2.4H20.4C20.7183 2.4 21.0235 2.52643 21.2485 2.75147C21.4736 2.97652 21.6 3.28174 21.6 3.6V19.908Z"
|
|
21
|
-
fill="white"
|
|
22
|
-
/>
|
|
23
|
-
</svg>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
export default ChatIcon;
|