@frak-labs/core-sdk 1.1.4 → 1.1.5-beta.5b65e64f
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-Cyn4asew.cjs +2 -0
- package/dist/actions-Cyn4asew.cjs.map +1 -0
- package/dist/actions-DtPVuk2e.js +2 -0
- package/dist/actions-DtPVuk2e.js.map +1 -0
- package/dist/actions.cjs +1 -1
- package/dist/actions.d.cts +3 -3
- package/dist/actions.d.ts +3 -3
- 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/frakContext-Bgidv-Se.js +2 -0
- package/dist/frakContext-Bgidv-Se.js.map +1 -0
- package/dist/frakContext-CeVlWFcX.cjs +2 -0
- package/dist/frakContext-CeVlWFcX.cjs.map +1 -0
- 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-lcImYQyL.d.ts → index-BCoPwxjq.d.cts} +4 -2
- package/dist/{index-Cm1PNC9z.d.ts → index-CiHjUnfc.d.ts} +8 -6
- package/dist/{index-Cumn_FNI.d.cts → index-D25z5B9K.d.cts} +8 -6
- package/dist/{index-DR4n-QOe.d.cts → index-trhAN7q9.d.ts} +4 -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-BErs7_Bg.d.cts → openSso-CENLMWJx.d.ts} +4 -279
- package/dist/{openSso-DRLH4D9a.d.ts → openSso-CKvkAGts.d.cts} +4 -279
- package/dist/rewards.cjs +2 -0
- package/dist/rewards.cjs.map +1 -0
- package/dist/rewards.d.cts +101 -0
- package/dist/rewards.d.ts +101 -0
- package/dist/rewards.js +2 -0
- package/dist/rewards.js.map +1 -0
- package/dist/src-BXtnEE3a.js +2 -0
- package/dist/src-BXtnEE3a.js.map +1 -0
- package/dist/src-TpX-7MwJ.cjs +2 -0
- package/dist/src-TpX-7MwJ.cjs.map +1 -0
- package/package.json +16 -3
- package/src/actions/getMerchantInformation.test.ts +2 -0
- package/src/actions/referral/processReferral.test.ts +4 -4
- package/src/actions/referral/processReferral.ts +4 -4
- package/src/clients/createIFrameFrakClient.ts +7 -7
- package/src/clients/transports/iframeLifecycleManager.ts +5 -21
- package/src/config/sdkConfigStore.ts +6 -3
- 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 +27 -0
- package/src/rewards/select.test.ts +212 -0
- package/src/rewards/select.ts +132 -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/rpc/merchantInformation.ts +120 -13
- package/src/utils/analytics/events/lifecycle.ts +1 -1
- package/src/utils/analytics/events/referral.ts +3 -3
- package/src/utils/browser/deepLinkWithFallback.ts +4 -1
- package/src/utils/browser/inAppBrowser.ts +2 -2
- package/src/utils/cache/withCache.ts +30 -11
- package/src/utils/iframe/iframeHelper.test.ts +39 -0
- package/src/utils/iframe/iframeHelper.ts +31 -2
- package/dist/actions-D5GbNcvt.cjs +0 -1
- package/dist/actions-DE2dHqtp.js +0 -1
- package/dist/frakContext-Bl17GGa3.cjs +0 -1
- package/dist/frakContext-DmI5CaSw.js +0 -1
- package/dist/src-5vpUuhfY.js +0 -1
- package/dist/src-BQsjMpvA.cjs +0 -1
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-CKvkAGts.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-D25z5B9K.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 };
|
package/dist/index.d.ts
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--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, u as IFrameRpcSchema, v as EmbeddedViewActionSharing, w as ModalRpcMetadata, x as DisplaySharingPageResultType, y as LoggedInEmbeddedView, z as SsoMetadata } from "./openSso-CENLMWJx.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-CiHjUnfc.js";
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as t,d as n,f as r,g as i,h as a,l as o,m as s,o as c,p as l,s as u,t as d,u as f,v as p,y as m}from"./frakContext-
|
|
1
|
+
import{_ as e,a as t,d as n,f as r,g as i,h as a,l as o,m as s,o as c,p as l,s as u,t as d,u as f,v as p,y as m}from"./frakContext-Bgidv-Se.js";import{a as h,c as g,d as _,f as v,i as y,l as b,n as x,o as S,r as C,s as w,t as T,u as E}from"./src-BXtnEE3a.js";import{n as D,r as O,t as k}from"./getCurrencyAmountKey-DQcwjJiB.js";export{v as DEEP_LINK_SCHEME,d as FrakContextManager,l as base64urlDecode,s as base64urlEncode,h as baseIframeProps,e as clearAllCache,r as compressJsonToB64,y as createIFrameFrakClient,C as decompressJsonFromB64,t as deleteQueryParamCaseInsensitive,S as findIframeInOpener,D as formatAmount,n as generateSsoUrl,i as getBackendUrl,m as getClientId,k as getCurrencyAmountKey,c as getQueryParamCaseInsensitive,O as getSupportedCurrency,w as isIOS,g as isInAppBrowser,b as isMobile,T as mergeAttribution,E as redirectToExternalBrowser,a as sdkConfigStore,x as setupClient,o as ssoPopupFeatures,f as ssoPopupName,u as trackEvent,_ as triggerDeepLinkWithFallback,p as withCache};
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { Address } from "viem";
|
|
2
|
+
|
|
3
|
+
//#region src/types/tracking.d.ts
|
|
4
|
+
type UtmParams = {
|
|
5
|
+
source?: string;
|
|
6
|
+
medium?: string;
|
|
7
|
+
campaign?: string;
|
|
8
|
+
term?: string;
|
|
9
|
+
content?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Attribution parameters appended to outbound sharing URLs.
|
|
13
|
+
*
|
|
14
|
+
* Defaults are derived from the V2 Frak context when available:
|
|
15
|
+
* - `utmSource`: `"frak"`
|
|
16
|
+
* - `utmMedium`: `"referral"`
|
|
17
|
+
* - `utmCampaign`: merchantId (`context.m`)
|
|
18
|
+
* - `via`: `"frak"`
|
|
19
|
+
* - `ref`: clientId (`context.c`)
|
|
20
|
+
*
|
|
21
|
+
* Fields explicitly set here override the defaults. Existing params on the
|
|
22
|
+
* base URL are preserved (gap-fill policy) to respect merchant-provided UTMs.
|
|
23
|
+
*/
|
|
24
|
+
type AttributionParams = {
|
|
25
|
+
utmSource?: string;
|
|
26
|
+
utmMedium?: string;
|
|
27
|
+
utmCampaign?: string;
|
|
28
|
+
utmContent?: string;
|
|
29
|
+
utmTerm?: string;
|
|
30
|
+
via?: string;
|
|
31
|
+
ref?: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Merchant-level attribution defaults.
|
|
35
|
+
*
|
|
36
|
+
* Same shape as {@link AttributionParams} minus `utmContent`, because
|
|
37
|
+
* `utm_content` describes the specific content/creative being shared and is
|
|
38
|
+
* inherently per-call or per-product (never a merchant-wide default).
|
|
39
|
+
*
|
|
40
|
+
* Used as the shape for both:
|
|
41
|
+
* - `FrakWalletSdkConfig.attribution` (SDK-side compile-time defaults)
|
|
42
|
+
* - Backend merchant-config attribution (dashboard-driven defaults)
|
|
43
|
+
*/
|
|
44
|
+
type AttributionDefaults = Omit<AttributionParams, "utmContent">;
|
|
45
|
+
type TrackArrivalParams = {
|
|
46
|
+
/** Sharer wallet address. Accepted in both V1 (legacy) and V2 (authenticated sharer) contexts. */referrerWallet?: Address;
|
|
47
|
+
referrerClientId?: string;
|
|
48
|
+
referrerMerchantId?: string; /** Epoch seconds timestamp from the referral link creation */
|
|
49
|
+
referralTimestamp?: number;
|
|
50
|
+
};
|
|
51
|
+
type TrackArrivalResult = {
|
|
52
|
+
success: boolean;
|
|
53
|
+
identityGroupId?: string;
|
|
54
|
+
referralLinkId?: string;
|
|
55
|
+
error?: string;
|
|
56
|
+
};
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/types/config.d.ts
|
|
59
|
+
/**
|
|
60
|
+
* All the currencies available
|
|
61
|
+
* @category Config
|
|
62
|
+
*/
|
|
63
|
+
type Currency = "eur" | "usd" | "gbp";
|
|
64
|
+
/**
|
|
65
|
+
* All the languages available
|
|
66
|
+
* @category Config
|
|
67
|
+
*/
|
|
68
|
+
type Language = "fr" | "en";
|
|
69
|
+
/**
|
|
70
|
+
* Configuration for the Frak Wallet SDK
|
|
71
|
+
* @category Config
|
|
72
|
+
*/
|
|
73
|
+
type FrakWalletSdkConfig = {
|
|
74
|
+
/**
|
|
75
|
+
* The Frak wallet url
|
|
76
|
+
* @defaultValue "https://wallet.frak.id"
|
|
77
|
+
*/
|
|
78
|
+
walletUrl?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Some metadata about your implementation of the Frak SDK
|
|
81
|
+
*/
|
|
82
|
+
metadata: {
|
|
83
|
+
/**
|
|
84
|
+
* Your application name (will be displayed in a few modals and in SSO)
|
|
85
|
+
*/
|
|
86
|
+
name?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Your merchant ID from the Frak dashboard (UUID format)
|
|
89
|
+
* Used for referral tracking and analytics
|
|
90
|
+
* If not provided, will be auto-fetched from the backend using your domain
|
|
91
|
+
*/
|
|
92
|
+
merchantId?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Language to display in the modal
|
|
95
|
+
* If undefined, will default to the browser language
|
|
96
|
+
*/
|
|
97
|
+
lang?: Language;
|
|
98
|
+
/**
|
|
99
|
+
* The currency to display in the modal
|
|
100
|
+
* @defaultValue `"eur"`
|
|
101
|
+
*/
|
|
102
|
+
currency?: Currency;
|
|
103
|
+
/**
|
|
104
|
+
* The logo URL that will be displayed in a few components
|
|
105
|
+
*/
|
|
106
|
+
logoUrl?: string;
|
|
107
|
+
/**
|
|
108
|
+
* The homepage link that could be displayed in a few components
|
|
109
|
+
*/
|
|
110
|
+
homepageLink?: string;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Some customization for the modal
|
|
114
|
+
*/
|
|
115
|
+
customizations?: {
|
|
116
|
+
/**
|
|
117
|
+
* Custom CSS styles to apply to the modals and components
|
|
118
|
+
*/
|
|
119
|
+
css?: `${string}.css`;
|
|
120
|
+
/**
|
|
121
|
+
* Custom i18n configuration for the modal
|
|
122
|
+
*/
|
|
123
|
+
i18n?: I18nConfig;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* The domain name of your application
|
|
127
|
+
* @defaultValue window.location.host
|
|
128
|
+
*/
|
|
129
|
+
domain?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Wait for backend config before rendering components.
|
|
132
|
+
* When true (default), components show a spinner until backend config is resolved.
|
|
133
|
+
* When false, components render immediately with SDK static config / HTML attributes.
|
|
134
|
+
* @defaultValue true
|
|
135
|
+
*/
|
|
136
|
+
waitForBackendConfig?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Default attribution params (UTM / via / ref) appended to outbound
|
|
139
|
+
* sharing URLs. Per-call `displaySharingPage` overrides win, then backend
|
|
140
|
+
* config, then this SDK-level default. `utm_content` is intentionally
|
|
141
|
+
* excluded — it is per-content/per-product, never a merchant-wide default.
|
|
142
|
+
*/
|
|
143
|
+
attribution?: AttributionDefaults;
|
|
144
|
+
/**
|
|
145
|
+
* Preload specific UI views inside the listener iframe for better UX.
|
|
146
|
+
* Default: ["sharing"]
|
|
147
|
+
*/
|
|
148
|
+
preload?: ListenerPreloadOption[];
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Custom i18n configuration for the modal
|
|
152
|
+
* See [i18next json format](https://www.i18next.com/misc/json-format#i18next-json-v4)
|
|
153
|
+
*
|
|
154
|
+
* Available variables
|
|
155
|
+
* - `{{ productName }}` : The name of your website (`metadata.name`)
|
|
156
|
+
* - `{{ productOrigin }}` : The origin url of your website
|
|
157
|
+
* - `{{ estimatedReward }}` : The estimated reward for the user (based on the specific `targetInteraction` you can specify, or the max referrer reward if no target interaction is specified)
|
|
158
|
+
*
|
|
159
|
+
* Context of the translation [see i18n context](https://www.i18next.com/translation-function/context)
|
|
160
|
+
* - For modal display, the key of the final action (`sharing`, `reward`, or undefined)
|
|
161
|
+
* - For embedded wallet display, the key of the logged in action (`sharing` or undefined)
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* // Multi language config
|
|
166
|
+
* const multiI18n = {
|
|
167
|
+
* fr: {
|
|
168
|
+
* "sdk.modal.title": "Titre de modal",
|
|
169
|
+
* "sdk.modal.description": "Description de modal, avec {{ estimatedReward }} de gains possible",
|
|
170
|
+
* },
|
|
171
|
+
* en: "https://example.com/en.json"
|
|
172
|
+
* }
|
|
173
|
+
*
|
|
174
|
+
* // Single language config
|
|
175
|
+
* const singleI18n = {
|
|
176
|
+
* "sdk.modal.title": "Modal title",
|
|
177
|
+
* "sdk.modal.description": "Modal description, with {{ estimatedReward }} of gains possible",
|
|
178
|
+
* }
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
181
|
+
* @category Config
|
|
182
|
+
*/
|
|
183
|
+
type I18nConfig = Record<Language, LocalizedI18nConfig> | LocalizedI18nConfig;
|
|
184
|
+
/**
|
|
185
|
+
* Options for preloading the listener UI
|
|
186
|
+
* @category Config
|
|
187
|
+
*/
|
|
188
|
+
type ListenerPreloadOption = "modal" | "sharing";
|
|
189
|
+
/**
|
|
190
|
+
* A localized i18n config (inline objects only — URL-based i18n removed)
|
|
191
|
+
* @category Config
|
|
192
|
+
*/
|
|
193
|
+
type LocalizedI18nConfig = {
|
|
194
|
+
[key: string]: string;
|
|
195
|
+
};
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/constants/interactionTypes.d.ts
|
|
198
|
+
/**
|
|
199
|
+
* The supported interaction type keys
|
|
200
|
+
*
|
|
201
|
+
* - `referral` - User arrived via a referral link
|
|
202
|
+
* - `create_referral_link` - User created/shared a referral link
|
|
203
|
+
* - `purchase` - User completed a purchase
|
|
204
|
+
* - `custom.${string}` - Custom interaction type defined per campaign
|
|
205
|
+
*
|
|
206
|
+
* @inline
|
|
207
|
+
*/
|
|
208
|
+
type InteractionTypeKey = "referral" | "create_referral_link" | "purchase" | `custom.${string}`;
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/types/rpc/merchantInformation.d.ts
|
|
211
|
+
/**
|
|
212
|
+
* The type for the amount of tokens
|
|
213
|
+
*/
|
|
214
|
+
type TokenAmountType = {
|
|
215
|
+
amount: number;
|
|
216
|
+
eurAmount: number;
|
|
217
|
+
usdAmount: number;
|
|
218
|
+
gbpAmount: number;
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* A tier definition for tiered rewards — pays either a flat token amount
|
|
222
|
+
* or a percent of the tier field value
|
|
223
|
+
*/
|
|
224
|
+
type RewardTier = {
|
|
225
|
+
minValue: number;
|
|
226
|
+
maxValue?: number;
|
|
227
|
+
amount: TokenAmountType;
|
|
228
|
+
} | {
|
|
229
|
+
minValue: number;
|
|
230
|
+
maxValue?: number;
|
|
231
|
+
percent: number;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Estimated reward amount — discriminated union by payout type
|
|
235
|
+
*
|
|
236
|
+
* - `fixed`: A known token amount (with fiat equivalents)
|
|
237
|
+
* - `percentage`: A percent of a purchase field (e.g. 5% of purchase_amount), with optional min/max caps
|
|
238
|
+
* - `tiered`: Amount depends on a field value matching tier brackets
|
|
239
|
+
*/
|
|
240
|
+
type EstimatedReward = {
|
|
241
|
+
payoutType: "fixed";
|
|
242
|
+
amount: TokenAmountType;
|
|
243
|
+
} | {
|
|
244
|
+
payoutType: "percentage";
|
|
245
|
+
percent: number;
|
|
246
|
+
percentOf: string;
|
|
247
|
+
maxAmount?: TokenAmountType;
|
|
248
|
+
minAmount?: TokenAmountType;
|
|
249
|
+
} | {
|
|
250
|
+
payoutType: "tiered";
|
|
251
|
+
tierField: string;
|
|
252
|
+
tiers: RewardTier[];
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Comparison operators usable in a {@link RuleCondition}.
|
|
256
|
+
* @group RPC Schema
|
|
257
|
+
*/
|
|
258
|
+
type ConditionOperator = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with" | "exists" | "not_exists" | "between";
|
|
259
|
+
/**
|
|
260
|
+
* Dot-path of the rule-evaluation context field a {@link RuleCondition} targets.
|
|
261
|
+
*
|
|
262
|
+
* Only the paths the SDK actually reads are listed (for editor autocompletion);
|
|
263
|
+
* the trailing `string` member keeps the type open to any other path the backend
|
|
264
|
+
* may emit, so it never lies at runtime. Custom interaction data is addressed
|
|
265
|
+
* through `custom.${string}`.
|
|
266
|
+
* @group RPC Schema
|
|
267
|
+
*/
|
|
268
|
+
type RuleField = "purchase.amount" | "time.timestamp" | "attribution.referrerIdentityGroupId" | `custom.${string}` | (string & Record<never, never>);
|
|
269
|
+
/**
|
|
270
|
+
* A single leaf rule condition. Compares the value found at {@link RuleField}
|
|
271
|
+
* in the evaluation context against `value` (and `valueTo` for `between`).
|
|
272
|
+
* @group RPC Schema
|
|
273
|
+
*/
|
|
274
|
+
type RuleCondition = {
|
|
275
|
+
field: RuleField;
|
|
276
|
+
operator: ConditionOperator;
|
|
277
|
+
value: string | number | boolean | null;
|
|
278
|
+
valueTo?: string | number | boolean | null;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* A recursive group of conditions combined through a boolean `logic`.
|
|
282
|
+
* @group RPC Schema
|
|
283
|
+
*/
|
|
284
|
+
type ConditionGroup = {
|
|
285
|
+
logic: "all" | "any" | "none";
|
|
286
|
+
conditions: (RuleCondition | ConditionGroup)[];
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* Campaign gating rules: a flat list of {@link RuleCondition} (implicitly
|
|
290
|
+
* AND-ed) or a nested {@link ConditionGroup} tree. Surfaced raw so integrators
|
|
291
|
+
* can inspect the rules and derive their own display (start date, minimum
|
|
292
|
+
* purchase, …) instead of relying on pre-computed fields.
|
|
293
|
+
* @group RPC Schema
|
|
294
|
+
*/
|
|
295
|
+
type RuleConditions = RuleCondition[] | ConditionGroup;
|
|
296
|
+
/**
|
|
297
|
+
* A reward offer exposed by a merchant campaign.
|
|
298
|
+
*
|
|
299
|
+
* Mirrors the backend `EstimatedRewardItem` one-to-one — a static parity
|
|
300
|
+
* assertion on the backend keeps its runtime-validated schema in lockstep with
|
|
301
|
+
* this published contract.
|
|
302
|
+
* @group RPC Schema
|
|
303
|
+
*/
|
|
304
|
+
type MerchantReward = {
|
|
305
|
+
/** Reward token address; falls back to the merchant token when omitted. */token?: Address; /** Identifier of the campaign rule this reward originates from. */
|
|
306
|
+
campaignId: string; /** Campaign display name. */
|
|
307
|
+
name: string; /** Interaction that triggers the reward. */
|
|
308
|
+
interactionTypeKey: InteractionTypeKey; /** Reward paid to the referrer, when the campaign defines one. */
|
|
309
|
+
referrer?: EstimatedReward; /** Reward paid to the referee, when the campaign defines one. */
|
|
310
|
+
referee?: EstimatedReward; /** Raw gating rules — inspect to derive start date, minimum purchase, … */
|
|
311
|
+
conditions: RuleConditions; /** Seconds a reward stays locked before settlement. */
|
|
312
|
+
defaultLockupSeconds?: number; /** Days before a pending reward expires. */
|
|
313
|
+
pendingRewardExpirationDays?: number; /** Per-user reward cap for this campaign. */
|
|
314
|
+
maxRewardsPerUser?: number; /** Merchant-wide per-user reward cap across every campaign. */
|
|
315
|
+
merchantMaxRewardsPerUser?: number; /** ISO-8601 campaign end date, or `null` when open-ended. */
|
|
316
|
+
expiresAt?: string | null;
|
|
317
|
+
};
|
|
318
|
+
/**
|
|
319
|
+
* Response of the `frak_getMerchantInformation` RPC method
|
|
320
|
+
* @group RPC Schema
|
|
321
|
+
*/
|
|
322
|
+
type GetMerchantInformationReturnType = {
|
|
323
|
+
/**
|
|
324
|
+
* Current merchant id
|
|
325
|
+
*/
|
|
326
|
+
id: string;
|
|
327
|
+
/**
|
|
328
|
+
* Some metadata
|
|
329
|
+
*/
|
|
330
|
+
onChainMetadata: {
|
|
331
|
+
/**
|
|
332
|
+
* Name of the merchant on-chain
|
|
333
|
+
*/
|
|
334
|
+
name: string;
|
|
335
|
+
/**
|
|
336
|
+
* Domain of the merchant on-chain
|
|
337
|
+
*/
|
|
338
|
+
domain: string;
|
|
339
|
+
};
|
|
340
|
+
rewards: MerchantReward[];
|
|
341
|
+
};
|
|
342
|
+
//#endregion
|
|
343
|
+
export { UtmParams as S, LocalizedI18nConfig as _, MerchantReward as a, TrackArrivalParams as b, RuleConditions as c, InteractionTypeKey as d, Currency as f, ListenerPreloadOption as g, Language as h, GetMerchantInformationReturnType as i, RuleField as l, I18nConfig as m, ConditionOperator as n, RewardTier as o, FrakWalletSdkConfig as p, EstimatedReward as r, RuleCondition as s, ConditionGroup as t, TokenAmountType as u, AttributionDefaults as v, TrackArrivalResult as x, AttributionParams as y };
|
|
344
|
+
//# sourceMappingURL=merchantInformation--tLnowAN.d.ts.map
|