@frak-labs/core-sdk 1.2.0-beta.9905e8f6 → 1.2.0-beta.c6ec16cf
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/cdn/bundle.js +1 -1
- package/dist/bundle.cjs +1 -1
- package/dist/bundle.d.cts +2 -2
- package/dist/bundle.d.ts +2 -2
- package/dist/bundle.js +1 -1
- package/dist/{index-BrMCc4nK.d.cts → index-PwHVGTLY.d.cts} +16 -2
- package/dist/{index-Dmng11I3.d.ts → index-SlEhbU9Q.d.ts} +16 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/src-Cd4rAMD9.cjs +2 -0
- package/dist/src-Cd4rAMD9.cjs.map +1 -0
- package/dist/src-KyZiC1sf.js +2 -0
- package/dist/src-KyZiC1sf.js.map +1 -0
- package/package.json +2 -2
- package/src/clients/createIFrameFrakClient.ts +5 -9
- package/src/index.ts +1 -0
- package/src/utils/i18n/detectPageLanguage.test.ts +44 -0
- package/src/utils/i18n/detectPageLanguage.ts +30 -0
- package/src/utils/index.ts +3 -0
- package/dist/src-Bigq2qnT.js +0 -2
- package/dist/src-Bigq2qnT.js.map +0 -1
- package/dist/src-D2D9Cw9X.cjs +0 -2
- package/dist/src-D2D9Cw9X.cjs.map +0 -1
package/cdn/bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var FrakSDK=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},r=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r};async function i(e,t,n){return await e.request({method:`frak_displayEmbeddedWallet`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function a(e,{steps:t,metadata:n},r){return await e.request({method:`frak_displayModal`,params:r?[t,n,e.config.metadata,r]:[t,n,e.config.metadata]})}async function o(e,t,n){return await e.request({method:`frak_displaySharingPage`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}let s=`https://backend.frak.id`;function c(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function l(e){return c(e)?`https://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:s}function u(e){if(e)return l(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return l(e)}return s}let d=`frak-client-id`;function f(){return typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function p(){if(typeof window>`u`||!window.localStorage)return console.warn(`[Frak SDK] No Window / localStorage available to save the clientId`),f();let e=localStorage.getItem(d);return e||(e=f(),localStorage.setItem(d,e)),e}var m=class extends Map{maxSize;constructor(e){super(),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;e!==void 0&&super.delete(e)}return this}};let h;function ee(){return h||={promiseCache:new m(1024),responseCache:new m(1024),failureCache:new m(1024)},h}async function g(e,{cacheKey:t,cacheTime:n=3e4}){let{promiseCache:r,responseCache:i,failureCache:a}=ee();if(n>0){let e=i.get(t);if(e&&Date.now()-e.created<n)return e.data}let o=a.get(t);if(o&&Date.now()-o<1e3)throw Error(`Cache: ${t} recently failed, backing off`);let s=r.get(t);s||(s=e(),r.set(t,s));try{let e=await s;return i.set(t,{data:e,created:Date.now()}),a.delete(t),e}catch(e){throw a.set(t,Date.now()),e}finally{r.delete(t)}}function _(){h&&(h.promiseCache.clear(),h.responseCache.clear(),h.failureCache.clear())}let v=`__frakSdkConfig`,y=`frak-config-cache`,b=`frak-merchant-id`,x={key:y},S=typeof window<`u`;function C(){return{isResolved:!1,merchantId:``}}let w=null;function te(){if(!S)return null;try{let e=localStorage.getItem(x.key);if(!e)return null;let t=JSON.parse(e);return t.config?.isResolved?(w=t,t):null}catch{return null}}function ne(){return(w??te())?.config}function re(){let e=w??te();return e?Date.now()-e.timestamp<3e4:!1}function ie(e){if(!(!S||!e.isResolved))try{let t={config:e,timestamp:Date.now()};localStorage.setItem(x.key,JSON.stringify(t)),w=t}catch{}}function ae(){if(S){w=null;try{localStorage.removeItem(x.key)}catch{}}}function oe(){S&&(window[v]||(window[v]=ne()??C()))}function T(){return S?(oe(),window[v]??C()):C()}function E(e){S&&window.dispatchEvent(new CustomEvent(`frak:config`,{detail:e}))}function se(e){return e??(S?window.location.hostname:``)}async function ce(e,t,n){try{let r=u(t),i=n?`&lang=${encodeURIComponent(n)}`:``,a=await fetch(`${r}/user/merchant/resolve?domain=${encodeURIComponent(e)}${i}`);if(!a.ok){console.warn(`[Frak SDK] Merchant lookup failed for domain ${e}: ${a.status}`);return}let o=await a.json();if(S)try{sessionStorage.setItem(b,o.merchantId)}catch{}return o}catch(e){console.warn(`[Frak SDK] Failed to fetch merchant config:`,e);return}}let D={getConfig:T,get isResolved(){return T().isResolved},get isCacheFresh(){return re()},setCacheScope(e,t){let n=`${e}:${t??``}`;x.key=`${y}:${n}`,w=null},setConfig(e){if(S&&(window[v]=e),ie(e),E(e),S&&e.merchantId)try{sessionStorage.setItem(b,e.merchantId)}catch{}},reset(){let e=ne()??C();S&&(window[v]=e),E(e)},clearCache(){if(ae(),_(),S)try{sessionStorage.removeItem(b)}catch{}},resolve(e,t,n){let r=se(e);return r?g(async()=>{let e=await ce(r,t,n);if(!e)throw Error(`Config resolution returned empty`);return e},{cacheKey:`sdkConfig:${r}:${n??``}`,cacheTime:1/0}).catch(()=>void 0):Promise.resolve(void 0)},getMerchantId(){let e=T();if(e.isResolved&&e.merchantId)return e.merchantId;if(S)try{return sessionStorage.getItem(b)??void 0}catch{}},async resolveMerchantId(e,t){return D.getMerchantId()||(await D.resolve(e,t))?.merchantId}};async function le(e){if(typeof window>`u`)return;let t=p();if(!t)return;let n=await D.resolveMerchantId();if(!n)return;let r=`frak-identity-ensured-${n}`;if(!window.sessionStorage.getItem(r))try{let i=u();(await fetch(`${i}/user/identity/ensure`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"x-wallet-sdk-auth":e,"x-frak-client-id":t},body:JSON.stringify({merchantId:n})})).ok&&window.sessionStorage.setItem(r,`1`)}catch{}}async function ue(e,t){return g(()=>e.request({method:`frak_getMerchantInformation`}),{cacheKey:`frak_getMerchantInformation`,cacheTime:t?.cacheTime})}async function de(e,t){return g(()=>e.request({method:`frak_getMergeToken`}),{cacheKey:`frak_getMergeToken`,cacheTime:t?.cacheTime})}async function fe(e,t){return g(()=>e.request({method:`frak_getUserReferralStatus`}),{cacheKey:`frak_getUserReferralStatus`,cacheTime:t?.cacheTime})}let pe={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006,userRejected:-32007};var O=class extends Error{code;data;constructor(e,t,n){super(t),this.code=e,this.data=n}toJSON(){return{code:this.code,message:this.message,data:this.data}}},k=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve=e=>{this._resolve?.(e)};reject=e=>{this._reject?.(e)}};function me(e){let{emittingTransport:t,listeningTransport:n,targetOrigin:r,middleware:i=[],lifecycleHandlers:a}=e,o=new Map;function s(e){return typeof e!=`object`||!e?!1:`clientLifecycle`in e||`iframeLifecycle`in e}function c(e){return typeof e!=`object`||!e?!1:`id`in e&&`topic`in e&&`data`in e}async function l(e){try{`clientLifecycle`in e&&a?.clientLifecycle?await a.clientLifecycle(e,{origin:r,source:null}):`iframeLifecycle`in e&&a?.iframeLifecycle&&await a.iframeLifecycle(e,{origin:r,source:null})}catch(e){console.error(`[RPC Client] Lifecycle handler error:`,e)}}async function u(e){let t={origin:r,source:null};for(let n of i)n.onRequest&&await n.onRequest(e,t);return e}async function d(e,t){let n={origin:r,source:null},a=t;for(let t of i)t.onResponse&&(a=await t.onResponse(e,a,n));return a}async function f(e){try{let t=new URL(e.origin).origin.toLowerCase(),n=new URL(r).origin.toLowerCase();if(t!==n){console.log(`Not expected origin`,t,n);return}}catch(e){console.error(`[RPC Client] Invalid origin`,e);return}if(s(e.data)){await l(e.data);return}if(!c(e.data))return;let t;try{let n=e.data.data,r=n instanceof Uint8Array||ArrayBuffer.isView(n)?{result:n}:n;t=await d(e.data,r)}catch(e){console.error(`[RPC Client] Middleware error on response:`,e);return}let n=o.get(e.data.id);n&&n(t)}async function p(e){let n=e;try{n=await u(e)}catch(e){throw console.error(`[RPC Client] Middleware error on request:`,e),e}t.postMessage(n,r)}function m(e){t.postMessage(e,r)}function h(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}n.addEventListener(`message`,f);function ee(e){let t=h(),n=new k;return o.set(t,e=>{e.error?n.reject(new O(e.error.code,e.error.message,e.error.data)):n.resolve(e.result),o.delete(t)}),p({id:t,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{o.delete(t),n.reject(e)}),n.promise}function g(e,t){let n=h();return o.set(n,e=>{e.error?(console.error(`[RPC Client] Listener error:`,e.error),o.delete(n)):t(e.result)}),p({id:n,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{console.error(`[RPC Client] Failed to send listener request:`,e),o.delete(n)}),()=>{o.delete(n)}}function _(){n.removeEventListener(`message`,f),o.clear()}return{request:ee,listen:g,sendLifecycle:m,cleanup:_}}function he(e){return new TextEncoder().encode(JSON.stringify(e))}function ge(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}function A(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function j(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(e.length+(t===0?0:4-t),`=`)),e=>e.charCodeAt(0))}function _e(e){return A(he(e))}function ve(e,t,n,r,i,a){let o=_e(ye({redirectUrl:t.redirectUrl,directExit:t.directExit,lang:t.lang,merchantId:n,metadata:{name:r,css:a,logoUrl:t.metadata?.logoUrl,homepageLink:t.metadata?.homepageLink},clientId:i})),s=new URL(e);return s.pathname=`/sso`,s.searchParams.set(`p`,o),s.toString()}function ye(e){return{r:e.redirectUrl,cId:e.clientId,d:e.directExit,l:e.lang,m:e.merchantId,md:{n:e.metadata?.name,css:e.metadata?.css,l:e.metadata?.logoUrl,h:e.metadata?.homepageLink}}}let M=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,be=`frak-sso`;async function xe(e,t){let{metadata:n,customizations:r,walletUrl:i}=e.config,a={...t,directExit:t.directExit??!t.redirectUrl};if(a.openInSameWindow??!!a.redirectUrl)return await e.request({method:`frak_openSso`,params:[a,n.name,r?.css]});let o=a.ssoPopupUrl??ve(i??`https://wallet.frak.id`,a,await D.resolveMerchantId()??``,n.name,p(),r?.css),s=window.open(o,be,M);if(!s)throw Error(`Popup was blocked. Please allow popups for this site.`);return s.focus(),await e.request({method:`frak_openSso`,params:[a,n.name,r?.css]})??{}}async function Se(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}let Ce=/^0x[a-fA-F0-9]{40}$/;function N(e){return typeof e==`string`&&Ce.test(e)}function P(e,t){return e.toLowerCase()===t.toLowerCase()}function we(e){let t=new Uint8Array(20);for(let n=0;n<20;n++){let r=Number.parseInt(e.substring(2+n*2,4+n*2),16);if(Number.isNaN(r))throw Error(`Invalid address: ${e}`);t[n]=r}return t}let Te=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Ee(e){let t=`0x`;for(let n=0;n<20;n++)t+=Te[e[n]];return t}function De(e){return`r`in e&&!(`v`in e)}function F(e){return`v`in e&&e.v===2}function Oe(e,t){let n=e.get(t);if(n!==null)return n;let r=t.toLowerCase();for(let[t,n]of e)if(t.toLowerCase()===r)return n;return null}function I(e,t){let n=t.toLowerCase(),r=[...e.keys()].filter(e=>e.toLowerCase()===n);for(let t of r)e.delete(t)}let ke=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ae(e){return typeof e==`string`&&ke.test(e)}function L(e){let t=e.replace(/-/g,``),n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=Number.parseInt(t.substring(e*2,e*2+2),16);return n}function R(e){let t=``;for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,`0`);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`}function je(e){if(!Ae(e.m)||!Number.isInteger(e.t)||e.t<0||e.t>4294967295)return null;let t=typeof e.c==`string`&&e.c.length>0,n=typeof e.w==`string`&&N(e.w);if(!t&&!n||t&&!Ae(e.c))return null;let r=new Uint8Array(21+(t?16:0)+(n?20:0)),i=new DataView(r.buffer,r.byteOffset,r.byteLength),a=0;return r[a++]=2|(t?16:0)|(n?32:0),r.set(L(e.m),a),a+=16,i.setUint32(a,e.t,!1),a+=4,t&&(r.set(L(e.c),a),a+=16),n&&(r.set(we(e.w),a),a+=20),r}function Me(e){if(e.length<21)return null;let t=e[0];if((t&15)!=2||t&192)return null;let n=(t&16)!=0,r=(t&32)!=0;if(!n&&!r)return null;let i=21+(n?16:0)+(r?20:0);if(e.length!==i)return null;let a=1,o=R(e.subarray(a,a+16));a+=16;let s=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(a,!1);a+=4;let c={v:2,m:o,t:s};if(n&&(c.c=R(e.subarray(a,a+16)),a+=16),r){let t=Ee(e.subarray(a,a+20));if(!N(t))return null;c.w=t,a+=20}return c}let z=`fCtx`;function B(e){if(e)try{if(F(e)){let t=je(e);return t?A(t):void 0}return A(we(e.r))}catch(t){console.error(`Error compressing Frak context`,{e:t,context:e})}}function V(e){if(!(!e||e.length===0))try{let t=j(e);if(t.length!==20)return Me(t)||void 0;let n=Ee(t);if(N(n))return{r:n}}catch(t){console.error(`Error decompressing Frak context`,{e:t,context:e})}}function Ne({url:e}){if(!e)return null;let t=Oe(new URL(e).searchParams,z);return t?V(t):null}function Pe(e){return{utm_source:e.utmSource??`frak`,utm_medium:e.utmMedium??void 0,utm_campaign:e.utmCampaign??void 0,utm_content:e.utmContent,utm_term:e.utmTerm,via:e.via??void 0,ref:e.ref??void 0}}function Fe(e,t){let n=Pe(t??{});for(let[t,r]of Object.entries(n))r===void 0||r===``||e.searchParams.has(t)||e.searchParams.set(t,r)}function Ie({url:e,context:t,attribution:n}){if(!e)return null;let r=B(t);if(!r)return null;let i=new URL(e);return I(i.searchParams,z),i.searchParams.set(z,r),Fe(i,n),i.toString()}function Le(e){let t=new URL(e);return I(t.searchParams,z),t.toString()}function Re({url:e,context:t}){if(!window.location?.href||typeof window>`u`){console.error(`No window found, can't update context`);return}let n=e??window.location.href,r;r=t===null?Le(n):Ie({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}let H={compress:B,decompress:V,parse:Ne,update:Ie,remove:Le,replaceUrl:Re};function ze({perCall:e,defaults:t,productUtmContent:n}){if(e===null)return;let r=e!==void 0,i=t!==void 0&&Object.keys(t).length>0;if(!r&&!i&&!(n!==void 0&&n!==``))return;let a={...t,...e??{}},o=n??e?.utmContent;return o!==void 0&&o!==``?a.utmContent=o:delete a.utmContent,a}function U(e,t,n){if(!e){console.debug(`[Frak] No client provided, skipping event tracking`);return}try{e.openPanel?.track(t,n)}catch(e){console.debug(`[Frak] Failed to track event:`,t,e)}}let W=`nexus-wallet-backup`,G=`frakwallet://`;function Be(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}let Ve=G.replace(`://`,``);function He(e){return`intent://${e.slice(13)}#Intent;scheme=${Ve};end`}function Ue(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=Be()&&We(e)?He(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function We(e){return e.startsWith(G)}function Ge(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent;return!!(/iPhone|iPad|iPod/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1)}let K=Ge();function Ke(){return typeof navigator>`u`?!1:K?!0:/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function qe(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase();return e.includes(`instagram`)||e.includes(`fban`)||e.includes(`fbav`)||e.includes(`facebook`)}let Je=qe();function Ye(e){K&&e.startsWith(`https://`)?window.location.href=`x-safari-https://${e.slice(8)}`:K&&e.startsWith(`http://`)?window.location.href=`x-safari-http://${e.slice(7)}`:window.location.href=`https://backend.frak.id/common/social?u=${encodeURIComponent(e)}`}function Xe(e){return ge(j(e))}let q={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function J(e){return e&&e in q?e:`eur`}function Ze(e){return e?q[e]??q.eur:q.eur}function Qe(e,t){let n=Ze(t),r=J(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function $e(e){return e?`${e}Amount`:`eurAmount`}let Y={id:`frak-wallet`,name:`frak-wallet`,title:`Frak Wallet`,allow:`publickey-credentials-get *; clipboard-write; web-share *`,style:{width:`0`,height:`0`,border:`0`,position:`absolute`,zIndex:2000001,top:`-1000px`,left:`-1000px`,colorScheme:`auto`}};function et({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);r.id=Y.id,r.name=Y.name,r.allow=Y.allow,r.style.zIndex=Y.style.zIndex.toString(),nt({iframe:r,isVisible:!1});let i=t?.walletUrl??e??`https://wallet.frak.id`,a=p();return it(i),it(u(i)),r.src=tt({walletUrl:i,clientId:a,preload:t?.preload}),new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function tt({walletUrl:e,clientId:t,preload:n}){let r=`${e}/listener?clientId=${encodeURIComponent(t)}`;return!n||n.length===0?r:`${r}#preload=${n.join(`,`)}`}function nt({iframe:e,isVisible:t}){if(!t){e.style.width=`0`,e.style.height=`0`,e.style.border=`0`,e.style.position=`fixed`,e.style.top=`-1000px`,e.style.left=`-1000px`;return}e.style.position=`fixed`,e.style.top=`0`,e.style.left=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`auto`}function rt(e=`/listener`){if(!window.opener)return null;let t=t=>{try{return t.location.origin===window.location.origin&&t.location.pathname===e}catch{return!1}};if(t(window.opener))return window.opener;try{let e=window.opener.frames;for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}catch(t){return console.error(`[findIframeInOpener] Error finding iframe with pathname ${e}:`,t),null}}function it(e){if(!(typeof document>`u`))try{let t=new URL(e).origin,n=`link[rel="preconnect"][data-frak-preconnect="${t}"]`;if(document.head.querySelector(n))return;let r=document.createElement(`link`);r.rel=`preconnect`,r.href=t,r.crossOrigin=``,r.dataset.frakPreconnect=t,document.head.appendChild(r)}catch{}}async function X(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t,{clientId:p()}]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,t.type)}}function at(e,t,n){return F(t)?(U(e,`user_referred_started`,{referrer_client_id:t.c,referrer_wallet:t.w,wallet_status:n?.key}),X(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referrerWallet:t.w,referralTimestamp:t.t}),!0):De(t)?(U(e,`user_referred_started`,{referrer:t.r,wallet_status:n?.key}),X(e,{type:`arrival`,referrerWallet:t.r}),!0):!1}function ot(e,t){let n=p();return!n&&!t?null:{v:2,m:e,t:Math.floor(Date.now()/1e3),...n?{c:n}:{},...t?{w:t}:{}}}function st(e,t){return F(e)?e.w&&t?.wallet?P(e.w,t.wallet):e.c?p()===e.c:!1:De(e)&&t?.wallet?P(e.r,t.wallet):!1}function ct(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;if(st(n,t))return`self-referral`;if(!at(e,n,t))return`no-referrer`;let i=F(n)?n.m:r?.merchantId,a=r?.alwaysAppendUrl&&i?ot(i,t?.wallet):null;return H.replaceUrl({url:window.location?.href,context:a}),U(e,`user_referred_completed`,{status:`success`}),`success`}async function lt(e,{options:t}={}){let n=H.parse({url:window.location.href}),r=await pt(e);try{return ct(e,{walletStatus:r,frakContext:n,options:t})}catch(e){console.warn(`Error processing referral`,{error:e})}}let ut=`frak:referral-success`;async function dt(e){try{await lt(e)===`success`&&window.dispatchEvent(new Event(ut))}catch(e){console.warn(`[Frak] Referral setup failed`,e)}}async function ft(e){if(typeof window>`u`){console.warn(`[Frak] No window found, can't track purchase`);return}let t=window.sessionStorage.getItem(`frak-wallet-interaction-token`),n=p();if(!t&&!n){console.warn(`[Frak] No identity found, skipping purchase check`);return}let r=e.merchantId??await D.resolveMerchantId();if(!r){console.warn(`[Frak] No merchant id found, skipping purchase check`);return}let i={Accept:`application/json`,"Content-Type":`application/json`};t&&(i[`x-wallet-sdk-auth`]=t),n&&(i[`x-frak-client-id`]=n);let a=u();await fetch(`${a}/user/track/purchase`,{method:`POST`,headers:i,body:JSON.stringify({customerId:e.customerId,orderId:e.orderId,token:e.token,merchantId:r})})}function pt(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(mt(e,t),t));let n=new k,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{mt(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function mt(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),le(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function ht(e,{metadata:t,login:n}){return Z(e,{steps:{login:n??{}},metadata:t})}function Z(e,t){function n(n){return Z(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return Z(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function i(n,r){return Z(e,{...t,steps:{...t.steps,final:{...r,action:{key:`sharing`,options:n}}}})}async function o(n,r){return n&&(t.metadata=n(t.metadata??{})),await a(e,t,r)}return{params:t,sendTx:n,reward:r,sharing:i,display:o}}async function gt(e,{tx:t,metadata:n}){return(await a(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function _t(e=96){let t=Math.ceil(e/2),n=``;if(typeof crypto<`u`&&crypto.getRandomValues){let e=new Uint8Array(t);crypto.getRandomValues(e);for(let t=0;t<e.length;t++)n+=e[t].toString(16).padStart(2,`0`)}else for(let e=0;e<t;e++)n+=(Math.random()*256|0).toString(16).padStart(2,`0`);return n.substring(0,e)}async function vt(e,{siwe:t,metadata:n}){let r=e.config?.domain??window.location.host,i=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`;return(await a(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??_t(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var yt=class{constructor(e){this.baseUrl=e.baseUrl,this.headers={"Content-Type":`application/json`,...e.defaultHeaders},this.maxRetries=e.maxRetries??3,this.initialRetryDelay=e.initialRetryDelay??500}async resolveHeaders(){let e={};for(let[t,n]of Object.entries(this.headers)){let r=await n;r!==null&&(e[t]=r)}return e}addHeader(e,t){this.headers[e]=t}async post(e,t,n,r){try{let r=await fetch(e,{method:`POST`,headers:await this.resolveHeaders(),body:t?JSON.stringify(t??{}):void 0,keepalive:!0,...n});if(r.status===401)return null;if(r.status!==200&&r.status!==202)throw Error(`HTTP error! status: ${r.status}`);let i=await r.text();return i?JSON.parse(i):null}catch(i){if(r<this.maxRetries){let i=this.initialRetryDelay*2**r;return await new Promise(e=>setTimeout(e,i)),this.post(e,t,n,r+1)}return console.error(`Max retries reached:`,i),null}}async fetch(e,t,n={}){let r=`${this.baseUrl}${e}`;return this.post(r,t,n,0)}},bt=class{constructor(e){this.groups=[],this.queue=[],this.options=e;let t={"openpanel-client-id":e.clientId};e.clientSecret&&(t[`openpanel-client-secret`]=e.clientSecret),t[`openpanel-sdk-name`]=e.sdk||`node`,t[`openpanel-sdk-version`]=e.sdkVersion||`1.3.1`,this.api=new yt({baseUrl:e.apiUrl||`https://api.openpanel.dev`,defaultHeaders:t})}init(){}ready(){this.options.disabled=!1,this.options.waitForProfile=!1,this.flush()}shouldQueue(e){return!!(this.options.disabled||this.options.waitForProfile&&!this.profileId||e.type===`replay`&&!this.sessionId)}addQueue(e){e.type===`track`&&(e.payload.properties={...e.payload.properties??{},__timestamp:new Date().toISOString()}),this.queue.push(e)}async send(e){if(this.options.filter&&!this.options.filter(e))return Promise.resolve();if(this.shouldQueue(e))return this.addQueue(e),Promise.resolve();let t=await this.api.fetch(`/track`,e,{keepalive:e.type!==`replay`});this.deviceId=t?.deviceId;let n=!!this.sessionId;return this.sessionId=t?.sessionId,!n&&this.sessionId&&this.flush(),t}setGlobalProperties(e){this.global={...this.global,...e}}track(e,t){this.log(`track event`,e,t);let{groups:n,profileId:r,...i}=t??{},a=[...new Set([...this.groups,...n??[]])];return this.send({type:`track`,payload:{name:e,profileId:r??this.profileId,groups:a.length>0?a:void 0,properties:{...this.global??{},...i}}})}identify(e){if(this.log(`identify user`,e),e.profileId&&(this.profileId=e.profileId,this.flush()),e.profileId&&Object.keys(e).length>1)return this.send({type:`identify`,payload:{...e,properties:{...this.global,...e.properties}}})}upsertGroup(e){return this.log(`upsert group`,e),this.send({type:`group`,payload:e})}setGroup(e){return this.log(`set group`,e),this.groups.includes(e)||(this.groups=[...this.groups,e]),this.send({type:`assign_group`,payload:{groupIds:[e],profileId:this.profileId}})}setGroups(e){return this.log(`set groups`,e),this.groups=[...new Set([...this.groups,...e])],this.send({type:`assign_group`,payload:{groupIds:e,profileId:this.profileId}})}alias(e){}increment(e){return this.send({type:`increment`,payload:e})}decrement(e){return this.send({type:`decrement`,payload:e})}revenue(e,t){let n=t?.deviceId;return delete t?.deviceId,this.track(`revenue`,{...t??{},...n?{__deviceId:n}:{},__revenue:e})}getDeviceId(){return this.deviceId??``}getSessionId(){return this.sessionId??``}fetchDeviceId(){return Promise.resolve(this.deviceId??``)}clear(){this.profileId=void 0,this.groups=[],this.deviceId=void 0,this.sessionId=void 0}buildFlushPayload(e){if(e.type===`replay`)return e.payload;if(e.type===`track`){let t=`groups`in e.payload?e.payload.groups??[]:[],n=[...new Set([...this.groups,...t])];return{...e.payload,profileId:e.payload.profileId??this.profileId,groups:n.length>0?n:void 0}}return e.type===`identify`||e.type===`increment`||e.type===`decrement`||e.type===`assign_group`?{...e.payload,profileId:e.payload.profileId??this.profileId}:e.payload}flush(){let e=[];for(let t of this.queue){if(this.shouldQueue(t)){e.push(t);continue}let n=this.buildFlushPayload(t);this.send({...t,payload:n})}this.queue=e}log(...e){this.options.debug&&console.log(`[OpenPanel.dev]`,...e)}};function xt(){return()=>{}}var St=n((()=>{})),Ct=r({startReplayRecorder:()=>wt,stopReplayRecorder:()=>Tt});function wt(e,t){if(typeof document>`u`||typeof window>`u`)return;Q&&Q();let n=e.maxEventsPerChunk??200,r=e.flushIntervalMs??1e4,i=e.maxPayloadBytes??1048576,a=[],o=0,s=null;function c(e){if(a.length===0)return;let n=JSON.stringify(a);if(new TextEncoder().encode(n).length>i){if(a.length>1){let t=Math.floor(a.length/2),n=a.slice(0,t),r=a.slice(t),i=e&&n.some(e=>e.type===2);a=n,c(i),a=r,c(!1);return}a=[];return}let r=a[0].timestamp,s=a[a.length-1].timestamp;try{t({chunk_index:o,events_count:a.length,is_full_snapshot:e,started_at:new Date(r).toISOString(),ended_at:new Date(s).toISOString(),payload:n}),o+=1,a=[]}catch(e){throw console.error(`[ReplayRecorder] sendChunk failed`,e),e}}function l(e){let t=e||a.some(e=>e.type===2);a.length>=n?c(t):e&&a.length>0&&c(!0)}let u=e.maskAllText!==!1,d=e.unmaskTextSelector,f=xt({emit(e,t){a.push(e),l(!!t)},checkoutEveryNms:r,maskAllInputs:e.maskAllInputs??!0,maskTextSelector:u?`*`:`[data-openpanel-replay-mask]`,maskTextFn:u&&d?(e,t)=>t?.closest(d)?e:e.replace(/\S/g,`*`):void 0,blockSelector:e.blockSelector??`[data-openpanel-replay-block]`,blockClass:e.blockClass,ignoreSelector:e.ignoreSelector});s=setInterval(()=>{a.length>0&&c(a.some(e=>e.type===2))},r);function p(){document.visibilityState===`hidden`&&a.length>0&&c(a.some(e=>e.type===2))}function m(){a.length>0&&c(a.some(e=>e.type===2))}document.addEventListener(`visibilitychange`,p),window.addEventListener(`pagehide`,m),Q=()=>{a.length>0&&c(a.some(e=>e.type===2)),s&&=(clearInterval(s),null),document.removeEventListener(`visibilitychange`,p),window.removeEventListener(`pagehide`,m),f?.(),Q=null}}function Tt(){Q&&Q()}var Q,Et=n((()=>{St(),Q=null})),Dt=typeof document<`u`?document.currentScript:null;function Ot(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var kt=class extends bt{constructor(e){if(super({sdk:`web`,sdkVersion:`1.4.1`,...e}),this.options=e,this.lastPath=``,this.pendingRevenues=[],!this.isServer()){try{let e=sessionStorage.getItem(`openpanel-pending-revenues`);if(e){let t=JSON.parse(e);Array.isArray(t)&&(this.pendingRevenues=t)}}catch{this.pendingRevenues=[]}if(this.setGlobalProperties({__referrer:document.referrer}),this.options.trackScreenViews&&(this.trackScreenViews(),setTimeout(()=>this.screenView(),0)),this.options.trackOutgoingLinks&&this.trackOutgoingLinks(),this.options.trackAttributes&&this.trackAttributes(),this.options.sessionReplay?.enabled){let e=this.options.sessionReplay.sampleRate??1;Math.random()<e&&this.loadReplayModule().then(e=>{e&&e.startReplayRecorder(this.options.sessionReplay,e=>{this.send({type:`replay`,payload:{...e}})})})}}}async loadReplayModule(){try{if(typeof __OPENPANEL_REPLAY_URL__<`u`){let e=Dt,t=this.options.sessionReplay?.scriptUrl||e?.src?.replace(`.js`,`-replay.js`)||`https://openpanel.dev/op1-replay.js`;return window.__openpanel_replay?window.__openpanel_replay:new Promise(e=>{let n=document.createElement(`script`);n.src=t,n.onload=()=>{e(window.__openpanel_replay??null)},n.onerror=()=>{console.warn(`[OpenPanel] Failed to load replay script from`,t),e(null)},document.head.appendChild(n)})}return await Promise.resolve().then(()=>(Et(),Ct))}catch(e){return console.warn(`[OpenPanel] Failed to load replay module`,e),null}}debounce(e,t){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(e,t)}isServer(){return typeof document>`u`}trackOutgoingLinks(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`a`);if(n&&t){let e=n.getAttribute(`href`);if(e?.startsWith(`http`))try{let r=new URL(e),i=window.location.hostname;r.hostname!==i&&super.track(`link_out`,{href:e,text:n.innerText||n.getAttribute(`title`)||t.getAttribute(`alt`)||t.getAttribute(`title`)})}catch{}}})}trackScreenViews(){if(this.isServer())return;let e=history.pushState;history.pushState=function(...t){let n=e.apply(this,t);return window.dispatchEvent(new Event(`pushstate`)),window.dispatchEvent(new Event(`locationchange`)),n};let t=history.replaceState;history.replaceState=function(...e){let n=t.apply(this,e);return window.dispatchEvent(new Event(`replacestate`)),window.dispatchEvent(new Event(`locationchange`)),n},window.addEventListener(`popstate`,()=>{window.dispatchEvent(new Event(`locationchange`))});let n=()=>this.debounce(()=>this.screenView(),50);this.options.trackHashChanges?window.addEventListener(`hashchange`,n):window.addEventListener(`locationchange`,n)}trackAttributes(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`button`),r=t.closest(`a`),i=n?.getAttribute(`data-track`)?n:r?.getAttribute(`data-track`)?r:null;if(i){let e={};for(let t of i.attributes)t.name.startsWith(`data-`)&&t.name!==`data-track`&&(e[Ot(t.name.replace(/^data-/,``))]=t.value);let t=i.getAttribute(`data-track`);t&&super.track(t,e)}})}track(e,t){return super.track(e,{...t,__path:this.lastPath})}screenView(e,t){if(this.isServer())return;let n,r;typeof e==`string`?(n=e,r=t):(n=window.location.href,r=e),this.lastPath!==n&&(this.lastPath=n,super.track(`screen_view`,{...r??{},__path:n,__title:document.title}))}async flushRevenue(){let e=this.pendingRevenues.map(e=>super.revenue(e.amount,e.properties));await Promise.all(e),this.clearRevenue()}clearRevenue(){if(this.pendingRevenues=[],!this.isServer())try{sessionStorage.removeItem(`openpanel-pending-revenues`)}catch{}}pendingRevenue(e,t){if(this.pendingRevenues.push({amount:e,properties:t}),!this.isServer())try{sessionStorage.setItem(`openpanel-pending-revenues`,JSON.stringify(this.pendingRevenues))}catch{}}};function At(e,t){if(typeof window>`u`)return;let n=new URL(window.location.href),r=n.searchParams.get(`sso`);r&&(t.then(()=>{e.sendLifecycle({clientLifecycle:`sso-redirect-complete`,data:{compressed:r}}),console.log(`[SSO URL Listener] Forwarded compressed SSO data to iframe`)}).catch(e=>{console.error(`[SSO URL Listener] Failed to forward SSO data:`,e)}),n.searchParams.delete(`sso`),window.history.replaceState({},``,n.toString()),console.log(`[SSO URL Listener] SSO parameter detected and URL cleaned`))}let jt=K&&Je;function Mt(e){e?localStorage.setItem(W,e):localStorage.removeItem(W)}function $(e,t){try{let n=new URL(e);if(!n.searchParams.has(`u`))return e;let r=Ft(window.location.href,t);return n.searchParams.delete(`u`),n.searchParams.append(`u`,r),n.toString()}catch{return e}}function Nt(e){let t=new URL(window.location.href);e&&t.searchParams.set(`fmt`,e);let n=t.protocol===`http:`?`x-safari-http`:`x-safari-https`;window.location.href=`${n}://${t.host}${t.pathname}${t.search}${t.hash}`}function Pt(e){return e.includes(`/common/social`)}function Ft(e,t){if(!t)return e;try{let n=new URL(e);return n.searchParams.set(`fmt`,t),n.toString()}catch{return`${e}${e.includes(`?`)?`&`:`?`}fmt=${encodeURIComponent(t)}`}}function It(e,t,n,r,i){if(i){let e=$(t,r);window.open(e,`_blank`);return}if(We(t)){let i=$(t,r);Ue(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(jt&&Pt(t))Nt(r);else{let e=$(t,r);window.location.href=e}}function Lt({iframe:e,targetOrigin:t}){let n=new k;return{handleEvent:r=>{if(!(`iframeLifecycle`in r))return;let{iframeLifecycle:i,data:a}=r;switch(i){case`connected`:n.resolve(!0);break;case`do-backup`:Mt(a.backup);break;case`remove-backup`:localStorage.removeItem(W);break;case`show`:case`hide`:nt({iframe:e,isVisible:i===`show`});break;case`redirect`:It(e,a.baseRedirectUrl,t,a.mergeToken,a.openInNewTab);break}},isConnected:n.promise}}function Rt({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=typeof navigator<`u`?navigator.language?.split(`-`)[0]:void 0,i=e.metadata.lang??(r===`en`||r===`fr`?r:void 0),a=e.domain??(typeof window<`u`?window.location.hostname:``);D.setCacheScope(a,i),D.reset();let o=D.isCacheFresh?void 0:D.resolve(e.domain,e.walletUrl,i),s=Lt({iframe:t,targetOrigin:n}),c=new k,l=Date.now();if(!t.contentWindow)throw new O(pe.configError,`The iframe does not have a content window`);let u=me({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await s.isConnected)throw new O(pe.clientNotConnected,`The iframe provider isn't connected yet`);return await c.promise,t}}],lifecycleHandlers:{iframeLifecycle:(e,t)=>{s.handleEvent(e)}}}),d=zt(u,s),f=async()=>{d(),u.cleanup(),t.remove(),_(),D.clearCache(),D.reset()},m;{console.log(`[Frak SDK] Initializing OpenPanel`),m=new kt({apiUrl:`https://op-api.gcp.frak.id`,clientId:`6eacc8d7-49ac-4936-95e9-81ef29449570`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>(e!==`track`||!t?.properties||`sdk_version`in t.properties||(t.properties={...t.properties,sdk_version:`1.2.0`,user_anonymous_client_id:p()}),!0)}),m.setGlobalProperties({sdk_version:`1.2.0`,user_anonymous_client_id:p()}),m.init(),m.track(`sdk_initialized`,{sdk_version:`1.2.0`});let e=!1,t=setTimeout(()=>{e||(e=!0,m?.track(`sdk_iframe_handshake_failed`,{reason:`timeout`}))},3e4);s.isConnected.then(()=>{e||(e=!0,clearTimeout(t),m?.track(`sdk_iframe_connected`,{handshake_duration_ms:Date.now()-l}))}).catch(()=>{e||(e=!0,clearTimeout(t),m?.track(`sdk_iframe_handshake_failed`,{reason:`unknown`}))})}let h=Bt({config:e,rpcClient:u,lifecycleManager:s,configPromise:o,contextSent:c,openPanel:m}).then(()=>{}).catch(e=>{throw c.reject(e),e});return{config:e,waitForConnection:s.isConnected,waitForSetup:h,request:u.request,listenerRequest:u.listen,destroy:f,openPanel:m}}function zt(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,250),r=setTimeout(()=>{o(),console.log(`Heartbeat timeout: connection failed`)},3e4),await t.isConnected,o()}function o(){n&&clearInterval(n),r&&clearTimeout(r)}return a(),o}async function Bt({config:e,rpcClient:t,lifecycleManager:n,configPromise:r,contextSent:i,openPanel:a}){await n.isConnected,At(t,n.isConnected);let o=new URL(window.location.href),s=o.searchParams.get(`fmt`)??void 0;s&&(o.searchParams.delete(`fmt`),window.history.replaceState({},``,o.toString()));let c=t=>{let n=t?.merchantId??e.metadata.merchantId??``,r=t?.domain??``,i=t?.allowedDomains??[],a=t?.sdkConfig,o=a?.attribution||e.attribution?{...e.attribution,...a?.attribution}:void 0;D.setConfig(a?{isResolved:!0,merchantId:n,domain:r,allowedDomains:i,hasRawSdkConfig:!0,name:a.name??e.metadata.name,logoUrl:a.logoUrl??e.metadata.logoUrl,homepageLink:a.homepageLink??e.metadata.homepageLink,lang:a.lang??e.metadata.lang,currency:a.currency??e.metadata.currency,hidden:a.hidden,css:a.css,translations:a.translations,placements:a.placements,components:a.components,attribution:o}:{isResolved:!0,merchantId:n,domain:r,allowedDomains:i,name:e.metadata.name,logoUrl:e.metadata.logoUrl,homepageLink:e.metadata.homepageLink,lang:e.metadata.lang,currency:e.metadata.currency,attribution:o})},l=!1,u=e=>{let n=l?void 0:s;l=!0;let r=e.hasRawSdkConfig?{name:e.name,logoUrl:e.logoUrl,homepageLink:e.homepageLink,lang:e.lang,currency:e.currency,hidden:e.hidden,css:e.css,translations:e.translations,placements:e.placements,attribution:e.attribution}:e.attribution?{attribution:e.attribution}:void 0,i=p();if(a){let t=a.global??{};a.setGlobalProperties({...t,merchant_id:e.merchantId,domain:e.domain??``})}t.sendLifecycle({clientLifecycle:`resolved-config`,data:{merchantId:e.merchantId,domain:e.domain??``,allowedDomains:e.allowedDomains??[],sourceUrl:window.location.href,...i&&{sdkAnonymousId:i},...n&&{pendingMergeToken:n},...r&&{sdkConfig:r}}})};D.isResolved&&(u(D.getConfig()),i.resolve()),r&&(c(await r),u(D.getConfig()),i.resolve());async function d(){let n=e.customizations?.css;n&&t.sendLifecycle({clientLifecycle:`modal-css`,data:{cssLink:n}})}async function f(){let n=e.customizations?.i18n;n&&t.sendLifecycle({clientLifecycle:`modal-i18n`,data:{i18n:n}})}async function m(){if(typeof window>`u`)return;let e=window.localStorage.getItem(W);e&&t.sendLifecycle({clientLifecycle:`restore-backup`,data:{backup:e}})}(await Promise.allSettled([d(),f(),m()])).some(e=>e.status===`rejected`)&&a?.track(`sdk_iframe_handshake_failed`,{reason:`asset_push`})}async function Vt({config:e}){let t=Ht(e),n=await et({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=Rt({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function Ht(e){let t=J(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}return e.DEEP_LINK_SCHEME=G,e.FrakContextManager=H,e.REFERRAL_SUCCESS_EVENT=ut,e.areAddressesEqual=P,e.base64urlDecode=j,e.base64urlEncode=A,e.baseIframeProps=Y,e.clearAllCache=_,e.compressJsonToB64=_e,e.createIFrameFrakClient=Rt,e.decompressJsonFromB64=Xe,e.deleteQueryParamCaseInsensitive=I,e.displayEmbeddedWallet=i,e.displayModal=a,e.displaySharingPage=o,e.ensureIdentity=le,e.findIframeInOpener=rt,e.formatAmount=Qe,e.generateSsoUrl=ve,e.getBackendUrl=u,e.getClientId=p,e.getCurrencyAmountKey=$e,e.getMerchantInformation=ue,e.getMergeToken=de,e.getQueryParamCaseInsensitive=Oe,e.getSupportedCurrency=J,e.getUserReferralStatus=fe,e.isIOS=K,e.isInAppBrowser=Je,e.isMobile=Ke,e.mergeAttribution=ze,e.modalBuilder=ht,e.openSso=xe,e.prepareSso=Se,e.processReferral=ct,e.redirectToExternalBrowser=Ye,e.referralInteraction=lt,e.sdkConfigStore=D,e.sendInteraction=X,e.sendTransaction=gt,e.setupClient=Vt,e.setupReferral=dt,e.siweAuthenticate=vt,e.ssoPopupFeatures=M,e.ssoPopupName=be,e.trackEvent=U,e.trackPurchaseStatus=ft,e.triggerDeepLinkWithFallback=Ue,e.watchWalletStatus=pt,e.withCache=g,e})({});
|
|
1
|
+
var FrakSDK=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},r=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r};async function i(e,t,n){return await e.request({method:`frak_displayEmbeddedWallet`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function a(e,{steps:t,metadata:n},r){return await e.request({method:`frak_displayModal`,params:r?[t,n,e.config.metadata,r]:[t,n,e.config.metadata]})}async function o(e,t,n){return await e.request({method:`frak_displaySharingPage`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}let s=`https://backend.frak.id`;function c(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function l(e){return c(e)?`https://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:s}function u(e){if(e)return l(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return l(e)}return s}let d=`frak-client-id`;function f(){return typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function p(){if(typeof window>`u`||!window.localStorage)return console.warn(`[Frak SDK] No Window / localStorage available to save the clientId`),f();let e=localStorage.getItem(d);return e||(e=f(),localStorage.setItem(d,e)),e}var m=class extends Map{maxSize;constructor(e){super(),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;e!==void 0&&super.delete(e)}return this}};let h;function ee(){return h||={promiseCache:new m(1024),responseCache:new m(1024),failureCache:new m(1024)},h}async function g(e,{cacheKey:t,cacheTime:n=3e4}){let{promiseCache:r,responseCache:i,failureCache:a}=ee();if(n>0){let e=i.get(t);if(e&&Date.now()-e.created<n)return e.data}let o=a.get(t);if(o&&Date.now()-o<1e3)throw Error(`Cache: ${t} recently failed, backing off`);let s=r.get(t);s||(s=e(),r.set(t,s));try{let e=await s;return i.set(t,{data:e,created:Date.now()}),a.delete(t),e}catch(e){throw a.set(t,Date.now()),e}finally{r.delete(t)}}function _(){h&&(h.promiseCache.clear(),h.responseCache.clear(),h.failureCache.clear())}let v=`__frakSdkConfig`,te=`frak-config-cache`,y=`frak-merchant-id`,b={key:te},x=typeof window<`u`;function S(){return{isResolved:!1,merchantId:``}}let C=null;function ne(){if(!x)return null;try{let e=localStorage.getItem(b.key);if(!e)return null;let t=JSON.parse(e);return t.config?.isResolved?(C=t,t):null}catch{return null}}function re(){return(C??ne())?.config}function ie(){let e=C??ne();return e?Date.now()-e.timestamp<3e4:!1}function ae(e){if(!(!x||!e.isResolved))try{let t={config:e,timestamp:Date.now()};localStorage.setItem(b.key,JSON.stringify(t)),C=t}catch{}}function oe(){if(x){C=null;try{localStorage.removeItem(b.key)}catch{}}}function se(){x&&(window[v]||(window[v]=re()??S()))}function w(){return x?(se(),window[v]??S()):S()}function ce(e){x&&window.dispatchEvent(new CustomEvent(`frak:config`,{detail:e}))}function le(e){return e??(x?window.location.hostname:``)}async function ue(e,t,n){try{let r=u(t),i=n?`&lang=${encodeURIComponent(n)}`:``,a=await fetch(`${r}/user/merchant/resolve?domain=${encodeURIComponent(e)}${i}`);if(!a.ok){console.warn(`[Frak SDK] Merchant lookup failed for domain ${e}: ${a.status}`);return}let o=await a.json();if(x)try{sessionStorage.setItem(y,o.merchantId)}catch{}return o}catch(e){console.warn(`[Frak SDK] Failed to fetch merchant config:`,e);return}}let T={getConfig:w,get isResolved(){return w().isResolved},get isCacheFresh(){return ie()},setCacheScope(e,t){let n=`${e}:${t??``}`;b.key=`${te}:${n}`,C=null},setConfig(e){if(x&&(window[v]=e),ae(e),ce(e),x&&e.merchantId)try{sessionStorage.setItem(y,e.merchantId)}catch{}},reset(){let e=re()??S();x&&(window[v]=e),ce(e)},clearCache(){if(oe(),_(),x)try{sessionStorage.removeItem(y)}catch{}},resolve(e,t,n){let r=le(e);return r?g(async()=>{let e=await ue(r,t,n);if(!e)throw Error(`Config resolution returned empty`);return e},{cacheKey:`sdkConfig:${r}:${n??``}`,cacheTime:1/0}).catch(()=>void 0):Promise.resolve(void 0)},getMerchantId(){let e=w();if(e.isResolved&&e.merchantId)return e.merchantId;if(x)try{return sessionStorage.getItem(y)??void 0}catch{}},async resolveMerchantId(e,t){return T.getMerchantId()||(await T.resolve(e,t))?.merchantId}};async function de(e){if(typeof window>`u`)return;let t=p();if(!t)return;let n=await T.resolveMerchantId();if(!n)return;let r=`frak-identity-ensured-${n}`;if(!window.sessionStorage.getItem(r))try{let i=u();(await fetch(`${i}/user/identity/ensure`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"x-wallet-sdk-auth":e,"x-frak-client-id":t},body:JSON.stringify({merchantId:n})})).ok&&window.sessionStorage.setItem(r,`1`)}catch{}}async function fe(e,t){return g(()=>e.request({method:`frak_getMerchantInformation`}),{cacheKey:`frak_getMerchantInformation`,cacheTime:t?.cacheTime})}async function pe(e,t){return g(()=>e.request({method:`frak_getMergeToken`}),{cacheKey:`frak_getMergeToken`,cacheTime:t?.cacheTime})}async function me(e,t){return g(()=>e.request({method:`frak_getUserReferralStatus`}),{cacheKey:`frak_getUserReferralStatus`,cacheTime:t?.cacheTime})}let he={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006,userRejected:-32007};var E=class extends Error{code;data;constructor(e,t,n){super(t),this.code=e,this.data=n}toJSON(){return{code:this.code,message:this.message,data:this.data}}},D=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve=e=>{this._resolve?.(e)};reject=e=>{this._reject?.(e)}};function ge(e){let{emittingTransport:t,listeningTransport:n,targetOrigin:r,middleware:i=[],lifecycleHandlers:a}=e,o=new Map;function s(e){return typeof e!=`object`||!e?!1:`clientLifecycle`in e||`iframeLifecycle`in e}function c(e){return typeof e!=`object`||!e?!1:`id`in e&&`topic`in e&&`data`in e}async function l(e){try{`clientLifecycle`in e&&a?.clientLifecycle?await a.clientLifecycle(e,{origin:r,source:null}):`iframeLifecycle`in e&&a?.iframeLifecycle&&await a.iframeLifecycle(e,{origin:r,source:null})}catch(e){console.error(`[RPC Client] Lifecycle handler error:`,e)}}async function u(e){let t={origin:r,source:null};for(let n of i)n.onRequest&&await n.onRequest(e,t);return e}async function d(e,t){let n={origin:r,source:null},a=t;for(let t of i)t.onResponse&&(a=await t.onResponse(e,a,n));return a}async function f(e){try{let t=new URL(e.origin).origin.toLowerCase(),n=new URL(r).origin.toLowerCase();if(t!==n){console.log(`Not expected origin`,t,n);return}}catch(e){console.error(`[RPC Client] Invalid origin`,e);return}if(s(e.data)){await l(e.data);return}if(!c(e.data))return;let t;try{let n=e.data.data,r=n instanceof Uint8Array||ArrayBuffer.isView(n)?{result:n}:n;t=await d(e.data,r)}catch(e){console.error(`[RPC Client] Middleware error on response:`,e);return}let n=o.get(e.data.id);n&&n(t)}async function p(e){let n=e;try{n=await u(e)}catch(e){throw console.error(`[RPC Client] Middleware error on request:`,e),e}t.postMessage(n,r)}function m(e){t.postMessage(e,r)}function h(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}n.addEventListener(`message`,f);function ee(e){let t=h(),n=new D;return o.set(t,e=>{e.error?n.reject(new E(e.error.code,e.error.message,e.error.data)):n.resolve(e.result),o.delete(t)}),p({id:t,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{o.delete(t),n.reject(e)}),n.promise}function g(e,t){let n=h();return o.set(n,e=>{e.error?(console.error(`[RPC Client] Listener error:`,e.error),o.delete(n)):t(e.result)}),p({id:n,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{console.error(`[RPC Client] Failed to send listener request:`,e),o.delete(n)}),()=>{o.delete(n)}}function _(){n.removeEventListener(`message`,f),o.clear()}return{request:ee,listen:g,sendLifecycle:m,cleanup:_}}function _e(e){return new TextEncoder().encode(JSON.stringify(e))}function ve(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}function O(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function k(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(e.length+(t===0?0:4-t),`=`)),e=>e.charCodeAt(0))}function ye(e){return O(_e(e))}function A(e,t,n,r,i,a){let o=ye(be({redirectUrl:t.redirectUrl,directExit:t.directExit,lang:t.lang,merchantId:n,metadata:{name:r,css:a,logoUrl:t.metadata?.logoUrl,homepageLink:t.metadata?.homepageLink},clientId:i})),s=new URL(e);return s.pathname=`/sso`,s.searchParams.set(`p`,o),s.toString()}function be(e){return{r:e.redirectUrl,cId:e.clientId,d:e.directExit,l:e.lang,m:e.merchantId,md:{n:e.metadata?.name,css:e.metadata?.css,l:e.metadata?.logoUrl,h:e.metadata?.homepageLink}}}let j=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,M=`frak-sso`;async function xe(e,t){let{metadata:n,customizations:r,walletUrl:i}=e.config,a={...t,directExit:t.directExit??!t.redirectUrl};if(a.openInSameWindow??!!a.redirectUrl)return await e.request({method:`frak_openSso`,params:[a,n.name,r?.css]});let o=a.ssoPopupUrl??A(i??`https://wallet.frak.id`,a,await T.resolveMerchantId()??``,n.name,p(),r?.css),s=window.open(o,M,j);if(!s)throw Error(`Popup was blocked. Please allow popups for this site.`);return s.focus(),await e.request({method:`frak_openSso`,params:[a,n.name,r?.css]})??{}}async function Se(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}let Ce=/^0x[a-fA-F0-9]{40}$/;function N(e){return typeof e==`string`&&Ce.test(e)}function P(e,t){return e.toLowerCase()===t.toLowerCase()}function F(e){let t=new Uint8Array(20);for(let n=0;n<20;n++){let r=Number.parseInt(e.substring(2+n*2,4+n*2),16);if(Number.isNaN(r))throw Error(`Invalid address: ${e}`);t[n]=r}return t}let we=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function I(e){let t=`0x`;for(let n=0;n<20;n++)t+=we[e[n]];return t}function L(e){return`r`in e&&!(`v`in e)}function R(e){return`v`in e&&e.v===2}function Te(e,t){let n=e.get(t);if(n!==null)return n;let r=t.toLowerCase();for(let[t,n]of e)if(t.toLowerCase()===r)return n;return null}function z(e,t){let n=t.toLowerCase(),r=[...e.keys()].filter(e=>e.toLowerCase()===n);for(let t of r)e.delete(t)}let Ee=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function De(e){return typeof e==`string`&&Ee.test(e)}function Oe(e){let t=e.replace(/-/g,``),n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=Number.parseInt(t.substring(e*2,e*2+2),16);return n}function ke(e){let t=``;for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,`0`);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`}function Ae(e){if(!De(e.m)||!Number.isInteger(e.t)||e.t<0||e.t>4294967295)return null;let t=typeof e.c==`string`&&e.c.length>0,n=typeof e.w==`string`&&N(e.w);if(!t&&!n||t&&!De(e.c))return null;let r=new Uint8Array(21+(t?16:0)+(n?20:0)),i=new DataView(r.buffer,r.byteOffset,r.byteLength),a=0;return r[a++]=2|(t?16:0)|(n?32:0),r.set(Oe(e.m),a),a+=16,i.setUint32(a,e.t,!1),a+=4,t&&(r.set(Oe(e.c),a),a+=16),n&&(r.set(F(e.w),a),a+=20),r}function je(e){if(e.length<21)return null;let t=e[0];if((t&15)!=2||t&192)return null;let n=(t&16)!=0,r=(t&32)!=0;if(!n&&!r)return null;let i=21+(n?16:0)+(r?20:0);if(e.length!==i)return null;let a=1,o=ke(e.subarray(a,a+16));a+=16;let s=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(a,!1);a+=4;let c={v:2,m:o,t:s};if(n&&(c.c=ke(e.subarray(a,a+16)),a+=16),r){let t=I(e.subarray(a,a+20));if(!N(t))return null;c.w=t,a+=20}return c}let B=`fCtx`;function Me(e){if(e)try{if(R(e)){let t=Ae(e);return t?O(t):void 0}return O(F(e.r))}catch(t){console.error(`Error compressing Frak context`,{e:t,context:e})}}function Ne(e){if(!(!e||e.length===0))try{let t=k(e);if(t.length!==20)return je(t)||void 0;let n=I(t);if(N(n))return{r:n}}catch(t){console.error(`Error decompressing Frak context`,{e:t,context:e})}}function Pe({url:e}){if(!e)return null;let t=Te(new URL(e).searchParams,B);return t?Ne(t):null}function Fe(e){return{utm_source:e.utmSource??`frak`,utm_medium:e.utmMedium??void 0,utm_campaign:e.utmCampaign??void 0,utm_content:e.utmContent,utm_term:e.utmTerm,via:e.via??void 0,ref:e.ref??void 0}}function Ie(e,t){let n=Fe(t??{});for(let[t,r]of Object.entries(n))r===void 0||r===``||e.searchParams.has(t)||e.searchParams.set(t,r)}function Le({url:e,context:t,attribution:n}){if(!e)return null;let r=Me(t);if(!r)return null;let i=new URL(e);return z(i.searchParams,B),i.searchParams.set(B,r),Ie(i,n),i.toString()}function Re(e){let t=new URL(e);return z(t.searchParams,B),t.toString()}function ze({url:e,context:t}){if(!window.location?.href||typeof window>`u`){console.error(`No window found, can't update context`);return}let n=e??window.location.href,r;r=t===null?Re(n):Le({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}let V={compress:Me,decompress:Ne,parse:Pe,update:Le,remove:Re,replaceUrl:ze};function Be({perCall:e,defaults:t,productUtmContent:n}){if(e===null)return;let r=e!==void 0,i=t!==void 0&&Object.keys(t).length>0;if(!r&&!i&&!(n!==void 0&&n!==``))return;let a={...t,...e??{}},o=n??e?.utmContent;return o!==void 0&&o!==``?a.utmContent=o:delete a.utmContent,a}function H(e,t,n){if(!e){console.debug(`[Frak] No client provided, skipping event tracking`);return}try{e.openPanel?.track(t,n)}catch(e){console.debug(`[Frak] Failed to track event:`,t,e)}}let U=`nexus-wallet-backup`,W=`frakwallet://`;function Ve(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}let He=W.replace(`://`,``);function Ue(e){return`intent://${e.slice(13)}#Intent;scheme=${He};end`}function We(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=Ve()&&G(e)?Ue(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function G(e){return e.startsWith(W)}function Ge(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent;return!!(/iPhone|iPad|iPod/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1)}let K=Ge();function Ke(){return typeof navigator>`u`?!1:K?!0:/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function qe(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase();return e.includes(`instagram`)||e.includes(`fban`)||e.includes(`fbav`)||e.includes(`facebook`)}let Je=qe();function Ye(e){K&&e.startsWith(`https://`)?window.location.href=`x-safari-https://${e.slice(8)}`:K&&e.startsWith(`http://`)?window.location.href=`x-safari-http://${e.slice(7)}`:window.location.href=`https://backend.frak.id/common/social?u=${encodeURIComponent(e)}`}function Xe(e){return ve(k(e))}let q={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function J(e){return e&&e in q?e:`eur`}function Ze(e){return e?q[e]??q.eur:q.eur}function Qe(e,t){let n=Ze(t),r=J(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function $e(e){return e?`${e}Amount`:`eurAmount`}function et(e){let t=e?.split(`-`)[0]?.toLowerCase();return t===`en`||t===`fr`?t:void 0}function tt(){return(typeof document<`u`?et(document.documentElement.lang):void 0)||(typeof navigator<`u`?et(navigator.language):void 0)}let Y={id:`frak-wallet`,name:`frak-wallet`,title:`Frak Wallet`,allow:`publickey-credentials-get *; clipboard-write; web-share *`,style:{width:`0`,height:`0`,border:`0`,position:`absolute`,zIndex:2000001,top:`-1000px`,left:`-1000px`,colorScheme:`auto`}};function nt({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);r.id=Y.id,r.name=Y.name,r.allow=Y.allow,r.style.zIndex=Y.style.zIndex.toString(),it({iframe:r,isVisible:!1});let i=t?.walletUrl??e??`https://wallet.frak.id`,a=p();return ot(i),ot(u(i)),r.src=rt({walletUrl:i,clientId:a,preload:t?.preload}),new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function rt({walletUrl:e,clientId:t,preload:n}){let r=`${e}/listener?clientId=${encodeURIComponent(t)}`;return!n||n.length===0?r:`${r}#preload=${n.join(`,`)}`}function it({iframe:e,isVisible:t}){if(!t){e.style.width=`0`,e.style.height=`0`,e.style.border=`0`,e.style.position=`fixed`,e.style.top=`-1000px`,e.style.left=`-1000px`;return}e.style.position=`fixed`,e.style.top=`0`,e.style.left=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`auto`}function at(e=`/listener`){if(!window.opener)return null;let t=t=>{try{return t.location.origin===window.location.origin&&t.location.pathname===e}catch{return!1}};if(t(window.opener))return window.opener;try{let e=window.opener.frames;for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}catch(t){return console.error(`[findIframeInOpener] Error finding iframe with pathname ${e}:`,t),null}}function ot(e){if(!(typeof document>`u`))try{let t=new URL(e).origin,n=`link[rel="preconnect"][data-frak-preconnect="${t}"]`;if(document.head.querySelector(n))return;let r=document.createElement(`link`);r.rel=`preconnect`,r.href=t,r.crossOrigin=``,r.dataset.frakPreconnect=t,document.head.appendChild(r)}catch{}}async function X(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t,{clientId:p()}]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,t.type)}}function st(e,t,n){return R(t)?(H(e,`user_referred_started`,{referrer_client_id:t.c,referrer_wallet:t.w,wallet_status:n?.key}),X(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referrerWallet:t.w,referralTimestamp:t.t}),!0):L(t)?(H(e,`user_referred_started`,{referrer:t.r,wallet_status:n?.key}),X(e,{type:`arrival`,referrerWallet:t.r}),!0):!1}function ct(e,t){let n=p();return!n&&!t?null:{v:2,m:e,t:Math.floor(Date.now()/1e3),...n?{c:n}:{},...t?{w:t}:{}}}function lt(e,t){return R(e)?e.w&&t?.wallet?P(e.w,t.wallet):e.c?p()===e.c:!1:L(e)&&t?.wallet?P(e.r,t.wallet):!1}function ut(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;if(lt(n,t))return`self-referral`;if(!st(e,n,t))return`no-referrer`;let i=R(n)?n.m:r?.merchantId,a=r?.alwaysAppendUrl&&i?ct(i,t?.wallet):null;return V.replaceUrl({url:window.location?.href,context:a}),H(e,`user_referred_completed`,{status:`success`}),`success`}async function dt(e,{options:t}={}){let n=V.parse({url:window.location.href}),r=await ht(e);try{return ut(e,{walletStatus:r,frakContext:n,options:t})}catch(e){console.warn(`Error processing referral`,{error:e})}}let ft=`frak:referral-success`;async function pt(e){try{await dt(e)===`success`&&window.dispatchEvent(new Event(ft))}catch(e){console.warn(`[Frak] Referral setup failed`,e)}}async function mt(e){if(typeof window>`u`){console.warn(`[Frak] No window found, can't track purchase`);return}let t=window.sessionStorage.getItem(`frak-wallet-interaction-token`),n=p();if(!t&&!n){console.warn(`[Frak] No identity found, skipping purchase check`);return}let r=e.merchantId??await T.resolveMerchantId();if(!r){console.warn(`[Frak] No merchant id found, skipping purchase check`);return}let i={Accept:`application/json`,"Content-Type":`application/json`};t&&(i[`x-wallet-sdk-auth`]=t),n&&(i[`x-frak-client-id`]=n);let a=u();await fetch(`${a}/user/track/purchase`,{method:`POST`,headers:i,body:JSON.stringify({customerId:e.customerId,orderId:e.orderId,token:e.token,merchantId:r})})}function ht(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(gt(e,t),t));let n=new D,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{gt(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function gt(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),de(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function _t(e,{metadata:t,login:n}){return Z(e,{steps:{login:n??{}},metadata:t})}function Z(e,t){function n(n){return Z(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return Z(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function i(n,r){return Z(e,{...t,steps:{...t.steps,final:{...r,action:{key:`sharing`,options:n}}}})}async function o(n,r){return n&&(t.metadata=n(t.metadata??{})),await a(e,t,r)}return{params:t,sendTx:n,reward:r,sharing:i,display:o}}async function vt(e,{tx:t,metadata:n}){return(await a(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function yt(e=96){let t=Math.ceil(e/2),n=``;if(typeof crypto<`u`&&crypto.getRandomValues){let e=new Uint8Array(t);crypto.getRandomValues(e);for(let t=0;t<e.length;t++)n+=e[t].toString(16).padStart(2,`0`)}else for(let e=0;e<t;e++)n+=(Math.random()*256|0).toString(16).padStart(2,`0`);return n.substring(0,e)}async function bt(e,{siwe:t,metadata:n}){let r=e.config?.domain??window.location.host,i=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`;return(await a(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??yt(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var xt=class{constructor(e){this.baseUrl=e.baseUrl,this.headers={"Content-Type":`application/json`,...e.defaultHeaders},this.maxRetries=e.maxRetries??3,this.initialRetryDelay=e.initialRetryDelay??500}async resolveHeaders(){let e={};for(let[t,n]of Object.entries(this.headers)){let r=await n;r!==null&&(e[t]=r)}return e}addHeader(e,t){this.headers[e]=t}async post(e,t,n,r){try{let r=await fetch(e,{method:`POST`,headers:await this.resolveHeaders(),body:t?JSON.stringify(t??{}):void 0,keepalive:!0,...n});if(r.status===401)return null;if(r.status!==200&&r.status!==202)throw Error(`HTTP error! status: ${r.status}`);let i=await r.text();return i?JSON.parse(i):null}catch(i){if(r<this.maxRetries){let i=this.initialRetryDelay*2**r;return await new Promise(e=>setTimeout(e,i)),this.post(e,t,n,r+1)}return console.error(`Max retries reached:`,i),null}}async fetch(e,t,n={}){let r=`${this.baseUrl}${e}`;return this.post(r,t,n,0)}},St=class{constructor(e){this.groups=[],this.queue=[],this.options=e;let t={"openpanel-client-id":e.clientId};e.clientSecret&&(t[`openpanel-client-secret`]=e.clientSecret),t[`openpanel-sdk-name`]=e.sdk||`node`,t[`openpanel-sdk-version`]=e.sdkVersion||`1.3.1`,this.api=new xt({baseUrl:e.apiUrl||`https://api.openpanel.dev`,defaultHeaders:t})}init(){}ready(){this.options.disabled=!1,this.options.waitForProfile=!1,this.flush()}shouldQueue(e){return!!(this.options.disabled||this.options.waitForProfile&&!this.profileId||e.type===`replay`&&!this.sessionId)}addQueue(e){e.type===`track`&&(e.payload.properties={...e.payload.properties??{},__timestamp:new Date().toISOString()}),this.queue.push(e)}async send(e){if(this.options.filter&&!this.options.filter(e))return Promise.resolve();if(this.shouldQueue(e))return this.addQueue(e),Promise.resolve();let t=await this.api.fetch(`/track`,e,{keepalive:e.type!==`replay`});this.deviceId=t?.deviceId;let n=!!this.sessionId;return this.sessionId=t?.sessionId,!n&&this.sessionId&&this.flush(),t}setGlobalProperties(e){this.global={...this.global,...e}}track(e,t){this.log(`track event`,e,t);let{groups:n,profileId:r,...i}=t??{},a=[...new Set([...this.groups,...n??[]])];return this.send({type:`track`,payload:{name:e,profileId:r??this.profileId,groups:a.length>0?a:void 0,properties:{...this.global??{},...i}}})}identify(e){if(this.log(`identify user`,e),e.profileId&&(this.profileId=e.profileId,this.flush()),e.profileId&&Object.keys(e).length>1)return this.send({type:`identify`,payload:{...e,properties:{...this.global,...e.properties}}})}upsertGroup(e){return this.log(`upsert group`,e),this.send({type:`group`,payload:e})}setGroup(e){return this.log(`set group`,e),this.groups.includes(e)||(this.groups=[...this.groups,e]),this.send({type:`assign_group`,payload:{groupIds:[e],profileId:this.profileId}})}setGroups(e){return this.log(`set groups`,e),this.groups=[...new Set([...this.groups,...e])],this.send({type:`assign_group`,payload:{groupIds:e,profileId:this.profileId}})}alias(e){}increment(e){return this.send({type:`increment`,payload:e})}decrement(e){return this.send({type:`decrement`,payload:e})}revenue(e,t){let n=t?.deviceId;return delete t?.deviceId,this.track(`revenue`,{...t??{},...n?{__deviceId:n}:{},__revenue:e})}getDeviceId(){return this.deviceId??``}getSessionId(){return this.sessionId??``}fetchDeviceId(){return Promise.resolve(this.deviceId??``)}clear(){this.profileId=void 0,this.groups=[],this.deviceId=void 0,this.sessionId=void 0}buildFlushPayload(e){if(e.type===`replay`)return e.payload;if(e.type===`track`){let t=`groups`in e.payload?e.payload.groups??[]:[],n=[...new Set([...this.groups,...t])];return{...e.payload,profileId:e.payload.profileId??this.profileId,groups:n.length>0?n:void 0}}return e.type===`identify`||e.type===`increment`||e.type===`decrement`||e.type===`assign_group`?{...e.payload,profileId:e.payload.profileId??this.profileId}:e.payload}flush(){let e=[];for(let t of this.queue){if(this.shouldQueue(t)){e.push(t);continue}let n=this.buildFlushPayload(t);this.send({...t,payload:n})}this.queue=e}log(...e){this.options.debug&&console.log(`[OpenPanel.dev]`,...e)}};function Ct(){return()=>{}}var wt=n((()=>{})),Tt=r({startReplayRecorder:()=>Et,stopReplayRecorder:()=>Dt});function Et(e,t){if(typeof document>`u`||typeof window>`u`)return;Q&&Q();let n=e.maxEventsPerChunk??200,r=e.flushIntervalMs??1e4,i=e.maxPayloadBytes??1048576,a=[],o=0,s=null;function c(e){if(a.length===0)return;let n=JSON.stringify(a);if(new TextEncoder().encode(n).length>i){if(a.length>1){let t=Math.floor(a.length/2),n=a.slice(0,t),r=a.slice(t),i=e&&n.some(e=>e.type===2);a=n,c(i),a=r,c(!1);return}a=[];return}let r=a[0].timestamp,s=a[a.length-1].timestamp;try{t({chunk_index:o,events_count:a.length,is_full_snapshot:e,started_at:new Date(r).toISOString(),ended_at:new Date(s).toISOString(),payload:n}),o+=1,a=[]}catch(e){throw console.error(`[ReplayRecorder] sendChunk failed`,e),e}}function l(e){let t=e||a.some(e=>e.type===2);a.length>=n?c(t):e&&a.length>0&&c(!0)}let u=e.maskAllText!==!1,d=e.unmaskTextSelector,f=Ct({emit(e,t){a.push(e),l(!!t)},checkoutEveryNms:r,maskAllInputs:e.maskAllInputs??!0,maskTextSelector:u?`*`:`[data-openpanel-replay-mask]`,maskTextFn:u&&d?(e,t)=>t?.closest(d)?e:e.replace(/\S/g,`*`):void 0,blockSelector:e.blockSelector??`[data-openpanel-replay-block]`,blockClass:e.blockClass,ignoreSelector:e.ignoreSelector});s=setInterval(()=>{a.length>0&&c(a.some(e=>e.type===2))},r);function p(){document.visibilityState===`hidden`&&a.length>0&&c(a.some(e=>e.type===2))}function m(){a.length>0&&c(a.some(e=>e.type===2))}document.addEventListener(`visibilitychange`,p),window.addEventListener(`pagehide`,m),Q=()=>{a.length>0&&c(a.some(e=>e.type===2)),s&&=(clearInterval(s),null),document.removeEventListener(`visibilitychange`,p),window.removeEventListener(`pagehide`,m),f?.(),Q=null}}function Dt(){Q&&Q()}var Q,Ot=n((()=>{wt(),Q=null})),kt=typeof document<`u`?document.currentScript:null;function At(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var jt=class extends St{constructor(e){if(super({sdk:`web`,sdkVersion:`1.4.1`,...e}),this.options=e,this.lastPath=``,this.pendingRevenues=[],!this.isServer()){try{let e=sessionStorage.getItem(`openpanel-pending-revenues`);if(e){let t=JSON.parse(e);Array.isArray(t)&&(this.pendingRevenues=t)}}catch{this.pendingRevenues=[]}if(this.setGlobalProperties({__referrer:document.referrer}),this.options.trackScreenViews&&(this.trackScreenViews(),setTimeout(()=>this.screenView(),0)),this.options.trackOutgoingLinks&&this.trackOutgoingLinks(),this.options.trackAttributes&&this.trackAttributes(),this.options.sessionReplay?.enabled){let e=this.options.sessionReplay.sampleRate??1;Math.random()<e&&this.loadReplayModule().then(e=>{e&&e.startReplayRecorder(this.options.sessionReplay,e=>{this.send({type:`replay`,payload:{...e}})})})}}}async loadReplayModule(){try{if(typeof __OPENPANEL_REPLAY_URL__<`u`){let e=kt,t=this.options.sessionReplay?.scriptUrl||e?.src?.replace(`.js`,`-replay.js`)||`https://openpanel.dev/op1-replay.js`;return window.__openpanel_replay?window.__openpanel_replay:new Promise(e=>{let n=document.createElement(`script`);n.src=t,n.onload=()=>{e(window.__openpanel_replay??null)},n.onerror=()=>{console.warn(`[OpenPanel] Failed to load replay script from`,t),e(null)},document.head.appendChild(n)})}return await Promise.resolve().then(()=>(Ot(),Tt))}catch(e){return console.warn(`[OpenPanel] Failed to load replay module`,e),null}}debounce(e,t){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(e,t)}isServer(){return typeof document>`u`}trackOutgoingLinks(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`a`);if(n&&t){let e=n.getAttribute(`href`);if(e?.startsWith(`http`))try{let r=new URL(e),i=window.location.hostname;r.hostname!==i&&super.track(`link_out`,{href:e,text:n.innerText||n.getAttribute(`title`)||t.getAttribute(`alt`)||t.getAttribute(`title`)})}catch{}}})}trackScreenViews(){if(this.isServer())return;let e=history.pushState;history.pushState=function(...t){let n=e.apply(this,t);return window.dispatchEvent(new Event(`pushstate`)),window.dispatchEvent(new Event(`locationchange`)),n};let t=history.replaceState;history.replaceState=function(...e){let n=t.apply(this,e);return window.dispatchEvent(new Event(`replacestate`)),window.dispatchEvent(new Event(`locationchange`)),n},window.addEventListener(`popstate`,()=>{window.dispatchEvent(new Event(`locationchange`))});let n=()=>this.debounce(()=>this.screenView(),50);this.options.trackHashChanges?window.addEventListener(`hashchange`,n):window.addEventListener(`locationchange`,n)}trackAttributes(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`button`),r=t.closest(`a`),i=n?.getAttribute(`data-track`)?n:r?.getAttribute(`data-track`)?r:null;if(i){let e={};for(let t of i.attributes)t.name.startsWith(`data-`)&&t.name!==`data-track`&&(e[At(t.name.replace(/^data-/,``))]=t.value);let t=i.getAttribute(`data-track`);t&&super.track(t,e)}})}track(e,t){return super.track(e,{...t,__path:this.lastPath})}screenView(e,t){if(this.isServer())return;let n,r;typeof e==`string`?(n=e,r=t):(n=window.location.href,r=e),this.lastPath!==n&&(this.lastPath=n,super.track(`screen_view`,{...r??{},__path:n,__title:document.title}))}async flushRevenue(){let e=this.pendingRevenues.map(e=>super.revenue(e.amount,e.properties));await Promise.all(e),this.clearRevenue()}clearRevenue(){if(this.pendingRevenues=[],!this.isServer())try{sessionStorage.removeItem(`openpanel-pending-revenues`)}catch{}}pendingRevenue(e,t){if(this.pendingRevenues.push({amount:e,properties:t}),!this.isServer())try{sessionStorage.setItem(`openpanel-pending-revenues`,JSON.stringify(this.pendingRevenues))}catch{}}};function Mt(e,t){if(typeof window>`u`)return;let n=new URL(window.location.href),r=n.searchParams.get(`sso`);r&&(t.then(()=>{e.sendLifecycle({clientLifecycle:`sso-redirect-complete`,data:{compressed:r}}),console.log(`[SSO URL Listener] Forwarded compressed SSO data to iframe`)}).catch(e=>{console.error(`[SSO URL Listener] Failed to forward SSO data:`,e)}),n.searchParams.delete(`sso`),window.history.replaceState({},``,n.toString()),console.log(`[SSO URL Listener] SSO parameter detected and URL cleaned`))}let Nt=K&&Je;function Pt(e){e?localStorage.setItem(U,e):localStorage.removeItem(U)}function $(e,t){try{let n=new URL(e);if(!n.searchParams.has(`u`))return e;let r=Lt(window.location.href,t);return n.searchParams.delete(`u`),n.searchParams.append(`u`,r),n.toString()}catch{return e}}function Ft(e){let t=new URL(window.location.href);e&&t.searchParams.set(`fmt`,e);let n=t.protocol===`http:`?`x-safari-http`:`x-safari-https`;window.location.href=`${n}://${t.host}${t.pathname}${t.search}${t.hash}`}function It(e){return e.includes(`/common/social`)}function Lt(e,t){if(!t)return e;try{let n=new URL(e);return n.searchParams.set(`fmt`,t),n.toString()}catch{return`${e}${e.includes(`?`)?`&`:`?`}fmt=${encodeURIComponent(t)}`}}function Rt(e,t,n,r,i){if(i){let e=$(t,r);window.open(e,`_blank`);return}if(G(t)){let i=$(t,r);We(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(Nt&&It(t))Ft(r);else{let e=$(t,r);window.location.href=e}}function zt({iframe:e,targetOrigin:t}){let n=new D;return{handleEvent:r=>{if(!(`iframeLifecycle`in r))return;let{iframeLifecycle:i,data:a}=r;switch(i){case`connected`:n.resolve(!0);break;case`do-backup`:Pt(a.backup);break;case`remove-backup`:localStorage.removeItem(U);break;case`show`:case`hide`:it({iframe:e,isVisible:i===`show`});break;case`redirect`:Rt(e,a.baseRedirectUrl,t,a.mergeToken,a.openInNewTab);break}},isConnected:n.promise}}function Bt({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=e.metadata.lang??tt(),i=e.domain??(typeof window<`u`?window.location.hostname:``);T.setCacheScope(i,r),T.reset();let a=T.isCacheFresh?void 0:T.resolve(e.domain,e.walletUrl,r),o=zt({iframe:t,targetOrigin:n}),s=new D,c=Date.now();if(!t.contentWindow)throw new E(he.configError,`The iframe does not have a content window`);let l=ge({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await o.isConnected)throw new E(he.clientNotConnected,`The iframe provider isn't connected yet`);return await s.promise,t}}],lifecycleHandlers:{iframeLifecycle:(e,t)=>{o.handleEvent(e)}}}),u=Vt(l,o),d=async()=>{u(),l.cleanup(),t.remove(),_(),T.clearCache(),T.reset()},f;{console.log(`[Frak SDK] Initializing OpenPanel`),f=new jt({apiUrl:`https://op-api.gcp.frak.id`,clientId:`6eacc8d7-49ac-4936-95e9-81ef29449570`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>(e!==`track`||!t?.properties||`sdk_version`in t.properties||(t.properties={...t.properties,sdk_version:`1.2.0`,user_anonymous_client_id:p()}),!0)}),f.setGlobalProperties({sdk_version:`1.2.0`,user_anonymous_client_id:p()}),f.init(),f.track(`sdk_initialized`,{sdk_version:`1.2.0`});let e=!1,t=setTimeout(()=>{e||(e=!0,f?.track(`sdk_iframe_handshake_failed`,{reason:`timeout`}))},3e4);o.isConnected.then(()=>{e||(e=!0,clearTimeout(t),f?.track(`sdk_iframe_connected`,{handshake_duration_ms:Date.now()-c}))}).catch(()=>{e||(e=!0,clearTimeout(t),f?.track(`sdk_iframe_handshake_failed`,{reason:`unknown`}))})}let m=Ht({config:e,rpcClient:l,lifecycleManager:o,configPromise:a,contextSent:s,openPanel:f}).then(()=>{}).catch(e=>{throw s.reject(e),e});return{config:e,waitForConnection:o.isConnected,waitForSetup:m,request:l.request,listenerRequest:l.listen,destroy:d,openPanel:f}}function Vt(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,250),r=setTimeout(()=>{o(),console.log(`Heartbeat timeout: connection failed`)},3e4),await t.isConnected,o()}function o(){n&&clearInterval(n),r&&clearTimeout(r)}return a(),o}async function Ht({config:e,rpcClient:t,lifecycleManager:n,configPromise:r,contextSent:i,openPanel:a}){await n.isConnected,Mt(t,n.isConnected);let o=new URL(window.location.href),s=o.searchParams.get(`fmt`)??void 0;s&&(o.searchParams.delete(`fmt`),window.history.replaceState({},``,o.toString()));let c=t=>{let n=t?.merchantId??e.metadata.merchantId??``,r=t?.domain??``,i=t?.allowedDomains??[],a=t?.sdkConfig,o=a?.attribution||e.attribution?{...e.attribution,...a?.attribution}:void 0;T.setConfig(a?{isResolved:!0,merchantId:n,domain:r,allowedDomains:i,hasRawSdkConfig:!0,name:a.name??e.metadata.name,logoUrl:a.logoUrl??e.metadata.logoUrl,homepageLink:a.homepageLink??e.metadata.homepageLink,lang:a.lang??e.metadata.lang,currency:a.currency??e.metadata.currency,hidden:a.hidden,css:a.css,translations:a.translations,placements:a.placements,components:a.components,attribution:o}:{isResolved:!0,merchantId:n,domain:r,allowedDomains:i,name:e.metadata.name,logoUrl:e.metadata.logoUrl,homepageLink:e.metadata.homepageLink,lang:e.metadata.lang,currency:e.metadata.currency,attribution:o})},l=!1,u=e=>{let n=l?void 0:s;l=!0;let r=e.hasRawSdkConfig?{name:e.name,logoUrl:e.logoUrl,homepageLink:e.homepageLink,lang:e.lang,currency:e.currency,hidden:e.hidden,css:e.css,translations:e.translations,placements:e.placements,attribution:e.attribution}:e.attribution?{attribution:e.attribution}:void 0,i=p();if(a){let t=a.global??{};a.setGlobalProperties({...t,merchant_id:e.merchantId,domain:e.domain??``})}t.sendLifecycle({clientLifecycle:`resolved-config`,data:{merchantId:e.merchantId,domain:e.domain??``,allowedDomains:e.allowedDomains??[],sourceUrl:window.location.href,...i&&{sdkAnonymousId:i},...n&&{pendingMergeToken:n},...r&&{sdkConfig:r}}})};T.isResolved&&(u(T.getConfig()),i.resolve()),r&&(c(await r),u(T.getConfig()),i.resolve());async function d(){let n=e.customizations?.css;n&&t.sendLifecycle({clientLifecycle:`modal-css`,data:{cssLink:n}})}async function f(){let n=e.customizations?.i18n;n&&t.sendLifecycle({clientLifecycle:`modal-i18n`,data:{i18n:n}})}async function m(){if(typeof window>`u`)return;let e=window.localStorage.getItem(U);e&&t.sendLifecycle({clientLifecycle:`restore-backup`,data:{backup:e}})}(await Promise.allSettled([d(),f(),m()])).some(e=>e.status===`rejected`)&&a?.track(`sdk_iframe_handshake_failed`,{reason:`asset_push`})}async function Ut({config:e}){let t=Wt(e),n=await nt({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=Bt({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function Wt(e){let t=J(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}return e.DEEP_LINK_SCHEME=W,e.FrakContextManager=V,e.REFERRAL_SUCCESS_EVENT=ft,e.areAddressesEqual=P,e.base64urlDecode=k,e.base64urlEncode=O,e.baseIframeProps=Y,e.clearAllCache=_,e.compressJsonToB64=ye,e.createIFrameFrakClient=Bt,e.decompressJsonFromB64=Xe,e.deleteQueryParamCaseInsensitive=z,e.detectPageLanguage=tt,e.displayEmbeddedWallet=i,e.displayModal=a,e.displaySharingPage=o,e.ensureIdentity=de,e.findIframeInOpener=at,e.formatAmount=Qe,e.generateSsoUrl=A,e.getBackendUrl=u,e.getClientId=p,e.getCurrencyAmountKey=$e,e.getMerchantInformation=fe,e.getMergeToken=pe,e.getQueryParamCaseInsensitive=Te,e.getSupportedCurrency=J,e.getUserReferralStatus=me,e.isIOS=K,e.isInAppBrowser=Je,e.isMobile=Ke,e.mergeAttribution=Be,e.modalBuilder=_t,e.openSso=xe,e.prepareSso=Se,e.processReferral=ut,e.redirectToExternalBrowser=Ye,e.referralInteraction=dt,e.sdkConfigStore=T,e.sendInteraction=X,e.sendTransaction=vt,e.setupClient=Ut,e.setupReferral=pt,e.siweAuthenticate=bt,e.ssoPopupFeatures=j,e.ssoPopupName=M,e.trackEvent=H,e.trackPurchaseStatus=mt,e.triggerDeepLinkWithFallback=We,e.watchWalletStatus=ht,e.withCache=g,e})({});
|
package/dist/bundle.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./frakContext-BGx4IVAK.cjs"),t=require("./src-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./frakContext-BGx4IVAK.cjs"),t=require("./src-Cd4rAMD9.cjs"),n=require("./getCurrencyAmountKey-oIVOsRrF.cjs"),r=require("./actions-DwDtd2rq.cjs");exports.DEEP_LINK_SCHEME=t.p,exports.FrakContextManager=e.t,exports.REFERRAL_SUCCESS_EVENT=r.o,exports.areAddressesEqual=e.i,exports.base64urlDecode=e.p,exports.base64urlEncode=e.m,exports.baseIframeProps=t.a,exports.clearAllCache=e._,exports.compressJsonToB64=e.f,exports.createIFrameFrakClient=t.i,exports.decompressJsonFromB64=t.r,exports.deleteQueryParamCaseInsensitive=e.a,exports.detectPageLanguage=t.f,exports.displayEmbeddedWallet=r.v,exports.displayModal=r._,exports.displaySharingPage=r.g,exports.ensureIdentity=r.h,exports.findIframeInOpener=t.o,exports.formatAmount=n.n,exports.generateSsoUrl=e.d,exports.getBackendUrl=e.g,exports.getClientId=e.y,exports.getCurrencyAmountKey=n.t,exports.getMerchantInformation=r.m,exports.getMergeToken=r.p,exports.getQueryParamCaseInsensitive=e.o,exports.getSupportedCurrency=n.r,exports.getUserReferralStatus=r.f,exports.isIOS=t.s,exports.isInAppBrowser=t.c,exports.isMobile=t.l,exports.mergeAttribution=t.t,exports.modalBuilder=r.r,exports.openSso=e.c,exports.prepareSso=r.d,exports.processReferral=r.l,exports.redirectToExternalBrowser=t.u,exports.referralInteraction=r.c,exports.sdkConfigStore=e.h,exports.sendInteraction=r.u,exports.sendTransaction=r.n,exports.setupClient=t.n,exports.setupReferral=r.s,exports.siweAuthenticate=r.t,exports.ssoPopupFeatures=e.l,exports.ssoPopupName=e.u,exports.trackEvent=e.s,exports.trackPurchaseStatus=r.a,exports.triggerDeepLinkWithFallback=t.d,exports.watchWalletStatus=r.i,exports.withCache=e.v;
|
package/dist/bundle.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as UtmParams, _ as LocalizedI18nConfig, a as MerchantReward, b as TrackArrivalParams, c as RuleConditions, d as InteractionTypeKey, f as Currency, g as ListenerPreloadOption, h as Language, i as GetMerchantInformationReturnType, l as RuleField, m as I18nConfig, n as ConditionOperator, o as RewardTier, p as FrakWalletSdkConfig, r as EstimatedReward, s as RuleCondition, t as ConditionGroup, u as TokenAmountType, v as AttributionDefaults, x as TrackArrivalResult, y as AttributionParams } from "./merchantInformation-BFdhF3De.cjs";
|
|
2
2
|
import { A as SendTransactionTxType, B as FinalActionType, C as DisplayModalParamsType, D as ModalStepTypes, E as ModalRpcStepsResultType, F as OpenSsoParamsType, G as MerchantConfigResponse, H as ModalStepMetadata, I as OpenSsoReturnType, J as SdkResolvedConfig, K as ResolvedPlacement, L as PrepareSsoParamsType, M as SiweAuthenticateReturnType, N as SiweAuthenticationParams, O as SendTransactionModalStepType, P as LoginModalStepType, R as PrepareSsoReturnType, S as SharingPageProduct, T as ModalRpcStepsInput, U as IFrameLifecycleEvent, V as FinalModalStepType, W as ClientLifecycleEvent, _ as EmbeddedViewActionReferred, a as FrakContextV1, b as DisplaySharingPageParamsType, c as FrakLifecycleEvent, d as WalletStatusReturnType, f as UserReferralStatusType, g as LoggedOutEmbeddedView, h as DisplayEmbeddedWalletResultType, i as FrakContext, j as SiweAuthenticateModalStepType, k as SendTransactionReturnType, l as IFrameTransport, m as DisplayEmbeddedWalletParamsType, n as ssoPopupFeatures, o as FrakContextV2, p as SendInteractionParamsType, q as ResolvedSdkConfig, r as ssoPopupName, s as FrakClient, t as openSso, u as IFrameRpcSchema, v as EmbeddedViewActionSharing, w as ModalRpcMetadata, x as DisplaySharingPageResultType, y as LoggedInEmbeddedView, z as SsoMetadata } from "./openSso-NCXikBK6.cjs";
|
|
3
|
-
import { A as
|
|
3
|
+
import { A as FrakContextManager, B as KeyProvider, C as DeepLinkFallbackOptions, D as SdkHandshakeFailureReason, E as SdkEventMap, F as getBackendUrl, I as setupClient, L as createIFrameFrakClient, M as DEEP_LINK_SCHEME, N as sdkConfigStore, O as MergeAttributionInput, P as getClientId, R as CompressedData, S as redirectToExternalBrowser, T as trackEvent, _ as clearAllCache, a as FullSsoParams, b as isInAppBrowser, c as findIframeInOpener, d as getCurrencyAmountKey, f as formatAmount, g as base64urlEncode, h as base64urlDecode, i as CompressedSsoData, j as areAddressesEqual, k as mergeAttribution, l as detectPageLanguage, m as compressJsonToB64, n as getQueryParamCaseInsensitive, o as generateSsoUrl, p as decompressJsonFromB64, r as AppSpecificSsoMetadata, s as baseIframeProps, t as deleteQueryParamCaseInsensitive, u as getSupportedCurrency, v as withCache, w as triggerDeepLinkWithFallback, x as isMobile, y as isIOS, z as HashProtectedData } from "./index-PwHVGTLY.cjs";
|
|
4
4
|
import { C as displayEmbeddedWallet, S as displayModal, _ as getUserReferralStatus, a as ModalBuilder, b as ensureIdentity, c as watchWalletStatus, d as REFERRAL_SUCCESS_EVENT, f as setupReferral, g as prepareSso, h as processReferral, i as sendTransaction, l as trackPurchaseStatus, m as ProcessReferralOptions, n as siweAuthenticate, o as ModalStepBuilder, p as referralInteraction, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction, v as getMergeToken, x as displaySharingPage, y as getMerchantInformation } from "./index-DlDKFfSX.cjs";
|
|
5
|
-
export { type AppSpecificSsoMetadata, type AttributionDefaults, type AttributionParams, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type ConditionGroup, type ConditionOperator, type Currency, DEEP_LINK_SCHEME, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type DisplaySharingPageParamsType, type DisplaySharingPageResultType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakContextV1, type FrakContextV2, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type ListenerPreloadOption, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type MerchantConfigResponse, type MerchantReward, type MergeAttributionInput, type ModalBuilder, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepBuilder, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type ProcessReferralOptions, REFERRAL_SUCCESS_EVENT, type ResolvedPlacement, type ResolvedSdkConfig, type RewardTier, type RuleCondition, type RuleConditions, type RuleField, type SdkEventMap, type SdkHandshakeFailureReason, type SdkResolvedConfig, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionParams, type SendTransactionReturnType, type SendTransactionTxType, type SharingPageProduct, type SiweAuthenticateModalParams, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalParams, type TrackArrivalResult, type UserReferralStatusType, type UtmParams, type WalletStatusReturnType, areAddressesEqual, base64urlDecode, base64urlEncode, baseIframeProps, clearAllCache, compressJsonToB64, createIFrameFrakClient, decompressJsonFromB64, deleteQueryParamCaseInsensitive, displayEmbeddedWallet, displayModal, displaySharingPage, ensureIdentity, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getMerchantInformation, getMergeToken, getQueryParamCaseInsensitive, getSupportedCurrency, getUserReferralStatus, isIOS, isInAppBrowser, isMobile, mergeAttribution, modalBuilder, openSso, prepareSso, processReferral, redirectToExternalBrowser, referralInteraction, sdkConfigStore, sendInteraction, sendTransaction, setupClient, setupReferral, siweAuthenticate, ssoPopupFeatures, ssoPopupName, trackEvent, trackPurchaseStatus, triggerDeepLinkWithFallback, watchWalletStatus, withCache };
|
|
5
|
+
export { type AppSpecificSsoMetadata, type AttributionDefaults, type AttributionParams, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type ConditionGroup, type ConditionOperator, type Currency, DEEP_LINK_SCHEME, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type DisplaySharingPageParamsType, type DisplaySharingPageResultType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakContextV1, type FrakContextV2, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type ListenerPreloadOption, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type MerchantConfigResponse, type MerchantReward, type MergeAttributionInput, type ModalBuilder, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepBuilder, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type ProcessReferralOptions, REFERRAL_SUCCESS_EVENT, type ResolvedPlacement, type ResolvedSdkConfig, type RewardTier, type RuleCondition, type RuleConditions, type RuleField, type SdkEventMap, type SdkHandshakeFailureReason, type SdkResolvedConfig, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionParams, type SendTransactionReturnType, type SendTransactionTxType, type SharingPageProduct, type SiweAuthenticateModalParams, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalParams, type TrackArrivalResult, type UserReferralStatusType, type UtmParams, type WalletStatusReturnType, areAddressesEqual, base64urlDecode, base64urlEncode, baseIframeProps, clearAllCache, compressJsonToB64, createIFrameFrakClient, decompressJsonFromB64, deleteQueryParamCaseInsensitive, detectPageLanguage, displayEmbeddedWallet, displayModal, displaySharingPage, ensureIdentity, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getMerchantInformation, getMergeToken, getQueryParamCaseInsensitive, getSupportedCurrency, getUserReferralStatus, isIOS, isInAppBrowser, isMobile, mergeAttribution, modalBuilder, openSso, prepareSso, processReferral, redirectToExternalBrowser, referralInteraction, sdkConfigStore, sendInteraction, sendTransaction, setupClient, setupReferral, siweAuthenticate, ssoPopupFeatures, ssoPopupName, trackEvent, trackPurchaseStatus, triggerDeepLinkWithFallback, watchWalletStatus, withCache };
|
package/dist/bundle.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as UtmParams, _ as LocalizedI18nConfig, a as MerchantReward, b as TrackArrivalParams, c as RuleConditions, d as InteractionTypeKey, f as Currency, g as ListenerPreloadOption, h as Language, i as GetMerchantInformationReturnType, l as RuleField, m as I18nConfig, n as ConditionOperator, o as RewardTier, p as FrakWalletSdkConfig, r as EstimatedReward, s as RuleCondition, t as ConditionGroup, u as TokenAmountType, v as AttributionDefaults, x as TrackArrivalResult, y as AttributionParams } from "./merchantInformation-BFdhF3De.js";
|
|
2
2
|
import { A as SendTransactionTxType, B as FinalActionType, C as DisplayModalParamsType, D as ModalStepTypes, E as ModalRpcStepsResultType, F as OpenSsoParamsType, G as MerchantConfigResponse, H as ModalStepMetadata, I as OpenSsoReturnType, J as SdkResolvedConfig, K as ResolvedPlacement, L as PrepareSsoParamsType, M as SiweAuthenticateReturnType, N as SiweAuthenticationParams, O as SendTransactionModalStepType, P as LoginModalStepType, R as PrepareSsoReturnType, S as SharingPageProduct, T as ModalRpcStepsInput, U as IFrameLifecycleEvent, V as FinalModalStepType, W as ClientLifecycleEvent, _ as EmbeddedViewActionReferred, a as FrakContextV1, b as DisplaySharingPageParamsType, c as FrakLifecycleEvent, d as WalletStatusReturnType, f as UserReferralStatusType, g as LoggedOutEmbeddedView, h as DisplayEmbeddedWalletResultType, i as FrakContext, j as SiweAuthenticateModalStepType, k as SendTransactionReturnType, l as IFrameTransport, m as DisplayEmbeddedWalletParamsType, n as ssoPopupFeatures, o as FrakContextV2, p as SendInteractionParamsType, q as ResolvedSdkConfig, r as ssoPopupName, s as FrakClient, t as openSso, u as IFrameRpcSchema, v as EmbeddedViewActionSharing, w as ModalRpcMetadata, x as DisplaySharingPageResultType, y as LoggedInEmbeddedView, z as SsoMetadata } from "./openSso-DYe9Eyet.js";
|
|
3
|
-
import { A as
|
|
3
|
+
import { A as FrakContextManager, B as KeyProvider, C as DeepLinkFallbackOptions, D as SdkHandshakeFailureReason, E as SdkEventMap, F as getBackendUrl, I as setupClient, L as createIFrameFrakClient, M as DEEP_LINK_SCHEME, N as sdkConfigStore, O as MergeAttributionInput, P as getClientId, R as CompressedData, S as redirectToExternalBrowser, T as trackEvent, _ as clearAllCache, a as FullSsoParams, b as isInAppBrowser, c as findIframeInOpener, d as getCurrencyAmountKey, f as formatAmount, g as base64urlEncode, h as base64urlDecode, i as CompressedSsoData, j as areAddressesEqual, k as mergeAttribution, l as detectPageLanguage, m as compressJsonToB64, n as getQueryParamCaseInsensitive, o as generateSsoUrl, p as decompressJsonFromB64, r as AppSpecificSsoMetadata, s as baseIframeProps, t as deleteQueryParamCaseInsensitive, u as getSupportedCurrency, v as withCache, w as triggerDeepLinkWithFallback, x as isMobile, y as isIOS, z as HashProtectedData } from "./index-SlEhbU9Q.js";
|
|
4
4
|
import { C as displayEmbeddedWallet, S as displayModal, _ as getUserReferralStatus, a as ModalBuilder, b as ensureIdentity, c as watchWalletStatus, d as REFERRAL_SUCCESS_EVENT, f as setupReferral, g as prepareSso, h as processReferral, i as sendTransaction, l as trackPurchaseStatus, m as ProcessReferralOptions, n as siweAuthenticate, o as ModalStepBuilder, p as referralInteraction, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction, v as getMergeToken, x as displaySharingPage, y as getMerchantInformation } from "./index-DjAbFZuV.js";
|
|
5
|
-
export { type AppSpecificSsoMetadata, type AttributionDefaults, type AttributionParams, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type ConditionGroup, type ConditionOperator, type Currency, DEEP_LINK_SCHEME, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type DisplaySharingPageParamsType, type DisplaySharingPageResultType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakContextV1, type FrakContextV2, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type ListenerPreloadOption, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type MerchantConfigResponse, type MerchantReward, type MergeAttributionInput, type ModalBuilder, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepBuilder, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type ProcessReferralOptions, REFERRAL_SUCCESS_EVENT, type ResolvedPlacement, type ResolvedSdkConfig, type RewardTier, type RuleCondition, type RuleConditions, type RuleField, type SdkEventMap, type SdkHandshakeFailureReason, type SdkResolvedConfig, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionParams, type SendTransactionReturnType, type SendTransactionTxType, type SharingPageProduct, type SiweAuthenticateModalParams, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalParams, type TrackArrivalResult, type UserReferralStatusType, type UtmParams, type WalletStatusReturnType, areAddressesEqual, base64urlDecode, base64urlEncode, baseIframeProps, clearAllCache, compressJsonToB64, createIFrameFrakClient, decompressJsonFromB64, deleteQueryParamCaseInsensitive, displayEmbeddedWallet, displayModal, displaySharingPage, ensureIdentity, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getMerchantInformation, getMergeToken, getQueryParamCaseInsensitive, getSupportedCurrency, getUserReferralStatus, isIOS, isInAppBrowser, isMobile, mergeAttribution, modalBuilder, openSso, prepareSso, processReferral, redirectToExternalBrowser, referralInteraction, sdkConfigStore, sendInteraction, sendTransaction, setupClient, setupReferral, siweAuthenticate, ssoPopupFeatures, ssoPopupName, trackEvent, trackPurchaseStatus, triggerDeepLinkWithFallback, watchWalletStatus, withCache };
|
|
5
|
+
export { type AppSpecificSsoMetadata, type AttributionDefaults, type AttributionParams, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type ConditionGroup, type ConditionOperator, type Currency, DEEP_LINK_SCHEME, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type DisplaySharingPageParamsType, type DisplaySharingPageResultType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakContextV1, type FrakContextV2, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type ListenerPreloadOption, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type MerchantConfigResponse, type MerchantReward, type MergeAttributionInput, type ModalBuilder, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepBuilder, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type ProcessReferralOptions, REFERRAL_SUCCESS_EVENT, type ResolvedPlacement, type ResolvedSdkConfig, type RewardTier, type RuleCondition, type RuleConditions, type RuleField, type SdkEventMap, type SdkHandshakeFailureReason, type SdkResolvedConfig, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionParams, type SendTransactionReturnType, type SendTransactionTxType, type SharingPageProduct, type SiweAuthenticateModalParams, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalParams, type TrackArrivalResult, type UserReferralStatusType, type UtmParams, type WalletStatusReturnType, areAddressesEqual, base64urlDecode, base64urlEncode, baseIframeProps, clearAllCache, compressJsonToB64, createIFrameFrakClient, decompressJsonFromB64, deleteQueryParamCaseInsensitive, detectPageLanguage, displayEmbeddedWallet, displayModal, displaySharingPage, ensureIdentity, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getMerchantInformation, getMergeToken, getQueryParamCaseInsensitive, getSupportedCurrency, getUserReferralStatus, isIOS, isInAppBrowser, isMobile, mergeAttribution, modalBuilder, openSso, prepareSso, processReferral, redirectToExternalBrowser, referralInteraction, sdkConfigStore, sendInteraction, sendTransaction, setupClient, setupReferral, siweAuthenticate, ssoPopupFeatures, ssoPopupName, trackEvent, trackPurchaseStatus, triggerDeepLinkWithFallback, watchWalletStatus, withCache };
|
package/dist/bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,o as u,p as d,s as f,t as p,u as m,v as h,y as g}from"./frakContext-Db64Zo2o.js";import{a as _,c as v,d as y,f as b,i as x,l as S,n as C,o as w,
|
|
1
|
+
import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,o as u,p as d,s as f,t as p,u as m,v as h,y as g}from"./frakContext-Db64Zo2o.js";import{a as _,c as v,d as y,f as b,i as x,l as S,n as C,o as w,p as T,r as E,s as D,t as O,u as k}from"./src-KyZiC1sf.js";import{n as A,r as j,t as M}from"./getCurrencyAmountKey-C-1W-BRg.js";import{_ as N,a as P,c as F,d as I,f as L,g as R,h as z,i as B,l as V,m as H,n as U,o as W,p as G,r as K,s as q,t as J,u as Y,v as X}from"./actions-CMPlZ7CH.js";export{T as DEEP_LINK_SCHEME,p as FrakContextManager,W as REFERRAL_SUCCESS_EVENT,s as areAddressesEqual,d as base64urlDecode,l as base64urlEncode,_ as baseIframeProps,e as clearAllCache,i as compressJsonToB64,x as createIFrameFrakClient,E as decompressJsonFromB64,t as deleteQueryParamCaseInsensitive,b as detectPageLanguage,X as displayEmbeddedWallet,N as displayModal,R as displaySharingPage,z as ensureIdentity,w as findIframeInOpener,A as formatAmount,r as generateSsoUrl,a as getBackendUrl,g as getClientId,M as getCurrencyAmountKey,H as getMerchantInformation,G as getMergeToken,u as getQueryParamCaseInsensitive,j as getSupportedCurrency,L as getUserReferralStatus,D as isIOS,v as isInAppBrowser,S as isMobile,O as mergeAttribution,K as modalBuilder,n as openSso,I as prepareSso,V as processReferral,k as redirectToExternalBrowser,F as referralInteraction,o as sdkConfigStore,Y as sendInteraction,U as sendTransaction,C as setupClient,q as setupReferral,J as siweAuthenticate,c as ssoPopupFeatures,m as ssoPopupName,f as trackEvent,P as trackPurchaseStatus,y as triggerDeepLinkWithFallback,B as watchWalletStatus,h as withCache};
|
|
@@ -507,6 +507,20 @@ declare function getCurrencyAmountKey(currency?: Currency): keyof TokenAmountTyp
|
|
|
507
507
|
*/
|
|
508
508
|
declare function getSupportedCurrency(currency?: Currency): Currency;
|
|
509
509
|
//#endregion
|
|
510
|
+
//#region src/utils/i18n/detectPageLanguage.d.ts
|
|
511
|
+
/**
|
|
512
|
+
* Best-effort detection of the page's intended content language for SDK copy.
|
|
513
|
+
*
|
|
514
|
+
* Precedence: the document's declared `<html lang>` (the page author's explicit
|
|
515
|
+
* content language) → the browser UI language (`navigator.language`). Returns
|
|
516
|
+
* `undefined` when neither resolves to a supported language, letting callers
|
|
517
|
+
* apply their own fallback (e.g. `"en"`).
|
|
518
|
+
*
|
|
519
|
+
* The `<html lang>` check comes first so a page authored in French renders
|
|
520
|
+
* French SDK copy even when the visitor's browser is set to another language.
|
|
521
|
+
*/
|
|
522
|
+
declare function detectPageLanguage(): Language | undefined;
|
|
523
|
+
//#endregion
|
|
510
524
|
//#region src/utils/iframe/iframeHelper.d.ts
|
|
511
525
|
/**
|
|
512
526
|
* Base props for the iframe
|
|
@@ -636,5 +650,5 @@ declare function getQueryParamCaseInsensitive(searchParams: URLSearchParams, key
|
|
|
636
650
|
*/
|
|
637
651
|
declare function deleteQueryParamCaseInsensitive(searchParams: URLSearchParams, key: string): void;
|
|
638
652
|
//#endregion
|
|
639
|
-
export {
|
|
640
|
-
//# sourceMappingURL=index-
|
|
653
|
+
export { FrakContextManager as A, KeyProvider as B, DeepLinkFallbackOptions as C, SdkHandshakeFailureReason as D, SdkEventMap as E, getBackendUrl as F, setupClient as I, createIFrameFrakClient as L, DEEP_LINK_SCHEME as M, sdkConfigStore as N, MergeAttributionInput as O, getClientId as P, CompressedData as R, redirectToExternalBrowser as S, trackEvent as T, clearAllCache as _, FullSsoParams as a, isInAppBrowser as b, findIframeInOpener as c, getCurrencyAmountKey as d, formatAmount as f, base64urlEncode as g, base64urlDecode as h, CompressedSsoData as i, areAddressesEqual as j, mergeAttribution as k, detectPageLanguage as l, compressJsonToB64 as m, getQueryParamCaseInsensitive as n, generateSsoUrl as o, decompressJsonFromB64 as p, AppSpecificSsoMetadata as r, baseIframeProps as s, deleteQueryParamCaseInsensitive as t, getSupportedCurrency as u, withCache as v, triggerDeepLinkWithFallback as w, isMobile as x, isIOS as y, HashProtectedData as z };
|
|
654
|
+
//# sourceMappingURL=index-PwHVGTLY.d.cts.map
|
|
@@ -507,6 +507,20 @@ declare function getCurrencyAmountKey(currency?: Currency): keyof TokenAmountTyp
|
|
|
507
507
|
*/
|
|
508
508
|
declare function getSupportedCurrency(currency?: Currency): Currency;
|
|
509
509
|
//#endregion
|
|
510
|
+
//#region src/utils/i18n/detectPageLanguage.d.ts
|
|
511
|
+
/**
|
|
512
|
+
* Best-effort detection of the page's intended content language for SDK copy.
|
|
513
|
+
*
|
|
514
|
+
* Precedence: the document's declared `<html lang>` (the page author's explicit
|
|
515
|
+
* content language) → the browser UI language (`navigator.language`). Returns
|
|
516
|
+
* `undefined` when neither resolves to a supported language, letting callers
|
|
517
|
+
* apply their own fallback (e.g. `"en"`).
|
|
518
|
+
*
|
|
519
|
+
* The `<html lang>` check comes first so a page authored in French renders
|
|
520
|
+
* French SDK copy even when the visitor's browser is set to another language.
|
|
521
|
+
*/
|
|
522
|
+
declare function detectPageLanguage(): Language | undefined;
|
|
523
|
+
//#endregion
|
|
510
524
|
//#region src/utils/iframe/iframeHelper.d.ts
|
|
511
525
|
/**
|
|
512
526
|
* Base props for the iframe
|
|
@@ -636,5 +650,5 @@ declare function getQueryParamCaseInsensitive(searchParams: URLSearchParams, key
|
|
|
636
650
|
*/
|
|
637
651
|
declare function deleteQueryParamCaseInsensitive(searchParams: URLSearchParams, key: string): void;
|
|
638
652
|
//#endregion
|
|
639
|
-
export {
|
|
640
|
-
//# sourceMappingURL=index-
|
|
653
|
+
export { FrakContextManager as A, KeyProvider as B, DeepLinkFallbackOptions as C, SdkHandshakeFailureReason as D, SdkEventMap as E, getBackendUrl as F, setupClient as I, createIFrameFrakClient as L, DEEP_LINK_SCHEME as M, sdkConfigStore as N, MergeAttributionInput as O, getClientId as P, CompressedData as R, redirectToExternalBrowser as S, trackEvent as T, clearAllCache as _, FullSsoParams as a, isInAppBrowser as b, findIframeInOpener as c, getCurrencyAmountKey as d, formatAmount as f, base64urlEncode as g, base64urlDecode as h, CompressedSsoData as i, areAddressesEqual as j, mergeAttribution as k, detectPageLanguage as l, compressJsonToB64 as m, getQueryParamCaseInsensitive as n, generateSsoUrl as o, decompressJsonFromB64 as p, AppSpecificSsoMetadata as r, baseIframeProps as s, deleteQueryParamCaseInsensitive as t, getSupportedCurrency as u, withCache as v, triggerDeepLinkWithFallback as w, isMobile as x, isIOS as y, HashProtectedData as z };
|
|
654
|
+
//# sourceMappingURL=index-SlEhbU9Q.d.ts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./frakContext-BGx4IVAK.cjs"),t=require("./src-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./frakContext-BGx4IVAK.cjs"),t=require("./src-Cd4rAMD9.cjs"),n=require("./getCurrencyAmountKey-oIVOsRrF.cjs");exports.DEEP_LINK_SCHEME=t.p,exports.FrakContextManager=e.t,exports.areAddressesEqual=e.i,exports.base64urlDecode=e.p,exports.base64urlEncode=e.m,exports.baseIframeProps=t.a,exports.clearAllCache=e._,exports.compressJsonToB64=e.f,exports.createIFrameFrakClient=t.i,exports.decompressJsonFromB64=t.r,exports.deleteQueryParamCaseInsensitive=e.a,exports.detectPageLanguage=t.f,exports.findIframeInOpener=t.o,exports.formatAmount=n.n,exports.generateSsoUrl=e.d,exports.getBackendUrl=e.g,exports.getClientId=e.y,exports.getCurrencyAmountKey=n.t,exports.getQueryParamCaseInsensitive=e.o,exports.getSupportedCurrency=n.r,exports.isIOS=t.s,exports.isInAppBrowser=t.c,exports.isMobile=t.l,exports.mergeAttribution=t.t,exports.redirectToExternalBrowser=t.u,exports.sdkConfigStore=e.h,exports.setupClient=t.n,exports.ssoPopupFeatures=e.l,exports.ssoPopupName=e.u,exports.trackEvent=e.s,exports.triggerDeepLinkWithFallback=t.d,exports.withCache=e.v;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { S as UtmParams, _ as LocalizedI18nConfig, a as MerchantReward, b as TrackArrivalParams, c as RuleConditions, d as InteractionTypeKey, f as Currency, g as ListenerPreloadOption, h as Language, i as GetMerchantInformationReturnType, l as RuleField, m as I18nConfig, n as ConditionOperator, o as RewardTier, p as FrakWalletSdkConfig, r as EstimatedReward, s as RuleCondition, t as ConditionGroup, u as TokenAmountType, v as AttributionDefaults, x as TrackArrivalResult, y as AttributionParams } from "./merchantInformation-BFdhF3De.cjs";
|
|
2
2
|
import { A as SendTransactionTxType, B as FinalActionType, C as DisplayModalParamsType, D as ModalStepTypes, E as ModalRpcStepsResultType, F as OpenSsoParamsType, G as MerchantConfigResponse, H as ModalStepMetadata, I as OpenSsoReturnType, J as SdkResolvedConfig, K as ResolvedPlacement, L as PrepareSsoParamsType, M as SiweAuthenticateReturnType, N as SiweAuthenticationParams, O as SendTransactionModalStepType, P as LoginModalStepType, R as PrepareSsoReturnType, S as SharingPageProduct, T as ModalRpcStepsInput, U as IFrameLifecycleEvent, V as FinalModalStepType, W as ClientLifecycleEvent, _ as EmbeddedViewActionReferred, a as FrakContextV1, b as DisplaySharingPageParamsType, c as FrakLifecycleEvent, d as WalletStatusReturnType, f as UserReferralStatusType, g as LoggedOutEmbeddedView, h as DisplayEmbeddedWalletResultType, i as FrakContext, j as SiweAuthenticateModalStepType, k as SendTransactionReturnType, l as IFrameTransport, m as DisplayEmbeddedWalletParamsType, n as ssoPopupFeatures, o as FrakContextV2, p as SendInteractionParamsType, q as ResolvedSdkConfig, r as ssoPopupName, s as FrakClient, u as IFrameRpcSchema, v as EmbeddedViewActionSharing, w as ModalRpcMetadata, x as DisplaySharingPageResultType, y as LoggedInEmbeddedView, z as SsoMetadata } from "./openSso-NCXikBK6.cjs";
|
|
3
|
-
import { A as
|
|
4
|
-
export { type AppSpecificSsoMetadata, type AttributionDefaults, type AttributionParams, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type ConditionGroup, type ConditionOperator, type Currency, DEEP_LINK_SCHEME, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type DisplaySharingPageParamsType, type DisplaySharingPageResultType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakContextV1, type FrakContextV2, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type ListenerPreloadOption, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type MerchantConfigResponse, type MerchantReward, type MergeAttributionInput, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type ResolvedPlacement, type ResolvedSdkConfig, type RewardTier, type RuleCondition, type RuleConditions, type RuleField, type SdkEventMap, type SdkHandshakeFailureReason, type SdkResolvedConfig, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionReturnType, type SendTransactionTxType, type SharingPageProduct, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalParams, type TrackArrivalResult, type UserReferralStatusType, type UtmParams, type WalletStatusReturnType, areAddressesEqual, base64urlDecode, base64urlEncode, baseIframeProps, clearAllCache, compressJsonToB64, createIFrameFrakClient, decompressJsonFromB64, deleteQueryParamCaseInsensitive, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getQueryParamCaseInsensitive, getSupportedCurrency, isIOS, isInAppBrowser, isMobile, mergeAttribution, redirectToExternalBrowser, sdkConfigStore, setupClient, ssoPopupFeatures, ssoPopupName, trackEvent, triggerDeepLinkWithFallback, withCache };
|
|
3
|
+
import { A as FrakContextManager, B as KeyProvider, C as DeepLinkFallbackOptions, D as SdkHandshakeFailureReason, E as SdkEventMap, F as getBackendUrl, I as setupClient, L as createIFrameFrakClient, M as DEEP_LINK_SCHEME, N as sdkConfigStore, O as MergeAttributionInput, P as getClientId, R as CompressedData, S as redirectToExternalBrowser, T as trackEvent, _ as clearAllCache, a as FullSsoParams, b as isInAppBrowser, c as findIframeInOpener, d as getCurrencyAmountKey, f as formatAmount, g as base64urlEncode, h as base64urlDecode, i as CompressedSsoData, j as areAddressesEqual, k as mergeAttribution, l as detectPageLanguage, m as compressJsonToB64, n as getQueryParamCaseInsensitive, o as generateSsoUrl, p as decompressJsonFromB64, r as AppSpecificSsoMetadata, s as baseIframeProps, t as deleteQueryParamCaseInsensitive, u as getSupportedCurrency, v as withCache, w as triggerDeepLinkWithFallback, x as isMobile, y as isIOS, z as HashProtectedData } from "./index-PwHVGTLY.cjs";
|
|
4
|
+
export { type AppSpecificSsoMetadata, type AttributionDefaults, type AttributionParams, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type ConditionGroup, type ConditionOperator, type Currency, DEEP_LINK_SCHEME, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type DisplaySharingPageParamsType, type DisplaySharingPageResultType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakContextV1, type FrakContextV2, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type ListenerPreloadOption, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type MerchantConfigResponse, type MerchantReward, type MergeAttributionInput, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type ResolvedPlacement, type ResolvedSdkConfig, type RewardTier, type RuleCondition, type RuleConditions, type RuleField, type SdkEventMap, type SdkHandshakeFailureReason, type SdkResolvedConfig, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionReturnType, type SendTransactionTxType, type SharingPageProduct, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalParams, type TrackArrivalResult, type UserReferralStatusType, type UtmParams, type WalletStatusReturnType, areAddressesEqual, base64urlDecode, base64urlEncode, baseIframeProps, clearAllCache, compressJsonToB64, createIFrameFrakClient, decompressJsonFromB64, deleteQueryParamCaseInsensitive, detectPageLanguage, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getQueryParamCaseInsensitive, getSupportedCurrency, isIOS, isInAppBrowser, isMobile, mergeAttribution, redirectToExternalBrowser, sdkConfigStore, setupClient, ssoPopupFeatures, ssoPopupName, trackEvent, triggerDeepLinkWithFallback, withCache };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { S as UtmParams, _ as LocalizedI18nConfig, a as MerchantReward, b as TrackArrivalParams, c as RuleConditions, d as InteractionTypeKey, f as Currency, g as ListenerPreloadOption, h as Language, i as GetMerchantInformationReturnType, l as RuleField, m as I18nConfig, n as ConditionOperator, o as RewardTier, p as FrakWalletSdkConfig, r as EstimatedReward, s as RuleCondition, t as ConditionGroup, u as TokenAmountType, v as AttributionDefaults, x as TrackArrivalResult, y as AttributionParams } from "./merchantInformation-BFdhF3De.js";
|
|
2
2
|
import { A as SendTransactionTxType, B as FinalActionType, C as DisplayModalParamsType, D as ModalStepTypes, E as ModalRpcStepsResultType, F as OpenSsoParamsType, G as MerchantConfigResponse, H as ModalStepMetadata, I as OpenSsoReturnType, J as SdkResolvedConfig, K as ResolvedPlacement, L as PrepareSsoParamsType, M as SiweAuthenticateReturnType, N as SiweAuthenticationParams, O as SendTransactionModalStepType, P as LoginModalStepType, R as PrepareSsoReturnType, S as SharingPageProduct, T as ModalRpcStepsInput, U as IFrameLifecycleEvent, V as FinalModalStepType, W as ClientLifecycleEvent, _ as EmbeddedViewActionReferred, a as FrakContextV1, b as DisplaySharingPageParamsType, c as FrakLifecycleEvent, d as WalletStatusReturnType, f as UserReferralStatusType, g as LoggedOutEmbeddedView, h as DisplayEmbeddedWalletResultType, i as FrakContext, j as SiweAuthenticateModalStepType, k as SendTransactionReturnType, l as IFrameTransport, m as DisplayEmbeddedWalletParamsType, n as ssoPopupFeatures, o as FrakContextV2, p as SendInteractionParamsType, q as ResolvedSdkConfig, r as ssoPopupName, s as FrakClient, u as IFrameRpcSchema, v as EmbeddedViewActionSharing, w as ModalRpcMetadata, x as DisplaySharingPageResultType, y as LoggedInEmbeddedView, z as SsoMetadata } from "./openSso-DYe9Eyet.js";
|
|
3
|
-
import { A as
|
|
4
|
-
export { type AppSpecificSsoMetadata, type AttributionDefaults, type AttributionParams, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type ConditionGroup, type ConditionOperator, type Currency, DEEP_LINK_SCHEME, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type DisplaySharingPageParamsType, type DisplaySharingPageResultType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakContextV1, type FrakContextV2, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type ListenerPreloadOption, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type MerchantConfigResponse, type MerchantReward, type MergeAttributionInput, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type ResolvedPlacement, type ResolvedSdkConfig, type RewardTier, type RuleCondition, type RuleConditions, type RuleField, type SdkEventMap, type SdkHandshakeFailureReason, type SdkResolvedConfig, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionReturnType, type SendTransactionTxType, type SharingPageProduct, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalParams, type TrackArrivalResult, type UserReferralStatusType, type UtmParams, type WalletStatusReturnType, areAddressesEqual, base64urlDecode, base64urlEncode, baseIframeProps, clearAllCache, compressJsonToB64, createIFrameFrakClient, decompressJsonFromB64, deleteQueryParamCaseInsensitive, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getQueryParamCaseInsensitive, getSupportedCurrency, isIOS, isInAppBrowser, isMobile, mergeAttribution, redirectToExternalBrowser, sdkConfigStore, setupClient, ssoPopupFeatures, ssoPopupName, trackEvent, triggerDeepLinkWithFallback, withCache };
|
|
3
|
+
import { A as FrakContextManager, B as KeyProvider, C as DeepLinkFallbackOptions, D as SdkHandshakeFailureReason, E as SdkEventMap, F as getBackendUrl, I as setupClient, L as createIFrameFrakClient, M as DEEP_LINK_SCHEME, N as sdkConfigStore, O as MergeAttributionInput, P as getClientId, R as CompressedData, S as redirectToExternalBrowser, T as trackEvent, _ as clearAllCache, a as FullSsoParams, b as isInAppBrowser, c as findIframeInOpener, d as getCurrencyAmountKey, f as formatAmount, g as base64urlEncode, h as base64urlDecode, i as CompressedSsoData, j as areAddressesEqual, k as mergeAttribution, l as detectPageLanguage, m as compressJsonToB64, n as getQueryParamCaseInsensitive, o as generateSsoUrl, p as decompressJsonFromB64, r as AppSpecificSsoMetadata, s as baseIframeProps, t as deleteQueryParamCaseInsensitive, u as getSupportedCurrency, v as withCache, w as triggerDeepLinkWithFallback, x as isMobile, y as isIOS, z as HashProtectedData } from "./index-SlEhbU9Q.js";
|
|
4
|
+
export { type AppSpecificSsoMetadata, type AttributionDefaults, type AttributionParams, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type ConditionGroup, type ConditionOperator, type Currency, DEEP_LINK_SCHEME, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type DisplaySharingPageParamsType, type DisplaySharingPageResultType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakContextV1, type FrakContextV2, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type ListenerPreloadOption, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type MerchantConfigResponse, type MerchantReward, type MergeAttributionInput, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type ResolvedPlacement, type ResolvedSdkConfig, type RewardTier, type RuleCondition, type RuleConditions, type RuleField, type SdkEventMap, type SdkHandshakeFailureReason, type SdkResolvedConfig, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionReturnType, type SendTransactionTxType, type SharingPageProduct, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalParams, type TrackArrivalResult, type UserReferralStatusType, type UtmParams, type WalletStatusReturnType, areAddressesEqual, base64urlDecode, base64urlEncode, baseIframeProps, clearAllCache, compressJsonToB64, createIFrameFrakClient, decompressJsonFromB64, deleteQueryParamCaseInsensitive, detectPageLanguage, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getQueryParamCaseInsensitive, getSupportedCurrency, isIOS, isInAppBrowser, isMobile, mergeAttribution, redirectToExternalBrowser, sdkConfigStore, setupClient, ssoPopupFeatures, ssoPopupName, trackEvent, triggerDeepLinkWithFallback, withCache };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,o as l,p as u,s as d,t as f,u as p,v as m,y as h}from"./frakContext-Db64Zo2o.js";import{a as g,c as _,d as v,f as y,i as b,l as x,n as S,o as C,
|
|
1
|
+
import{_ as e,a as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,o as l,p as u,s as d,t as f,u as p,v as m,y as h}from"./frakContext-Db64Zo2o.js";import{a as g,c as _,d as v,f as y,i as b,l as x,n as S,o as C,p as w,r as T,s as E,t as D,u as O}from"./src-KyZiC1sf.js";import{n as k,r as A,t as j}from"./getCurrencyAmountKey-C-1W-BRg.js";export{w as DEEP_LINK_SCHEME,f as FrakContextManager,o as areAddressesEqual,u as base64urlDecode,c as base64urlEncode,g as baseIframeProps,e as clearAllCache,r as compressJsonToB64,b as createIFrameFrakClient,T as decompressJsonFromB64,t as deleteQueryParamCaseInsensitive,y as detectPageLanguage,C as findIframeInOpener,k as formatAmount,n as generateSsoUrl,i as getBackendUrl,h as getClientId,j as getCurrencyAmountKey,l as getQueryParamCaseInsensitive,A as getSupportedCurrency,E as isIOS,_ as isInAppBrowser,x as isMobile,D as mergeAttribution,O as redirectToExternalBrowser,a as sdkConfigStore,S as setupClient,s as ssoPopupFeatures,p as ssoPopupName,d as trackEvent,v as triggerDeepLinkWithFallback,m as withCache};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./frakContext-BGx4IVAK.cjs"),t=require("./getCurrencyAmountKey-oIVOsRrF.cjs");let n=require("@frak-labs/frame-connector"),r=require("@openpanel/web");const i=`nexus-wallet-backup`,a=`frakwallet://`;function o(e){let t=e?.split(`-`)[0]?.toLowerCase();return t===`en`||t===`fr`?t:void 0}function s(){return(typeof document<`u`?o(document.documentElement.lang):void 0)||(typeof navigator<`u`?o(navigator.language):void 0)}function c(e,t){if(typeof window>`u`)return;let n=new URL(window.location.href),r=n.searchParams.get(`sso`);r&&(t.then(()=>{e.sendLifecycle({clientLifecycle:`sso-redirect-complete`,data:{compressed:r}}),console.log(`[SSO URL Listener] Forwarded compressed SSO data to iframe`)}).catch(e=>{console.error(`[SSO URL Listener] Failed to forward SSO data:`,e)}),n.searchParams.delete(`sso`),window.history.replaceState({},``,n.toString()),console.log(`[SSO URL Listener] SSO parameter detected and URL cleaned`))}function l(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}const u=a.replace(`://`,``);function d(e){return`intent://${e.slice(13)}#Intent;scheme=${u};end`}function f(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=l()&&p(e)?d(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function p(e){return e.startsWith(a)}function m(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent;return!!(/iPhone|iPad|iPod/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1)}const h=m();function g(){return typeof navigator>`u`?!1:h?!0:/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function _(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase();return e.includes(`instagram`)||e.includes(`fban`)||e.includes(`fbav`)||e.includes(`facebook`)}const v=_();function y(e){h&&e.startsWith(`https://`)?window.location.href=`x-safari-https://${e.slice(8)}`:h&&e.startsWith(`http://`)?window.location.href=`x-safari-http://${e.slice(7)}`:window.location.href=`https://backend.frak.id/common/social?u=${encodeURIComponent(e)}`}const b={id:`frak-wallet`,name:`frak-wallet`,title:`Frak Wallet`,allow:`publickey-credentials-get *; clipboard-write; web-share *`,style:{width:`0`,height:`0`,border:`0`,position:`absolute`,zIndex:2000001,top:`-1000px`,left:`-1000px`,colorScheme:`auto`}};function x({walletBaseUrl:t,config:n}){let r=document.querySelector(`#frak-wallet`);r&&r.remove();let i=document.createElement(`iframe`);i.id=b.id,i.name=b.name,i.allow=b.allow,i.style.zIndex=b.style.zIndex.toString(),C({iframe:i,isVisible:!1});let a=n?.walletUrl??t??`https://wallet.frak.id`,o=e.y();return T(a),T(e.g(a)),i.src=S({walletUrl:a,clientId:o,preload:n?.preload}),new Promise(e=>{i.addEventListener(`load`,()=>e(i)),document.body.appendChild(i)})}function S({walletUrl:e,clientId:t,preload:n}){let r=`${e}/listener?clientId=${encodeURIComponent(t)}`;return!n||n.length===0?r:`${r}#preload=${n.join(`,`)}`}function C({iframe:e,isVisible:t}){if(!t){e.style.width=`0`,e.style.height=`0`,e.style.border=`0`,e.style.position=`fixed`,e.style.top=`-1000px`,e.style.left=`-1000px`;return}e.style.position=`fixed`,e.style.top=`0`,e.style.left=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`auto`}function w(e=`/listener`){if(!window.opener)return null;let t=t=>{try{return t.location.origin===window.location.origin&&t.location.pathname===e}catch{return!1}};if(t(window.opener))return window.opener;try{let e=window.opener.frames;for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}catch(t){return console.error(`[findIframeInOpener] Error finding iframe with pathname ${e}:`,t),null}}function T(e){if(!(typeof document>`u`))try{let t=new URL(e).origin,n=`link[rel="preconnect"][data-frak-preconnect="${t}"]`;if(document.head.querySelector(n))return;let r=document.createElement(`link`);r.rel=`preconnect`,r.href=t,r.crossOrigin=``,r.dataset.frakPreconnect=t,document.head.appendChild(r)}catch{}}const E=h&&v;function D(e){e?localStorage.setItem(i,e):localStorage.removeItem(i)}function O(e,t){try{let n=new URL(e);if(!n.searchParams.has(`u`))return e;let r=j(window.location.href,t);return n.searchParams.delete(`u`),n.searchParams.append(`u`,r),n.toString()}catch{return e}}function k(e){let t=new URL(window.location.href);e&&t.searchParams.set(`fmt`,e);let n=t.protocol===`http:`?`x-safari-http`:`x-safari-https`;window.location.href=`${n}://${t.host}${t.pathname}${t.search}${t.hash}`}function A(e){return e.includes(`/common/social`)}function j(e,t){if(!t)return e;try{let n=new URL(e);return n.searchParams.set(`fmt`,t),n.toString()}catch{return`${e}${e.includes(`?`)?`&`:`?`}fmt=${encodeURIComponent(t)}`}}function M(e,t,n,r,i){if(i){let e=O(t,r);window.open(e,`_blank`);return}if(p(t)){let i=O(t,r);f(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(E&&A(t))k(r);else{let e=O(t,r);window.location.href=e}}function N({iframe:e,targetOrigin:t}){let r=new n.Deferred;return{handleEvent:n=>{if(!(`iframeLifecycle`in n))return;let{iframeLifecycle:a,data:o}=n;switch(a){case`connected`:r.resolve(!0);break;case`do-backup`:D(o.backup);break;case`remove-backup`:localStorage.removeItem(i);break;case`show`:case`hide`:C({iframe:e,isVisible:a===`show`});break;case`redirect`:M(e,o.baseRedirectUrl,t,o.mergeToken,o.openInNewTab);break}},isConnected:r.promise}}function P({config:t,iframe:i}){let a=t?.walletUrl??`https://wallet.frak.id`,o=t.metadata.lang??s(),c=t.domain??(typeof window<`u`?window.location.hostname:``);e.h.setCacheScope(c,o),e.h.reset();let l=e.h.isCacheFresh?void 0:e.h.resolve(t.domain,t.walletUrl,o),u=N({iframe:i,targetOrigin:a}),d=new n.Deferred,f=Date.now();if(!i.contentWindow)throw new n.FrakRpcError(n.RpcErrorCodes.configError,`The iframe does not have a content window`);let p=(0,n.createRpcClient)({emittingTransport:i.contentWindow,listeningTransport:window,targetOrigin:a,middleware:[{async onRequest(e,t){if(!await u.isConnected)throw new n.FrakRpcError(n.RpcErrorCodes.clientNotConnected,`The iframe provider isn't connected yet`);return await d.promise,t}}],lifecycleHandlers:{iframeLifecycle:(e,t)=>{u.handleEvent(e)}}}),m=F(p,u),h=async()=>{m(),p.cleanup(),i.remove(),e._(),e.h.clearCache(),e.h.reset()},g;{console.log(`[Frak SDK] Initializing OpenPanel`),g=new r.OpenPanel({apiUrl:`https://op-api.gcp.frak.id`,clientId:`6eacc8d7-49ac-4936-95e9-81ef29449570`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:t,payload:n})=>(t!==`track`||!n?.properties||`sdk_version`in n.properties||(n.properties={...n.properties,sdk_version:`1.2.0`,user_anonymous_client_id:e.y()}),!0)}),g.setGlobalProperties({sdk_version:`1.2.0`,user_anonymous_client_id:e.y()}),g.init(),g.track(`sdk_initialized`,{sdk_version:`1.2.0`});let t=!1,n=setTimeout(()=>{t||(t=!0,g?.track(`sdk_iframe_handshake_failed`,{reason:`timeout`}))},3e4);u.isConnected.then(()=>{t||(t=!0,clearTimeout(n),g?.track(`sdk_iframe_connected`,{handshake_duration_ms:Date.now()-f}))}).catch(()=>{t||(t=!0,clearTimeout(n),g?.track(`sdk_iframe_handshake_failed`,{reason:`unknown`}))})}let _=I({config:t,rpcClient:p,lifecycleManager:u,configPromise:l,contextSent:d,openPanel:g}).then(()=>{}).catch(e=>{throw d.reject(e),e});return{config:t,waitForConnection:u.isConnected,waitForSetup:_,request:p.request,listenerRequest:p.listen,destroy:h,openPanel:g}}function F(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,250),r=setTimeout(()=>{o(),console.log(`Heartbeat timeout: connection failed`)},3e4),await t.isConnected,o()}function o(){n&&clearInterval(n),r&&clearTimeout(r)}return a(),o}async function I({config:t,rpcClient:n,lifecycleManager:r,configPromise:a,contextSent:o,openPanel:s}){await r.isConnected,c(n,r.isConnected);let l=new URL(window.location.href),u=l.searchParams.get(`fmt`)??void 0;u&&(l.searchParams.delete(`fmt`),window.history.replaceState({},``,l.toString()));let d=n=>{let r=n?.merchantId??t.metadata.merchantId??``,i=n?.domain??``,a=n?.allowedDomains??[],o=n?.sdkConfig,s=o?.attribution||t.attribution?{...t.attribution,...o?.attribution}:void 0;e.h.setConfig(o?{isResolved:!0,merchantId:r,domain:i,allowedDomains:a,hasRawSdkConfig:!0,name:o.name??t.metadata.name,logoUrl:o.logoUrl??t.metadata.logoUrl,homepageLink:o.homepageLink??t.metadata.homepageLink,lang:o.lang??t.metadata.lang,currency:o.currency??t.metadata.currency,hidden:o.hidden,css:o.css,translations:o.translations,placements:o.placements,components:o.components,attribution:s}:{isResolved:!0,merchantId:r,domain:i,allowedDomains:a,name:t.metadata.name,logoUrl:t.metadata.logoUrl,homepageLink:t.metadata.homepageLink,lang:t.metadata.lang,currency:t.metadata.currency,attribution:s})},f=!1,p=t=>{let r=f?void 0:u;f=!0;let i=t.hasRawSdkConfig?{name:t.name,logoUrl:t.logoUrl,homepageLink:t.homepageLink,lang:t.lang,currency:t.currency,hidden:t.hidden,css:t.css,translations:t.translations,placements:t.placements,attribution:t.attribution}:t.attribution?{attribution:t.attribution}:void 0,a=e.y();if(s){let e=s.global??{};s.setGlobalProperties({...e,merchant_id:t.merchantId,domain:t.domain??``})}n.sendLifecycle({clientLifecycle:`resolved-config`,data:{merchantId:t.merchantId,domain:t.domain??``,allowedDomains:t.allowedDomains??[],sourceUrl:window.location.href,...a&&{sdkAnonymousId:a},...r&&{pendingMergeToken:r},...i&&{sdkConfig:i}}})};e.h.isResolved&&(p(e.h.getConfig()),o.resolve()),a&&(d(await a),p(e.h.getConfig()),o.resolve());async function m(){let e=t.customizations?.css;e&&n.sendLifecycle({clientLifecycle:`modal-css`,data:{cssLink:e}})}async function h(){let e=t.customizations?.i18n;e&&n.sendLifecycle({clientLifecycle:`modal-i18n`,data:{i18n:e}})}async function g(){if(typeof window>`u`)return;let e=window.localStorage.getItem(i);e&&n.sendLifecycle({clientLifecycle:`restore-backup`,data:{backup:e}})}(await Promise.allSettled([m(),h(),g()])).some(e=>e.status===`rejected`)&&s?.track(`sdk_iframe_handshake_failed`,{reason:`asset_push`})}function L(t){return(0,n.jsonDecode)(e.p(t))}async function R({config:e}){let t=z(e),n=await x({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=P({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function z(e){let n=t.r(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:n}}}function B({perCall:e,defaults:t,productUtmContent:n}){if(e===null)return;let r=e!==void 0,i=t!==void 0&&Object.keys(t).length>0;if(!r&&!i&&!(n!==void 0&&n!==``))return;let a={...t,...e??{}},o=n??e?.utmContent;return o!==void 0&&o!==``?a.utmContent=o:delete a.utmContent,a}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return y}});
|
|
2
|
+
//# sourceMappingURL=src-Cd4rAMD9.cjs.map
|