@frak-labs/core-sdk 0.2.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/cdn/bundle.js +3 -3
- package/dist/actions-D4aBXbdp.cjs +1 -0
- package/dist/actions-Dq_uN-wn.js +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 +4 -4
- package/dist/bundle.d.ts +4 -4
- package/dist/bundle.js +1 -1
- package/dist/{computeLegacyProductId-CCAZvLa5.d.cts → index-BV5D9DsW.d.ts} +91 -37
- package/dist/{siweAuthenticate-CnCZ7mok.d.ts → index-BphwTmKA.d.cts} +122 -8
- package/dist/{computeLegacyProductId-b5cUWdAm.d.ts → index-Dwmo109y.d.cts} +91 -37
- package/dist/{siweAuthenticate-CVigMOxz.d.cts → index-_f8EuN_1.d.ts} +122 -8
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/{openSso-B0g7-807.d.cts → openSso-BwEK2M98.d.cts} +283 -44
- package/dist/{openSso-CMzwvaCa.d.ts → openSso-C1Wzl5-i.d.ts} +283 -44
- package/dist/src-B1eliIi6.cjs +13 -0
- package/dist/src-C0UH1GsN.js +13 -0
- package/dist/trackEvent-BqJqRZ-u.cjs +1 -0
- package/dist/trackEvent-Bqq4jd6R.js +1 -0
- package/package.json +11 -12
- package/src/actions/displayEmbeddedWallet.ts +6 -2
- package/src/actions/displayModal.ts +6 -2
- package/src/actions/displaySharingPage.ts +49 -0
- package/src/actions/ensureIdentity.ts +2 -2
- package/src/actions/getMerchantInformation.test.ts +13 -1
- package/src/actions/getMerchantInformation.ts +20 -5
- package/src/actions/getMergeToken.ts +33 -0
- package/src/actions/getUserReferralStatus.ts +42 -0
- package/src/actions/index.ts +8 -1
- package/src/actions/referral/setupReferral.test.ts +79 -0
- package/src/actions/referral/setupReferral.ts +32 -0
- package/src/actions/trackPurchaseStatus.test.ts +32 -20
- package/src/actions/trackPurchaseStatus.ts +3 -5
- package/src/actions/wrapper/modalBuilder.test.ts +4 -2
- package/src/actions/wrapper/modalBuilder.ts +6 -8
- package/src/clients/createIFrameFrakClient.ts +151 -27
- package/src/clients/transports/iframeLifecycleManager.test.ts +14 -94
- package/src/clients/transports/iframeLifecycleManager.ts +35 -53
- package/src/index.ts +17 -4
- package/src/stubs/rrweb.ts +9 -0
- package/src/types/config.ts +10 -3
- package/src/types/index.ts +13 -1
- package/src/types/lifecycle/client.ts +22 -27
- package/src/types/lifecycle/iframe.ts +7 -8
- package/src/types/resolvedConfig.ts +128 -0
- package/src/types/rpc/displaySharingPage.ts +82 -0
- package/src/types/rpc/embedded/index.ts +1 -1
- package/src/types/rpc/interaction.ts +4 -0
- package/src/types/rpc/userReferralStatus.ts +20 -0
- package/src/types/rpc.ts +54 -5
- package/src/utils/backendUrl.test.ts +2 -2
- package/src/utils/backendUrl.ts +1 -1
- package/src/utils/cache/index.ts +7 -0
- package/src/utils/cache/lruMap.test.ts +55 -0
- package/src/utils/cache/lruMap.ts +38 -0
- package/src/utils/cache/withCache.test.ts +168 -0
- package/src/utils/cache/withCache.ts +124 -0
- package/src/utils/inAppBrowser.ts +60 -0
- package/src/utils/index.ts +6 -4
- package/src/utils/sdkConfigStore.test.ts +405 -0
- package/src/utils/sdkConfigStore.ts +263 -0
- package/src/utils/sso.ts +3 -7
- package/dist/setupClient-BduY6Sym.cjs +0 -13
- package/dist/setupClient-ftmdQ-I8.js +0 -13
- package/dist/siweAuthenticate-BWmI2_TN.cjs +0 -1
- package/dist/siweAuthenticate-zczqxm0a.js +0 -1
- package/dist/trackEvent-CeLFVzZn.js +0 -1
- package/dist/trackEvent-Ew5r5zfI.cjs +0 -1
- package/src/utils/merchantId.test.ts +0 -653
- package/src/utils/merchantId.ts +0 -143
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as t,c as n,
|
|
1
|
+
import{_ as e,a as t,c as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h,v as g,y as _}from"./trackEvent-Bqq4jd6R.js";import{_ as v,a as y,c as b,d as x,f as S,g as C,h as w,i as T,l as E,m as D,n as O,o as k,p as A,r as j,s as M,t as N,u as P,v as F,y as I}from"./src-C0UH1GsN.js";export{I as DEEP_LINK_SCHEME,j as DebugInfoGatherer,f as FrakContextManager,i as base64urlDecode,e as base64urlEncode,M as baseIframeProps,p as clearAllCache,a as compressJsonToB64,g as computeLegacyProductId,O as createIFrameFrakClient,b as createIframe,u as decompressJsonFromB64,E as findIframeInOpener,x as formatAmount,c as generateSsoUrl,h as getBackendUrl,n as getCache,_ as getClientId,P as getCurrencyAmountKey,A as getSupportedCurrency,S as getSupportedLocale,w as isChromiumAndroid,C as isFrakDeepLink,T as isIOS,y as isInAppBrowser,o as isV1Context,t as isV2Context,D as locales,k as redirectToExternalBrowser,l as sdkConfigStore,N as setupClient,r as ssoPopupFeatures,d as ssoPopupName,v as toAndroidIntentUrl,m as trackEvent,F as triggerDeepLinkWithFallback,s as withCache};
|
|
@@ -31,7 +31,7 @@ type FrakWalletSdkConfig = {
|
|
|
31
31
|
/**
|
|
32
32
|
* Your application name (will be displayed in a few modals and in SSO)
|
|
33
33
|
*/
|
|
34
|
-
name
|
|
34
|
+
name?: string;
|
|
35
35
|
/**
|
|
36
36
|
* Your merchant ID from the Frak dashboard (UUID format)
|
|
37
37
|
* Used for referral tracking and analytics
|
|
@@ -75,6 +75,13 @@ type FrakWalletSdkConfig = {
|
|
|
75
75
|
* @defaultValue window.location.host
|
|
76
76
|
*/
|
|
77
77
|
domain?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Wait for backend config before rendering components.
|
|
80
|
+
* When true (default), components show a spinner until backend config is resolved.
|
|
81
|
+
* When false, components render immediately with SDK static config / HTML attributes.
|
|
82
|
+
* @defaultValue true
|
|
83
|
+
*/
|
|
84
|
+
waitForBackendConfig?: boolean;
|
|
78
85
|
};
|
|
79
86
|
/**
|
|
80
87
|
* Custom i18n configuration for the modal
|
|
@@ -111,19 +118,118 @@ type FrakWalletSdkConfig = {
|
|
|
111
118
|
*/
|
|
112
119
|
type I18nConfig = Record<Language, LocalizedI18nConfig> | LocalizedI18nConfig;
|
|
113
120
|
/**
|
|
114
|
-
* A localized i18n config
|
|
121
|
+
* A localized i18n config (inline objects only — URL-based i18n removed)
|
|
115
122
|
* @category Config
|
|
116
123
|
*/
|
|
117
|
-
type LocalizedI18nConfig =
|
|
124
|
+
type LocalizedI18nConfig = {
|
|
118
125
|
[key: string]: string;
|
|
119
126
|
};
|
|
120
127
|
//#endregion
|
|
128
|
+
//#region src/types/resolvedConfig.d.ts
|
|
129
|
+
/**
|
|
130
|
+
* Response from the merchant resolve endpoint
|
|
131
|
+
* @category Config
|
|
132
|
+
*/
|
|
133
|
+
type MerchantConfigResponse = {
|
|
134
|
+
merchantId: string;
|
|
135
|
+
name: string;
|
|
136
|
+
domain: string;
|
|
137
|
+
allowedDomains: string[];
|
|
138
|
+
sdkConfig?: ResolvedSdkConfig;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Resolved placement config from backend
|
|
142
|
+
* Translations already flattened: default + lang-specific merged into one record
|
|
143
|
+
* @category Config
|
|
144
|
+
*/
|
|
145
|
+
type ResolvedPlacement = {
|
|
146
|
+
/** Per-component configuration within this placement */components?: {
|
|
147
|
+
buttonShare?: {
|
|
148
|
+
text?: string;
|
|
149
|
+
noRewardText?: string;
|
|
150
|
+
clickAction?: "embedded-wallet" | "share-modal" | "sharing-page";
|
|
151
|
+
useReward?: boolean;
|
|
152
|
+
css?: string;
|
|
153
|
+
};
|
|
154
|
+
buttonWallet?: {
|
|
155
|
+
position?: "right" | "left";
|
|
156
|
+
css?: string;
|
|
157
|
+
};
|
|
158
|
+
openInApp?: {
|
|
159
|
+
text?: string;
|
|
160
|
+
css?: string;
|
|
161
|
+
};
|
|
162
|
+
postPurchase?: {
|
|
163
|
+
badgeText?: string;
|
|
164
|
+
refereeText?: string;
|
|
165
|
+
refereeNoRewardText?: string;
|
|
166
|
+
referrerText?: string;
|
|
167
|
+
referrerNoRewardText?: string;
|
|
168
|
+
ctaText?: string;
|
|
169
|
+
ctaNoRewardText?: string;
|
|
170
|
+
css?: string;
|
|
171
|
+
};
|
|
172
|
+
banner?: {
|
|
173
|
+
referralTitle?: string;
|
|
174
|
+
referralDescription?: string;
|
|
175
|
+
referralCta?: string;
|
|
176
|
+
inappTitle?: string;
|
|
177
|
+
inappDescription?: string;
|
|
178
|
+
inappCta?: string;
|
|
179
|
+
css?: string;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
targetInteraction?: string; /** Already flattened: default + lang-specific merged into one record */
|
|
183
|
+
translations?: Record<string, string>; /** Global placement CSS (applied to modals/listener) */
|
|
184
|
+
css?: string;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Resolved SDK config from backend `/resolve` endpoint
|
|
188
|
+
* Language resolution and translation merging already applied
|
|
189
|
+
* @category Config
|
|
190
|
+
*/
|
|
191
|
+
type ResolvedSdkConfig = {
|
|
192
|
+
name?: string;
|
|
193
|
+
logoUrl?: string;
|
|
194
|
+
homepageLink?: string;
|
|
195
|
+
currency?: Currency;
|
|
196
|
+
lang?: Language; /** When true, all SDK components should be hidden */
|
|
197
|
+
hidden?: boolean;
|
|
198
|
+
css?: string;
|
|
199
|
+
translations?: Record<string, string>;
|
|
200
|
+
placements?: Record<string, ResolvedPlacement>; /** Global component defaults (used when no placement override exists) */
|
|
201
|
+
components?: ResolvedPlacement["components"];
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Internal SDK config store state
|
|
205
|
+
* Merged config: backend > SDK static > defaults
|
|
206
|
+
* Components subscribe to this reactively
|
|
207
|
+
* @category Config
|
|
208
|
+
*/
|
|
209
|
+
type SdkResolvedConfig = {
|
|
210
|
+
/** Whether the backend config has been resolved */isResolved: boolean; /** Merchant ID from resolution */
|
|
211
|
+
merchantId: string; /** Domain returned by the resolve endpoint */
|
|
212
|
+
domain?: string; /** Domains allowed for this merchant (used by iframe trust check) */
|
|
213
|
+
allowedDomains?: string[]; /** Whether the resolve returned a backend sdkConfig object */
|
|
214
|
+
hasRawSdkConfig?: boolean; /** Merged metadata fields */
|
|
215
|
+
name?: string;
|
|
216
|
+
logoUrl?: string;
|
|
217
|
+
homepageLink?: string;
|
|
218
|
+
lang?: Language;
|
|
219
|
+
currency?: Currency; /** When true, all SDK components should be hidden */
|
|
220
|
+
hidden?: boolean; /** Global CSS from backend config (passed to iframe) */
|
|
221
|
+
css?: string; /** Global translations (for reference / component fallback) */
|
|
222
|
+
translations?: Record<string, string>; /** Named placements (keyed by placement ID) */
|
|
223
|
+
placements?: Record<string, ResolvedPlacement>; /** Global component defaults (fallback for placement-level overrides) */
|
|
224
|
+
components?: ResolvedPlacement["components"];
|
|
225
|
+
};
|
|
226
|
+
//#endregion
|
|
121
227
|
//#region src/types/lifecycle/client.d.ts
|
|
122
228
|
/**
|
|
123
229
|
* Event related to the iframe lifecycle
|
|
124
230
|
* @ignore
|
|
125
231
|
*/
|
|
126
|
-
type ClientLifecycleEvent = CustomCssEvent | CustomI18nEvent | RestoreBackupEvent | HearbeatEvent |
|
|
232
|
+
type ClientLifecycleEvent = CustomCssEvent | CustomI18nEvent | RestoreBackupEvent | HearbeatEvent | SsoRedirectCompleteEvent | DeepLinkFailedEvent | ResolvedConfigEvent;
|
|
127
233
|
type CustomCssEvent = {
|
|
128
234
|
clientLifecycle: "modal-css";
|
|
129
235
|
data: {
|
|
@@ -146,30 +252,6 @@ type HearbeatEvent = {
|
|
|
146
252
|
clientLifecycle: "heartbeat";
|
|
147
253
|
data?: never;
|
|
148
254
|
};
|
|
149
|
-
type HandshakeResponse = {
|
|
150
|
-
clientLifecycle: "handshake-response";
|
|
151
|
-
data: {
|
|
152
|
-
token: string;
|
|
153
|
-
currentUrl: string;
|
|
154
|
-
/**
|
|
155
|
-
* Pending merge token extracted from URL (?fmt= parameter)
|
|
156
|
-
* When present, listener should execute identity merge in background
|
|
157
|
-
* URL is cleaned after handshake response is sent
|
|
158
|
-
*/
|
|
159
|
-
pendingMergeToken?: string;
|
|
160
|
-
/**
|
|
161
|
-
* Client ID for identity tracking (belt & suspenders fallback)
|
|
162
|
-
* Primary delivery is via iframe URL query param; handshake is backup for SSR
|
|
163
|
-
*/
|
|
164
|
-
clientId?: string;
|
|
165
|
-
/**
|
|
166
|
-
* Explicit domain from SDK config (FrakWalletSdkConfig.domain)
|
|
167
|
-
* When present, listener should prefer this over URL-derived domain
|
|
168
|
-
* for merchant resolution (handles proxied/tunneled environments)
|
|
169
|
-
*/
|
|
170
|
-
configDomain?: string;
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
255
|
type SsoRedirectCompleteEvent = {
|
|
174
256
|
clientLifecycle: "sso-redirect-complete";
|
|
175
257
|
data: {
|
|
@@ -182,6 +264,21 @@ type DeepLinkFailedEvent = {
|
|
|
182
264
|
originalUrl: string;
|
|
183
265
|
};
|
|
184
266
|
};
|
|
267
|
+
type ResolvedConfigEvent = {
|
|
268
|
+
clientLifecycle: "resolved-config";
|
|
269
|
+
data: {
|
|
270
|
+
merchantId: string; /** The domain the backend resolved this config for */
|
|
271
|
+
domain: string; /** All domains registered for this merchant (for domain proof) */
|
|
272
|
+
allowedDomains: string[]; /** Full URL of the parent page (for interaction tracking) */
|
|
273
|
+
sourceUrl: string;
|
|
274
|
+
/**
|
|
275
|
+
* Pending merge token extracted from URL (?fmt= parameter).
|
|
276
|
+
* When present, listener should execute identity merge in background.
|
|
277
|
+
*/
|
|
278
|
+
pendingMergeToken?: string;
|
|
279
|
+
sdkConfig?: ResolvedSdkConfig;
|
|
280
|
+
};
|
|
281
|
+
};
|
|
185
282
|
//#endregion
|
|
186
283
|
//#region src/types/lifecycle/iframe.d.ts
|
|
187
284
|
/**
|
|
@@ -191,19 +288,13 @@ type DeepLinkFailedEvent = {
|
|
|
191
288
|
type IFrameLifecycleEvent = {
|
|
192
289
|
iframeLifecycle: "connected" | "show" | "hide" | "remove-backup";
|
|
193
290
|
data?: never;
|
|
194
|
-
} | DoBackupEvent |
|
|
291
|
+
} | DoBackupEvent | RedirectRequestEvent;
|
|
195
292
|
type DoBackupEvent = {
|
|
196
293
|
iframeLifecycle: "do-backup";
|
|
197
294
|
data: {
|
|
198
295
|
backup?: string;
|
|
199
296
|
};
|
|
200
297
|
};
|
|
201
|
-
type HandshakeRequestEvent = {
|
|
202
|
-
iframeLifecycle: "handshake";
|
|
203
|
-
data: {
|
|
204
|
-
token: string;
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
298
|
type RedirectRequestEvent = {
|
|
208
299
|
iframeLifecycle: "redirect";
|
|
209
300
|
data: {
|
|
@@ -218,6 +309,13 @@ type RedirectRequestEvent = {
|
|
|
218
309
|
* Used when redirecting out of social browsers to preserve identity across contexts
|
|
219
310
|
*/
|
|
220
311
|
mergeToken?: string;
|
|
312
|
+
/**
|
|
313
|
+
* When true, open the URL in a new tab via window.open(_blank)
|
|
314
|
+
* instead of navigating the current page.
|
|
315
|
+
* Requires the postMessage to include user activation delegation
|
|
316
|
+
* (includeUserActivation: true) so Safari allows the popup.
|
|
317
|
+
*/
|
|
318
|
+
openInNewTab?: boolean;
|
|
221
319
|
};
|
|
222
320
|
};
|
|
223
321
|
//#endregion
|
|
@@ -534,6 +632,85 @@ type DisplayModalParamsType<T extends ModalStepTypes[]> = {
|
|
|
534
632
|
metadata?: ModalRpcMetadata;
|
|
535
633
|
};
|
|
536
634
|
//#endregion
|
|
635
|
+
//#region src/types/rpc/displaySharingPage.d.ts
|
|
636
|
+
/**
|
|
637
|
+
* Product information to display on the sharing page
|
|
638
|
+
* @group Sharing Page
|
|
639
|
+
*/
|
|
640
|
+
type SharingPageProduct = {
|
|
641
|
+
/**
|
|
642
|
+
* The product title / name
|
|
643
|
+
*/
|
|
644
|
+
title: string;
|
|
645
|
+
/**
|
|
646
|
+
* Optional product image URL
|
|
647
|
+
*/
|
|
648
|
+
imageUrl?: string;
|
|
649
|
+
/**
|
|
650
|
+
* Optional product-specific sharing link
|
|
651
|
+
* When provided and the product is selected, this link is used instead of the default sharing link
|
|
652
|
+
*/
|
|
653
|
+
link?: string;
|
|
654
|
+
};
|
|
655
|
+
/**
|
|
656
|
+
* Parameters to display the sharing page
|
|
657
|
+
* @group Sharing Page
|
|
658
|
+
* @group RPC Schema
|
|
659
|
+
*/
|
|
660
|
+
type DisplaySharingPageParamsType = {
|
|
661
|
+
/**
|
|
662
|
+
* Products to showcase on the sharing page
|
|
663
|
+
* If provided, they will be displayed in a product card section
|
|
664
|
+
*/
|
|
665
|
+
products?: SharingPageProduct[];
|
|
666
|
+
/**
|
|
667
|
+
* Optional link override for sharing
|
|
668
|
+
* If not provided, the sharing link will be generated from the current page URL + merchant context
|
|
669
|
+
*/
|
|
670
|
+
link?: string;
|
|
671
|
+
/**
|
|
672
|
+
* Optional metadata overrides for the sharing page
|
|
673
|
+
*/
|
|
674
|
+
metadata?: {
|
|
675
|
+
/**
|
|
676
|
+
* Logo override for the sharing page header
|
|
677
|
+
*/
|
|
678
|
+
logo?: string;
|
|
679
|
+
/**
|
|
680
|
+
* Link to the homepage of the calling website
|
|
681
|
+
*/
|
|
682
|
+
homepageLink?: string;
|
|
683
|
+
/**
|
|
684
|
+
* The target interaction behind this sharing page
|
|
685
|
+
*/
|
|
686
|
+
targetInteraction?: InteractionTypeKey;
|
|
687
|
+
/**
|
|
688
|
+
* i18n overrides for the sharing page
|
|
689
|
+
*/
|
|
690
|
+
i18n?: I18nConfig;
|
|
691
|
+
};
|
|
692
|
+
};
|
|
693
|
+
/**
|
|
694
|
+
* Result of the sharing page display
|
|
695
|
+
* @group Sharing Page
|
|
696
|
+
* @group RPC Schema
|
|
697
|
+
*/
|
|
698
|
+
type DisplaySharingPageResultType = {
|
|
699
|
+
/**
|
|
700
|
+
* The action the user took
|
|
701
|
+
* - "shared": User used the native share dialog
|
|
702
|
+
* - "copied": User copied the link to clipboard
|
|
703
|
+
* - "dismissed": User dismissed the sharing page without acting
|
|
704
|
+
*/
|
|
705
|
+
action: "shared" | "copied" | "dismissed";
|
|
706
|
+
/**
|
|
707
|
+
* The install URL for the Frak app
|
|
708
|
+
* Can be used as a fallback to redirect the user to the install page
|
|
709
|
+
* from the merchant's top-level page (e.g. via `window.location.href`)
|
|
710
|
+
*/
|
|
711
|
+
installUrl?: string;
|
|
712
|
+
};
|
|
713
|
+
//#endregion
|
|
537
714
|
//#region src/types/rpc/embedded/loggedIn.d.ts
|
|
538
715
|
/**
|
|
539
716
|
* The different type of action we can have on the embedded view (once the user is logged in)
|
|
@@ -691,7 +868,9 @@ type SendInteractionParamsType = {
|
|
|
691
868
|
utmTerm?: string;
|
|
692
869
|
utmContent?: string;
|
|
693
870
|
} | {
|
|
694
|
-
type: "sharing";
|
|
871
|
+
type: "sharing"; /** Epoch seconds timestamp matching the V2 context `t` field embedded in the referral link URL, used for backend correlation */
|
|
872
|
+
sharingTimestamp?: number; /** Merchant order ID linking this sharing event to a purchase (stays server-side, never in URL) */
|
|
873
|
+
purchaseId?: string;
|
|
695
874
|
} | {
|
|
696
875
|
type: "custom";
|
|
697
876
|
customType: string;
|
|
@@ -769,6 +948,28 @@ type GetMerchantInformationReturnType = {
|
|
|
769
948
|
}[];
|
|
770
949
|
};
|
|
771
950
|
//#endregion
|
|
951
|
+
//#region src/types/rpc/userReferralStatus.d.ts
|
|
952
|
+
/**
|
|
953
|
+
* User referral status returned by `frak_getUserReferralStatus`.
|
|
954
|
+
*
|
|
955
|
+
* Generic referral context for the current user on a merchant.
|
|
956
|
+
* Used by components like `<frak-post-purchase>` and `<frak-referred-banner>`
|
|
957
|
+
* to adapt their display based on the user's referral relationship.
|
|
958
|
+
*
|
|
959
|
+
* Returns `null` when the user's identity cannot be resolved
|
|
960
|
+
* (e.g. no clientId and no wallet session).
|
|
961
|
+
*
|
|
962
|
+
* @group RPC Schema
|
|
963
|
+
*/
|
|
964
|
+
type UserReferralStatusType = {
|
|
965
|
+
/**
|
|
966
|
+
* Whether the user was referred to this merchant by someone else.
|
|
967
|
+
*
|
|
968
|
+
* `true` means a referral link exists where this user is the referee.
|
|
969
|
+
*/
|
|
970
|
+
isReferred: boolean;
|
|
971
|
+
};
|
|
972
|
+
//#endregion
|
|
772
973
|
//#region src/types/rpc/walletStatus.d.ts
|
|
773
974
|
/**
|
|
774
975
|
* RPC Response for the method `frak_listenToWalletStatus`
|
|
@@ -815,7 +1016,7 @@ type WalletNotConnected = {
|
|
|
815
1016
|
* - Response Type: stream (emits updates when wallet status changes)
|
|
816
1017
|
*
|
|
817
1018
|
* #### frak_displayModal
|
|
818
|
-
* - Params: [requests: {@link ModalRpcStepsInput}, metadata?: {@link ModalRpcMetadata}, configMetadata: {@link FrakWalletSdkConfig}["metadata"]]
|
|
1019
|
+
* - Params: [requests: {@link ModalRpcStepsInput}, metadata?: {@link ModalRpcMetadata}, configMetadata: {@link FrakWalletSdkConfig}["metadata"], placement?: string]
|
|
819
1020
|
* - Returns: {@link ModalRpcStepsResultType}
|
|
820
1021
|
* - Response Type: promise (one-shot)
|
|
821
1022
|
*
|
|
@@ -830,9 +1031,14 @@ type WalletNotConnected = {
|
|
|
830
1031
|
* - Response Type: promise (one-shot)
|
|
831
1032
|
*
|
|
832
1033
|
* #### frak_displayEmbeddedWallet
|
|
833
|
-
* - Params: [request: {@link DisplayEmbeddedWalletParamsType}, metadata: {@link FrakWalletSdkConfig}["metadata"]]
|
|
1034
|
+
* - Params: [request: {@link DisplayEmbeddedWalletParamsType}, metadata: {@link FrakWalletSdkConfig}["metadata"], placement?: string]
|
|
834
1035
|
* - Returns: {@link DisplayEmbeddedWalletResultType}
|
|
835
1036
|
* - Response Type: promise (one-shot)
|
|
1037
|
+
*
|
|
1038
|
+
* #### frak_displaySharingPage
|
|
1039
|
+
* - Params: [request: {@link DisplaySharingPageParamsType}, configMetadata: {@link FrakWalletSdkConfig}["metadata"], placement?: string]
|
|
1040
|
+
* - Returns: {@link DisplaySharingPageResultType}
|
|
1041
|
+
* - Response Type: promise (one-shot)
|
|
836
1042
|
*/
|
|
837
1043
|
type IFrameRpcSchema = [
|
|
838
1044
|
/**
|
|
@@ -850,7 +1056,7 @@ type IFrameRpcSchema = [
|
|
|
850
1056
|
*/
|
|
851
1057
|
{
|
|
852
1058
|
Method: "frak_displayModal";
|
|
853
|
-
Parameters: [requests: ModalRpcStepsInput, metadata: ModalRpcMetadata | undefined, configMetadata: FrakWalletSdkConfig["metadata"]];
|
|
1059
|
+
Parameters: [requests: ModalRpcStepsInput, metadata: ModalRpcMetadata | undefined, configMetadata: FrakWalletSdkConfig["metadata"], placement?: string];
|
|
854
1060
|
ReturnType: ModalRpcStepsResultType;
|
|
855
1061
|
},
|
|
856
1062
|
/**
|
|
@@ -860,7 +1066,7 @@ type IFrameRpcSchema = [
|
|
|
860
1066
|
*/
|
|
861
1067
|
{
|
|
862
1068
|
Method: "frak_prepareSso";
|
|
863
|
-
Parameters: [params: PrepareSsoParamsType, name
|
|
1069
|
+
Parameters: [params: PrepareSsoParamsType, name?: string, customCss?: string];
|
|
864
1070
|
ReturnType: PrepareSsoReturnType;
|
|
865
1071
|
},
|
|
866
1072
|
/**
|
|
@@ -871,7 +1077,7 @@ type IFrameRpcSchema = [
|
|
|
871
1077
|
*/
|
|
872
1078
|
{
|
|
873
1079
|
Method: "frak_openSso";
|
|
874
|
-
Parameters: [params: OpenSsoParamsType, name
|
|
1080
|
+
Parameters: [params: OpenSsoParamsType, name?: string, customCss?: string];
|
|
875
1081
|
ReturnType: OpenSsoReturnType;
|
|
876
1082
|
},
|
|
877
1083
|
/**
|
|
@@ -892,14 +1098,14 @@ type IFrameRpcSchema = [
|
|
|
892
1098
|
*/
|
|
893
1099
|
{
|
|
894
1100
|
Method: "frak_displayEmbeddedWallet";
|
|
895
|
-
Parameters: [request: DisplayEmbeddedWalletParamsType, metadata: FrakWalletSdkConfig["metadata"]];
|
|
1101
|
+
Parameters: [request: DisplayEmbeddedWalletParamsType, metadata: FrakWalletSdkConfig["metadata"], placement?: string];
|
|
896
1102
|
ReturnType: DisplayEmbeddedWalletResultType;
|
|
897
1103
|
},
|
|
898
1104
|
/**
|
|
899
1105
|
* Method to send interactions (arrival, sharing, custom events)
|
|
900
1106
|
* Fire-and-forget method - no return value expected
|
|
901
1107
|
* merchantId is resolved from context
|
|
902
|
-
* clientId is passed via metadata as safeguard against
|
|
1108
|
+
* clientId is passed via metadata as safeguard against race conditions
|
|
903
1109
|
*/
|
|
904
1110
|
{
|
|
905
1111
|
Method: "frak_sendInteraction";
|
|
@@ -907,6 +1113,39 @@ type IFrameRpcSchema = [
|
|
|
907
1113
|
clientId?: string;
|
|
908
1114
|
}];
|
|
909
1115
|
ReturnType: undefined;
|
|
1116
|
+
},
|
|
1117
|
+
/**
|
|
1118
|
+
* Method to get the current user's referral status on this merchant.
|
|
1119
|
+
* Returns whether the user was referred (has a referral link as referee).
|
|
1120
|
+
* Returns null when the user's identity cannot be resolved.
|
|
1121
|
+
* This is a one-shot request.
|
|
1122
|
+
*/
|
|
1123
|
+
{
|
|
1124
|
+
Method: "frak_getUserReferralStatus";
|
|
1125
|
+
Parameters?: undefined;
|
|
1126
|
+
ReturnType: UserReferralStatusType | null;
|
|
1127
|
+
},
|
|
1128
|
+
/**
|
|
1129
|
+
* Method to display a sharing page with product info and sharing buttons
|
|
1130
|
+
* Resolves on first user action (share/copy) but the page stays visible
|
|
1131
|
+
* This is a one-shot request
|
|
1132
|
+
*/
|
|
1133
|
+
{
|
|
1134
|
+
Method: "frak_displaySharingPage";
|
|
1135
|
+
Parameters: [request: DisplaySharingPageParamsType, configMetadata: FrakWalletSdkConfig["metadata"], placement?: string];
|
|
1136
|
+
ReturnType: DisplaySharingPageResultType;
|
|
1137
|
+
},
|
|
1138
|
+
/**
|
|
1139
|
+
* Method to get a merge token for the current anonymous identity.
|
|
1140
|
+
* Used by in-app browser redirect flows to preserve identity
|
|
1141
|
+
* when switching from a WebView to the system browser.
|
|
1142
|
+
* Returns the merge token string, or null if unavailable.
|
|
1143
|
+
* This is a one-shot request.
|
|
1144
|
+
*/
|
|
1145
|
+
{
|
|
1146
|
+
Method: "frak_getMergeToken";
|
|
1147
|
+
Parameters?: undefined;
|
|
1148
|
+
ReturnType: string | null;
|
|
910
1149
|
}];
|
|
911
1150
|
//#endregion
|
|
912
1151
|
//#region src/types/transport.d.ts
|
|
@@ -1052,4 +1291,4 @@ declare const ssoPopupName = "frak-sso";
|
|
|
1052
1291
|
*/
|
|
1053
1292
|
declare function openSso(client: FrakClient, args: OpenSsoParamsType): Promise<OpenSsoReturnType>;
|
|
1054
1293
|
//#endregion
|
|
1055
|
-
export {
|
|
1294
|
+
export { ResolvedPlacement as $, ModalRpcMetadata as A, LoginModalStepType as B, EmbeddedViewActionReferred as C, DisplaySharingPageResultType as D, DisplaySharingPageParamsType as E, SendTransactionReturnType as F, SsoMetadata as G, OpenSsoReturnType as H, SendTransactionTxType as I, ModalStepMetadata as J, FinalActionType as K, SiweAuthenticateModalStepType as L, ModalRpcStepsResultType as M, ModalStepTypes as N, SharingPageProduct as O, SendTransactionModalStepType as P, MerchantConfigResponse as Q, SiweAuthenticateReturnType as R, LoggedOutEmbeddedView as S, LoggedInEmbeddedView as T, PrepareSsoParamsType as U, OpenSsoParamsType as V, PrepareSsoReturnType as W, IFrameLifecycleEvent as X, InteractionTypeKey as Y, ClientLifecycleEvent as Z, RewardTier as _, FrakContextV1 as a, Language as at, DisplayEmbeddedWalletParamsType as b, isV2Context as c, IFrameTransport as d, ResolvedSdkConfig as et, IFrameRpcSchema as f, GetMerchantInformationReturnType as g, EstimatedReward as h, FrakContext as i, I18nConfig as it, ModalRpcStepsInput as j, DisplayModalParamsType as k, FrakClient as l, UserReferralStatusType as m, ssoPopupFeatures as n, Currency as nt, FrakContextV2 as o, LocalizedI18nConfig as ot, WalletStatusReturnType as p, FinalModalStepType as q, ssoPopupName as r, FrakWalletSdkConfig as rt, isV1Context as s, openSso as t, SdkResolvedConfig as tt, FrakLifecycleEvent as u, TokenAmountType as v, EmbeddedViewActionSharing as w, DisplayEmbeddedWalletResultType as x, SendInteractionParamsType as y, SiweAuthenticationParams as z };
|