@elliemae/pui-logrocket 1.1.30 → 1.1.31
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 +2 -2
- 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.90effac0.js +1 -0
- package/build/docs/assets/js/e376fc56.8f124f07.js +1 -0
- package/build/docs/assets/js/{main.382ddcc3.js → main.d9838ecf.js} +2 -2
- package/build/docs/assets/js/{runtime~main.c9322911.js → runtime~main.16dcbf24.js} +1 -1
- package/build/docs/compliance/index.html +5 -4
- package/build/docs/index.html +2 -2
- package/build/docs/usage-guide/index.html +19 -7
- package/dist/cjs/logrocket.js +83 -24
- package/dist/esm/logrocket.js +83 -24
- package/dist/public/index.html +1 -1
- package/dist/public/js/emuiLogrocket.436f95cb9c84877fed75.js +45 -0
- package/dist/public/js/emuiLogrocket.436f95cb9c84877fed75.js.br +0 -0
- package/dist/public/js/emuiLogrocket.436f95cb9c84877fed75.js.gz +0 -0
- package/dist/public/js/emuiLogrocket.436f95cb9c84877fed75.js.map +1 -0
- package/dist/types/lib/typings/window.d.ts +8 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/umd/index.js +19 -19
- 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.d0e26bed.js +0 -1
- package/build/docs/assets/js/e376fc56.4af42dfd.js +0 -1
- package/dist/public/js/emuiLogrocket.494499f2d458ef12a709.js +0 -45
- package/dist/public/js/emuiLogrocket.494499f2d458ef12a709.js.br +0 -0
- package/dist/public/js/emuiLogrocket.494499f2d458ef12a709.js.gz +0 -0
- package/dist/public/js/emuiLogrocket.494499f2d458ef12a709.js.map +0 -1
- /package/build/docs/assets/js/{main.382ddcc3.js.LICENSE.txt → main.d9838ecf.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e,a,r,t,o,
|
|
1
|
+
(()=>{"use strict";var e,a,r,t,o,c={},f={};function n(e){var a=f[e];if(void 0!==a)return a.exports;var r=f[e]={id:e,loaded:!1,exports:{}};return c[e].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}n.m=c,n.c=f,e=[],n.O=(a,r,t,o)=>{if(!r){var c=1/0;for(i=0;i<e.length;i++){for(var[r,t,o]=e[i],f=!0,d=0;d<r.length;d++)(!1&o||c>=o)&&Object.keys(n.O).every(e=>n.O[e](r[d]))?r.splice(d--,1):(f=!1,o<c&&(c=o));if(f){e.splice(i--,1);var b=t();void 0!==b&&(a=b)}}return a}o=o||0;for(var i=e.length;i>0&&e[i-1][2]>o;i--)e[i]=e[i-1];e[i]=[r,t,o]},n.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return n.d(a,{a:a}),a},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,n.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var o=Object.create(null);n.r(o);var c={};a=a||[null,r({}),r([]),r(r)];for(var f=2&t&&e;("object"==typeof f||"function"==typeof f)&&!~a.indexOf(f);f=r(f))Object.getOwnPropertyNames(f).forEach(a=>c[a]=()=>e[a]);return c.default=()=>e,n.d(o,c),o},n.d=(e,a)=>{for(var r in a)n.o(a,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:a[r]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((a,r)=>(n.f[r](e,a),a),[])),n.u=e=>"assets/js/"+({295:"51c4ceb1",594:"5e8c322a",2076:"common",3361:"c377a04b",3480:"e376fc56",4319:"211c08f1",4804:"7fcbe1af",5742:"aba21aa0",5754:"acaa8c75",5760:"552a934f",5908:"04ee7372",7098:"a7bd4aaa",8401:"17896441",9048:"a94703ab",9647:"5e95c892"}[e]||e)+"."+{200:"0310889b",295:"093ba7f1",483:"18c7d7f8",594:"503d46ea",638:"a021b03c",654:"0e97a121",764:"32783b8e",967:"d428fcf6",1138:"aa8c4e98",1370:"c8be4ee0",2076:"6c804366",2180:"31d6ce39",2327:"251d6533",2706:"74774645",3308:"78e397d4",3361:"2361a76f",3480:"8f124f07",3725:"36fa16ca",3767:"2998632d",3899:"94243d47",4167:"eb3f034b",4319:"f5d0523b",4359:"6536c7a0",4390:"744aab40",4413:"e614d609",4453:"ef8b090c",4632:"aa312ff7",4804:"5999b9e8",4860:"cfa79720",5168:"97fb36dd",5179:"ccfc9ebc",5182:"30f41439",5275:"4ed9ae52",5742:"a5d4e000",5754:"70525e75",5760:"b125f196",5820:"2cd5bf53",5908:"90effac0",6143:"8bf840e9",6340:"eaf6d37a",6376:"13262bdb",6603:"cbc20a0f",6761:"0b26728e",6873:"83ee6c7c",7039:"3ca79f91",7098:"ad524078",7204:"1ce9a9b1",7616:"6501b368",7666:"99e92eb2",7876:"3ac89535",8071:"6922ccd8",8401:"dfa22f5b",8907:"4424af8f",9048:"5c63b074",9647:"2d99be36",9748:"cc3f89d3",9845:"d704e0f2"}[e]+".js",n.miniCssF=e=>{},n.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),t={},o="@elliemae/pui-logrocket:",n.l=(e,a,r,c)=>{if(t[e])t[e].push(a);else{var f,d;if(void 0!==r)for(var b=document.getElementsByTagName("script"),i=0;i<b.length;i++){var l=b[i];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==o+r){f=l;break}}f||(d=!0,(f=document.createElement("script")).charset="utf-8",n.nc&&f.setAttribute("nonce",n.nc),f.setAttribute("data-webpack",o+r),f.src=e),t[e]=[a];var u=(a,r)=>{f.onerror=f.onload=null,clearTimeout(s);var o=t[e];if(delete t[e],f.parentNode&&f.parentNode.removeChild(f),o&&o.forEach(e=>e(r)),a)return a(r)},s=setTimeout(u.bind(null,void 0,{type:"timeout",target:f}),12e4);f.onerror=u.bind(null,f.onerror),f.onload=u.bind(null,f.onload),d&&document.head.appendChild(f)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.p="/logrocket/",n.gca=function(e){return e={17896441:"8401","51c4ceb1":"295","5e8c322a":"594",common:"2076",c377a04b:"3361",e376fc56:"3480","211c08f1":"4319","7fcbe1af":"4804",aba21aa0:"5742",acaa8c75:"5754","552a934f":"5760","04ee7372":"5908",a7bd4aaa:"7098",a94703ab:"9048","5e95c892":"9647"}[e]||e,n.p+n.u(e)},(()=>{var e={5354:0,1869:0};n.f.j=(a,r)=>{var t=n.o(e,a)?e[a]:void 0;if(0!==t)if(t)r.push(t[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var o=new Promise((r,o)=>t=e[a]=[r,o]);r.push(t[2]=o);var c=n.p+n.u(a),f=new Error;n.l(c,r=>{if(n.o(e,a)&&(0!==(t=e[a])&&(e[a]=void 0),t)){var o=r&&("load"===r.type?"missing":r.type),c=r&&r.target&&r.target.src;f.message="Loading chunk "+a+" failed.\n("+o+": "+c+")",f.name="ChunkLoadError",f.type=o,f.request=c,t[1](f)}},"chunk-"+a,a)}},n.O.j=a=>0===e[a];var a=(a,r)=>{var t,o,[c,f,d]=r,b=0;if(c.some(a=>0!==e[a])){for(t in f)n.o(f,t)&&(n.m[t]=f[t]);if(d)var i=d(n)}for(a&&a(r);b<c.length;b++)o=c[b],n.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return n.O(i)},r=globalThis.webpackChunk_elliemae_pui_logrocket=globalThis.webpackChunk_elliemae_pui_logrocket||[];r.forEach(a.bind(null,0)),r.push=a.bind(null,r.push.bind(r))})()})();
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="generator" content="Docusaurus v3.9.2">
|
|
6
6
|
<title data-rh="true">Compliance Requirements | LogRocket</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://pui.ice.com/logrocket/compliance"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="Compliance Requirements | LogRocket"><meta data-rh="true" name="description" content="Due to wiretapping & privacy laws in certain jurisdictions, it is essential to ensure that our session recording practices comply with local regulations. Below are the key compliance requirements we need to adhere to when using LogRocket for recording user sessions and activities,"><meta data-rh="true" property="og:description" content="Due to wiretapping & privacy laws in certain jurisdictions, it is essential to ensure that our session recording practices comply with local regulations. Below are the key compliance requirements we need to adhere to when using LogRocket for recording user sessions and activities,"><link data-rh="true" rel="icon" href="/logrocket/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://pui.ice.com/logrocket/compliance"><link data-rh="true" rel="alternate" href="https://pui.ice.com/logrocket/compliance" hreflang="en"><link data-rh="true" rel="alternate" href="https://pui.ice.com/logrocket/compliance" hreflang="x-default"><script data-rh="true" type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Compliance Requirements","item":"https://pui.ice.com/logrocket/compliance"}]}</script><link rel="stylesheet" href="/logrocket/assets/css/styles.48d5ef50.css">
|
|
7
|
-
<script src="/logrocket/assets/js/runtime~main.
|
|
8
|
-
<script src="/logrocket/assets/js/main.
|
|
7
|
+
<script src="/logrocket/assets/js/runtime~main.16dcbf24.js" defer="defer"></script>
|
|
8
|
+
<script src="/logrocket/assets/js/main.d9838ecf.js" defer="defer"></script>
|
|
9
9
|
</head>
|
|
10
10
|
<body class="navigation-with-keyboard">
|
|
11
11
|
<svg style="display: none;"><defs>
|
|
@@ -248,13 +248,14 @@
|
|
|
248
248
|
<h4 class="anchor anchorTargetStickyNavbar_UXZL" id="url-sanitization">URL Sanitization<a href="#url-sanitization" class="hash-link" aria-label="Direct link to URL Sanitization" title="Direct link to URL Sanitization" translate="no"></a></h4>
|
|
249
249
|
<p>Sensitive URL parameters are automatically redacted:</p>
|
|
250
250
|
<ul>
|
|
251
|
-
<li class="">Authorization codes: <code>code=REDACTED</code
|
|
251
|
+
<li class="">Authorization codes: The standalone <code>code</code> query parameter is redacted to <code>code=REDACTED</code> (does not affect parameters like <code>zipcode</code> or <code>promo_code</code>)</li>
|
|
252
|
+
<li class="">All occurrences of the <code>code</code> parameter in the URL are redacted</li>
|
|
252
253
|
<li class="">Custom patterns can be added via the <code>browser.urlSanitizer</code> configuration</li>
|
|
253
254
|
</ul>
|
|
254
255
|
<h4 class="anchor anchorTargetStickyNavbar_UXZL" id="network-sanitization">Network Sanitization<a href="#network-sanitization" class="hash-link" aria-label="Direct link to Network Sanitization" title="Direct link to Network Sanitization" translate="no"></a></h4>
|
|
255
256
|
<p>Network requests and responses are sanitized to prevent sensitive data leakage:</p>
|
|
256
257
|
<ul>
|
|
257
|
-
<li class=""><strong>Request headers</strong>: Authorization headers are replaced with <code>**redacted**</code
|
|
258
|
+
<li class=""><strong>Request headers</strong>: Authorization headers are replaced with <code>**redacted**</code> (case-insensitive matching)</li>
|
|
258
259
|
<li class=""><strong>Request bodies</strong>: All request bodies are set to <code>null</code> by default</li>
|
|
259
260
|
<li class=""><strong>Response bodies</strong>: All response bodies are removed by default</li>
|
|
260
261
|
<li class=""><strong>Custom headers</strong>: Headers like <code>x-secret</code> trigger complete response removal</li>
|
package/build/docs/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="generator" content="Docusaurus v3.9.2">
|
|
6
6
|
<title data-rh="true">Getting Started | LogRocket</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://pui.ice.com/logrocket/"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="Getting Started | LogRocket"><meta data-rh="true" name="description" content="UI Platform LogRocket library standardizes the way we integrate LogRocket into our applications."><meta data-rh="true" property="og:description" content="UI Platform LogRocket library standardizes the way we integrate LogRocket into our applications."><link data-rh="true" rel="icon" href="/logrocket/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://pui.ice.com/logrocket/"><link data-rh="true" rel="alternate" href="https://pui.ice.com/logrocket/" hreflang="en"><link data-rh="true" rel="alternate" href="https://pui.ice.com/logrocket/" hreflang="x-default"><script data-rh="true">function insertBanner(){var n=document.createElement("div");n.id="__docusaurus-base-url-issue-banner-container";n.innerHTML='\n<div id="__docusaurus-base-url-issue-banner" style="border: thick solid red; background-color: rgb(255, 230, 179); margin: 20px; padding: 20px; font-size: 20px;">\n <p style="font-weight: bold; font-size: 30px;">Your Docusaurus site did not load properly.</p>\n <p>A very common reason is a wrong site <a href="https://docusaurus.io/docs/docusaurus.config.js/#baseUrl" style="font-weight: bold;">baseUrl configuration</a>.</p>\n <p>Current configured baseUrl = <span style="font-weight: bold; color: red;">/logrocket/</span> </p>\n <p>We suggest trying baseUrl = <span id="__docusaurus-base-url-issue-banner-suggestion-container" style="font-weight: bold; color: green;"></span></p>\n</div>\n',document.body.prepend(n);var e=document.getElementById("__docusaurus-base-url-issue-banner-suggestion-container"),o=window.location.pathname,s="/"===o.substr(-1)?o:o+"/";e.innerHTML=s}document.addEventListener("DOMContentLoaded",function(){void 0===window.docusaurus&&insertBanner()})</script><script data-rh="true" type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Getting Started","item":"https://pui.ice.com/logrocket/"}]}</script><link rel="stylesheet" href="/logrocket/assets/css/styles.48d5ef50.css">
|
|
7
|
-
<script src="/logrocket/assets/js/runtime~main.
|
|
8
|
-
<script src="/logrocket/assets/js/main.
|
|
7
|
+
<script src="/logrocket/assets/js/runtime~main.16dcbf24.js" defer="defer"></script>
|
|
8
|
+
<script src="/logrocket/assets/js/main.d9838ecf.js" defer="defer"></script>
|
|
9
9
|
</head>
|
|
10
10
|
<body class="navigation-with-keyboard">
|
|
11
11
|
<svg style="display: none;"><defs>
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="generator" content="Docusaurus v3.9.2">
|
|
6
6
|
<title data-rh="true">Usage Guide | LogRocket</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://pui.ice.com/logrocket/usage-guide"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="Usage Guide | LogRocket"><meta data-rh="true" name="description" content="UI Platform LogRocket library standardizes the way we integrate LogRocket into our applications."><meta data-rh="true" property="og:description" content="UI Platform LogRocket library standardizes the way we integrate LogRocket into our applications."><link data-rh="true" rel="icon" href="/logrocket/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://pui.ice.com/logrocket/usage-guide"><link data-rh="true" rel="alternate" href="https://pui.ice.com/logrocket/usage-guide" hreflang="en"><link data-rh="true" rel="alternate" href="https://pui.ice.com/logrocket/usage-guide" hreflang="x-default"><script data-rh="true" type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Usage Guide","item":"https://pui.ice.com/logrocket/usage-guide"}]}</script><link rel="stylesheet" href="/logrocket/assets/css/styles.48d5ef50.css">
|
|
7
|
-
<script src="/logrocket/assets/js/runtime~main.
|
|
8
|
-
<script src="/logrocket/assets/js/main.
|
|
7
|
+
<script src="/logrocket/assets/js/runtime~main.16dcbf24.js" defer="defer"></script>
|
|
8
|
+
<script src="/logrocket/assets/js/main.d9838ecf.js" defer="defer"></script>
|
|
9
9
|
</head>
|
|
10
10
|
<body class="navigation-with-keyboard">
|
|
11
11
|
<svg style="display: none;"><defs>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
<li class=""><code>localhostEnable</code> (boolean): Flag to enable LogRocket when running on localhost. Defaults to <code>false</code>. When set to <code>true</code>, LogRocket will be enabled on localhost even if the <code>LOGROCKET_ENABLE_ON_LOCALHOST</code> environment variable is not set. This is useful for local development and testing.</li>
|
|
35
35
|
<li class=""><code>childDomains</code> (array of strings): List of domains of child micro applications (e.g., iframes). Only include domains for cross-origin child microapps.</li>
|
|
36
36
|
<li class=""><code>parentDomain</code> (string): Parent domain of the hosting application. library automatically detects parent domain for cross-origin iframes.</li>
|
|
37
|
-
<li class=""><code>rootHostname</code> (string): Use this option to control whether sessions that traverse different subdomains on your product application are kept intact or broken up into sessions specific to each microapp subdomain. Set this to the highest-level hostname sessions should be shared across (e.g.,
|
|
37
|
+
<li class=""><code>rootHostname</code> (string): Use this option to control whether sessions that traverse different subdomains on your product application are kept intact or broken up into sessions specific to each microapp subdomain. Set this to the highest-level hostname sessions should be shared across (e.g., <code>.ice.com</code>). A leading period is required. When not specified, the library auto-detects the root hostname by extracting the last two segments of the top-level window's hostname and validating it against the allowed domains: <code>.ice.com</code>, <code>.elliemae.com</code>, <code>.encompassloconnect.com</code>, <code>.ellielabs.com</code>, <code>.elliemae.io</code>, <code>.intcx.net</code>. For example, <code>beta.encompass.elliemae.io</code> resolves to <code>.elliemae.io</code>. If the hostname doesn't match any allowed domain, <code>rootHostname</code> is omitted and LogRocket scopes the session cookie to the current page's hostname.</li>
|
|
38
38
|
</ul>
|
|
39
39
|
<h2 class="anchor anchorTargetStickyNavbar_UXZL" id="testing-logrocket-integration-from-localhost">Testing LogRocket Integration from Localhost<a href="#testing-logrocket-integration-from-localhost" class="hash-link" aria-label="Direct link to Testing LogRocket Integration from Localhost" title="Direct link to Testing LogRocket Integration from Localhost" translate="no"></a></h2>
|
|
40
40
|
<p>When developing locally, you may want to test LogRocket integration. There are two ways to enable LogRocket on localhost:</p>
|
|
@@ -70,8 +70,9 @@
|
|
|
70
70
|
<p>The library uses OneTrust's event system to determine when to initialize LogRocket based on the user's consent banner state:</p>
|
|
71
71
|
<p><strong>First-time visitors</strong> (no <code>OptanonAlertBoxClosed</code> cookie):</p>
|
|
72
72
|
<ul>
|
|
73
|
-
<li class="">The library
|
|
74
|
-
<li class="">
|
|
73
|
+
<li class="">The library first checks if the C0002 consent group is already active in <code>window.OnetrustActiveGroups</code></li>
|
|
74
|
+
<li class="">If C0002 is already present (non-rejectable, as in internal apps like EncompassWeb/TPO), LogRocket initializes immediately without waiting for banner interaction</li>
|
|
75
|
+
<li class="">If C0002 is not yet active, the library listens for the <code>OTConsentApplied</code> event, which fires when the user first interacts with the consent banner (Accept/Decline)</li>
|
|
75
76
|
<li class="">LogRocket initializes immediately after the user makes their choice</li>
|
|
76
77
|
</ul>
|
|
77
78
|
<p><strong>Returning visitors</strong> (has <code>OptanonAlertBoxClosed</code> cookie):</p>
|
|
@@ -80,12 +81,22 @@
|
|
|
80
81
|
<li class="">This event fires when OneTrust SDK loads and updates the consent groups</li>
|
|
81
82
|
<li class="">LogRocket initializes once the consent groups are available</li>
|
|
82
83
|
</ul>
|
|
84
|
+
<p><strong>Timeout fallback</strong>:</p>
|
|
85
|
+
<ul>
|
|
86
|
+
<li class="">If the expected OneTrust event (<code>OTConsentApplied</code> or <code>OneTrustGroupsUpdated</code>) is not received within 10 seconds, the library initializes LogRocket with the current consent state and logs a warning</li>
|
|
87
|
+
<li class="">This prevents LogRocket from being permanently blocked if the OneTrust SDK fails to load or fire events</li>
|
|
88
|
+
</ul>
|
|
89
|
+
<p><strong>Init failure recovery</strong>:</p>
|
|
90
|
+
<ul>
|
|
91
|
+
<li class="">If LogRocket initialization fails (e.g., due to a network error or invalid configuration), the <code>isLogRocketInitialized</code> flag is reset to <code>false</code>, allowing a retry on the next call to <code>initLogRocket</code></li>
|
|
92
|
+
</ul>
|
|
83
93
|
<p>This event-based approach ensures that:</p>
|
|
84
94
|
<ul>
|
|
85
95
|
<li class="">LogRocket only initializes when consent status is available</li>
|
|
86
|
-
<li class="">
|
|
96
|
+
<li class="">Internal apps with non-rejectable consent groups initialize immediately</li>
|
|
97
|
+
<li class="">First-time users of consumer apps see immediate feedback when they consent</li>
|
|
87
98
|
<li class="">Returning users get automatic initialization without re-showing the banner</li>
|
|
88
|
-
<li class="">The integration is
|
|
99
|
+
<li class="">The integration is resilient to OneTrust SDK failures via the timeout fallback</li>
|
|
89
100
|
</ul>
|
|
90
101
|
<p>The library automatically applies privacy-focused defaults including:</p>
|
|
91
102
|
<ul>
|
|
@@ -108,6 +119,7 @@
|
|
|
108
119
|
<li class=""><strong><code>lrEnabled</code></strong>: Set to <code>'true'</code> if LogRocket is enabled in the app, <code>'false'</code> otherwise</li>
|
|
109
120
|
<li class=""><strong><code>lrAppId</code></strong>: The LogRocket application ID being used in the app</li>
|
|
110
121
|
</ul>
|
|
122
|
+
<p><strong>Important</strong>: After <code>initLogRocket</code> completes, <code>buildLogRocketQueryParams</code> returns the consent and enabled state captured at initialization time (stored in <code>window.emui.lrSessionRecordingConsent</code> and <code>window.emui.lrEnabled</code>). This ensures child iframes always reflect the parent app's actual initialization state, even if the user changes consent preferences after initialization. If called before <code>initLogRocket</code>, it evaluates the current live state as a fallback.</p>
|
|
111
123
|
<div class="language-javascript codeBlockContainer_hfT5 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_7tLg"><pre tabindex="0" class="prism-code language-javascript codeBlock_jGqy thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_reRH"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// parent microapplication</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> buildLogRocketQueryParams </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'@elliemae/pui-logrocket'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> urlParams </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">buildLogRocketQueryParams</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// urlParams: "analyticsConsent=true&lrEnabled=true&lrAppId=your-app-id"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> childUrl </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">https://child-app.example.com?</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">urlParams</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// launch guest application with childUrl using SSF V2 / App SDK GuestMicroapp</span><br></span></code></pre></div></div>
|
|
112
124
|
<h3 class="anchor anchorTargetStickyNavbar_UXZL" id="support-for-legacy-angularjs-microapps-in-iframes">Support for Legacy AngularJS Microapps in Iframes<a href="#support-for-legacy-angularjs-microapps-in-iframes" class="hash-link" aria-label="Direct link to Support for Legacy AngularJS Microapps in Iframes" title="Direct link to Support for Legacy AngularJS Microapps in Iframes" translate="no"></a></h3>
|
|
113
125
|
<p>For older AngularJS-based microapplications running inside iframes, the library automatically reads the <code>analyticsConsent</code> parameter from the iframe's <code>src</code> URL. This provides backward compatibility for legacy microapps that cannot directly access parent window variables or URL parameters.</p>
|
package/dist/cjs/logrocket.js
CHANGED
|
@@ -53,10 +53,10 @@ if (!scriptSrc) {
|
|
|
53
53
|
} catch {
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
if (scriptSrc && /(cdn\.mortgagetech\..*\.ice\.com
|
|
56
|
+
if (scriptSrc && /(cdn\.mortgagetech\..*\.ice\.com|\/\/localhost[\d:/])/.test(scriptSrc)) {
|
|
57
57
|
try {
|
|
58
58
|
const url = new URL(scriptSrc);
|
|
59
|
-
cdnDomain = url.
|
|
59
|
+
cdnDomain = url.hostname === "localhost" ? "https://cdn.mortgagetech.d1.ice.com" : url.origin;
|
|
60
60
|
} catch {
|
|
61
61
|
cdnDomain = null;
|
|
62
62
|
}
|
|
@@ -88,7 +88,30 @@ const getParentDomain = () => {
|
|
|
88
88
|
};
|
|
89
89
|
const removeCurrentWindowDomain = (domains) => {
|
|
90
90
|
if (!domains || domains.length === 0) return null;
|
|
91
|
-
|
|
91
|
+
const filtered = domains.filter(
|
|
92
|
+
(domain) => domain !== window.location.origin
|
|
93
|
+
);
|
|
94
|
+
return filtered.length > 0 ? filtered : null;
|
|
95
|
+
};
|
|
96
|
+
const ALLOWED_ROOT_HOSTNAMES = [
|
|
97
|
+
".ice.com",
|
|
98
|
+
".elliemae.com",
|
|
99
|
+
".encompassloconnect.com",
|
|
100
|
+
".ellielabs.com",
|
|
101
|
+
".elliemae.io",
|
|
102
|
+
".intcx.net"
|
|
103
|
+
];
|
|
104
|
+
const getRootHostname = () => {
|
|
105
|
+
let hostname;
|
|
106
|
+
try {
|
|
107
|
+
hostname = window.top?.location?.hostname ?? window.location.hostname;
|
|
108
|
+
} catch {
|
|
109
|
+
hostname = window.location.hostname;
|
|
110
|
+
}
|
|
111
|
+
const parts = hostname.split(".");
|
|
112
|
+
if (parts.length < 2) return null;
|
|
113
|
+
const rootDomain = `.${parts.slice(-2).join(".")}`;
|
|
114
|
+
return ALLOWED_ROOT_HOSTNAMES.includes(rootDomain) ? rootDomain : null;
|
|
92
115
|
};
|
|
93
116
|
const getDefaultOptions = () => {
|
|
94
117
|
const filteredChildDomains = removeCurrentWindowDomain(
|
|
@@ -99,7 +122,10 @@ const getDefaultOptions = () => {
|
|
|
99
122
|
browser: {
|
|
100
123
|
urlSanitizer: (url) => {
|
|
101
124
|
let sanitizedUrl = url;
|
|
102
|
-
sanitizedUrl = sanitizedUrl.replace(
|
|
125
|
+
sanitizedUrl = sanitizedUrl.replace(
|
|
126
|
+
/([?&])code=([^&]*)/g,
|
|
127
|
+
"$1code=REDACTED"
|
|
128
|
+
);
|
|
103
129
|
return sanitizedUrl;
|
|
104
130
|
}
|
|
105
131
|
},
|
|
@@ -120,12 +146,13 @@ const getDefaultOptions = () => {
|
|
|
120
146
|
mergeIframes: true,
|
|
121
147
|
network: {
|
|
122
148
|
requestSanitizer: (request) => {
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
149
|
+
const sanitizedHeaders = Object.keys(request.headers).reduce((acc, key) => {
|
|
150
|
+
acc[key] = /^authorization$/i.test(key) ? "**redacted**" : request.headers[key] ?? "";
|
|
151
|
+
return acc;
|
|
152
|
+
}, {});
|
|
127
153
|
return {
|
|
128
|
-
...
|
|
154
|
+
...request,
|
|
155
|
+
headers: sanitizedHeaders,
|
|
129
156
|
body: null
|
|
130
157
|
};
|
|
131
158
|
},
|
|
@@ -141,14 +168,15 @@ const getDefaultOptions = () => {
|
|
|
141
168
|
},
|
|
142
169
|
release: process?.env?.APP_VERSION,
|
|
143
170
|
// app sdk based applications use this env variable to specify the app code version
|
|
144
|
-
rootHostname: window.emui?.logRocketConfig?.rootHostname ??
|
|
171
|
+
rootHostname: window.emui?.logRocketConfig?.rootHostname ?? getRootHostname() ?? void 0,
|
|
145
172
|
...filteredChildDomains && filteredChildDomains.length > 0 ? { childDomains: filteredChildDomains } : {},
|
|
146
173
|
...parentDomain ? { parentDomain } : {}
|
|
147
174
|
};
|
|
148
175
|
};
|
|
176
|
+
const getActiveConsentGroups = () => window.OnetrustActiveGroups?.split(",").map((g) => g.trim()).filter(Boolean) ?? [];
|
|
149
177
|
const hasUserConsentedForLogRocketInit = () => {
|
|
150
178
|
if (window.OnetrustActiveGroups) {
|
|
151
|
-
return
|
|
179
|
+
return getActiveConsentGroups().includes("C0002");
|
|
152
180
|
}
|
|
153
181
|
return true;
|
|
154
182
|
};
|
|
@@ -173,7 +201,7 @@ const hasUserConsentedToSessionRecording = () => {
|
|
|
173
201
|
return window.emui.dangerouslyOverrideSessionRecordingConsent;
|
|
174
202
|
}
|
|
175
203
|
if (window.OnetrustActiveGroups) {
|
|
176
|
-
return
|
|
204
|
+
return getActiveConsentGroups().includes("C0003");
|
|
177
205
|
}
|
|
178
206
|
const urlParams = new URLSearchParams(window.location.search);
|
|
179
207
|
if (urlParams.get("analyticsConsent") === "true") {
|
|
@@ -198,11 +226,10 @@ const getLRAppId = (appId) => {
|
|
|
198
226
|
};
|
|
199
227
|
const buildLogRocketQueryParams = () => {
|
|
200
228
|
const urlParams = new URLSearchParams();
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
);
|
|
205
|
-
urlParams.append("lrEnabled", isLogRocketDisabled() ? "false" : "true");
|
|
229
|
+
const consent = window.emui?.lrSessionRecordingConsent ?? hasUserConsentedToSessionRecording();
|
|
230
|
+
const enabled = window.emui?.lrEnabled ?? !isLogRocketDisabled();
|
|
231
|
+
urlParams.append("analyticsConsent", consent ? "true" : "false");
|
|
232
|
+
urlParams.append("lrEnabled", enabled ? "true" : "false");
|
|
206
233
|
urlParams.append("lrAppId", getLRAppId() ?? "");
|
|
207
234
|
return urlParams.toString();
|
|
208
235
|
};
|
|
@@ -216,11 +243,14 @@ const init = (options) => {
|
|
|
216
243
|
}
|
|
217
244
|
if (isLogRocketDisabled()) {
|
|
218
245
|
window.emui.isLogRocketInitialized = false;
|
|
246
|
+
window.emui.lrEnabled = false;
|
|
219
247
|
getLogger().info("LogRocket is disabled in this environment");
|
|
220
248
|
return;
|
|
221
249
|
}
|
|
250
|
+
window.emui.lrEnabled = true;
|
|
222
251
|
const defaultOptions = getDefaultOptions();
|
|
223
252
|
const consent = hasUserConsentedToSessionRecording();
|
|
253
|
+
window.emui.lrSessionRecordingConsent = consent;
|
|
224
254
|
if (defaultOptions.dom) {
|
|
225
255
|
defaultOptions.dom.isEnabled = consent;
|
|
226
256
|
}
|
|
@@ -238,31 +268,60 @@ const init = (options) => {
|
|
|
238
268
|
};
|
|
239
269
|
const hasSeenBanner = () => {
|
|
240
270
|
const m = document.cookie.match(/(^|;\s*)OptanonAlertBoxClosed=([^;]+)/);
|
|
241
|
-
|
|
271
|
+
if (!m) return false;
|
|
272
|
+
try {
|
|
273
|
+
return !!decodeURIComponent(m[2]);
|
|
274
|
+
} catch {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
242
277
|
};
|
|
243
278
|
const initLogRocket = (options) => {
|
|
244
279
|
if (window.emui.isLogRocketInitialized) return;
|
|
245
|
-
|
|
246
|
-
if (!lrAppId) {
|
|
280
|
+
if (!getLRAppId(options?.appId)) {
|
|
247
281
|
throw new Error(
|
|
248
282
|
"LogRocket appId is required to initialize LogRocket. Either pass it as parameter or set window.emui.logRocketConfig.appId"
|
|
249
283
|
);
|
|
250
284
|
}
|
|
251
285
|
window.emui.isLogRocketInitialized = true;
|
|
252
286
|
if (window.hasOneTrust) {
|
|
287
|
+
let handled = false;
|
|
253
288
|
const handler = () => {
|
|
254
|
-
|
|
289
|
+
if (handled) return;
|
|
290
|
+
handled = true;
|
|
291
|
+
try {
|
|
292
|
+
init(options);
|
|
293
|
+
} catch (error) {
|
|
294
|
+
window.emui.isLogRocketInitialized = false;
|
|
295
|
+
getLogger().error({
|
|
296
|
+
message: "LogRocket initialization failed",
|
|
297
|
+
exception: error
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
const addListenerWithTimeout = (event) => {
|
|
302
|
+
window.addEventListener(event, handler, { once: true });
|
|
303
|
+
setTimeout(() => {
|
|
304
|
+
if (!handled) {
|
|
305
|
+
getLogger().warn(
|
|
306
|
+
`OneTrust event '${event}' not received within 10s, initializing LogRocket with current consent state`
|
|
307
|
+
);
|
|
308
|
+
handler();
|
|
309
|
+
}
|
|
310
|
+
}, 1e4);
|
|
255
311
|
};
|
|
256
|
-
if (
|
|
257
|
-
|
|
312
|
+
if (hasSeenBanner()) {
|
|
313
|
+
addListenerWithTimeout("OneTrustGroupsUpdated");
|
|
314
|
+
} else if (getActiveConsentGroups().includes("C0002")) {
|
|
315
|
+
handler();
|
|
258
316
|
} else {
|
|
259
|
-
|
|
317
|
+
addListenerWithTimeout("OTConsentApplied");
|
|
260
318
|
}
|
|
261
319
|
} else {
|
|
262
320
|
setTimeout(() => {
|
|
263
321
|
try {
|
|
264
322
|
init(options);
|
|
265
323
|
} catch (error) {
|
|
324
|
+
window.emui.isLogRocketInitialized = false;
|
|
266
325
|
getLogger().error({
|
|
267
326
|
message: "LogRocket initialization failed",
|
|
268
327
|
exception: error
|
package/dist/esm/logrocket.js
CHANGED
|
@@ -17,10 +17,10 @@ if (!scriptSrc) {
|
|
|
17
17
|
} catch {
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
if (scriptSrc && /(cdn\.mortgagetech\..*\.ice\.com
|
|
20
|
+
if (scriptSrc && /(cdn\.mortgagetech\..*\.ice\.com|\/\/localhost[\d:/])/.test(scriptSrc)) {
|
|
21
21
|
try {
|
|
22
22
|
const url = new URL(scriptSrc);
|
|
23
|
-
cdnDomain = url.
|
|
23
|
+
cdnDomain = url.hostname === "localhost" ? "https://cdn.mortgagetech.d1.ice.com" : url.origin;
|
|
24
24
|
} catch {
|
|
25
25
|
cdnDomain = null;
|
|
26
26
|
}
|
|
@@ -52,7 +52,30 @@ const getParentDomain = () => {
|
|
|
52
52
|
};
|
|
53
53
|
const removeCurrentWindowDomain = (domains) => {
|
|
54
54
|
if (!domains || domains.length === 0) return null;
|
|
55
|
-
|
|
55
|
+
const filtered = domains.filter(
|
|
56
|
+
(domain) => domain !== window.location.origin
|
|
57
|
+
);
|
|
58
|
+
return filtered.length > 0 ? filtered : null;
|
|
59
|
+
};
|
|
60
|
+
const ALLOWED_ROOT_HOSTNAMES = [
|
|
61
|
+
".ice.com",
|
|
62
|
+
".elliemae.com",
|
|
63
|
+
".encompassloconnect.com",
|
|
64
|
+
".ellielabs.com",
|
|
65
|
+
".elliemae.io",
|
|
66
|
+
".intcx.net"
|
|
67
|
+
];
|
|
68
|
+
const getRootHostname = () => {
|
|
69
|
+
let hostname;
|
|
70
|
+
try {
|
|
71
|
+
hostname = window.top?.location?.hostname ?? window.location.hostname;
|
|
72
|
+
} catch {
|
|
73
|
+
hostname = window.location.hostname;
|
|
74
|
+
}
|
|
75
|
+
const parts = hostname.split(".");
|
|
76
|
+
if (parts.length < 2) return null;
|
|
77
|
+
const rootDomain = `.${parts.slice(-2).join(".")}`;
|
|
78
|
+
return ALLOWED_ROOT_HOSTNAMES.includes(rootDomain) ? rootDomain : null;
|
|
56
79
|
};
|
|
57
80
|
const getDefaultOptions = () => {
|
|
58
81
|
const filteredChildDomains = removeCurrentWindowDomain(
|
|
@@ -63,7 +86,10 @@ const getDefaultOptions = () => {
|
|
|
63
86
|
browser: {
|
|
64
87
|
urlSanitizer: (url) => {
|
|
65
88
|
let sanitizedUrl = url;
|
|
66
|
-
sanitizedUrl = sanitizedUrl.replace(
|
|
89
|
+
sanitizedUrl = sanitizedUrl.replace(
|
|
90
|
+
/([?&])code=([^&]*)/g,
|
|
91
|
+
"$1code=REDACTED"
|
|
92
|
+
);
|
|
67
93
|
return sanitizedUrl;
|
|
68
94
|
}
|
|
69
95
|
},
|
|
@@ -84,12 +110,13 @@ const getDefaultOptions = () => {
|
|
|
84
110
|
mergeIframes: true,
|
|
85
111
|
network: {
|
|
86
112
|
requestSanitizer: (request) => {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
113
|
+
const sanitizedHeaders = Object.keys(request.headers).reduce((acc, key) => {
|
|
114
|
+
acc[key] = /^authorization$/i.test(key) ? "**redacted**" : request.headers[key] ?? "";
|
|
115
|
+
return acc;
|
|
116
|
+
}, {});
|
|
91
117
|
return {
|
|
92
|
-
...
|
|
118
|
+
...request,
|
|
119
|
+
headers: sanitizedHeaders,
|
|
93
120
|
body: null
|
|
94
121
|
};
|
|
95
122
|
},
|
|
@@ -105,14 +132,15 @@ const getDefaultOptions = () => {
|
|
|
105
132
|
},
|
|
106
133
|
release: process?.env?.APP_VERSION,
|
|
107
134
|
// app sdk based applications use this env variable to specify the app code version
|
|
108
|
-
rootHostname: window.emui?.logRocketConfig?.rootHostname ??
|
|
135
|
+
rootHostname: window.emui?.logRocketConfig?.rootHostname ?? getRootHostname() ?? void 0,
|
|
109
136
|
...filteredChildDomains && filteredChildDomains.length > 0 ? { childDomains: filteredChildDomains } : {},
|
|
110
137
|
...parentDomain ? { parentDomain } : {}
|
|
111
138
|
};
|
|
112
139
|
};
|
|
140
|
+
const getActiveConsentGroups = () => window.OnetrustActiveGroups?.split(",").map((g) => g.trim()).filter(Boolean) ?? [];
|
|
113
141
|
const hasUserConsentedForLogRocketInit = () => {
|
|
114
142
|
if (window.OnetrustActiveGroups) {
|
|
115
|
-
return
|
|
143
|
+
return getActiveConsentGroups().includes("C0002");
|
|
116
144
|
}
|
|
117
145
|
return true;
|
|
118
146
|
};
|
|
@@ -137,7 +165,7 @@ const hasUserConsentedToSessionRecording = () => {
|
|
|
137
165
|
return window.emui.dangerouslyOverrideSessionRecordingConsent;
|
|
138
166
|
}
|
|
139
167
|
if (window.OnetrustActiveGroups) {
|
|
140
|
-
return
|
|
168
|
+
return getActiveConsentGroups().includes("C0003");
|
|
141
169
|
}
|
|
142
170
|
const urlParams = new URLSearchParams(window.location.search);
|
|
143
171
|
if (urlParams.get("analyticsConsent") === "true") {
|
|
@@ -162,11 +190,10 @@ const getLRAppId = (appId) => {
|
|
|
162
190
|
};
|
|
163
191
|
const buildLogRocketQueryParams = () => {
|
|
164
192
|
const urlParams = new URLSearchParams();
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
);
|
|
169
|
-
urlParams.append("lrEnabled", isLogRocketDisabled() ? "false" : "true");
|
|
193
|
+
const consent = window.emui?.lrSessionRecordingConsent ?? hasUserConsentedToSessionRecording();
|
|
194
|
+
const enabled = window.emui?.lrEnabled ?? !isLogRocketDisabled();
|
|
195
|
+
urlParams.append("analyticsConsent", consent ? "true" : "false");
|
|
196
|
+
urlParams.append("lrEnabled", enabled ? "true" : "false");
|
|
170
197
|
urlParams.append("lrAppId", getLRAppId() ?? "");
|
|
171
198
|
return urlParams.toString();
|
|
172
199
|
};
|
|
@@ -180,11 +207,14 @@ const init = (options) => {
|
|
|
180
207
|
}
|
|
181
208
|
if (isLogRocketDisabled()) {
|
|
182
209
|
window.emui.isLogRocketInitialized = false;
|
|
210
|
+
window.emui.lrEnabled = false;
|
|
183
211
|
getLogger().info("LogRocket is disabled in this environment");
|
|
184
212
|
return;
|
|
185
213
|
}
|
|
214
|
+
window.emui.lrEnabled = true;
|
|
186
215
|
const defaultOptions = getDefaultOptions();
|
|
187
216
|
const consent = hasUserConsentedToSessionRecording();
|
|
217
|
+
window.emui.lrSessionRecordingConsent = consent;
|
|
188
218
|
if (defaultOptions.dom) {
|
|
189
219
|
defaultOptions.dom.isEnabled = consent;
|
|
190
220
|
}
|
|
@@ -202,31 +232,60 @@ const init = (options) => {
|
|
|
202
232
|
};
|
|
203
233
|
const hasSeenBanner = () => {
|
|
204
234
|
const m = document.cookie.match(/(^|;\s*)OptanonAlertBoxClosed=([^;]+)/);
|
|
205
|
-
|
|
235
|
+
if (!m) return false;
|
|
236
|
+
try {
|
|
237
|
+
return !!decodeURIComponent(m[2]);
|
|
238
|
+
} catch {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
206
241
|
};
|
|
207
242
|
const initLogRocket = (options) => {
|
|
208
243
|
if (window.emui.isLogRocketInitialized) return;
|
|
209
|
-
|
|
210
|
-
if (!lrAppId) {
|
|
244
|
+
if (!getLRAppId(options?.appId)) {
|
|
211
245
|
throw new Error(
|
|
212
246
|
"LogRocket appId is required to initialize LogRocket. Either pass it as parameter or set window.emui.logRocketConfig.appId"
|
|
213
247
|
);
|
|
214
248
|
}
|
|
215
249
|
window.emui.isLogRocketInitialized = true;
|
|
216
250
|
if (window.hasOneTrust) {
|
|
251
|
+
let handled = false;
|
|
217
252
|
const handler = () => {
|
|
218
|
-
|
|
253
|
+
if (handled) return;
|
|
254
|
+
handled = true;
|
|
255
|
+
try {
|
|
256
|
+
init(options);
|
|
257
|
+
} catch (error) {
|
|
258
|
+
window.emui.isLogRocketInitialized = false;
|
|
259
|
+
getLogger().error({
|
|
260
|
+
message: "LogRocket initialization failed",
|
|
261
|
+
exception: error
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
const addListenerWithTimeout = (event) => {
|
|
266
|
+
window.addEventListener(event, handler, { once: true });
|
|
267
|
+
setTimeout(() => {
|
|
268
|
+
if (!handled) {
|
|
269
|
+
getLogger().warn(
|
|
270
|
+
`OneTrust event '${event}' not received within 10s, initializing LogRocket with current consent state`
|
|
271
|
+
);
|
|
272
|
+
handler();
|
|
273
|
+
}
|
|
274
|
+
}, 1e4);
|
|
219
275
|
};
|
|
220
|
-
if (
|
|
221
|
-
|
|
276
|
+
if (hasSeenBanner()) {
|
|
277
|
+
addListenerWithTimeout("OneTrustGroupsUpdated");
|
|
278
|
+
} else if (getActiveConsentGroups().includes("C0002")) {
|
|
279
|
+
handler();
|
|
222
280
|
} else {
|
|
223
|
-
|
|
281
|
+
addListenerWithTimeout("OTConsentApplied");
|
|
224
282
|
}
|
|
225
283
|
} else {
|
|
226
284
|
setTimeout(() => {
|
|
227
285
|
try {
|
|
228
286
|
init(options);
|
|
229
287
|
} catch (error) {
|
|
288
|
+
window.emui.isLogRocketInitialized = false;
|
|
230
289
|
getLogger().error({
|
|
231
290
|
message: "LogRocket initialization failed",
|
|
232
291
|
exception: error
|
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.436f95cb9c84877fed75.js"></script></head><body><h1>LogRocket Test</h1><button id="testButton">Click me</button></body></html>
|