@frak-labs/core-sdk 0.1.1-beta.4dfea079 → 0.1.1-beta.a3dc949d
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/dist/actions.d.cts +1 -1
- package/dist/actions.d.ts +1 -1
- package/dist/bundle.d.cts +3 -3
- package/dist/bundle.d.ts +3 -3
- package/dist/{computeLegacyProductId-CscYhyUi.d.cts → computeLegacyProductId-CpWhPpNt.d.cts} +21 -14
- package/dist/{computeLegacyProductId-WbD1gXV9.d.ts → computeLegacyProductId-dlTwDh1o.d.ts} +21 -14
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/{siweAuthenticate-CR4Dpji6.d.cts → siweAuthenticate-BPqJTadR.d.cts} +39 -0
- package/dist/{siweAuthenticate-udoruuy9.d.ts → siweAuthenticate-CRMIfmna.d.ts} +39 -0
- package/package.json +2 -2
- package/src/actions/displayEmbeddedWallet.ts +1 -0
- package/src/actions/getMerchantInformation.ts +7 -0
- package/src/actions/sendInteraction.ts +31 -0
- package/src/clients/createIFrameFrakClient.ts +2 -1
- package/src/clients/transports/iframeLifecycleManager.ts +9 -1
- package/src/index.ts +0 -1
- package/src/types/index.ts +0 -1
- package/src/utils/formatAmount.ts +6 -0
- package/src/utils/sso.ts +2 -1
- package/src/utils/trackEvent.ts +10 -0
package/dist/actions.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as openSso } from "./openSso-CC1-loUk.cjs";
|
|
2
|
-
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, h as getMerchantInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction } from "./siweAuthenticate-
|
|
2
|
+
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, h as getMerchantInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction } from "./siweAuthenticate-BPqJTadR.cjs";
|
|
3
3
|
export { type ModalBuilder, type ModalStepBuilder, type ProcessReferralOptions, type SendTransactionParams, type SiweAuthenticateModalParams, displayEmbeddedWallet, displayModal, getMerchantInformation, modalBuilder, openSso, prepareSso, processReferral, referralInteraction, sendInteraction, sendTransaction, siweAuthenticate, trackPurchaseStatus, watchWalletStatus };
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as openSso } from "./openSso-tkqaDQLV.js";
|
|
2
|
-
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, h as getMerchantInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction } from "./siweAuthenticate-
|
|
2
|
+
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, h as getMerchantInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction } from "./siweAuthenticate-CRMIfmna.js";
|
|
3
3
|
export { type ModalBuilder, type ModalStepBuilder, type ProcessReferralOptions, type SendTransactionParams, type SiweAuthenticateModalParams, displayEmbeddedWallet, displayModal, getMerchantInformation, modalBuilder, openSso, prepareSso, processReferral, referralInteraction, sendInteraction, sendTransaction, siweAuthenticate, trackPurchaseStatus, watchWalletStatus };
|
package/dist/bundle.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { A as SiweAuthenticateReturnType, B as ModalStepMetadata, C as ModalRpcStepsInput, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, G as FrakWalletSdkConfig, H as IFrameLifecycleEvent, I as PrepareSsoReturnType, J as LocalizedI18nConfig, K as I18nConfig, L as SsoMetadata, M as LoginModalStepType, N as OpenSsoParamsType, O as SendTransactionTxType, P as OpenSsoReturnType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, U as ClientLifecycleEvent, V as InteractionTypeKey, W as Currency, _ as LoggedOutEmbeddedView, a as FrakClient, b as LoggedInEmbeddedView, c as IFrameRpcSchema, d as GetMerchantInformationReturnType, f as RewardTier, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, k as SiweAuthenticateModalStepType, l as WalletStatusReturnType, m as SendInteractionParamsType, n as ssoPopupFeatures, o as FrakLifecycleEvent, p as TokenAmountType, q as Language, r as ssoPopupName, s as IFrameTransport, t as openSso, u as EstimatedReward, v as EmbeddedViewActionReferred, w as ModalRpcStepsResultType, x as DisplayModalParamsType, y as EmbeddedViewActionSharing, z as FinalModalStepType } from "./openSso-CC1-loUk.cjs";
|
|
2
|
-
import { A as getBackendUrl, B as
|
|
3
|
-
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, h as getMerchantInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction } from "./siweAuthenticate-
|
|
4
|
-
export { AppSpecificSsoMetadata, ClientLifecycleEvent, CompressedData, CompressedSsoData, Currency, DEEP_LINK_SCHEME, DebugInfoGatherer, DeepLinkFallbackOptions, DisplayEmbeddedWalletParamsType, DisplayEmbeddedWalletResultType, DisplayModalParamsType, EmbeddedViewActionReferred, EmbeddedViewActionSharing, EstimatedReward, FinalActionType, FinalModalStepType, FrakClient, FrakContext, FrakContextManager, FrakEvent, FrakLifecycleEvent, FrakWalletSdkConfig, FullSsoParams, GetMerchantInformationReturnType, HashProtectedData, I18nConfig, IFrameLifecycleEvent, IFrameRpcSchema, IFrameTransport, InteractionTypeKey, KeyProvider, Language, LocalesKey, LocalizedI18nConfig, LoggedInEmbeddedView, LoggedOutEmbeddedView, LoginModalStepType, ModalBuilder, ModalRpcMetadata, ModalRpcStepsInput, ModalRpcStepsResultType, ModalStepBuilder, ModalStepMetadata, ModalStepTypes, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, PrepareSsoReturnType, ProcessReferralOptions, RewardTier, SendInteractionParamsType, SendTransactionModalStepType, SendTransactionParams, SendTransactionReturnType, SendTransactionTxType, SiweAuthenticateModalParams, SiweAuthenticateModalStepType, SiweAuthenticateReturnType, SiweAuthenticationParams, SsoMetadata, TokenAmountType,
|
|
2
|
+
import { A as getBackendUrl, B as HashProtectedData, C as triggerDeepLinkWithFallback, D as base64urlDecode, E as compressJsonToB64, F as createIFrameFrakClient, I as TrackArrivalParams, L as TrackArrivalResult, M as locales, N as setupClient, O as base64urlEncode, P as DebugInfoGatherer, R as UtmParams, S as toAndroidIntentUrl, T as decompressJsonFromB64, V as KeyProvider, _ as formatAmount, a as CompressedSsoData, b as isChromiumAndroid, c as clearMerchantIdCache, d as baseIframeProps, f as createIframe, g as getCurrencyAmountKey, h as getSupportedCurrency, i as AppSpecificSsoMetadata, j as LocalesKey, k as getClientId, l as fetchMerchantId, m as getSupportedLocale, n as FrakEvent, o as FullSsoParams, p as findIframeInOpener, r as trackEvent, s as generateSsoUrl, t as computeLegacyProductId, u as resolveMerchantId, v as FrakContextManager, w as DEEP_LINK_SCHEME, x as isFrakDeepLink, y as DeepLinkFallbackOptions, z as CompressedData } from "./computeLegacyProductId-CpWhPpNt.cjs";
|
|
3
|
+
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, h as getMerchantInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction } from "./siweAuthenticate-BPqJTadR.cjs";
|
|
4
|
+
export { AppSpecificSsoMetadata, ClientLifecycleEvent, CompressedData, CompressedSsoData, Currency, DEEP_LINK_SCHEME, DebugInfoGatherer, DeepLinkFallbackOptions, DisplayEmbeddedWalletParamsType, DisplayEmbeddedWalletResultType, DisplayModalParamsType, EmbeddedViewActionReferred, EmbeddedViewActionSharing, EstimatedReward, FinalActionType, FinalModalStepType, FrakClient, FrakContext, FrakContextManager, FrakEvent, FrakLifecycleEvent, FrakWalletSdkConfig, FullSsoParams, GetMerchantInformationReturnType, HashProtectedData, I18nConfig, IFrameLifecycleEvent, IFrameRpcSchema, IFrameTransport, InteractionTypeKey, KeyProvider, Language, LocalesKey, LocalizedI18nConfig, LoggedInEmbeddedView, LoggedOutEmbeddedView, LoginModalStepType, ModalBuilder, ModalRpcMetadata, ModalRpcStepsInput, ModalRpcStepsResultType, ModalStepBuilder, ModalStepMetadata, ModalStepTypes, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, PrepareSsoReturnType, ProcessReferralOptions, RewardTier, SendInteractionParamsType, SendTransactionModalStepType, SendTransactionParams, SendTransactionReturnType, SendTransactionTxType, SiweAuthenticateModalParams, SiweAuthenticateModalStepType, SiweAuthenticateReturnType, SiweAuthenticationParams, SsoMetadata, TokenAmountType, TrackArrivalParams, TrackArrivalResult, UtmParams, WalletStatusReturnType, base64urlDecode, base64urlEncode, baseIframeProps, clearMerchantIdCache, compressJsonToB64, computeLegacyProductId, createIFrameFrakClient, createIframe, decompressJsonFromB64, displayEmbeddedWallet, displayModal, fetchMerchantId, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getMerchantInformation, getSupportedCurrency, getSupportedLocale, isChromiumAndroid, isFrakDeepLink, locales, modalBuilder, openSso, prepareSso, processReferral, referralInteraction, resolveMerchantId, sendInteraction, sendTransaction, setupClient, siweAuthenticate, ssoPopupFeatures, ssoPopupName, toAndroidIntentUrl, trackEvent, trackPurchaseStatus, triggerDeepLinkWithFallback, watchWalletStatus };
|
package/dist/bundle.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { A as SiweAuthenticateReturnType, B as ModalStepMetadata, C as ModalRpcStepsInput, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, G as FrakWalletSdkConfig, H as IFrameLifecycleEvent, I as PrepareSsoReturnType, J as LocalizedI18nConfig, K as I18nConfig, L as SsoMetadata, M as LoginModalStepType, N as OpenSsoParamsType, O as SendTransactionTxType, P as OpenSsoReturnType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, U as ClientLifecycleEvent, V as InteractionTypeKey, W as Currency, _ as LoggedOutEmbeddedView, a as FrakClient, b as LoggedInEmbeddedView, c as IFrameRpcSchema, d as GetMerchantInformationReturnType, f as RewardTier, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, k as SiweAuthenticateModalStepType, l as WalletStatusReturnType, m as SendInteractionParamsType, n as ssoPopupFeatures, o as FrakLifecycleEvent, p as TokenAmountType, q as Language, r as ssoPopupName, s as IFrameTransport, t as openSso, u as EstimatedReward, v as EmbeddedViewActionReferred, w as ModalRpcStepsResultType, x as DisplayModalParamsType, y as EmbeddedViewActionSharing, z as FinalModalStepType } from "./openSso-tkqaDQLV.js";
|
|
2
|
-
import { A as getBackendUrl, B as
|
|
3
|
-
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, h as getMerchantInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction } from "./siweAuthenticate-
|
|
4
|
-
export { AppSpecificSsoMetadata, ClientLifecycleEvent, CompressedData, CompressedSsoData, Currency, DEEP_LINK_SCHEME, DebugInfoGatherer, DeepLinkFallbackOptions, DisplayEmbeddedWalletParamsType, DisplayEmbeddedWalletResultType, DisplayModalParamsType, EmbeddedViewActionReferred, EmbeddedViewActionSharing, EstimatedReward, FinalActionType, FinalModalStepType, FrakClient, FrakContext, FrakContextManager, FrakEvent, FrakLifecycleEvent, FrakWalletSdkConfig, FullSsoParams, GetMerchantInformationReturnType, HashProtectedData, I18nConfig, IFrameLifecycleEvent, IFrameRpcSchema, IFrameTransport, InteractionTypeKey, KeyProvider, Language, LocalesKey, LocalizedI18nConfig, LoggedInEmbeddedView, LoggedOutEmbeddedView, LoginModalStepType, ModalBuilder, ModalRpcMetadata, ModalRpcStepsInput, ModalRpcStepsResultType, ModalStepBuilder, ModalStepMetadata, ModalStepTypes, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, PrepareSsoReturnType, ProcessReferralOptions, RewardTier, SendInteractionParamsType, SendTransactionModalStepType, SendTransactionParams, SendTransactionReturnType, SendTransactionTxType, SiweAuthenticateModalParams, SiweAuthenticateModalStepType, SiweAuthenticateReturnType, SiweAuthenticationParams, SsoMetadata, TokenAmountType,
|
|
2
|
+
import { A as getBackendUrl, B as HashProtectedData, C as triggerDeepLinkWithFallback, D as base64urlDecode, E as compressJsonToB64, F as createIFrameFrakClient, I as TrackArrivalParams, L as TrackArrivalResult, M as locales, N as setupClient, O as base64urlEncode, P as DebugInfoGatherer, R as UtmParams, S as toAndroidIntentUrl, T as decompressJsonFromB64, V as KeyProvider, _ as formatAmount, a as CompressedSsoData, b as isChromiumAndroid, c as clearMerchantIdCache, d as baseIframeProps, f as createIframe, g as getCurrencyAmountKey, h as getSupportedCurrency, i as AppSpecificSsoMetadata, j as LocalesKey, k as getClientId, l as fetchMerchantId, m as getSupportedLocale, n as FrakEvent, o as FullSsoParams, p as findIframeInOpener, r as trackEvent, s as generateSsoUrl, t as computeLegacyProductId, u as resolveMerchantId, v as FrakContextManager, w as DEEP_LINK_SCHEME, x as isFrakDeepLink, y as DeepLinkFallbackOptions, z as CompressedData } from "./computeLegacyProductId-dlTwDh1o.js";
|
|
3
|
+
import { _ as displayEmbeddedWallet, a as ModalBuilder, c as watchWalletStatus, d as referralInteraction, f as ProcessReferralOptions, g as displayModal, h as getMerchantInformation, i as sendTransaction, l as trackPurchaseStatus, m as prepareSso, n as siweAuthenticate, o as ModalStepBuilder, p as processReferral, r as SendTransactionParams, s as modalBuilder, t as SiweAuthenticateModalParams, u as sendInteraction } from "./siweAuthenticate-CRMIfmna.js";
|
|
4
|
+
export { AppSpecificSsoMetadata, ClientLifecycleEvent, CompressedData, CompressedSsoData, Currency, DEEP_LINK_SCHEME, DebugInfoGatherer, DeepLinkFallbackOptions, DisplayEmbeddedWalletParamsType, DisplayEmbeddedWalletResultType, DisplayModalParamsType, EmbeddedViewActionReferred, EmbeddedViewActionSharing, EstimatedReward, FinalActionType, FinalModalStepType, FrakClient, FrakContext, FrakContextManager, FrakEvent, FrakLifecycleEvent, FrakWalletSdkConfig, FullSsoParams, GetMerchantInformationReturnType, HashProtectedData, I18nConfig, IFrameLifecycleEvent, IFrameRpcSchema, IFrameTransport, InteractionTypeKey, KeyProvider, Language, LocalesKey, LocalizedI18nConfig, LoggedInEmbeddedView, LoggedOutEmbeddedView, LoginModalStepType, ModalBuilder, ModalRpcMetadata, ModalRpcStepsInput, ModalRpcStepsResultType, ModalStepBuilder, ModalStepMetadata, ModalStepTypes, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, PrepareSsoReturnType, ProcessReferralOptions, RewardTier, SendInteractionParamsType, SendTransactionModalStepType, SendTransactionParams, SendTransactionReturnType, SendTransactionTxType, SiweAuthenticateModalParams, SiweAuthenticateModalStepType, SiweAuthenticateReturnType, SiweAuthenticationParams, SsoMetadata, TokenAmountType, TrackArrivalParams, TrackArrivalResult, UtmParams, WalletStatusReturnType, base64urlDecode, base64urlEncode, baseIframeProps, clearMerchantIdCache, compressJsonToB64, computeLegacyProductId, createIFrameFrakClient, createIframe, decompressJsonFromB64, displayEmbeddedWallet, displayModal, fetchMerchantId, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getMerchantInformation, getSupportedCurrency, getSupportedLocale, isChromiumAndroid, isFrakDeepLink, locales, modalBuilder, openSso, prepareSso, processReferral, referralInteraction, resolveMerchantId, sendInteraction, sendTransaction, setupClient, siweAuthenticate, ssoPopupFeatures, ssoPopupName, toAndroidIntentUrl, trackEvent, trackPurchaseStatus, triggerDeepLinkWithFallback, watchWalletStatus };
|
package/dist/{computeLegacyProductId-CscYhyUi.d.cts → computeLegacyProductId-CpWhPpNt.d.cts}
RENAMED
|
@@ -62,23 +62,13 @@ type TrackArrivalResult = {
|
|
|
62
62
|
touchpointId?: string;
|
|
63
63
|
error?: string;
|
|
64
64
|
};
|
|
65
|
-
/**
|
|
66
|
-
* Internal params passed to the trackArrival action
|
|
67
|
-
* Includes merchantId resolved from config or fetch
|
|
68
|
-
* @internal
|
|
69
|
-
*/
|
|
70
|
-
type TrackArrivalInternalParams = TrackArrivalParams & {
|
|
71
|
-
/**
|
|
72
|
-
* The merchant ID (UUID from dashboard)
|
|
73
|
-
*/
|
|
74
|
-
merchantId: string;
|
|
75
|
-
};
|
|
76
65
|
//#endregion
|
|
77
66
|
//#region src/clients/createIFrameFrakClient.d.ts
|
|
78
67
|
/**
|
|
79
68
|
* Create a new iframe Frak client
|
|
80
69
|
* @param args
|
|
81
|
-
* @param args.config - The configuration to use for the Frak Wallet SDK
|
|
70
|
+
* @param args.config - The configuration to use for the Frak Wallet SDK.
|
|
71
|
+
* When `config.domain` is set, it is forwarded to the iframe handshake so the listener resolves the correct merchant in tunneled/proxied environments (e.g. Shopify dev with Cloudflare tunnel).
|
|
82
72
|
* @param args.iframe - The iframe to use for the communication
|
|
83
73
|
* @returns The created Frak Client
|
|
84
74
|
*
|
|
@@ -333,6 +323,12 @@ declare const FrakContextManager: {
|
|
|
333
323
|
};
|
|
334
324
|
//#endregion
|
|
335
325
|
//#region src/utils/formatAmount.d.ts
|
|
326
|
+
/**
|
|
327
|
+
* Format a numeric amount as a localized currency string
|
|
328
|
+
* @param amount - The raw numeric amount to format
|
|
329
|
+
* @param currency - Optional currency config; defaults to EUR/fr-FR when omitted
|
|
330
|
+
* @returns Localized currency string (e.g. "1 500 €", "$1,500")
|
|
331
|
+
*/
|
|
336
332
|
declare function formatAmount(amount: number, currency?: Currency): string;
|
|
337
333
|
//#endregion
|
|
338
334
|
//#region src/utils/getCurrencyAmountKey.d.ts
|
|
@@ -471,9 +467,10 @@ type FullSsoParams = Omit<PrepareSsoParamsType, "metadata"> & {
|
|
|
471
467
|
*
|
|
472
468
|
* @param walletUrl - Base wallet URL (e.g., "https://wallet.frak.id")
|
|
473
469
|
* @param params - SSO parameters
|
|
474
|
-
* @param
|
|
470
|
+
* @param merchantId - Merchant identifier
|
|
475
471
|
* @param name - Application name
|
|
476
472
|
* @param css - Optional custom CSS
|
|
473
|
+
* @param clientId - Optional client identifier (auto-generated if omitted)
|
|
477
474
|
* @returns Complete SSO URL ready to open in popup or redirect
|
|
478
475
|
*
|
|
479
476
|
* @example
|
|
@@ -507,8 +504,18 @@ type CompressedSsoData = {
|
|
|
507
504
|
};
|
|
508
505
|
//#endregion
|
|
509
506
|
//#region src/utils/trackEvent.d.ts
|
|
507
|
+
/**
|
|
508
|
+
* Analytics event names emitted by the SDK
|
|
509
|
+
*/
|
|
510
510
|
type FrakEvent = "share_button_clicked" | "wallet_button_clicked" | "open_in_app_clicked" | "open_in_app_login_clicked" | "app_not_installed" | "share_modal_error" | "user_referred_started" | "user_referred_completed" | "user_referred_error";
|
|
511
511
|
type EventProps = Record<string, unknown>;
|
|
512
|
+
/**
|
|
513
|
+
* Track an analytics event via OpenPanel.
|
|
514
|
+
* Fire-and-forget: silently catches errors.
|
|
515
|
+
* @param client - The Frak client instance (no-op if undefined)
|
|
516
|
+
* @param event - The event name to track
|
|
517
|
+
* @param props - Optional event properties
|
|
518
|
+
*/
|
|
512
519
|
declare function trackEvent(client: FrakClient | undefined, event: FrakEvent, props?: EventProps): void;
|
|
513
520
|
//#endregion
|
|
514
521
|
//#region src/utils/computeLegacyProductId.d.ts
|
|
@@ -522,4 +529,4 @@ declare function computeLegacyProductId({
|
|
|
522
529
|
domain?: string;
|
|
523
530
|
}): `0x${string}`;
|
|
524
531
|
//#endregion
|
|
525
|
-
export { getBackendUrl as A,
|
|
532
|
+
export { getBackendUrl as A, HashProtectedData as B, triggerDeepLinkWithFallback as C, base64urlDecode as D, compressJsonToB64 as E, createIFrameFrakClient as F, TrackArrivalParams as I, TrackArrivalResult as L, locales as M, setupClient as N, base64urlEncode as O, DebugInfoGatherer as P, UtmParams as R, toAndroidIntentUrl as S, decompressJsonFromB64 as T, KeyProvider as V, formatAmount as _, CompressedSsoData as a, isChromiumAndroid as b, clearMerchantIdCache as c, baseIframeProps as d, createIframe as f, getCurrencyAmountKey as g, getSupportedCurrency as h, AppSpecificSsoMetadata as i, LocalesKey as j, getClientId as k, fetchMerchantId as l, getSupportedLocale as m, FrakEvent as n, FullSsoParams as o, findIframeInOpener as p, trackEvent as r, generateSsoUrl as s, computeLegacyProductId as t, resolveMerchantId as u, FrakContextManager as v, DEEP_LINK_SCHEME as w, isFrakDeepLink as x, DeepLinkFallbackOptions as y, CompressedData as z };
|
|
@@ -62,23 +62,13 @@ type TrackArrivalResult = {
|
|
|
62
62
|
touchpointId?: string;
|
|
63
63
|
error?: string;
|
|
64
64
|
};
|
|
65
|
-
/**
|
|
66
|
-
* Internal params passed to the trackArrival action
|
|
67
|
-
* Includes merchantId resolved from config or fetch
|
|
68
|
-
* @internal
|
|
69
|
-
*/
|
|
70
|
-
type TrackArrivalInternalParams = TrackArrivalParams & {
|
|
71
|
-
/**
|
|
72
|
-
* The merchant ID (UUID from dashboard)
|
|
73
|
-
*/
|
|
74
|
-
merchantId: string;
|
|
75
|
-
};
|
|
76
65
|
//#endregion
|
|
77
66
|
//#region src/clients/createIFrameFrakClient.d.ts
|
|
78
67
|
/**
|
|
79
68
|
* Create a new iframe Frak client
|
|
80
69
|
* @param args
|
|
81
|
-
* @param args.config - The configuration to use for the Frak Wallet SDK
|
|
70
|
+
* @param args.config - The configuration to use for the Frak Wallet SDK.
|
|
71
|
+
* When `config.domain` is set, it is forwarded to the iframe handshake so the listener resolves the correct merchant in tunneled/proxied environments (e.g. Shopify dev with Cloudflare tunnel).
|
|
82
72
|
* @param args.iframe - The iframe to use for the communication
|
|
83
73
|
* @returns The created Frak Client
|
|
84
74
|
*
|
|
@@ -333,6 +323,12 @@ declare const FrakContextManager: {
|
|
|
333
323
|
};
|
|
334
324
|
//#endregion
|
|
335
325
|
//#region src/utils/formatAmount.d.ts
|
|
326
|
+
/**
|
|
327
|
+
* Format a numeric amount as a localized currency string
|
|
328
|
+
* @param amount - The raw numeric amount to format
|
|
329
|
+
* @param currency - Optional currency config; defaults to EUR/fr-FR when omitted
|
|
330
|
+
* @returns Localized currency string (e.g. "1 500 €", "$1,500")
|
|
331
|
+
*/
|
|
336
332
|
declare function formatAmount(amount: number, currency?: Currency): string;
|
|
337
333
|
//#endregion
|
|
338
334
|
//#region src/utils/getCurrencyAmountKey.d.ts
|
|
@@ -471,9 +467,10 @@ type FullSsoParams = Omit<PrepareSsoParamsType, "metadata"> & {
|
|
|
471
467
|
*
|
|
472
468
|
* @param walletUrl - Base wallet URL (e.g., "https://wallet.frak.id")
|
|
473
469
|
* @param params - SSO parameters
|
|
474
|
-
* @param
|
|
470
|
+
* @param merchantId - Merchant identifier
|
|
475
471
|
* @param name - Application name
|
|
476
472
|
* @param css - Optional custom CSS
|
|
473
|
+
* @param clientId - Optional client identifier (auto-generated if omitted)
|
|
477
474
|
* @returns Complete SSO URL ready to open in popup or redirect
|
|
478
475
|
*
|
|
479
476
|
* @example
|
|
@@ -507,8 +504,18 @@ type CompressedSsoData = {
|
|
|
507
504
|
};
|
|
508
505
|
//#endregion
|
|
509
506
|
//#region src/utils/trackEvent.d.ts
|
|
507
|
+
/**
|
|
508
|
+
* Analytics event names emitted by the SDK
|
|
509
|
+
*/
|
|
510
510
|
type FrakEvent = "share_button_clicked" | "wallet_button_clicked" | "open_in_app_clicked" | "open_in_app_login_clicked" | "app_not_installed" | "share_modal_error" | "user_referred_started" | "user_referred_completed" | "user_referred_error";
|
|
511
511
|
type EventProps = Record<string, unknown>;
|
|
512
|
+
/**
|
|
513
|
+
* Track an analytics event via OpenPanel.
|
|
514
|
+
* Fire-and-forget: silently catches errors.
|
|
515
|
+
* @param client - The Frak client instance (no-op if undefined)
|
|
516
|
+
* @param event - The event name to track
|
|
517
|
+
* @param props - Optional event properties
|
|
518
|
+
*/
|
|
512
519
|
declare function trackEvent(client: FrakClient | undefined, event: FrakEvent, props?: EventProps): void;
|
|
513
520
|
//#endregion
|
|
514
521
|
//#region src/utils/computeLegacyProductId.d.ts
|
|
@@ -522,4 +529,4 @@ declare function computeLegacyProductId({
|
|
|
522
529
|
domain?: string;
|
|
523
530
|
}): `0x${string}`;
|
|
524
531
|
//#endregion
|
|
525
|
-
export { getBackendUrl as A,
|
|
532
|
+
export { getBackendUrl as A, HashProtectedData as B, triggerDeepLinkWithFallback as C, base64urlDecode as D, compressJsonToB64 as E, createIFrameFrakClient as F, TrackArrivalParams as I, TrackArrivalResult as L, locales as M, setupClient as N, base64urlEncode as O, DebugInfoGatherer as P, UtmParams as R, toAndroidIntentUrl as S, decompressJsonFromB64 as T, KeyProvider as V, formatAmount as _, CompressedSsoData as a, isChromiumAndroid as b, clearMerchantIdCache as c, baseIframeProps as d, createIframe as f, getCurrencyAmountKey as g, getSupportedCurrency as h, AppSpecificSsoMetadata as i, LocalesKey as j, getClientId as k, fetchMerchantId as l, getSupportedLocale as m, FrakEvent as n, FullSsoParams as o, findIframeInOpener as p, trackEvent as r, generateSsoUrl as s, computeLegacyProductId as t, resolveMerchantId as u, FrakContextManager as v, DEEP_LINK_SCHEME as w, isFrakDeepLink as x, DeepLinkFallbackOptions as y, CompressedData as z };
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { A as SiweAuthenticateReturnType, B as ModalStepMetadata, C as ModalRpcStepsInput, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, G as FrakWalletSdkConfig, H as IFrameLifecycleEvent, I as PrepareSsoReturnType, J as LocalizedI18nConfig, K as I18nConfig, L as SsoMetadata, M as LoginModalStepType, N as OpenSsoParamsType, O as SendTransactionTxType, P as OpenSsoReturnType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, U as ClientLifecycleEvent, V as InteractionTypeKey, W as Currency, _ as LoggedOutEmbeddedView, a as FrakClient, b as LoggedInEmbeddedView, c as IFrameRpcSchema, d as GetMerchantInformationReturnType, f as RewardTier, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, k as SiweAuthenticateModalStepType, l as WalletStatusReturnType, m as SendInteractionParamsType, n as ssoPopupFeatures, o as FrakLifecycleEvent, p as TokenAmountType, q as Language, r as ssoPopupName, s as IFrameTransport, u as EstimatedReward, v as EmbeddedViewActionReferred, w as ModalRpcStepsResultType, x as DisplayModalParamsType, y as EmbeddedViewActionSharing, z as FinalModalStepType } from "./openSso-CC1-loUk.cjs";
|
|
2
|
-
import { A as getBackendUrl, B as
|
|
3
|
-
export { type AppSpecificSsoMetadata, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type Currency, DEEP_LINK_SCHEME, DebugInfoGatherer, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakEvent, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type LocalesKey, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type RewardTier, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionReturnType, type SendTransactionTxType, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type
|
|
2
|
+
import { A as getBackendUrl, B as HashProtectedData, C as triggerDeepLinkWithFallback, D as base64urlDecode, E as compressJsonToB64, F as createIFrameFrakClient, I as TrackArrivalParams, L as TrackArrivalResult, M as locales, N as setupClient, O as base64urlEncode, P as DebugInfoGatherer, R as UtmParams, S as toAndroidIntentUrl, T as decompressJsonFromB64, V as KeyProvider, _ as formatAmount, a as CompressedSsoData, b as isChromiumAndroid, c as clearMerchantIdCache, d as baseIframeProps, f as createIframe, g as getCurrencyAmountKey, h as getSupportedCurrency, i as AppSpecificSsoMetadata, j as LocalesKey, k as getClientId, l as fetchMerchantId, m as getSupportedLocale, n as FrakEvent, o as FullSsoParams, p as findIframeInOpener, r as trackEvent, s as generateSsoUrl, t as computeLegacyProductId, u as resolveMerchantId, v as FrakContextManager, w as DEEP_LINK_SCHEME, x as isFrakDeepLink, y as DeepLinkFallbackOptions, z as CompressedData } from "./computeLegacyProductId-CpWhPpNt.cjs";
|
|
3
|
+
export { type AppSpecificSsoMetadata, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type Currency, DEEP_LINK_SCHEME, DebugInfoGatherer, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakEvent, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type LocalesKey, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type RewardTier, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionReturnType, type SendTransactionTxType, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalParams, type TrackArrivalResult, type UtmParams, type WalletStatusReturnType, base64urlDecode, base64urlEncode, baseIframeProps, clearMerchantIdCache, compressJsonToB64, computeLegacyProductId, createIFrameFrakClient, createIframe, decompressJsonFromB64, fetchMerchantId, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getSupportedCurrency, getSupportedLocale, isChromiumAndroid, isFrakDeepLink, locales, resolveMerchantId, setupClient, ssoPopupFeatures, ssoPopupName, toAndroidIntentUrl, trackEvent, triggerDeepLinkWithFallback };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { A as SiweAuthenticateReturnType, B as ModalStepMetadata, C as ModalRpcStepsInput, D as SendTransactionReturnType, E as SendTransactionModalStepType, F as PrepareSsoParamsType, G as FrakWalletSdkConfig, H as IFrameLifecycleEvent, I as PrepareSsoReturnType, J as LocalizedI18nConfig, K as I18nConfig, L as SsoMetadata, M as LoginModalStepType, N as OpenSsoParamsType, O as SendTransactionTxType, P as OpenSsoReturnType, R as FinalActionType, S as ModalRpcMetadata, T as ModalStepTypes, U as ClientLifecycleEvent, V as InteractionTypeKey, W as Currency, _ as LoggedOutEmbeddedView, a as FrakClient, b as LoggedInEmbeddedView, c as IFrameRpcSchema, d as GetMerchantInformationReturnType, f as RewardTier, g as DisplayEmbeddedWalletResultType, h as DisplayEmbeddedWalletParamsType, i as FrakContext, j as SiweAuthenticationParams, k as SiweAuthenticateModalStepType, l as WalletStatusReturnType, m as SendInteractionParamsType, n as ssoPopupFeatures, o as FrakLifecycleEvent, p as TokenAmountType, q as Language, r as ssoPopupName, s as IFrameTransport, u as EstimatedReward, v as EmbeddedViewActionReferred, w as ModalRpcStepsResultType, x as DisplayModalParamsType, y as EmbeddedViewActionSharing, z as FinalModalStepType } from "./openSso-tkqaDQLV.js";
|
|
2
|
-
import { A as getBackendUrl, B as
|
|
3
|
-
export { type AppSpecificSsoMetadata, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type Currency, DEEP_LINK_SCHEME, DebugInfoGatherer, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakEvent, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type LocalesKey, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type RewardTier, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionReturnType, type SendTransactionTxType, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type
|
|
2
|
+
import { A as getBackendUrl, B as HashProtectedData, C as triggerDeepLinkWithFallback, D as base64urlDecode, E as compressJsonToB64, F as createIFrameFrakClient, I as TrackArrivalParams, L as TrackArrivalResult, M as locales, N as setupClient, O as base64urlEncode, P as DebugInfoGatherer, R as UtmParams, S as toAndroidIntentUrl, T as decompressJsonFromB64, V as KeyProvider, _ as formatAmount, a as CompressedSsoData, b as isChromiumAndroid, c as clearMerchantIdCache, d as baseIframeProps, f as createIframe, g as getCurrencyAmountKey, h as getSupportedCurrency, i as AppSpecificSsoMetadata, j as LocalesKey, k as getClientId, l as fetchMerchantId, m as getSupportedLocale, n as FrakEvent, o as FullSsoParams, p as findIframeInOpener, r as trackEvent, s as generateSsoUrl, t as computeLegacyProductId, u as resolveMerchantId, v as FrakContextManager, w as DEEP_LINK_SCHEME, x as isFrakDeepLink, y as DeepLinkFallbackOptions, z as CompressedData } from "./computeLegacyProductId-dlTwDh1o.js";
|
|
3
|
+
export { type AppSpecificSsoMetadata, type ClientLifecycleEvent, type CompressedData, type CompressedSsoData, type Currency, DEEP_LINK_SCHEME, DebugInfoGatherer, type DeepLinkFallbackOptions, type DisplayEmbeddedWalletParamsType, type DisplayEmbeddedWalletResultType, type DisplayModalParamsType, type EmbeddedViewActionReferred, type EmbeddedViewActionSharing, type EstimatedReward, type FinalActionType, type FinalModalStepType, type FrakClient, type FrakContext, FrakContextManager, type FrakEvent, type FrakLifecycleEvent, type FrakWalletSdkConfig, type FullSsoParams, type GetMerchantInformationReturnType, type HashProtectedData, type I18nConfig, type IFrameLifecycleEvent, type IFrameRpcSchema, type IFrameTransport, type InteractionTypeKey, type KeyProvider, type Language, type LocalesKey, type LocalizedI18nConfig, type LoggedInEmbeddedView, type LoggedOutEmbeddedView, type LoginModalStepType, type ModalRpcMetadata, type ModalRpcStepsInput, type ModalRpcStepsResultType, type ModalStepMetadata, type ModalStepTypes, type OpenSsoParamsType, type OpenSsoReturnType, type PrepareSsoParamsType, type PrepareSsoReturnType, type RewardTier, type SendInteractionParamsType, type SendTransactionModalStepType, type SendTransactionReturnType, type SendTransactionTxType, type SiweAuthenticateModalStepType, type SiweAuthenticateReturnType, type SiweAuthenticationParams, type SsoMetadata, type TokenAmountType, type TrackArrivalParams, type TrackArrivalResult, type UtmParams, type WalletStatusReturnType, base64urlDecode, base64urlEncode, baseIframeProps, clearMerchantIdCache, compressJsonToB64, computeLegacyProductId, createIFrameFrakClient, createIframe, decompressJsonFromB64, fetchMerchantId, findIframeInOpener, formatAmount, generateSsoUrl, getBackendUrl, getClientId, getCurrencyAmountKey, getSupportedCurrency, getSupportedLocale, isChromiumAndroid, isFrakDeepLink, locales, resolveMerchantId, setupClient, ssoPopupFeatures, ssoPopupName, toAndroidIntentUrl, trackEvent, triggerDeepLinkWithFallback };
|
|
@@ -5,6 +5,7 @@ import { A as SiweAuthenticateReturnType, D as SendTransactionReturnType, E as S
|
|
|
5
5
|
* Function used to display the Frak embedded wallet popup
|
|
6
6
|
* @param client - The current Frak Client
|
|
7
7
|
* @param params - The parameter used to customise the embedded wallet
|
|
8
|
+
* @returns The embedded wallet display result
|
|
8
9
|
*/
|
|
9
10
|
declare function displayEmbeddedWallet(client: FrakClient, params: DisplayEmbeddedWalletParamsType): Promise<DisplayEmbeddedWalletResultType>;
|
|
10
11
|
//#endregion
|
|
@@ -117,6 +118,13 @@ declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(cli
|
|
|
117
118
|
}: DisplayModalParamsType<T>): Promise<ModalRpcStepsResultType<T>>;
|
|
118
119
|
//#endregion
|
|
119
120
|
//#region src/actions/getMerchantInformation.d.ts
|
|
121
|
+
/**
|
|
122
|
+
* Fetch the current merchant information (name, rewards, tiers) from the wallet iframe
|
|
123
|
+
* @param client - The current Frak Client
|
|
124
|
+
* @returns The merchant information including available reward tiers
|
|
125
|
+
*
|
|
126
|
+
* @see {@link @frak-labs/core-sdk!index.GetMerchantInformationReturnType | `GetMerchantInformationReturnType`} for the return type shape
|
|
127
|
+
*/
|
|
120
128
|
declare function getMerchantInformation(client: FrakClient): Promise<GetMerchantInformationReturnType>;
|
|
121
129
|
//#endregion
|
|
122
130
|
//#region src/actions/prepareSso.d.ts
|
|
@@ -234,6 +242,37 @@ declare function referralInteraction(client: FrakClient, {
|
|
|
234
242
|
*
|
|
235
243
|
* @param client - The Frak client instance
|
|
236
244
|
* @param params - The interaction parameters
|
|
245
|
+
*
|
|
246
|
+
* @description Sends a user interaction event through the wallet iframe RPC. Supports three interaction types: arrival tracking, sharing events, and custom interactions.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* Track a user arrival with referral attribution:
|
|
250
|
+
* ```ts
|
|
251
|
+
* await sendInteraction(client, {
|
|
252
|
+
* type: "arrival",
|
|
253
|
+
* referrerWallet: "0x1234...abcd",
|
|
254
|
+
* landingUrl: window.location.href,
|
|
255
|
+
* utmSource: "twitter",
|
|
256
|
+
* utmMedium: "social",
|
|
257
|
+
* utmCampaign: "launch-2026",
|
|
258
|
+
* });
|
|
259
|
+
* ```
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* Track a sharing event:
|
|
263
|
+
* ```ts
|
|
264
|
+
* await sendInteraction(client, { type: "sharing" });
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* Send a custom interaction:
|
|
269
|
+
* ```ts
|
|
270
|
+
* await sendInteraction(client, {
|
|
271
|
+
* type: "custom",
|
|
272
|
+
* customType: "newsletter_signup",
|
|
273
|
+
* data: { email: "user@example.com" },
|
|
274
|
+
* });
|
|
275
|
+
* ```
|
|
237
276
|
*/
|
|
238
277
|
declare function sendInteraction(client: FrakClient, params: SendInteractionParamsType): Promise<void>;
|
|
239
278
|
//#endregion
|
|
@@ -5,6 +5,7 @@ import { A as SiweAuthenticateReturnType, D as SendTransactionReturnType, E as S
|
|
|
5
5
|
* Function used to display the Frak embedded wallet popup
|
|
6
6
|
* @param client - The current Frak Client
|
|
7
7
|
* @param params - The parameter used to customise the embedded wallet
|
|
8
|
+
* @returns The embedded wallet display result
|
|
8
9
|
*/
|
|
9
10
|
declare function displayEmbeddedWallet(client: FrakClient, params: DisplayEmbeddedWalletParamsType): Promise<DisplayEmbeddedWalletResultType>;
|
|
10
11
|
//#endregion
|
|
@@ -117,6 +118,13 @@ declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(cli
|
|
|
117
118
|
}: DisplayModalParamsType<T>): Promise<ModalRpcStepsResultType<T>>;
|
|
118
119
|
//#endregion
|
|
119
120
|
//#region src/actions/getMerchantInformation.d.ts
|
|
121
|
+
/**
|
|
122
|
+
* Fetch the current merchant information (name, rewards, tiers) from the wallet iframe
|
|
123
|
+
* @param client - The current Frak Client
|
|
124
|
+
* @returns The merchant information including available reward tiers
|
|
125
|
+
*
|
|
126
|
+
* @see {@link @frak-labs/core-sdk!index.GetMerchantInformationReturnType | `GetMerchantInformationReturnType`} for the return type shape
|
|
127
|
+
*/
|
|
120
128
|
declare function getMerchantInformation(client: FrakClient): Promise<GetMerchantInformationReturnType>;
|
|
121
129
|
//#endregion
|
|
122
130
|
//#region src/actions/prepareSso.d.ts
|
|
@@ -234,6 +242,37 @@ declare function referralInteraction(client: FrakClient, {
|
|
|
234
242
|
*
|
|
235
243
|
* @param client - The Frak client instance
|
|
236
244
|
* @param params - The interaction parameters
|
|
245
|
+
*
|
|
246
|
+
* @description Sends a user interaction event through the wallet iframe RPC. Supports three interaction types: arrival tracking, sharing events, and custom interactions.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* Track a user arrival with referral attribution:
|
|
250
|
+
* ```ts
|
|
251
|
+
* await sendInteraction(client, {
|
|
252
|
+
* type: "arrival",
|
|
253
|
+
* referrerWallet: "0x1234...abcd",
|
|
254
|
+
* landingUrl: window.location.href,
|
|
255
|
+
* utmSource: "twitter",
|
|
256
|
+
* utmMedium: "social",
|
|
257
|
+
* utmCampaign: "launch-2026",
|
|
258
|
+
* });
|
|
259
|
+
* ```
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* Track a sharing event:
|
|
263
|
+
* ```ts
|
|
264
|
+
* await sendInteraction(client, { type: "sharing" });
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* Send a custom interaction:
|
|
269
|
+
* ```ts
|
|
270
|
+
* await sendInteraction(client, {
|
|
271
|
+
* type: "custom",
|
|
272
|
+
* customType: "newsletter_signup",
|
|
273
|
+
* data: { email: "user@example.com" },
|
|
274
|
+
* });
|
|
275
|
+
* ```
|
|
237
276
|
*/
|
|
238
277
|
declare function sendInteraction(client: FrakClient, params: SendInteractionParamsType): Promise<void>;
|
|
239
278
|
//#endregion
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "0.1.1-beta.
|
|
14
|
+
"version": "0.1.1-beta.a3dc949d",
|
|
15
15
|
"description": "Core SDK of the Frak wallet, low level library to interact directly with the frak ecosystem.",
|
|
16
16
|
"repository": {
|
|
17
17
|
"url": "https://github.com/frak-id/wallet",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"viem": "^2.x"
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
|
-
"@frak-labs/frame-connector": "0.1.0-beta.
|
|
94
|
+
"@frak-labs/frame-connector": "0.1.0-beta.a3dc949d",
|
|
95
95
|
"@openpanel/web": "^1.0.7"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
* Function used to display the Frak embedded wallet popup
|
|
9
9
|
* @param client - The current Frak Client
|
|
10
10
|
* @param params - The parameter used to customise the embedded wallet
|
|
11
|
+
* @returns The embedded wallet display result
|
|
11
12
|
*/
|
|
12
13
|
export async function displayEmbeddedWallet(
|
|
13
14
|
client: FrakClient,
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { FrakClient, GetMerchantInformationReturnType } from "../types";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Fetch the current merchant information (name, rewards, tiers) from the wallet iframe
|
|
5
|
+
* @param client - The current Frak Client
|
|
6
|
+
* @returns The merchant information including available reward tiers
|
|
7
|
+
*
|
|
8
|
+
* @see {@link @frak-labs/core-sdk!index.GetMerchantInformationReturnType | `GetMerchantInformationReturnType`} for the return type shape
|
|
9
|
+
*/
|
|
3
10
|
export async function getMerchantInformation(
|
|
4
11
|
client: FrakClient
|
|
5
12
|
): Promise<GetMerchantInformationReturnType> {
|
|
@@ -7,6 +7,37 @@ import type { SendInteractionParamsType } from "../types/rpc/interaction";
|
|
|
7
7
|
*
|
|
8
8
|
* @param client - The Frak client instance
|
|
9
9
|
* @param params - The interaction parameters
|
|
10
|
+
*
|
|
11
|
+
* @description Sends a user interaction event through the wallet iframe RPC. Supports three interaction types: arrival tracking, sharing events, and custom interactions.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* Track a user arrival with referral attribution:
|
|
15
|
+
* ```ts
|
|
16
|
+
* await sendInteraction(client, {
|
|
17
|
+
* type: "arrival",
|
|
18
|
+
* referrerWallet: "0x1234...abcd",
|
|
19
|
+
* landingUrl: window.location.href,
|
|
20
|
+
* utmSource: "twitter",
|
|
21
|
+
* utmMedium: "social",
|
|
22
|
+
* utmCampaign: "launch-2026",
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* Track a sharing event:
|
|
28
|
+
* ```ts
|
|
29
|
+
* await sendInteraction(client, { type: "sharing" });
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* Send a custom interaction:
|
|
34
|
+
* ```ts
|
|
35
|
+
* await sendInteraction(client, {
|
|
36
|
+
* type: "custom",
|
|
37
|
+
* customType: "newsletter_signup",
|
|
38
|
+
* data: { email: "user@example.com" },
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
10
41
|
*/
|
|
11
42
|
export async function sendInteraction(
|
|
12
43
|
client: FrakClient,
|
|
@@ -23,7 +23,8 @@ type SdkRpcClient = RpcClient<IFrameRpcSchema, FrakLifecycleEvent>;
|
|
|
23
23
|
/**
|
|
24
24
|
* Create a new iframe Frak client
|
|
25
25
|
* @param args
|
|
26
|
-
* @param args.config - The configuration to use for the Frak Wallet SDK
|
|
26
|
+
* @param args.config - The configuration to use for the Frak Wallet SDK.
|
|
27
|
+
* When `config.domain` is set, it is forwarded to the iframe handshake so the listener resolves the correct merchant in tunneled/proxied environments (e.g. Shopify dev with Cloudflare tunnel).
|
|
27
28
|
* @param args.iframe - The iframe to use for the communication
|
|
28
29
|
* @returns The created Frak Client
|
|
29
30
|
*
|
|
@@ -26,7 +26,11 @@ function handleBackup(backup: string | undefined): void {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Handle handshake with iframe
|
|
29
|
+
* Handle handshake with iframe — sends client metadata so the listener can resolve the correct merchant
|
|
30
|
+
* @param iframe - The iframe element to post the handshake response to
|
|
31
|
+
* @param token - The handshake token received from the iframe
|
|
32
|
+
* @param targetOrigin - The target origin for postMessage security
|
|
33
|
+
* @param configDomain - Optional override domain for merchant resolution in tunneled/proxied environments
|
|
30
34
|
*/
|
|
31
35
|
function handleHandshake(
|
|
32
36
|
iframe: HTMLIFrameElement,
|
|
@@ -113,6 +117,10 @@ function handleRedirect(
|
|
|
113
117
|
|
|
114
118
|
/**
|
|
115
119
|
* Create a new iframe lifecycle handler
|
|
120
|
+
* @param args
|
|
121
|
+
* @param args.iframe - The iframe element used for wallet communication
|
|
122
|
+
* @param args.targetOrigin - The wallet URL origin for postMessage security
|
|
123
|
+
* @param args.configDomain - Optional domain override forwarded during handshake for tunneled/proxied environments
|
|
116
124
|
* @ignore
|
|
117
125
|
*/
|
|
118
126
|
export function createIFrameLifecycleManager({
|
package/src/index.ts
CHANGED
package/src/types/index.ts
CHANGED
|
@@ -2,6 +2,12 @@ import type { Currency } from "../types";
|
|
|
2
2
|
import { getSupportedCurrency } from "./getSupportedCurrency";
|
|
3
3
|
import { getSupportedLocale } from "./getSupportedLocale";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Format a numeric amount as a localized currency string
|
|
7
|
+
* @param amount - The raw numeric amount to format
|
|
8
|
+
* @param currency - Optional currency config; defaults to EUR/fr-FR when omitted
|
|
9
|
+
* @returns Localized currency string (e.g. "1 500 €", "$1,500")
|
|
10
|
+
*/
|
|
5
11
|
export function formatAmount(amount: number, currency?: Currency) {
|
|
6
12
|
// Get the supported locale (e.g. "fr-FR")
|
|
7
13
|
const supportedLocale = getSupportedLocale(currency);
|
package/src/utils/sso.ts
CHANGED
|
@@ -23,9 +23,10 @@ export type FullSsoParams = Omit<PrepareSsoParamsType, "metadata"> & {
|
|
|
23
23
|
*
|
|
24
24
|
* @param walletUrl - Base wallet URL (e.g., "https://wallet.frak.id")
|
|
25
25
|
* @param params - SSO parameters
|
|
26
|
-
* @param
|
|
26
|
+
* @param merchantId - Merchant identifier
|
|
27
27
|
* @param name - Application name
|
|
28
28
|
* @param css - Optional custom CSS
|
|
29
|
+
* @param clientId - Optional client identifier (auto-generated if omitted)
|
|
29
30
|
* @returns Complete SSO URL ready to open in popup or redirect
|
|
30
31
|
*
|
|
31
32
|
* @example
|
package/src/utils/trackEvent.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { FrakClient } from "../types";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Analytics event names emitted by the SDK
|
|
5
|
+
*/
|
|
3
6
|
export type FrakEvent =
|
|
4
7
|
| "share_button_clicked"
|
|
5
8
|
| "wallet_button_clicked"
|
|
@@ -13,6 +16,13 @@ export type FrakEvent =
|
|
|
13
16
|
|
|
14
17
|
type EventProps = Record<string, unknown>;
|
|
15
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Track an analytics event via OpenPanel.
|
|
21
|
+
* Fire-and-forget: silently catches errors.
|
|
22
|
+
* @param client - The Frak client instance (no-op if undefined)
|
|
23
|
+
* @param event - The event name to track
|
|
24
|
+
* @param props - Optional event properties
|
|
25
|
+
*/
|
|
16
26
|
export function trackEvent(
|
|
17
27
|
client: FrakClient | undefined,
|
|
18
28
|
event: FrakEvent,
|