@frak-labs/core-sdk 0.2.1 → 1.0.0-beta.61e6fb99
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-Di4welXI.cjs +1 -0
- package/dist/actions-DyMkUe65.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-B_Uj-puh.d.ts} +249 -73
- package/dist/{computeLegacyProductId-b5cUWdAm.d.ts → index-ByVpu25D.d.cts} +249 -73
- package/dist/{siweAuthenticate-CnCZ7mok.d.ts → index-CGyEOo9J.d.cts} +122 -8
- package/dist/{siweAuthenticate-CVigMOxz.d.cts → index-Cdf5j2_W.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-B6pD2oA6.d.ts} +380 -46
- package/dist/{openSso-CMzwvaCa.d.ts → openSso-qjaccFd0.d.cts} +379 -45
- package/dist/sdkConfigStore-DvwFc6Ym.cjs +1 -0
- package/dist/sdkConfigStore-M37skmM8.js +1 -0
- package/dist/src-BqpqVHCq.cjs +13 -0
- package/dist/src-BxRYON49.js +13 -0
- package/package.json +12 -13
- 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/processReferral.test.ts +4 -8
- package/src/actions/referral/processReferral.ts +5 -11
- 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 +233 -28
- package/src/clients/transports/iframeLifecycleManager.test.ts +14 -94
- package/src/clients/transports/iframeLifecycleManager.ts +35 -53
- package/src/index.ts +25 -5
- package/src/stubs/rrweb.ts +9 -0
- package/src/types/config.ts +19 -3
- package/src/types/index.ts +15 -1
- package/src/types/lifecycle/client.ts +29 -27
- package/src/types/lifecycle/iframe.ts +7 -8
- package/src/types/resolvedConfig.ts +138 -0
- package/src/types/rpc/displaySharingPage.ts +100 -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/types/tracking.ts +36 -0
- package/src/utils/FrakContext.test.ts +151 -0
- package/src/utils/FrakContext.ts +67 -1
- package/src/utils/analytics/events/component.ts +58 -0
- package/src/utils/analytics/events/index.ts +20 -0
- package/src/utils/analytics/events/lifecycle.ts +26 -0
- package/src/utils/analytics/events/referral.ts +10 -0
- package/src/utils/analytics/index.ts +8 -0
- package/src/utils/{trackEvent.test.ts → analytics/trackEvent.test.ts} +22 -30
- package/src/utils/analytics/trackEvent.ts +34 -0
- 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 +11 -5
- package/src/utils/mergeAttribution.test.ts +153 -0
- package/src/utils/mergeAttribution.ts +75 -0
- 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/src/utils/trackEvent.ts +0 -41
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as SsoMetadata, Q as MerchantConfigResponse, U as PrepareSsoParamsType, a as FrakContextV1, at as Language, ct as AttributionParams, i as FrakContext, l as FrakClient, nt as Currency, o as FrakContextV2, rt as FrakWalletSdkConfig, st as AttributionDefaults, tt as SdkResolvedConfig, v as TokenAmountType } from "./openSso-B6pD2oA6.js";
|
|
2
|
+
import { Hex } from "viem";
|
|
2
3
|
import { RpcMessage, RpcResponse } from "@frak-labs/frame-connector";
|
|
3
|
-
import { Address, Hex } from "viem";
|
|
4
4
|
|
|
5
5
|
//#region src/types/compression.d.ts
|
|
6
6
|
/**
|
|
@@ -22,35 +22,12 @@ type HashProtectedData<DataType> = Readonly<DataType & {
|
|
|
22
22
|
*/
|
|
23
23
|
type KeyProvider<DataType> = (value: DataType) => string[];
|
|
24
24
|
//#endregion
|
|
25
|
-
//#region src/types/tracking.d.ts
|
|
26
|
-
type UtmParams = {
|
|
27
|
-
source?: string;
|
|
28
|
-
medium?: string;
|
|
29
|
-
campaign?: string;
|
|
30
|
-
term?: string;
|
|
31
|
-
content?: string;
|
|
32
|
-
};
|
|
33
|
-
type TrackArrivalParams = {
|
|
34
|
-
/** @deprecated V1 legacy — use referrerClientId for v2 contexts */referrerWallet?: Address;
|
|
35
|
-
referrerClientId?: string;
|
|
36
|
-
referrerMerchantId?: string; /** Epoch seconds timestamp from the referral link creation */
|
|
37
|
-
referralTimestamp?: number;
|
|
38
|
-
landingUrl?: string;
|
|
39
|
-
utmParams?: UtmParams;
|
|
40
|
-
};
|
|
41
|
-
type TrackArrivalResult = {
|
|
42
|
-
success: boolean;
|
|
43
|
-
identityGroupId?: string;
|
|
44
|
-
touchpointId?: string;
|
|
45
|
-
error?: string;
|
|
46
|
-
};
|
|
47
|
-
//#endregion
|
|
48
25
|
//#region src/clients/createIFrameFrakClient.d.ts
|
|
49
26
|
/**
|
|
50
27
|
* Create a new iframe Frak client
|
|
51
28
|
* @param args
|
|
52
29
|
* @param args.config - The configuration to use for the Frak Wallet SDK.
|
|
53
|
-
* When `config.domain` is set, it is
|
|
30
|
+
* When `config.domain` is set, it is used to resolve the correct merchant config in tunneled/proxied environments (e.g. Shopify dev with Cloudflare tunnel).
|
|
54
31
|
* @param args.iframe - The iframe to use for the communication
|
|
55
32
|
* @returns The created Frak Client
|
|
56
33
|
*
|
|
@@ -134,6 +111,111 @@ declare const locales: {
|
|
|
134
111
|
readonly gbp: "en-GB";
|
|
135
112
|
};
|
|
136
113
|
//#endregion
|
|
114
|
+
//#region src/utils/analytics/events/component.d.ts
|
|
115
|
+
type ButtonBaseProps = {
|
|
116
|
+
placement?: string;
|
|
117
|
+
target_interaction?: string;
|
|
118
|
+
has_reward?: boolean;
|
|
119
|
+
};
|
|
120
|
+
type BannerVariant = "referral" | "inapp";
|
|
121
|
+
type BannerOutcome = "clicked" | "dismissed";
|
|
122
|
+
type PostPurchaseVariant = "referrer" | "referee";
|
|
123
|
+
type ShareClickAction = "share-modal" | "embedded-wallet" | "sharing-page";
|
|
124
|
+
type SdkComponentEventMap = {
|
|
125
|
+
share_button_clicked: ButtonBaseProps & {
|
|
126
|
+
click_action: ShareClickAction;
|
|
127
|
+
};
|
|
128
|
+
share_modal_error: ButtonBaseProps & {
|
|
129
|
+
error?: string;
|
|
130
|
+
};
|
|
131
|
+
open_in_app_clicked: {
|
|
132
|
+
placement?: string;
|
|
133
|
+
path: string;
|
|
134
|
+
};
|
|
135
|
+
app_not_installed: {
|
|
136
|
+
placement?: string;
|
|
137
|
+
path: string;
|
|
138
|
+
};
|
|
139
|
+
banner_impression: {
|
|
140
|
+
placement?: string;
|
|
141
|
+
variant: BannerVariant;
|
|
142
|
+
has_reward?: boolean;
|
|
143
|
+
};
|
|
144
|
+
banner_resolved: {
|
|
145
|
+
placement?: string;
|
|
146
|
+
variant: BannerVariant;
|
|
147
|
+
outcome: BannerOutcome;
|
|
148
|
+
};
|
|
149
|
+
post_purchase_impression: {
|
|
150
|
+
placement?: string;
|
|
151
|
+
variant: PostPurchaseVariant;
|
|
152
|
+
has_reward?: boolean;
|
|
153
|
+
};
|
|
154
|
+
post_purchase_clicked: {
|
|
155
|
+
placement?: string;
|
|
156
|
+
variant: PostPurchaseVariant;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/utils/analytics/events/lifecycle.d.ts
|
|
161
|
+
type SdkHandshakeFailureReason = "timeout" | "origin" | "asset_push" | "unknown";
|
|
162
|
+
type SdkLifecycleEventMap = {
|
|
163
|
+
sdk_initialized: {
|
|
164
|
+
sdkVersion?: string;
|
|
165
|
+
};
|
|
166
|
+
sdk_iframe_connected: {
|
|
167
|
+
handshake_duration_ms: number;
|
|
168
|
+
};
|
|
169
|
+
sdk_iframe_handshake_failed: {
|
|
170
|
+
reason: SdkHandshakeFailureReason;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Emitted by the CDN bootstrap when `initFrakSdk()` throws before a
|
|
174
|
+
* client is available. Uses a transient OpenPanel instance so broken
|
|
175
|
+
* partner integrations are still captured.
|
|
176
|
+
*/
|
|
177
|
+
sdk_init_failed: {
|
|
178
|
+
reason: string;
|
|
179
|
+
config_missing?: boolean;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/utils/analytics/events/referral.d.ts
|
|
184
|
+
type SdkReferralEventMap = {
|
|
185
|
+
user_referred_started: {
|
|
186
|
+
referrer?: string;
|
|
187
|
+
referrerClientId?: string;
|
|
188
|
+
walletStatus?: string;
|
|
189
|
+
};
|
|
190
|
+
user_referred_completed: {
|
|
191
|
+
status: "success";
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/utils/analytics/events/index.d.ts
|
|
196
|
+
/**
|
|
197
|
+
* Merged SDK event map. Consumed by the SDK's typed `trackEvent`.
|
|
198
|
+
* Stays isolated from wallet-shared because the SDK ships in partner
|
|
199
|
+
* bundles (different OpenPanel client id, no wallet-shared dependency
|
|
200
|
+
* allowed — see `packages/wallet-shared/AGENTS.md`).
|
|
201
|
+
*/
|
|
202
|
+
type SdkEventMap = SdkLifecycleEventMap & SdkComponentEventMap & SdkReferralEventMap;
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/utils/analytics/trackEvent.d.ts
|
|
205
|
+
/**
|
|
206
|
+
* Track an analytics event via the SDK's OpenPanel instance.
|
|
207
|
+
* Fire-and-forget — silently catches errors so analytics never break a
|
|
208
|
+
* partner integration.
|
|
209
|
+
*
|
|
210
|
+
* The client must be passed explicitly because the OpenPanel instance is
|
|
211
|
+
* scoped to each `FrakClient` (a partner site may hold multiple iframes).
|
|
212
|
+
*
|
|
213
|
+
* @param client - The Frak client instance (no-op if undefined)
|
|
214
|
+
* @param event - Typed event name from the SDK event map
|
|
215
|
+
* @param properties - Typed properties for the given event
|
|
216
|
+
*/
|
|
217
|
+
declare function trackEvent<K extends keyof SdkEventMap>(client: FrakClient | undefined, event: K, properties?: SdkEventMap[K]): void;
|
|
218
|
+
//#endregion
|
|
137
219
|
//#region src/utils/backendUrl.d.ts
|
|
138
220
|
/**
|
|
139
221
|
* Get the backend URL for API calls
|
|
@@ -143,6 +225,50 @@ declare const locales: {
|
|
|
143
225
|
*/
|
|
144
226
|
declare function getBackendUrl(walletUrl?: string): string;
|
|
145
227
|
//#endregion
|
|
228
|
+
//#region src/utils/cache/withCache.d.ts
|
|
229
|
+
type WithCacheOptions = {
|
|
230
|
+
/** The key to cache the data against */cacheKey: string; /** Time in ms that cached data will remain valid. Default: 30_000 (30s). Set to 0 to disable caching. */
|
|
231
|
+
cacheTime?: number;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Returns the result of a given promise, and caches the result for
|
|
235
|
+
* subsequent invocations against a provided cache key.
|
|
236
|
+
*
|
|
237
|
+
* Also deduplicates concurrent calls — if multiple callers request the same
|
|
238
|
+
* cache key while the promise is pending, they share the same promise.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```ts
|
|
242
|
+
* // First call fetches, subsequent calls return cached data for 30s
|
|
243
|
+
* const data = await withCache(
|
|
244
|
+
* () => client.request({ method: "frak_getMerchantInformation" }),
|
|
245
|
+
* { cacheKey: "merchantInfo", cacheTime: 30_000 }
|
|
246
|
+
* );
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
declare function withCache<TData>(fn: () => Promise<TData>, {
|
|
250
|
+
cacheKey,
|
|
251
|
+
cacheTime
|
|
252
|
+
}: WithCacheOptions): Promise<TData>;
|
|
253
|
+
/**
|
|
254
|
+
* Get a cache handle for a specific key, useful for manual invalidation.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```ts
|
|
258
|
+
* // Invalidate merchant info cache after a mutation
|
|
259
|
+
* getCache("frak_getMerchantInformation").clear();
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
declare function getCache(cacheKey: string): {
|
|
263
|
+
/** Clear both the pending promise and the cached response */clear: () => void; /** Check if a non-expired response exists */
|
|
264
|
+
has: (cacheTime?: number) => boolean;
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* Clear all cached data (both pending promises and resolved responses).
|
|
268
|
+
* Called automatically when the client is destroyed.
|
|
269
|
+
*/
|
|
270
|
+
declare function clearAllCache(): void;
|
|
271
|
+
//#endregion
|
|
146
272
|
//#region src/utils/clientId.d.ts
|
|
147
273
|
/**
|
|
148
274
|
* Client ID utilities for anonymous tracking
|
|
@@ -276,17 +402,25 @@ declare function parse({
|
|
|
276
402
|
/**
|
|
277
403
|
* Add or replace the `fCtx` query parameter in a URL with the given context.
|
|
278
404
|
*
|
|
405
|
+
* Standard affiliation params (`utm_source`, `utm_medium`, `utm_campaign`,
|
|
406
|
+
* `ref`, `via`, ...) are always appended using gap-fill semantics: pre-existing
|
|
407
|
+
* params on the URL are preserved, defaults are derived from the context when
|
|
408
|
+
* applicable, and `attribution` overrides take precedence when provided.
|
|
409
|
+
*
|
|
279
410
|
* @param args
|
|
280
411
|
* @param args.url - The URL to update
|
|
281
412
|
* @param args.context - The context to embed (V1 or V2)
|
|
413
|
+
* @param args.attribution - Optional attribution overrides. Defaults are applied even when omitted.
|
|
282
414
|
* @returns The updated URL string, or null on failure
|
|
283
415
|
*/
|
|
284
416
|
declare function update({
|
|
285
417
|
url,
|
|
286
|
-
context
|
|
418
|
+
context,
|
|
419
|
+
attribution
|
|
287
420
|
}: {
|
|
288
421
|
url?: string;
|
|
289
422
|
context: FrakContextV1 | FrakContextV2;
|
|
423
|
+
attribution?: AttributionParams;
|
|
290
424
|
}): string | null;
|
|
291
425
|
/**
|
|
292
426
|
* Remove the `fCtx` query parameter from a URL.
|
|
@@ -415,47 +549,104 @@ declare function createIframe({
|
|
|
415
549
|
*/
|
|
416
550
|
declare function findIframeInOpener(pathname?: string): Window | null;
|
|
417
551
|
//#endregion
|
|
418
|
-
//#region src/utils/
|
|
552
|
+
//#region src/utils/inAppBrowser.d.ts
|
|
553
|
+
/**
|
|
554
|
+
* Whether the current device runs iOS (including iPadOS 13+).
|
|
555
|
+
*/
|
|
556
|
+
declare const isIOS: boolean;
|
|
419
557
|
/**
|
|
420
|
-
*
|
|
558
|
+
* Whether the current browser is a social media in-app browser
|
|
559
|
+
* (Instagram, Facebook).
|
|
421
560
|
*/
|
|
561
|
+
declare const isInAppBrowser: boolean;
|
|
422
562
|
/**
|
|
423
|
-
*
|
|
563
|
+
* Redirect to external browser from in-app WebView.
|
|
424
564
|
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
565
|
+
* - **iOS**: Uses `x-safari-https://` scheme — server-side 302 redirects
|
|
566
|
+
* to custom URL schemes are silently swallowed by WKWebView.
|
|
567
|
+
* Direct `window.location.href` assignment works (confirmed iOS 17+).
|
|
428
568
|
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
* // Use merchantId for tracking
|
|
434
|
-
* }
|
|
435
|
-
* ```
|
|
569
|
+
* - **Android**: Uses backend `/common/social` endpoint which returns a PDF
|
|
570
|
+
* Content-Type response, forcing the WebView to hand off to the default browser.
|
|
571
|
+
*
|
|
572
|
+
* @param targetUrl - The URL to open in the external browser
|
|
436
573
|
*/
|
|
437
|
-
declare function
|
|
574
|
+
declare function redirectToExternalBrowser(targetUrl: string): void;
|
|
575
|
+
//#endregion
|
|
576
|
+
//#region src/utils/mergeAttribution.d.ts
|
|
438
577
|
/**
|
|
439
|
-
*
|
|
440
|
-
* Useful for testing or when switching domains
|
|
578
|
+
* Inputs for {@link mergeAttribution}.
|
|
441
579
|
*/
|
|
442
|
-
|
|
580
|
+
type MergeAttributionInput = {
|
|
581
|
+
/**
|
|
582
|
+
* Per-call attribution override passed to actions like `displaySharingPage`.
|
|
583
|
+
*
|
|
584
|
+
* - `null` explicitly disables attribution (no UTM/ref/via params are added).
|
|
585
|
+
* - `undefined` means "no per-call override" — defaults apply if present.
|
|
586
|
+
* - An object (including `{}`) merges field-by-field with defaults.
|
|
587
|
+
*/
|
|
588
|
+
perCall: AttributionParams | null | undefined;
|
|
589
|
+
/**
|
|
590
|
+
* Pre-merged merchant-level defaults (backend config > SDK static config).
|
|
591
|
+
* `utm_content` is intentionally absent from this shape.
|
|
592
|
+
*/
|
|
593
|
+
defaults?: AttributionDefaults;
|
|
594
|
+
/**
|
|
595
|
+
* Per-product `utm_content` override (from the currently selected
|
|
596
|
+
* `SharingPageProduct`). Takes precedence over `perCall.utmContent`.
|
|
597
|
+
*/
|
|
598
|
+
productUtmContent?: string;
|
|
599
|
+
};
|
|
443
600
|
/**
|
|
444
|
-
*
|
|
601
|
+
* Merge the three attribution layers into a single {@link AttributionParams}
|
|
602
|
+
* value suitable for `FrakContextManager.update`.
|
|
445
603
|
*
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
604
|
+
* Priority per field:
|
|
605
|
+
* 1. `perCall` (wins)
|
|
606
|
+
* 2. `defaults` (merchant-level, backend > SDK static, already pre-merged)
|
|
607
|
+
* 3. Hardcoded fallbacks resolved later by `FrakContextManager`
|
|
608
|
+
*
|
|
609
|
+
* Special rules:
|
|
610
|
+
* - `perCall === null` returns `undefined` (explicit disable: no UTM/ref/via).
|
|
611
|
+
* - `perCall === undefined` (no opinion) yields at least `{}` so `FrakContextManager`
|
|
612
|
+
* applies its hardcoded defaults (utm_source=frak, utm_medium=referral,
|
|
613
|
+
* utm_campaign=<merchantId>, ref=<clientId>, via=frak).
|
|
614
|
+
* - `utm_content` never comes from `defaults`; only `productUtmContent` or
|
|
615
|
+
* `perCall.utmContent` can populate it.
|
|
616
|
+
*/
|
|
617
|
+
declare function mergeAttribution({
|
|
618
|
+
perCall,
|
|
619
|
+
defaults,
|
|
620
|
+
productUtmContent
|
|
621
|
+
}: MergeAttributionInput): AttributionParams | undefined;
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/utils/sdkConfigStore.d.ts
|
|
624
|
+
declare const GLOBAL_KEY = "__frakSdkConfig";
|
|
625
|
+
declare global {
|
|
626
|
+
interface Window {
|
|
627
|
+
[GLOBAL_KEY]?: SdkResolvedConfig;
|
|
628
|
+
}
|
|
629
|
+
interface WindowEventMap {
|
|
630
|
+
"frak:config": CustomEvent<SdkResolvedConfig>;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
declare function getConfig(): SdkResolvedConfig;
|
|
634
|
+
declare const sdkConfigStore: {
|
|
635
|
+
getConfig: typeof getConfig;
|
|
636
|
+
readonly isResolved: boolean;
|
|
637
|
+
readonly isCacheFresh: boolean;
|
|
638
|
+
setCacheScope(domain: string, lang?: string): void;
|
|
639
|
+
setConfig(config: SdkResolvedConfig): void;
|
|
640
|
+
reset(): void;
|
|
641
|
+
clearCache(): void;
|
|
642
|
+
resolve(domain?: string, walletUrl?: string, lang?: Language): Promise<MerchantConfigResponse | undefined>;
|
|
643
|
+
getMerchantId(): string | undefined;
|
|
644
|
+
resolveMerchantId(domain?: string, walletUrl?: string): Promise<string | undefined>;
|
|
645
|
+
};
|
|
455
646
|
//#endregion
|
|
456
647
|
//#region src/utils/sso.d.ts
|
|
457
648
|
type AppSpecificSsoMetadata = SsoMetadata & {
|
|
458
|
-
name
|
|
649
|
+
name?: string;
|
|
459
650
|
css?: string;
|
|
460
651
|
};
|
|
461
652
|
/**
|
|
@@ -489,7 +680,7 @@ type FullSsoParams = Omit<PrepareSsoParamsType, "metadata"> & {
|
|
|
489
680
|
* // Returns: https://wallet.frak.id/sso?p=<compressed_base64>
|
|
490
681
|
* ```
|
|
491
682
|
*/
|
|
492
|
-
declare function generateSsoUrl(walletUrl: string, params: PrepareSsoParamsType, merchantId: string, name: string, clientId: string, css?: string): string;
|
|
683
|
+
declare function generateSsoUrl(walletUrl: string, params: PrepareSsoParamsType, merchantId: string, name: string | undefined, clientId: string, css?: string): string;
|
|
493
684
|
/**
|
|
494
685
|
* Type of compressed the sso data
|
|
495
686
|
*/
|
|
@@ -501,28 +692,13 @@ type CompressedSsoData = {
|
|
|
501
692
|
l?: "en" | "fr";
|
|
502
693
|
m: string;
|
|
503
694
|
md: {
|
|
504
|
-
n
|
|
695
|
+
n?: string;
|
|
505
696
|
css?: string;
|
|
506
697
|
l?: string;
|
|
507
698
|
h?: string;
|
|
508
699
|
};
|
|
509
700
|
};
|
|
510
701
|
//#endregion
|
|
511
|
-
//#region src/utils/trackEvent.d.ts
|
|
512
|
-
/**
|
|
513
|
-
* Analytics event names emitted by the SDK
|
|
514
|
-
*/
|
|
515
|
-
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";
|
|
516
|
-
type EventProps = Record<string, unknown>;
|
|
517
|
-
/**
|
|
518
|
-
* Track an analytics event via OpenPanel.
|
|
519
|
-
* Fire-and-forget: silently catches errors.
|
|
520
|
-
* @param client - The Frak client instance (no-op if undefined)
|
|
521
|
-
* @param event - The event name to track
|
|
522
|
-
* @param props - Optional event properties
|
|
523
|
-
*/
|
|
524
|
-
declare function trackEvent(client: FrakClient | undefined, event: FrakEvent, props?: EventProps): void;
|
|
525
|
-
//#endregion
|
|
526
702
|
//#region src/utils/computeLegacyProductId.d.ts
|
|
527
703
|
/**
|
|
528
704
|
* Compute the legacy product id from a domain
|
|
@@ -534,4 +710,4 @@ declare function computeLegacyProductId({
|
|
|
534
710
|
domain?: string;
|
|
535
711
|
}): `0x${string}`;
|
|
536
712
|
//#endregion
|
|
537
|
-
export {
|
|
713
|
+
export { getClientId as A, setupClient as B, toAndroidIntentUrl as C, compressJsonToB64 as D, decompressJsonFromB64 as E, trackEvent as F, KeyProvider as G, createIFrameFrakClient as H, SdkEventMap as I, SdkHandshakeFailureReason as L, getCache as M, withCache as N, base64urlDecode as O, getBackendUrl as P, LocalesKey as R, isFrakDeepLink as S, DEEP_LINK_SCHEME as T, CompressedData as U, DebugInfoGatherer as V, HashProtectedData as W, getCurrencyAmountKey as _, generateSsoUrl as a, DeepLinkFallbackOptions as b, mergeAttribution as c, redirectToExternalBrowser as d, baseIframeProps as f, getSupportedCurrency as g, getSupportedLocale as h, FullSsoParams as i, clearAllCache as j, base64urlEncode as k, isIOS as l, findIframeInOpener as m, AppSpecificSsoMetadata as n, sdkConfigStore as o, createIframe as p, CompressedSsoData as r, MergeAttributionInput as s, computeLegacyProductId as t, isInAppBrowser as u, formatAmount as v, triggerDeepLinkWithFallback as w, isChromiumAndroid as x, FrakContextManager as y, locales as z };
|