@frak-labs/core-sdk 0.1.1 → 0.2.0-beta.7898df5b

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.
Files changed (130) hide show
  1. package/README.md +58 -0
  2. package/cdn/bundle.js +14 -0
  3. package/dist/actions.cjs +1 -1
  4. package/dist/actions.d.cts +3 -3
  5. package/dist/actions.d.ts +3 -3
  6. package/dist/actions.js +1 -1
  7. package/dist/bundle.cjs +1 -1
  8. package/dist/bundle.d.cts +4 -6
  9. package/dist/bundle.d.ts +4 -6
  10. package/dist/bundle.js +1 -1
  11. package/dist/computeLegacyProductId-CCAZvLa5.d.cts +537 -0
  12. package/dist/computeLegacyProductId-b5cUWdAm.d.ts +537 -0
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.d.cts +3 -4
  15. package/dist/index.d.ts +3 -4
  16. package/dist/index.js +1 -1
  17. package/dist/{openSso-D--Airj6.d.cts → openSso-B0g7-807.d.cts} +173 -136
  18. package/dist/{openSso-DsKJ4y0j.d.ts → openSso-CMzwvaCa.d.ts} +173 -136
  19. package/dist/setupClient-BICl5fdX.js +13 -0
  20. package/dist/setupClient-nl8Dhh4V.cjs +13 -0
  21. package/dist/siweAuthenticate-BWmI2_TN.cjs +1 -0
  22. package/dist/{index-d8xS4ryI.d.ts → siweAuthenticate-CVigMOxz.d.cts} +113 -92
  23. package/dist/{index-C6FxkWPC.d.cts → siweAuthenticate-CnCZ7mok.d.ts} +113 -92
  24. package/dist/siweAuthenticate-zczqxm0a.js +1 -0
  25. package/dist/trackEvent-CeLFVzZn.js +1 -0
  26. package/dist/trackEvent-Ew5r5zfI.cjs +1 -0
  27. package/package.json +11 -22
  28. package/src/actions/displayEmbeddedWallet.ts +1 -0
  29. package/src/actions/displayModal.test.ts +12 -11
  30. package/src/actions/displayModal.ts +7 -18
  31. package/src/actions/ensureIdentity.ts +68 -0
  32. package/src/actions/{getProductInformation.test.ts → getMerchantInformation.test.ts} +33 -50
  33. package/src/actions/getMerchantInformation.ts +16 -0
  34. package/src/actions/index.ts +3 -2
  35. package/src/actions/openSso.ts +4 -2
  36. package/src/actions/referral/processReferral.test.ts +117 -242
  37. package/src/actions/referral/processReferral.ts +134 -204
  38. package/src/actions/referral/referralInteraction.test.ts +4 -12
  39. package/src/actions/referral/referralInteraction.ts +3 -13
  40. package/src/actions/sendInteraction.ts +46 -22
  41. package/src/actions/trackPurchaseStatus.test.ts +354 -141
  42. package/src/actions/trackPurchaseStatus.ts +48 -11
  43. package/src/actions/watchWalletStatus.ts +2 -3
  44. package/src/actions/wrapper/modalBuilder.test.ts +0 -14
  45. package/src/actions/wrapper/modalBuilder.ts +3 -12
  46. package/src/bundle.ts +0 -1
  47. package/src/clients/createIFrameFrakClient.ts +10 -5
  48. package/src/clients/transports/iframeLifecycleManager.test.ts +163 -4
  49. package/src/clients/transports/iframeLifecycleManager.ts +172 -33
  50. package/src/constants/interactionTypes.ts +12 -41
  51. package/src/index.ts +27 -16
  52. package/src/types/config.ts +6 -0
  53. package/src/types/context.ts +48 -6
  54. package/src/types/index.ts +15 -11
  55. package/src/types/lifecycle/client.ts +24 -1
  56. package/src/types/lifecycle/iframe.ts +6 -0
  57. package/src/types/rpc/displayModal.ts +2 -4
  58. package/src/types/rpc/embedded/index.ts +2 -2
  59. package/src/types/rpc/interaction.ts +31 -39
  60. package/src/types/rpc/merchantInformation.ts +77 -0
  61. package/src/types/rpc/modal/index.ts +0 -4
  62. package/src/types/rpc/modal/login.ts +5 -1
  63. package/src/types/rpc/walletStatus.ts +1 -7
  64. package/src/types/rpc.ts +22 -30
  65. package/src/types/tracking.ts +31 -0
  66. package/src/utils/FrakContext.test.ts +270 -186
  67. package/src/utils/FrakContext.ts +78 -56
  68. package/src/utils/backendUrl.test.ts +83 -0
  69. package/src/utils/backendUrl.ts +62 -0
  70. package/src/utils/clientId.test.ts +41 -0
  71. package/src/utils/clientId.ts +43 -0
  72. package/src/utils/compression/compress.test.ts +1 -1
  73. package/src/utils/compression/compress.ts +2 -2
  74. package/src/utils/compression/decompress.test.ts +8 -4
  75. package/src/utils/compression/decompress.ts +2 -2
  76. package/src/utils/{computeProductId.ts → computeLegacyProductId.ts} +2 -2
  77. package/src/utils/constants.ts +5 -0
  78. package/src/utils/deepLinkWithFallback.test.ts +243 -0
  79. package/src/utils/deepLinkWithFallback.ts +103 -0
  80. package/src/utils/formatAmount.ts +6 -0
  81. package/src/utils/iframeHelper.test.ts +18 -5
  82. package/src/utils/iframeHelper.ts +10 -3
  83. package/src/utils/index.ts +16 -1
  84. package/src/utils/merchantId.test.ts +653 -0
  85. package/src/utils/merchantId.ts +143 -0
  86. package/src/utils/sso.ts +18 -11
  87. package/src/utils/trackEvent.test.ts +23 -5
  88. package/src/utils/trackEvent.ts +13 -0
  89. package/cdn/bundle.iife.js +0 -14
  90. package/dist/actions-B5j-i1p0.cjs +0 -1
  91. package/dist/actions-q090Z0oR.js +0 -1
  92. package/dist/index-7OZ39x1U.d.ts +0 -195
  93. package/dist/index-CRsQWnTs.d.cts +0 -351
  94. package/dist/index-Ck1hudEi.d.ts +0 -351
  95. package/dist/index-zDq-VlKx.d.cts +0 -195
  96. package/dist/interaction-DMJ3ZfaF.d.cts +0 -45
  97. package/dist/interaction-KX1h9a7V.d.ts +0 -45
  98. package/dist/interactions-DnfM3oe0.js +0 -1
  99. package/dist/interactions-EIXhNLf6.cjs +0 -1
  100. package/dist/interactions.cjs +0 -1
  101. package/dist/interactions.d.cts +0 -2
  102. package/dist/interactions.d.ts +0 -2
  103. package/dist/interactions.js +0 -1
  104. package/dist/productTypes-BUkXJKZ7.cjs +0 -1
  105. package/dist/productTypes-CGb1MmBF.js +0 -1
  106. package/dist/src-1LQ4eLq5.js +0 -13
  107. package/dist/src-hW71KjPN.cjs +0 -13
  108. package/dist/trackEvent-CHnYa85W.js +0 -1
  109. package/dist/trackEvent-GuQm_1Nm.cjs +0 -1
  110. package/src/actions/getProductInformation.ts +0 -14
  111. package/src/actions/openSso.test.ts +0 -407
  112. package/src/actions/sendInteraction.test.ts +0 -219
  113. package/src/constants/interactionTypes.test.ts +0 -128
  114. package/src/constants/productTypes.test.ts +0 -130
  115. package/src/constants/productTypes.ts +0 -33
  116. package/src/interactions/index.ts +0 -5
  117. package/src/interactions/pressEncoder.test.ts +0 -215
  118. package/src/interactions/pressEncoder.ts +0 -53
  119. package/src/interactions/purchaseEncoder.test.ts +0 -291
  120. package/src/interactions/purchaseEncoder.ts +0 -99
  121. package/src/interactions/referralEncoder.test.ts +0 -170
  122. package/src/interactions/referralEncoder.ts +0 -47
  123. package/src/interactions/retailEncoder.test.ts +0 -107
  124. package/src/interactions/retailEncoder.ts +0 -37
  125. package/src/interactions/webshopEncoder.test.ts +0 -56
  126. package/src/interactions/webshopEncoder.ts +0 -30
  127. package/src/types/rpc/modal/openSession.ts +0 -25
  128. package/src/types/rpc/productInformation.ts +0 -59
  129. package/src/utils/computeProductId.test.ts +0 -80
  130. package/src/utils/sso.test.ts +0 -361
