@meetelise/chat 1.20.73 → 1.20.74
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/public/demo/index.html +24 -0
- package/public/dist/index.js +87 -87
- package/src/MEChat.ts +21 -13
- package/src/WebComponent/Scheduler/tour-scheduler.ts +23 -0
- package/src/WebComponent/actions/email-us-window.ts +9 -1
- package/src/WebComponent/actions/text-us-window.ts +5 -1
- package/src/gtm.ts +17 -0
package/src/MEChat.ts
CHANGED
|
@@ -273,6 +273,7 @@ const overrideContactUsForm = async (
|
|
|
273
273
|
"Missing the following form elements: " + missingElements.join(", ")
|
|
274
274
|
);
|
|
275
275
|
}
|
|
276
|
+
const originalButtonText = btn.textContent;
|
|
276
277
|
|
|
277
278
|
// Replace the original form element with the cloned one
|
|
278
279
|
const clonedButton = btn.cloneNode(true) as HTMLButtonElement;
|
|
@@ -282,6 +283,9 @@ const overrideContactUsForm = async (
|
|
|
282
283
|
if (!isValid()) return;
|
|
283
284
|
event.preventDefault();
|
|
284
285
|
|
|
286
|
+
clonedButton.textContent = "Processing request...";
|
|
287
|
+
clonedButton.disabled = true;
|
|
288
|
+
|
|
285
289
|
const formValues: { [key: string]: string | undefined } = {};
|
|
286
290
|
Object.entries(getFormElements()).forEach(
|
|
287
291
|
([key, val]) => (formValues[key] = val?.value)
|
|
@@ -325,21 +329,25 @@ const overrideContactUsForm = async (
|
|
|
325
329
|
"org-slug": orgSlug,
|
|
326
330
|
},
|
|
327
331
|
body: jsonData,
|
|
328
|
-
})
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
+
})
|
|
333
|
+
.then((response) => {
|
|
334
|
+
if (!response.ok) {
|
|
335
|
+
throw new Error(`HTTP error ${response.status}`);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
form.reset();
|
|
339
|
+
Object.values(getFormElements()).forEach((el) => {
|
|
340
|
+
if (!el) return;
|
|
341
|
+
el.disabled = true;
|
|
342
|
+
});
|
|
343
|
+
clonedButton.textContent = "Submitted";
|
|
344
|
+
clonedButton.disabled = true;
|
|
332
345
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
346
|
+
return response.json();
|
|
347
|
+
})
|
|
348
|
+
.catch(() => {
|
|
349
|
+
clonedButton.textContent = originalButtonText;
|
|
337
350
|
});
|
|
338
|
-
clonedButton.textContent = "Submitted";
|
|
339
|
-
clonedButton.disabled = true;
|
|
340
|
-
|
|
341
|
-
return response.json();
|
|
342
|
-
});
|
|
343
351
|
};
|
|
344
352
|
};
|
|
345
353
|
|
|
@@ -30,6 +30,7 @@ import { InputStyles } from "../actions/InputStyles";
|
|
|
30
30
|
import { classMap } from "lit/directives/class-map.js";
|
|
31
31
|
import postLeadSources from "../../postLeadSources";
|
|
32
32
|
import { FeatureFlagsShowDropdown } from "../../fetchFeatureFlag";
|
|
33
|
+
import { pushGtmEvent } from "../../gtm";
|
|
33
34
|
|
|
34
35
|
const getHumanReadableLayout = (layout: string) => {
|
|
35
36
|
if (layout == "studio") return "Studio";
|
|
@@ -373,6 +374,28 @@ export class TourScheduler extends LitElement {
|
|
|
373
374
|
? this.selectedLeadSource.value
|
|
374
375
|
: this.currentLeadSource;
|
|
375
376
|
|
|
377
|
+
pushGtmEvent("scheduleTourSubmitted", {
|
|
378
|
+
email: this.email,
|
|
379
|
+
phone: `+1${this.phoneNumber.match(/\d/g)?.join("")}`,
|
|
380
|
+
firstName: this.firstNameInput.value,
|
|
381
|
+
lastName: this.lastNameInput.value,
|
|
382
|
+
tourType: tourTypeForSubmission[this.tourType],
|
|
383
|
+
tourTime: `${this.selectedTime.datetime}${this.selectedTime.offset}`,
|
|
384
|
+
layouts: this.layoutTypeSelect.value
|
|
385
|
+
? [this.layoutTypeSelect.value]
|
|
386
|
+
: null,
|
|
387
|
+
unitNumbers:
|
|
388
|
+
this.unitTypeSelect && this.unitTypeSelect.value
|
|
389
|
+
? [this.unitTypeSelect.value]
|
|
390
|
+
: null,
|
|
391
|
+
lead_sources: [
|
|
392
|
+
...new Set(
|
|
393
|
+
parsedLeadSource
|
|
394
|
+
? [parsedLeadSource, "property-website"]
|
|
395
|
+
: ["property-website"]
|
|
396
|
+
),
|
|
397
|
+
],
|
|
398
|
+
});
|
|
376
399
|
const data = {
|
|
377
400
|
referrer: document.referrer,
|
|
378
401
|
email_address: this.email,
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { InputStyles } from "./InputStyles";
|
|
16
16
|
import axios from "axios";
|
|
17
17
|
import { FeatureFlagsShowDropdown } from "../../fetchFeatureFlag";
|
|
18
|
+
import { pushGtmEvent } from "../../gtm";
|
|
18
19
|
|
|
19
20
|
@customElement("email-us-window")
|
|
20
21
|
export class EmailUsWindow extends LitElement {
|
|
@@ -488,7 +489,14 @@ const createEmail = async (
|
|
|
488
489
|
// @ts-ignore
|
|
489
490
|
query_params: Object.fromEntries(queryParams.entries()),
|
|
490
491
|
};
|
|
491
|
-
|
|
492
|
+
pushGtmEvent("emailUsSubmitted", {
|
|
493
|
+
firstName,
|
|
494
|
+
lastName,
|
|
495
|
+
email,
|
|
496
|
+
phone: formattedPhoneNumber,
|
|
497
|
+
message,
|
|
498
|
+
leadSources,
|
|
499
|
+
});
|
|
492
500
|
await axios.post(
|
|
493
501
|
"https://app.meetelise.com/platformApi/state/create/emailMe",
|
|
494
502
|
requestBody,
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from "./formatPhoneNumber";
|
|
11
11
|
import { InputStyles } from "./InputStyles";
|
|
12
12
|
import axios from "axios";
|
|
13
|
+
import { pushGtmEvent } from "../../gtm";
|
|
13
14
|
|
|
14
15
|
@customElement("text-us-window")
|
|
15
16
|
export class TextUsWindow extends LitElement {
|
|
@@ -266,7 +267,10 @@ const createTextWithUs = async (
|
|
|
266
267
|
// @ts-ignore
|
|
267
268
|
query_params: Object.fromEntries(queryParams.entries()),
|
|
268
269
|
};
|
|
269
|
-
|
|
270
|
+
pushGtmEvent("textUsSubmitted", {
|
|
271
|
+
phone: formattedPhoneNumber,
|
|
272
|
+
leadSources,
|
|
273
|
+
});
|
|
270
274
|
await axios.post(
|
|
271
275
|
"https://app.meetelise.com/platformApi/state/create/textMe",
|
|
272
276
|
requestBody,
|
package/src/gtm.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
|
+
dataLayer: any[];
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const pushGtmEvent = (
|
|
9
|
+
eventName: string,
|
|
10
|
+
event: Record<string, unknown> = {}
|
|
11
|
+
): void => {
|
|
12
|
+
window.dataLayer = window.dataLayer || [];
|
|
13
|
+
window.dataLayer.push({
|
|
14
|
+
event: eventName,
|
|
15
|
+
...event,
|
|
16
|
+
});
|
|
17
|
+
};
|