@meetelise/chat 1.20.39 → 1.20.41

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.
@@ -1,6 +1,7 @@
1
1
  import { LitElement, html, TemplateResult, css } from "lit";
2
2
  import { property, state, query, customElement } from "lit/decorators.js";
3
3
  import { classMap } from "lit/directives/class-map.js";
4
+ import { InputStyles } from "./actions/InputStyles";
4
5
 
5
6
  type MeSelectOption = {
6
7
  label: string;
@@ -45,6 +46,12 @@ export class MESelect extends LitElement {
45
46
  this.isOpen = !this.isOpen;
46
47
  this.activeOption = null;
47
48
  }
49
+
50
+ if (!this.value) {
51
+ this.meSelect.style.color = "rgba(32, 32, 32, 0.5)";
52
+ } else {
53
+ this.meSelect.style.color = "rgba(32, 32, 32, 1)";
54
+ }
48
55
  this.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
49
56
  };
50
57
 
@@ -75,96 +82,89 @@ export class MESelect extends LitElement {
75
82
  });
76
83
  }
77
84
 
78
- static styles = css`
79
- :host {
80
- --light-grey: #e3e3e3;
81
- --active-option-color: #f5f7f9;
82
- --light-border: 1px solid $light-border-color;
83
- }
85
+ static styles = [
86
+ css`
87
+ :host {
88
+ --light-grey: #e3e3e3;
89
+ --active-option-color: #f5f7f9;
90
+ --light-border: 1px solid $light-border-color;
91
+ }
84
92
 
85
- * {
86
- box-sizing: border-box;
87
- user-select: none;
88
- font-family: Poppins;
89
- font-size: 14px;
90
- }
93
+ ul {
94
+ padding-left: 0;
95
+ margin-bottom: 0;
96
+ max-height: 200px;
97
+ overflow-y: scroll;
98
+ position: absolute;
99
+ min-height: 40px;
100
+ min-width: 144px;
101
+ max-width: 400px;
102
+ width: max-content;
103
+ background-color: white;
104
+ z-index: 20;
105
+ margin-top: 4px;
106
+ border: var(--light-border);
107
+ box-sizing: border-box;
108
+ box-shadow: 0px 4px 14px rgba(0, 0, 0, 0.15);
109
+ border-radius: 10px;
91
110
 
92
- #select {
93
- height: 50px;
94
- min-width: 144px;
95
- width: fit-content;
96
- display: flex;
97
- justify-content: space-between;
98
- gap: 17px;
99
- padding: 14.5px;
100
- padding-right: 19.5px;
101
- align-items: center;
102
- background: white;
103
- border: 1px solid #e3e3e3;
104
- box-sizing: border-box;
105
- box-shadow: 0px 1px 0px rgba(142, 142, 142, 0.2);
106
- border-radius: 10px;
107
- }
111
+ font-size: 14px;
112
+ line-height: 14px;
113
+ font-family: "Poppins";
114
+ }
108
115
 
109
- ul {
110
- padding-left: 0;
111
- margin-bottom: 0;
112
- max-height: 200px;
113
- overflow-y: scroll;
114
- position: absolute;
115
- min-height: 40px;
116
- min-width: 144px;
117
- max-width: 400px;
118
- width: max-content;
119
- background-color: white;
120
- z-index: 20;
121
- margin-top: 4px;
122
- border: var(--light-border);
123
- box-sizing: border-box;
124
- box-shadow: 0px 4px 14px rgba(0, 0, 0, 0.15);
125
- border-radius: 10px;
126
- }
116
+ #select {
117
+ width: -webkit-fill-available;
118
+ height: 49px;
119
+ display: flex;
120
+ align-items: center;
121
+ justify-content: space-between;
122
+ color: rgba(32, 32, 32, 0.5);
123
+ }
127
124
 
128
- ::-webkit-scrollbar {
129
- -webkit-appearance: none;
130
- width: 8px;
131
- }
125
+ ::-webkit-scrollbar {
126
+ -webkit-appearance: none;
127
+ width: 8px;
128
+ }
132
129
 
133
- ::-webkit-scrollbar-thumb {
134
- border-radius: 10px;
135
- background-color: rgba(0, 0, 0, 0.4);
136
- -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
137
- }
130
+ ::-webkit-scrollbar-thumb {
131
+ border-radius: 10px;
132
+ background-color: rgba(0, 0, 0, 0.4);
133
+ -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
134
+ }
138
135
 
139
- .option {
140
- list-style: none;
141
- padding: 10px;
142
- }
136
+ .option {
137
+ list-style: none;
138
+ padding: 10px;
139
+ }
143
140
 
144
- .option:first-child {
145
- border-top-left-radius: 10px;
146
- border-top-right-radius: 10px;
147
- }
141
+ .option:first-child {
142
+ border-top-left-radius: 10px;
143
+ border-top-right-radius: 10px;
144
+ }
148
145
 
149
- .option:last-child {
150
- border-bottom-left-radius: 10px;
151
- border-bottom-right-radius: 10px;
152
- }
146
+ .option:last-child {
147
+ border-bottom-left-radius: 10px;
148
+ border-bottom-right-radius: 10px;
149
+ }
153
150
 
154
- /* TODO: why two diff ones? copied from EWA but don't understand */
155
- .option:active {
156
- background-color: var(--light-grey);
157
- }
151
+ /* TODO: why two diff ones? copied from EWA but don't understand */
152
+ .option:active {
153
+ background-color: var(--light-grey);
154
+ }
158
155
 
