@frak-labs/core-sdk 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/bundle.js +1 -1
- package/dist/{actions-DrZ_PIs1.cjs → actions-Cyn4asew.cjs} +1 -1
- package/dist/{actions-DrZ_PIs1.cjs.map → actions-Cyn4asew.cjs.map} +1 -1
- package/dist/{actions-HG5M8wX7.js → actions-DtPVuk2e.js} +1 -1
- package/dist/{actions-HG5M8wX7.js.map → actions-DtPVuk2e.js.map} +1 -1
- package/dist/actions.cjs +1 -1
- package/dist/actions.d.cts +2 -2
- package/dist/actions.d.ts +2 -2
- package/dist/actions.js +1 -1
- package/dist/bundle.cjs +1 -1
- package/dist/bundle.d.cts +5 -4
- package/dist/bundle.d.ts +5 -4
- package/dist/bundle.js +1 -1
- package/dist/getCurrencyAmountKey-DQcwjJiB.js +2 -0
- package/dist/getCurrencyAmountKey-DQcwjJiB.js.map +1 -0
- package/dist/getCurrencyAmountKey-h2eOiYzv.cjs +2 -0
- package/dist/getCurrencyAmountKey-h2eOiYzv.cjs.map +1 -0
- package/dist/{index-BysidNLB.d.ts → index-CD-GW6rL.d.ts} +3 -2
- package/dist/{index-k1lfbVkl.d.cts → index-D5_EwZ3f.d.cts} +3 -2
- package/dist/{index-C1A3I4x1.d.cts → index-DPez7SXh.d.cts} +3 -2
- package/dist/{index-BJMazhpm.d.ts → index-DQYipoH_.d.ts} +3 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/merchantInformation--tLnowAN.d.ts +344 -0
- package/dist/merchantInformation-BSuahpjl.d.cts +344 -0
- package/dist/{openSso-BWeD0Fb2.d.ts → openSso-CjZ8lAEA.d.ts} +7 -286
- package/dist/{openSso-B0igO6Iu.d.cts → openSso-DSXbUP-j.d.cts} +7 -286
- package/dist/rewards.cjs +2 -0
- package/dist/rewards.cjs.map +1 -0
- package/dist/rewards.d.cts +130 -0
- package/dist/rewards.d.ts +130 -0
- package/dist/rewards.js +2 -0
- package/dist/rewards.js.map +1 -0
- package/dist/src-CTtM8g9p.cjs +2 -0
- package/dist/src-CTtM8g9p.cjs.map +1 -0
- package/dist/src-Dq2hi427.js +2 -0
- package/dist/src-Dq2hi427.js.map +1 -0
- package/package.json +13 -1
- package/src/actions/getMerchantInformation.test.ts +2 -0
- package/src/index.ts +6 -0
- package/src/rewards/conditions.test.ts +60 -0
- package/src/rewards/conditions.ts +72 -0
- package/src/rewards/example.test.ts +92 -0
- package/src/rewards/example.ts +57 -0
- package/src/rewards/format.test.ts +143 -0
- package/src/rewards/format.ts +81 -0
- package/src/rewards/index.ts +29 -0
- package/src/rewards/select.test.ts +281 -0
- package/src/rewards/select.ts +197 -0
- package/src/rewards/value.test.ts +89 -0
- package/src/rewards/value.ts +73 -0
- package/src/types/index.ts +6 -0
- package/src/types/resolvedConfig.ts +4 -0
- package/src/types/rpc/merchantInformation.ts +107 -7
- package/dist/src-DXE40XuK.js +0 -2
- package/dist/src-DXE40XuK.js.map +0 -1
- package/dist/src-hwLbVkQI.cjs +0 -2
- package/dist/src-hwLbVkQI.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions-HG5M8wX7.js","names":[],"sources":["../src/actions/displayEmbeddedWallet.ts","../src/actions/displayModal.ts","../src/actions/displaySharingPage.ts","../src/actions/ensureIdentity.ts","../src/actions/getMerchantInformation.ts","../src/actions/getMergeToken.ts","../src/actions/getUserReferralStatus.ts","../src/actions/prepareSso.ts","../src/actions/sendInteraction.ts","../src/actions/referral/processReferral.ts","../src/actions/referral/referralInteraction.ts","../src/actions/referral/setupReferral.ts","../src/actions/trackPurchaseStatus.ts","../src/actions/watchWalletStatus.ts","../src/actions/wrapper/modalBuilder.ts","../src/actions/wrapper/sendTransaction.ts","../src/actions/wrapper/siweAuthenticate.ts"],"sourcesContent":["import type {\n DisplayEmbeddedWalletParamsType,\n DisplayEmbeddedWalletResultType,\n FrakClient,\n} from \"../types\";\n\n/**\n * Function used to display the Frak embedded wallet popup\n * @param client - The current Frak Client\n * @param params - The parameter used to customise the embedded wallet\n * @param placement - Optional placement ID to associate with this display request\n * @returns The embedded wallet display result\n */\nexport async function displayEmbeddedWallet(\n client: FrakClient,\n params: DisplayEmbeddedWalletParamsType,\n placement?: string\n): Promise<DisplayEmbeddedWalletResultType> {\n return await client.request({\n method: \"frak_displayEmbeddedWallet\",\n params: placement\n ? [params, client.config.metadata, placement]\n : [params, client.config.metadata],\n });\n}\n","import type {\n DisplayModalParamsType,\n FrakClient,\n ModalRpcStepsResultType,\n ModalStepTypes,\n} from \"../types\";\n\n/**\n * Function used to display a modal\n * @param client - The current Frak Client\n * @param args\n * @param args.steps - The different steps of the modal\n * @param args.metadata - The metadata for the modal (customization, etc)\n * @param placement - Optional placement ID to associate with this modal display\n * @returns The result of each modal steps\n *\n * @description This function will display a modal to the user with the provided steps and metadata.\n *\n * @remarks\n * - The UI of the displayed modal can be configured with the `customCss` property in the `customizations.css` field of the top-level config.\n * - The `login` step will be automatically skipped if the user is already logged in. It's safe to include this step in all cases to ensure proper user state.\n * - Steps are automatically reordered in the following sequence:\n * 1. `login` (if needed)\n * 2. All other steps in the order specified\n * 3. `success` (if included, always last)\n *\n * @example\n * Simple sharing modal with steps:\n * 1. Login (Skipped if already logged in)\n * 2. Display a success message with sharing link option\n *\n * ```ts\n * const results = await displayModal(frakConfig, {\n * steps: {\n * // Simple login with no SSO, nor customization\n * login: { allowSso: false },\n * // Success message\n * final: {\n * action: { key: \"reward\" },\n * // Skip this step, it will be only displayed in the stepper within the modal\n * autoSkip: true,\n * },\n * },\n * });\n *\n * console.log(\"Login step - wallet\", results.login.wallet);\n * ```\n *\n * @example\n * A full modal example, with a few customization options, with the steps:\n * 1. Login (Skipped if already logged in)\n * 2. Authenticate via SIWE\n * 3. Send a transaction\n * 4. Display a success message with sharing link options\n *\n * ```ts\n * const results = await displayModal(frakConfig, {\n * steps: {\n * // Login step\n * login: {\n * allowSso: true,\n * ssoMetadata: {\n * logoUrl: \"https://my-app.com/logo.png\",\n * homepageLink: \"https://my-app.com\",\n * },\n * },\n * // Siwe authentication\n * siweAuthenticate: {\n * siwe: {\n * domain: \"my-app.com\",\n * uri: \"https://my-app.com/\",\n * nonce: generateSiweNonce(),\n * version: \"1\",\n * },\n * },\n * // Send batched transaction\n * sendTransaction: {\n * tx: [\n * { to: \"0xdeadbeef\", data: \"0xdeadbeef\" },\n * { to: \"0xdeadbeef\", data: \"0xdeadbeef\" },\n * ],\n * },\n * // Success message with sharing options\n * final: {\n * action: {\n * key: \"sharing\",\n * options: {\n * popupTitle: \"Share the app\",\n * text: \"Discover my super app website\",\n * link: \"https://my-app.com\",\n * },\n * },\n * dismissedMetadata: {\n * title: \"Dismiss\",\n * description: \"You won't be rewarded for this sharing action\",\n * },\n * },\n * },\n * metadata: {\n * // Header of desktop modals\n * header: {\n * title: \"My-App\",\n * icon: \"https://my-app.com/logo.png\",\n * },\n * // Context that will be present in every modal steps\n * context: \"My-app overkill flow\",\n * },\n * });\n * ```\n */\nexport async function displayModal<\n T extends ModalStepTypes[] = ModalStepTypes[],\n>(\n client: FrakClient,\n { steps, metadata }: DisplayModalParamsType<T>,\n placement?: string\n): Promise<ModalRpcStepsResultType<T>> {\n return (await client.request({\n method: \"frak_displayModal\",\n params: placement\n ? [steps, metadata, client.config.metadata, placement]\n : [steps, metadata, client.config.metadata],\n })) as ModalRpcStepsResultType<T>;\n}\n","import type {\n DisplaySharingPageParamsType,\n DisplaySharingPageResultType,\n FrakClient,\n} from \"../types\";\n\n/**\n * Function used to display a sharing page\n * @param client - The current Frak Client\n * @param params - The parameters to customize the sharing page (products, link override, metadata)\n * @param placement - Optional placement ID to associate with this display request\n * @returns The result indicating the user's action (shared, copied, or dismissed)\n *\n * @description This function will display a full-page sharing UI to the user,\n * showing product info, estimated rewards, sharing steps, FAQ, and share/copy buttons.\n * The sharing link is generated from the user's wallet context + merchant info.\n *\n * @remarks\n * - The promise resolves on the first user action (share or copy) but the page stays visible\n * - The user can continue to share/copy multiple times after the initial resolution\n * - Dismissing the page after a share/copy action is a no-op (promise already resolved)\n * - If the user dismisses without any action, the promise resolves with `{ action: \"dismissed\" }`\n *\n * @example\n * ```ts\n * const result = await displaySharingPage(frakClient, {\n * products: [\n * {\n * title: \"Babies camel cuir velours bout carré\",\n * imageUrl: \"https://example.com/product.jpg\",\n * },\n * ],\n * });\n *\n * console.log(\"User action:\", result.action); // \"shared\" | \"copied\" | \"dismissed\"\n * ```\n */\nexport async function displaySharingPage(\n client: FrakClient,\n params: DisplaySharingPageParamsType,\n placement?: string\n): Promise<DisplaySharingPageResultType> {\n return await client.request({\n method: \"frak_displaySharingPage\",\n params: placement\n ? [params, client.config.metadata, placement]\n : [params, client.config.metadata],\n });\n}\n","import { getBackendUrl } from \"../config/backendUrl\";\nimport { getClientId } from \"../config/clientId\";\nimport { sdkConfigStore } from \"../config/sdkConfigStore\";\n\nconst ENSURE_STORAGE_PREFIX = \"frak-identity-ensured-\";\n\n/**\n * Ensure the current wallet ↔ clientId link exists on the backend.\n *\n * Called automatically by {@link watchWalletStatus} when a connected wallet\n * status is received. Acts as a failsafe: if the primary merge (SSO, pairing,\n * login/register) missed or silently failed, this ensures the link is\n * eventually established.\n *\n * The call is:\n * - **Idempotent** — if already linked, backend returns immediately\n * - **Deduplicated** — only fires once per browser session per merchant\n * - **Fire-and-forget** — errors are logged but never thrown\n *\n * @param interactionToken - The SDK JWT from wallet status (x-wallet-sdk-auth)\n *\n * @example\n * ```ts\n * // Usually called automatically via watchWalletStatus side effect.\n * // Can also be called manually if needed:\n * await ensureIdentity(\"eyJhbGciOi...\");\n * ```\n */\nexport async function ensureIdentity(interactionToken: string): Promise<void> {\n if (typeof window === \"undefined\") {\n return;\n }\n\n const clientId = getClientId();\n if (!clientId) {\n return;\n }\n\n const merchantId = await sdkConfigStore.resolveMerchantId();\n if (!merchantId) {\n return;\n }\n\n const storageKey = `${ENSURE_STORAGE_PREFIX}${merchantId}`;\n if (window.sessionStorage.getItem(storageKey)) {\n return;\n }\n\n try {\n const backendUrl = getBackendUrl();\n const response = await fetch(`${backendUrl}/user/identity/ensure`, {\n method: \"POST\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n \"x-wallet-sdk-auth\": interactionToken,\n \"x-frak-client-id\": clientId,\n },\n body: JSON.stringify({ merchantId }),\n });\n\n if (response.ok) {\n window.sessionStorage.setItem(storageKey, \"1\");\n }\n } catch {\n // Fire-and-forget — retry on next session\n }\n}\n","import type { FrakClient, GetMerchantInformationReturnType } from \"../types\";\nimport { withCache } from \"../utils/cache\";\n\n/**\n * Fetch the current merchant information (name, rewards, tiers) from the wallet iframe.\n *\n * Results are cached in memory for 30 seconds by default. Concurrent calls\n * while a request is in-flight are deduplicated automatically.\n *\n * @param client - The current Frak Client\n * @param options - Optional cache configuration\n * @param options.cacheTime - Time in ms to cache the result. Default: 30_000 (30s). Set to 0 to disable.\n * @returns The merchant information including available reward tiers\n *\n * @see {@link @frak-labs/core-sdk!index.GetMerchantInformationReturnType | `GetMerchantInformationReturnType`} for the return type shape\n */\nexport async function getMerchantInformation(\n client: FrakClient,\n options?: { cacheTime?: number }\n): Promise<GetMerchantInformationReturnType> {\n return withCache(\n () =>\n client.request({\n method: \"frak_getMerchantInformation\",\n }),\n {\n cacheKey: \"frak_getMerchantInformation\",\n cacheTime: options?.cacheTime,\n }\n );\n}\n","import type { FrakClient } from \"../types\";\nimport { withCache } from \"../utils/cache\";\n\n/**\n * Fetch a merge token for the current anonymous identity.\n *\n * Used by in-app browser redirect flows to preserve identity\n * when switching from a WebView to the system browser.\n * The token is appended as `?fmt=` to the redirect URL.\n *\n * Results are cached in memory for 30 seconds by default. Concurrent calls\n * while a request is in-flight are deduplicated automatically.\n *\n * @param client - The current Frak Client\n * @param options - Optional cache configuration\n * @param options.cacheTime - Time in ms to cache the result. Default: 30_000 (30s). Set to 0 to disable.\n * @returns The merge token string, or null if unavailable\n */\nexport async function getMergeToken(\n client: FrakClient,\n options?: { cacheTime?: number }\n): Promise<string | null> {\n return withCache(\n () =>\n client.request({\n method: \"frak_getMergeToken\",\n }),\n {\n cacheKey: \"frak_getMergeToken\",\n cacheTime: options?.cacheTime,\n }\n );\n}\n","import type { FrakClient, UserReferralStatusType } from \"../types\";\nimport { withCache } from \"../utils/cache\";\n\n/**\n * Fetch the current user's referral status on the current merchant.\n *\n * The listener resolves the user's identity (via clientId or wallet session)\n * and checks whether a referral link exists where the user is the referee.\n *\n * Results are cached in memory for 30 seconds by default. Concurrent calls\n * while a request is in-flight are deduplicated automatically.\n *\n * Returns `null` when the user's identity cannot be resolved.\n *\n * @param client - The current Frak Client\n * @param options - Optional cache configuration\n * @param options.cacheTime - Time in ms to cache the result. Default: 30_000 (30s). Set to 0 to disable.\n * @returns The user's referral status, or `null` if identity cannot be resolved\n *\n * @example\n * ```ts\n * const status = await getUserReferralStatus(client);\n * if (status?.isReferred) {\n * console.log(\"User was referred to this merchant\");\n * }\n * ```\n */\nexport async function getUserReferralStatus(\n client: FrakClient,\n options?: { cacheTime?: number }\n): Promise<UserReferralStatusType | null> {\n return withCache(\n () =>\n client.request({\n method: \"frak_getUserReferralStatus\",\n }),\n {\n cacheKey: \"frak_getUserReferralStatus\",\n cacheTime: options?.cacheTime,\n }\n );\n}\n","import type {\n FrakClient,\n PrepareSsoParamsType,\n PrepareSsoReturnType,\n} from \"../types\";\n\n/**\n * Generate SSO URL without opening popup\n *\n * This is a **synchronous**, client-side function that generates the SSO URL\n * without any RPC calls to the wallet iframe. Use this when you need:\n * - Custom URL modifications before opening popup\n * - Pre-generation for advanced popup strategies\n * - URL inspection/logging before SSO flow\n *\n * @param client - The current Frak Client\n * @param args - The SSO parameters\n * @returns Object containing the generated ssoUrl\n *\n * @example\n * ```ts\n * // Generate URL for inspection\n * const { ssoUrl } = prepareSso(client, {\n * metadata: { logoUrl: \"...\" },\n * directExit: true\n * });\n * console.log(\"Opening SSO:\", ssoUrl);\n *\n * // Add custom params\n * const customUrl = `${ssoUrl}&tracking=abc123`;\n * await openSso(client, { metadata, ssoPopupUrl: customUrl });\n * ```\n *\n * @remarks\n * For most use cases, just use `openSso()` which handles URL generation automatically.\n * Only use `prepareSso()` when you need explicit control over the URL.\n */\nexport async function prepareSso(\n client: FrakClient,\n args: PrepareSsoParamsType\n): Promise<PrepareSsoReturnType> {\n const { metadata, customizations } = client.config;\n\n return await client.request({\n method: \"frak_prepareSso\",\n params: [args, metadata.name, customizations?.css],\n });\n}\n","import { getClientId } from \"../config/clientId\";\nimport type { FrakClient } from \"../types\";\nimport type { SendInteractionParamsType } from \"../types/rpc/interaction\";\n\n/**\n * Send an interaction to the backend via the listener RPC.\n * Fire-and-forget: errors are caught and logged, not thrown.\n *\n * @param client - The Frak client instance\n * @param params - The interaction parameters\n *\n * @description Sends a user interaction event through the wallet iframe RPC. Supports three interaction types: arrival tracking, sharing events, and custom interactions.\n *\n * @example\n * Track a user arrival with referral attribution:\n * ```ts\n * await sendInteraction(client, {\n * type: \"arrival\",\n * referrerWallet: \"0x1234...abcd\",\n * landingUrl: window.location.href,\n * utmSource: \"twitter\",\n * utmMedium: \"social\",\n * utmCampaign: \"launch-2026\",\n * });\n * ```\n *\n * @example\n * Track a sharing event:\n * ```ts\n * await sendInteraction(client, { type: \"sharing\" });\n * ```\n *\n * @example\n * Send a custom interaction:\n * ```ts\n * await sendInteraction(client, {\n * type: \"custom\",\n * customType: \"newsletter_signup\",\n * data: { email: \"user@example.com\" },\n * });\n * ```\n */\nexport async function sendInteraction(\n client: FrakClient,\n params: SendInteractionParamsType\n): Promise<void> {\n try {\n await client.request({\n method: \"frak_sendInteraction\",\n params: [params, { clientId: getClientId() }],\n });\n } catch {\n // Silent failure - fire-and-forget\n console.warn(\"[Frak SDK] Failed to send interaction:\", params.type);\n }\n}\n","import { getClientId } from \"../../config/clientId\";\nimport { FrakContextManager } from \"../../context\";\nimport { areAddressesEqual } from \"../../context/address\";\nimport type {\n FrakClient,\n FrakContext,\n FrakContextV2,\n WalletStatusReturnType,\n} from \"../../types\";\nimport { isV1Context, isV2Context } from \"../../types\";\nimport { trackEvent } from \"../../utils\";\nimport { sendInteraction } from \"../sendInteraction\";\n\n/**\n * Options for the referral auto-interaction process.\n */\nexport type ProcessReferralOptions = {\n /**\n * If true, always replace the URL with the current user's referral context\n * so the next visitor gets referred by this user.\n * @defaultValue false\n */\n alwaysAppendUrl?: boolean;\n /**\n * Merchant ID for building the current user's referral context.\n * Required when `alwaysAppendUrl` is true and the incoming context is V1.\n * For V2 contexts, the merchantId is already embedded in the context.\n */\n merchantId?: string;\n};\n\n/**\n * The different states of the referral process.\n * @inline\n */\ntype ReferralState =\n | \"idle\"\n | \"processing\"\n | \"success\"\n | \"no-referrer\"\n | \"self-referral\";\n\n/**\n * Track an arrival event if the context version is recognized.\n * Sends both tracking analytics and the arrival interaction RPC.\n *\n * @returns true if the context was valid and tracked, false otherwise\n */\nfunction trackArrivalIfValid(\n client: FrakClient,\n frakContext: FrakContext,\n walletStatus?: WalletStatusReturnType\n): boolean {\n if (isV2Context(frakContext)) {\n trackEvent(client, \"user_referred_started\", {\n referrer_client_id: frakContext.c,\n referrer_wallet: frakContext.w,\n wallet_status: walletStatus?.key,\n });\n sendInteraction(client, {\n type: \"arrival\",\n referrerClientId: frakContext.c,\n referrerMerchantId: frakContext.m,\n referrerWallet: frakContext.w,\n referralTimestamp: frakContext.t,\n });\n return true;\n }\n\n if (isV1Context(frakContext)) {\n trackEvent(client, \"user_referred_started\", {\n referrer: frakContext.r,\n wallet_status: walletStatus?.key,\n });\n sendInteraction(client, {\n type: \"arrival\",\n referrerWallet: frakContext.r,\n });\n return true;\n }\n\n return false;\n}\n\n/**\n * Build a V2 context representing the current user for URL replacement.\n *\n * Emits both `c` (anonymous clientId) and `w` (wallet) when available — wallet\n * is the preferred identity signal and takes attribution precedence downstream.\n * Returns null when neither identifier is available.\n */\nfunction buildCurrentUserContext(\n merchantId: string,\n wallet?: WalletStatusReturnType[\"wallet\"]\n): FrakContextV2 | null {\n const clientId = getClientId();\n if (!clientId && !wallet) return null;\n return {\n v: 2,\n m: merchantId,\n t: Math.floor(Date.now() / 1000),\n ...(clientId ? { c: clientId } : {}),\n ...(wallet ? { w: wallet } : {}),\n };\n}\n\n/**\n * Client-side self-referral preflight check.\n * Prevents unnecessary backend round-trips for obvious self-referrals.\n */\nfunction isSelfReferral(\n frakContext: FrakContext,\n walletStatus?: WalletStatusReturnType\n): boolean {\n if (isV2Context(frakContext)) {\n // Wallet match takes precedence — it's the strongest signal we have.\n if (frakContext.w && walletStatus?.wallet) {\n return areAddressesEqual(frakContext.w, walletStatus.wallet);\n }\n if (frakContext.c) {\n return getClientId() === frakContext.c;\n }\n return false;\n }\n if (isV1Context(frakContext) && walletStatus?.wallet) {\n return areAddressesEqual(frakContext.r, walletStatus.wallet);\n }\n return false;\n}\n\n/**\n * Handle the full referral interaction flow:\n *\n * 1. Check if the user has been referred (if not, early exit)\n * 2. Preflight self-referral check (if yes, early exit)\n * 3. Track the arrival event\n * 4. Replace the current URL with the user's own referral context\n * 5. Return the resulting referral state\n *\n * @param client - The current Frak Client\n * @param args\n * @param args.walletStatus - The current user wallet status\n * @param args.frakContext - The referral context parsed from the URL\n * @param args.options - Options for URL replacement and merchant context\n * @returns The referral state\n *\n * @see {@link @frak-labs/core-sdk!ModalStepTypes} for modal step types\n */\nexport function processReferral(\n client: FrakClient,\n {\n walletStatus,\n frakContext,\n options,\n }: {\n walletStatus?: WalletStatusReturnType;\n frakContext?: FrakContext | null;\n options?: ProcessReferralOptions;\n }\n): ReferralState {\n if (!frakContext) {\n return \"no-referrer\";\n }\n\n if (isSelfReferral(frakContext, walletStatus)) {\n return \"self-referral\";\n }\n\n if (!trackArrivalIfValid(client, frakContext, walletStatus)) {\n return \"no-referrer\";\n }\n\n // V2 context embeds merchantId; V1 falls back to options\n const contextMerchantId = isV2Context(frakContext)\n ? frakContext.m\n : options?.merchantId;\n\n const replaceContext =\n options?.alwaysAppendUrl && contextMerchantId\n ? buildCurrentUserContext(contextMerchantId, walletStatus?.wallet)\n : null;\n\n FrakContextManager.replaceUrl({\n url: window.location?.href,\n context: replaceContext,\n });\n\n trackEvent(client, \"user_referred_completed\", {\n status: \"success\",\n });\n\n return \"success\";\n}\n","import { FrakContextManager } from \"../../context\";\nimport type { FrakClient } from \"../../types\";\nimport { watchWalletStatus } from \"../index\";\nimport {\n type ProcessReferralOptions,\n processReferral,\n} from \"./processReferral\";\n\n/**\n * Function used to handle referral interactions\n * @param client - The current Frak Client\n * @param args\n * @param args.options - Some options for the referral interaction\n *\n * @returns A promise with the resulting referral state, or undefined in case of an error\n *\n * @description This function will automatically handle the referral interaction process\n *\n * @see {@link processReferral} for more details on the automatic referral handling process\n */\nexport async function referralInteraction(\n client: FrakClient,\n {\n options,\n }: {\n options?: ProcessReferralOptions;\n } = {}\n) {\n // Get the current frak context\n const frakContext = FrakContextManager.parse({\n url: window.location.href,\n });\n\n // Get the current wallet status\n const currentWalletStatus = await watchWalletStatus(client);\n\n try {\n return processReferral(client, {\n walletStatus: currentWalletStatus,\n frakContext,\n options,\n });\n } catch (error) {\n console.warn(\"Error processing referral\", { error });\n }\n return;\n}\n","import type { FrakClient } from \"../../types\";\nimport { referralInteraction } from \"./referralInteraction\";\n\n/**\n * Custom event name dispatched on successful referral processing.\n *\n * Fired once per page load when a valid referral context is found in the URL\n * and successfully tracked. Consumers (e.g. `<frak-banner>`) listen for this\n * to display a referral success message.\n */\nexport const REFERRAL_SUCCESS_EVENT = \"frak:referral-success\";\n\n/**\n * Process referral context and emit a DOM event on success.\n *\n * - Calls {@link referralInteraction} to detect and track any referral in the URL\n * - On `\"success\"`, dispatches a bare {@link REFERRAL_SUCCESS_EVENT} on `window`\n * - Silently swallows errors (fire-and-forget during SDK init)\n *\n * @param client - The initialized Frak client\n */\nexport async function setupReferral(client: FrakClient): Promise<void> {\n try {\n const state = await referralInteraction(client);\n\n if (state === \"success\") {\n window.dispatchEvent(new Event(REFERRAL_SUCCESS_EVENT));\n }\n } catch (error) {\n console.warn(\"[Frak] Referral setup failed\", error);\n }\n}\n","import { getBackendUrl } from \"../config/backendUrl\";\nimport { getClientId } from \"../config/clientId\";\nimport { sdkConfigStore } from \"../config/sdkConfigStore\";\n\n/**\n * Function used to track the status of a purchase\n * when a purchase is tracked, the `purchaseCompleted` interactions will be automatically send for the user when we receive the purchase confirmation via webhook.\n *\n * @param args.customerId - The customer id that made the purchase (on your side)\n * @param args.orderId - The order id of the purchase (on your side)\n * @param args.token - The token of the purchase\n * @param args.merchantId - Optional explicit merchant id to use for the tracking request\n *\n * @description This function will send a request to the backend to listen for the purchase status.\n *\n * @example\n * async function trackPurchase(checkout) {\n * const payload = {\n * customerId: checkout.order.customer.id,\n * orderId: checkout.order.id,\n * token: checkout.token,\n * merchantId: \"your-merchant-id\",\n * };\n *\n * await trackPurchaseStatus(payload);\n * }\n *\n * @remarks\n * - Merchant id is resolved in this order: explicit `args.merchantId`, then `sdkConfigStore.resolveMerchantId()` (config store → sessionStorage → backend fetch).\n * - This function supports anonymous users and will use the `x-frak-client-id` header when available.\n * - At least one identity source must exist (`frak-wallet-interaction-token` or `x-frak-client-id`), otherwise the tracking request is skipped.\n * - This function will print a warning if used in a non-browser environment or if no identity / merchant id can be resolved.\n */\nexport async function trackPurchaseStatus(args: {\n customerId: string | number;\n orderId: string | number;\n token: string;\n merchantId?: string;\n}) {\n if (typeof window === \"undefined\") {\n console.warn(\"[Frak] No window found, can't track purchase\");\n return;\n }\n\n const interactionToken = window.sessionStorage.getItem(\n \"frak-wallet-interaction-token\"\n );\n\n const clientId = getClientId();\n if (!interactionToken && !clientId) {\n console.warn(\"[Frak] No identity found, skipping purchase check\");\n return;\n }\n\n const merchantId =\n args.merchantId ?? (await sdkConfigStore.resolveMerchantId());\n\n if (!merchantId) {\n console.warn(\"[Frak] No merchant id found, skipping purchase check\");\n return;\n }\n\n const headers: Record<string, string> = {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n };\n\n if (interactionToken) {\n headers[\"x-wallet-sdk-auth\"] = interactionToken;\n }\n\n if (clientId) {\n headers[\"x-frak-client-id\"] = clientId;\n }\n\n // Submit the listening request\n const backendUrl = getBackendUrl();\n await fetch(`${backendUrl}/user/track/purchase`, {\n method: \"POST\",\n headers,\n body: JSON.stringify({\n customerId: args.customerId,\n orderId: args.orderId,\n token: args.token,\n merchantId,\n }),\n });\n}\n","import { Deferred } from \"@frak-labs/frame-connector\";\nimport type { FrakClient } from \"../types/client\";\nimport type { WalletStatusReturnType } from \"../types/rpc/walletStatus\";\nimport { ensureIdentity } from \"./ensureIdentity\";\n\n/**\n * Function used to watch the current frak wallet status\n * @param client - The current Frak Client\n * @param callback - The callback that will receive any wallet status change\n * @returns A promise resolving with the initial wallet status\n *\n * @description This function will return the current wallet status, and will listen to any change in the wallet status.\n *\n * @example\n * await watchWalletStatus(frakConfig, (status: WalletStatusReturnType) => {\n * if (status.key === \"connected\") {\n * console.log(\"Wallet connected:\", status.wallet);\n * } else {\n * console.log(\"Wallet not connected\");\n * }\n * });\n */\nexport function watchWalletStatus(\n client: FrakClient,\n callback?: (status: WalletStatusReturnType) => void\n): Promise<WalletStatusReturnType> {\n // If no callback is provided, just do a request with deferred result\n if (!callback) {\n return client\n .request({ method: \"frak_listenToWalletStatus\" })\n .then((result) => {\n // Handle side effects of this request\n walletStatusSideEffect(client, result);\n\n // Return the result\n return result;\n });\n }\n\n // Otherwise, listen to the wallet status and return the first one received\n const firstResult = new Deferred<WalletStatusReturnType>();\n let hasResolved = false;\n\n // Start the listening request, and return the first result\n client.listenerRequest(\n {\n method: \"frak_listenToWalletStatus\",\n },\n (status) => {\n // Handle side effects of this request\n walletStatusSideEffect(client, status);\n\n // Transmit the status to the callback\n callback(status);\n\n // If the promise hasn't resolved yet, resolve it\n if (!hasResolved) {\n firstResult.resolve(status);\n hasResolved = true;\n }\n }\n );\n\n return firstResult.promise;\n}\n\n/**\n * Helper to save a potential interaction token\n * @param interactionToken\n */\nfunction walletStatusSideEffect(\n client: FrakClient,\n status: WalletStatusReturnType\n) {\n if (typeof window === \"undefined\") {\n return;\n }\n\n // Update the global properties\n client.openPanel?.setGlobalProperties({\n wallet: status.wallet ?? null,\n });\n\n if (status.interactionToken) {\n window.sessionStorage.setItem(\n \"frak-wallet-interaction-token\",\n status.interactionToken\n );\n ensureIdentity(status.interactionToken);\n } else {\n window.sessionStorage.removeItem(\"frak-wallet-interaction-token\");\n }\n}\n","import type {\n DisplayModalParamsType,\n FinalActionType,\n FinalModalStepType,\n FrakClient,\n LoginModalStepType,\n ModalRpcMetadata,\n ModalRpcStepsResultType,\n ModalStepTypes,\n SendTransactionModalStepType,\n} from \"../../types\";\nimport { displayModal } from \"../displayModal\";\n\n/**\n * Represent the type of the modal step builder\n */\nexport type ModalStepBuilder<\n Steps extends ModalStepTypes[] = ModalStepTypes[],\n> = {\n /**\n * The current modal params\n */\n params: DisplayModalParamsType<Steps>;\n /**\n * Add a send transaction step to the modal\n */\n sendTx: (\n options: SendTransactionModalStepType[\"params\"]\n ) => ModalStepBuilder<[...Steps, SendTransactionModalStepType]>;\n /**\n * Add a final step of type reward to the modal\n */\n reward: (\n options?: Omit<FinalModalStepType[\"params\"], \"action\">\n ) => ModalStepBuilder<[...Steps, FinalModalStepType]>;\n /**\n * Add a final step of type sharing to the modal\n */\n sharing: (\n sharingOptions?: Extract<\n FinalActionType,\n { key: \"sharing\" }\n >[\"options\"],\n options?: Omit<FinalModalStepType[\"params\"], \"action\">\n ) => ModalStepBuilder<[...Steps, FinalModalStepType]>;\n /**\n * Display the modal\n * @param metadataOverride - Function returning optional metadata to override the current modal metadata\n * @param placement - Optional placement ID to associate with this modal display\n */\n display: (\n metadataOverride?: (\n current?: ModalRpcMetadata\n ) => ModalRpcMetadata | undefined,\n placement?: string\n ) => Promise<ModalRpcStepsResultType<Steps>>;\n};\n\n/**\n * Represent the output type of the modal builder\n */\nexport type ModalBuilder = ModalStepBuilder<[LoginModalStepType]>;\n\n/**\n * Helper to craft Frak modal, and share a base initial config\n * @param client - The current Frak Client\n * @param args\n * @param args.metadata - Common modal metadata (customisation, language etc)\n * @param args.login - Login step parameters\n *\n * @description This function will create a modal builder with the provided metadata and login parameters.\n *\n * @example\n * Here is an example of how to use the `modalBuilder` to create and display a sharing modal:\n *\n * ```js\n * // Create the modal builder\n * const modalBuilder = window.FrakSDK.modalBuilder(frakClient, baseModalConfig);\n *\n * // Configure the information to be shared via the sharing link\n * const sharingConfig = {\n * popupTitle: \"Share this with your friends\",\n * text: \"Discover our product!\",\n * link: window.location.href,\n * };\n *\n * // Display the sharing modal\n * function modalShare() {\n * modalBuilder.sharing(sharingConfig).display();\n * }\n * ```\n *\n * @see {@link ModalStepTypes} for more info about each modal step types and their parameters\n * @see {@link ModalRpcMetadata} for more info about the metadata that can be passed to the modal\n * @see {@link ModalRpcStepsResultType} for more info about the result of each modal steps\n * @see {@link displayModal} for more info about how the modal is displayed\n */\nexport function modalBuilder(\n client: FrakClient,\n {\n metadata,\n login,\n }: {\n metadata?: ModalRpcMetadata;\n login?: LoginModalStepType[\"params\"];\n }\n): ModalBuilder {\n // Build the initial modal params\n const baseParams: DisplayModalParamsType<[LoginModalStepType]> = {\n steps: {\n login: login ?? {},\n },\n metadata,\n };\n\n // Return the step builder\n return modalStepsBuilder(client, baseParams);\n}\n\n/**\n * Modal step builder, allowing to add new steps to the modal, and to build and display it\n */\nfunction modalStepsBuilder<CurrentSteps extends ModalStepTypes[]>(\n client: FrakClient,\n params: DisplayModalParamsType<CurrentSteps>\n): ModalStepBuilder<CurrentSteps> {\n // Function add the send tx step\n function sendTx(options: SendTransactionModalStepType[\"params\"]) {\n return modalStepsBuilder<\n [...CurrentSteps, SendTransactionModalStepType]\n >(client, {\n ...params,\n steps: {\n ...params.steps,\n sendTransaction: options,\n },\n } as DisplayModalParamsType<\n [...CurrentSteps, SendTransactionModalStepType]\n >);\n }\n\n // Function to add a reward step at the end\n function reward(options?: Omit<FinalModalStepType[\"params\"], \"action\">) {\n return modalStepsBuilder<[...CurrentSteps, FinalModalStepType]>(\n client,\n {\n ...params,\n steps: {\n ...params.steps,\n final: {\n ...options,\n action: { key: \"reward\" },\n },\n },\n } as DisplayModalParamsType<[...CurrentSteps, FinalModalStepType]>\n );\n }\n\n // Function to add sharing step at the end\n function sharing(\n sharingOptions?: Extract<\n FinalActionType,\n { key: \"sharing\" }\n >[\"options\"],\n options?: Omit<FinalModalStepType[\"params\"], \"action\">\n ) {\n return modalStepsBuilder<[...CurrentSteps, FinalModalStepType]>(\n client,\n {\n ...params,\n steps: {\n ...params.steps,\n final: {\n ...options,\n action: { key: \"sharing\", options: sharingOptions },\n },\n },\n } as DisplayModalParamsType<[...CurrentSteps, FinalModalStepType]>\n );\n }\n\n async function display(\n metadataOverride?: (\n current?: ModalRpcMetadata\n ) => ModalRpcMetadata | undefined,\n placement?: string\n ) {\n if (metadataOverride) {\n params.metadata = metadataOverride(params.metadata ?? {});\n }\n return await displayModal(client, params, placement);\n }\n\n return {\n params,\n sendTx,\n reward,\n sharing,\n display,\n };\n}\n","import type {\n FrakClient,\n ModalRpcMetadata,\n SendTransactionModalStepType,\n SendTransactionReturnType,\n} from \"../../types\";\nimport { displayModal } from \"../displayModal\";\n\n/**\n * Parameters to directly show a modal used to send a transaction\n * @inline\n */\nexport type SendTransactionParams = {\n /**\n * The transaction to be sent (either a single tx or multiple ones)\n */\n tx: SendTransactionModalStepType[\"params\"][\"tx\"];\n /**\n * Custom metadata to be passed to the modal\n */\n metadata?: ModalRpcMetadata;\n};\n\n/**\n * Function used to send a user transaction, simple wrapper around the displayModal function to ease the send transaction process\n * @param client - The current Frak Client\n * @param args - The parameters\n * @returns The hash of the transaction that was sent in a promise\n *\n * @description This function will display a modal to the user with the provided transaction and metadata.\n *\n * @example\n * const { hash } = await sendTransaction(frakConfig, {\n * tx: {\n * to: \"0xdeadbeef\",\n * value: toHex(100n),\n * },\n * metadata: {\n * header: {\n * title: \"Sending eth\",\n * },\n * context: \"Send 100wei to 0xdeadbeef\",\n * },\n * });\n * console.log(\"Transaction hash:\", hash);\n */\nexport async function sendTransaction(\n client: FrakClient,\n { tx, metadata }: SendTransactionParams\n): Promise<SendTransactionReturnType> {\n // Trigger a modal with login options\n const result = await displayModal(client, {\n metadata,\n steps: {\n login: {},\n sendTransaction: { tx },\n },\n });\n\n // Return the tx result only\n return result.sendTransaction;\n}\n","import type {\n FrakClient,\n ModalRpcMetadata,\n SiweAuthenticateReturnType,\n SiweAuthenticationParams,\n} from \"../../types\";\nimport { displayModal } from \"../displayModal\";\n\n/**\n * Generate a random EIP-4361-compatible nonce.\n *\n * Matches viem/siwe's `generateSiweNonce` shape (96 alphanumeric chars) but\n * inlined here to avoid pulling viem's runtime utilities into the bundle.\n * Uses `crypto.getRandomValues` when available (browsers, modern Node) and\n * falls back to `Math.random` for the rare environment without WebCrypto.\n */\nfunction generateSiweNonce(length = 96): string {\n const byteCount = Math.ceil(length / 2);\n let hex = \"\";\n if (typeof crypto !== \"undefined\" && crypto.getRandomValues) {\n const bytes = new Uint8Array(byteCount);\n crypto.getRandomValues(bytes);\n for (let i = 0; i < bytes.length; i++) {\n hex += bytes[i].toString(16).padStart(2, \"0\");\n }\n } else {\n for (let i = 0; i < byteCount; i++) {\n hex += ((Math.random() * 256) | 0).toString(16).padStart(2, \"0\");\n }\n }\n return hex.substring(0, length);\n}\n\n/**\n * Parameter used to directly show a modal used to authenticate with SIWE\n * @inline\n */\nexport type SiweAuthenticateModalParams = {\n /**\n * Partial SIWE params, since we can rebuild them from the SDK if they are empty\n *\n * If no parameters provider, some fields will be recomputed from the current configuration and environment.\n * - `statement` will be set to a default value\n * - `nonce` will be generated\n * - `uri` will be set to the current domain\n * - `version` will be set to \"1\"\n * - `domain` will be set to the current window domain\n *\n * @default {}\n */\n siwe?: Partial<SiweAuthenticationParams>;\n /**\n * Custom metadata to be passed to the modal\n */\n metadata?: ModalRpcMetadata;\n};\n\n/**\n * Function used to launch a siwe authentication\n * @param client - The current Frak Client\n * @param args - The parameters\n * @returns The SIWE authentication result (message + signature) in a promise\n *\n * @description This function will display a modal to the user with the provided SIWE parameters and metadata.\n *\n * @example\n * import { siweAuthenticate } from \"@frak-labs/core-sdk/actions\";\n * import { parseSiweMessage } from \"viem/siwe\";\n *\n * const { signature, message } = await siweAuthenticate(frakConfig, {\n * siwe: {\n * statement: \"Sign in to My App\",\n * domain: \"my-app.com\",\n * expirationTimeTimestamp: Date.now() + 1000 * 60 * 5,\n * },\n * metadata: {\n * header: {\n * title: \"Sign in\",\n * },\n * context: \"Sign in to My App\",\n * },\n * });\n * console.log(\"Parsed final message:\", parseSiweMessage(message));\n * console.log(\"Siwe signature:\", signature);\n */\nexport async function siweAuthenticate(\n client: FrakClient,\n { siwe, metadata }: SiweAuthenticateModalParams\n): Promise<SiweAuthenticateReturnType> {\n const effectiveDomain = client.config?.domain ?? window.location.host;\n const realStatement =\n siwe?.statement ??\n `I confirm that I want to use my Frak wallet on: ${client.config.metadata.name}`;\n\n // Fill up the siwe request params\n const builtSiwe: SiweAuthenticationParams = {\n ...siwe,\n statement: realStatement,\n nonce: siwe?.nonce ?? generateSiweNonce(),\n uri: siwe?.uri ?? `https://${effectiveDomain}`,\n version: siwe?.version ?? \"1\",\n domain: effectiveDomain,\n };\n\n // Trigger a modal with login options\n const result = await displayModal(client, {\n metadata,\n steps: {\n login: {},\n siweAuthenticate: {\n siwe: builtSiwe,\n },\n },\n });\n\n // Return the SIWE result only\n return result.siweAuthenticate;\n}\n"],"mappings":"4JAaA,eAAsB,EAClB,EACA,EACA,EACwC,CACxC,OAAO,MAAM,EAAO,QAAQ,CACxB,OAAQ,6BACR,OAAQ,EACF,CAAC,EAAQ,EAAO,OAAO,SAAU,CAAS,EAC1C,CAAC,EAAQ,EAAO,OAAO,QAAQ,CACzC,CAAC,CACL,CCsFA,eAAsB,EAGlB,EACA,CAAE,QAAO,YACT,EACmC,CACnC,OAAQ,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,IAAS,KAAK,OAAO,EAAI,IAAO,GAAG,SAAS,EAAE,EAAE,SAAS,EAAG,GAAG,EAGvE,OAAO,EAAI,UAAU,EAAG,CAAM,CAClC,CAsDA,eAAsB,EAClB,EACA,CAAE,OAAM,YAC2B,CACnC,IAAM,EAAkB,EAAO,QAAQ,QAAU,OAAO,SAAS,KAC3D,EACF,GAAM,WACN,mDAAmD,EAAO,OAAO,SAAS,OAwB9E,OAAO,MAXc,EAAa,EAAQ,CACtC,WACA,MAAO,CACH,MAAO,CAAC,EACR,iBAAkB,CACd,KAAM,CAdd,GAAG,EACH,UAAW,EACX,MAAO,GAAM,OAAS,EAAkB,EACxC,IAAK,GAAM,KAAO,WAAW,IAC7B,QAAS,GAAM,SAAW,IAC1B,OAAQ,CASc,CAClB,CACJ,CACJ,CAAC,GAGa,gBAClB"}
|
|
1
|
+
{"version":3,"file":"actions-DtPVuk2e.js","names":[],"sources":["../src/actions/displayEmbeddedWallet.ts","../src/actions/displayModal.ts","../src/actions/displaySharingPage.ts","../src/actions/ensureIdentity.ts","../src/actions/getMerchantInformation.ts","../src/actions/getMergeToken.ts","../src/actions/getUserReferralStatus.ts","../src/actions/prepareSso.ts","../src/actions/sendInteraction.ts","../src/actions/referral/processReferral.ts","../src/actions/referral/referralInteraction.ts","../src/actions/referral/setupReferral.ts","../src/actions/trackPurchaseStatus.ts","../src/actions/watchWalletStatus.ts","../src/actions/wrapper/modalBuilder.ts","../src/actions/wrapper/sendTransaction.ts","../src/actions/wrapper/siweAuthenticate.ts"],"sourcesContent":["import type {\n DisplayEmbeddedWalletParamsType,\n DisplayEmbeddedWalletResultType,\n FrakClient,\n} from \"../types\";\n\n/**\n * Function used to display the Frak embedded wallet popup\n * @param client - The current Frak Client\n * @param params - The parameter used to customise the embedded wallet\n * @param placement - Optional placement ID to associate with this display request\n * @returns The embedded wallet display result\n */\nexport async function displayEmbeddedWallet(\n client: FrakClient,\n params: DisplayEmbeddedWalletParamsType,\n placement?: string\n): Promise<DisplayEmbeddedWalletResultType> {\n return await client.request({\n method: \"frak_displayEmbeddedWallet\",\n params: placement\n ? [params, client.config.metadata, placement]\n : [params, client.config.metadata],\n });\n}\n","import type {\n DisplayModalParamsType,\n FrakClient,\n ModalRpcStepsResultType,\n ModalStepTypes,\n} from \"../types\";\n\n/**\n * Function used to display a modal\n * @param client - The current Frak Client\n * @param args\n * @param args.steps - The different steps of the modal\n * @param args.metadata - The metadata for the modal (customization, etc)\n * @param placement - Optional placement ID to associate with this modal display\n * @returns The result of each modal steps\n *\n * @description This function will display a modal to the user with the provided steps and metadata.\n *\n * @remarks\n * - The UI of the displayed modal can be configured with the `customCss` property in the `customizations.css` field of the top-level config.\n * - The `login` step will be automatically skipped if the user is already logged in. It's safe to include this step in all cases to ensure proper user state.\n * - Steps are automatically reordered in the following sequence:\n * 1. `login` (if needed)\n * 2. All other steps in the order specified\n * 3. `success` (if included, always last)\n *\n * @example\n * Simple sharing modal with steps:\n * 1. Login (Skipped if already logged in)\n * 2. Display a success message with sharing link option\n *\n * ```ts\n * const results = await displayModal(frakConfig, {\n * steps: {\n * // Simple login with no SSO, nor customization\n * login: { allowSso: false },\n * // Success message\n * final: {\n * action: { key: \"reward\" },\n * // Skip this step, it will be only displayed in the stepper within the modal\n * autoSkip: true,\n * },\n * },\n * });\n *\n * console.log(\"Login step - wallet\", results.login.wallet);\n * ```\n *\n * @example\n * A full modal example, with a few customization options, with the steps:\n * 1. Login (Skipped if already logged in)\n * 2. Authenticate via SIWE\n * 3. Send a transaction\n * 4. Display a success message with sharing link options\n *\n * ```ts\n * const results = await displayModal(frakConfig, {\n * steps: {\n * // Login step\n * login: {\n * allowSso: true,\n * ssoMetadata: {\n * logoUrl: \"https://my-app.com/logo.png\",\n * homepageLink: \"https://my-app.com\",\n * },\n * },\n * // Siwe authentication\n * siweAuthenticate: {\n * siwe: {\n * domain: \"my-app.com\",\n * uri: \"https://my-app.com/\",\n * nonce: generateSiweNonce(),\n * version: \"1\",\n * },\n * },\n * // Send batched transaction\n * sendTransaction: {\n * tx: [\n * { to: \"0xdeadbeef\", data: \"0xdeadbeef\" },\n * { to: \"0xdeadbeef\", data: \"0xdeadbeef\" },\n * ],\n * },\n * // Success message with sharing options\n * final: {\n * action: {\n * key: \"sharing\",\n * options: {\n * popupTitle: \"Share the app\",\n * text: \"Discover my super app website\",\n * link: \"https://my-app.com\",\n * },\n * },\n * dismissedMetadata: {\n * title: \"Dismiss\",\n * description: \"You won't be rewarded for this sharing action\",\n * },\n * },\n * },\n * metadata: {\n * // Header of desktop modals\n * header: {\n * title: \"My-App\",\n * icon: \"https://my-app.com/logo.png\",\n * },\n * // Context that will be present in every modal steps\n * context: \"My-app overkill flow\",\n * },\n * });\n * ```\n */\nexport async function displayModal<\n T extends ModalStepTypes[] = ModalStepTypes[],\n>(\n client: FrakClient,\n { steps, metadata }: DisplayModalParamsType<T>,\n placement?: string\n): Promise<ModalRpcStepsResultType<T>> {\n return (await client.request({\n method: \"frak_displayModal\",\n params: placement\n ? [steps, metadata, client.config.metadata, placement]\n : [steps, metadata, client.config.metadata],\n })) as ModalRpcStepsResultType<T>;\n}\n","import type {\n DisplaySharingPageParamsType,\n DisplaySharingPageResultType,\n FrakClient,\n} from \"../types\";\n\n/**\n * Function used to display a sharing page\n * @param client - The current Frak Client\n * @param params - The parameters to customize the sharing page (products, link override, metadata)\n * @param placement - Optional placement ID to associate with this display request\n * @returns The result indicating the user's action (shared, copied, or dismissed)\n *\n * @description This function will display a full-page sharing UI to the user,\n * showing product info, estimated rewards, sharing steps, FAQ, and share/copy buttons.\n * The sharing link is generated from the user's wallet context + merchant info.\n *\n * @remarks\n * - The promise resolves on the first user action (share or copy) but the page stays visible\n * - The user can continue to share/copy multiple times after the initial resolution\n * - Dismissing the page after a share/copy action is a no-op (promise already resolved)\n * - If the user dismisses without any action, the promise resolves with `{ action: \"dismissed\" }`\n *\n * @example\n * ```ts\n * const result = await displaySharingPage(frakClient, {\n * products: [\n * {\n * title: \"Babies camel cuir velours bout carré\",\n * imageUrl: \"https://example.com/product.jpg\",\n * },\n * ],\n * });\n *\n * console.log(\"User action:\", result.action); // \"shared\" | \"copied\" | \"dismissed\"\n * ```\n */\nexport async function displaySharingPage(\n client: FrakClient,\n params: DisplaySharingPageParamsType,\n placement?: string\n): Promise<DisplaySharingPageResultType> {\n return await client.request({\n method: \"frak_displaySharingPage\",\n params: placement\n ? [params, client.config.metadata, placement]\n : [params, client.config.metadata],\n });\n}\n","import { getBackendUrl } from \"../config/backendUrl\";\nimport { getClientId } from \"../config/clientId\";\nimport { sdkConfigStore } from \"../config/sdkConfigStore\";\n\nconst ENSURE_STORAGE_PREFIX = \"frak-identity-ensured-\";\n\n/**\n * Ensure the current wallet ↔ clientId link exists on the backend.\n *\n * Called automatically by {@link watchWalletStatus} when a connected wallet\n * status is received. Acts as a failsafe: if the primary merge (SSO, pairing,\n * login/register) missed or silently failed, this ensures the link is\n * eventually established.\n *\n * The call is:\n * - **Idempotent** — if already linked, backend returns immediately\n * - **Deduplicated** — only fires once per browser session per merchant\n * - **Fire-and-forget** — errors are logged but never thrown\n *\n * @param interactionToken - The SDK JWT from wallet status (x-wallet-sdk-auth)\n *\n * @example\n * ```ts\n * // Usually called automatically via watchWalletStatus side effect.\n * // Can also be called manually if needed:\n * await ensureIdentity(\"eyJhbGciOi...\");\n * ```\n */\nexport async function ensureIdentity(interactionToken: string): Promise<void> {\n if (typeof window === \"undefined\") {\n return;\n }\n\n const clientId = getClientId();\n if (!clientId) {\n return;\n }\n\n const merchantId = await sdkConfigStore.resolveMerchantId();\n if (!merchantId) {\n return;\n }\n\n const storageKey = `${ENSURE_STORAGE_PREFIX}${merchantId}`;\n if (window.sessionStorage.getItem(storageKey)) {\n return;\n }\n\n try {\n const backendUrl = getBackendUrl();\n const response = await fetch(`${backendUrl}/user/identity/ensure`, {\n method: \"POST\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n \"x-wallet-sdk-auth\": interactionToken,\n \"x-frak-client-id\": clientId,\n },\n body: JSON.stringify({ merchantId }),\n });\n\n if (response.ok) {\n window.sessionStorage.setItem(storageKey, \"1\");\n }\n } catch {\n // Fire-and-forget — retry on next session\n }\n}\n","import type { FrakClient, GetMerchantInformationReturnType } from \"../types\";\nimport { withCache } from \"../utils/cache\";\n\n/**\n * Fetch the current merchant information (name, rewards, tiers) from the wallet iframe.\n *\n * Results are cached in memory for 30 seconds by default. Concurrent calls\n * while a request is in-flight are deduplicated automatically.\n *\n * @param client - The current Frak Client\n * @param options - Optional cache configuration\n * @param options.cacheTime - Time in ms to cache the result. Default: 30_000 (30s). Set to 0 to disable.\n * @returns The merchant information including available reward tiers\n *\n * @see {@link @frak-labs/core-sdk!index.GetMerchantInformationReturnType | `GetMerchantInformationReturnType`} for the return type shape\n */\nexport async function getMerchantInformation(\n client: FrakClient,\n options?: { cacheTime?: number }\n): Promise<GetMerchantInformationReturnType> {\n return withCache(\n () =>\n client.request({\n method: \"frak_getMerchantInformation\",\n }),\n {\n cacheKey: \"frak_getMerchantInformation\",\n cacheTime: options?.cacheTime,\n }\n );\n}\n","import type { FrakClient } from \"../types\";\nimport { withCache } from \"../utils/cache\";\n\n/**\n * Fetch a merge token for the current anonymous identity.\n *\n * Used by in-app browser redirect flows to preserve identity\n * when switching from a WebView to the system browser.\n * The token is appended as `?fmt=` to the redirect URL.\n *\n * Results are cached in memory for 30 seconds by default. Concurrent calls\n * while a request is in-flight are deduplicated automatically.\n *\n * @param client - The current Frak Client\n * @param options - Optional cache configuration\n * @param options.cacheTime - Time in ms to cache the result. Default: 30_000 (30s). Set to 0 to disable.\n * @returns The merge token string, or null if unavailable\n */\nexport async function getMergeToken(\n client: FrakClient,\n options?: { cacheTime?: number }\n): Promise<string | null> {\n return withCache(\n () =>\n client.request({\n method: \"frak_getMergeToken\",\n }),\n {\n cacheKey: \"frak_getMergeToken\",\n cacheTime: options?.cacheTime,\n }\n );\n}\n","import type { FrakClient, UserReferralStatusType } from \"../types\";\nimport { withCache } from \"../utils/cache\";\n\n/**\n * Fetch the current user's referral status on the current merchant.\n *\n * The listener resolves the user's identity (via clientId or wallet session)\n * and checks whether a referral link exists where the user is the referee.\n *\n * Results are cached in memory for 30 seconds by default. Concurrent calls\n * while a request is in-flight are deduplicated automatically.\n *\n * Returns `null` when the user's identity cannot be resolved.\n *\n * @param client - The current Frak Client\n * @param options - Optional cache configuration\n * @param options.cacheTime - Time in ms to cache the result. Default: 30_000 (30s). Set to 0 to disable.\n * @returns The user's referral status, or `null` if identity cannot be resolved\n *\n * @example\n * ```ts\n * const status = await getUserReferralStatus(client);\n * if (status?.isReferred) {\n * console.log(\"User was referred to this merchant\");\n * }\n * ```\n */\nexport async function getUserReferralStatus(\n client: FrakClient,\n options?: { cacheTime?: number }\n): Promise<UserReferralStatusType | null> {\n return withCache(\n () =>\n client.request({\n method: \"frak_getUserReferralStatus\",\n }),\n {\n cacheKey: \"frak_getUserReferralStatus\",\n cacheTime: options?.cacheTime,\n }\n );\n}\n","import type {\n FrakClient,\n PrepareSsoParamsType,\n PrepareSsoReturnType,\n} from \"../types\";\n\n/**\n * Generate SSO URL without opening popup\n *\n * This is a **synchronous**, client-side function that generates the SSO URL\n * without any RPC calls to the wallet iframe. Use this when you need:\n * - Custom URL modifications before opening popup\n * - Pre-generation for advanced popup strategies\n * - URL inspection/logging before SSO flow\n *\n * @param client - The current Frak Client\n * @param args - The SSO parameters\n * @returns Object containing the generated ssoUrl\n *\n * @example\n * ```ts\n * // Generate URL for inspection\n * const { ssoUrl } = prepareSso(client, {\n * metadata: { logoUrl: \"...\" },\n * directExit: true\n * });\n * console.log(\"Opening SSO:\", ssoUrl);\n *\n * // Add custom params\n * const customUrl = `${ssoUrl}&tracking=abc123`;\n * await openSso(client, { metadata, ssoPopupUrl: customUrl });\n * ```\n *\n * @remarks\n * For most use cases, just use `openSso()` which handles URL generation automatically.\n * Only use `prepareSso()` when you need explicit control over the URL.\n */\nexport async function prepareSso(\n client: FrakClient,\n args: PrepareSsoParamsType\n): Promise<PrepareSsoReturnType> {\n const { metadata, customizations } = client.config;\n\n return await client.request({\n method: \"frak_prepareSso\",\n params: [args, metadata.name, customizations?.css],\n });\n}\n","import { getClientId } from \"../config/clientId\";\nimport type { FrakClient } from \"../types\";\nimport type { SendInteractionParamsType } from \"../types/rpc/interaction\";\n\n/**\n * Send an interaction to the backend via the listener RPC.\n * Fire-and-forget: errors are caught and logged, not thrown.\n *\n * @param client - The Frak client instance\n * @param params - The interaction parameters\n *\n * @description Sends a user interaction event through the wallet iframe RPC. Supports three interaction types: arrival tracking, sharing events, and custom interactions.\n *\n * @example\n * Track a user arrival with referral attribution:\n * ```ts\n * await sendInteraction(client, {\n * type: \"arrival\",\n * referrerWallet: \"0x1234...abcd\",\n * landingUrl: window.location.href,\n * utmSource: \"twitter\",\n * utmMedium: \"social\",\n * utmCampaign: \"launch-2026\",\n * });\n * ```\n *\n * @example\n * Track a sharing event:\n * ```ts\n * await sendInteraction(client, { type: \"sharing\" });\n * ```\n *\n * @example\n * Send a custom interaction:\n * ```ts\n * await sendInteraction(client, {\n * type: \"custom\",\n * customType: \"newsletter_signup\",\n * data: { email: \"user@example.com\" },\n * });\n * ```\n */\nexport async function sendInteraction(\n client: FrakClient,\n params: SendInteractionParamsType\n): Promise<void> {\n try {\n await client.request({\n method: \"frak_sendInteraction\",\n params: [params, { clientId: getClientId() }],\n });\n } catch {\n // Silent failure - fire-and-forget\n console.warn(\"[Frak SDK] Failed to send interaction:\", params.type);\n }\n}\n","import { getClientId } from \"../../config/clientId\";\nimport { FrakContextManager } from \"../../context\";\nimport { areAddressesEqual } from \"../../context/address\";\nimport type {\n FrakClient,\n FrakContext,\n FrakContextV2,\n WalletStatusReturnType,\n} from \"../../types\";\nimport { isV1Context, isV2Context } from \"../../types\";\nimport { trackEvent } from \"../../utils\";\nimport { sendInteraction } from \"../sendInteraction\";\n\n/**\n * Options for the referral auto-interaction process.\n */\nexport type ProcessReferralOptions = {\n /**\n * If true, always replace the URL with the current user's referral context\n * so the next visitor gets referred by this user.\n * @defaultValue false\n */\n alwaysAppendUrl?: boolean;\n /**\n * Merchant ID for building the current user's referral context.\n * Required when `alwaysAppendUrl` is true and the incoming context is V1.\n * For V2 contexts, the merchantId is already embedded in the context.\n */\n merchantId?: string;\n};\n\n/**\n * The different states of the referral process.\n * @inline\n */\ntype ReferralState =\n | \"idle\"\n | \"processing\"\n | \"success\"\n | \"no-referrer\"\n | \"self-referral\";\n\n/**\n * Track an arrival event if the context version is recognized.\n * Sends both tracking analytics and the arrival interaction RPC.\n *\n * @returns true if the context was valid and tracked, false otherwise\n */\nfunction trackArrivalIfValid(\n client: FrakClient,\n frakContext: FrakContext,\n walletStatus?: WalletStatusReturnType\n): boolean {\n if (isV2Context(frakContext)) {\n trackEvent(client, \"user_referred_started\", {\n referrer_client_id: frakContext.c,\n referrer_wallet: frakContext.w,\n wallet_status: walletStatus?.key,\n });\n sendInteraction(client, {\n type: \"arrival\",\n referrerClientId: frakContext.c,\n referrerMerchantId: frakContext.m,\n referrerWallet: frakContext.w,\n referralTimestamp: frakContext.t,\n });\n return true;\n }\n\n if (isV1Context(frakContext)) {\n trackEvent(client, \"user_referred_started\", {\n referrer: frakContext.r,\n wallet_status: walletStatus?.key,\n });\n sendInteraction(client, {\n type: \"arrival\",\n referrerWallet: frakContext.r,\n });\n return true;\n }\n\n return false;\n}\n\n/**\n * Build a V2 context representing the current user for URL replacement.\n *\n * Emits both `c` (anonymous clientId) and `w` (wallet) when available — wallet\n * is the preferred identity signal and takes attribution precedence downstream.\n * Returns null when neither identifier is available.\n */\nfunction buildCurrentUserContext(\n merchantId: string,\n wallet?: WalletStatusReturnType[\"wallet\"]\n): FrakContextV2 | null {\n const clientId = getClientId();\n if (!clientId && !wallet) return null;\n return {\n v: 2,\n m: merchantId,\n t: Math.floor(Date.now() / 1000),\n ...(clientId ? { c: clientId } : {}),\n ...(wallet ? { w: wallet } : {}),\n };\n}\n\n/**\n * Client-side self-referral preflight check.\n * Prevents unnecessary backend round-trips for obvious self-referrals.\n */\nfunction isSelfReferral(\n frakContext: FrakContext,\n walletStatus?: WalletStatusReturnType\n): boolean {\n if (isV2Context(frakContext)) {\n // Wallet match takes precedence — it's the strongest signal we have.\n if (frakContext.w && walletStatus?.wallet) {\n return areAddressesEqual(frakContext.w, walletStatus.wallet);\n }\n if (frakContext.c) {\n return getClientId() === frakContext.c;\n }\n return false;\n }\n if (isV1Context(frakContext) && walletStatus?.wallet) {\n return areAddressesEqual(frakContext.r, walletStatus.wallet);\n }\n return false;\n}\n\n/**\n * Handle the full referral interaction flow:\n *\n * 1. Check if the user has been referred (if not, early exit)\n * 2. Preflight self-referral check (if yes, early exit)\n * 3. Track the arrival event\n * 4. Replace the current URL with the user's own referral context\n * 5. Return the resulting referral state\n *\n * @param client - The current Frak Client\n * @param args\n * @param args.walletStatus - The current user wallet status\n * @param args.frakContext - The referral context parsed from the URL\n * @param args.options - Options for URL replacement and merchant context\n * @returns The referral state\n *\n * @see {@link @frak-labs/core-sdk!ModalStepTypes} for modal step types\n */\nexport function processReferral(\n client: FrakClient,\n {\n walletStatus,\n frakContext,\n options,\n }: {\n walletStatus?: WalletStatusReturnType;\n frakContext?: FrakContext | null;\n options?: ProcessReferralOptions;\n }\n): ReferralState {\n if (!frakContext) {\n return \"no-referrer\";\n }\n\n if (isSelfReferral(frakContext, walletStatus)) {\n return \"self-referral\";\n }\n\n if (!trackArrivalIfValid(client, frakContext, walletStatus)) {\n return \"no-referrer\";\n }\n\n // V2 context embeds merchantId; V1 falls back to options\n const contextMerchantId = isV2Context(frakContext)\n ? frakContext.m\n : options?.merchantId;\n\n const replaceContext =\n options?.alwaysAppendUrl && contextMerchantId\n ? buildCurrentUserContext(contextMerchantId, walletStatus?.wallet)\n : null;\n\n FrakContextManager.replaceUrl({\n url: window.location?.href,\n context: replaceContext,\n });\n\n trackEvent(client, \"user_referred_completed\", {\n status: \"success\",\n });\n\n return \"success\";\n}\n","import { FrakContextManager } from \"../../context\";\nimport type { FrakClient } from \"../../types\";\nimport { watchWalletStatus } from \"../index\";\nimport {\n type ProcessReferralOptions,\n processReferral,\n} from \"./processReferral\";\n\n/**\n * Function used to handle referral interactions\n * @param client - The current Frak Client\n * @param args\n * @param args.options - Some options for the referral interaction\n *\n * @returns A promise with the resulting referral state, or undefined in case of an error\n *\n * @description This function will automatically handle the referral interaction process\n *\n * @see {@link processReferral} for more details on the automatic referral handling process\n */\nexport async function referralInteraction(\n client: FrakClient,\n {\n options,\n }: {\n options?: ProcessReferralOptions;\n } = {}\n) {\n // Get the current frak context\n const frakContext = FrakContextManager.parse({\n url: window.location.href,\n });\n\n // Get the current wallet status\n const currentWalletStatus = await watchWalletStatus(client);\n\n try {\n return processReferral(client, {\n walletStatus: currentWalletStatus,\n frakContext,\n options,\n });\n } catch (error) {\n console.warn(\"Error processing referral\", { error });\n }\n return;\n}\n","import type { FrakClient } from \"../../types\";\nimport { referralInteraction } from \"./referralInteraction\";\n\n/**\n * Custom event name dispatched on successful referral processing.\n *\n * Fired once per page load when a valid referral context is found in the URL\n * and successfully tracked. Consumers (e.g. `<frak-banner>`) listen for this\n * to display a referral success message.\n */\nexport const REFERRAL_SUCCESS_EVENT = \"frak:referral-success\";\n\n/**\n * Process referral context and emit a DOM event on success.\n *\n * - Calls {@link referralInteraction} to detect and track any referral in the URL\n * - On `\"success\"`, dispatches a bare {@link REFERRAL_SUCCESS_EVENT} on `window`\n * - Silently swallows errors (fire-and-forget during SDK init)\n *\n * @param client - The initialized Frak client\n */\nexport async function setupReferral(client: FrakClient): Promise<void> {\n try {\n const state = await referralInteraction(client);\n\n if (state === \"success\") {\n window.dispatchEvent(new Event(REFERRAL_SUCCESS_EVENT));\n }\n } catch (error) {\n console.warn(\"[Frak] Referral setup failed\", error);\n }\n}\n","import { getBackendUrl } from \"../config/backendUrl\";\nimport { getClientId } from \"../config/clientId\";\nimport { sdkConfigStore } from \"../config/sdkConfigStore\";\n\n/**\n * Function used to track the status of a purchase\n * when a purchase is tracked, the `purchaseCompleted` interactions will be automatically send for the user when we receive the purchase confirmation via webhook.\n *\n * @param args.customerId - The customer id that made the purchase (on your side)\n * @param args.orderId - The order id of the purchase (on your side)\n * @param args.token - The token of the purchase\n * @param args.merchantId - Optional explicit merchant id to use for the tracking request\n *\n * @description This function will send a request to the backend to listen for the purchase status.\n *\n * @example\n * async function trackPurchase(checkout) {\n * const payload = {\n * customerId: checkout.order.customer.id,\n * orderId: checkout.order.id,\n * token: checkout.token,\n * merchantId: \"your-merchant-id\",\n * };\n *\n * await trackPurchaseStatus(payload);\n * }\n *\n * @remarks\n * - Merchant id is resolved in this order: explicit `args.merchantId`, then `sdkConfigStore.resolveMerchantId()` (config store → sessionStorage → backend fetch).\n * - This function supports anonymous users and will use the `x-frak-client-id` header when available.\n * - At least one identity source must exist (`frak-wallet-interaction-token` or `x-frak-client-id`), otherwise the tracking request is skipped.\n * - This function will print a warning if used in a non-browser environment or if no identity / merchant id can be resolved.\n */\nexport async function trackPurchaseStatus(args: {\n customerId: string | number;\n orderId: string | number;\n token: string;\n merchantId?: string;\n}) {\n if (typeof window === \"undefined\") {\n console.warn(\"[Frak] No window found, can't track purchase\");\n return;\n }\n\n const interactionToken = window.sessionStorage.getItem(\n \"frak-wallet-interaction-token\"\n );\n\n const clientId = getClientId();\n if (!interactionToken && !clientId) {\n console.warn(\"[Frak] No identity found, skipping purchase check\");\n return;\n }\n\n const merchantId =\n args.merchantId ?? (await sdkConfigStore.resolveMerchantId());\n\n if (!merchantId) {\n console.warn(\"[Frak] No merchant id found, skipping purchase check\");\n return;\n }\n\n const headers: Record<string, string> = {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n };\n\n if (interactionToken) {\n headers[\"x-wallet-sdk-auth\"] = interactionToken;\n }\n\n if (clientId) {\n headers[\"x-frak-client-id\"] = clientId;\n }\n\n // Submit the listening request\n const backendUrl = getBackendUrl();\n await fetch(`${backendUrl}/user/track/purchase`, {\n method: \"POST\",\n headers,\n body: JSON.stringify({\n customerId: args.customerId,\n orderId: args.orderId,\n token: args.token,\n merchantId,\n }),\n });\n}\n","import { Deferred } from \"@frak-labs/frame-connector\";\nimport type { FrakClient } from \"../types/client\";\nimport type { WalletStatusReturnType } from \"../types/rpc/walletStatus\";\nimport { ensureIdentity } from \"./ensureIdentity\";\n\n/**\n * Function used to watch the current frak wallet status\n * @param client - The current Frak Client\n * @param callback - The callback that will receive any wallet status change\n * @returns A promise resolving with the initial wallet status\n *\n * @description This function will return the current wallet status, and will listen to any change in the wallet status.\n *\n * @example\n * await watchWalletStatus(frakConfig, (status: WalletStatusReturnType) => {\n * if (status.key === \"connected\") {\n * console.log(\"Wallet connected:\", status.wallet);\n * } else {\n * console.log(\"Wallet not connected\");\n * }\n * });\n */\nexport function watchWalletStatus(\n client: FrakClient,\n callback?: (status: WalletStatusReturnType) => void\n): Promise<WalletStatusReturnType> {\n // If no callback is provided, just do a request with deferred result\n if (!callback) {\n return client\n .request({ method: \"frak_listenToWalletStatus\" })\n .then((result) => {\n // Handle side effects of this request\n walletStatusSideEffect(client, result);\n\n // Return the result\n return result;\n });\n }\n\n // Otherwise, listen to the wallet status and return the first one received\n const firstResult = new Deferred<WalletStatusReturnType>();\n let hasResolved = false;\n\n // Start the listening request, and return the first result\n client.listenerRequest(\n {\n method: \"frak_listenToWalletStatus\",\n },\n (status) => {\n // Handle side effects of this request\n walletStatusSideEffect(client, status);\n\n // Transmit the status to the callback\n callback(status);\n\n // If the promise hasn't resolved yet, resolve it\n if (!hasResolved) {\n firstResult.resolve(status);\n hasResolved = true;\n }\n }\n );\n\n return firstResult.promise;\n}\n\n/**\n * Helper to save a potential interaction token\n * @param interactionToken\n */\nfunction walletStatusSideEffect(\n client: FrakClient,\n status: WalletStatusReturnType\n) {\n if (typeof window === \"undefined\") {\n return;\n }\n\n // Update the global properties\n client.openPanel?.setGlobalProperties({\n wallet: status.wallet ?? null,\n });\n\n if (status.interactionToken) {\n window.sessionStorage.setItem(\n \"frak-wallet-interaction-token\",\n status.interactionToken\n );\n ensureIdentity(status.interactionToken);\n } else {\n window.sessionStorage.removeItem(\"frak-wallet-interaction-token\");\n }\n}\n","import type {\n DisplayModalParamsType,\n FinalActionType,\n FinalModalStepType,\n FrakClient,\n LoginModalStepType,\n ModalRpcMetadata,\n ModalRpcStepsResultType,\n ModalStepTypes,\n SendTransactionModalStepType,\n} from \"../../types\";\nimport { displayModal } from \"../displayModal\";\n\n/**\n * Represent the type of the modal step builder\n */\nexport type ModalStepBuilder<\n Steps extends ModalStepTypes[] = ModalStepTypes[],\n> = {\n /**\n * The current modal params\n */\n params: DisplayModalParamsType<Steps>;\n /**\n * Add a send transaction step to the modal\n */\n sendTx: (\n options: SendTransactionModalStepType[\"params\"]\n ) => ModalStepBuilder<[...Steps, SendTransactionModalStepType]>;\n /**\n * Add a final step of type reward to the modal\n */\n reward: (\n options?: Omit<FinalModalStepType[\"params\"], \"action\">\n ) => ModalStepBuilder<[...Steps, FinalModalStepType]>;\n /**\n * Add a final step of type sharing to the modal\n */\n sharing: (\n sharingOptions?: Extract<\n FinalActionType,\n { key: \"sharing\" }\n >[\"options\"],\n options?: Omit<FinalModalStepType[\"params\"], \"action\">\n ) => ModalStepBuilder<[...Steps, FinalModalStepType]>;\n /**\n * Display the modal\n * @param metadataOverride - Function returning optional metadata to override the current modal metadata\n * @param placement - Optional placement ID to associate with this modal display\n */\n display: (\n metadataOverride?: (\n current?: ModalRpcMetadata\n ) => ModalRpcMetadata | undefined,\n placement?: string\n ) => Promise<ModalRpcStepsResultType<Steps>>;\n};\n\n/**\n * Represent the output type of the modal builder\n */\nexport type ModalBuilder = ModalStepBuilder<[LoginModalStepType]>;\n\n/**\n * Helper to craft Frak modal, and share a base initial config\n * @param client - The current Frak Client\n * @param args\n * @param args.metadata - Common modal metadata (customisation, language etc)\n * @param args.login - Login step parameters\n *\n * @description This function will create a modal builder with the provided metadata and login parameters.\n *\n * @example\n * Here is an example of how to use the `modalBuilder` to create and display a sharing modal:\n *\n * ```js\n * // Create the modal builder\n * const modalBuilder = window.FrakSDK.modalBuilder(frakClient, baseModalConfig);\n *\n * // Configure the information to be shared via the sharing link\n * const sharingConfig = {\n * popupTitle: \"Share this with your friends\",\n * text: \"Discover our product!\",\n * link: window.location.href,\n * };\n *\n * // Display the sharing modal\n * function modalShare() {\n * modalBuilder.sharing(sharingConfig).display();\n * }\n * ```\n *\n * @see {@link ModalStepTypes} for more info about each modal step types and their parameters\n * @see {@link ModalRpcMetadata} for more info about the metadata that can be passed to the modal\n * @see {@link ModalRpcStepsResultType} for more info about the result of each modal steps\n * @see {@link displayModal} for more info about how the modal is displayed\n */\nexport function modalBuilder(\n client: FrakClient,\n {\n metadata,\n login,\n }: {\n metadata?: ModalRpcMetadata;\n login?: LoginModalStepType[\"params\"];\n }\n): ModalBuilder {\n // Build the initial modal params\n const baseParams: DisplayModalParamsType<[LoginModalStepType]> = {\n steps: {\n login: login ?? {},\n },\n metadata,\n };\n\n // Return the step builder\n return modalStepsBuilder(client, baseParams);\n}\n\n/**\n * Modal step builder, allowing to add new steps to the modal, and to build and display it\n */\nfunction modalStepsBuilder<CurrentSteps extends ModalStepTypes[]>(\n client: FrakClient,\n params: DisplayModalParamsType<CurrentSteps>\n): ModalStepBuilder<CurrentSteps> {\n // Function add the send tx step\n function sendTx(options: SendTransactionModalStepType[\"params\"]) {\n return modalStepsBuilder<\n [...CurrentSteps, SendTransactionModalStepType]\n >(client, {\n ...params,\n steps: {\n ...params.steps,\n sendTransaction: options,\n },\n } as DisplayModalParamsType<\n [...CurrentSteps, SendTransactionModalStepType]\n >);\n }\n\n // Function to add a reward step at the end\n function reward(options?: Omit<FinalModalStepType[\"params\"], \"action\">) {\n return modalStepsBuilder<[...CurrentSteps, FinalModalStepType]>(\n client,\n {\n ...params,\n steps: {\n ...params.steps,\n final: {\n ...options,\n action: { key: \"reward\" },\n },\n },\n } as DisplayModalParamsType<[...CurrentSteps, FinalModalStepType]>\n );\n }\n\n // Function to add sharing step at the end\n function sharing(\n sharingOptions?: Extract<\n FinalActionType,\n { key: \"sharing\" }\n >[\"options\"],\n options?: Omit<FinalModalStepType[\"params\"], \"action\">\n ) {\n return modalStepsBuilder<[...CurrentSteps, FinalModalStepType]>(\n client,\n {\n ...params,\n steps: {\n ...params.steps,\n final: {\n ...options,\n action: { key: \"sharing\", options: sharingOptions },\n },\n },\n } as DisplayModalParamsType<[...CurrentSteps, FinalModalStepType]>\n );\n }\n\n async function display(\n metadataOverride?: (\n current?: ModalRpcMetadata\n ) => ModalRpcMetadata | undefined,\n placement?: string\n ) {\n if (metadataOverride) {\n params.metadata = metadataOverride(params.metadata ?? {});\n }\n return await displayModal(client, params, placement);\n }\n\n return {\n params,\n sendTx,\n reward,\n sharing,\n display,\n };\n}\n","import type {\n FrakClient,\n ModalRpcMetadata,\n SendTransactionModalStepType,\n SendTransactionReturnType,\n} from \"../../types\";\nimport { displayModal } from \"../displayModal\";\n\n/**\n * Parameters to directly show a modal used to send a transaction\n * @inline\n */\nexport type SendTransactionParams = {\n /**\n * The transaction to be sent (either a single tx or multiple ones)\n */\n tx: SendTransactionModalStepType[\"params\"][\"tx\"];\n /**\n * Custom metadata to be passed to the modal\n */\n metadata?: ModalRpcMetadata;\n};\n\n/**\n * Function used to send a user transaction, simple wrapper around the displayModal function to ease the send transaction process\n * @param client - The current Frak Client\n * @param args - The parameters\n * @returns The hash of the transaction that was sent in a promise\n *\n * @description This function will display a modal to the user with the provided transaction and metadata.\n *\n * @example\n * const { hash } = await sendTransaction(frakConfig, {\n * tx: {\n * to: \"0xdeadbeef\",\n * value: toHex(100n),\n * },\n * metadata: {\n * header: {\n * title: \"Sending eth\",\n * },\n * context: \"Send 100wei to 0xdeadbeef\",\n * },\n * });\n * console.log(\"Transaction hash:\", hash);\n */\nexport async function sendTransaction(\n client: FrakClient,\n { tx, metadata }: SendTransactionParams\n): Promise<SendTransactionReturnType> {\n // Trigger a modal with login options\n const result = await displayModal(client, {\n metadata,\n steps: {\n login: {},\n sendTransaction: { tx },\n },\n });\n\n // Return the tx result only\n return result.sendTransaction;\n}\n","import type {\n FrakClient,\n ModalRpcMetadata,\n SiweAuthenticateReturnType,\n SiweAuthenticationParams,\n} from \"../../types\";\nimport { displayModal } from \"../displayModal\";\n\n/**\n * Generate a random EIP-4361-compatible nonce.\n *\n * Matches viem/siwe's `generateSiweNonce` shape (96 alphanumeric chars) but\n * inlined here to avoid pulling viem's runtime utilities into the bundle.\n * Uses `crypto.getRandomValues` when available (browsers, modern Node) and\n * falls back to `Math.random` for the rare environment without WebCrypto.\n */\nfunction generateSiweNonce(length = 96): string {\n const byteCount = Math.ceil(length / 2);\n let hex = \"\";\n if (typeof crypto !== \"undefined\" && crypto.getRandomValues) {\n const bytes = new Uint8Array(byteCount);\n crypto.getRandomValues(bytes);\n for (let i = 0; i < bytes.length; i++) {\n hex += bytes[i].toString(16).padStart(2, \"0\");\n }\n } else {\n for (let i = 0; i < byteCount; i++) {\n hex += ((Math.random() * 256) | 0).toString(16).padStart(2, \"0\");\n }\n }\n return hex.substring(0, length);\n}\n\n/**\n * Parameter used to directly show a modal used to authenticate with SIWE\n * @inline\n */\nexport type SiweAuthenticateModalParams = {\n /**\n * Partial SIWE params, since we can rebuild them from the SDK if they are empty\n *\n * If no parameters provider, some fields will be recomputed from the current configuration and environment.\n * - `statement` will be set to a default value\n * - `nonce` will be generated\n * - `uri` will be set to the current domain\n * - `version` will be set to \"1\"\n * - `domain` will be set to the current window domain\n *\n * @default {}\n */\n siwe?: Partial<SiweAuthenticationParams>;\n /**\n * Custom metadata to be passed to the modal\n */\n metadata?: ModalRpcMetadata;\n};\n\n/**\n * Function used to launch a siwe authentication\n * @param client - The current Frak Client\n * @param args - The parameters\n * @returns The SIWE authentication result (message + signature) in a promise\n *\n * @description This function will display a modal to the user with the provided SIWE parameters and metadata.\n *\n * @example\n * import { siweAuthenticate } from \"@frak-labs/core-sdk/actions\";\n * import { parseSiweMessage } from \"viem/siwe\";\n *\n * const { signature, message } = await siweAuthenticate(frakConfig, {\n * siwe: {\n * statement: \"Sign in to My App\",\n * domain: \"my-app.com\",\n * expirationTimeTimestamp: Date.now() + 1000 * 60 * 5,\n * },\n * metadata: {\n * header: {\n * title: \"Sign in\",\n * },\n * context: \"Sign in to My App\",\n * },\n * });\n * console.log(\"Parsed final message:\", parseSiweMessage(message));\n * console.log(\"Siwe signature:\", signature);\n */\nexport async function siweAuthenticate(\n client: FrakClient,\n { siwe, metadata }: SiweAuthenticateModalParams\n): Promise<SiweAuthenticateReturnType> {\n const effectiveDomain = client.config?.domain ?? window.location.host;\n const realStatement =\n siwe?.statement ??\n `I confirm that I want to use my Frak wallet on: ${client.config.metadata.name}`;\n\n // Fill up the siwe request params\n const builtSiwe: SiweAuthenticationParams = {\n ...siwe,\n statement: realStatement,\n nonce: siwe?.nonce ?? generateSiweNonce(),\n uri: siwe?.uri ?? `https://${effectiveDomain}`,\n version: siwe?.version ?? \"1\",\n domain: effectiveDomain,\n };\n\n // Trigger a modal with login options\n const result = await displayModal(client, {\n metadata,\n steps: {\n login: {},\n siweAuthenticate: {\n siwe: builtSiwe,\n },\n },\n });\n\n // Return the SIWE result only\n return result.siweAuthenticate;\n}\n"],"mappings":"4JAaA,eAAsB,EAClB,EACA,EACA,EACwC,CACxC,OAAO,MAAM,EAAO,QAAQ,CACxB,OAAQ,6BACR,OAAQ,EACF,CAAC,EAAQ,EAAO,OAAO,SAAU,CAAS,EAC1C,CAAC,EAAQ,EAAO,OAAO,QAAQ,CACzC,CAAC,CACL,CCsFA,eAAsB,EAGlB,EACA,CAAE,QAAO,YACT,EACmC,CACnC,OAAQ,MAAM,EAAO,QAAQ,CACzB,OAAQ,oBACR,OAAQ,EACF,CAAC,EAAO,EAAU,EAAO,OAAO,SAAU,CAAS,EACnD,CAAC,EAAO,EAAU,EAAO,OAAO,QAAQ,CAClD,CAAC,CACL,CCtFA,eAAsB,EAClB,EACA,EACA,EACqC,CACrC,OAAO,MAAM,EAAO,QAAQ,CACxB,OAAQ,0BACR,OAAQ,EACF,CAAC,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AS,OAwB9E,OAAO,MAXc,EAAa,EAAQ,CACtC,WACA,MAAO,CACH,MAAO,CAAC,EACR,iBAAkB,CACd,KAAM,CAdd,GAAG,EACH,UAAW,EACX,MAAO,GAAM,OAAS,EAAkB,EACxC,IAAK,GAAM,KAAO,WAAW,IAC7B,QAAS,GAAM,SAAW,IAC1B,OAAQ,CASc,CAClB,CACJ,CACJ,CAAC,GAGa,gBAClB"}
|
package/dist/actions.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./frakContext-CeVlWFcX.cjs`),t=require(`./actions-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./frakContext-CeVlWFcX.cjs`),t=require(`./actions-Cyn4asew.cjs`);exports.REFERRAL_SUCCESS_EVENT=t.o,exports.displayEmbeddedWallet=t.v,exports.displayModal=t._,exports.displaySharingPage=t.g,exports.ensureIdentity=t.h,exports.getMerchantInformation=t.m,exports.getMergeToken=t.p,exports.getUserReferralStatus=t.f,exports.modalBuilder=t.r,exports.openSso=e.c,exports.prepareSso=t.d,exports.processReferral=t.l,exports.referralInteraction=t.c,exports.sendInteraction=t.u,exports.sendTransaction=t.n,exports.setupReferral=t.s,exports.siweAuthenticate=t.t,exports.trackPurchaseStatus=t.a,exports.watchWalletStatus=t.i;
|
package/dist/actions.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as openSso } from "./openSso-
|
|
2
|
-
import { C as displayEmbeddedWallet, S as displayModal, _ as getUserReferralStatus, a as ModalBuilder, b as ensureIdentity, c as watchWalletStatus, d as REFERRAL_SUCCESS_EVENT, f as setupReferral, g as prepareSso, h as processReferral, i as sendTransaction, l as trackPurchaseStatus, m as ProcessReferralOptions, n as siweAuthenticate, o as ModalStepBuilder, p as referralInteraction, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction, v as getMergeToken, x as displaySharingPage, y as getMerchantInformation } from "./index-
|
|
1
|
+
import { t as openSso } from "./openSso-DSXbUP-j.cjs";
|
|
2
|
+
import { C as displayEmbeddedWallet, S as displayModal, _ as getUserReferralStatus, a as ModalBuilder, b as ensureIdentity, c as watchWalletStatus, d as REFERRAL_SUCCESS_EVENT, f as setupReferral, g as prepareSso, h as processReferral, i as sendTransaction, l as trackPurchaseStatus, m as ProcessReferralOptions, n as siweAuthenticate, o as ModalStepBuilder, p as referralInteraction, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction, v as getMergeToken, x as displaySharingPage, y as getMerchantInformation } from "./index-DPez7SXh.cjs";
|
|
3
3
|
export { type ModalBuilder, type ModalStepBuilder, type ProcessReferralOptions, REFERRAL_SUCCESS_EVENT, type SendTransactionParams, type SiweAuthenticateModalParams, displayEmbeddedWallet, displayModal, displaySharingPage, ensureIdentity, getMerchantInformation, getMergeToken, getUserReferralStatus, modalBuilder, openSso, prepareSso, processReferral, referralInteraction, sendInteraction, sendTransaction, setupReferral, siweAuthenticate, trackPurchaseStatus, watchWalletStatus };
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as openSso } from "./openSso-
|
|
2
|
-
import { C as displayEmbeddedWallet, S as displayModal, _ as getUserReferralStatus, a as ModalBuilder, b as ensureIdentity, c as watchWalletStatus, d as REFERRAL_SUCCESS_EVENT, f as setupReferral, g as prepareSso, h as processReferral, i as sendTransaction, l as trackPurchaseStatus, m as ProcessReferralOptions, n as siweAuthenticate, o as ModalStepBuilder, p as referralInteraction, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction, v as getMergeToken, x as displaySharingPage, y as getMerchantInformation } from "./index-
|
|
1
|
+
import { t as openSso } from "./openSso-CjZ8lAEA.js";
|
|
2
|
+
import { C as displayEmbeddedWallet, S as displayModal, _ as getUserReferralStatus, a as ModalBuilder, b as ensureIdentity, c as watchWalletStatus, d as REFERRAL_SUCCESS_EVENT, f as setupReferral, g as prepareSso, h as processReferral, i as sendTransaction, l as trackPurchaseStatus, m as ProcessReferralOptions, n as siweAuthenticate, o as ModalStepBuilder, p as referralInteraction, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction, v as getMergeToken, x as displaySharingPage, y as getMerchantInformation } from "./index-DQYipoH_.js";
|
|
3
3
|
export { type ModalBuilder, type ModalStepBuilder, type ProcessReferralOptions, REFERRAL_SUCCESS_EVENT, type SendTransactionParams, type SiweAuthenticateModalParams, displayEmbeddedWallet, displayModal, displaySharingPage, ensureIdentity, getMerchantInformation, getMergeToken, getUserReferralStatus, modalBuilder, openSso, prepareSso, processReferral, referralInteraction, sendInteraction, sendTransaction, setupReferral, siweAuthenticate, trackPurchaseStatus, watchWalletStatus };
|
package/dist/actions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./frakContext-Bgidv-Se.js";import{_ as t,a as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _,v}from"./actions-
|
|
1
|
+
import{c as e}from"./frakContext-Bgidv-Se.js";import{_ as t,a as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _,v}from"./actions-DtPVuk2e.js";export{f as REFERRAL_SUCCESS_EVENT,v as displayEmbeddedWallet,t as displayModal,o as displaySharingPage,s as ensureIdentity,u as getMerchantInformation,p as getMergeToken,a as getUserReferralStatus,m as modalBuilder,e as openSso,i as prepareSso,l as processReferral,r as referralInteraction,_ as sendInteraction,d as sendTransaction,h as setupReferral,g as siweAuthenticate,n as trackPurchaseStatus,c as watchWalletStatus};
|
package/dist/bundle.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./frakContext-CeVlWFcX.cjs`),t=require(`./src-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./frakContext-CeVlWFcX.cjs`),t=require(`./src-CTtM8g9p.cjs`),n=require(`./getCurrencyAmountKey-h2eOiYzv.cjs`),r=require(`./actions-Cyn4asew.cjs`);exports.DEEP_LINK_SCHEME=t.f,exports.FrakContextManager=e.t,exports.REFERRAL_SUCCESS_EVENT=r.o,exports.base64urlDecode=e.p,exports.base64urlEncode=e.m,exports.baseIframeProps=t.a,exports.clearAllCache=e._,exports.compressJsonToB64=e.f,exports.createIFrameFrakClient=t.i,exports.decompressJsonFromB64=t.r,exports.deleteQueryParamCaseInsensitive=e.a,exports.displayEmbeddedWallet=r.v,exports.displayModal=r._,exports.displaySharingPage=r.g,exports.ensureIdentity=r.h,exports.findIframeInOpener=t.o,exports.formatAmount=n.n,exports.generateSsoUrl=e.d,exports.getBackendUrl=e.g,exports.getClientId=e.y,exports.getCurrencyAmountKey=n.t,exports.getMerchantInformation=r.m,exports.getMergeToken=r.p,exports.getQueryParamCaseInsensitive=e.o,exports.getSupportedCurrency=n.r,exports.getUserReferralStatus=r.f,exports.isIOS=t.s,exports.isInAppBrowser=t.c,exports.isMobile=t.l,exports.mergeAttribution=t.t,exports.modalBuilder=r.r,exports.openSso=e.c,exports.prepareSso=r.d,exports.processReferral=r.l,exports.redirectToExternalBrowser=t.u,exports.referralInteraction=r.c,exports.sdkConfigStore=e.h,exports.sendInteraction=r.u,exports.sendTransaction=r.n,exports.setupClient=t.n,exports.setupReferral=r.s,exports.siweAuthenticate=r.t,exports.ssoPopupFeatures=e.l,exports.ssoPopupName=e.u,exports.trackEvent=e.s,exports.trackPurchaseStatus=r.a,exports.triggerDeepLinkWithFallback=t.d,exports.watchWalletStatus=r.i,exports.withCache=e.v;
|
package/dist/bundle.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
3
|
-
import { C as
|
|
4
|
-
|
|
1
|
+
import { S as UtmParams, _ as LocalizedI18nConfig, a as MerchantReward, b as TrackArrivalParams, c as RuleConditions, d as InteractionTypeKey, f as Currency, g as ListenerPreloadOption, h as Language, i as GetMerchantInformationReturnType, l as RuleField, m as I18nConfig, n as ConditionOperator, o as RewardTier, p as FrakWalletSdkConfig, r as EstimatedReward, s as RuleCondition, t as ConditionGroup, u as TokenAmountType, v as AttributionDefaults, x as TrackArrivalResult, y as AttributionParams } from "./merchantInformation-BSuahpjl.cjs";
|
|
2
|
+
import { A as SendTransactionTxType, B as FinalActionType, C as DisplayModalParamsType, D as ModalStepTypes, E as ModalRpcStepsResultType, F as OpenSsoParamsType, G as MerchantConfigResponse, H as ModalStepMetadata, I as OpenSsoReturnType, J as SdkResolvedConfig, K as ResolvedPlacement, L as PrepareSsoParamsType, M as SiweAuthenticateReturnType, N as SiweAuthenticationParams, O as SendTransactionModalStepType, P as LoginModalStepType, R as PrepareSsoReturnType, S as SharingPageProduct, T as ModalRpcStepsInput, U as IFrameLifecycleEvent, V as FinalModalStepType, W as ClientLifecycleEvent, _ as EmbeddedViewActionReferred, a as FrakContextV1, b as DisplaySharingPageParamsType, c as FrakLifecycleEvent, d as WalletStatusReturnType, f as UserReferralStatusType, g as LoggedOutEmbeddedView, h as DisplayEmbeddedWalletResultType, i as FrakContext, j as SiweAuthenticateModalStepType, k as SendTransactionReturnType, l as IFrameTransport, m as DisplayEmbeddedWalletParamsType, n as ssoPopupFeatures, o as FrakContextV2, p as SendInteractionParamsType, q as ResolvedSdkConfig, r as ssoPopupName, s as FrakClient, t as openSso, u as IFrameRpcSchema, v as EmbeddedViewActionSharing, w as ModalRpcMetadata, x as DisplaySharingPageResultType, y as LoggedInEmbeddedView, z as SsoMetadata } from "./openSso-DSXbUP-j.cjs";
|
|
3
|
+
import { A as DEEP_LINK_SCHEME, C as triggerDeepLinkWithFallback, D as MergeAttributionInput, E as SdkHandshakeFailureReason, F as createIFrameFrakClient, I as CompressedData, L as HashProtectedData, M as getClientId, N as getBackendUrl, O as mergeAttribution, P as setupClient, R as KeyProvider, S as DeepLinkFallbackOptions, T as SdkEventMap, _ as withCache, a as FullSsoParams, b as isMobile, c as findIframeInOpener, d as formatAmount, f as decompressJsonFromB64, g as clearAllCache, h as base64urlEncode, i as CompressedSsoData, j as sdkConfigStore, k as FrakContextManager, l as getSupportedCurrency, m as base64urlDecode, n as getQueryParamCaseInsensitive, o as generateSsoUrl, p as compressJsonToB64, r as AppSpecificSsoMetadata, s as baseIframeProps, t as deleteQueryParamCaseInsensitive, u as getCurrencyAmountKey, v as isIOS, w as trackEvent, x as redirectToExternalBrowser, y as isInAppBrowser } from "./index-D5_EwZ3f.cjs";
|
|
4
|
+
import { C as displayEmbeddedWallet, S as displayModal, _ as getUserReferralStatus, a as ModalBuilder, b as ensureIdentity, c as watchWalletStatus, d as REFERRAL_SUCCESS_EVENT, f as setupReferral, g as prepareSso, h as processReferral, i as sendTransaction, l as trackPurchaseStatus, m as ProcessReferralOptions, n as siweAuthenticate, o as ModalStepBuilder, p as referralInteraction, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction, v as getMergeToken, x as displaySharingPage, y as getMerchantInformation } from "./index-DPez7SXh.cjs";
|
|
5
|
+
export { type AppSpecificSsoMetadata, type AttributionDefaults, type AttributionParams, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type ConditionGroup, type ConditionOperator, type Currency, DEEP_LINK_SCHEME, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type DisplaySharingPageParamsType, type DisplaySharingPageResultType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakContextV1, type FrakContextV2, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type ListenerPreloadOption, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type MerchantConfigResponse, type MerchantReward, type MergeAttributionInput, type ModalBuilder, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepBuilder, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type ProcessReferralOptions, REFERRAL_SUCCESS_EVENT, type ResolvedPlacement, type ResolvedSdkConfig, type RewardTier, type RuleCondition, type RuleConditions, type RuleField, type SdkEventMap, type SdkHandshakeFailureReason, type SdkResolvedConfig, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionParams, type SendTransactionReturnType, type SendTransactionTxType, type SharingPageProduct, type SiweAuthenticateModalParams, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalParams, type TrackArrivalResult, type UserReferralStatusType, type UtmParams, type WalletStatusReturnType, base64urlDecode, base64urlEncode, baseIframeProps, clearAllCache, compressJsonToB64, createIFrameFrakClient, decompressJsonFromB64, deleteQueryParamCaseInsensitive, displayEmbeddedWallet, displayModal, displaySharingPage, ensureIdentity, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getMerchantInformation, getMergeToken, getQueryParamCaseInsensitive, getSupportedCurrency, getUserReferralStatus, isIOS, isInAppBrowser, isMobile, mergeAttribution, modalBuilder, openSso, prepareSso, processReferral, redirectToExternalBrowser, referralInteraction, sdkConfigStore, sendInteraction, sendTransaction, setupClient, setupReferral, siweAuthenticate, ssoPopupFeatures, ssoPopupName, trackEvent, trackPurchaseStatus, triggerDeepLinkWithFallback, watchWalletStatus, withCache };
|
package/dist/bundle.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
3
|
-
import { C as
|
|
4
|
-
|
|
1
|
+
import { S as UtmParams, _ as LocalizedI18nConfig, a as MerchantReward, b as TrackArrivalParams, c as RuleConditions, d as InteractionTypeKey, f as Currency, g as ListenerPreloadOption, h as Language, i as GetMerchantInformationReturnType, l as RuleField, m as I18nConfig, n as ConditionOperator, o as RewardTier, p as FrakWalletSdkConfig, r as EstimatedReward, s as RuleCondition, t as ConditionGroup, u as TokenAmountType, v as AttributionDefaults, x as TrackArrivalResult, y as AttributionParams } from "./merchantInformation--tLnowAN.js";
|
|
2
|
+
import { A as SendTransactionTxType, B as FinalActionType, C as DisplayModalParamsType, D as ModalStepTypes, E as ModalRpcStepsResultType, F as OpenSsoParamsType, G as MerchantConfigResponse, H as ModalStepMetadata, I as OpenSsoReturnType, J as SdkResolvedConfig, K as ResolvedPlacement, L as PrepareSsoParamsType, M as SiweAuthenticateReturnType, N as SiweAuthenticationParams, O as SendTransactionModalStepType, P as LoginModalStepType, R as PrepareSsoReturnType, S as SharingPageProduct, T as ModalRpcStepsInput, U as IFrameLifecycleEvent, V as FinalModalStepType, W as ClientLifecycleEvent, _ as EmbeddedViewActionReferred, a as FrakContextV1, b as DisplaySharingPageParamsType, c as FrakLifecycleEvent, d as WalletStatusReturnType, f as UserReferralStatusType, g as LoggedOutEmbeddedView, h as DisplayEmbeddedWalletResultType, i as FrakContext, j as SiweAuthenticateModalStepType, k as SendTransactionReturnType, l as IFrameTransport, m as DisplayEmbeddedWalletParamsType, n as ssoPopupFeatures, o as FrakContextV2, p as SendInteractionParamsType, q as ResolvedSdkConfig, r as ssoPopupName, s as FrakClient, t as openSso, u as IFrameRpcSchema, v as EmbeddedViewActionSharing, w as ModalRpcMetadata, x as DisplaySharingPageResultType, y as LoggedInEmbeddedView, z as SsoMetadata } from "./openSso-CjZ8lAEA.js";
|
|
3
|
+
import { A as DEEP_LINK_SCHEME, C as triggerDeepLinkWithFallback, D as MergeAttributionInput, E as SdkHandshakeFailureReason, F as createIFrameFrakClient, I as CompressedData, L as HashProtectedData, M as getClientId, N as getBackendUrl, O as mergeAttribution, P as setupClient, R as KeyProvider, S as DeepLinkFallbackOptions, T as SdkEventMap, _ as withCache, a as FullSsoParams, b as isMobile, c as findIframeInOpener, d as formatAmount, f as decompressJsonFromB64, g as clearAllCache, h as base64urlEncode, i as CompressedSsoData, j as sdkConfigStore, k as FrakContextManager, l as getSupportedCurrency, m as base64urlDecode, n as getQueryParamCaseInsensitive, o as generateSsoUrl, p as compressJsonToB64, r as AppSpecificSsoMetadata, s as baseIframeProps, t as deleteQueryParamCaseInsensitive, u as getCurrencyAmountKey, v as isIOS, w as trackEvent, x as redirectToExternalBrowser, y as isInAppBrowser } from "./index-CD-GW6rL.js";
|
|
4
|
+
import { C as displayEmbeddedWallet, S as displayModal, _ as getUserReferralStatus, a as ModalBuilder, b as ensureIdentity, c as watchWalletStatus, d as REFERRAL_SUCCESS_EVENT, f as setupReferral, g as prepareSso, h as processReferral, i as sendTransaction, l as trackPurchaseStatus, m as ProcessReferralOptions, n as siweAuthenticate, o as ModalStepBuilder, p as referralInteraction, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction, v as getMergeToken, x as displaySharingPage, y as getMerchantInformation } from "./index-DQYipoH_.js";
|
|
5
|
+
export { type AppSpecificSsoMetadata, type AttributionDefaults, type AttributionParams, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type ConditionGroup, type ConditionOperator, type Currency, DEEP_LINK_SCHEME, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type DisplaySharingPageParamsType, type DisplaySharingPageResultType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakContextV1, type FrakContextV2, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type ListenerPreloadOption, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type MerchantConfigResponse, type MerchantReward, type MergeAttributionInput, type ModalBuilder, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepBuilder, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type ProcessReferralOptions, REFERRAL_SUCCESS_EVENT, type ResolvedPlacement, type ResolvedSdkConfig, type RewardTier, type RuleCondition, type RuleConditions, type RuleField, type SdkEventMap, type SdkHandshakeFailureReason, type SdkResolvedConfig, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionParams, type SendTransactionReturnType, type SendTransactionTxType, type SharingPageProduct, type SiweAuthenticateModalParams, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalParams, type TrackArrivalResult, type UserReferralStatusType, type UtmParams, type WalletStatusReturnType, base64urlDecode, base64urlEncode, baseIframeProps, clearAllCache, compressJsonToB64, createIFrameFrakClient, decompressJsonFromB64, deleteQueryParamCaseInsensitive, displayEmbeddedWallet, displayModal, displaySharingPage, ensureIdentity, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getMerchantInformation, getMergeToken, getQueryParamCaseInsensitive, getSupportedCurrency, getUserReferralStatus, isIOS, isInAppBrowser, isMobile, mergeAttribution, modalBuilder, openSso, prepareSso, processReferral, redirectToExternalBrowser, referralInteraction, sdkConfigStore, sendInteraction, sendTransaction, setupClient, setupReferral, siweAuthenticate, ssoPopupFeatures, ssoPopupName, trackEvent, trackPurchaseStatus, triggerDeepLinkWithFallback, watchWalletStatus, withCache };
|
package/dist/bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,l as s,m as c,o as l,p as u,s as d,t as f,u as p,v as m,y as h}from"./frakContext-Bgidv-Se.js";import{a as g,c as _,d as v,f as y,
|
|
1
|
+
import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,l as s,m as c,o as l,p as u,s as d,t as f,u as p,v as m,y as h}from"./frakContext-Bgidv-Se.js";import{a as g,c as _,d as v,f as y,i as b,l as x,n as S,o as C,r as w,s as T,t as E,u as D}from"./src-Dq2hi427.js";import{n as O,r as k,t as A}from"./getCurrencyAmountKey-DQcwjJiB.js";import{_ as j,a as M,c as N,d as P,f as F,g as I,h as L,i as R,l as z,m as B,n as V,o as H,p as U,r as W,s as G,t as K,u as q,v as J}from"./actions-DtPVuk2e.js";export{y as DEEP_LINK_SCHEME,f as FrakContextManager,H as REFERRAL_SUCCESS_EVENT,u as base64urlDecode,c as base64urlEncode,g as baseIframeProps,e as clearAllCache,i as compressJsonToB64,b as createIFrameFrakClient,w as decompressJsonFromB64,t as deleteQueryParamCaseInsensitive,J as displayEmbeddedWallet,j as displayModal,I as displaySharingPage,L as ensureIdentity,C as findIframeInOpener,O as formatAmount,r as generateSsoUrl,a as getBackendUrl,h as getClientId,A as getCurrencyAmountKey,B as getMerchantInformation,U as getMergeToken,l as getQueryParamCaseInsensitive,k as getSupportedCurrency,F as getUserReferralStatus,T as isIOS,_ as isInAppBrowser,x as isMobile,E as mergeAttribution,W as modalBuilder,n as openSso,P as prepareSso,z as processReferral,D as redirectToExternalBrowser,N as referralInteraction,o as sdkConfigStore,q as sendInteraction,V as sendTransaction,S as setupClient,G as setupReferral,K as siweAuthenticate,s as ssoPopupFeatures,p as ssoPopupName,d as trackEvent,M as trackPurchaseStatus,v as triggerDeepLinkWithFallback,R as watchWalletStatus,m as withCache};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function t(t){return t&&t in e?t:`eur`}function n(t){return t?e[t]??e.eur:e.eur}function r(e,r){let i=n(r),a=t(r);return e.toLocaleString(i,{style:`currency`,currency:a,minimumFractionDigits:0,maximumFractionDigits:2})}function i(e){return e?`${e}Amount`:`eurAmount`}export{r as n,t as r,i as t};
|
|
2
|
+
//# sourceMappingURL=getCurrencyAmountKey-DQcwjJiB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCurrencyAmountKey-DQcwjJiB.js","names":[],"sources":["../src/constants/locales.ts","../src/utils/format/getSupportedCurrency.ts","../src/utils/format/getSupportedLocale.ts","../src/utils/format/formatAmount.ts","../src/utils/format/getCurrencyAmountKey.ts"],"sourcesContent":["/**\n * The keys for each locales\n * @inline\n */\nexport type LocalesKey = keyof typeof locales;\n\n/**\n * Map the currency to the locale\n */\nexport const locales = {\n eur: \"fr-FR\",\n usd: \"en-US\",\n gbp: \"en-GB\",\n} as const;\n","import { locales } from \"../../constants/locales\";\nimport type { Currency } from \"../../types\";\n\n/**\n * Get the supported currency for a given currency\n * @param currency - The currency to use\n * @returns The supported currency\n */\nexport function getSupportedCurrency(currency?: Currency): Currency {\n if (!currency) {\n return \"eur\";\n }\n return currency in locales ? currency : \"eur\";\n}\n","import { type LocalesKey, locales } from \"../../constants/locales\";\nimport type { Currency } from \"../../types\";\n\n/**\n * Get the supported locale for a given currency\n * @param currency - The currency to use\n * @returns The supported locale\n */\nexport function getSupportedLocale(\n currency?: Currency\n): (typeof locales)[LocalesKey] {\n if (!currency) {\n return locales.eur;\n }\n return locales[currency] ?? locales.eur;\n}\n","import type { Currency } from \"../../types\";\nimport { getSupportedCurrency } from \"./getSupportedCurrency\";\nimport { getSupportedLocale } from \"./getSupportedLocale\";\n\n/**\n * Format a numeric amount as a localized currency string\n * @param amount - The raw numeric amount to format\n * @param currency - Optional currency config; defaults to EUR/fr-FR when omitted\n * @returns Localized currency string (e.g. \"1 500 €\", \"$1,500\")\n */\nexport function formatAmount(amount: number, currency?: Currency) {\n // Get the supported locale (e.g. \"fr-FR\")\n const supportedLocale = getSupportedLocale(currency);\n\n // Get the supported currency (e.g. \"eur\")\n const supportedCurrency = getSupportedCurrency(currency);\n\n return amount.toLocaleString(supportedLocale, {\n style: \"currency\",\n currency: supportedCurrency,\n minimumFractionDigits: 0,\n maximumFractionDigits: 2,\n });\n}\n","import type { Currency, TokenAmountType } from \"../../types\";\n\n/**\n * Get the currency amount key for a given currency\n * @param currency - The currency to use\n * @returns The currency amount key\n */\nexport function getCurrencyAmountKey(\n currency?: Currency\n): keyof TokenAmountType {\n if (!currency) {\n return \"eurAmount\";\n }\n return `${currency}Amount` as keyof TokenAmountType;\n}\n"],"mappings":"AASA,MAAa,EAAU,CACnB,IAAK,QACL,IAAK,QACL,IAAK,OACT,ECLA,SAAgB,EAAqB,EAA+B,CAIhE,OAHK,GAGE,KAAY,EAAU,EAAW,KAC5C,CCLA,SAAgB,EACZ,EAC4B,CAI5B,OAHK,EAGE,EAAQ,IAAa,EAAQ,IAFzB,EAAQ,GAGvB,CCLA,SAAgB,EAAa,EAAgB,EAAqB,CAE9D,IAAM,EAAkB,EAAmB,CAAQ,EAG7C,EAAoB,EAAqB,CAAQ,EAEvD,OAAO,EAAO,eAAe,EAAiB,CAC1C,MAAO,WACP,SAAU,EACV,sBAAuB,EACvB,sBAAuB,CAC3B,CAAC,CACL,CChBA,SAAgB,EACZ,EACqB,CAIrB,OAHK,EAGE,GAAG,EAAS,QAFR,WAGf"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function t(t){return t&&t in e?t:`eur`}function n(t){return t?e[t]??e.eur:e.eur}function r(e,r){let i=n(r),a=t(r);return e.toLocaleString(i,{style:`currency`,currency:a,minimumFractionDigits:0,maximumFractionDigits:2})}function i(e){return e?`${e}Amount`:`eurAmount`}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
|
|
2
|
+
//# sourceMappingURL=getCurrencyAmountKey-h2eOiYzv.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCurrencyAmountKey-h2eOiYzv.cjs","names":[],"sources":["../src/constants/locales.ts","../src/utils/format/getSupportedCurrency.ts","../src/utils/format/getSupportedLocale.ts","../src/utils/format/formatAmount.ts","../src/utils/format/getCurrencyAmountKey.ts"],"sourcesContent":["/**\n * The keys for each locales\n * @inline\n */\nexport type LocalesKey = keyof typeof locales;\n\n/**\n * Map the currency to the locale\n */\nexport const locales = {\n eur: \"fr-FR\",\n usd: \"en-US\",\n gbp: \"en-GB\",\n} as const;\n","import { locales } from \"../../constants/locales\";\nimport type { Currency } from \"../../types\";\n\n/**\n * Get the supported currency for a given currency\n * @param currency - The currency to use\n * @returns The supported currency\n */\nexport function getSupportedCurrency(currency?: Currency): Currency {\n if (!currency) {\n return \"eur\";\n }\n return currency in locales ? currency : \"eur\";\n}\n","import { type LocalesKey, locales } from \"../../constants/locales\";\nimport type { Currency } from \"../../types\";\n\n/**\n * Get the supported locale for a given currency\n * @param currency - The currency to use\n * @returns The supported locale\n */\nexport function getSupportedLocale(\n currency?: Currency\n): (typeof locales)[LocalesKey] {\n if (!currency) {\n return locales.eur;\n }\n return locales[currency] ?? locales.eur;\n}\n","import type { Currency } from \"../../types\";\nimport { getSupportedCurrency } from \"./getSupportedCurrency\";\nimport { getSupportedLocale } from \"./getSupportedLocale\";\n\n/**\n * Format a numeric amount as a localized currency string\n * @param amount - The raw numeric amount to format\n * @param currency - Optional currency config; defaults to EUR/fr-FR when omitted\n * @returns Localized currency string (e.g. \"1 500 €\", \"$1,500\")\n */\nexport function formatAmount(amount: number, currency?: Currency) {\n // Get the supported locale (e.g. \"fr-FR\")\n const supportedLocale = getSupportedLocale(currency);\n\n // Get the supported currency (e.g. \"eur\")\n const supportedCurrency = getSupportedCurrency(currency);\n\n return amount.toLocaleString(supportedLocale, {\n style: \"currency\",\n currency: supportedCurrency,\n minimumFractionDigits: 0,\n maximumFractionDigits: 2,\n });\n}\n","import type { Currency, TokenAmountType } from \"../../types\";\n\n/**\n * Get the currency amount key for a given currency\n * @param currency - The currency to use\n * @returns The currency amount key\n */\nexport function getCurrencyAmountKey(\n currency?: Currency\n): keyof TokenAmountType {\n if (!currency) {\n return \"eurAmount\";\n }\n return `${currency}Amount` as keyof TokenAmountType;\n}\n"],"mappings":"AASA,MAAa,EAAU,CACnB,IAAK,QACL,IAAK,QACL,IAAK,OACT,ECLA,SAAgB,EAAqB,EAA+B,CAIhE,OAHK,GAGE,KAAY,EAAU,EAAW,KAC5C,CCLA,SAAgB,EACZ,EAC4B,CAI5B,OAHK,EAGE,EAAQ,IAAa,EAAQ,IAFzB,EAAQ,GAGvB,CCLA,SAAgB,EAAa,EAAgB,EAAqB,CAE9D,IAAM,EAAkB,EAAmB,CAAQ,EAG7C,EAAoB,EAAqB,CAAQ,EAEvD,OAAO,EAAO,eAAe,EAAiB,CAC1C,MAAO,WACP,SAAU,EACV,sBAAuB,EACvB,sBAAuB,CAC3B,CAAC,CACL,CChBA,SAAgB,EACZ,EACqB,CAIrB,OAHK,EAGE,GAAG,EAAS,QAFR,WAGf"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as Currency, h as Language, p as FrakWalletSdkConfig, u as TokenAmountType, v as AttributionDefaults, y as AttributionParams } from "./merchantInformation--tLnowAN.js";
|
|
2
|
+
import { G as MerchantConfigResponse, J as SdkResolvedConfig, L as PrepareSsoParamsType, a as FrakContextV1, i as FrakContext, o as FrakContextV2, s as FrakClient, z as SsoMetadata } from "./openSso-CjZ8lAEA.js";
|
|
2
3
|
import { Hex } from "viem";
|
|
3
4
|
|
|
4
5
|
//#region src/types/compression.d.ts
|
|
@@ -645,4 +646,4 @@ declare function getQueryParamCaseInsensitive(searchParams: URLSearchParams, key
|
|
|
645
646
|
declare function deleteQueryParamCaseInsensitive(searchParams: URLSearchParams, key: string): void;
|
|
646
647
|
//#endregion
|
|
647
648
|
export { DEEP_LINK_SCHEME as A, triggerDeepLinkWithFallback as C, MergeAttributionInput as D, SdkHandshakeFailureReason as E, createIFrameFrakClient as F, CompressedData as I, HashProtectedData as L, getClientId as M, getBackendUrl as N, mergeAttribution as O, setupClient as P, KeyProvider as R, DeepLinkFallbackOptions as S, SdkEventMap as T, withCache as _, FullSsoParams as a, isMobile as b, findIframeInOpener as c, formatAmount as d, decompressJsonFromB64 as f, clearAllCache as g, base64urlEncode as h, CompressedSsoData as i, sdkConfigStore as j, FrakContextManager as k, getSupportedCurrency as l, base64urlDecode as m, getQueryParamCaseInsensitive as n, generateSsoUrl as o, compressJsonToB64 as p, AppSpecificSsoMetadata as r, baseIframeProps as s, deleteQueryParamCaseInsensitive as t, getCurrencyAmountKey as u, isIOS as v, trackEvent as w, redirectToExternalBrowser as x, isInAppBrowser as y };
|
|
648
|
-
//# sourceMappingURL=index-
|
|
649
|
+
//# sourceMappingURL=index-CD-GW6rL.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as Currency, h as Language, p as FrakWalletSdkConfig, u as TokenAmountType, v as AttributionDefaults, y as AttributionParams } from "./merchantInformation-BSuahpjl.cjs";
|
|
2
|
+
import { G as MerchantConfigResponse, J as SdkResolvedConfig, L as PrepareSsoParamsType, a as FrakContextV1, i as FrakContext, o as FrakContextV2, s as FrakClient, z as SsoMetadata } from "./openSso-DSXbUP-j.cjs";
|
|
2
3
|
import { Hex } from "viem";
|
|
3
4
|
|
|
4
5
|
//#region src/types/compression.d.ts
|
|
@@ -645,4 +646,4 @@ declare function getQueryParamCaseInsensitive(searchParams: URLSearchParams, key
|
|
|
645
646
|
declare function deleteQueryParamCaseInsensitive(searchParams: URLSearchParams, key: string): void;
|
|
646
647
|
//#endregion
|
|
647
648
|
export { DEEP_LINK_SCHEME as A, triggerDeepLinkWithFallback as C, MergeAttributionInput as D, SdkHandshakeFailureReason as E, createIFrameFrakClient as F, CompressedData as I, HashProtectedData as L, getClientId as M, getBackendUrl as N, mergeAttribution as O, setupClient as P, KeyProvider as R, DeepLinkFallbackOptions as S, SdkEventMap as T, withCache as _, FullSsoParams as a, isMobile as b, findIframeInOpener as c, formatAmount as d, decompressJsonFromB64 as f, clearAllCache as g, base64urlEncode as h, CompressedSsoData as i, sdkConfigStore as j, FrakContextManager as k, getSupportedCurrency as l, base64urlDecode as m, getQueryParamCaseInsensitive as n, generateSsoUrl as o, compressJsonToB64 as p, AppSpecificSsoMetadata as r, baseIframeProps as s, deleteQueryParamCaseInsensitive as t, getCurrencyAmountKey as u, isIOS as v, trackEvent as w, redirectToExternalBrowser as x, isInAppBrowser as y };
|
|
648
|
-
//# sourceMappingURL=index-
|
|
649
|
+
//# sourceMappingURL=index-D5_EwZ3f.d.cts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as GetMerchantInformationReturnType } from "./merchantInformation-BSuahpjl.cjs";
|
|
2
|
+
import { B as FinalActionType, C as DisplayModalParamsType, D as ModalStepTypes, E as ModalRpcStepsResultType, L as PrepareSsoParamsType, M as SiweAuthenticateReturnType, N as SiweAuthenticationParams, O as SendTransactionModalStepType, P as LoginModalStepType, R as PrepareSsoReturnType, V as FinalModalStepType, b as DisplaySharingPageParamsType, d as WalletStatusReturnType, f as UserReferralStatusType, h as DisplayEmbeddedWalletResultType, i as FrakContext, k as SendTransactionReturnType, m as DisplayEmbeddedWalletParamsType, p as SendInteractionParamsType, s as FrakClient, w as ModalRpcMetadata, x as DisplaySharingPageResultType } from "./openSso-DSXbUP-j.cjs";
|
|
2
3
|
|
|
3
4
|
//#region src/actions/displayEmbeddedWallet.d.ts
|
|
4
5
|
/**
|
|
@@ -644,4 +645,4 @@ declare function siweAuthenticate(client: FrakClient, {
|
|
|
644
645
|
}: SiweAuthenticateModalParams): Promise<SiweAuthenticateReturnType>;
|
|
645
646
|
//#endregion
|
|
646
647
|
export { displayEmbeddedWallet as C, displayModal as S, getUserReferralStatus as _, ModalBuilder as a, ensureIdentity as b, watchWalletStatus as c, REFERRAL_SUCCESS_EVENT as d, setupReferral as f, prepareSso as g, processReferral as h, sendTransaction as i, trackPurchaseStatus as l, ProcessReferralOptions as m, siweAuthenticate as n, ModalStepBuilder as o, referralInteraction as p, SendTransactionParams as r, modalBuilder as s, SiweAuthenticateModalParams as t, sendInteraction as u, getMergeToken as v, displaySharingPage as x, getMerchantInformation as y };
|
|
647
|
-
//# sourceMappingURL=index-
|
|
648
|
+
//# sourceMappingURL=index-DPez7SXh.d.cts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as GetMerchantInformationReturnType } from "./merchantInformation--tLnowAN.js";
|
|
2
|
+
import { B as FinalActionType, C as DisplayModalParamsType, D as ModalStepTypes, E as ModalRpcStepsResultType, L as PrepareSsoParamsType, M as SiweAuthenticateReturnType, N as SiweAuthenticationParams, O as SendTransactionModalStepType, P as LoginModalStepType, R as PrepareSsoReturnType, V as FinalModalStepType, b as DisplaySharingPageParamsType, d as WalletStatusReturnType, f as UserReferralStatusType, h as DisplayEmbeddedWalletResultType, i as FrakContext, k as SendTransactionReturnType, m as DisplayEmbeddedWalletParamsType, p as SendInteractionParamsType, s as FrakClient, w as ModalRpcMetadata, x as DisplaySharingPageResultType } from "./openSso-CjZ8lAEA.js";
|
|
2
3
|
|
|
3
4
|
//#region src/actions/displayEmbeddedWallet.d.ts
|
|
4
5
|
/**
|
|
@@ -644,4 +645,4 @@ declare function siweAuthenticate(client: FrakClient, {
|
|
|
644
645
|
}: SiweAuthenticateModalParams): Promise<SiweAuthenticateReturnType>;
|
|
645
646
|
//#endregion
|
|
646
647
|
export { displayEmbeddedWallet as C, displayModal as S, getUserReferralStatus as _, ModalBuilder as a, ensureIdentity as b, watchWalletStatus as c, REFERRAL_SUCCESS_EVENT as d, setupReferral as f, prepareSso as g, processReferral as h, sendTransaction as i, trackPurchaseStatus as l, ProcessReferralOptions as m, siweAuthenticate as n, ModalStepBuilder as o, referralInteraction as p, SendTransactionParams as r, modalBuilder as s, SiweAuthenticateModalParams as t, sendInteraction as u, getMergeToken as v, displaySharingPage as x, getMerchantInformation as y };
|
|
647
|
-
//# sourceMappingURL=index-
|
|
648
|
+
//# sourceMappingURL=index-DQYipoH_.d.ts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./frakContext-CeVlWFcX.cjs`),t=require(`./src-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./frakContext-CeVlWFcX.cjs`),t=require(`./src-CTtM8g9p.cjs`),n=require(`./getCurrencyAmountKey-h2eOiYzv.cjs`);exports.DEEP_LINK_SCHEME=t.f,exports.FrakContextManager=e.t,exports.base64urlDecode=e.p,exports.base64urlEncode=e.m,exports.baseIframeProps=t.a,exports.clearAllCache=e._,exports.compressJsonToB64=e.f,exports.createIFrameFrakClient=t.i,exports.decompressJsonFromB64=t.r,exports.deleteQueryParamCaseInsensitive=e.a,exports.findIframeInOpener=t.o,exports.formatAmount=n.n,exports.generateSsoUrl=e.d,exports.getBackendUrl=e.g,exports.getClientId=e.y,exports.getCurrencyAmountKey=n.t,exports.getQueryParamCaseInsensitive=e.o,exports.getSupportedCurrency=n.r,exports.isIOS=t.s,exports.isInAppBrowser=t.c,exports.isMobile=t.l,exports.mergeAttribution=t.t,exports.redirectToExternalBrowser=t.u,exports.sdkConfigStore=e.h,exports.setupClient=t.n,exports.ssoPopupFeatures=e.l,exports.ssoPopupName=e.u,exports.trackEvent=e.s,exports.triggerDeepLinkWithFallback=t.d,exports.withCache=e.v;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
3
|
-
|
|
1
|
+
import { S as UtmParams, _ as LocalizedI18nConfig, a as MerchantReward, b as TrackArrivalParams, c as RuleConditions, d as InteractionTypeKey, f as Currency, g as ListenerPreloadOption, h as Language, i as GetMerchantInformationReturnType, l as RuleField, m as I18nConfig, n as ConditionOperator, o as RewardTier, p as FrakWalletSdkConfig, r as EstimatedReward, s as RuleCondition, t as ConditionGroup, u as TokenAmountType, v as AttributionDefaults, x as TrackArrivalResult, y as AttributionParams } from "./merchantInformation-BSuahpjl.cjs";
|
|
2
|
+
import { A as SendTransactionTxType, B as FinalActionType, C as DisplayModalParamsType, D as ModalStepTypes, E as ModalRpcStepsResultType, F as OpenSsoParamsType, G as MerchantConfigResponse, H as ModalStepMetadata, I as OpenSsoReturnType, J as SdkResolvedConfig, K as ResolvedPlacement, L as PrepareSsoParamsType, M as SiweAuthenticateReturnType, N as SiweAuthenticationParams, O as SendTransactionModalStepType, P as LoginModalStepType, R as PrepareSsoReturnType, S as SharingPageProduct, T as ModalRpcStepsInput, U as IFrameLifecycleEvent, V as FinalModalStepType, W as ClientLifecycleEvent, _ as EmbeddedViewActionReferred, a as FrakContextV1, b as DisplaySharingPageParamsType, c as FrakLifecycleEvent, d as WalletStatusReturnType, f as UserReferralStatusType, g as LoggedOutEmbeddedView, h as DisplayEmbeddedWalletResultType, i as FrakContext, j as SiweAuthenticateModalStepType, k as SendTransactionReturnType, l as IFrameTransport, m as DisplayEmbeddedWalletParamsType, n as ssoPopupFeatures, o as FrakContextV2, p as SendInteractionParamsType, q as ResolvedSdkConfig, r as ssoPopupName, s as FrakClient, u as IFrameRpcSchema, v as EmbeddedViewActionSharing, w as ModalRpcMetadata, x as DisplaySharingPageResultType, y as LoggedInEmbeddedView, z as SsoMetadata } from "./openSso-DSXbUP-j.cjs";
|
|
3
|
+
import { A as DEEP_LINK_SCHEME, C as triggerDeepLinkWithFallback, D as MergeAttributionInput, E as SdkHandshakeFailureReason, F as createIFrameFrakClient, I as CompressedData, L as HashProtectedData, M as getClientId, N as getBackendUrl, O as mergeAttribution, P as setupClient, R as KeyProvider, S as DeepLinkFallbackOptions, T as SdkEventMap, _ as withCache, a as FullSsoParams, b as isMobile, c as findIframeInOpener, d as formatAmount, f as decompressJsonFromB64, g as clearAllCache, h as base64urlEncode, i as CompressedSsoData, j as sdkConfigStore, k as FrakContextManager, l as getSupportedCurrency, m as base64urlDecode, n as getQueryParamCaseInsensitive, o as generateSsoUrl, p as compressJsonToB64, r as AppSpecificSsoMetadata, s as baseIframeProps, t as deleteQueryParamCaseInsensitive, u as getCurrencyAmountKey, v as isIOS, w as trackEvent, x as redirectToExternalBrowser, y as isInAppBrowser } from "./index-D5_EwZ3f.cjs";
|
|
4
|
+
export { type AppSpecificSsoMetadata, type AttributionDefaults, type AttributionParams, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type ConditionGroup, type ConditionOperator, type Currency, DEEP_LINK_SCHEME, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type DisplaySharingPageParamsType, type DisplaySharingPageResultType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakContextV1, type FrakContextV2, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type ListenerPreloadOption, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type MerchantConfigResponse, type MerchantReward, type MergeAttributionInput, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type ResolvedPlacement, type ResolvedSdkConfig, type RewardTier, type RuleCondition, type RuleConditions, type RuleField, type SdkEventMap, type SdkHandshakeFailureReason, type SdkResolvedConfig, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionReturnType, type SendTransactionTxType, type SharingPageProduct, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalParams, type TrackArrivalResult, type UserReferralStatusType, type UtmParams, type WalletStatusReturnType, base64urlDecode, base64urlEncode, baseIframeProps, clearAllCache, compressJsonToB64, createIFrameFrakClient, decompressJsonFromB64, deleteQueryParamCaseInsensitive, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getQueryParamCaseInsensitive, getSupportedCurrency, isIOS, isInAppBrowser, isMobile, mergeAttribution, redirectToExternalBrowser, sdkConfigStore, setupClient, ssoPopupFeatures, ssoPopupName, trackEvent, triggerDeepLinkWithFallback, withCache };
|