@frak-labs/core-sdk 0.1.1-beta.6c24a72f → 0.1.1-beta.caa04eda
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/README.md +58 -0
- package/cdn/bundle.js +1 -1
- package/dist/actions.d.cts +2 -2
- package/dist/actions.d.ts +2 -2
- package/dist/bundle.cjs +1 -1
- package/dist/bundle.d.cts +3 -3
- package/dist/bundle.d.ts +3 -3
- package/dist/bundle.js +1 -1
- package/dist/{computeLegacyProductId-BB2XwoJJ.d.ts → computeLegacyProductId-DwVnZDGV.d.ts} +21 -3
- package/dist/{computeLegacyProductId-Ce84telU.d.cts → computeLegacyProductId-Qt-DXyeo.d.cts} +21 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{openSso-oAGMkQ4T.d.cts → openSso-CC1-loUk.d.cts} +6 -0
- package/dist/{openSso-ocIfOlv6.d.ts → openSso-tkqaDQLV.d.ts} +6 -0
- package/dist/setupClient-BjIbK6XJ.cjs +13 -0
- package/dist/{setupClient-DS3T5LNS.js → setupClient-D_HId3e2.js} +1 -1
- package/dist/{siweAuthenticate-DP0y5LIx.d.ts → siweAuthenticate-BC-2Nm4i.d.cts} +9 -1
- package/dist/{siweAuthenticate-D5lp5sdP.d.cts → siweAuthenticate-DnLK9fre.d.ts} +9 -1
- package/package.json +2 -2
- package/src/actions/displayEmbeddedWallet.ts +1 -0
- package/src/actions/getMerchantInformation.ts +7 -0
- package/src/clients/createIFrameFrakClient.ts +3 -1
- package/src/clients/transports/iframeLifecycleManager.ts +15 -3
- package/src/types/lifecycle/client.ts +6 -0
- package/src/utils/formatAmount.ts +6 -0
- package/src/utils/sso.ts +2 -1
- package/src/utils/trackEvent.ts +10 -0
- package/dist/setupClient-CudGNb4Q.cjs +0 -13
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
CHANGED
|
@@ -11,4 +11,4 @@ var FrakSDK=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Modu
|
|
|
11
11
|
Last Response: ${t.lastResponse}
|
|
12
12
|
Client Status: ${t.clientStatus}
|
|
13
13
|
Error: ${t.error}
|
|
14
|
-
`.trim()}};function Et(e){e?localStorage.setItem(U,e):localStorage.removeItem(U)}function Dt(e,t,n){let
|
|
14
|
+
`.trim()}};function Et(e){e?localStorage.setItem(U,e):localStorage.removeItem(U)}function Dt(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:F(),pendingMergeToken:a,configDomain:r}},n),a&&(i.searchParams.delete(`fmt`),window.history.replaceState({},``,i.toString()))}function Ot(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 kt(e,t,n,r){let i=Ot(t,r);W(t)?We(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}}):window.location.href=i}function At({iframe:e,targetOrigin:t,configDomain:n}){let r=new R;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`:Et(o.backup);break;case`remove-backup`:localStorage.removeItem(U);break;case`show`:case`hide`:tt({iframe:e,isVisible:a===`show`});break;case`handshake`:Dt(e,o.token,t,n);break;case`redirect`:kt(e,o.baseRedirectUrl,t,o.mergeToken);break}},isConnected:r.promise}}function jt({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=At({iframe:t,targetOrigin:n,configDomain:e.domain}),i=new Tt(e,t);if(!t.contentWindow)throw new L(I.configError,`The iframe does not have a content window`);let a=Oe({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await r.isConnected)throw new L(I.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=Mt(a,r),s=async()=>{o(),a.cleanup(),t.remove()},c;console.log(`[Frak SDK] Initializing OpenPanel`),c=new Ct({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=Nt({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 Mt(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 Nt({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,wt(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(U);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([r(),i(),a()])}async function Pt({config:e}){let t=Ft(e),n=await et({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=jt({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function Ft(e){let t=J(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}return e.DEEP_LINK_SCHEME=Ve,e.DebugInfoGatherer=Tt,e.FrakContextManager=K,e.base64urlDecode=B,e.base64urlEncode=z,e.baseIframeProps=Y,e.clearMerchantIdCache=at,e.compressJsonToB64=V,e.computeLegacyProductId=M,e.createIFrameFrakClient=jt,e.createIframe=et,e.decompressJsonFromB64=Be,e.displayEmbeddedWallet=n,e.displayModal=r,e.fetchMerchantId=rt,e.findIframeInOpener=nt,e.formatAmount=Qe,e.generateSsoUrl=je,e.getBackendUrl=H,e.getClientId=F,e.getCurrencyAmountKey=$e,e.getMerchantInformation=i,e.getSupportedCurrency=J,e.getSupportedLocale=Ze,e.isChromiumAndroid=He,e.isFrakDeepLink=W,e.locales=q,e.modalBuilder=gt,e.openSso=Fe,e.prepareSso=Ie,e.processReferral=ct,e.referralInteraction=ft,e.resolveMerchantId=ot,e.sendInteraction=st,e.sendTransaction=_t,e.setupClient=Pt,e.siweAuthenticate=yt,e.ssoPopupFeatures=Ne,e.ssoPopupName=Pe,e.toAndroidIntentUrl=Ue,e.trackEvent=Q,e.trackPurchaseStatus=pt,e.triggerDeepLinkWithFallback=We,e.watchWalletStatus=mt,e})({});
|
package/dist/actions.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as openSso } from "./openSso-
|
|
2
|
-
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, 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 } from "./siweAuthenticate-
|
|
1
|
+
import { t as openSso } from "./openSso-CC1-loUk.cjs";
|
|
2
|
+
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, 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 } from "./siweAuthenticate-BC-2Nm4i.cjs";
|
|
3
3
|
export { type ModalBuilder, type ModalStepBuilder, type ProcessReferralOptions, type SendTransactionParams, type SiweAuthenticateModalParams, displayEmbeddedWallet, displayModal, 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-
|
|
2
|
-
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, 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 } from "./siweAuthenticate-
|
|
1
|
+
import { t as openSso } from "./openSso-tkqaDQLV.js";
|
|
2
|
+
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, 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 } from "./siweAuthenticate-DnLK9fre.js";
|
|
3
3
|
export { type ModalBuilder, type ModalStepBuilder, type ProcessReferralOptions, type SendTransactionParams, type SiweAuthenticateModalParams, displayEmbeddedWallet, displayModal, getMerchantInformation, modalBuilder, openSso, prepareSso, processReferral, referralInteraction, sendInteraction, sendTransaction, siweAuthenticate, trackPurchaseStatus, watchWalletStatus };
|
package/dist/bundle.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./trackEvent-CGIryq5h.cjs`),t=require(`./setupClient-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./trackEvent-CGIryq5h.cjs`),t=require(`./setupClient-BjIbK6XJ.cjs`),n=require(`./siweAuthenticate-B_Z2OZmj.cjs`);exports.DEEP_LINK_SCHEME=t.b,exports.DebugInfoGatherer=t.y,exports.FrakContextManager=e.n,exports.base64urlDecode=e.l,exports.base64urlEncode=e.u,exports.baseIframeProps=t.f,exports.clearMerchantIdCache=t.n,exports.compressJsonToB64=e.c,exports.computeLegacyProductId=e.f,exports.createIFrameFrakClient=t.d,exports.createIframe=t.p,exports.decompressJsonFromB64=t.u,exports.displayEmbeddedWallet=n.f,exports.displayModal=n.d,exports.fetchMerchantId=t.r,exports.findIframeInOpener=t.m,exports.formatAmount=t.o,exports.generateSsoUrl=e.s,exports.getBackendUrl=e.r,exports.getClientId=e.d,exports.getCurrencyAmountKey=t.a,exports.getMerchantInformation=n.u,exports.getSupportedCurrency=t.c,exports.getSupportedLocale=t.s,exports.isChromiumAndroid=t.h,exports.isFrakDeepLink=t.g,exports.locales=t.l,exports.modalBuilder=n.r,exports.openSso=e.i,exports.prepareSso=n.l,exports.processReferral=n.s,exports.referralInteraction=n.o,exports.resolveMerchantId=t.i,exports.sendInteraction=n.c,exports.sendTransaction=n.n,exports.setupClient=t.t,exports.siweAuthenticate=n.t,exports.ssoPopupFeatures=e.a,exports.ssoPopupName=e.o,exports.toAndroidIntentUrl=t._,exports.trackEvent=e.t,exports.trackPurchaseStatus=n.a,exports.triggerDeepLinkWithFallback=t.v,exports.watchWalletStatus=n.i;
|
package/dist/bundle.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as SiweAuthenticateReturnType, B as ModalStepMetadata, C as ModalRpcStepsInput, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, G as FrakWalletSdkConfig, H as IFrameLifecycleEvent, I as PrepareSsoReturnType, J as LocalizedI18nConfig, K as I18nConfig, L as SsoMetadata, M as LoginModalStepType, N as OpenSsoParamsType, O as SendTransactionTxType, P as OpenSsoReturnType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, U as ClientLifecycleEvent, V as InteractionTypeKey, W as Currency, _ as LoggedOutEmbeddedView, a as FrakClient, b as LoggedInEmbeddedView, c as IFrameRpcSchema, d as GetMerchantInformationReturnType, f as RewardTier, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, k as SiweAuthenticateModalStepType, l as WalletStatusReturnType, m as SendInteractionParamsType, n as ssoPopupFeatures, o as FrakLifecycleEvent, p as TokenAmountType, q as Language, r as ssoPopupName, s as IFrameTransport, t as openSso, u as EstimatedReward, v as EmbeddedViewActionReferred, w as ModalRpcStepsResultType, x as DisplayModalParamsType, y as EmbeddedViewActionSharing, z as FinalModalStepType } from "./openSso-
|
|
2
|
-
import { A as getBackendUrl, B as CompressedData, C as triggerDeepLinkWithFallback, D as base64urlDecode, E as compressJsonToB64, F as createIFrameFrakClient, H as KeyProvider, I as TrackArrivalInternalParams, L as TrackArrivalParams, M as locales, N as setupClient, O as base64urlEncode, P as DebugInfoGatherer, R as TrackArrivalResult, S as toAndroidIntentUrl, T as decompressJsonFromB64, V as HashProtectedData, _ 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 UtmParams } from "./computeLegacyProductId-
|
|
3
|
-
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, 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 } from "./siweAuthenticate-
|
|
1
|
+
import { A as SiweAuthenticateReturnType, B as ModalStepMetadata, C as ModalRpcStepsInput, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, G as FrakWalletSdkConfig, H as IFrameLifecycleEvent, I as PrepareSsoReturnType, J as LocalizedI18nConfig, K as I18nConfig, L as SsoMetadata, M as LoginModalStepType, N as OpenSsoParamsType, O as SendTransactionTxType, P as OpenSsoReturnType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, U as ClientLifecycleEvent, V as InteractionTypeKey, W as Currency, _ as LoggedOutEmbeddedView, a as FrakClient, b as LoggedInEmbeddedView, c as IFrameRpcSchema, d as GetMerchantInformationReturnType, f as RewardTier, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, k as SiweAuthenticateModalStepType, l as WalletStatusReturnType, m as SendInteractionParamsType, n as ssoPopupFeatures, o as FrakLifecycleEvent, p as TokenAmountType, q as Language, r as ssoPopupName, s as IFrameTransport, t as openSso, u as EstimatedReward, v as EmbeddedViewActionReferred, w as ModalRpcStepsResultType, x as DisplayModalParamsType, y as EmbeddedViewActionSharing, z as FinalModalStepType } from "./openSso-CC1-loUk.cjs";
|
|
2
|
+
import { A as getBackendUrl, B as CompressedData, C as triggerDeepLinkWithFallback, D as base64urlDecode, E as compressJsonToB64, F as createIFrameFrakClient, H as KeyProvider, I as TrackArrivalInternalParams, L as TrackArrivalParams, M as locales, N as setupClient, O as base64urlEncode, P as DebugInfoGatherer, R as TrackArrivalResult, S as toAndroidIntentUrl, T as decompressJsonFromB64, V as HashProtectedData, _ 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 UtmParams } from "./computeLegacyProductId-Qt-DXyeo.cjs";
|
|
3
|
+
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, 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 } from "./siweAuthenticate-BC-2Nm4i.cjs";
|
|
4
4
|
export { AppSpecificSsoMetadata, ClientLifecycleEvent, CompressedData, CompressedSsoData, Currency, DEEP_LINK_SCHEME, DebugInfoGatherer, DeepLinkFallbackOptions, DisplayEmbeddedWalletParamsType, DisplayEmbeddedWalletResultType, DisplayModalParamsType, EmbeddedViewActionReferred, EmbeddedViewActionSharing, EstimatedReward, FinalActionType, FinalModalStepType, FrakClient, FrakContext, FrakContextManager, 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, TrackArrivalInternalParams, TrackArrivalParams, TrackArrivalResult, UtmParams, WalletStatusReturnType, base64urlDecode, base64urlEncode, baseIframeProps, clearMerchantIdCache, compressJsonToB64, computeLegacyProductId, createIFrameFrakClient, createIframe, decompressJsonFromB64, displayEmbeddedWallet, displayModal, fetchMerchantId, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getMerchantInformation, getSupportedCurrency, getSupportedLocale, isChromiumAndroid, isFrakDeepLink, 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,4 +1,4 @@
|
|
|
1
|
-
import { A as SiweAuthenticateReturnType, B as ModalStepMetadata, C as ModalRpcStepsInput, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, G as FrakWalletSdkConfig, H as IFrameLifecycleEvent, I as PrepareSsoReturnType, J as LocalizedI18nConfig, K as I18nConfig, L as SsoMetadata, M as LoginModalStepType, N as OpenSsoParamsType, O as SendTransactionTxType, P as OpenSsoReturnType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, U as ClientLifecycleEvent, V as InteractionTypeKey, W as Currency, _ as LoggedOutEmbeddedView, a as FrakClient, b as LoggedInEmbeddedView, c as IFrameRpcSchema, d as GetMerchantInformationReturnType, f as RewardTier, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, k as SiweAuthenticateModalStepType, l as WalletStatusReturnType, m as SendInteractionParamsType, n as ssoPopupFeatures, o as FrakLifecycleEvent, p as TokenAmountType, q as Language, r as ssoPopupName, s as IFrameTransport, t as openSso, u as EstimatedReward, v as EmbeddedViewActionReferred, w as ModalRpcStepsResultType, x as DisplayModalParamsType, y as EmbeddedViewActionSharing, z as FinalModalStepType } from "./openSso-
|
|
2
|
-
import { A as getBackendUrl, B as CompressedData, C as triggerDeepLinkWithFallback, D as base64urlDecode, E as compressJsonToB64, F as createIFrameFrakClient, H as KeyProvider, I as TrackArrivalInternalParams, L as TrackArrivalParams, M as locales, N as setupClient, O as base64urlEncode, P as DebugInfoGatherer, R as TrackArrivalResult, S as toAndroidIntentUrl, T as decompressJsonFromB64, V as HashProtectedData, _ 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 UtmParams } from "./computeLegacyProductId-
|
|
3
|
-
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, 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 } from "./siweAuthenticate-
|
|
1
|
+
import { A as SiweAuthenticateReturnType, B as ModalStepMetadata, C as ModalRpcStepsInput, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, G as FrakWalletSdkConfig, H as IFrameLifecycleEvent, I as PrepareSsoReturnType, J as LocalizedI18nConfig, K as I18nConfig, L as SsoMetadata, M as LoginModalStepType, N as OpenSsoParamsType, O as SendTransactionTxType, P as OpenSsoReturnType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, U as ClientLifecycleEvent, V as InteractionTypeKey, W as Currency, _ as LoggedOutEmbeddedView, a as FrakClient, b as LoggedInEmbeddedView, c as IFrameRpcSchema, d as GetMerchantInformationReturnType, f as RewardTier, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, k as SiweAuthenticateModalStepType, l as WalletStatusReturnType, m as SendInteractionParamsType, n as ssoPopupFeatures, o as FrakLifecycleEvent, p as TokenAmountType, q as Language, r as ssoPopupName, s as IFrameTransport, t as openSso, u as EstimatedReward, v as EmbeddedViewActionReferred, w as ModalRpcStepsResultType, x as DisplayModalParamsType, y as EmbeddedViewActionSharing, z as FinalModalStepType } from "./openSso-tkqaDQLV.js";
|
|
2
|
+
import { A as getBackendUrl, B as CompressedData, C as triggerDeepLinkWithFallback, D as base64urlDecode, E as compressJsonToB64, F as createIFrameFrakClient, H as KeyProvider, I as TrackArrivalInternalParams, L as TrackArrivalParams, M as locales, N as setupClient, O as base64urlEncode, P as DebugInfoGatherer, R as TrackArrivalResult, S as toAndroidIntentUrl, T as decompressJsonFromB64, V as HashProtectedData, _ 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 UtmParams } from "./computeLegacyProductId-DwVnZDGV.js";
|
|
3
|
+
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, 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 } from "./siweAuthenticate-DnLK9fre.js";
|
|
4
4
|
export { AppSpecificSsoMetadata, ClientLifecycleEvent, CompressedData, CompressedSsoData, Currency, DEEP_LINK_SCHEME, DebugInfoGatherer, DeepLinkFallbackOptions, DisplayEmbeddedWalletParamsType, DisplayEmbeddedWalletResultType, DisplayModalParamsType, EmbeddedViewActionReferred, EmbeddedViewActionSharing, EstimatedReward, FinalActionType, FinalModalStepType, FrakClient, FrakContext, FrakContextManager, 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, TrackArrivalInternalParams, TrackArrivalParams, TrackArrivalResult, UtmParams, WalletStatusReturnType, base64urlDecode, base64urlEncode, baseIframeProps, clearMerchantIdCache, compressJsonToB64, computeLegacyProductId, createIFrameFrakClient, createIframe, decompressJsonFromB64, displayEmbeddedWallet, displayModal, fetchMerchantId, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getMerchantInformation, getSupportedCurrency, getSupportedLocale, isChromiumAndroid, isFrakDeepLink, 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,d as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./trackEvent-YfUh4jrx.js";import{_ as f,a as p,b as m,c as h,d as g,f as _,g as v,h as y,i as b,l as x,m as S,n as C,o as w,p as T,r as E,s as D,t as O,u as k,v as A,y as j}from"./setupClient-
|
|
1
|
+
import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./trackEvent-YfUh4jrx.js";import{_ as f,a as p,b as m,c as h,d as g,f as _,g as v,h as y,i as b,l as x,m as S,n as C,o as w,p as T,r as E,s as D,t as O,u as k,v as A,y as j}from"./setupClient-D_HId3e2.js";import{a as M,c as N,d as P,f as F,i as I,l as L,n as R,o as z,r as B,s as V,t as H,u as U}from"./siweAuthenticate-CQ4OfPuA.js";export{m as DEEP_LINK_SCHEME,j as DebugInfoGatherer,o as FrakContextManager,a as base64urlDecode,d as base64urlEncode,_ as baseIframeProps,C as clearMerchantIdCache,t as compressJsonToB64,r as computeLegacyProductId,g as createIFrameFrakClient,T as createIframe,k as decompressJsonFromB64,F as displayEmbeddedWallet,P as displayModal,E as fetchMerchantId,S as findIframeInOpener,w as formatAmount,l as generateSsoUrl,c as getBackendUrl,n as getClientId,p as getCurrencyAmountKey,U as getMerchantInformation,h as getSupportedCurrency,D as getSupportedLocale,y as isChromiumAndroid,v as isFrakDeepLink,x as locales,B as modalBuilder,i as openSso,L as prepareSso,V as processReferral,z as referralInteraction,b as resolveMerchantId,N as sendInteraction,R as sendTransaction,O as setupClient,H as siweAuthenticate,e as ssoPopupFeatures,s as ssoPopupName,f as toAndroidIntentUrl,u as trackEvent,M as trackPurchaseStatus,A as triggerDeepLinkWithFallback,I as watchWalletStatus};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as PrepareSsoParamsType, G as FrakWalletSdkConfig, L as SsoMetadata, W as Currency, a as FrakClient, i as FrakContext, p as TokenAmountType } from "./openSso-
|
|
1
|
+
import { F as PrepareSsoParamsType, G as FrakWalletSdkConfig, L as SsoMetadata, W as Currency, a as FrakClient, i as FrakContext, p as TokenAmountType } from "./openSso-tkqaDQLV.js";
|
|
2
2
|
import { Address, Hex } from "viem";
|
|
3
3
|
import { RpcMessage, RpcResponse } from "@frak-labs/frame-connector";
|
|
4
4
|
|
|
@@ -78,7 +78,8 @@ type TrackArrivalInternalParams = TrackArrivalParams & {
|
|
|
78
78
|
/**
|
|
79
79
|
* Create a new iframe Frak client
|
|
80
80
|
* @param args
|
|
81
|
-
* @param args.config - The configuration to use for the Frak Wallet SDK
|
|
81
|
+
* @param args.config - The configuration to use for the Frak Wallet SDK.
|
|
82
|
+
* When `config.domain` is set, it is forwarded to the iframe handshake so the listener resolves the correct merchant in tunneled/proxied environments (e.g. Shopify dev with Cloudflare tunnel).
|
|
82
83
|
* @param args.iframe - The iframe to use for the communication
|
|
83
84
|
* @returns The created Frak Client
|
|
84
85
|
*
|
|
@@ -333,6 +334,12 @@ declare const FrakContextManager: {
|
|
|
333
334
|
};
|
|
334
335
|
//#endregion
|
|
335
336
|
//#region src/utils/formatAmount.d.ts
|
|
337
|
+
/**
|
|
338
|
+
* Format a numeric amount as a localized currency string
|
|
339
|
+
* @param amount - The raw numeric amount to format
|
|
340
|
+
* @param currency - Optional currency config; defaults to EUR/fr-FR when omitted
|
|
341
|
+
* @returns Localized currency string (e.g. "1 500 €", "$1,500")
|
|
342
|
+
*/
|
|
336
343
|
declare function formatAmount(amount: number, currency?: Currency): string;
|
|
337
344
|
//#endregion
|
|
338
345
|
//#region src/utils/getCurrencyAmountKey.d.ts
|
|
@@ -471,9 +478,10 @@ type FullSsoParams = Omit<PrepareSsoParamsType, "metadata"> & {
|
|
|
471
478
|
*
|
|
472
479
|
* @param walletUrl - Base wallet URL (e.g., "https://wallet.frak.id")
|
|
473
480
|
* @param params - SSO parameters
|
|
474
|
-
* @param
|
|
481
|
+
* @param merchantId - Merchant identifier
|
|
475
482
|
* @param name - Application name
|
|
476
483
|
* @param css - Optional custom CSS
|
|
484
|
+
* @param clientId - Optional client identifier (auto-generated if omitted)
|
|
477
485
|
* @returns Complete SSO URL ready to open in popup or redirect
|
|
478
486
|
*
|
|
479
487
|
* @example
|
|
@@ -507,8 +515,18 @@ type CompressedSsoData = {
|
|
|
507
515
|
};
|
|
508
516
|
//#endregion
|
|
509
517
|
//#region src/utils/trackEvent.d.ts
|
|
518
|
+
/**
|
|
519
|
+
* Analytics event names emitted by the SDK
|
|
520
|
+
*/
|
|
510
521
|
type FrakEvent = "share_button_clicked" | "wallet_button_clicked" | "open_in_app_clicked" | "open_in_app_login_clicked" | "app_not_installed" | "share_modal_error" | "user_referred_started" | "user_referred_completed" | "user_referred_error";
|
|
511
522
|
type EventProps = Record<string, unknown>;
|
|
523
|
+
/**
|
|
524
|
+
* Track an analytics event via OpenPanel.
|
|
525
|
+
* Fire-and-forget: silently catches errors.
|
|
526
|
+
* @param client - The Frak client instance (no-op if undefined)
|
|
527
|
+
* @param event - The event name to track
|
|
528
|
+
* @param props - Optional event properties
|
|
529
|
+
*/
|
|
512
530
|
declare function trackEvent(client: FrakClient | undefined, event: FrakEvent, props?: EventProps): void;
|
|
513
531
|
//#endregion
|
|
514
532
|
//#region src/utils/computeLegacyProductId.d.ts
|
package/dist/{computeLegacyProductId-Ce84telU.d.cts → computeLegacyProductId-Qt-DXyeo.d.cts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as PrepareSsoParamsType, G as FrakWalletSdkConfig, L as SsoMetadata, W as Currency, a as FrakClient, i as FrakContext, p as TokenAmountType } from "./openSso-
|
|
1
|
+
import { F as PrepareSsoParamsType, G as FrakWalletSdkConfig, L as SsoMetadata, W as Currency, a as FrakClient, i as FrakContext, p as TokenAmountType } from "./openSso-CC1-loUk.cjs";
|
|
2
2
|
import { RpcMessage, RpcResponse } from "@frak-labs/frame-connector";
|
|
3
3
|
import { Address, Hex } from "viem";
|
|
4
4
|
|
|
@@ -78,7 +78,8 @@ type TrackArrivalInternalParams = TrackArrivalParams & {
|
|
|
78
78
|
/**
|
|
79
79
|
* Create a new iframe Frak client
|
|
80
80
|
* @param args
|
|
81
|
-
* @param args.config - The configuration to use for the Frak Wallet SDK
|
|
81
|
+
* @param args.config - The configuration to use for the Frak Wallet SDK.
|
|
82
|
+
* When `config.domain` is set, it is forwarded to the iframe handshake so the listener resolves the correct merchant in tunneled/proxied environments (e.g. Shopify dev with Cloudflare tunnel).
|
|
82
83
|
* @param args.iframe - The iframe to use for the communication
|
|
83
84
|
* @returns The created Frak Client
|
|
84
85
|
*
|
|
@@ -333,6 +334,12 @@ declare const FrakContextManager: {
|
|
|
333
334
|
};
|
|
334
335
|
//#endregion
|
|
335
336
|
//#region src/utils/formatAmount.d.ts
|
|
337
|
+
/**
|
|
338
|
+
* Format a numeric amount as a localized currency string
|
|
339
|
+
* @param amount - The raw numeric amount to format
|
|
340
|
+
* @param currency - Optional currency config; defaults to EUR/fr-FR when omitted
|
|
341
|
+
* @returns Localized currency string (e.g. "1 500 €", "$1,500")
|
|
342
|
+
*/
|
|
336
343
|
declare function formatAmount(amount: number, currency?: Currency): string;
|
|
337
344
|
//#endregion
|
|
338
345
|
//#region src/utils/getCurrencyAmountKey.d.ts
|
|
@@ -471,9 +478,10 @@ type FullSsoParams = Omit<PrepareSsoParamsType, "metadata"> & {
|
|
|
471
478
|
*
|
|
472
479
|
* @param walletUrl - Base wallet URL (e.g., "https://wallet.frak.id")
|
|
473
480
|
* @param params - SSO parameters
|
|
474
|
-
* @param
|
|
481
|
+
* @param merchantId - Merchant identifier
|
|
475
482
|
* @param name - Application name
|
|
476
483
|
* @param css - Optional custom CSS
|
|
484
|
+
* @param clientId - Optional client identifier (auto-generated if omitted)
|
|
477
485
|
* @returns Complete SSO URL ready to open in popup or redirect
|
|
478
486
|
*
|
|
479
487
|
* @example
|
|
@@ -507,8 +515,18 @@ type CompressedSsoData = {
|
|
|
507
515
|
};
|
|
508
516
|
//#endregion
|
|
509
517
|
//#region src/utils/trackEvent.d.ts
|
|
518
|
+
/**
|
|
519
|
+
* Analytics event names emitted by the SDK
|
|
520
|
+
*/
|
|
510
521
|
type FrakEvent = "share_button_clicked" | "wallet_button_clicked" | "open_in_app_clicked" | "open_in_app_login_clicked" | "app_not_installed" | "share_modal_error" | "user_referred_started" | "user_referred_completed" | "user_referred_error";
|
|
511
522
|
type EventProps = Record<string, unknown>;
|
|
523
|
+
/**
|
|
524
|
+
* Track an analytics event via OpenPanel.
|
|
525
|
+
* Fire-and-forget: silently catches errors.
|
|
526
|
+
* @param client - The Frak client instance (no-op if undefined)
|
|
527
|
+
* @param event - The event name to track
|
|
528
|
+
* @param props - Optional event properties
|
|
529
|
+
*/
|
|
512
530
|
declare function trackEvent(client: FrakClient | undefined, event: FrakEvent, props?: EventProps): void;
|
|
513
531
|
//#endregion
|
|
514
532
|
//#region src/utils/computeLegacyProductId.d.ts
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./trackEvent-CGIryq5h.cjs`),t=require(`./setupClient-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./trackEvent-CGIryq5h.cjs`),t=require(`./setupClient-BjIbK6XJ.cjs`);exports.DEEP_LINK_SCHEME=t.b,exports.DebugInfoGatherer=t.y,exports.FrakContextManager=e.n,exports.base64urlDecode=e.l,exports.base64urlEncode=e.u,exports.baseIframeProps=t.f,exports.clearMerchantIdCache=t.n,exports.compressJsonToB64=e.c,exports.computeLegacyProductId=e.f,exports.createIFrameFrakClient=t.d,exports.createIframe=t.p,exports.decompressJsonFromB64=t.u,exports.fetchMerchantId=t.r,exports.findIframeInOpener=t.m,exports.formatAmount=t.o,exports.generateSsoUrl=e.s,exports.getBackendUrl=e.r,exports.getClientId=e.d,exports.getCurrencyAmountKey=t.a,exports.getSupportedCurrency=t.c,exports.getSupportedLocale=t.s,exports.isChromiumAndroid=t.h,exports.isFrakDeepLink=t.g,exports.locales=t.l,exports.resolveMerchantId=t.i,exports.setupClient=t.t,exports.ssoPopupFeatures=e.a,exports.ssoPopupName=e.o,exports.toAndroidIntentUrl=t._,exports.trackEvent=e.t,exports.triggerDeepLinkWithFallback=t.v;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as SiweAuthenticateReturnType, B as ModalStepMetadata, C as ModalRpcStepsInput, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, G as FrakWalletSdkConfig, H as IFrameLifecycleEvent, I as PrepareSsoReturnType, J as LocalizedI18nConfig, K as I18nConfig, L as SsoMetadata, M as LoginModalStepType, N as OpenSsoParamsType, O as SendTransactionTxType, P as OpenSsoReturnType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, U as ClientLifecycleEvent, V as InteractionTypeKey, W as Currency, _ as LoggedOutEmbeddedView, a as FrakClient, b as LoggedInEmbeddedView, c as IFrameRpcSchema, d as GetMerchantInformationReturnType, f as RewardTier, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, k as SiweAuthenticateModalStepType, l as WalletStatusReturnType, m as SendInteractionParamsType, n as ssoPopupFeatures, o as FrakLifecycleEvent, p as TokenAmountType, q as Language, r as ssoPopupName, s as IFrameTransport, u as EstimatedReward, v as EmbeddedViewActionReferred, w as ModalRpcStepsResultType, x as DisplayModalParamsType, y as EmbeddedViewActionSharing, z as FinalModalStepType } from "./openSso-
|
|
2
|
-
import { A as getBackendUrl, B as CompressedData, C as triggerDeepLinkWithFallback, D as base64urlDecode, E as compressJsonToB64, F as createIFrameFrakClient, H as KeyProvider, I as TrackArrivalInternalParams, L as TrackArrivalParams, M as locales, N as setupClient, O as base64urlEncode, P as DebugInfoGatherer, R as TrackArrivalResult, S as toAndroidIntentUrl, T as decompressJsonFromB64, V as HashProtectedData, _ 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 UtmParams } from "./computeLegacyProductId-
|
|
1
|
+
import { A as SiweAuthenticateReturnType, B as ModalStepMetadata, C as ModalRpcStepsInput, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, G as FrakWalletSdkConfig, H as IFrameLifecycleEvent, I as PrepareSsoReturnType, J as LocalizedI18nConfig, K as I18nConfig, L as SsoMetadata, M as LoginModalStepType, N as OpenSsoParamsType, O as SendTransactionTxType, P as OpenSsoReturnType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, U as ClientLifecycleEvent, V as InteractionTypeKey, W as Currency, _ as LoggedOutEmbeddedView, a as FrakClient, b as LoggedInEmbeddedView, c as IFrameRpcSchema, d as GetMerchantInformationReturnType, f as RewardTier, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, k as SiweAuthenticateModalStepType, l as WalletStatusReturnType, m as SendInteractionParamsType, n as ssoPopupFeatures, o as FrakLifecycleEvent, p as TokenAmountType, q as Language, r as ssoPopupName, s as IFrameTransport, u as EstimatedReward, v as EmbeddedViewActionReferred, w as ModalRpcStepsResultType, x as DisplayModalParamsType, y as EmbeddedViewActionSharing, z as FinalModalStepType } from "./openSso-CC1-loUk.cjs";
|
|
2
|
+
import { A as getBackendUrl, B as CompressedData, C as triggerDeepLinkWithFallback, D as base64urlDecode, E as compressJsonToB64, F as createIFrameFrakClient, H as KeyProvider, I as TrackArrivalInternalParams, L as TrackArrivalParams, M as locales, N as setupClient, O as base64urlEncode, P as DebugInfoGatherer, R as TrackArrivalResult, S as toAndroidIntentUrl, T as decompressJsonFromB64, V as HashProtectedData, _ 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 UtmParams } from "./computeLegacyProductId-Qt-DXyeo.cjs";
|
|
3
3
|
export { type AppSpecificSsoMetadata, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type Currency, DEEP_LINK_SCHEME, DebugInfoGatherer, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakEvent, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type LocalesKey, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type RewardTier, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionReturnType, type SendTransactionTxType, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalInternalParams, type TrackArrivalParams, type TrackArrivalResult, type UtmParams, type WalletStatusReturnType, base64urlDecode, base64urlEncode, baseIframeProps, clearMerchantIdCache, compressJsonToB64, computeLegacyProductId, createIFrameFrakClient, createIframe, decompressJsonFromB64, fetchMerchantId, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getSupportedCurrency, getSupportedLocale, isChromiumAndroid, isFrakDeepLink, locales, resolveMerchantId, setupClient, ssoPopupFeatures, ssoPopupName, toAndroidIntentUrl, trackEvent, triggerDeepLinkWithFallback };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as SiweAuthenticateReturnType, B as ModalStepMetadata, C as ModalRpcStepsInput, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, G as FrakWalletSdkConfig, H as IFrameLifecycleEvent, I as PrepareSsoReturnType, J as LocalizedI18nConfig, K as I18nConfig, L as SsoMetadata, M as LoginModalStepType, N as OpenSsoParamsType, O as SendTransactionTxType, P as OpenSsoReturnType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, U as ClientLifecycleEvent, V as InteractionTypeKey, W as Currency, _ as LoggedOutEmbeddedView, a as FrakClient, b as LoggedInEmbeddedView, c as IFrameRpcSchema, d as GetMerchantInformationReturnType, f as RewardTier, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, k as SiweAuthenticateModalStepType, l as WalletStatusReturnType, m as SendInteractionParamsType, n as ssoPopupFeatures, o as FrakLifecycleEvent, p as TokenAmountType, q as Language, r as ssoPopupName, s as IFrameTransport, u as EstimatedReward, v as EmbeddedViewActionReferred, w as ModalRpcStepsResultType, x as DisplayModalParamsType, y as EmbeddedViewActionSharing, z as FinalModalStepType } from "./openSso-
|
|
2
|
-
import { A as getBackendUrl, B as CompressedData, C as triggerDeepLinkWithFallback, D as base64urlDecode, E as compressJsonToB64, F as createIFrameFrakClient, H as KeyProvider, I as TrackArrivalInternalParams, L as TrackArrivalParams, M as locales, N as setupClient, O as base64urlEncode, P as DebugInfoGatherer, R as TrackArrivalResult, S as toAndroidIntentUrl, T as decompressJsonFromB64, V as HashProtectedData, _ 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 UtmParams } from "./computeLegacyProductId-
|
|
1
|
+
import { A as SiweAuthenticateReturnType, B as ModalStepMetadata, C as ModalRpcStepsInput, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, G as FrakWalletSdkConfig, H as IFrameLifecycleEvent, I as PrepareSsoReturnType, J as LocalizedI18nConfig, K as I18nConfig, L as SsoMetadata, M as LoginModalStepType, N as OpenSsoParamsType, O as SendTransactionTxType, P as OpenSsoReturnType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, U as ClientLifecycleEvent, V as InteractionTypeKey, W as Currency, _ as LoggedOutEmbeddedView, a as FrakClient, b as LoggedInEmbeddedView, c as IFrameRpcSchema, d as GetMerchantInformationReturnType, f as RewardTier, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, k as SiweAuthenticateModalStepType, l as WalletStatusReturnType, m as SendInteractionParamsType, n as ssoPopupFeatures, o as FrakLifecycleEvent, p as TokenAmountType, q as Language, r as ssoPopupName, s as IFrameTransport, u as EstimatedReward, v as EmbeddedViewActionReferred, w as ModalRpcStepsResultType, x as DisplayModalParamsType, y as EmbeddedViewActionSharing, z as FinalModalStepType } from "./openSso-tkqaDQLV.js";
|
|
2
|
+
import { A as getBackendUrl, B as CompressedData, C as triggerDeepLinkWithFallback, D as base64urlDecode, E as compressJsonToB64, F as createIFrameFrakClient, H as KeyProvider, I as TrackArrivalInternalParams, L as TrackArrivalParams, M as locales, N as setupClient, O as base64urlEncode, P as DebugInfoGatherer, R as TrackArrivalResult, S as toAndroidIntentUrl, T as decompressJsonFromB64, V as HashProtectedData, _ 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 UtmParams } from "./computeLegacyProductId-DwVnZDGV.js";
|
|
3
3
|
export { type AppSpecificSsoMetadata, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type Currency, DEEP_LINK_SCHEME, DebugInfoGatherer, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakEvent, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type LocalesKey, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type RewardTier, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionReturnType, type SendTransactionTxType, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalInternalParams, type TrackArrivalParams, type TrackArrivalResult, type UtmParams, type WalletStatusReturnType, base64urlDecode, base64urlEncode, baseIframeProps, clearMerchantIdCache, compressJsonToB64, computeLegacyProductId, createIFrameFrakClient, createIframe, decompressJsonFromB64, fetchMerchantId, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getSupportedCurrency, getSupportedLocale, isChromiumAndroid, isFrakDeepLink, locales, resolveMerchantId, setupClient, ssoPopupFeatures, ssoPopupName, toAndroidIntentUrl, trackEvent, triggerDeepLinkWithFallback };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,d as n,f as r,l as i,n as a,o,r as s,s as c,t as l,u}from"./trackEvent-YfUh4jrx.js";import{_ as d,a as f,b as p,c as m,d as h,f as g,g as _,h as v,i as y,l as b,m as x,n as S,o as C,p as w,r as T,s as E,t as D,u as O,v as k,y as A}from"./setupClient-
|
|
1
|
+
import{a as e,c as t,d as n,f as r,l as i,n as a,o,r as s,s as c,t as l,u}from"./trackEvent-YfUh4jrx.js";import{_ as d,a as f,b as p,c as m,d as h,f as g,g as _,h as v,i as y,l as b,m as x,n as S,o as C,p as w,r as T,s as E,t as D,u as O,v as k,y as A}from"./setupClient-D_HId3e2.js";export{p as DEEP_LINK_SCHEME,A as DebugInfoGatherer,a as FrakContextManager,i as base64urlDecode,u as base64urlEncode,g as baseIframeProps,S as clearMerchantIdCache,t as compressJsonToB64,r as computeLegacyProductId,h as createIFrameFrakClient,w as createIframe,O as decompressJsonFromB64,T as fetchMerchantId,x as findIframeInOpener,C as formatAmount,c as generateSsoUrl,s as getBackendUrl,n as getClientId,f as getCurrencyAmountKey,m as getSupportedCurrency,E as getSupportedLocale,v as isChromiumAndroid,_ as isFrakDeepLink,b as locales,y as resolveMerchantId,D as setupClient,e as ssoPopupFeatures,o as ssoPopupName,d as toAndroidIntentUrl,l as trackEvent,k as triggerDeepLinkWithFallback};
|
|
@@ -162,6 +162,12 @@ type HandshakeResponse = {
|
|
|
162
162
|
* URL is cleaned after handshake response is sent
|
|
163
163
|
*/
|
|
164
164
|
pendingMergeToken?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Explicit domain from SDK config (FrakWalletSdkConfig.domain)
|
|
167
|
+
* When present, listener should prefer this over URL-derived domain
|
|
168
|
+
* for merchant resolution (handles proxied/tunneled environments)
|
|
169
|
+
*/
|
|
170
|
+
configDomain?: string;
|
|
165
171
|
};
|
|
166
172
|
};
|
|
167
173
|
type SsoRedirectCompleteEvent = {
|
|
@@ -162,6 +162,12 @@ type HandshakeResponse = {
|
|
|
162
162
|
* URL is cleaned after handshake response is sent
|
|
163
163
|
*/
|
|
164
164
|
pendingMergeToken?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Explicit domain from SDK config (FrakWalletSdkConfig.domain)
|
|
167
|
+
* When present, listener should prefer this over URL-derived domain
|
|
168
|
+
* for merchant resolution (handles proxied/tunneled environments)
|
|
169
|
+
*/
|
|
170
|
+
configDomain?: string;
|
|
165
171
|
};
|
|
166
172
|
};
|
|
167
173
|
type SsoRedirectCompleteEvent = {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const e=require(`./trackEvent-CGIryq5h.cjs`);let t=require(`@frak-labs/frame-connector`),n=require(`@openpanel/web`);const r=`nexus-wallet-backup`,i=`frakwallet://`;function a(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 o=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 n=this.getIframeStatus(),r=this.getNavigatorInfo(),i=`Unknown`;return e instanceof t.FrakRpcError?i=`FrakRpcError: ${e.code} '${e.message}'`:e instanceof Error?i=e.message:typeof e==`string`&&(i=e),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):`no-config`,navigatorInfo:r?this.base64Encode(r):`no-navigator`,iframeStatus:n?this.base64Encode(n):`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:i}}static empty(){return new e}formatDebugInfo(e){let t=this.gatherDebugInfo(e);return`
|
|
2
|
+
Debug Information:
|
|
3
|
+
-----------------
|
|
4
|
+
Timestamp: ${t.timestamp}
|
|
5
|
+
URL: ${t.encodedUrl}
|
|
6
|
+
Config: ${t.encodedConfig}
|
|
7
|
+
Navigator Info: ${t.navigatorInfo}
|
|
8
|
+
IFrame Status: ${t.iframeStatus}
|
|
9
|
+
Last Request: ${t.lastRequest}
|
|
10
|
+
Last Response: ${t.lastResponse}
|
|
11
|
+
Client Status: ${t.clientStatus}
|
|
12
|
+
Error: ${t.error}
|
|
13
|
+
`.trim()}};function s(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}function c(e){return`intent://${e.slice(13)}#Intent;scheme=frakwallet;package=id.frak.wallet;end`}function l(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=s()&&u(e)?c(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function u(e){return e.startsWith(i)}const d={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 f({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);return r.id=d.id,r.name=d.name,r.allow=d.allow,r.style.zIndex=d.style.zIndex.toString(),p({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 p({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 m(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 h(e){e?localStorage.setItem(r,e):localStorage.removeItem(r)}function g(t,n,r,i){let a=new URL(window.location.href),o=a.searchParams.get(`fmt`)??void 0;t.contentWindow?.postMessage({clientLifecycle:`handshake-response`,data:{token:n,currentUrl:window.location.href,clientId:e.d(),pendingMergeToken:o,configDomain:i}},r),o&&(a.searchParams.delete(`fmt`),window.history.replaceState({},``,a.toString()))}function _(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 v(e,t,n,r){let i=_(t,r);u(t)?l(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}}):window.location.href=i}function y({iframe:e,targetOrigin:n,configDomain:i}){let a=new t.Deferred;return{handleEvent:async t=>{if(!(`iframeLifecycle`in t))return;let{iframeLifecycle:o,data:s}=t;switch(o){case`connected`:a.resolve(!0);break;case`do-backup`:h(s.backup);break;case`remove-backup`:localStorage.removeItem(r);break;case`show`:case`hide`:p({iframe:e,isVisible:o===`show`});break;case`handshake`:g(e,s.token,n,i);break;case`redirect`:v(e,s.baseRedirectUrl,n,s.mergeToken);break}},isConnected:a.promise}}function b({config:e,iframe:r}){let i=e?.walletUrl??`https://wallet.frak.id`,a=y({iframe:r,targetOrigin:i,configDomain:e.domain}),s=new o(e,r);if(!r.contentWindow)throw new t.FrakRpcError(t.RpcErrorCodes.configError,`The iframe does not have a content window`);let c=(0,t.createRpcClient)({emittingTransport:r.contentWindow,listeningTransport:window,targetOrigin:i,middleware:[{async onRequest(e,n){if(!await a.isConnected)throw new t.FrakRpcError(t.RpcErrorCodes.clientNotConnected,`The iframe provider isn't connected yet`);return n}},{onRequest(e,t){return s.setLastRequest(e),t},onResponse(e,t){return s.setLastResponse(e,t),t}}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await a.handleEvent(e)}}}),l=x(c,a),u=async()=>{l(),c.cleanup(),r.remove()},d;console.log(`[Frak SDK] Initializing OpenPanel`),d=new n.OpenPanel({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)}),d.setGlobalProperties({sdkVersion:`0.1.1`}),d.init();let f=S({config:e,rpcClient:c,lifecycleManager:a}).then(()=>s.updateSetupStatus(!0));return{config:e,debugInfo:s,waitForConnection:a.isConnected,waitForSetup:f,request:c.request,listenerRequest:c.listen,destroy:u,openPanel:d}}function x(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 S({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,a(t,n.isConnected);async function i(){let n=e.customizations?.css;if(!n)return;let r={clientLifecycle:`modal-css`,data:{cssLink:n}};t.sendLifecycle(r)}async function o(){let n=e.customizations?.i18n;if(!n)return;let r={clientLifecycle:`modal-i18n`,data:{i18n:n}};t.sendLifecycle(r)}async function s(){if(typeof window>`u`)return;let e=window.localStorage.getItem(r);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([i(),o(),s()])}function C(n){return(0,t.jsonDecode)(e.l(n))}const w={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function T(e){return e&&e in w?e:`eur`}function E(e){return e?w[e]??w.eur:w.eur}function D(e,t){let n=E(t),r=T(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function O(e){return e?`${e}Amount`:`eurAmount`}let k,A;async function j(e,t){if(k)return k;if(A)return A;A=M(e,t);let n=await A;return A=void 0,n}async function M(t,n){let r=t??(typeof window<`u`?window.location.hostname:``);if(r)try{let t=e.r(n),i=await fetch(`${t}/user/merchant/resolve?domain=${encodeURIComponent(r)}`);if(!i.ok){console.warn(`[Frak SDK] Merchant lookup failed for domain ${r}: ${i.status}`);return}return k=(await i.json()).merchantId,k}catch(e){console.warn(`[Frak SDK] Failed to fetch merchantId:`,e);return}}function N(){k=void 0,A=void 0}async function P(e,t){return e.metadata?.merchantId?e.metadata.merchantId:j(void 0,t)}async function F({config:e}){let t=I(e),n=await f({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=b({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function I(e){let t=T(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return o}});
|
|
@@ -10,4 +10,4 @@ import{d as e,l as t,r as n}from"./trackEvent-YfUh4jrx.js";import{Deferred as r,
|
|
|
10
10
|
Last Response: ${t.lastResponse}
|
|
11
11
|
Client Status: ${t.clientStatus}
|
|
12
12
|
Error: ${t.error}
|
|
13
|
-
`.trim()}};function p(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}function m(e){return`intent://${e.slice(13)}#Intent;scheme=frakwallet;package=id.frak.wallet;end`}function h(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=p()&&g(e)?m(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function g(e){return e.startsWith(u)}const _={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 v({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);return r.id=_.id,r.name=_.name,r.allow=_.allow,r.style.zIndex=_.style.zIndex.toString(),y({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 y({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 b(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 x(e){e?localStorage.setItem(l,e):localStorage.removeItem(l)}function S(t,n,r){let
|
|
13
|
+
`.trim()}};function p(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}function m(e){return`intent://${e.slice(13)}#Intent;scheme=frakwallet;package=id.frak.wallet;end`}function h(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=p()&&g(e)?m(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function g(e){return e.startsWith(u)}const _={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 v({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);return r.id=_.id,r.name=_.name,r.allow=_.allow,r.style.zIndex=_.style.zIndex.toString(),y({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 y({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 b(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 x(e){e?localStorage.setItem(l,e):localStorage.removeItem(l)}function S(t,n,r,i){let a=new URL(window.location.href),o=a.searchParams.get(`fmt`)??void 0;t.contentWindow?.postMessage({clientLifecycle:`handshake-response`,data:{token:n,currentUrl:window.location.href,clientId:e(),pendingMergeToken:o,configDomain:i}},r),o&&(a.searchParams.delete(`fmt`),window.history.replaceState({},``,a.toString()))}function C(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 w(e,t,n,r){let i=C(t,r);g(t)?h(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}}):window.location.href=i}function T({iframe:e,targetOrigin:t,configDomain:n}){let i=new r;return{handleEvent:async r=>{if(!(`iframeLifecycle`in r))return;let{iframeLifecycle:a,data:o}=r;switch(a){case`connected`:i.resolve(!0);break;case`do-backup`:x(o.backup);break;case`remove-backup`:localStorage.removeItem(l);break;case`show`:case`hide`:y({iframe:e,isVisible:a===`show`});break;case`handshake`:S(e,o.token,t,n);break;case`redirect`:w(e,o.baseRedirectUrl,t,o.mergeToken);break}},isConnected:i.promise}}function E({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=T({iframe:t,targetOrigin:n,configDomain:e.domain}),s=new f(e,t);if(!t.contentWindow)throw new i(a.configError,`The iframe does not have a content window`);let l=o({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await r.isConnected)throw new i(a.clientNotConnected,`The iframe provider isn't connected yet`);return t}},{onRequest(e,t){return s.setLastRequest(e),t},onResponse(e,t){return s.setLastResponse(e,t),t}}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await r.handleEvent(e)}}}),u=D(l,r),d=async()=>{u(),l.cleanup(),t.remove()},p;console.log(`[Frak SDK] Initializing OpenPanel`),p=new c({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)}),p.setGlobalProperties({sdkVersion:`0.1.1`}),p.init();let m=O({config:e,rpcClient:l,lifecycleManager:r}).then(()=>s.updateSetupStatus(!0));return{config:e,debugInfo:s,waitForConnection:r.isConnected,waitForSetup:m,request:l.request,listenerRequest:l.listen,destroy:d,openPanel:p}}function D(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 O({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,d(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(l);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([r(),i(),a()])}function k(e){return s(t(e))}const A={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function j(e){return e&&e in A?e:`eur`}function M(e){return e?A[e]??A.eur:A.eur}function N(e,t){let n=M(t),r=j(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function P(e){return e?`${e}Amount`:`eurAmount`}let F,I;async function L(e,t){if(F)return F;if(I)return I;I=R(e,t);let n=await I;return I=void 0,n}async function R(e,t){let r=e??(typeof window<`u`?window.location.hostname:``);if(r)try{let e=n(t),i=await fetch(`${e}/user/merchant/resolve?domain=${encodeURIComponent(r)}`);if(!i.ok){console.warn(`[Frak SDK] Merchant lookup failed for domain ${r}: ${i.status}`);return}return F=(await i.json()).merchantId,F}catch(e){console.warn(`[Frak SDK] Failed to fetch merchantId:`,e);return}}function z(){F=void 0,I=void 0}async function B(e,t){return e.metadata?.merchantId?e.metadata.merchantId:L(void 0,t)}async function V({config:e}){let t=H(e),n=await v({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=E({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function H(e){let t=j(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}export{m as _,P as a,u as b,j as c,E as d,_ as f,g,p as h,B as i,A as l,b as m,z as n,N as o,v as p,L as r,M as s,V as t,k as u,h as v,f as y};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { A as SiweAuthenticateReturnType, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, I as PrepareSsoReturnType, M as LoginModalStepType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, a as FrakClient, d as GetMerchantInformationReturnType, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, l as WalletStatusReturnType, m as SendInteractionParamsType, w as ModalRpcStepsResultType, x as DisplayModalParamsType, z as FinalModalStepType } from "./openSso-
|
|
1
|
+
import { A as SiweAuthenticateReturnType, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, I as PrepareSsoReturnType, M as LoginModalStepType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, a as FrakClient, d as GetMerchantInformationReturnType, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, l as WalletStatusReturnType, m as SendInteractionParamsType, w as ModalRpcStepsResultType, x as DisplayModalParamsType, z as FinalModalStepType } from "./openSso-CC1-loUk.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/actions/displayEmbeddedWallet.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Function used to display the Frak embedded wallet popup
|
|
6
6
|
* @param client - The current Frak Client
|
|
7
7
|
* @param params - The parameter used to customise the embedded wallet
|
|
8
|
+
* @returns The embedded wallet display result
|
|
8
9
|
*/
|
|
9
10
|
declare function displayEmbeddedWallet(client: FrakClient, params: DisplayEmbeddedWalletParamsType): Promise<DisplayEmbeddedWalletResultType>;
|
|
10
11
|
//#endregion
|
|
@@ -117,6 +118,13 @@ declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(cli
|
|
|
117
118
|
}: DisplayModalParamsType<T>): Promise<ModalRpcStepsResultType<T>>;
|
|
118
119
|
//#endregion
|
|
119
120
|
//#region src/actions/getMerchantInformation.d.ts
|
|
121
|
+
/**
|
|
122
|
+
* Fetch the current merchant information (name, rewards, tiers) from the wallet iframe
|
|
123
|
+
* @param client - The current Frak Client
|
|
124
|
+
* @returns The merchant information including available reward tiers
|
|
125
|
+
*
|
|
126
|
+
* @see {@link @frak-labs/core-sdk!index.GetMerchantInformationReturnType | `GetMerchantInformationReturnType`} for the return type shape
|
|
127
|
+
*/
|
|
120
128
|
declare function getMerchantInformation(client: FrakClient): Promise<GetMerchantInformationReturnType>;
|
|
121
129
|
//#endregion
|
|
122
130
|
//#region src/actions/prepareSso.d.ts
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { A as SiweAuthenticateReturnType, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, I as PrepareSsoReturnType, M as LoginModalStepType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, a as FrakClient, d as GetMerchantInformationReturnType, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, l as WalletStatusReturnType, m as SendInteractionParamsType, w as ModalRpcStepsResultType, x as DisplayModalParamsType, z as FinalModalStepType } from "./openSso-
|
|
1
|
+
import { A as SiweAuthenticateReturnType, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, I as PrepareSsoReturnType, M as LoginModalStepType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, a as FrakClient, d as GetMerchantInformationReturnType, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, l as WalletStatusReturnType, m as SendInteractionParamsType, w as ModalRpcStepsResultType, x as DisplayModalParamsType, z as FinalModalStepType } from "./openSso-tkqaDQLV.js";
|
|
2
2
|
|
|
3
3
|
//#region src/actions/displayEmbeddedWallet.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Function used to display the Frak embedded wallet popup
|
|
6
6
|
* @param client - The current Frak Client
|
|
7
7
|
* @param params - The parameter used to customise the embedded wallet
|
|
8
|
+
* @returns The embedded wallet display result
|
|
8
9
|
*/
|
|
9
10
|
declare function displayEmbeddedWallet(client: FrakClient, params: DisplayEmbeddedWalletParamsType): Promise<DisplayEmbeddedWalletResultType>;
|
|
10
11
|
//#endregion
|
|
@@ -117,6 +118,13 @@ declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(cli
|
|
|
117
118
|
}: DisplayModalParamsType<T>): Promise<ModalRpcStepsResultType<T>>;
|
|
118
119
|
//#endregion
|
|
119
120
|
//#region src/actions/getMerchantInformation.d.ts
|
|
121
|
+
/**
|
|
122
|
+
* Fetch the current merchant information (name, rewards, tiers) from the wallet iframe
|
|
123
|
+
* @param client - The current Frak Client
|
|
124
|
+
* @returns The merchant information including available reward tiers
|
|
125
|
+
*
|
|
126
|
+
* @see {@link @frak-labs/core-sdk!index.GetMerchantInformationReturnType | `GetMerchantInformationReturnType`} for the return type shape
|
|
127
|
+
*/
|
|
120
128
|
declare function getMerchantInformation(client: FrakClient): Promise<GetMerchantInformationReturnType>;
|
|
121
129
|
//#endregion
|
|
122
130
|
//#region src/actions/prepareSso.d.ts
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "0.1.1-beta.
|
|
14
|
+
"version": "0.1.1-beta.caa04eda",
|
|
15
15
|
"description": "Core SDK of the Frak wallet, low level library to interact directly with the frak ecosystem.",
|
|
16
16
|
"repository": {
|
|
17
17
|
"url": "https://github.com/frak-id/wallet",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"viem": "^2.x"
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
|
-
"@frak-labs/frame-connector": "0.1.0-beta.
|
|
94
|
+
"@frak-labs/frame-connector": "0.1.0-beta.caa04eda",
|
|
95
95
|
"@openpanel/web": "^1.0.7"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
* Function used to display the Frak embedded wallet popup
|
|
9
9
|
* @param client - The current Frak Client
|
|
10
10
|
* @param params - The parameter used to customise the embedded wallet
|
|
11
|
+
* @returns The embedded wallet display result
|
|
11
12
|
*/
|
|
12
13
|
export async function displayEmbeddedWallet(
|
|
13
14
|
client: FrakClient,
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { FrakClient, GetMerchantInformationReturnType } from "../types";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Fetch the current merchant information (name, rewards, tiers) from the wallet iframe
|
|
5
|
+
* @param client - The current Frak Client
|
|
6
|
+
* @returns The merchant information including available reward tiers
|
|
7
|
+
*
|
|
8
|
+
* @see {@link @frak-labs/core-sdk!index.GetMerchantInformationReturnType | `GetMerchantInformationReturnType`} for the return type shape
|
|
9
|
+
*/
|
|
3
10
|
export async function getMerchantInformation(
|
|
4
11
|
client: FrakClient
|
|
5
12
|
): Promise<GetMerchantInformationReturnType> {
|
|
@@ -23,7 +23,8 @@ type SdkRpcClient = RpcClient<IFrameRpcSchema, FrakLifecycleEvent>;
|
|
|
23
23
|
/**
|
|
24
24
|
* Create a new iframe Frak client
|
|
25
25
|
* @param args
|
|
26
|
-
* @param args.config - The configuration to use for the Frak Wallet SDK
|
|
26
|
+
* @param args.config - The configuration to use for the Frak Wallet SDK.
|
|
27
|
+
* When `config.domain` is set, it is forwarded to the iframe handshake so the listener resolves the correct merchant in tunneled/proxied environments (e.g. Shopify dev with Cloudflare tunnel).
|
|
27
28
|
* @param args.iframe - The iframe to use for the communication
|
|
28
29
|
* @returns The created Frak Client
|
|
29
30
|
*
|
|
@@ -49,6 +50,7 @@ export function createIFrameFrakClient({
|
|
|
49
50
|
const lifecycleManager = createIFrameLifecycleManager({
|
|
50
51
|
iframe,
|
|
51
52
|
targetOrigin: frakWalletUrl,
|
|
53
|
+
configDomain: config.domain,
|
|
52
54
|
});
|
|
53
55
|
|
|
54
56
|
// Create our debug info gatherer
|
|
@@ -26,12 +26,17 @@ function handleBackup(backup: string | undefined): void {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Handle handshake with iframe
|
|
29
|
+
* Handle handshake with iframe — sends client metadata so the listener can resolve the correct merchant
|
|
30
|
+
* @param iframe - The iframe element to post the handshake response to
|
|
31
|
+
* @param token - The handshake token received from the iframe
|
|
32
|
+
* @param targetOrigin - The target origin for postMessage security
|
|
33
|
+
* @param configDomain - Optional override domain for merchant resolution in tunneled/proxied environments
|
|
30
34
|
*/
|
|
31
35
|
function handleHandshake(
|
|
32
36
|
iframe: HTMLIFrameElement,
|
|
33
37
|
token: string,
|
|
34
|
-
targetOrigin: string
|
|
38
|
+
targetOrigin: string,
|
|
39
|
+
configDomain?: string
|
|
35
40
|
): void {
|
|
36
41
|
const url = new URL(window.location.href);
|
|
37
42
|
const pendingMergeToken = url.searchParams.get("fmt") ?? undefined;
|
|
@@ -44,6 +49,7 @@ function handleHandshake(
|
|
|
44
49
|
currentUrl: window.location.href,
|
|
45
50
|
clientId: getClientId(),
|
|
46
51
|
pendingMergeToken,
|
|
52
|
+
configDomain,
|
|
47
53
|
},
|
|
48
54
|
},
|
|
49
55
|
targetOrigin
|
|
@@ -111,14 +117,20 @@ function handleRedirect(
|
|
|
111
117
|
|
|
112
118
|
/**
|
|
113
119
|
* Create a new iframe lifecycle handler
|
|
120
|
+
* @param args
|
|
121
|
+
* @param args.iframe - The iframe element used for wallet communication
|
|
122
|
+
* @param args.targetOrigin - The wallet URL origin for postMessage security
|
|
123
|
+
* @param args.configDomain - Optional domain override forwarded during handshake for tunneled/proxied environments
|
|
114
124
|
* @ignore
|
|
115
125
|
*/
|
|
116
126
|
export function createIFrameLifecycleManager({
|
|
117
127
|
iframe,
|
|
118
128
|
targetOrigin,
|
|
129
|
+
configDomain,
|
|
119
130
|
}: {
|
|
120
131
|
iframe: HTMLIFrameElement;
|
|
121
132
|
targetOrigin: string;
|
|
133
|
+
configDomain?: string;
|
|
122
134
|
}): IframeLifecycleManager {
|
|
123
135
|
// Create the isConnected listener
|
|
124
136
|
const isConnectedDeferred = new Deferred<boolean>();
|
|
@@ -149,7 +161,7 @@ export function createIFrameLifecycleManager({
|
|
|
149
161
|
break;
|
|
150
162
|
// Handshake handling
|
|
151
163
|
case "handshake":
|
|
152
|
-
handleHandshake(iframe, data.token, targetOrigin);
|
|
164
|
+
handleHandshake(iframe, data.token, targetOrigin, configDomain);
|
|
153
165
|
break;
|
|
154
166
|
// Redirect handling
|
|
155
167
|
case "redirect":
|
|
@@ -49,6 +49,12 @@ type HandshakeResponse = {
|
|
|
49
49
|
* URL is cleaned after handshake response is sent
|
|
50
50
|
*/
|
|
51
51
|
pendingMergeToken?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Explicit domain from SDK config (FrakWalletSdkConfig.domain)
|
|
54
|
+
* When present, listener should prefer this over URL-derived domain
|
|
55
|
+
* for merchant resolution (handles proxied/tunneled environments)
|
|
56
|
+
*/
|
|
57
|
+
configDomain?: string;
|
|
52
58
|
};
|
|
53
59
|
};
|
|
54
60
|
|
|
@@ -2,6 +2,12 @@ import type { Currency } from "../types";
|
|
|
2
2
|
import { getSupportedCurrency } from "./getSupportedCurrency";
|
|
3
3
|
import { getSupportedLocale } from "./getSupportedLocale";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Format a numeric amount as a localized currency string
|
|
7
|
+
* @param amount - The raw numeric amount to format
|
|
8
|
+
* @param currency - Optional currency config; defaults to EUR/fr-FR when omitted
|
|
9
|
+
* @returns Localized currency string (e.g. "1 500 €", "$1,500")
|
|
10
|
+
*/
|
|
5
11
|
export function formatAmount(amount: number, currency?: Currency) {
|
|
6
12
|
// Get the supported locale (e.g. "fr-FR")
|
|
7
13
|
const supportedLocale = getSupportedLocale(currency);
|
package/src/utils/sso.ts
CHANGED
|
@@ -23,9 +23,10 @@ export type FullSsoParams = Omit<PrepareSsoParamsType, "metadata"> & {
|
|
|
23
23
|
*
|
|
24
24
|
* @param walletUrl - Base wallet URL (e.g., "https://wallet.frak.id")
|
|
25
25
|
* @param params - SSO parameters
|
|
26
|
-
* @param
|
|
26
|
+
* @param merchantId - Merchant identifier
|
|
27
27
|
* @param name - Application name
|
|
28
28
|
* @param css - Optional custom CSS
|
|
29
|
+
* @param clientId - Optional client identifier (auto-generated if omitted)
|
|
29
30
|
* @returns Complete SSO URL ready to open in popup or redirect
|
|
30
31
|
*
|
|
31
32
|
* @example
|
package/src/utils/trackEvent.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { FrakClient } from "../types";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Analytics event names emitted by the SDK
|
|
5
|
+
*/
|
|
3
6
|
export type FrakEvent =
|
|
4
7
|
| "share_button_clicked"
|
|
5
8
|
| "wallet_button_clicked"
|
|
@@ -13,6 +16,13 @@ export type FrakEvent =
|
|
|
13
16
|
|
|
14
17
|
type EventProps = Record<string, unknown>;
|
|
15
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Track an analytics event via OpenPanel.
|
|
21
|
+
* Fire-and-forget: silently catches errors.
|
|
22
|
+
* @param client - The Frak client instance (no-op if undefined)
|
|
23
|
+
* @param event - The event name to track
|
|
24
|
+
* @param props - Optional event properties
|
|
25
|
+
*/
|
|
16
26
|
export function trackEvent(
|
|
17
27
|
client: FrakClient | undefined,
|
|
18
28
|
event: FrakEvent,
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const e=require(`./trackEvent-CGIryq5h.cjs`);let t=require(`@frak-labs/frame-connector`),n=require(`@openpanel/web`);const r=`nexus-wallet-backup`,i=`frakwallet://`;function a(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 o=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 n=this.getIframeStatus(),r=this.getNavigatorInfo(),i=`Unknown`;return e instanceof t.FrakRpcError?i=`FrakRpcError: ${e.code} '${e.message}'`:e instanceof Error?i=e.message:typeof e==`string`&&(i=e),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):`no-config`,navigatorInfo:r?this.base64Encode(r):`no-navigator`,iframeStatus:n?this.base64Encode(n):`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:i}}static empty(){return new e}formatDebugInfo(e){let t=this.gatherDebugInfo(e);return`
|
|
2
|
-
Debug Information:
|
|
3
|
-
-----------------
|
|
4
|
-
Timestamp: ${t.timestamp}
|
|
5
|
-
URL: ${t.encodedUrl}
|
|
6
|
-
Config: ${t.encodedConfig}
|
|
7
|
-
Navigator Info: ${t.navigatorInfo}
|
|
8
|
-
IFrame Status: ${t.iframeStatus}
|
|
9
|
-
Last Request: ${t.lastRequest}
|
|
10
|
-
Last Response: ${t.lastResponse}
|
|
11
|
-
Client Status: ${t.clientStatus}
|
|
12
|
-
Error: ${t.error}
|
|
13
|
-
`.trim()}};function s(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}function c(e){return`intent://${e.slice(13)}#Intent;scheme=frakwallet;package=id.frak.wallet;end`}function l(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=s()&&u(e)?c(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function u(e){return e.startsWith(i)}const d={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 f({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);return r.id=d.id,r.name=d.name,r.allow=d.allow,r.style.zIndex=d.style.zIndex.toString(),p({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 p({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 m(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 h(e){e?localStorage.setItem(r,e):localStorage.removeItem(r)}function g(t,n,r){let i=new URL(window.location.href),a=i.searchParams.get(`fmt`)??void 0;t.contentWindow?.postMessage({clientLifecycle:`handshake-response`,data:{token:n,currentUrl:window.location.href,clientId:e.d(),pendingMergeToken:a}},r),a&&(i.searchParams.delete(`fmt`),window.history.replaceState({},``,i.toString()))}function _(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 v(e,t,n,r){let i=_(t,r);u(t)?l(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}}):window.location.href=i}function y({iframe:e,targetOrigin:n}){let i=new t.Deferred;return{handleEvent:async t=>{if(!(`iframeLifecycle`in t))return;let{iframeLifecycle:a,data:o}=t;switch(a){case`connected`:i.resolve(!0);break;case`do-backup`:h(o.backup);break;case`remove-backup`:localStorage.removeItem(r);break;case`show`:case`hide`:p({iframe:e,isVisible:a===`show`});break;case`handshake`:g(e,o.token,n);break;case`redirect`:v(e,o.baseRedirectUrl,n,o.mergeToken);break}},isConnected:i.promise}}function b({config:e,iframe:r}){let i=e?.walletUrl??`https://wallet.frak.id`,a=y({iframe:r,targetOrigin:i}),s=new o(e,r);if(!r.contentWindow)throw new t.FrakRpcError(t.RpcErrorCodes.configError,`The iframe does not have a content window`);let c=(0,t.createRpcClient)({emittingTransport:r.contentWindow,listeningTransport:window,targetOrigin:i,middleware:[{async onRequest(e,n){if(!await a.isConnected)throw new t.FrakRpcError(t.RpcErrorCodes.clientNotConnected,`The iframe provider isn't connected yet`);return n}},{onRequest(e,t){return s.setLastRequest(e),t},onResponse(e,t){return s.setLastResponse(e,t),t}}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await a.handleEvent(e)}}}),l=x(c,a),u=async()=>{l(),c.cleanup(),r.remove()},d;console.log(`[Frak SDK] Initializing OpenPanel`),d=new n.OpenPanel({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)}),d.setGlobalProperties({sdkVersion:`0.1.1`}),d.init();let f=S({config:e,rpcClient:c,lifecycleManager:a}).then(()=>s.updateSetupStatus(!0));return{config:e,debugInfo:s,waitForConnection:a.isConnected,waitForSetup:f,request:c.request,listenerRequest:c.listen,destroy:u,openPanel:d}}function x(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 S({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,a(t,n.isConnected);async function i(){let n=e.customizations?.css;if(!n)return;let r={clientLifecycle:`modal-css`,data:{cssLink:n}};t.sendLifecycle(r)}async function o(){let n=e.customizations?.i18n;if(!n)return;let r={clientLifecycle:`modal-i18n`,data:{i18n:n}};t.sendLifecycle(r)}async function s(){if(typeof window>`u`)return;let e=window.localStorage.getItem(r);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([i(),o(),s()])}function C(n){return(0,t.jsonDecode)(e.l(n))}const w={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function T(e){return e&&e in w?e:`eur`}function E(e){return e?w[e]??w.eur:w.eur}function D(e,t){let n=E(t),r=T(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function O(e){return e?`${e}Amount`:`eurAmount`}let k,A;async function j(e,t){if(k)return k;if(A)return A;A=M(e,t);let n=await A;return A=void 0,n}async function M(t,n){let r=t??(typeof window<`u`?window.location.hostname:``);if(r)try{let t=e.r(n),i=await fetch(`${t}/user/merchant/resolve?domain=${encodeURIComponent(r)}`);if(!i.ok){console.warn(`[Frak SDK] Merchant lookup failed for domain ${r}: ${i.status}`);return}return k=(await i.json()).merchantId,k}catch(e){console.warn(`[Frak SDK] Failed to fetch merchantId:`,e);return}}function N(){k=void 0,A=void 0}async function P(e,t){return e.metadata?.merchantId?e.metadata.merchantId:j(void 0,t)}async function F({config:e}){let t=I(e),n=await f({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=b({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function I(e){let t=T(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return o}});
|