@elliemae/pui-logrocket 1.2.3-beta.1 → 1.2.4
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/build/docs/404.html +2 -2
- package/build/docs/api/functions/buildLogRocketQueryParams/index.html +2 -2
- package/build/docs/api/functions/hasUserConsentedToSessionRecording/index.html +3 -3
- package/build/docs/api/functions/initLogRocket/index.html +2 -2
- package/build/docs/api/index.html +2 -2
- package/build/docs/api/type-aliases/LROptions/index.html +2 -2
- package/build/docs/assets/js/04ee7372.c7af6b05.js +1 -0
- package/build/docs/assets/js/211c08f1.c26e72ea.js +1 -0
- package/build/docs/assets/js/e376fc56.0c9034e0.js +1 -0
- package/build/docs/assets/js/main.33883ccf.js +2 -0
- package/build/docs/assets/js/{runtime~main.2c9f76e8.js → runtime~main.4402f01c.js} +1 -1
- package/build/docs/compliance/index.html +6 -6
- package/build/docs/index.html +2 -2
- package/build/docs/usage-guide/index.html +53 -102
- package/dist/cjs/logrocket.js +45 -18
- package/dist/esm/logrocket.js +44 -18
- package/dist/public/index.html +1 -1
- package/dist/public/js/emuiLogrocket.b05aab66ef02cf198fdf.js +45 -0
- package/dist/public/js/emuiLogrocket.b05aab66ef02cf198fdf.js.br +0 -0
- package/dist/public/js/emuiLogrocket.b05aab66ef02cf198fdf.js.gz +0 -0
- package/dist/public/js/emuiLogrocket.b05aab66ef02cf198fdf.js.map +1 -0
- package/dist/types/lib/logrocket.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/umd/index.js +16 -16
- package/dist/umd/index.js.br +0 -0
- package/dist/umd/index.js.gz +0 -0
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
- package/build/docs/assets/js/04ee7372.7628802a.js +0 -1
- package/build/docs/assets/js/211c08f1.f5d0523b.js +0 -1
- package/build/docs/assets/js/e376fc56.e8d801d6.js +0 -1
- package/build/docs/assets/js/main.7d1e671a.js +0 -2
- package/dist/public/js/emuiLogrocket.e8b7c0d946880c4dfd80.js +0 -45
- package/dist/public/js/emuiLogrocket.e8b7c0d946880c4dfd80.js.br +0 -0
- package/dist/public/js/emuiLogrocket.e8b7c0d946880c4dfd80.js.gz +0 -0
- package/dist/public/js/emuiLogrocket.e8b7c0d946880c4dfd80.js.map +0 -1
- /package/build/docs/assets/js/{main.7d1e671a.js.LICENSE.txt → main.33883ccf.js.LICENSE.txt} +0 -0
package/dist/cjs/logrocket.js
CHANGED
|
@@ -36,6 +36,7 @@ module.exports = __toCommonJS(logrocket_exports);
|
|
|
36
36
|
var import_setup = __toESM(require("logrocket/setup"));
|
|
37
37
|
var import_logrocket_react = __toESM(require("logrocket-react"));
|
|
38
38
|
var import_utils = require("./utils.js");
|
|
39
|
+
const import_meta = {};
|
|
39
40
|
const setupLogRocketReact = import_logrocket_react.default.default || import_logrocket_react.default;
|
|
40
41
|
const setup = import_setup.default.default || import_setup.default;
|
|
41
42
|
window.emui = window.emui || {};
|
|
@@ -49,6 +50,12 @@ let scriptSrc = null;
|
|
|
49
50
|
if (typeof document !== "undefined" && document.currentScript) {
|
|
50
51
|
scriptSrc = document.currentScript.src;
|
|
51
52
|
}
|
|
53
|
+
if (!scriptSrc) {
|
|
54
|
+
try {
|
|
55
|
+
scriptSrc = typeof import_meta !== "undefined" ? import_meta.url : null;
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
}
|
|
52
59
|
if (scriptSrc && /(cdn\.mortgagetech\.(.*\.)?ice\.com|\/\/localhost[\d:/])/.test(scriptSrc)) {
|
|
53
60
|
try {
|
|
54
61
|
const url = new URL(scriptSrc);
|
|
@@ -107,9 +114,8 @@ const getParentDomain = () => {
|
|
|
107
114
|
}
|
|
108
115
|
return parentDomain;
|
|
109
116
|
};
|
|
110
|
-
const buildChildDomains = () => {
|
|
117
|
+
const buildChildDomains = (override) => {
|
|
111
118
|
const currentOrigin = window.location.origin;
|
|
112
|
-
const override = window.emui?.logRocketConfig?.childDomains;
|
|
113
119
|
if (override === void 0 || override === null) {
|
|
114
120
|
return [currentOrigin];
|
|
115
121
|
}
|
|
@@ -121,7 +127,11 @@ const buildChildDomains = () => {
|
|
|
121
127
|
}
|
|
122
128
|
const { valid, invalid } = override.reduce(
|
|
123
129
|
(acc, entry) => {
|
|
124
|
-
(
|
|
130
|
+
if (typeof entry === "string" && isValidOrigin(entry)) {
|
|
131
|
+
acc.valid.push(entry);
|
|
132
|
+
} else {
|
|
133
|
+
acc.invalid.push(String(entry));
|
|
134
|
+
}
|
|
125
135
|
return acc;
|
|
126
136
|
},
|
|
127
137
|
{ valid: [], invalid: [] }
|
|
@@ -135,8 +145,7 @@ const buildChildDomains = () => {
|
|
|
135
145
|
if (valid.includes(currentOrigin)) return valid;
|
|
136
146
|
return [...valid, currentOrigin];
|
|
137
147
|
};
|
|
138
|
-
const buildParentDomain = () => {
|
|
139
|
-
const override = window.emui?.logRocketConfig?.parentDomain;
|
|
148
|
+
const buildParentDomain = (override) => {
|
|
140
149
|
if (override !== void 0 && override !== null) {
|
|
141
150
|
if (typeof override === "string" && isValidOrigin(override)) {
|
|
142
151
|
return override;
|
|
@@ -149,24 +158,25 @@ const buildParentDomain = () => {
|
|
|
149
158
|
return getParentDomain();
|
|
150
159
|
};
|
|
151
160
|
const ROOT_HOSTNAME_RE = /[^.]+\.[^.]+$/;
|
|
152
|
-
const getRootHostname = () => {
|
|
161
|
+
const getRootHostname = (override) => {
|
|
153
162
|
const match = ROOT_HOSTNAME_RE.exec(window.location.hostname);
|
|
154
163
|
const auto = match ? `.${match[0]}` : void 0;
|
|
155
|
-
|
|
156
|
-
if (override && auto && override.startsWith(".") && override.endsWith(auto)) {
|
|
164
|
+
if (typeof override === "string" && auto && override.startsWith(".") && override.endsWith(auto)) {
|
|
157
165
|
return override;
|
|
158
166
|
}
|
|
159
|
-
if (override) {
|
|
167
|
+
if (override !== void 0 && override !== null) {
|
|
160
168
|
const autoLabel = auto ?? "(none)";
|
|
161
169
|
getLogger().warn(
|
|
162
|
-
`LogRocket rootHostname override "${
|
|
170
|
+
`LogRocket rootHostname override "${String(
|
|
171
|
+
override
|
|
172
|
+
)}" ignored: must start with "." and end with the auto-detected "${autoLabel}". Using auto-detected value.`
|
|
163
173
|
);
|
|
164
174
|
}
|
|
165
175
|
return auto;
|
|
166
176
|
};
|
|
167
|
-
const getDefaultOptions = () => {
|
|
168
|
-
const childDomains = buildChildDomains();
|
|
169
|
-
const parentDomain = buildParentDomain();
|
|
177
|
+
const getDefaultOptions = (overrides) => {
|
|
178
|
+
const childDomains = buildChildDomains(overrides.childDomains);
|
|
179
|
+
const parentDomain = buildParentDomain(overrides.parentDomain);
|
|
170
180
|
return {
|
|
171
181
|
browser: {
|
|
172
182
|
urlSanitizer: (url) => {
|
|
@@ -217,7 +227,7 @@ const getDefaultOptions = () => {
|
|
|
217
227
|
},
|
|
218
228
|
release: process?.env?.APP_VERSION,
|
|
219
229
|
// app sdk based applications use this env variable to specify the app code version
|
|
220
|
-
rootHostname: getRootHostname(),
|
|
230
|
+
rootHostname: getRootHostname(overrides.rootHostname),
|
|
221
231
|
childDomains,
|
|
222
232
|
...parentDomain ? { parentDomain } : {}
|
|
223
233
|
};
|
|
@@ -243,11 +253,11 @@ const isLogRocketDisabled = () => {
|
|
|
243
253
|
return false;
|
|
244
254
|
};
|
|
245
255
|
const hasUserConsentedToSessionRecording = () => {
|
|
246
|
-
if (
|
|
256
|
+
if (window.emui?.dangerouslyOverrideSessionRecordingConsent === true) {
|
|
247
257
|
getLogger().warn(
|
|
248
258
|
"Using dangerouslyOverrideSessionRecordingConsent - this should only be used for testing purposes"
|
|
249
259
|
);
|
|
250
|
-
return
|
|
260
|
+
return true;
|
|
251
261
|
}
|
|
252
262
|
if (window.OnetrustActiveGroups) {
|
|
253
263
|
return getActiveConsentGroups().includes("C0003");
|
|
@@ -291,8 +301,23 @@ const logInitOutcome = (sessionRecordingEnabled) => {
|
|
|
291
301
|
getLogger().info(`LogRocket session URL: ${sessionURL}`);
|
|
292
302
|
});
|
|
293
303
|
};
|
|
304
|
+
const resolveAutoDetectedOverrides = (fromOptions) => {
|
|
305
|
+
const windowConfig = window.emui?.logRocketConfig;
|
|
306
|
+
return {
|
|
307
|
+
rootHostname: fromOptions.rootHostname ?? windowConfig?.rootHostname,
|
|
308
|
+
childDomains: fromOptions.childDomains ?? windowConfig?.childDomains,
|
|
309
|
+
parentDomain: fromOptions.parentDomain ?? windowConfig?.parentDomain
|
|
310
|
+
};
|
|
311
|
+
};
|
|
294
312
|
const init = (options) => {
|
|
295
|
-
const {
|
|
313
|
+
const {
|
|
314
|
+
appId,
|
|
315
|
+
isReact = true,
|
|
316
|
+
rootHostname,
|
|
317
|
+
childDomains,
|
|
318
|
+
parentDomain,
|
|
319
|
+
...rest
|
|
320
|
+
} = options ?? {};
|
|
296
321
|
lrAppId = getLRAppId(appId);
|
|
297
322
|
if (!lrAppId) {
|
|
298
323
|
throw new Error(
|
|
@@ -306,7 +331,9 @@ const init = (options) => {
|
|
|
306
331
|
return;
|
|
307
332
|
}
|
|
308
333
|
window.emui.lrEnabled = true;
|
|
309
|
-
const defaultOptions = getDefaultOptions(
|
|
334
|
+
const defaultOptions = getDefaultOptions(
|
|
335
|
+
resolveAutoDetectedOverrides({ rootHostname, childDomains, parentDomain })
|
|
336
|
+
);
|
|
310
337
|
const consent = hasUserConsentedToSessionRecording();
|
|
311
338
|
window.emui.lrSessionRecordingConsent = consent;
|
|
312
339
|
if (defaultOptions.dom) {
|
package/dist/esm/logrocket.js
CHANGED
|
@@ -14,6 +14,12 @@ let scriptSrc = null;
|
|
|
14
14
|
if (typeof document !== "undefined" && document.currentScript) {
|
|
15
15
|
scriptSrc = document.currentScript.src;
|
|
16
16
|
}
|
|
17
|
+
if (!scriptSrc) {
|
|
18
|
+
try {
|
|
19
|
+
scriptSrc = typeof import.meta !== "undefined" ? import.meta.url : null;
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
}
|
|
17
23
|
if (scriptSrc && /(cdn\.mortgagetech\.(.*\.)?ice\.com|\/\/localhost[\d:/])/.test(scriptSrc)) {
|
|
18
24
|
try {
|
|
19
25
|
const url = new URL(scriptSrc);
|
|
@@ -72,9 +78,8 @@ const getParentDomain = () => {
|
|
|
72
78
|
}
|
|
73
79
|
return parentDomain;
|
|
74
80
|
};
|
|
75
|
-
const buildChildDomains = () => {
|
|
81
|
+
const buildChildDomains = (override) => {
|
|
76
82
|
const currentOrigin = window.location.origin;
|
|
77
|
-
const override = window.emui?.logRocketConfig?.childDomains;
|
|
78
83
|
if (override === void 0 || override === null) {
|
|
79
84
|
return [currentOrigin];
|
|
80
85
|
}
|
|
@@ -86,7 +91,11 @@ const buildChildDomains = () => {
|
|
|
86
91
|
}
|
|
87
92
|
const { valid, invalid } = override.reduce(
|
|
88
93
|
(acc, entry) => {
|
|
89
|
-
(
|
|
94
|
+
if (typeof entry === "string" && isValidOrigin(entry)) {
|
|
95
|
+
acc.valid.push(entry);
|
|
96
|
+
} else {
|
|
97
|
+
acc.invalid.push(String(entry));
|
|
98
|
+
}
|
|
90
99
|
return acc;
|
|
91
100
|
},
|
|
92
101
|
{ valid: [], invalid: [] }
|
|
@@ -100,8 +109,7 @@ const buildChildDomains = () => {
|
|
|
100
109
|
if (valid.includes(currentOrigin)) return valid;
|
|
101
110
|
return [...valid, currentOrigin];
|
|
102
111
|
};
|
|
103
|
-
const buildParentDomain = () => {
|
|
104
|
-
const override = window.emui?.logRocketConfig?.parentDomain;
|
|
112
|
+
const buildParentDomain = (override) => {
|
|
105
113
|
if (override !== void 0 && override !== null) {
|
|
106
114
|
if (typeof override === "string" && isValidOrigin(override)) {
|
|
107
115
|
return override;
|
|
@@ -114,24 +122,25 @@ const buildParentDomain = () => {
|
|
|
114
122
|
return getParentDomain();
|
|
115
123
|
};
|
|
116
124
|
const ROOT_HOSTNAME_RE = /[^.]+\.[^.]+$/;
|
|
117
|
-
const getRootHostname = () => {
|
|
125
|
+
const getRootHostname = (override) => {
|
|
118
126
|
const match = ROOT_HOSTNAME_RE.exec(window.location.hostname);
|
|
119
127
|
const auto = match ? `.${match[0]}` : void 0;
|
|
120
|
-
|
|
121
|
-
if (override && auto && override.startsWith(".") && override.endsWith(auto)) {
|
|
128
|
+
if (typeof override === "string" && auto && override.startsWith(".") && override.endsWith(auto)) {
|
|
122
129
|
return override;
|
|
123
130
|
}
|
|
124
|
-
if (override) {
|
|
131
|
+
if (override !== void 0 && override !== null) {
|
|
125
132
|
const autoLabel = auto ?? "(none)";
|
|
126
133
|
getLogger().warn(
|
|
127
|
-
`LogRocket rootHostname override "${
|
|
134
|
+
`LogRocket rootHostname override "${String(
|
|
135
|
+
override
|
|
136
|
+
)}" ignored: must start with "." and end with the auto-detected "${autoLabel}". Using auto-detected value.`
|
|
128
137
|
);
|
|
129
138
|
}
|
|
130
139
|
return auto;
|
|
131
140
|
};
|
|
132
|
-
const getDefaultOptions = () => {
|
|
133
|
-
const childDomains = buildChildDomains();
|
|
134
|
-
const parentDomain = buildParentDomain();
|
|
141
|
+
const getDefaultOptions = (overrides) => {
|
|
142
|
+
const childDomains = buildChildDomains(overrides.childDomains);
|
|
143
|
+
const parentDomain = buildParentDomain(overrides.parentDomain);
|
|
135
144
|
return {
|
|
136
145
|
browser: {
|
|
137
146
|
urlSanitizer: (url) => {
|
|
@@ -182,7 +191,7 @@ const getDefaultOptions = () => {
|
|
|
182
191
|
},
|
|
183
192
|
release: process?.env?.APP_VERSION,
|
|
184
193
|
// app sdk based applications use this env variable to specify the app code version
|
|
185
|
-
rootHostname: getRootHostname(),
|
|
194
|
+
rootHostname: getRootHostname(overrides.rootHostname),
|
|
186
195
|
childDomains,
|
|
187
196
|
...parentDomain ? { parentDomain } : {}
|
|
188
197
|
};
|
|
@@ -208,11 +217,11 @@ const isLogRocketDisabled = () => {
|
|
|
208
217
|
return false;
|
|
209
218
|
};
|
|
210
219
|
const hasUserConsentedToSessionRecording = () => {
|
|
211
|
-
if (
|
|
220
|
+
if (window.emui?.dangerouslyOverrideSessionRecordingConsent === true) {
|
|
212
221
|
getLogger().warn(
|
|
213
222
|
"Using dangerouslyOverrideSessionRecordingConsent - this should only be used for testing purposes"
|
|
214
223
|
);
|
|
215
|
-
return
|
|
224
|
+
return true;
|
|
216
225
|
}
|
|
217
226
|
if (window.OnetrustActiveGroups) {
|
|
218
227
|
return getActiveConsentGroups().includes("C0003");
|
|
@@ -256,8 +265,23 @@ const logInitOutcome = (sessionRecordingEnabled) => {
|
|
|
256
265
|
getLogger().info(`LogRocket session URL: ${sessionURL}`);
|
|
257
266
|
});
|
|
258
267
|
};
|
|
268
|
+
const resolveAutoDetectedOverrides = (fromOptions) => {
|
|
269
|
+
const windowConfig = window.emui?.logRocketConfig;
|
|
270
|
+
return {
|
|
271
|
+
rootHostname: fromOptions.rootHostname ?? windowConfig?.rootHostname,
|
|
272
|
+
childDomains: fromOptions.childDomains ?? windowConfig?.childDomains,
|
|
273
|
+
parentDomain: fromOptions.parentDomain ?? windowConfig?.parentDomain
|
|
274
|
+
};
|
|
275
|
+
};
|
|
259
276
|
const init = (options) => {
|
|
260
|
-
const {
|
|
277
|
+
const {
|
|
278
|
+
appId,
|
|
279
|
+
isReact = true,
|
|
280
|
+
rootHostname,
|
|
281
|
+
childDomains,
|
|
282
|
+
parentDomain,
|
|
283
|
+
...rest
|
|
284
|
+
} = options ?? {};
|
|
261
285
|
lrAppId = getLRAppId(appId);
|
|
262
286
|
if (!lrAppId) {
|
|
263
287
|
throw new Error(
|
|
@@ -271,7 +295,9 @@ const init = (options) => {
|
|
|
271
295
|
return;
|
|
272
296
|
}
|
|
273
297
|
window.emui.lrEnabled = true;
|
|
274
|
-
const defaultOptions = getDefaultOptions(
|
|
298
|
+
const defaultOptions = getDefaultOptions(
|
|
299
|
+
resolveAutoDetectedOverrides({ rootHostname, childDomains, parentDomain })
|
|
300
|
+
);
|
|
275
301
|
const consent = hasUserConsentedToSessionRecording();
|
|
276
302
|
window.emui.lrSessionRecordingConsent = consent;
|
|
277
303
|
if (defaultOptions.dom) {
|
package/dist/public/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>LogRocket Test</title><script defer="defer" src="js/emuiLogrocket.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>LogRocket Test</title><script defer="defer" src="js/emuiLogrocket.b05aab66ef02cf198fdf.js"></script></head><body><h1>LogRocket Test</h1><button id="testButton">Click me</button></body></html>
|