@morgan-and-morgan/intake-agent 1.2.0 → 1.3.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/dist/mm-intake-widget.js +13 -4
- package/package.json +1 -1
package/dist/mm-intake-widget.js
CHANGED
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
}
|
|
37
37
|
return Object.keys(sanitized).length === 0 ? null : sanitized;
|
|
38
38
|
};
|
|
39
|
-
const
|
|
40
|
-
const
|
|
39
|
+
const LANDING_PAGE_COOKIES = ["trackedLandingPage", "tracked_landing_page"];
|
|
40
|
+
const LANDING_TIMESTAMP_COOKIES = ["trackedLandingPageTimestamp", "tracked_landing_timestamp"];
|
|
41
41
|
const readTimestampCookie = (cookie) => {
|
|
42
|
-
const raw =
|
|
42
|
+
const raw = readFirstCookie(cookie, LANDING_TIMESTAMP_COOKIES);
|
|
43
43
|
return raw === void 0 ? void 0 : decodeCookieValue(raw);
|
|
44
44
|
};
|
|
45
45
|
const readCookie = (cookie, name) => {
|
|
@@ -47,6 +47,15 @@
|
|
|
47
47
|
const raw = (_a = cookie.split(";").map((entry) => entry.trim()).find((entry) => entry.startsWith(`${name}=`))) == null ? void 0 : _a.slice(name.length + 1);
|
|
48
48
|
return raw === void 0 || raw === "" ? void 0 : raw;
|
|
49
49
|
};
|
|
50
|
+
const readFirstCookie = (cookie, names) => {
|
|
51
|
+
for (const name of names) {
|
|
52
|
+
const raw = readCookie(cookie, name);
|
|
53
|
+
if (raw !== void 0) {
|
|
54
|
+
return raw;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return void 0;
|
|
58
|
+
};
|
|
50
59
|
const decodeCookieValue = (raw) => {
|
|
51
60
|
try {
|
|
52
61
|
return decodeURIComponent(raw);
|
|
@@ -62,7 +71,7 @@
|
|
|
62
71
|
}
|
|
63
72
|
};
|
|
64
73
|
const readLandingPage = (cookie) => {
|
|
65
|
-
const raw =
|
|
74
|
+
const raw = readFirstCookie(cookie, LANDING_PAGE_COOKIES);
|
|
66
75
|
if (raw === void 0 || parseUrl(raw) !== null) {
|
|
67
76
|
return raw;
|
|
68
77
|
}
|