@frak-labs/components 0.0.24-beta.74fa073f → 0.0.24-beta.9e639ff6
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/{ButtonShare.BjPnbirM.js → ButtonShare.BpOpqZip.js} +1 -1
- package/cdn/{ButtonWallet.ap5Z2Om0.js → ButtonWallet.DJ5Gi0mk.js} +1 -1
- package/cdn/{OpenInAppButton.CI4WWhAN.js → OpenInAppButton.BXL49ZLV.js} +1 -1
- package/cdn/{Spinner.CviT8Bie.js → Spinner.e-KcQ9pb.js} +1 -1
- package/cdn/components.js +1 -1
- package/cdn/{initFrakSdk.VDR5GNZg.js → initFrakSdk.DBAsnVHd.js} +1 -1
- package/cdn/loader.js +1 -1
- package/cdn/{useClientReady.Ds1tWqGf.js → useClientReady.CpmCaJk-.js} +1 -1
- package/dist/{Spinner-J7chVm6X.js → Spinner-Bs9F-lbj.js} +3 -3
- package/dist/buttonShare.js +1 -1
- package/dist/buttonWallet.js +3 -3
- package/dist/openInApp.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,a as t,b as n,c as r,f as i,h as a,l as o,m as s,n as c,o as l,p as u,s as d}from"./initFrakSdk.
|
|
1
|
+
import{S as e,a as t,b as n,c as r,f as i,h as a,l as o,m as s,n as c,o as l,p as u,s as d}from"./initFrakSdk.DBAsnVHd.js";import{t as f}from"./Spinner.e-KcQ9pb.js";import{a as p,i as m,n as h,o as g,r as _,t as v}from"./useClientReady.CpmCaJk-.js";function y(e,t){return!e||e.payoutType!==`fixed`?0:e.amount[t]}function b(e,t){return e.reduce((e,n)=>Math.max(e,y(n.referrer,t)),0)}async function x({targetInteraction:e}){let n=window.FrakSetup?.client;if(!n){console.warn(`Frak client not ready yet`);return}let{rewards:i}=await t(n),a=r(n.config.metadata?.currency),o=b(e?i.filter(t=>t.interactionTypeKey===e):i,a);if(!(o<=0))return d(Math.round(o),n.config.metadata?.currency)}function S(e,t){let[n,r]=_(void 0);return p(()=>{e&&x({targetInteraction:t}).then(e=>{e&&r(e)})},[e,t]),{reward:n}}const C={buttonShare:`nOB7Uq_buttonShare`};C.buttonShare;function w(e={}){let{successDuration:t=2e3}=e,[n,r]=_(!1);return{copy:m(async e=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e),r(!0);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();try{document.execCommand(`copy`),r(!0)}catch(e){return console.error(`Failed to copy text:`,e),!1}finally{t.remove()}}return setTimeout(()=>{r(!1)},t),!0}catch(e){return console.error(`Failed to copy text:`,e),!1}},[t]),copied:n}}const T={errorContainer:{marginTop:`16px`,padding:`16px`,backgroundColor:`#FEE2E2`,border:`1px solid #FCA5A5`,borderRadius:`4px`,color:`#991B1B`},header:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`12px`},title:{margin:0,fontSize:`16px`,fontWeight:500},message:{fontSize:`14px`,lineHeight:`1.5`,margin:`0 0 12px 0`},link:{color:`#991B1B`,textDecoration:`underline`,textUnderlineOffset:`2px`},copyButton:{display:`inline-flex`,alignItems:`center`,gap:`8px`,marginBottom:`10px`,padding:`8px 12px`,backgroundColor:`white`,border:`1px solid #D1D5DB`,borderRadius:`4px`,color:`black`,fontSize:`14px`,fontWeight:500}};function E({debugInfo:e}){let[t,n]=_(!1);return a(`div`,{children:[a(`button`,{type:`button`,style:T.copyButton,onClick:()=>n(!t),children:`Ouvrir les informations`}),t&&a(`textarea`,{style:{display:`block`,width:`100%`,height:`200px`,fontSize:`12px`},children:e})]})}function D({debugInfo:e}){let{copied:t,copy:n}=w();return a(`div`,{style:T.errorContainer,children:[a(`div`,{style:T.header,children:a(`h3`,{style:T.title,children:`Oups ! Nous avons rencontré un petit problème`})}),a(`p`,{style:T.message,children:[`Impossible d'ouvrir le menu de partage pour le moment. Si le problème persiste, copiez les informations ci-dessous et collez-les dans votre mail à`,` `,a(`a`,{href:`mailto:help@frak-labs.com?subject=Debug`,style:T.link,children:`help@frak-labs.com`}),` `,a(`br`,{}),`Merci pour votre retour, nous traitons votre demande dans les plus brefs délais.`]}),a(`button`,{type:`button`,onClick:()=>n(e??``),style:T.copyButton,children:t?`Informations copiées !`:`Copier les informations de débogage`}),a(E,{debugInfo:e})]})}function O(e){let[t,n]=_(void 0),[r,a]=_(!1);return{handleShare:m(async()=>{if(!window.FrakSetup?.client){console.error(`Frak client not found`),n(o.empty().formatDebugInfo(`Frak client not found`)),a(!0);return}let t=c();if(!t)throw Error(`modalBuilderSteps not found`);try{await t.sharing(window.FrakSetup?.modalShareConfig??{}).display(t=>({...t,targetInteraction:e}))}catch(e){if(e instanceof s&&e.code===u.clientAborted){console.debug(`User aborted the modal`);return}let t=window.FrakSetup.client.debugInfo.formatDebugInfo(e);i(window.FrakSetup.client,`share_modal_error`,{error:e instanceof Object&&`message`in e?e.message:`Unknown error`,debugInfo:t}),n(t),a(!0),console.error(`Error while opening the modal`,e)}},[e]),isError:r,debugInfo:t}}async function k(){if(!window.FrakSetup?.client)throw Error(`Frak client not found`);await l(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}function A({text:t=`Share and earn!`,classname:r=``,useReward:o,noRewardText:s,targetInteraction:c,showWallet:l}){let u=h(()=>o!==void 0,[o]),d=h(()=>l!==void 0,[l]),{isClientReady:p}=v(),{reward:g}=S(u&&p,c),{handleShare:_,isError:y,debugInfo:b}=O(c),x=h(()=>u?g?t.includes(`{REWARD}`)?t.replace(`{REWARD}`,g):`${t} ${g}`:s??t.replace(`{REWARD}`,``):t,[u,t,s,g]),w=m(async()=>{i(window.FrakSetup.client,`share_button_clicked`),d?await k():await _()},[d,_]);return a(n,{children:[a(`button`,{type:`button`,className:e(C.buttonShare,r,`override`),onClick:w,children:[!p&&a(f,{}),` `,x]}),y&&a(D,{debugInfo:b})]})}g(A,`frak-button-share`,[`text`],{shadow:!1});export{A as ButtonShare,S as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,f as t,h as n,i as r}from"./initFrakSdk.
|
|
1
|
+
import{S as e,f as t,h as n,i as r}from"./initFrakSdk.DBAsnVHd.js";import{a as i,n as a,o,r as s,t as c}from"./useClientReady.CpmCaJk-.js";import{t as l}from"./ButtonShare.BpOpqZip.js";function u(e){return n(`svg`,{fill:`none`,height:`1em`,viewBox:`0 0 28 28`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n(`title`,{children:`Gift icon`}),n(`path`,{d:`m23.1427 13.9999v11.4285h-18.2857v-11.4285m9.1429 11.4285v-17.14282m0 0h-5.1429c-.75776 0-1.48448-.30102-2.0203-.83684s-.83684-1.26255-.83684-2.02031.30102-1.48448.83684-2.0203 1.26254-.83684 2.0203-.83684c4 0 5.1429 5.71429 5.1429 5.71429zm0 0h5.1428c.7578 0 1.4845-.30102 2.0203-.83684s.8369-1.26255.8369-2.02031-.3011-1.48448-.8369-2.0203-1.2625-.83684-2.0203-.83684c-4 0-5.1428 5.71429-5.1428 5.71429zm-11.42861 0h22.85711v5.71432h-22.85711z`,stroke:`#fff`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]})}const d={reward:`Kl62ia_reward`,button__right:`Kl62ia_button__right`,button:`Kl62ia_button`,button__left:`Kl62ia_button__left`};d.reward,d.button__right,d.button,d.button__left;function f({classname:o=``,useReward:f,targetInteraction:p}){let m=a(()=>f!==void 0,[f]),{isClientReady:h}=c(),{reward:g}=l(m&&h,p),[_,v]=s(`right`);return i(()=>{let e=window.FrakSetup?.modalWalletConfig?.metadata?.position;v(e??`right`)},[]),n(`button`,{type:`button`,"aria-label":`Open wallet`,class:e(d.button,_===`left`?d.button__left:d.button__right,o,`override`),disabled:!h,onClick:()=>{t(window.FrakSetup.client,`wallet_button_clicked`),r()},children:[n(u,{}),g&&n(`span`,{className:d.reward,children:g})]})}o(f,`frak-button-wallet`,[],{shadow:!1});export{f as ButtonWallet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,d as t,f as n,h as r,u as i}from"./initFrakSdk.
|
|
1
|
+
import{S as e,d as t,f as n,h as r,u as i}from"./initFrakSdk.DBAsnVHd.js";import{t as a}from"./Spinner.e-KcQ9pb.js";import{n as o,o as s,t as c}from"./useClientReady.CpmCaJk-.js";function l(){return typeof navigator>`u`?!1:!!(/iPhone|iPad|iPod|Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1)}function u(){return{isMobile:o(()=>l(),[])}}function d(e=`wallet`){let r=window.FrakSetup?.client;r&&n(r,`open_in_app_clicked`),t(`${i}${e}`,{onFallback:()=>{r&&n(r,`app_not_installed`)}})}const f={button:`XYfqGq_button`};f.button;function p({text:t=`Open in App`,classname:n=``}){let{isClientReady:i}=c(),{isMobile:o}=u();if(!o)return null;let s=()=>{d()};return r(`button`,{type:`button`,"aria-label":`Open in Frak Wallet app`,className:e(f.button,n,`override`),disabled:!i,onClick:s,children:[!i&&r(a,{}),` `,t]})}s(p,`frak-open-in-app`,[`text`],{shadow:!1});export{p as OpenInAppButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,h as t}from"./initFrakSdk.
|
|
1
|
+
import{S as e,h as t}from"./initFrakSdk.DBAsnVHd.js";const n={"rt-spinner-leaf-fade":`M4fSKa_rt-spinner-leaf-fade`,spinner:`M4fSKa_spinner`,spinner__leaf:`M4fSKa_spinner__leaf`};n[`rt-spinner-leaf-fade`],n.spinner,n.spinner__leaf;const r=({ref:r,className:i,...a})=>t(`span`,{...a,ref:r,className:e(n.spinner),children:[t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf})]});r.displayName=`Spinner`;export{r as t};
|
package/cdn/components.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import(`https://cdn.jsdelivr.net/npm/@frak-labs/components@beta/cdn/loader.js?v=
|
|
1
|
+
import(`https://cdn.jsdelivr.net/npm/@frak-labs/components@beta/cdn/loader.js?v=1772016567223`);
|
|
@@ -11,4 +11,4 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
|
|
|
11
11
|
Last Response: ${t.lastResponse}
|
|
12
12
|
Client Status: ${t.clientStatus}
|
|
13
13
|
Error: ${t.error}
|
|
14
|
-
`.trim()}};function Cn(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}function wn(e){return`intent://${e.slice(13)}#Intent;scheme=frakwallet;end`}function Tn(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=Cn()&&En(e)?wn(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function En(e){return e.startsWith(bn)}const Z={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 Dn({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);return r.id=Z.id,r.name=Z.name,r.allow=Z.allow,r.style.zIndex=Z.style.zIndex.toString(),On({iframe:r,isVisible:!1}),r.src=`${t?.walletUrl??e??`https://wallet.frak.id`}/listener`,new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function On({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 kn(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 An(e){e?localStorage.setItem(X,e):localStorage.removeItem(X)}function jn(e,t,n,r){let i=new URL(window.location.href),a=i.searchParams.get(`fmt`)??void 0;e.contentWindow?.postMessage({clientLifecycle:`handshake-response`,data:{token:t,currentUrl:window.location.href,clientId:G(),pendingMergeToken:a,configDomain:r}},n),a&&(i.searchParams.delete(`fmt`),window.history.replaceState({},``,i.toString()))}function Mn(e,t){try{let n=new URL(e);return n.searchParams.has(`u`)?(n.searchParams.delete(`u`),n.searchParams.append(`u`,window.location.href),t&&n.searchParams.append(`fmt`,t),n.toString()):e}catch{return e}}function Nn(e,t,n,r){let i=Mn(t,r);En(t)?Tn(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}}):window.location.href=i}function Pn({iframe:e,targetOrigin:t,configDomain:n}){let r=new Rt;return{handleEvent:async i=>{if(!(`iframeLifecycle`in i))return;let{iframeLifecycle:a,data:o}=i;switch(a){case`connected`:r.resolve(!0);break;case`do-backup`:An(o.backup);break;case`remove-backup`:localStorage.removeItem(X);break;case`show`:case`hide`:On({iframe:e,isVisible:a===`show`});break;case`handshake`:jn(e,o.token,t,n);break;case`redirect`:Nn(e,o.baseRedirectUrl,t,o.mergeToken);break}},isConnected:r.promise}}function Fn({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=Pn({iframe:t,targetOrigin:n,configDomain:e.domain}),i=new Sn(e,t);if(!t.contentWindow)throw new W(U.configError,`The iframe does not have a content window`);let a=zt({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await r.isConnected)throw new W(U.clientNotConnected,`The iframe provider isn't connected yet`);return t}},{onRequest(e,t){return i.setLastRequest(e),t},onResponse(e,t){return i.setLastResponse(e,t),t}}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await r.handleEvent(e)}}}),o=In(a,r),s=async()=>{o(),a.cleanup(),t.remove()},c;console.log(`[Frak SDK] Initializing OpenPanel`),c=new yn({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||`sdkVersion`in t.properties||(t.properties={...t.properties,sdkVersion:`0.1.1`}),!0)}),c.setGlobalProperties({sdkVersion:`0.1.1`}),c.init();let l=Ln({config:e,rpcClient:a,lifecycleManager:r}).then(()=>i.updateSetupStatus(!0));return{config:e,debugInfo:i,waitForConnection:r.isConnected,waitForSetup:l,request:a.request,listenerRequest:a.listen,destroy:s,openPanel:c}}function In(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,1e3),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 Ln({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,xn(t,n.isConnected);async function r(){let n=e.customizations?.css;if(!n)return;let r={clientLifecycle:`modal-css`,data:{cssLink:n}};t.sendLifecycle(r)}async function i(){let n=e.customizations?.i18n;if(!n)return;let r={clientLifecycle:`modal-i18n`,data:{i18n:n}};t.sendLifecycle(r)}async function a(){if(typeof window>`u`)return;let e=window.localStorage.getItem(X);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([r(),i(),a()])}function Rn(e){return Vt(Kt(e))}const Q={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function zn(e){return e&&e in Q?e:`eur`}function Bn(e){return e?Q[e]??Q.eur:Q.eur}function Vn(e,t){let n=Bn(t),r=zn(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function Hn(e){return e?`${e}Amount`:`eurAmount`}async function Un({config:e}){let t=Wn(e),n=await Dn({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=Fn({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function Wn(e){let t=zn(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}function Gn(){return Lt(96)}async function $(e,t){return await e.request({method:`frak_displayEmbeddedWallet`,params:[t,e.config.metadata]})}async function Kn(e,{steps:t,metadata:n}){return await e.request({method:`frak_displayModal`,params:[t,n,e.config.metadata]})}async function qn(e){return await e.request({method:`frak_getMerchantInformation`})}async function Jn(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function Yn(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,t.type)}}async function Xn(e,{walletStatus:t,frakContext:n,modalConfig:r,options:i}){if(!n?.r)return`no-referrer`;Y(e,`user_referred_started`,{properties:{referrer:n?.r,walletStatus:t?.key}}),Yn(e,{type:`arrival`,referrerWallet:n.r,landingUrl:typeof window<`u`?window.location.href:void 0});let a=!1;async function o(){if(!a)return a=!0,Qn(e,{modalConfig:{...r,loggedIn:{action:{key:`referred`}}},walletStatus:t})}try{let{status:r,currentWallet:a}=await Zn({initialWalletStatus:t,getFreshWalletStatus:o,frakContext:n});return K.replaceUrl({url:window.location?.href,context:i?.alwaysAppendUrl?{r:a}:null}),Y(e,`user_referred_completed`,{properties:{status:r,referrer:n?.r,wallet:a}}),r}catch(r){return console.log(`Error processing referral`,{error:r}),Y(e,`user_referred_error`,{properties:{referrer:n?.r,error:r instanceof W?`[${r.code}] ${r.name} - ${r.message}`:r instanceof Error?r.message:`undefined`}}),K.replaceUrl({url:window.location?.href,context:i?.alwaysAppendUrl?{r:t?.wallet}:null}),$n(r)}}async function Zn({initialWalletStatus:e,getFreshWalletStatus:t,frakContext:n}){let r=e?.wallet;return r||=await t(),r&&It(n.r,r)?{status:`self-referral`,currentWallet:r}:{status:`success`,currentWallet:r}}async function Qn(e,{modalConfig:t,walletStatus:n}){return n?.key===`connected`?n.wallet??void 0:(await $(e,t??{}))?.wallet??void 0}function $n(e){if(e instanceof W)switch(e.code){case U.walletNotConnected:return`no-wallet`;default:return`error`}return`error`}async function er(e,{modalConfig:t,options:n}={}){let r=K.parse({url:window.location.href}),i=await nr(e);try{return await Xn(e,{walletStatus:i,frakContext:r,modalConfig:t,options:n})}catch(e){console.warn(`Error processing referral`,{error:e})}}async function tr(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=G();if(!t&&!n){console.warn(`[Frak] No identity found, skipping purchase check`);return}let r=window.sessionStorage.getItem(`frak-merchant-id`),i=e.merchantId??r??await fn();if(!i){console.warn(`[Frak] No merchant id found, skipping purchase check`);return}let a={Accept:`application/json`,"Content-Type":`application/json`};t&&(a[`x-wallet-sdk-auth`]=t),n&&(a[`x-frak-client-id`]=n);let o=nn();await fetch(`${o}/user/track/purchase`,{method:`POST`,headers:a,body:JSON.stringify({customerId:e.customerId,orderId:e.orderId,token:e.token,merchantId:i})})}function nr(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(rr(e,t),t));let n=new Rt,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{rr(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function rr(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function ir(e,{metadata:t,login:n}){return ar(e,{steps:{login:n??{}},metadata:t})}function ar(e,t){function n(n){return ar(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return ar(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function i(n,r){return ar(e,{...t,steps:{...t.steps,final:{...r,action:{key:`sharing`,options:n}}}})}async function a(n){return n&&(t.metadata=n(t.metadata??{})),await Kn(e,t)}return{params:t,sendTx:n,reward:r,sharing:i,display:a}}async function or(e,{tx:t,metadata:n}){return(await Kn(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}async function sr(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 Kn(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??Gn(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var cr=t({DEEP_LINK_SCHEME:()=>bn,DebugInfoGatherer:()=>Sn,FrakContextManager:()=>K,base64urlDecode:()=>Kt,base64urlEncode:()=>Gt,baseIframeProps:()=>Z,clearMerchantIdCache:()=>mn,compressJsonToB64:()=>qt,computeLegacyProductId:()=>Ht,createIFrameFrakClient:()=>Fn,createIframe:()=>Dn,decompressJsonFromB64:()=>Rn,displayEmbeddedWallet:()=>$,displayModal:()=>Kn,fetchMerchantId:()=>fn,findIframeInOpener:()=>kn,formatAmount:()=>Vn,generateSsoUrl:()=>Jt,getBackendUrl:()=>nn,getClientId:()=>G,getCurrencyAmountKey:()=>Hn,getMerchantInformation:()=>qn,getSupportedCurrency:()=>zn,getSupportedLocale:()=>Bn,isChromiumAndroid:()=>Cn,isFrakDeepLink:()=>En,locales:()=>Q,modalBuilder:()=>ir,openSso:()=>Qt,prepareSso:()=>Jn,processReferral:()=>Xn,referralInteraction:()=>er,resolveMerchantId:()=>hn,sendInteraction:()=>Yn,sendTransaction:()=>or,setupClient:()=>Un,siweAuthenticate:()=>sr,ssoPopupFeatures:()=>Xt,ssoPopupName:()=>Zt,toAndroidIntentUrl:()=>wn,trackEvent:()=>Y,trackPurchaseStatus:()=>tr,triggerDeepLinkWithFallback:()=>Tn,watchWalletStatus:()=>nr});function lr(){`vibrate`in navigator?navigator.vibrate(10):console.log(`Vibration not supported`)}function ur(){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}lr(),$(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}const dr=`frakClientReady`;function fr(){let e=new CustomEvent(dr);window.dispatchEvent(e)}function pr(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(dr,t,!1)}function mr(e){window.modalBuilderSteps=ir(e,window.FrakSetup?.modalConfig??{})}async function hr(e){let t=await er(e,{modalConfig:window.FrakSetup?.modalWalletConfig});console.log(`referral`,t)}function gr(){if(!window.modalBuilderSteps)throw Error(`modalBuilderSteps not found`);return window.modalBuilderSteps}async function _r(){if(window.FrakSetup.core=cr,!vr())return;if(console.log(`[Frak SDK] Starting initialization`),!window.FrakSetup.config){console.error(`[Frak SDK] Configuration not found`),window.frakSetupInProgress=!1;return}let e=await Un({config:window.FrakSetup.config});if(!e){console.error(`[Frak SDK] Failed to create client`),window.frakSetupInProgress=!1;return}window.FrakSetup.client=e,console.log(`[Frak SDK] Client initialized successfully`),fr(),mr(e),hr(e),window.frakSetupInProgress=!1,yr()}function vr(){return window.frakSetupInProgress?(console.log(`[Frak SDK] Initialization already in progress`),!1):(window.frakSetupInProgress=!0,window.FrakSetup?.client?(console.log(`[Frak SDK] Client already initialized`),window.frakSetupInProgress=!1,!1):window.FrakSetup?.config?!0:(console.error(`[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.`),window.frakSetupInProgress=!1,!1))}function yr(){let e=new URLSearchParams(window.location.search).get(`frakAction`);e&&e===`share`&&(console.log(`[Frak SDK] Auto open query param found`),ur())}export{n as C,a as S,he as _,qn as a,w as b,Hn as c,Tn as d,Y as f,me as g,ve as h,ur as i,Sn as l,W as m,gr as n,$ as o,U as p,pr as r,Vn as s,_r as t,bn as u,ge as v,s as x,S as y};
|
|
14
|
+
`.trim()}};function Cn(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}function wn(e){return`intent://${e.slice(13)}#Intent;scheme=frakwallet;end`}function Tn(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=Cn()&&En(e)?wn(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function En(e){return e.startsWith(bn)}const Z={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 Dn({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);return r.id=Z.id,r.name=Z.name,r.allow=Z.allow,r.style.zIndex=Z.style.zIndex.toString(),On({iframe:r,isVisible:!1}),r.src=`${t?.walletUrl??e??`https://wallet.frak.id`}/listener`,new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function On({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 kn(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}}const An=(()=>{if(typeof navigator>`u`)return!1;let e=navigator.userAgent;if(!/iPhone|iPad|iPod/i.test(e))return!1;let t=e.toLowerCase();return t.includes(`instagram`)||t.includes(`fban`)||t.includes(`fbav`)||t.includes(`facebook`)})();function jn(e){e?localStorage.setItem(X,e):localStorage.removeItem(X)}function Mn(e,t,n,r){let i=new URL(window.location.href),a=i.searchParams.get(`fmt`)??void 0;e.contentWindow?.postMessage({clientLifecycle:`handshake-response`,data:{token:t,currentUrl:window.location.href,clientId:G(),pendingMergeToken:a,configDomain:r}},n),a&&(i.searchParams.delete(`fmt`),window.history.replaceState({},``,i.toString()))}function Nn(e,t){try{let n=new URL(e);return n.searchParams.has(`u`)?(n.searchParams.delete(`u`),n.searchParams.append(`u`,window.location.href),t&&n.searchParams.append(`fmt`,t),n.toString()):e}catch{return e}}function Pn(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 Fn(e){return e.includes(`/common/social`)}function In(e,t,n,r){if(En(t)){let i=Nn(t,r);Tn(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(An&&Fn(t))Pn(r);else{let e=Nn(t,r);window.location.href=e}}function Ln({iframe:e,targetOrigin:t,configDomain:n}){let r=new Rt;return{handleEvent:async i=>{if(!(`iframeLifecycle`in i))return;let{iframeLifecycle:a,data:o}=i;switch(a){case`connected`:r.resolve(!0);break;case`do-backup`:jn(o.backup);break;case`remove-backup`:localStorage.removeItem(X);break;case`show`:case`hide`:On({iframe:e,isVisible:a===`show`});break;case`handshake`:Mn(e,o.token,t,n);break;case`redirect`:In(e,o.baseRedirectUrl,t,o.mergeToken);break}},isConnected:r.promise}}function Rn({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=Ln({iframe:t,targetOrigin:n,configDomain:e.domain}),i=new Sn(e,t);if(!t.contentWindow)throw new W(U.configError,`The iframe does not have a content window`);let a=zt({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await r.isConnected)throw new W(U.clientNotConnected,`The iframe provider isn't connected yet`);return t}},{onRequest(e,t){return i.setLastRequest(e),t},onResponse(e,t){return i.setLastResponse(e,t),t}}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await r.handleEvent(e)}}}),o=zn(a,r),s=async()=>{o(),a.cleanup(),t.remove()},c;console.log(`[Frak SDK] Initializing OpenPanel`),c=new yn({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||`sdkVersion`in t.properties||(t.properties={...t.properties,sdkVersion:`0.1.1`}),!0)}),c.setGlobalProperties({sdkVersion:`0.1.1`}),c.init();let l=Bn({config:e,rpcClient:a,lifecycleManager:r}).then(()=>i.updateSetupStatus(!0));return{config:e,debugInfo:i,waitForConnection:r.isConnected,waitForSetup:l,request:a.request,listenerRequest:a.listen,destroy:s,openPanel:c}}function zn(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,1e3),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 Bn({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,xn(t,n.isConnected);async function r(){let n=e.customizations?.css;if(!n)return;let r={clientLifecycle:`modal-css`,data:{cssLink:n}};t.sendLifecycle(r)}async function i(){let n=e.customizations?.i18n;if(!n)return;let r={clientLifecycle:`modal-i18n`,data:{i18n:n}};t.sendLifecycle(r)}async function a(){if(typeof window>`u`)return;let e=window.localStorage.getItem(X);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([r(),i(),a()])}function Vn(e){return Vt(Kt(e))}const Q={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function Hn(e){return e&&e in Q?e:`eur`}function Un(e){return e?Q[e]??Q.eur:Q.eur}function Wn(e,t){let n=Un(t),r=Hn(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function Gn(e){return e?`${e}Amount`:`eurAmount`}async function Kn({config:e}){let t=qn(e),n=await Dn({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=Rn({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function qn(e){let t=Hn(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}function Jn(){return Lt(96)}async function $(e,t){return await e.request({method:`frak_displayEmbeddedWallet`,params:[t,e.config.metadata]})}async function Yn(e,{steps:t,metadata:n}){return await e.request({method:`frak_displayModal`,params:[t,n,e.config.metadata]})}async function Xn(e){return await e.request({method:`frak_getMerchantInformation`})}async function Zn(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function Qn(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,t.type)}}async function $n(e,{walletStatus:t,frakContext:n,modalConfig:r,options:i}){if(!n?.r)return`no-referrer`;Y(e,`user_referred_started`,{properties:{referrer:n?.r,walletStatus:t?.key}}),Qn(e,{type:`arrival`,referrerWallet:n.r,landingUrl:typeof window<`u`?window.location.href:void 0});let a=!1;async function o(){if(!a)return a=!0,tr(e,{modalConfig:{...r,loggedIn:{action:{key:`referred`}}},walletStatus:t})}try{let{status:r,currentWallet:a}=await er({initialWalletStatus:t,getFreshWalletStatus:o,frakContext:n});return K.replaceUrl({url:window.location?.href,context:i?.alwaysAppendUrl?{r:a}:null}),Y(e,`user_referred_completed`,{properties:{status:r,referrer:n?.r,wallet:a}}),r}catch(r){return console.log(`Error processing referral`,{error:r}),Y(e,`user_referred_error`,{properties:{referrer:n?.r,error:r instanceof W?`[${r.code}] ${r.name} - ${r.message}`:r instanceof Error?r.message:`undefined`}}),K.replaceUrl({url:window.location?.href,context:i?.alwaysAppendUrl?{r:t?.wallet}:null}),nr(r)}}async function er({initialWalletStatus:e,getFreshWalletStatus:t,frakContext:n}){let r=e?.wallet;return r||=await t(),r&&It(n.r,r)?{status:`self-referral`,currentWallet:r}:{status:`success`,currentWallet:r}}async function tr(e,{modalConfig:t,walletStatus:n}){return n?.key===`connected`?n.wallet??void 0:(await $(e,t??{}))?.wallet??void 0}function nr(e){if(e instanceof W)switch(e.code){case U.walletNotConnected:return`no-wallet`;default:return`error`}return`error`}async function rr(e,{modalConfig:t,options:n}={}){let r=K.parse({url:window.location.href}),i=await ar(e);try{return await $n(e,{walletStatus:i,frakContext:r,modalConfig:t,options:n})}catch(e){console.warn(`Error processing referral`,{error:e})}}async function ir(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=G();if(!t&&!n){console.warn(`[Frak] No identity found, skipping purchase check`);return}let r=window.sessionStorage.getItem(`frak-merchant-id`),i=e.merchantId??r??await fn();if(!i){console.warn(`[Frak] No merchant id found, skipping purchase check`);return}let a={Accept:`application/json`,"Content-Type":`application/json`};t&&(a[`x-wallet-sdk-auth`]=t),n&&(a[`x-frak-client-id`]=n);let o=nn();await fetch(`${o}/user/track/purchase`,{method:`POST`,headers:a,body:JSON.stringify({customerId:e.customerId,orderId:e.orderId,token:e.token,merchantId:i})})}function ar(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(or(e,t),t));let n=new Rt,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{or(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function or(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function sr(e,{metadata:t,login:n}){return cr(e,{steps:{login:n??{}},metadata:t})}function cr(e,t){function n(n){return cr(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return cr(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function i(n,r){return cr(e,{...t,steps:{...t.steps,final:{...r,action:{key:`sharing`,options:n}}}})}async function a(n){return n&&(t.metadata=n(t.metadata??{})),await Yn(e,t)}return{params:t,sendTx:n,reward:r,sharing:i,display:a}}async function lr(e,{tx:t,metadata:n}){return(await Yn(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}async function ur(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 Yn(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??Jn(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var dr=t({DEEP_LINK_SCHEME:()=>bn,DebugInfoGatherer:()=>Sn,FrakContextManager:()=>K,base64urlDecode:()=>Kt,base64urlEncode:()=>Gt,baseIframeProps:()=>Z,clearMerchantIdCache:()=>mn,compressJsonToB64:()=>qt,computeLegacyProductId:()=>Ht,createIFrameFrakClient:()=>Rn,createIframe:()=>Dn,decompressJsonFromB64:()=>Vn,displayEmbeddedWallet:()=>$,displayModal:()=>Yn,fetchMerchantId:()=>fn,findIframeInOpener:()=>kn,formatAmount:()=>Wn,generateSsoUrl:()=>Jt,getBackendUrl:()=>nn,getClientId:()=>G,getCurrencyAmountKey:()=>Gn,getMerchantInformation:()=>Xn,getSupportedCurrency:()=>Hn,getSupportedLocale:()=>Un,isChromiumAndroid:()=>Cn,isFrakDeepLink:()=>En,locales:()=>Q,modalBuilder:()=>sr,openSso:()=>Qt,prepareSso:()=>Zn,processReferral:()=>$n,referralInteraction:()=>rr,resolveMerchantId:()=>hn,sendInteraction:()=>Qn,sendTransaction:()=>lr,setupClient:()=>Kn,siweAuthenticate:()=>ur,ssoPopupFeatures:()=>Xt,ssoPopupName:()=>Zt,toAndroidIntentUrl:()=>wn,trackEvent:()=>Y,trackPurchaseStatus:()=>ir,triggerDeepLinkWithFallback:()=>Tn,watchWalletStatus:()=>ar});function fr(){`vibrate`in navigator?navigator.vibrate(10):console.log(`Vibration not supported`)}function pr(){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}fr(),$(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}const mr=`frakClientReady`;function hr(){let e=new CustomEvent(mr);window.dispatchEvent(e)}function gr(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(mr,t,!1)}function _r(e){window.modalBuilderSteps=sr(e,window.FrakSetup?.modalConfig??{})}async function vr(e){let t=await rr(e,{modalConfig:window.FrakSetup?.modalWalletConfig});console.log(`referral`,t)}function yr(){if(!window.modalBuilderSteps)throw Error(`modalBuilderSteps not found`);return window.modalBuilderSteps}async function br(){if(window.FrakSetup.core=dr,!xr())return;if(console.log(`[Frak SDK] Starting initialization`),!window.FrakSetup.config){console.error(`[Frak SDK] Configuration not found`),window.frakSetupInProgress=!1;return}let e=await Kn({config:window.FrakSetup.config});if(!e){console.error(`[Frak SDK] Failed to create client`),window.frakSetupInProgress=!1;return}window.FrakSetup.client=e,console.log(`[Frak SDK] Client initialized successfully`),hr(),_r(e),vr(e),window.frakSetupInProgress=!1,Sr()}function xr(){return window.frakSetupInProgress?(console.log(`[Frak SDK] Initialization already in progress`),!1):(window.frakSetupInProgress=!0,window.FrakSetup?.client?(console.log(`[Frak SDK] Client already initialized`),window.frakSetupInProgress=!1,!1):window.FrakSetup?.config?!0:(console.error(`[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.`),window.frakSetupInProgress=!1,!1))}function Sr(){let e=new URLSearchParams(window.location.search).get(`frakAction`);e&&e===`share`&&(console.log(`[Frak SDK] Auto open query param found`),pr())}export{n as C,a as S,he as _,Xn as a,w as b,Gn as c,Tn as d,Y as f,me as g,ve as h,pr as i,Sn as l,W as m,yr as n,$ as o,U as p,gr as r,Wn as s,br as t,bn as u,ge as v,s as x,S as y};
|
package/cdn/loader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,t}from"./initFrakSdk.
|
|
1
|
+
import{C as e,t}from"./initFrakSdk.DBAsnVHd.js";import{t as n}from"./Spinner.e-KcQ9pb.js";function r(){let e=`frak-components-styles`;if(document.getElementById(e))return;let t=import.meta.url,n=t.substring(0,t.lastIndexOf(`/`)),r=document.createElement(`link`);r.id=e,r.rel=`stylesheet`,r.href=`${n}/loader.css`,document.head.appendChild(r)}r(),e(t);const i={"button-share":()=>import(`./ButtonShare.BpOpqZip.js`),"button-wallet":()=>import(`./ButtonWallet.DJ5Gi0mk.js`),"open-in-app":()=>import(`./OpenInAppButton.BXL49ZLV.js`)},a=new MutationObserver(e=>{for(let{addedNodes:t}of e)for(let e of Array.from(t))e.nodeType===Node.ELEMENT_NODE&&o(e)});async function o(e){let t=e instanceof Element?e.tagName.toLowerCase():``,n=t?.startsWith(`frak-`),r=Array.from(e.querySelectorAll(`:not(:defined)`)).map(e=>e.tagName.toLowerCase()).filter(e=>e.startsWith(`frak-`));n&&!customElements.get(t)&&r.push(t);let i=[...new Set(r)];await Promise.allSettled(i.map(e=>s(e)))}async function s(e){if(customElements.get(e))return Promise.resolve();try{let t=e.replace(/^frak-/i,``);if(!(t in i))throw Error(`Component ${e} is not supported.`);await i[t]()}catch(e){console.error(e)}}o(document.body),a.observe(document.documentElement,{subtree:!0,childList:!0});export{n as Spinner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,_ as t,b as n,g as r,r as i,t as a,v as o,x as s,y as c}from"./initFrakSdk.
|
|
1
|
+
import{C as e,_ as t,b as n,g as r,r as i,t as a,v as o,x as s,y as c}from"./initFrakSdk.DBAsnVHd.js";function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(this,arguments)}function u(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}var d=[`context`,`children`],f=[`useFragment`];function p(e,t,n,r){function i(){var t,n=Reflect.construct(HTMLElement,[],i);return n._vdomComponent=e,r&&r.shadow?(n._root=n.attachShadow({mode:r.mode||`open`,serializable:(t=r.serializable)!=null&&t}),r.adoptedStyleSheets&&(n._root.adoptedStyleSheets=r.adoptedStyleSheets)):n._root=n,n}return(i.prototype=Object.create(HTMLElement.prototype)).constructor=i,i.prototype.connectedCallback=function(){h.call(this,r)},i.prototype.attributeChangedCallback=_,i.prototype.disconnectedCallback=v,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),i.observedAttributes=n,e.formAssociated&&(i.formAssociated=!0),n.forEach(function(e){Object.defineProperty(i.prototype,e,{get:function(){return this._vdom?this._vdom.props[e]:this._props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||={},this._props[e]=t);var n=typeof t;t!=null&&n!==`string`&&n!==`boolean`&&n!==`number`||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,i),i}function m(e){this.getChildContext=function(){return e.context};var t=e.children;return o(t,u(e,d))}function h(e){var n=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(n),this._vdom=c(m,l({},this._props,{context:n.detail.context}),b(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?t:r)(this._vdom,this._root)}function g(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function _(e,t,n){if(this._vdom){var i={};i[e]=n??=void 0,i[g(e)]=n,this._vdom=o(this._vdom,i),r(this._vdom,this._root)}}function v(){r(this._vdom=null,this._root)}function y(e,t){var r=this,i=e.useFragment,a=u(e,f);return c(i?n:`slot`,l({},a,{ref:function(e){e?(r.ref=e,r._listener||(r._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener(`_preact`,r._listener))):r.ref.removeEventListener(`_preact`,r._listener)}}))}function b(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var r=[],i={},a=0,o=e.attributes,s=e.childNodes;for(a=o.length;a--;)o[a].name!==`slot`&&(i[o[a].name]=o[a].value,i[g(o[a].name)]=o[a].value);for(a=s.length;a--;){var l=b(s[a],null,n),u=s[a].slot;u?i[u]=c(y,{name:u},l):r[a]=l}var d=!(!n||!n.shadow),f=t?c(y,{useFragment:!d},r):r;return!d&&t&&(e.innerHTML=``),c(t||e.nodeName.toLowerCase(),i,f)}function x(t,n,r=[],i={shadow:!1}){typeof window<`u`&&(e(a),customElements.get(n)||p(t,n,r,i))}var S,C,w,T,E=0,D=[],O=s,k=O.__b,A=O.__r,j=O.diffed,M=O.__c,N=O.unmount,P=O.__;function F(e,t){O.__h&&O.__h(C,e,E||t),E=0;var n=C.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function I(e){return E=1,L(q,e)}function L(e,t,n){var r=F(S++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):q(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=C,!C.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};C.__f=!0;var a=C.shouldComponentUpdate,o=C.componentWillUpdate;C.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},C.shouldComponentUpdate=i}return r.__N||r.__}function R(e,t){var n=F(S++,3);!O.__s&&K(n.__H,t)&&(n.__=e,n.u=t,C.__H.__h.push(n))}function z(e,t){var n=F(S++,7);return K(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function B(e,t){return E=8,z(function(){return e},t)}function V(){for(var e;e=D.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(W),t.__h.some(G),t.__h=[]}catch(n){t.__h=[],O.__e(n,e.__v)}}}O.__b=function(e){C=null,k&&k(e)},O.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),P&&P(e,t)},O.__r=function(e){A&&A(e),S=0;var t=(C=e.__c).__H;t&&(w===C?(t.__h=[],C.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(W),t.__h.some(G),t.__h=[],S=0)),w=C},O.diffed=function(e){j&&j(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(D.push(t)!==1&&T===O.requestAnimationFrame||((T=O.requestAnimationFrame)||U)(V)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),w=C=null},O.__c=function(e,t){t.some(function(e){try{e.__h.some(W),e.__h=e.__h.filter(function(e){return!e.__||G(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],O.__e(n,e.__v)}}),M&&M(e,t)},O.unmount=function(e){N&&N(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{W(e)}catch(e){t=e}}),n.__H=void 0,t&&O.__e(t,n.__v))};var H=typeof requestAnimationFrame==`function`;function U(e){var t,n=function(){clearTimeout(r),H&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);H&&(t=requestAnimationFrame(n))}function W(e){var t=C,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),C=t}function G(e){var t=C;e.__c=e.__(),C=t}function K(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function q(e,t){return typeof t==`function`?t(e):t}function J(){let[e,t]=I(!0),n=B(()=>{t(!1)},[]);return R(()=>(i(`add`,n),()=>i(`remove`,n)),[n]),{isClientReady:!e}}export{R as a,B as i,z as n,x as o,I as r,J as t};
|
|
@@ -4,12 +4,12 @@ import { jsx, jsxs } from "preact/jsx-runtime";
|
|
|
4
4
|
//#region src/components/Spinner/index.module.css?css_module
|
|
5
5
|
const classes = {
|
|
6
6
|
"rt-spinner-leaf-fade": "M4fSKa_rt-spinner-leaf-fade",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
7
|
+
"spinner__leaf": "M4fSKa_spinner__leaf",
|
|
8
|
+
"spinner": "M4fSKa_spinner"
|
|
9
9
|
};
|
|
10
10
|
const _rt_spinner_leaf_fade0 = classes["rt-spinner-leaf-fade"];
|
|
11
|
-
const _spinner0 = classes["spinner"];
|
|
12
11
|
const _spinner__leaf0 = classes["spinner__leaf"];
|
|
12
|
+
const _spinner0 = classes["spinner"];
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/components/Spinner/index.tsx
|
package/dist/buttonShare.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as registerWebComponent, r as getModalBuilderSteps, t as useClientReady } from "./useClientReady-iCtUeDsc.js";
|
|
2
|
-
import { t as Spinner } from "./Spinner-
|
|
2
|
+
import { t as Spinner } from "./Spinner-Bs9F-lbj.js";
|
|
3
3
|
import { t as useReward } from "./useReward-DAkT-7wT.js";
|
|
4
4
|
import { DebugInfoGatherer, trackEvent } from "@frak-labs/core-sdk";
|
|
5
5
|
import { displayEmbeddedWallet } from "@frak-labs/core-sdk/actions";
|
package/dist/buttonWallet.js
CHANGED
|
@@ -26,15 +26,15 @@ function GiftIcon(props) {
|
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/components/ButtonWallet/ButtonWallet.module.css?css_module
|
|
28
28
|
const classes = {
|
|
29
|
-
"button__left": "Kl62ia_button__left",
|
|
30
29
|
"button__right": "Kl62ia_button__right",
|
|
31
30
|
"button": "Kl62ia_button",
|
|
32
|
-
"reward": "Kl62ia_reward"
|
|
31
|
+
"reward": "Kl62ia_reward",
|
|
32
|
+
"button__left": "Kl62ia_button__left"
|
|
33
33
|
};
|
|
34
|
-
const _button__left0 = classes["button__left"];
|
|
35
34
|
const _button__right0 = classes["button__right"];
|
|
36
35
|
const _button0 = classes["button"];
|
|
37
36
|
const _reward0 = classes["reward"];
|
|
37
|
+
const _button__left0 = classes["button__left"];
|
|
38
38
|
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region src/components/ButtonWallet/ButtonWallet.tsx
|
package/dist/openInApp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as registerWebComponent, t as useClientReady } from "./useClientReady-iCtUeDsc.js";
|
|
2
|
-
import { t as Spinner } from "./Spinner-
|
|
2
|
+
import { t as Spinner } from "./Spinner-Bs9F-lbj.js";
|
|
3
3
|
import { DEEP_LINK_SCHEME, trackEvent, triggerDeepLinkWithFallback } from "@frak-labs/core-sdk";
|
|
4
4
|
import { cx } from "class-variance-authority";
|
|
5
5
|
import { useMemo } from "preact/hooks";
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "0.0.24-beta.
|
|
14
|
+
"version": "0.0.24-beta.9e639ff6",
|
|
15
15
|
"description": "Frak Wallet components, helping any person to interact with the Frak wallet.",
|
|
16
16
|
"repository": {
|
|
17
17
|
"url": "https://github.com/frak-id/wallet",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"publish": "echo 'Publishing components...'"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@frak-labs/frame-connector": "0.1.0-beta.
|
|
80
|
-
"@frak-labs/core-sdk": "0.1.1-beta.
|
|
79
|
+
"@frak-labs/frame-connector": "0.1.0-beta.9e639ff6",
|
|
80
|
+
"@frak-labs/core-sdk": "0.1.1-beta.9e639ff6",
|
|
81
81
|
"class-variance-authority": "^0.7.1",
|
|
82
82
|
"preact": "^10.28.3",
|
|
83
83
|
"preact-custom-element": "^4.6.0"
|