@pontive/pontkit-loader 1.0.3 → 1.0.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/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $="1.1.1",U=["/__auth/auth/v1/runtime-config","/auth/v1/runtime-config"],j=1500,K=/^\d+\.\d+\.\d+$/;function F(t){return typeof t=="string"&&K.test(t)}function b(t){return typeof t=="string"&&/^https?:\/\//.test(t)}function N(t){return typeof t=="string"&&/^sha(256|384|512)-[A-Za-z0-9+/]+=*$/.test(t)}async function V(t={}){const a=t.fetchImpl??globalThis.fetch;if(typeof a!="function")return null;const l=t.urls??D(),d=t.timeoutMs??j;for(const e of l){const p=await W(a,e,d);if(p)return p}return null}function D(){return typeof window<"u"&&typeof window.__pontRuntimeConfigUrl=="string"?[window.__pontRuntimeConfigUrl]:U}async function W(t,a,l){const d=typeof AbortController=="function"?new AbortController:null,e=d?setTimeout(()=>d.abort(),l):null;try{const p=await t(a,{headers:{accept:"application/json"},signal:d?.signal});if(!p.ok)return null;const n=await p.json();if(!n||!F(n.core_elements_version))return null;const g={core_elements_version:n.core_elements_version,source:typeof n.source=="string"?n.source:void 0,catalog_revision:typeof n.catalog_revision=="number"?n.catalog_revision:void 0};return n.assets&&b(n.assets.js)&&b(n.assets.css)&&(g.assets={js:n.assets.js,css:n.assets.css}),n.integrity&&N(n.integrity.js)&&N(n.integrity.css)&&(g.integrity={js:n.integrity.js,css:n.integrity.css}),g}catch{return null}finally{e&&clearTimeout(e)}}let v=null,T=null;const E="@pontive/pontkit-core",q=[t=>`https://cdn.jsdelivr.net/npm/${E}@${t}/dist/index.mjs`,t=>`https://unpkg.com/${E}@${t}/dist/index.mjs`,t=>`https://esm.sh/${E}@${t}/dist/index.mjs`],z=[t=>`https://cdn.jsdelivr.net/npm/${E}@${t}/dist/styles.css`,t=>`https://unpkg.com/${E}@${t}/dist/styles.css`,t=>`https://esm.sh/${E}@${t}/dist/styles.css`],B=$;function X(t,a){return new Promise((l,d)=>{const e=document.createElement("link");e.rel="stylesheet",e.href=t,a&&(e.integrity=a,e.crossOrigin="anonymous"),e.onload=()=>l(),e.onerror=p=>d(p),document.head.appendChild(e)})}function Z(t,a){return new Promise((l,d)=>{const e=document.createElement("script");e.type="module",e.src=t,e.integrity=a,e.crossOrigin="anonymous",e.onload=()=>l(),e.onerror=()=>d(new Error(`core-elements module at ${t} failed to load or did not match its integrity hash`)),document.head.appendChild(e)}).then(()=>import(t))}async function x(){return typeof window>"u"||typeof document>"u"?null:window.__pontLoaded?window.__pontCoreSdk:window.__pontLoading?window.__pontLoading:(T||(T=J().catch(t=>{throw T=null,window.__pontLoading=void 0,t}),window.__pontLoading=T),T)}async function J(){const t=await V(),a=t?.core_elements_version??B,l=q.map(n=>n(a)),d=z.map(n=>n(a));t?.assets&&(l.unshift(t.assets.js),d.unshift(t.assets.css));const e=t?.integrity;let p=null;for(let n=0;n<l.length;n++){const g=l[n],G=d[n];try{let k=function(i){if(!i)return i;const C=[];let _=!1,m=null;const h=new Promise(o=>{m=o}),y=new Proxy(i,{get(o,c,f){if(c==="configure")return(...u)=>{const r=o.configure?.(...u);_=!0;try{C.forEach(({prop:w,args:I,resolve:A,reject:S})=>{try{const M=o[w].apply(o,I);M&&typeof M.then=="function"?M.then(A).catch(S):A(M)}catch(O){S(O)}})}catch{}C.length=0;try{y.__configured=!0}catch{}return m?.(),r};const s=o[c];return typeof s=="function"?(...u)=>{if(!_)return new Promise((r,w)=>{C.push({prop:c,args:u,resolve:r,reject:w})});try{return s.apply(o,u)}catch(r){throw r}}:s}});try{y.__whenConfigured=h,y.__configured=_}catch{}try{i.__whenConfigured=h,i.__configured=_;const o=i.configure;typeof o=="function"&&(i.configure=(...f)=>{const s=o.apply(i,f);_=!0;try{C.forEach(({prop:u,args:r,resolve:w,reject:I})=>{try{const S=i[u].apply(i,r);S&&typeof S.then=="function"?S.then(w).catch(I):w(S)}catch(A){I(A)}})}catch{}C.length=0;try{i.__configured=!0}catch{}return m?.(),s});const c=i.startLoginflow;typeof c=="function"&&(i.startLoginflow=(...f)=>_?c.apply(i,f):new Promise((s,u)=>{h.then(()=>{try{const r=c.apply(i,f);r&&typeof r.then=="function"?r.then(s).catch(u):s(r)}catch(r){u(r)}}).catch(()=>{try{const r=c.apply(i,f);r&&typeof r.then=="function"?r.then(s).catch(u):s(r)}catch(r){u(r)}})}))}catch{}try{h.then(()=>{setTimeout(()=>{try{document.querySelectorAll("pont-signin, pont-signup").forEach(o=>{try{if(o.__pontInitRetried)return;o.__pontInitRetried=!0;const c=o.__pontRetryInit;if(typeof c=="function"){try{c.call(o)}catch(f){console.error(f)}return}if(o.__pontFailedForConfig)try{o.connectedCallback?.()}catch(f){console.error(f)}}catch{}})}catch{}},0)})}catch{}return y};await X(G,e?.css);const P=e?await Z(g,e.js):await import(g),H=P.useAuthProvider?.(),R=k(H);try{P.Auth=R,P.useAuthProvider=()=>R}catch{}window.__pontCoreSdk={...P,Auth:R},v=window.__pontCoreSdk,window.__pontLoaded=!0,window.__pontLoading=void 0;try{const i=C=>{const _=customElements.get(C);if(!_)return;const m=_.prototype;if(m.__pontConfiguredPatched)return;m.__pontConfiguredPatched=!0;const h=m.connectedCallback;typeof h=="function"&&(m.connectedCallback=function(...y){const o=window.__pontCoreSdk?.Auth,c=o?.__whenConfigured,f=!!o?.__configured;if(c&&!f){c.then(()=>{try{h.apply(this,y)}catch(s){console.error(s)}}).catch(()=>{try{h.apply(this,y)}catch(s){console.error(s)}});return}try{h.apply(this,y)}catch(s){if(s&&typeof s.message=="string"&&s.message.includes("Auth.configure() must be called")&&c){c.then(()=>{try{h.apply(this,y)}catch(u){console.error(u)}});return}throw s}})};["pont-signin","pont-signup"].forEach(i)}catch{}return console.log(`PontKit Web Components loaded (${a}) from:`,g),v}catch(k){console.error(`Failed loading from ${g}`,k),p=k}}throw console.error("❌ Failed to load PontKit web components from all CDNs.",p),p}let L=null;async function Q(){typeof window>"u"||window.__pontCoreSdk?.openAccountSettingsModal||(L||(L=x().then(()=>{window.__pontCoreSdk?.openAccountSettingsModal||console.warn("[pontive-react] Core sdk loaded but modal functions are missing.")}).catch(t=>{throw console.error("[pontive-react] Failed to load core SDK:",t),t})),await L)}exports.CORE_ELEMENTS_VERSION=$;exports.RUNTIME_CONFIG_PATHS=U;exports.RUNTIME_CONFIG_TIMEOUT_MS=j;exports.ensureCoreSdkLoaded=Q;exports.fetchRuntimeConfig=V;exports.isExactVersion=F;exports.isSriHash=N;exports.loadWebComponents=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $="1.1.4",U=["/__auth/auth/v1/runtime-config","/auth/v1/runtime-config"],j=1500,K=/^\d+\.\d+\.\d+$/;function F(t){return typeof t=="string"&&K.test(t)}function b(t){return typeof t=="string"&&/^https?:\/\//.test(t)}function N(t){return typeof t=="string"&&/^sha(256|384|512)-[A-Za-z0-9+/]+=*$/.test(t)}async function V(t={}){const a=t.fetchImpl??globalThis.fetch;if(typeof a!="function")return null;const l=t.urls??D(),d=t.timeoutMs??j;for(const e of l){const p=await W(a,e,d);if(p)return p}return null}function D(){return typeof window<"u"&&typeof window.__pontRuntimeConfigUrl=="string"?[window.__pontRuntimeConfigUrl]:U}async function W(t,a,l){const d=typeof AbortController=="function"?new AbortController:null,e=d?setTimeout(()=>d.abort(),l):null;try{const p=await t(a,{headers:{accept:"application/json"},signal:d?.signal});if(!p.ok)return null;const n=await p.json();if(!n||!F(n.core_elements_version))return null;const g={core_elements_version:n.core_elements_version,source:typeof n.source=="string"?n.source:void 0,catalog_revision:typeof n.catalog_revision=="number"?n.catalog_revision:void 0};return n.assets&&b(n.assets.js)&&b(n.assets.css)&&(g.assets={js:n.assets.js,css:n.assets.css}),n.integrity&&N(n.integrity.js)&&N(n.integrity.css)&&(g.integrity={js:n.integrity.js,css:n.integrity.css}),g}catch{return null}finally{e&&clearTimeout(e)}}let v=null,T=null;const E="@pontive/pontkit-core",q=[t=>`https://cdn.jsdelivr.net/npm/${E}@${t}/dist/index.mjs`,t=>`https://unpkg.com/${E}@${t}/dist/index.mjs`,t=>`https://esm.sh/${E}@${t}/dist/index.mjs`],z=[t=>`https://cdn.jsdelivr.net/npm/${E}@${t}/dist/styles.css`,t=>`https://unpkg.com/${E}@${t}/dist/styles.css`,t=>`https://esm.sh/${E}@${t}/dist/styles.css`],B=$;function X(t,a){return new Promise((l,d)=>{const e=document.createElement("link");e.rel="stylesheet",e.href=t,a&&(e.integrity=a,e.crossOrigin="anonymous"),e.onload=()=>l(),e.onerror=p=>d(p),document.head.appendChild(e)})}function Z(t,a){return new Promise((l,d)=>{const e=document.createElement("script");e.type="module",e.src=t,e.integrity=a,e.crossOrigin="anonymous",e.onload=()=>l(),e.onerror=()=>d(new Error(`core-elements module at ${t} failed to load or did not match its integrity hash`)),document.head.appendChild(e)}).then(()=>import(t))}async function x(){return typeof window>"u"||typeof document>"u"?null:window.__pontLoaded?window.__pontCoreSdk:window.__pontLoading?window.__pontLoading:(T||(T=J().catch(t=>{throw T=null,window.__pontLoading=void 0,t}),window.__pontLoading=T),T)}async function J(){const t=await V(),a=t?.core_elements_version??B,l=q.map(n=>n(a)),d=z.map(n=>n(a));t?.assets&&(l.unshift(t.assets.js),d.unshift(t.assets.css));const e=t?.integrity;let p=null;for(let n=0;n<l.length;n++){const g=l[n],G=d[n];try{let k=function(i){if(!i)return i;const C=[];let _=!1,m=null;const h=new Promise(o=>{m=o}),y=new Proxy(i,{get(o,c,f){if(c==="configure")return(...u)=>{const r=o.configure?.(...u);_=!0;try{C.forEach(({prop:w,args:I,resolve:A,reject:S})=>{try{const M=o[w].apply(o,I);M&&typeof M.then=="function"?M.then(A).catch(S):A(M)}catch(O){S(O)}})}catch{}C.length=0;try{y.__configured=!0}catch{}return m?.(),r};const s=o[c];return typeof s=="function"?(...u)=>{if(!_)return new Promise((r,w)=>{C.push({prop:c,args:u,resolve:r,reject:w})});try{return s.apply(o,u)}catch(r){throw r}}:s}});try{y.__whenConfigured=h,y.__configured=_}catch{}try{i.__whenConfigured=h,i.__configured=_;const o=i.configure;typeof o=="function"&&(i.configure=(...f)=>{const s=o.apply(i,f);_=!0;try{C.forEach(({prop:u,args:r,resolve:w,reject:I})=>{try{const S=i[u].apply(i,r);S&&typeof S.then=="function"?S.then(w).catch(I):w(S)}catch(A){I(A)}})}catch{}C.length=0;try{i.__configured=!0}catch{}return m?.(),s});const c=i.startLoginflow;typeof c=="function"&&(i.startLoginflow=(...f)=>_?c.apply(i,f):new Promise((s,u)=>{h.then(()=>{try{const r=c.apply(i,f);r&&typeof r.then=="function"?r.then(s).catch(u):s(r)}catch(r){u(r)}}).catch(()=>{try{const r=c.apply(i,f);r&&typeof r.then=="function"?r.then(s).catch(u):s(r)}catch(r){u(r)}})}))}catch{}try{h.then(()=>{setTimeout(()=>{try{document.querySelectorAll("pont-signin, pont-signup").forEach(o=>{try{if(o.__pontInitRetried)return;o.__pontInitRetried=!0;const c=o.__pontRetryInit;if(typeof c=="function"){try{c.call(o)}catch(f){console.error(f)}return}if(o.__pontFailedForConfig)try{o.connectedCallback?.()}catch(f){console.error(f)}}catch{}})}catch{}},0)})}catch{}return y};await X(G,e?.css);const P=e?await Z(g,e.js):await import(g),H=P.useAuthProvider?.(),R=k(H);try{P.Auth=R,P.useAuthProvider=()=>R}catch{}window.__pontCoreSdk={...P,Auth:R},v=window.__pontCoreSdk,window.__pontLoaded=!0,window.__pontLoading=void 0;try{const i=C=>{const _=customElements.get(C);if(!_)return;const m=_.prototype;if(m.__pontConfiguredPatched)return;m.__pontConfiguredPatched=!0;const h=m.connectedCallback;typeof h=="function"&&(m.connectedCallback=function(...y){const o=window.__pontCoreSdk?.Auth,c=o?.__whenConfigured,f=!!o?.__configured;if(c&&!f){c.then(()=>{try{h.apply(this,y)}catch(s){console.error(s)}}).catch(()=>{try{h.apply(this,y)}catch(s){console.error(s)}});return}try{h.apply(this,y)}catch(s){if(s&&typeof s.message=="string"&&s.message.includes("Auth.configure() must be called")&&c){c.then(()=>{try{h.apply(this,y)}catch(u){console.error(u)}});return}throw s}})};["pont-signin","pont-signup"].forEach(i)}catch{}return console.log(`PontKit Web Components loaded (${a}) from:`,g),v}catch(k){console.error(`Failed loading from ${g}`,k),p=k}}throw console.error("❌ Failed to load PontKit web components from all CDNs.",p),p}let L=null;async function Q(){typeof window>"u"||window.__pontCoreSdk?.openAccountSettingsModal||(L||(L=x().then(()=>{window.__pontCoreSdk?.openAccountSettingsModal||console.warn("[pontive-react] Core sdk loaded but modal functions are missing.")}).catch(t=>{throw console.error("[pontive-react] Failed to load core SDK:",t),t})),await L)}exports.CORE_ELEMENTS_VERSION=$;exports.RUNTIME_CONFIG_PATHS=U;exports.RUNTIME_CONFIG_TIMEOUT_MS=j;exports.ensureCoreSdkLoaded=Q;exports.fetchRuntimeConfig=V;exports.isExactVersion=F;exports.isSriHash=N;exports.loadWebComponents=x;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const j = "1.1.1", F = [
1
+ const j = "1.1.4", F = [
2
2
  "/__auth/auth/v1/runtime-config",
3
3
  "/auth/v1/runtime-config"
4
4
  ], J = 1500, x = /^\d+\.\d+\.\d+$/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pontive/pontkit-loader",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "license": "MIT",
5
5
  "description": "Loads @pontive/pontkit-core from the CDN at the release the platform decides.",
6
6
  "type": "module",
@@ -32,6 +32,6 @@
32
32
  "access": "public"
33
33
  },
34
34
  "devDependencies": {
35
- "@pontive/pontkit-core": "1.1.1"
35
+ "@pontive/pontkit-core": "1.1.4"
36
36
  }
37
37
  }