159
- .option.active {
160
- background-color: var(--active-option-color);
161
- }
162
- `;
156
+ .option.active {
157
+ background-color: var(--active-option-color);
158
+ }
159
+ `,
160
+ InputStyles,
161
+ ];
163
162
  render(): TemplateResult {
164
163
  return html`
165
164
  <div>
166
165
  <div
167
166
  id="select"
167
+ class="webchat-input"
168
168
  tabindex="0"
169
169
  @click=${() => (this.isOpen = !this.isOpen)}
170
170
  @keydown="${(e: KeyboardEvent) => {
package/src/analytics.ts CHANGED
@@ -37,22 +37,6 @@ export default class Analytics {
37
37
  };
38
38
  }
39
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
-
56
40
  /**
57
41
  * Send an event. Takes one argument, the event type name.
58
42
  */
@@ -72,9 +56,25 @@ export default class Analytics {
72
56
  building: this.building,
73
57
  referrer: document.referrer,
74
58
  featureFlags: this.featureFlags,
75
- campaignSources: this.campaignSources(),
59
+ campaignSources: getCampaignSources(),
76
60
  }),
77
61
  }
78
62
  );
79
63
  }
80
64
  }
65
+
66
+ export const getCampaignSources = (): CampaignSources => {
67
+ const queryParams = new URL(window.location.href).searchParams;
68
+ const yardiCampaignSource =
69
+ window.RCTPCampaign?.CampaignDetails?.Source ?? null;
70
+ const entrataCampaignSource = queryParams.get("switch_cls[id]");
71
+ const realpageCampaignSource = queryParams.get("ilm");
72
+ const utmCampaignSource = queryParams.get("utm_source");
73
+
74
+ return {
75
+ entrataCampaignSource,
76
+ realpageCampaignSource,
77
+ utmCampaignSource,
78
+ yardiCampaignSource,
79
+ };
80
+ };
@@ -1,5 +1,5 @@
1
1
  import axios from "axios";
2
- export interface BuildingABType {
2
+ interface BuildingABType {
3
3
  abTestType: string;
4
4
  }
5
5
  export default async function fetchBuildingABTestType(
@@ -0,0 +1,20 @@
1
+ import axios from "axios";
2
+ import { getUrlQueryParameters } from "./postLeadSources";
3
+
4
+ export default async function fetchCurrentParsedLeadSource(): Promise<
5
+ string | null
6
+ > {
7
+ const host = "https://app.meetelise.com";
8
+ try {
9
+ const currentParsedLeadSourceResponse = await axios.get(
10
+ `${host}/platformApi/webchat/current-parsed-lead-source`,
11
+ {
12
+ params: { webchat_query_params: getUrlQueryParameters() },
13
+ }
14
+ );
15
+
16
+ return currentParsedLeadSourceResponse.data;
17
+ } catch (_) {
18
+ return null;
19
+ }
20
+ }
@@ -0,0 +1,17 @@
1
+ import axios from "axios";
2
+ export interface BuildingABType {
3
+ abTestType: string;
4
+ }
5
+ export default async function fetchLeadSources(
6
+ buildingSlug: string
7
+ ): Promise<string[] | null> {
8
+ const host = "https://app.meetelise.com";
9
+ try {
10
+ const leadSourcesResponse = await axios.get(
11
+ `${host}/platformApi/webchat/${buildingSlug}/lead-sources`
12
+ );
13
+ return leadSourcesResponse.data;
14
+ } catch (_) {
15
+ return null;
16
+ }
17
+ }
@@ -0,0 +1,40 @@
1
+ import axios from "axios";
2
+ export interface BuildingABType {
3
+ abTestType: string;
4
+ }
5
+ export default async function postLeadSources({
6
+ chatId,
7
+ website,
8
+ referrer,
9
+ buildingSlug,
10
+ selectedLeadSource,
11
+ }: {
12
+ chatId: string;
13
+ website: string;
14
+ referrer: string;
15
+ buildingSlug: string;
16
+ selectedLeadSource: string;
17
+ }): Promise<string | null> {
18
+ const host = "https://app.meetelise.com";
19
+ try {
20
+ const abTestTypeResponse = await axios.post(
21
+ `${host}/platformApi/webchat/lead-sourced`,
22
+ {
23
+ chat_id: chatId,
24
+ website: website,
25
+ referrer: referrer,
26
+ query_params: getUrlQueryParameters(),
27
+ building_slug: buildingSlug,
28
+ timestamp: new Date(),
29
+ selected_lead_source: selectedLeadSource,
30
+ }
31
+ );
32
+ return abTestTypeResponse.data;
33
+ } catch (_) {
34
+ return null;
35
+ }
36
+ }
37
+
38
+ export function getUrlQueryParameters(): { [queryKey: string]: string } | null {
39
+ return Object.fromEntries(new URLSearchParams(window.location.search));
40
+ }
package/tsconfig.json CHANGED
@@ -8,7 +8,8 @@
8
8
  "module": "esnext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
9
9
  "lib": [
10
10
  "esnext",
11
- "dom"
11
+ "dom",
12
+ "dom.iterable"
12
13
  ] /* Specify library files to be included in the compilation. */,
13
14
  // "allowJs": true, /* Allow javascript files to be compiled. */
14
15
  // "checkJs": true, /* Report errors in .js files. */