package/README.md CHANGED
@@ -6,3 +6,61 @@ Checkout our documentation for more information's about the usage:
6
6
  - [React client usage](https://docs.frak.id/wallet-sdk/getting-started/react)
7
7
  - [Core client usage](https://docs.frak.id/wallet-sdk/getting-started/javascript)
8
8
  - [CDN / Browser usage](https://docs.frak.id/wallet-sdk/getting-started/cdn)
9
+
10
+ ## API Surface
11
+
12
+ The Core SDK exports 111 functions, types, and utilities organized into four categories:
13
+
14
+ ### Client
15
+
16
+ | Export | Purpose |
17
+ |--------|---------|
18
+ | `createIFrameFrakClient` | Initialize iframe-based Frak client for wallet communication |
19
+ | `setupClient` | Configure client with blockchain and transport settings |
20
+ | `DebugInfoGatherer` | Utility class for collecting debug information |
21
+
22
+ ### Actions
23
+
24
+ | Export | Purpose |
25
+ |--------|---------|
26
+ | `displayModal` | Show wallet modal for user interactions |
27
+ | `displayEmbeddedWallet` | Render embedded wallet view within your app |
28
+ | `getMerchantInformation` | Fetch merchant data including rewards and tiers |
29
+ | `openSso` | Trigger single sign-on flow in popup window |
30
+ | `prepareSso` | Prepare SSO parameters before opening popup |
31
+ | `processReferral` | Handle referral code processing and validation |
32
+ | `referralInteraction` | Track referral-related user interactions |
33
+ | `sendInteraction` | Send user interaction events to wallet |
34
+ | `trackPurchaseStatus` | Monitor purchase completion status |
35
+ | `watchWalletStatus` | Subscribe to wallet connection and balance updates |
36
+ | `modalBuilder` | Helper to construct multi-step modal flows |
37
+ | `sendTransaction` | Wrapper for transaction signing and submission |
38
+ | `siweAuthenticate` | Sign-in with Ethereum authentication flow |
39
+
40
+ ### Utilities
41
+
42
+ | Export | Purpose |
43
+ |--------|---------|
44
+ | `fetchMerchantId` | Retrieve merchant ID from backend |
45
+ | `resolveMerchantId` | Resolve and cache merchant ID |
46
+ | `computeLegacyProductId` | Convert product ID to legacy format |
47
+ | `triggerDeepLinkWithFallback` | Open deep link with mobile fallback |
48
+ | `base64urlEncode` / `base64urlDecode` | URL-safe base64 encoding/decoding |
49
+ | `compressJsonToB64` / `decompressJsonFromB64` | JSON compression utilities |
50
+ | `trackEvent` | Send analytics events |
51
+ | `getClientId` | Retrieve unique client identifier |
52
+ | `getBackendUrl` | Get configured backend URL |
53
+ | `formatAmount` | Format token amounts with decimals |
54
+ | `getCurrencyAmountKey` | Generate currency-specific cache key |
55
+ | `getSupportedCurrency` | Check currency support |
56
+ | `getSupportedLocale` | Validate locale availability |
57
+ | `createIframe` / `findIframeInOpener` | Iframe DOM helpers |
58
+ | `FrakContextManager` | Manage SDK context lifecycle |
59
+ | `generateSsoUrl` | Build SSO redirect URL |
60
+
61
+ ### Types
62
+
63
+ Core SDK exports 40+ TypeScript types including:
64
+
65
+ `FrakClient`, `FrakWalletSdkConfig`, `SendInteractionParamsType`, `DisplayModalParamsType`, `WalletStatusReturnType`, `GetMerchantInformationReturnType`, `DisplayEmbeddedWalletParamsType`, `SendTransactionReturnType`, `SiweAuthenticateReturnType`, `OpenSsoParamsType`, `PrepareSsoParamsType`, `TrackArrivalParams`, `UtmParams`, `Currency`, `Language`, `FrakContext`, `IFrameRpcSchema`, and more.
66
+
package/cdn/bundle.js ADDED
@@ -0,0 +1,14 @@
1
+ var FrakSDK=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=(e,t)=>()=>(e&&(t=e(e=0)),t);async function n(e,t){return await e.request({method:`frak_displayEmbeddedWallet`,params:[t,e.config.metadata]})}async function r(e,{steps:t,metadata:n}){return await e.request({method:`frak_displayModal`,params:[t,n,e.config.metadata]})}let i=`https://backend.frak.id`;function a(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function o(e){return a(e)?`http://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:i}function s(e){if(e)return o(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return o(e)}return i}let c=`frak-client-id`;function l(){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 u(){if(typeof window>`u`||!window.localStorage)return console.warn(`[Frak SDK] No Window / localStorage available to save the clientId`),l();let e=localStorage.getItem(c);return e||(e=l(),localStorage.setItem(c,e)),e}let d=`frak-merchant-id`,f,p;async function m(e,t){if(f)return f;if(typeof window<`u`){let e=window.sessionStorage.getItem(d);if(e)return f=e,e}if(p)return p;p=h(e,t);let n=await p;return p=void 0,n}async function h(e,t){let n=e??(typeof window<`u`?window.location.hostname:``);if(n)try{let e=s(t),r=await fetch(`${e}/user/merchant/resolve?domain=${encodeURIComponent(n)}`);if(!r.ok){console.warn(`[Frak SDK] Merchant lookup failed for domain ${n}: ${r.status}`);return}let i=await r.json();return f=i.merchantId,typeof window<`u`&&window.sessionStorage.setItem(d,i.merchantId),f}catch(e){console.warn(`[Frak SDK] Failed to fetch merchantId:`,e);return}}function ee(){f=void 0,p=void 0,typeof window<`u`&&window.sessionStorage.removeItem(d)}async function g(e,t){return e.metadata?.merchantId?e.metadata.merchantId:m(void 0,t)}async function _(e){if(typeof window>`u`)return;let t=u();if(!t)return;let n=await m();if(!n)return;let r=`frak-identity-ensured-${n}`;if(!window.sessionStorage.getItem(r))try{let i=s();(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 te(e){return await e.request({method:`frak_getMerchantInformation`})}function v(e,{strict:t=!0}={}){return!e||typeof e!=`string`?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith(`0x`)}var ne=t((()=>{}));function re(e){return v(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var ie=t((()=>{ne()})),y,ae=t((()=>{y=`2.46.3`}));function oe(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?oe(e.cause,t):t?null:e}var b,x,se=t((()=>{ae(),b={getDocsUrl:({docsBaseUrl:e,docsPath:t=``,docsSlug:n})=>t?`${e??`https://viem.sh`}${t}${n?`#${n}`:``}`:void 0,version:`viem@${y}`},x=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof e&&n.cause.docsPath||n.docsPath,a=b.getDocsUrl?.({...n,docsPath:i}),o=[t||`An error occurred.`,``,...n.metaMessages?[...n.metaMessages,``]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...b.version?[`Version: ${b.version}`]:[]].join(`
2
+ `);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,`details`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,`docsPath`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,`metaMessages`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,`shortMessage`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,`version`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,`name`,{enumerable:!0,configurable:!0,writable:!0,value:`BaseError`}),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=y}walk(e){return oe(this,e)}}})),S,ce=t((()=>{se(),S=class extends x{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:`SizeExceedsPaddingSizeError`})}}}));function C(e,{dir:t,size:n=32}={}){return typeof e==`string`?le(e,{dir:t,size:n}):ue(e,{dir:t,size:n})}function le(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace(`0x`,``);if(r.length>n*2)throw new S({size:Math.ceil(r.length/2),targetSize:n,type:`hex`});return`0x${r[t===`right`?`padEnd`:`padStart`](n*2,`0`)}`}function ue(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new S({size:e.length,targetSize:n,type:`bytes`});let r=new Uint8Array(n);for(let i=0;i<n;i++){let a=t===`right`;r[a?i:n-i-1]=e[a?i:e.length-i-1]}return r}var de=t((()=>{ce()})),fe,pe,me=t((()=>{se(),fe=class extends x{constructor({max:e,min:t,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${r*8}-bit ${n?`signed`:`unsigned`} `:``}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:`IntegerOutOfRangeError`})}},pe=class extends x{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:`SizeOverflowError`})}}}));function w(e,{size:t}){if(re(e)>t)throw new pe({givenSize:re(e),maxSize:t})}var he=t((()=>{me(),ie()}));function ge(e,t={}){return typeof e==`number`||typeof e==`bigint`?ve(e,t):typeof e==`string`?ye(e,t):typeof e==`boolean`?_e(e,t):T(e,t)}function _e(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(w(n,{size:t.size}),C(n,{size:t.size})):n}function T(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=be[e[t]];let r=`0x${n}`;return typeof t.size==`number`?(w(r,{size:t.size}),C(r,{dir:`right`,size:t.size})):r}function ve(e,t={}){let{signed:n,size:r}=t,i=BigInt(e),a;r?a=n?(1n<<BigInt(r)*8n-1n)-1n:2n**(BigInt(r)*8n)-1n:typeof e==`number`&&(a=BigInt(2**53-1));let o=typeof a==`bigint`&&n?-a-1n:0;if(a&&i>a||i<o){let t=typeof e==`bigint`?`n`:``;throw new fe({max:a?`${a}${t}`:void 0,min:`${o}${t}`,signed:n,size:r,value:`${e}${t}`})}let s=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?C(s,{size:r}):s}function ye(e,t={}){return T(xe.encode(e),t)}var be,xe;function Se(e,t={}){return typeof e==`number`||typeof e==`bigint`?we(e,t):typeof e==`boolean`?Ce(e,t):v(e)?D(e,t):Te(e,t)}function Ce(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size==`number`?(w(n,{size:t.size}),C(n,{size:t.size})):n}function E(e){if(e>=O.zero&&e<=O.nine)return e-O.zero;if(e>=O.A&&e<=O.F)return e-(O.A-10);if(e>=O.a&&e<=O.f)return e-(O.a-10)}function D(e,t={}){let n=e;t.size&&(w(n,{size:t.size}),n=C(n,{dir:`right`,size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);let i=r.length/2,a=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let n=E(r.charCodeAt(t++)),i=E(r.charCodeAt(t++));if(n===void 0||i===void 0)throw new x(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);a[e]=n*16+i}return a}function we(e,t){return D(ve(e,t))}function Te(e,t={}){let n=Ee.encode(e);return typeof t.size==`number`?(w(n,{size:t.size}),C(n,{dir:`right`,size:t.size})):n}var Ee,O,De,Oe;function ke(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function Ae(e,...t){if(!ke(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function je(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Me(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}var Ne,Pe;function Fe(e,t){let n=t||`hex`,r=Pe(v(e,{strict:!1})?Se(e):e);return n===`bytes`?r:ge(r)}var Ie;function Le(e,t){if(k.has(`${e}.${t}`))return k.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=Fe(Te(n),`bytes`),i=(t?n.substring(`${t}0x`.length):n).split(``);for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(r[e>>1]&15)>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let a=`0x${i.join(``)}`;return k.set(`${e}.${t}`,a),a}var k;function A(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(j.has(r))return j.get(r);let i=Re.test(e)?e.toLowerCase()===e?!0:n?Le(e)===e:!0:!1;return j.set(r,i),i}var Re,j;function ze(e,t){if(!A(e,{strict:!1}))throw new Ie({address:e});if(!A(t,{strict:!1}))throw new Ie({address:t});return e.toLowerCase()===t.toLowerCase()}let M=256,N;function Be(e=11){if(!N||M+e>256*2){N=``,M=0;for(let e=0;e<256;e++)N+=(256+Math.random()*256|0).toString(16).substring(1)}return N.substring(M,M+++e)}function Ve({domain:e}={}){return Fe(ge((e??window.location.host).replace(`www.`,``)))}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 P=class extends Error{constructor(e,t,n){super(t),this.code=e,this.data=n}toJSON(){return{code:this.code,message:this.message,data:this.data}}},F=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 Ue(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 F;return o.set(t,e=>{e.error?n.reject(new P(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 We(e){return new TextEncoder().encode(JSON.stringify(e))}function Ge(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}function I(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function L(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 R(e){return I(We(e))}function z(e,t,n,r,i,a){let o=R(Ke({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 Ke(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 B=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,V=`frak-sso`;async function qe(e,t){let{metadata:n,customizations:r,walletUrl:i}=e.config;if(t.openInSameWindow??!!t.redirectUrl)return await e.request({method:`frak_openSso`,params:[t,n.name,r?.css]});let a=t.ssoPopupUrl??z(i??`https://wallet.frak.id`,t,Ve(),n.name,u(),r?.css),o=window.open(a,V,B);if(!o)throw Error(`Popup was blocked. Please allow popups for this site.`);return o.focus(),await e.request({method:`frak_openSso`,params:[t,n.name,r?.css]})??{}}async function Je(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}function H(e){return`r`in e&&!(`v`in e)}function U(e){return`v`in e&&e.v===2}function Ye(e){return Ge(L(e))}let W=`nexus-wallet-backup`,Xe=`frakwallet://`;function Ze(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}function Qe(e){return`intent://${e.slice(13)}#Intent;scheme=frakwallet;end`}function $e(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=Ze()&&G(e)?Qe(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function G(e){return e.startsWith(Xe)}let K=`fCtx`;function et(e){if(e)try{return U(e)?!e.c||!e.m||!e.t?void 0:R({v:2,c:e.c,m:e.m,t:e.t}):I(D(e.r))}catch(t){console.error(`Error compressing Frak context`,{e:t,context:e})}}function tt(e){if(!(!e||e.length===0))try{let t=Ye(e);if(t&&typeof t==`object`&&t.v===2)return t.c&&t.m&&t.t?{v:2,c:t.c,m:t.m,t:t.t}:void 0;let n=T(L(e),{size:20});if(A(n))return{r:n}}catch(t){console.error(`Error decompressing Frak context`,{e:t,context:e})}}function nt({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(K);return t?tt(t):null}function rt({url:e,context:t}){if(!e)return null;let n=et(t);if(!n)return null;let r=new URL(e);return r.searchParams.set(K,n),r.toString()}function it(e){let t=new URL(e);return t.searchParams.delete(K),t.toString()}function at({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?it(n):rt({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}let q={compress:et,decompress:tt,parse:nt,update:rt,remove:it,replaceUrl:at},J={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function Y(e){return e&&e in J?e:`eur`}function ot(e){return e?J[e]??J.eur:J.eur}function st(e,t){let n=ot(t),r=Y(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function ct(e){return e?`${e}Amount`:`eurAmount`}let X={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 lt({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);r.id=X.id,r.name=X.name,r.allow=X.allow,r.style.zIndex=X.style.zIndex.toString(),ut({iframe:r,isVisible:!1});let i=t?.walletUrl??e??`https://wallet.frak.id`,a=u();return r.src=`${i}/listener?clientId=${encodeURIComponent(a)}`,new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function ut({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 dt(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 Z(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)}}async function Q(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t,{clientId:u()}]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,t.type)}}function ft(e,t,n){let r=typeof window<`u`?window.location.href:void 0;return U(t)?(Z(e,`user_referred_started`,{properties:{referrerClientId:t.c,walletStatus:n?.key}}),Q(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referralTimestamp:t.t,landingUrl:r}),!0):H(t)?(Z(e,`user_referred_started`,{properties:{referrer:t.r,walletStatus:n?.key}}),Q(e,{type:`arrival`,referrerWallet:t.r,landingUrl:r}),!0):!1}function pt(e){let t=u();return t?{v:2,c:t,m:e,t:Math.floor(Date.now()/1e3)}:null}function mt(e,t){return U(e)?u()===e.c:H(e)&&t?.wallet?ze(e.r,t.wallet):!1}function ht(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;if(mt(n,t))return`self-referral`;if(!ft(e,n,t))return`no-referrer`;let i=U(n)?n.m:r?.merchantId,a=r?.alwaysAppendUrl&&i?pt(i):null;return q.replaceUrl({url:window.location?.href,context:a}),Z(e,`user_referred_completed`,{properties:{status:`success`}}),`success`}async function gt(e,{options:t}={}){let n=q.parse({url:window.location.href}),r=await vt(e);try{return ht(e,{walletStatus:r,frakContext:n,options:t})}catch(e){console.warn(`Error processing referral`,{error:e})}}async function _t(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=u();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 m();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=s();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 vt(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(yt(e,t),t));let n=new F,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{yt(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function yt(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),_(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function bt(e,{metadata:t,login:n}){return $(e,{steps:{login:n??{}},metadata:t})}function $(e,t){function n(n){return $(e,{...t,steps:{...t.steps,sendTransaction:n}})}function i(n){return $(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function a(n,r){return $(e,{...t,steps:{...t.steps,final:{...r,action:{key:`sharing`,options:n}}}})}async function o(n){return n&&(t.metadata=n(t.metadata??{})),await r(e,t)}return{params:t,sendTx:n,reward:i,sharing:a,display:o}}async function xt(e,{tx:t,metadata:n}){return(await r(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function St(){return Be(96)}async function Ct(e,{siwe:t,metadata:n}){let i=e.config?.domain??window.location.host,a=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`;return(await r(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:a,nonce:t?.nonce??St(),uri:t?.uri??`https://${i}`,version:t?.version??`1`,domain:i}}}})).siweAuthenticate}var wt=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)}},Tt=class{constructor(e){this.options=e,this.queue=[];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.0.4`,this.api=new wt({baseUrl:e.apiUrl||`https://api.openpanel.dev`,defaultHeaders:t})}init(){}ready(){this.options.waitForProfile=!1,this.flush()}async send(e){return this.options.disabled||this.options.filter&&!this.options.filter(e)?Promise.resolve():this.options.waitForProfile&&!this.profileId?(this.queue.push(e),Promise.resolve()):this.api.fetch(`/track`,e)}setGlobalProperties(e){this.global={...this.global,...e}}async track(e,t){return this.log(`track event`,e,t),this.send({type:`track`,payload:{name:e,profileId:t?.profileId??this.profileId,properties:{...this.global??{},...t??{}}}})}async identify(e){if(this.log(`identify user`,e),e.profileId&&(this.profileId=e.profileId,this.flush()),Object.keys(e).length>1)return this.send({type:`identify`,payload:{...e,properties:{...this.global,...e.properties}}})}async alias(e){}async increment(e){return this.send({type:`increment`,payload:e})}async decrement(e){return this.send({type:`decrement`,payload:e})}async revenue(e,t){let n=t?.deviceId;return delete t?.deviceId,this.track(`revenue`,{...t??{},...n?{__deviceId:n}:{},__revenue:e})}async fetchDeviceId(){return(await this.api.fetch(`/track/device-id`,void 0,{method:`GET`,keepalive:!1}))?.deviceId??``}clear(){this.profileId=void 0}flush(){this.queue.forEach(e=>{this.send({...e,payload:{...e.payload,profileId:e.payload.profileId??this.profileId}})}),this.queue=[]}log(...e){this.options.debug&&console.log(`[OpenPanel.dev]`,...e)}};function Et(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var Dt=class extends Tt{constructor(e){if(super({sdk:`web`,sdkVersion:`1.0.7`,...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=[]}this.setGlobalProperties({__referrer:document.referrer}),this.options.trackScreenViews&&(this.trackScreenViews(),setTimeout(()=>this.screenView(),0)),this.options.trackOutgoingLinks&&this.trackOutgoingLinks(),this.options.trackAttributes&&this.trackAttributes()}}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[Et(t.name.replace(/^data-/,``))]=t.value);let t=i.getAttribute(`data-track`);t&&super.track(t,e)}})}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 Ot(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`))}var kt=class e{config;iframe;isSetupDone=!1;lastResponse=null;lastRequest=null;constructor(e,t){this.config=e,this.iframe=t,this.lastRequest=null,this.lastResponse=null}setLastResponse(e,t){this.lastResponse={message:e,response:t,timestamp:Date.now()}}setLastRequest(e){this.lastRequest={event:e,timestamp:Date.now()}}updateSetupStatus(e){this.isSetupDone=e}base64Encode(e){try{return btoa(JSON.stringify(e))}catch(e){return console.warn(`Failed to encode debug data`,e),btoa(`Failed to encode data`)}}getIframeStatus(){return this.iframe?{loading:this.iframe.hasAttribute(`loading`),url:this.iframe.src,readyState:this.iframe.contentDocument?.readyState?this.iframe.contentDocument.readyState===`complete`?1:0:-1,contentWindow:!!this.iframe.contentWindow,isConnected:this.iframe.isConnected}:null}getNavigatorInfo(){return navigator?{userAgent:navigator.userAgent,language:navigator.language,onLine:navigator.onLine,screenWidth:window.screen.width,screenHeight:window.screen.height,pixelRatio:window.devicePixelRatio}:null}gatherDebugInfo(e){let t=this.getIframeStatus(),n=this.getNavigatorInfo(),r=`Unknown`;return e instanceof P?r=`FrakRpcError: ${e.code} '${e.message}'`:e instanceof Error?r=e.message:typeof e==`string`&&(r=e),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):`no-config`,navigatorInfo:n?this.base64Encode(n):`no-navigator`,iframeStatus:t?this.base64Encode(t):`not-iframe`,lastRequest:this.lastRequest?this.base64Encode(this.lastRequest):`No Frak request logged`,lastResponse:this.lastResponse?this.base64Encode(this.lastResponse):`No Frak response logged`,clientStatus:this.isSetupDone?`setup`:`not-setup`,error:r}}static empty(){return new e}formatDebugInfo(e){let t=this.gatherDebugInfo(e);return`
3
+ Debug Information:
4
+ -----------------
5
+ Timestamp: ${t.timestamp}
6
+ URL: ${t.encodedUrl}
7
+ Config: ${t.encodedConfig}
8
+ Navigator Info: ${t.navigatorInfo}
9
+ IFrame Status: ${t.iframeStatus}
10
+ Last Request: ${t.lastRequest}
11
+ Last Response: ${t.lastResponse}
12
+ Client Status: ${t.clientStatus}
13
+ Error: ${t.error}
14
+ `.trim()}};let At=(()=>{if(typeof navigator>`u`)return!1;let e=navigator.userAgent;if(!(/iPhone|iPad|iPod/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1))return!1;let t=e.toLowerCase();return t.includes(`instagram`)||t.includes(`fban`)||t.includes(`fbav`)||t.includes(`facebook`)})();function jt(e){e?localStorage.setItem(W,e):localStorage.removeItem(W)}function Mt(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,pendingMergeToken:a,configDomain:r,clientId:u()}},n),a&&(i.searchParams.delete(`fmt`),window.history.replaceState({},``,i.toString()))}function Nt(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 Pt(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 Ft(e){return e.includes(`/common/social`)}function It(e,t,n,r){if(G(t)){let i=Nt(t,r);$e(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(At&&Ft(t))Pt(r);else{let e=Nt(t,r);window.location.href=e}}function Lt({iframe:e,targetOrigin:t,configDomain:n}){let r=new F;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`:jt(o.backup);break;case`remove-backup`:localStorage.removeItem(W);break;case`show`:case`hide`:ut({iframe:e,isVisible:a===`show`});break;case`handshake`:Mt(e,o.token,t,n);break;case`redirect`:It(e,o.baseRedirectUrl,t,o.mergeToken);break}},isConnected:r.promise}}function Rt({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=Lt({iframe:t,targetOrigin:n,configDomain:e.domain}),i=new kt(e,t);if(!t.contentWindow)throw new P(He.configError,`The iframe does not have a content window`);let a=Ue({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await r.isConnected)throw new P(He.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=zt(a,r),s=async()=>{o(),a.cleanup(),t.remove()},c;console.log(`[Frak SDK] Initializing OpenPanel`),c=new Dt({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.2.0`,userAnonymousClientId:u()}),!0)}),c.setGlobalProperties({sdkVersion:`0.2.0`,userAnonymousClientId:u()}),c.init();let l=Bt({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 zt(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 Bt({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,Ot(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(W);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([r(),i(),a()])}async function Vt({config:e}){let t=Ht(e),n=await lt({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=Y(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}return e.DEEP_LINK_SCHEME=Xe,e.DebugInfoGatherer=kt,e.FrakContextManager=q,e.base64urlDecode=L,e.base64urlEncode=I,e.baseIframeProps=X,e.clearMerchantIdCache=ee,e.compressJsonToB64=R,e.computeLegacyProductId=Ve,e.createIFrameFrakClient=Rt,e.createIframe=lt,e.decompressJsonFromB64=Ye,e.displayEmbeddedWallet=n,e.displayModal=r,e.ensureIdentity=_,e.fetchMerchantId=m,e.findIframeInOpener=dt,e.formatAmount=st,e.generateSsoUrl=z,e.getBackendUrl=s,e.getClientId=u,e.getCurrencyAmountKey=ct,e.getMerchantInformation=te,e.getSupportedCurrency=Y,e.getSupportedLocale=ot,e.isChromiumAndroid=Ze,e.isFrakDeepLink=G,e.isV1Context=H,e.isV2Context=U,e.locales=J,e.modalBuilder=bt,e.openSso=qe,e.prepareSso=Je,e.processReferral=ht,e.referralInteraction=gt,e.resolveMerchantId=g,e.sendInteraction=Q,e.sendTransaction=xt,e.setupClient=Vt,e.siweAuthenticate=Ct,e.ssoPopupFeatures=B,e.ssoPopupName=V,e.toAndroidIntentUrl=Qe,e.trackEvent=Z,e.trackPurchaseStatus=_t,e.triggerDeepLinkWithFallback=$e,e.watchWalletStatus=vt,e})({});
package/dist/actions.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./trackEvent-GuQm_1Nm.cjs`),t=require(`./actions-B5j-i1p0.cjs`);exports.displayEmbeddedWallet=t.f,exports.displayModal=t.d,exports.getProductInformation=t.u,exports.modalBuilder=t.r,exports.openSso=e.r,exports.prepareSso=t.l,exports.processReferral=t.c,exports.referralInteraction=t.s,exports.sendInteraction=t.o,exports.sendTransaction=t.n,exports.siweAuthenticate=t.t,exports.trackPurchaseStatus=t.a,exports.watchWalletStatus=t.i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./trackEvent-Ew5r5zfI.cjs`),t=require(`./siweAuthenticate-BWmI2_TN.cjs`);exports.displayEmbeddedWallet=t.p,exports.displayModal=t.f,exports.ensureIdentity=t.d,exports.getMerchantInformation=t.u,exports.modalBuilder=t.r,exports.openSso=e.u,exports.prepareSso=t.l,exports.processReferral=t.s,exports.referralInteraction=t.o,exports.sendInteraction=t.c,exports.sendTransaction=t.n,exports.siweAuthenticate=t.t,exports.trackPurchaseStatus=t.a,exports.watchWalletStatus=t.i;
@@ -1,3 +1,3 @@
1
- import { t as openSso } from "./openSso-D--Airj6.cjs";
2
- import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, h as getProductInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction } from "./index-C6FxkWPC.cjs";
3
- export { ModalBuilder, ModalStepBuilder, ProcessReferralOptions, SendTransactionParams, SiweAuthenticateModalParams, displayEmbeddedWallet, displayModal, getProductInformation, modalBuilder, openSso, prepareSso, processReferral, referralInteraction, sendInteraction, sendTransaction, siweAuthenticate, trackPurchaseStatus, watchWalletStatus };
1
+ import { t as openSso } from "./openSso-B0g7-807.cjs";
2
+ import { _ as displayModal, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as ensureIdentity, h as getMerchantInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction, v as displayEmbeddedWallet } from "./siweAuthenticate-CVigMOxz.cjs";
3
+ export { type ModalBuilder, type ModalStepBuilder, type ProcessReferralOptions, type SendTransactionParams, type SiweAuthenticateModalParams, displayEmbeddedWallet, displayModal, ensureIdentity, getMerchantInformation, modalBuilder, openSso, prepareSso, processReferral, referralInteraction, sendInteraction, sendTransaction, siweAuthenticate, trackPurchaseStatus, watchWalletStatus };
package/dist/actions.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { t as openSso } from "./openSso-DsKJ4y0j.js";
2
- import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, h as getProductInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction } from "./index-d8xS4ryI.js";
3
- export { ModalBuilder, ModalStepBuilder, ProcessReferralOptions, SendTransactionParams, SiweAuthenticateModalParams, displayEmbeddedWallet, displayModal, getProductInformation, modalBuilder, openSso, prepareSso, processReferral, referralInteraction, sendInteraction, sendTransaction, siweAuthenticate, trackPurchaseStatus, watchWalletStatus };
1
+ import { t as openSso } from "./openSso-CMzwvaCa.js";
2
+ import { _ as displayModal, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as ensureIdentity, h as getMerchantInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction, v as displayEmbeddedWallet } from "./siweAuthenticate-CnCZ7mok.js";
3
+ export { type ModalBuilder, type ModalStepBuilder, type ProcessReferralOptions, type SendTransactionParams, type SiweAuthenticateModalParams, displayEmbeddedWallet, displayModal, ensureIdentity, getMerchantInformation, modalBuilder, openSso, prepareSso, processReferral, referralInteraction, sendInteraction, sendTransaction, siweAuthenticate, trackPurchaseStatus, watchWalletStatus };
package/dist/actions.js CHANGED
@@ -1 +1 @@
1
- import{r as e}from"./trackEvent-CHnYa85W.js";import{a as t,c as n,d as r,f as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d,u as f}from"./actions-q090Z0oR.js";export{i as displayEmbeddedWallet,r as displayModal,f as getProductInformation,l as modalBuilder,e as openSso,o as prepareSso,n as processReferral,u as referralInteraction,c as sendInteraction,s as sendTransaction,d as siweAuthenticate,t as trackPurchaseStatus,a as watchWalletStatus};
1
+ import{u as e}from"./trackEvent-CeLFVzZn.js";import{a as t,c as n,d as r,f as i,i as a,l as o,n as s,o as c,p as l,r as u,s as d,t as f,u as p}from"./siweAuthenticate-zczqxm0a.js";export{l as displayEmbeddedWallet,i as displayModal,r as ensureIdentity,p as getMerchantInformation,u as modalBuilder,e as openSso,o as prepareSso,d as processReferral,c as referralInteraction,n as sendInteraction,s as sendTransaction,f as siweAuthenticate,t as trackPurchaseStatus,a as watchWalletStatus};
package/dist/bundle.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./trackEvent-GuQm_1Nm.cjs`),t=require(`./src-hW71KjPN.cjs`),n=require(`./productTypes-BUkXJKZ7.cjs`),r=require(`./actions-B5j-i1p0.cjs`),i=require(`./interactions-EIXhNLf6.cjs`);exports.DebugInfoGatherer=t.f,exports.FrakContextManager=e.n,exports.PressInteractionEncoder=i.a,exports.PurchaseInteractionEncoder=i.i,exports.ReferralInteractionEncoder=i.r,exports.RetailInteractionEncoder=i.n,exports.WebShopInteractionEncoder=i.t,exports.base64urlDecode=e.c,exports.base64urlEncode=e.l,exports.baseIframeProps=t.l,exports.compressJsonToB64=e.s,exports.createIFrameFrakClient=t.c,exports.createIframe=t.u,exports.decompressJsonFromB64=t.s,exports.displayEmbeddedWallet=r.f,exports.displayModal=r.d,exports.findIframeInOpener=t.d,exports.formatAmount=t.r,exports.generateSsoUrl=e.o,exports.getCurrencyAmountKey=t.n,exports.getProductInformation=r.u,exports.getSupportedCurrency=t.a,exports.getSupportedLocale=t.i,exports.interactionTypes=n.r,exports.locales=t.o,exports.modalBuilder=r.r,exports.openSso=e.r,exports.prepareSso=r.l,exports.processReferral=r.c,exports.productTypes=n.t,exports.productTypesMask=n.n,exports.referralInteraction=r.s,exports.sendInteraction=r.o,exports.sendTransaction=r.n,exports.setupClient=t.t,exports.siweAuthenticate=r.t,exports.ssoPopupFeatures=e.i,exports.ssoPopupName=e.a,exports.trackEvent=e.t,exports.trackPurchaseStatus=r.a,exports.watchWalletStatus=r.i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./trackEvent-Ew5r5zfI.cjs`),t=require(`./setupClient-nl8Dhh4V.cjs`),n=require(`./siweAuthenticate-BWmI2_TN.cjs`);exports.DEEP_LINK_SCHEME=t.g,exports.DebugInfoGatherer=t.r,exports.FrakContextManager=e.a,exports.base64urlDecode=e.h,exports.base64urlEncode=e.g,exports.baseIframeProps=t.i,exports.clearMerchantIdCache=e.n,exports.compressJsonToB64=e.m,exports.computeLegacyProductId=e._,exports.createIFrameFrakClient=t.n,exports.createIframe=t.a,exports.decompressJsonFromB64=e.c,exports.displayEmbeddedWallet=n.p,exports.displayModal=n.f,exports.ensureIdentity=n.d,exports.fetchMerchantId=e.r,exports.findIframeInOpener=t.o,exports.formatAmount=t.c,exports.generateSsoUrl=e.p,exports.getBackendUrl=e.l,exports.getClientId=e.v,exports.getCurrencyAmountKey=t.s,exports.getMerchantInformation=n.u,exports.getSupportedCurrency=t.u,exports.getSupportedLocale=t.l,exports.isChromiumAndroid=t.f,exports.isFrakDeepLink=t.p,exports.isV1Context=e.o,exports.isV2Context=e.s,exports.locales=t.d,exports.modalBuilder=n.r,exports.openSso=e.u,exports.prepareSso=n.l,exports.processReferral=n.s,exports.referralInteraction=n.o,exports.resolveMerchantId=e.i,exports.sendInteraction=n.c,exports.sendTransaction=n.n,exports.setupClient=t.t,exports.siweAuthenticate=n.t,exports.ssoPopupFeatures=e.d,exports.ssoPopupName=e.f,exports.toAndroidIntentUrl=t.m,exports.trackEvent=e.t,exports.trackPurchaseStatus=n.a,exports.triggerDeepLinkWithFallback=t.h,exports.watchWalletStatus=n.i;
package/dist/bundle.d.cts CHANGED
@@ -1,6 +1,4 @@
1
- import { A as SiweAuthenticateReturnType, B as FinalActionType, C as ModalRpcStepsInput, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as OpenSsoParamsType, G as interactionTypes, H as ModalStepMetadata, I as OpenSsoReturnType, J as Currency, K as IFrameLifecycleEvent, L as PrepareSsoParamsType, M as OpenInteractionSessionModalStepType, N as OpenInteractionSessionReturnType, O as SendTransactionTxType, P as LoginModalStepType, Q as LocalizedI18nConfig, R as PrepareSsoReturnType, S as ModalRpcMetadata, T as ModalStepTypes, U as FullInteractionTypesKey, V as FinalModalStepType, W as InteractionTypesKey, X as I18nConfig, Y as FrakWalletSdkConfig, Z as Language, _ as LoggedOutEmbeddedView, a as FrakClient, b as LoggedInEmbeddedView, c as IFrameRpcSchema, d as TokenAmountType, f as ProductTypesKey, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, k as SiweAuthenticateModalStepType, l as WalletStatusReturnType, m as productTypesMask, n as ssoPopupFeatures, o as FrakLifecycleEvent, p as productTypes, q as ClientLifecycleEvent, r as ssoPopupName, s as IFrameTransport, t as openSso, u as GetProductInformationReturnType, v as EmbeddedViewActionReferred, w as ModalRpcStepsResultType, x as DisplayModalParamsType, y as EmbeddedViewActionSharing, z as SsoMetadata } from "./openSso-D--Airj6.cjs";
2
- import { n as SendInteractionParamsType, r as SendInteractionReturnType, t as PreparedInteraction } from "./interaction-DMJ3ZfaF.cjs";
3
- import { C as CompressedData, S as createIFrameFrakClient, T as KeyProvider, _ as base64urlEncode, a as generateSsoUrl, b as setupClient, c as findIframeInOpener, d as getCurrencyAmountKey, f as formatAmount, g as base64urlDecode, h as compressJsonToB64, i as FullSsoParams, l as getSupportedLocale, m as decompressJsonFromB64, n as AppSpecificSsoMetadata, o as baseIframeProps, p as FrakContextManager, r as CompressedSsoData, s as createIframe, t as trackEvent, u as getSupportedCurrency, v as LocalesKey, w as HashProtectedData, x as DebugInfoGatherer, y as locales } from "./index-CRsQWnTs.cjs";
4
- import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, h as getProductInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction } from "./index-C6FxkWPC.cjs";
5
- import { a as PressInteractionEncoder, i as PurchaseInteractionEncoder, n as RetailInteractionEncoder, r as ReferralInteractionEncoder, t as WebShopInteractionEncoder } from "./index-zDq-VlKx.cjs";
6
- export { AppSpecificSsoMetadata, ClientLifecycleEvent, CompressedData, CompressedSsoData, Currency, DebugInfoGatherer, DisplayEmbeddedWalletParamsType, DisplayEmbeddedWalletResultType, DisplayModalParamsType, EmbeddedViewActionReferred, EmbeddedViewActionSharing, FinalActionType, FinalModalStepType, FrakClient, FrakContext, FrakContextManager, FrakLifecycleEvent, FrakWalletSdkConfig, FullInteractionTypesKey, FullSsoParams, GetProductInformationReturnType, HashProtectedData, I18nConfig, IFrameLifecycleEvent, IFrameRpcSchema, IFrameTransport, InteractionTypesKey, KeyProvider, Language, LocalesKey, LocalizedI18nConfig, LoggedInEmbeddedView, LoggedOutEmbeddedView, LoginModalStepType, ModalBuilder, ModalRpcMetadata, ModalRpcStepsInput, ModalRpcStepsResultType, ModalStepBuilder, ModalStepMetadata, ModalStepTypes, OpenInteractionSessionModalStepType, OpenInteractionSessionReturnType, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, PrepareSsoReturnType, PreparedInteraction, PressInteractionEncoder, ProcessReferralOptions, ProductTypesKey, PurchaseInteractionEncoder, ReferralInteractionEncoder, RetailInteractionEncoder, SendInteractionParamsType, SendInteractionReturnType, SendTransactionModalStepType, SendTransactionParams, SendTransactionReturnType, SendTransactionTxType, SiweAuthenticateModalParams, SiweAuthenticateModalStepType, SiweAuthenticateReturnType, SiweAuthenticationParams, SsoMetadata, TokenAmountType, WalletStatusReturnType, WebShopInteractionEncoder, base64urlDecode, base64urlEncode, baseIframeProps, compressJsonToB64, createIFrameFrakClient, createIframe, decompressJsonFromB64, displayEmbeddedWallet, displayModal, findIframeInOpener, formatAmount, generateSsoUrl, getCurrencyAmountKey, getProductInformation, getSupportedCurrency, getSupportedLocale, interactionTypes, locales, modalBuilder, openSso, prepareSso, processReferral, productTypes, productTypesMask, referralInteraction, sendInteraction, sendTransaction, setupClient, siweAuthenticate, ssoPopupFeatures, ssoPopupName, trackEvent, trackPurchaseStatus, watchWalletStatus };
1
+ import { A as SendTransactionModalStepType, B as PrepareSsoReturnType, C as EmbeddedViewActionSharing, D as ModalRpcStepsInput, E as ModalRpcMetadata, F as SiweAuthenticationParams, G as InteractionTypeKey, H as FinalActionType, I as LoginModalStepType, J as Currency, K as IFrameLifecycleEvent, L as OpenSsoParamsType, M as SendTransactionTxType, N as SiweAuthenticateModalStepType, O as ModalRpcStepsResultType, P as SiweAuthenticateReturnType, Q as LocalizedI18nConfig, R as OpenSsoReturnType, S as EmbeddedViewActionReferred, T as DisplayModalParamsType, U as FinalModalStepType, V as SsoMetadata, W as ModalStepMetadata, X as I18nConfig, Y as FrakWalletSdkConfig, Z as Language, _ as TokenAmountType, a as FrakContextV1, b as DisplayEmbeddedWalletResultType, c as isV2Context, d as IFrameTransport, f as IFrameRpcSchema, g as RewardTier, h as GetMerchantInformationReturnType, i as FrakContext, j as SendTransactionReturnType, k as ModalStepTypes, l as FrakClient, m as EstimatedReward, n as ssoPopupFeatures, o as FrakContextV2, p as WalletStatusReturnType, q as ClientLifecycleEvent, r as ssoPopupName, s as isV1Context, t as openSso, u as FrakLifecycleEvent, v as SendInteractionParamsType, w as LoggedInEmbeddedView, x as LoggedOutEmbeddedView, y as DisplayEmbeddedWalletParamsType, z as PrepareSsoParamsType } from "./openSso-B0g7-807.cjs";
2
+ import { A as getBackendUrl, B as HashProtectedData, C as triggerDeepLinkWithFallback, D as base64urlDecode, E as compressJsonToB64, F as createIFrameFrakClient, I as TrackArrivalParams, L as TrackArrivalResult, M as locales, N as setupClient, O as base64urlEncode, P as DebugInfoGatherer, R as UtmParams, S as toAndroidIntentUrl, T as decompressJsonFromB64, V as KeyProvider, _ as formatAmount, a as CompressedSsoData, b as isChromiumAndroid, c as clearMerchantIdCache, d as baseIframeProps, f as createIframe, g as getCurrencyAmountKey, h as getSupportedCurrency, i as AppSpecificSsoMetadata, j as LocalesKey, k as getClientId, l as fetchMerchantId, m as getSupportedLocale, n as FrakEvent, o as FullSsoParams, p as findIframeInOpener, r as trackEvent, s as generateSsoUrl, t as computeLegacyProductId, u as resolveMerchantId, v as FrakContextManager, w as DEEP_LINK_SCHEME, x as isFrakDeepLink, y as DeepLinkFallbackOptions, z as CompressedData } from "./computeLegacyProductId-CCAZvLa5.cjs";
3
+ import { _ as displayModal, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as ensureIdentity, h as getMerchantInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction, v as displayEmbeddedWallet } from "./siweAuthenticate-CVigMOxz.cjs";
4
+ export { AppSpecificSsoMetadata, ClientLifecycleEvent, CompressedData, CompressedSsoData, Currency, DEEP_LINK_SCHEME, DebugInfoGatherer, DeepLinkFallbackOptions, DisplayEmbeddedWalletParamsType, DisplayEmbeddedWalletResultType, DisplayModalParamsType, EmbeddedViewActionReferred, EmbeddedViewActionSharing, EstimatedReward, FinalActionType, FinalModalStepType, FrakClient, FrakContext, FrakContextManager, FrakContextV1, FrakContextV2, FrakEvent, FrakLifecycleEvent, FrakWalletSdkConfig, FullSsoParams, GetMerchantInformationReturnType, HashProtectedData, I18nConfig, IFrameLifecycleEvent, IFrameRpcSchema, IFrameTransport, InteractionTypeKey, KeyProvider, Language, LocalesKey, LocalizedI18nConfig, LoggedInEmbeddedView, LoggedOutEmbeddedView, LoginModalStepType, ModalBuilder, ModalRpcMetadata, ModalRpcStepsInput, ModalRpcStepsResultType, ModalStepBuilder, ModalStepMetadata, ModalStepTypes, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, PrepareSsoReturnType, ProcessReferralOptions, RewardTier, SendInteractionParamsType, SendTransactionModalStepType, SendTransactionParams, SendTransactionReturnType, SendTransactionTxType, SiweAuthenticateModalParams, SiweAuthenticateModalStepType, SiweAuthenticateReturnType, SiweAuthenticationParams, SsoMetadata, TokenAmountType, TrackArrivalParams, TrackArrivalResult, UtmParams, WalletStatusReturnType, base64urlDecode, base64urlEncode, baseIframeProps, clearMerchantIdCache, compressJsonToB64, computeLegacyProductId, createIFrameFrakClient, createIframe, decompressJsonFromB64, displayEmbeddedWallet, displayModal, ensureIdentity, fetchMerchantId, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getMerchantInformation, getSupportedCurrency, getSupportedLocale, isChromiumAndroid, isFrakDeepLink, isV1Context, isV2Context, locales, modalBuilder, openSso, prepareSso, processReferral, referralInteraction, resolveMerchantId, sendInteraction, sendTransaction, setupClient, siweAuthenticate, ssoPopupFeatures, ssoPopupName, toAndroidIntentUrl, trackEvent, trackPurchaseStatus, triggerDeepLinkWithFallback, watchWalletStatus };
package/dist/bundle.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- import { A as SiweAuthenticateReturnType, B as FinalActionType, C as ModalRpcStepsInput, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as OpenSsoParamsType, G as interactionTypes, H as ModalStepMetadata, I as OpenSsoReturnType, J as Currency, K as IFrameLifecycleEvent, L as PrepareSsoParamsType, M as OpenInteractionSessionModalStepType, N as OpenInteractionSessionReturnType, O as SendTransactionTxType, P as LoginModalStepType, Q as LocalizedI18nConfig, R as PrepareSsoReturnType, S as ModalRpcMetadata, T as ModalStepTypes, U as FullInteractionTypesKey, V as FinalModalStepType, W as InteractionTypesKey, X as I18nConfig, Y as FrakWalletSdkConfig, Z as Language, _ as LoggedOutEmbeddedView, a as FrakClient, b as LoggedInEmbeddedView, c as IFrameRpcSchema, d as TokenAmountType, f as ProductTypesKey, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, k as SiweAuthenticateModalStepType, l as WalletStatusReturnType, m as productTypesMask, n as ssoPopupFeatures, o as FrakLifecycleEvent, p as productTypes, q as ClientLifecycleEvent, r as ssoPopupName, s as IFrameTransport, t as openSso, u as GetProductInformationReturnType, v as EmbeddedViewActionReferred, w as ModalRpcStepsResultType, x as DisplayModalParamsType, y as EmbeddedViewActionSharing, z as SsoMetadata } from "./openSso-DsKJ4y0j.js";
2
- import { n as SendInteractionParamsType, r as SendInteractionReturnType, t as PreparedInteraction } from "./interaction-KX1h9a7V.js";
3
- import { C as CompressedData, S as createIFrameFrakClient, T as KeyProvider, _ as base64urlEncode, a as generateSsoUrl, b as setupClient, c as findIframeInOpener, d as getCurrencyAmountKey, f as formatAmount, g as base64urlDecode, h as compressJsonToB64, i as FullSsoParams, l as getSupportedLocale, m as decompressJsonFromB64, n as AppSpecificSsoMetadata, o as baseIframeProps, p as FrakContextManager, r as CompressedSsoData, s as createIframe, t as trackEvent, u as getSupportedCurrency, v as LocalesKey, w as HashProtectedData, x as DebugInfoGatherer, y as locales } from "./index-Ck1hudEi.js";
4
- import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, h as getProductInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction } from "./index-d8xS4ryI.js";
5
- import { a as PressInteractionEncoder, i as PurchaseInteractionEncoder, n as RetailInteractionEncoder, r as ReferralInteractionEncoder, t as WebShopInteractionEncoder } from "./index-7OZ39x1U.js";
6
- export { AppSpecificSsoMetadata, ClientLifecycleEvent, CompressedData, CompressedSsoData, Currency, DebugInfoGatherer, DisplayEmbeddedWalletParamsType, DisplayEmbeddedWalletResultType, DisplayModalParamsType, EmbeddedViewActionReferred, EmbeddedViewActionSharing, FinalActionType, FinalModalStepType, FrakClient, FrakContext, FrakContextManager, FrakLifecycleEvent, FrakWalletSdkConfig, FullInteractionTypesKey, FullSsoParams, GetProductInformationReturnType, HashProtectedData, I18nConfig, IFrameLifecycleEvent, IFrameRpcSchema, IFrameTransport, InteractionTypesKey, KeyProvider, Language, LocalesKey, LocalizedI18nConfig, LoggedInEmbeddedView, LoggedOutEmbeddedView, LoginModalStepType, ModalBuilder, ModalRpcMetadata, ModalRpcStepsInput, ModalRpcStepsResultType, ModalStepBuilder, ModalStepMetadata, ModalStepTypes, OpenInteractionSessionModalStepType, OpenInteractionSessionReturnType, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, PrepareSsoReturnType, PreparedInteraction, PressInteractionEncoder, ProcessReferralOptions, ProductTypesKey, PurchaseInteractionEncoder, ReferralInteractionEncoder, RetailInteractionEncoder, SendInteractionParamsType, SendInteractionReturnType, SendTransactionModalStepType, SendTransactionParams, SendTransactionReturnType, SendTransactionTxType, SiweAuthenticateModalParams, SiweAuthenticateModalStepType, SiweAuthenticateReturnType, SiweAuthenticationParams, SsoMetadata, TokenAmountType, WalletStatusReturnType, WebShopInteractionEncoder, base64urlDecode, base64urlEncode, baseIframeProps, compressJsonToB64, createIFrameFrakClient, createIframe, decompressJsonFromB64, displayEmbeddedWallet, displayModal, findIframeInOpener, formatAmount, generateSsoUrl, getCurrencyAmountKey, getProductInformation, getSupportedCurrency, getSupportedLocale, interactionTypes, locales, modalBuilder, openSso, prepareSso, processReferral, productTypes, productTypesMask, referralInteraction, sendInteraction, sendTransaction, setupClient, siweAuthenticate, ssoPopupFeatures, ssoPopupName, trackEvent, trackPurchaseStatus, watchWalletStatus };
1
+ import { A as SendTransactionModalStepType, B as PrepareSsoReturnType, C as EmbeddedViewActionSharing, D as ModalRpcStepsInput, E as ModalRpcMetadata, F as SiweAuthenticationParams, G as InteractionTypeKey, H as FinalActionType, I as LoginModalStepType, J as Currency, K as IFrameLifecycleEvent, L as OpenSsoParamsType, M as SendTransactionTxType, N as SiweAuthenticateModalStepType, O as ModalRpcStepsResultType, P as SiweAuthenticateReturnType, Q as LocalizedI18nConfig, R as OpenSsoReturnType, S as EmbeddedViewActionReferred, T as DisplayModalParamsType, U as FinalModalStepType, V as SsoMetadata, W as ModalStepMetadata, X as I18nConfig, Y as FrakWalletSdkConfig, Z as Language, _ as TokenAmountType, a as FrakContextV1, b as DisplayEmbeddedWalletResultType, c as isV2Context, d as IFrameTransport, f as IFrameRpcSchema, g as RewardTier, h as GetMerchantInformationReturnType, i as FrakContext, j as SendTransactionReturnType, k as ModalStepTypes, l as FrakClient, m as EstimatedReward, n as ssoPopupFeatures, o as FrakContextV2, p as WalletStatusReturnType, q as ClientLifecycleEvent, r as ssoPopupName, s as isV1Context, t as openSso, u as FrakLifecycleEvent, v as SendInteractionParamsType, w as LoggedInEmbeddedView, x as LoggedOutEmbeddedView, y as DisplayEmbeddedWalletParamsType, z as PrepareSsoParamsType } from "./openSso-CMzwvaCa.js";
2
+ import { A as getBackendUrl, B as HashProtectedData, C as triggerDeepLinkWithFallback, D as base64urlDecode, E as compressJsonToB64, F as createIFrameFrakClient, I as TrackArrivalParams, L as TrackArrivalResult, M as locales, N as setupClient, O as base64urlEncode, P as DebugInfoGatherer, R as UtmParams, S as toAndroidIntentUrl, T as decompressJsonFromB64, V as KeyProvider, _ as formatAmount, a as CompressedSsoData, b as isChromiumAndroid, c as clearMerchantIdCache, d as baseIframeProps, f as createIframe, g as getCurrencyAmountKey, h as getSupportedCurrency, i as AppSpecificSsoMetadata, j as LocalesKey, k as getClientId, l as fetchMerchantId, m as getSupportedLocale, n as FrakEvent, o as FullSsoParams, p as findIframeInOpener, r as trackEvent, s as generateSsoUrl, t as computeLegacyProductId, u as resolveMerchantId, v as FrakContextManager, w as DEEP_LINK_SCHEME, x as isFrakDeepLink, y as DeepLinkFallbackOptions, z as CompressedData } from "./computeLegacyProductId-b5cUWdAm.js";
3
+ import { _ as displayModal, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as ensureIdentity, h as getMerchantInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction, v as displayEmbeddedWallet } from "./siweAuthenticate-CnCZ7mok.js";
4
+ export { AppSpecificSsoMetadata, ClientLifecycleEvent, CompressedData, CompressedSsoData, Currency, DEEP_LINK_SCHEME, DebugInfoGatherer, DeepLinkFallbackOptions, DisplayEmbeddedWalletParamsType, DisplayEmbeddedWalletResultType, DisplayModalParamsType, EmbeddedViewActionReferred, EmbeddedViewActionSharing, EstimatedReward, FinalActionType, FinalModalStepType, FrakClient, FrakContext, FrakContextManager, FrakContextV1, FrakContextV2, FrakEvent, FrakLifecycleEvent, FrakWalletSdkConfig, FullSsoParams, GetMerchantInformationReturnType, HashProtectedData, I18nConfig, IFrameLifecycleEvent, IFrameRpcSchema, IFrameTransport, InteractionTypeKey, KeyProvider, Language, LocalesKey, LocalizedI18nConfig, LoggedInEmbeddedView, LoggedOutEmbeddedView, LoginModalStepType, ModalBuilder, ModalRpcMetadata, ModalRpcStepsInput, ModalRpcStepsResultType, ModalStepBuilder, ModalStepMetadata, ModalStepTypes, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, PrepareSsoReturnType, ProcessReferralOptions, RewardTier, SendInteractionParamsType, SendTransactionModalStepType, SendTransactionParams, SendTransactionReturnType, SendTransactionTxType, SiweAuthenticateModalParams, SiweAuthenticateModalStepType, SiweAuthenticateReturnType, SiweAuthenticationParams, SsoMetadata, TokenAmountType, TrackArrivalParams, TrackArrivalResult, UtmParams, WalletStatusReturnType, base64urlDecode, base64urlEncode, baseIframeProps, clearMerchantIdCache, compressJsonToB64, computeLegacyProductId, createIFrameFrakClient, createIframe, decompressJsonFromB64, displayEmbeddedWallet, displayModal, ensureIdentity, fetchMerchantId, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getMerchantInformation, getSupportedCurrency, getSupportedLocale, isChromiumAndroid, isFrakDeepLink, isV1Context, isV2Context, locales, modalBuilder, openSso, prepareSso, processReferral, referralInteraction, resolveMerchantId, sendInteraction, sendTransaction, setupClient, siweAuthenticate, ssoPopupFeatures, ssoPopupName, toAndroidIntentUrl, trackEvent, trackPurchaseStatus, triggerDeepLinkWithFallback, watchWalletStatus };
package/dist/bundle.js CHANGED
@@ -1 +1 @@
1
- import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./trackEvent-CHnYa85W.js";import{a as l,c as u,d,f,i as p,l as m,n as h,o as g,r as _,s as v,t as y,u as b}from"./src-1LQ4eLq5.js";import{n as x,r as S,t as C}from"./productTypes-CGb1MmBF.js";import{a as w,c as T,d as E,f as D,i as O,l as k,n as A,o as j,r as M,s as N,t as P,u as F}from"./actions-q090Z0oR.js";import{a as I,i as L,n as R,r as z,t as B}from"./interactions-DnfM3oe0.js";export{f as DebugInfoGatherer,i as FrakContextManager,I as PressInteractionEncoder,L as PurchaseInteractionEncoder,z as ReferralInteractionEncoder,R as RetailInteractionEncoder,B as WebShopInteractionEncoder,t as base64urlDecode,r as base64urlEncode,m as baseIframeProps,s as compressJsonToB64,u as createIFrameFrakClient,b as createIframe,v as decompressJsonFromB64,D as displayEmbeddedWallet,E as displayModal,d as findIframeInOpener,_ as formatAmount,a as generateSsoUrl,h as getCurrencyAmountKey,F as getProductInformation,l as getSupportedCurrency,p as getSupportedLocale,S as interactionTypes,g as locales,M as modalBuilder,o as openSso,k as prepareSso,T as processReferral,C as productTypes,x as productTypesMask,N as referralInteraction,j as sendInteraction,A as sendTransaction,y as setupClient,P as siweAuthenticate,n as ssoPopupFeatures,e as ssoPopupName,c as trackEvent,w as trackPurchaseStatus,O as watchWalletStatus};
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,n as u,o as d,p as f,r as p,s as m,t as h,u as g,v as _}from"./trackEvent-CeLFVzZn.js";import{a as v,c as y,d as b,f as x,g as S,h as C,i as w,l as T,m as E,n as D,o as O,p as k,r as A,s as j,t as M,u as N}from"./setupClient-BICl5fdX.js";import{a as P,c as F,d as I,f as L,i as R,l as z,n as B,o as V,p as H,r as U,s as W,t as G,u as K}from"./siweAuthenticate-zczqxm0a.js";export{S as DEEP_LINK_SCHEME,A as DebugInfoGatherer,t as FrakContextManager,o as base64urlDecode,a as base64urlEncode,w as baseIframeProps,u as clearMerchantIdCache,l as compressJsonToB64,e as computeLegacyProductId,D as createIFrameFrakClient,v as createIframe,n as decompressJsonFromB64,H as displayEmbeddedWallet,L as displayModal,I as ensureIdentity,p as fetchMerchantId,O as findIframeInOpener,y as formatAmount,f as generateSsoUrl,c as getBackendUrl,_ as getClientId,j as getCurrencyAmountKey,K as getMerchantInformation,N as getSupportedCurrency,T as getSupportedLocale,x as isChromiumAndroid,k as isFrakDeepLink,d as isV1Context,m as isV2Context,b as locales,U as modalBuilder,g as openSso,z as prepareSso,W as processReferral,V as referralInteraction,s as resolveMerchantId,F as sendInteraction,B as sendTransaction,M as setupClient,G as siweAuthenticate,r as ssoPopupFeatures,i as ssoPopupName,E as toAndroidIntentUrl,h as trackEvent,P as trackPurchaseStatus,C as triggerDeepLinkWithFallback,R as watchWalletStatus};