@sesamy/sesamy-js 1.21.8 → 1.21.9
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/sesamy-js.cjs +1 -1
- package/dist/sesamy-js.iife.js +1 -1
- package/dist/sesamy-js.mjs +2 -1
- package/package.json +1 -1
package/dist/sesamy-js.cjs
CHANGED
|
@@ -14,4 +14,4 @@ CAUSE: `+h.stack,$.response=w,$.status=w.status,$.url=c,w.type==="opaque")throw
|
|
|
14
14
|
background: linear-gradient(to bottom, rgba(255, 255, 255, 0), white);
|
|
15
15
|
pointer-events: none;
|
|
16
16
|
}
|
|
17
|
-
`,document.head.appendChild(i)}async function gh(e){try{const t=await fetch(e);return t.ok?await t.text():(console.error(`Failed to fetch content from ${e}: ${t.statusText}`),null)}catch(t){return console.error(`Error fetching content from ${e}:`,t),null}}async function EE(e,t
|
|
17
|
+
`,document.head.appendChild(i)}async function gh(e){try{const t=await fetch(e);return t.ok?await t.text():(console.error(`Failed to fetch content from ${e}: ${t.statusText}`),null)}catch(t){return console.error(`Error fetching content from ${e}:`,t),null}}async function EE(e,t){const r=t.insertionPoint||"inside";let n="";if(t.contentType==="selector"&&t.content){const a=document.querySelector(t.content);if(a)n=a.innerHTML;else{console.warn(`Source element for selector '${t.content}' not found`);return}}else if(t.contentType==="url"&&t.content){const a=await gh(t.content);if(a)n=a;else{console.warn(`Failed to fetch content from URL '${t.content}'`);return}}else t.content&&(n=t.content);switch(r){case"before":e.insertAdjacentHTML("beforebegin",n);break;case"after":e.insertAdjacentHTML("afterend",n);break;case"inside":default:e.innerHTML+=n;break}}async function OE(e,t){if(t.contentType==="selector"&&t.content){const r=document.querySelector(t.content);r?e.innerHTML=r.innerHTML:console.warn(`Source element for selector '${t.content}' not found`)}else if(t.contentType==="url"&&t.content){const r=await gh(t.content);r?e.innerHTML=r:console.warn(`Failed to fetch content from URL '${t.content}'`)}else t.content&&(e.innerHTML=t.content)}async function kE({enabled:e=!1,rules:t}){if(!e)return;const r=await ra(),n=window.location.href;for(const a of t){const i=document.querySelectorAll(a.selector);if(!(a.path&&!new RegExp(a.path).test(n)))for(const o of i){const s=o;if(!(a.authenticated!==void 0&&a.authenticated!==r))switch(a.transform){case"insert":await EE(s,a);break;case"replace":await OE(s,a);break;case"remove":o.remove();break;case"gradient":PE(s,a);break;default:console.warn(`Unknown transform type: ${a.transform}`)}}}}function _E(){const e=new URLSearchParams(window.location.hash.substring(1)),t=e.get("access_token");if(t){Dd(t);const r=new URL(window.location.href);e.delete("access_token"),r.hash=e.toString(),window.history.replaceState(null,"",r)}}const vl="sesamy-refresh",pl="force-refetch-entitlements";function RE(){const e=new URLSearchParams(window.location.search),t=e.get(pl),r=e.get(vl);if(t!==null||r!==null){const n=new URL(window.location.href);e.delete(pl),e.delete(vl),n.search=e.toString(),Ie(),window.history.replaceState(null,"",n)}}function CE(e){const t=e.split(".")[1],r=atob(t);return JSON.parse(r)}function AE(){const e=new URLSearchParams(window.location.search),t=e.get("sesamy-token")||e.get("token");if(!t)return;try{const n=CE(t),a=new Date(n.exp*1e3),i={id:"",title:"Signed link",sku:n.s.toString(),purchaseOptionsId:n.pid.toString(),url:n.url.toString(),token:t,type:"article",expiresAt:a.toISOString(),createdAt:new Date(n.iat).toISOString(),updatedAt:new Date(n.iat).toISOString()};eP(i)}catch{}const r=new URL(window.location.href);r.searchParams.delete("ss"),r.searchParams.delete("se"),r.searchParams.delete("sp"),r.searchParams.delete("so"),r.searchParams.delete("token"),r.searchParams.delete("sesamy-token"),window.history.replaceState(null,"",r)}const ml="sesamy-user";async function jE(){var a;const t=(a=new URLSearchParams(window.location.search).get(ml))==null?void 0:a.toLowerCase();if(!t)return;const r=await DT();(r==null?void 0:r.email)!==t&&(Ie(),Xo({authorizationParams:{email_hint:t,login_hint:t}}));const n=new URL(window.location.href);n.searchParams.delete(ml),window.history.replaceState(null,"",n)}const gl="sesamy-purchase";function LE(){const e=new URLSearchParams(window.location.search),t=e.get(gl);if(t!==null){const r=new URL(window.location.href);e.delete(gl),r.search=e.toString(),Xe(Oe.PURCHASE,{itemSrc:t}),Ie(),window.history.replaceState(null,"",r)}}const yl="sesamy-login",NE="sesamy_login";async function xE(){const e=new URLSearchParams(window.location.search);if(!(e.get(yl)||e.get(NE)))return;await ra()||Xo();const n=new URL(window.location.href);n.searchParams.delete(yl),window.history.replaceState(null,"",n)}const UE=typeof window<"u";async function wl(e){pE({clientId:e.clientId,environment:e.environment,...e.analytics}),await UT({clientId:e.clientId,organization:e.organization,environment:e.environment,...e.auth}),e.transform&&await kE(e.transform),_E(),RE(),AE(),await xE(),await jE(),LE(),Xe(Oe.READY,{})}async function yh(e){const t=IE({clientId:e.clientId,environment:e.environment,...e.api});return UE&&(e.awaitAllServices?await wl(e):wl(e)),t}if(typeof document<"u"){const e=document.getElementById("sesamy-js");if(e!=null&&e.textContent)try{const t=JSON.parse(e.textContent);yh(t)}catch(t){console.error("Failed to parse config",t)}}exports.init=yh;
|
package/dist/sesamy-js.iife.js
CHANGED
|
@@ -14,4 +14,4 @@ CAUSE: `+h.stack,$.response=w,$.status=w.status,$.url=c,w.type==="opaque")throw
|
|
|
14
14
|
background: linear-gradient(to bottom, rgba(255, 255, 255, 0), white);
|
|
15
15
|
pointer-events: none;
|
|
16
16
|
}
|
|
17
|
-
`,document.head.appendChild(i)}async function oh(e){try{const t=await fetch(e);return t.ok?await t.text():(console.error(`Failed to fetch content from ${e}: ${t.statusText}`),null)}catch(t){return console.error(`Error fetching content from ${e}:`,t),null}}async function TE(e,t
|
|
17
|
+
`,document.head.appendChild(i)}async function oh(e){try{const t=await fetch(e);return t.ok?await t.text():(console.error(`Failed to fetch content from ${e}: ${t.statusText}`),null)}catch(t){return console.error(`Error fetching content from ${e}:`,t),null}}async function TE(e,t){const r=t.insertionPoint||"inside";let n="";if(t.contentType==="selector"&&t.content){const a=document.querySelector(t.content);if(a)n=a.innerHTML;else{console.warn(`Source element for selector '${t.content}' not found`);return}}else if(t.contentType==="url"&&t.content){const a=await oh(t.content);if(a)n=a;else{console.warn(`Failed to fetch content from URL '${t.content}'`);return}}else t.content&&(n=t.content);switch(r){case"before":e.insertAdjacentHTML("beforebegin",n);break;case"after":e.insertAdjacentHTML("afterend",n);break;case"inside":default:e.innerHTML+=n;break}}async function PE(e,t){if(t.contentType==="selector"&&t.content){const r=document.querySelector(t.content);r?e.innerHTML=r.innerHTML:console.warn(`Source element for selector '${t.content}' not found`)}else if(t.contentType==="url"&&t.content){const r=await oh(t.content);r?e.innerHTML=r:console.warn(`Failed to fetch content from URL '${t.content}'`)}else t.content&&(e.innerHTML=t.content)}async function EE({enabled:e=!1,rules:t}){if(!e)return;const r=await Kn(),n=window.location.href;for(const a of t){const i=document.querySelectorAll(a.selector);if(!(a.path&&!new RegExp(a.path).test(n)))for(const o of i){const s=o;if(!(a.authenticated!==void 0&&a.authenticated!==r))switch(a.transform){case"insert":await TE(s,a);break;case"replace":await PE(s,a);break;case"remove":o.remove();break;case"gradient":IE(s,a);break;default:console.warn(`Unknown transform type: ${a.transform}`)}}}}function OE(){const e=new URLSearchParams(window.location.hash.substring(1)),t=e.get("access_token");if(t){Wf(t);const r=new URL(window.location.href);e.delete("access_token"),r.hash=e.toString(),window.history.replaceState(null,"",r)}}const sh="sesamy-refresh",ch="force-refetch-entitlements";function kE(){const e=new URLSearchParams(window.location.search),t=e.get(ch),r=e.get(sh);if(t!==null||r!==null){const n=new URL(window.location.href);e.delete(ch),e.delete(sh),n.search=e.toString(),Re(),window.history.replaceState(null,"",n)}}function _E(e){const t=e.split(".")[1],r=atob(t);return JSON.parse(r)}function RE(){const e=new URLSearchParams(window.location.search),t=e.get("sesamy-token")||e.get("token");if(!t)return;try{const n=_E(t),a=new Date(n.exp*1e3),i={id:"",title:"Signed link",sku:n.s.toString(),purchaseOptionsId:n.pid.toString(),url:n.url.toString(),token:t,type:"article",expiresAt:a.toISOString(),createdAt:new Date(n.iat).toISOString(),updatedAt:new Date(n.iat).toISOString()};qT(i)}catch{}const r=new URL(window.location.href);r.searchParams.delete("ss"),r.searchParams.delete("se"),r.searchParams.delete("sp"),r.searchParams.delete("so"),r.searchParams.delete("token"),r.searchParams.delete("sesamy-token"),window.history.replaceState(null,"",r)}const uh="sesamy-user";async function CE(){var a;const t=(a=new URLSearchParams(window.location.search).get(uh))==null?void 0:a.toLowerCase();if(!t)return;const r=await xT();(r==null?void 0:r.email)!==t&&(Re(),Do({authorizationParams:{email_hint:t,login_hint:t}}));const n=new URL(window.location.href);n.searchParams.delete(uh),window.history.replaceState(null,"",n)}const lh="sesamy-purchase";function AE(){const e=new URLSearchParams(window.location.search),t=e.get(lh);if(t!==null){const r=new URL(window.location.href);e.delete(lh),r.search=e.toString(),Je(_e.PURCHASE,{itemSrc:t}),Re(),window.history.replaceState(null,"",r)}}const fh="sesamy-login",jE="sesamy_login";async function LE(){const e=new URLSearchParams(window.location.search);if(!(e.get(fh)||e.get(jE)))return;await Kn()||Do();const n=new URL(window.location.href);n.searchParams.delete(fh),window.history.replaceState(null,"",n)}const NE=typeof window<"u";async function dh(e){hE({clientId:e.clientId,environment:e.environment,...e.analytics}),await NT({clientId:e.clientId,organization:e.organization,environment:e.environment,...e.auth}),e.transform&&await EE(e.transform),OE(),kE(),RE(),await LE(),await CE(),AE(),Je(_e.READY,{})}async function hh(e){const t=SE({clientId:e.clientId,environment:e.environment,...e.api});return NE&&(e.awaitAllServices?await dh(e):dh(e)),t}if(typeof document<"u"){const e=document.getElementById("sesamy-js");if(e!=null&&e.textContent)try{const t=JSON.parse(e.textContent);hh(t)}catch(t){console.error("Failed to parse config",t)}}return xe.init=hh,Object.defineProperty(xe,Symbol.toStringTag,{value:"Module"}),xe}({});
|
package/dist/sesamy-js.mjs
CHANGED
|
@@ -5591,7 +5591,8 @@ async function gh(e) {
|
|
|
5591
5591
|
return console.error(`Error fetching content from ${e}:`, t), null;
|
|
5592
5592
|
}
|
|
5593
5593
|
}
|
|
5594
|
-
async function PE(e, t
|
|
5594
|
+
async function PE(e, t) {
|
|
5595
|
+
const r = t.insertionPoint || "inside";
|
|
5595
5596
|
let n = "";
|
|
5596
5597
|
if (t.contentType === "selector" && t.content) {
|
|
5597
5598
|
const a = document.querySelector(t.content);
|