@frak-labs/core-sdk 0.1.0-beta.afa252b0 → 0.1.0-beta.b0bd1f8a

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.
Files changed (139) hide show
  1. package/cdn/bundle.iife.js +14 -0
  2. package/dist/actions-CEEObPYc.js +1 -0
  3. package/dist/actions-DbQhWYx8.cjs +1 -0
  4. package/dist/actions.cjs +1 -1
  5. package/dist/actions.d.cts +3 -1481
  6. package/dist/actions.d.ts +3 -1481
  7. package/dist/actions.js +1 -1
  8. package/dist/bundle.cjs +1 -13
  9. package/dist/bundle.d.cts +6 -2087
  10. package/dist/bundle.d.ts +6 -2087
  11. package/dist/bundle.js +1 -13
  12. package/dist/index-7OZ39x1U.d.ts +195 -0
  13. package/dist/index-C6FxkWPC.d.cts +511 -0
  14. package/dist/index-UFX7xCg3.d.ts +351 -0
  15. package/dist/index-d8xS4ryI.d.ts +511 -0
  16. package/dist/index-p4FqSp8z.d.cts +351 -0
  17. package/dist/index-zDq-VlKx.d.cts +195 -0
  18. package/dist/index.cjs +1 -13
  19. package/dist/index.d.cts +4 -1387
  20. package/dist/index.d.ts +4 -1387
  21. package/dist/index.js +1 -13
  22. package/dist/interaction-DMJ3ZfaF.d.cts +45 -0
  23. package/dist/interaction-KX1h9a7V.d.ts +45 -0
  24. package/dist/interactions-DnfM3oe0.js +1 -0
  25. package/dist/interactions-EIXhNLf6.cjs +1 -0
  26. package/dist/interactions.cjs +1 -1
  27. package/dist/interactions.d.cts +2 -182
  28. package/dist/interactions.d.ts +2 -182
  29. package/dist/interactions.js +1 -1
  30. package/dist/openSso-D--Airj6.d.cts +1018 -0
  31. package/dist/openSso-DsKJ4y0j.d.ts +1018 -0
  32. package/dist/productTypes-BUkXJKZ7.cjs +1 -0
  33. package/dist/productTypes-CGb1MmBF.js +1 -0
  34. package/dist/src-B_xO0AR6.cjs +13 -0
  35. package/dist/src-D2d52OZa.js +13 -0
  36. package/dist/trackEvent-CHnYa85W.js +1 -0
  37. package/dist/trackEvent-GuQm_1Nm.cjs +1 -0
  38. package/package.json +23 -18
  39. package/src/actions/displayEmbeddedWallet.test.ts +194 -0
  40. package/src/actions/displayEmbeddedWallet.ts +20 -0
  41. package/src/actions/displayModal.test.ts +387 -0
  42. package/src/actions/displayModal.ts +131 -0
  43. package/src/actions/getProductInformation.test.ts +133 -0
  44. package/src/actions/getProductInformation.ts +14 -0
  45. package/src/actions/index.ts +29 -0
  46. package/src/actions/openSso.test.ts +407 -0
  47. package/src/actions/openSso.ts +116 -0
  48. package/src/actions/prepareSso.test.ts +223 -0
  49. package/src/actions/prepareSso.ts +48 -0
  50. package/src/actions/referral/processReferral.ts +230 -0
  51. package/src/actions/referral/referralInteraction.ts +57 -0
  52. package/src/actions/sendInteraction.test.ts +219 -0
  53. package/src/actions/sendInteraction.ts +32 -0
  54. package/src/actions/trackPurchaseStatus.test.ts +287 -0
  55. package/src/actions/trackPurchaseStatus.ts +53 -0
  56. package/src/actions/watchWalletStatus.test.ts +372 -0
  57. package/src/actions/watchWalletStatus.ts +94 -0
  58. package/src/actions/wrapper/modalBuilder.ts +212 -0
  59. package/src/actions/wrapper/sendTransaction.ts +62 -0
  60. package/src/actions/wrapper/siweAuthenticate.ts +94 -0
  61. package/src/bundle.ts +3 -0
  62. package/src/clients/DebugInfo.ts +182 -0
  63. package/src/clients/createIFrameFrakClient.ts +287 -0
  64. package/src/clients/index.ts +3 -0
  65. package/src/clients/setupClient.test.ts +343 -0
  66. package/src/clients/setupClient.ts +73 -0
  67. package/src/clients/transports/iframeLifecycleManager.test.ts +399 -0
  68. package/src/clients/transports/iframeLifecycleManager.ts +90 -0
  69. package/src/constants/interactionTypes.ts +44 -0
  70. package/src/constants/locales.ts +14 -0
  71. package/src/constants/productTypes.ts +33 -0
  72. package/src/index.ts +101 -0
  73. package/src/interactions/index.ts +5 -0
  74. package/src/interactions/pressEncoder.test.ts +215 -0
  75. package/src/interactions/pressEncoder.ts +53 -0
  76. package/src/interactions/purchaseEncoder.test.ts +291 -0
  77. package/src/interactions/purchaseEncoder.ts +99 -0
  78. package/src/interactions/referralEncoder.test.ts +170 -0
  79. package/src/interactions/referralEncoder.ts +47 -0
  80. package/src/interactions/retailEncoder.test.ts +107 -0
  81. package/src/interactions/retailEncoder.ts +37 -0
  82. package/src/interactions/webshopEncoder.test.ts +56 -0
  83. package/src/interactions/webshopEncoder.ts +30 -0
  84. package/src/types/client.ts +14 -0
  85. package/src/types/compression.ts +22 -0
  86. package/src/types/config.ts +111 -0
  87. package/src/types/context.ts +13 -0
  88. package/src/types/index.ts +71 -0
  89. package/src/types/lifecycle/client.ts +46 -0
  90. package/src/types/lifecycle/iframe.ts +35 -0
  91. package/src/types/lifecycle/index.ts +2 -0
  92. package/src/types/rpc/displayModal.ts +84 -0
  93. package/src/types/rpc/embedded/index.ts +68 -0
  94. package/src/types/rpc/embedded/loggedIn.ts +55 -0
  95. package/src/types/rpc/embedded/loggedOut.ts +28 -0
  96. package/src/types/rpc/interaction.ts +43 -0
  97. package/src/types/rpc/modal/final.ts +46 -0
  98. package/src/types/rpc/modal/generic.ts +46 -0
  99. package/src/types/rpc/modal/index.ts +20 -0
  100. package/src/types/rpc/modal/login.ts +32 -0
  101. package/src/types/rpc/modal/openSession.ts +25 -0
  102. package/src/types/rpc/modal/siweAuthenticate.ts +37 -0
  103. package/src/types/rpc/modal/transaction.ts +33 -0
  104. package/src/types/rpc/productInformation.ts +59 -0
  105. package/src/types/rpc/sso.ts +80 -0
  106. package/src/types/rpc/walletStatus.ts +35 -0
  107. package/src/types/rpc.ts +158 -0
  108. package/src/types/transport.ts +34 -0
  109. package/src/utils/FrakContext.test.ts +407 -0
  110. package/src/utils/FrakContext.ts +158 -0
  111. package/src/utils/compression/b64.test.ts +181 -0
  112. package/src/utils/compression/b64.ts +29 -0
  113. package/src/utils/compression/compress.test.ts +123 -0
  114. package/src/utils/compression/compress.ts +11 -0
  115. package/src/utils/compression/decompress.test.ts +145 -0
  116. package/src/utils/compression/decompress.ts +11 -0
  117. package/src/utils/compression/index.ts +3 -0
  118. package/src/utils/computeProductId.test.ts +80 -0
  119. package/src/utils/computeProductId.ts +11 -0
  120. package/src/utils/constants.test.ts +23 -0
  121. package/src/utils/constants.ts +4 -0
  122. package/src/utils/formatAmount.test.ts +113 -0
  123. package/src/utils/formatAmount.ts +18 -0
  124. package/src/utils/getCurrencyAmountKey.test.ts +44 -0
  125. package/src/utils/getCurrencyAmountKey.ts +15 -0
  126. package/src/utils/getSupportedCurrency.test.ts +51 -0
  127. package/src/utils/getSupportedCurrency.ts +14 -0
  128. package/src/utils/getSupportedLocale.test.ts +64 -0
  129. package/src/utils/getSupportedLocale.ts +16 -0
  130. package/src/utils/iframeHelper.test.ts +450 -0
  131. package/src/utils/iframeHelper.ts +143 -0
  132. package/src/utils/index.ts +21 -0
  133. package/src/utils/sso.test.ts +361 -0
  134. package/src/utils/sso.ts +119 -0
  135. package/src/utils/ssoUrlListener.ts +60 -0
  136. package/src/utils/trackEvent.test.ts +162 -0
  137. package/src/utils/trackEvent.ts +26 -0
  138. package/cdn/bundle.js +0 -19
  139. package/cdn/bundle.js.LICENSE.txt +0 -10
@@ -0,0 +1,351 @@
1
+ import { J as Currency, L as PrepareSsoParamsType, Y as FrakWalletSdkConfig, a as FrakClient, d as TokenAmountType, i as FrakContext, z as SsoMetadata } from "./openSso-D--Airj6.cjs";
2
+ import { RpcMessage, RpcResponse } from "@frak-labs/frame-connector";
3
+ import { Hex } from "viem";
4
+
5
+ //#region src/types/compression.d.ts
6
+ /**
7
+ * The received encoded data from a client
8
+ * -> The encoded should contain a HashProtectedData once decoded
9
+ * @ignore
10
+ */
11
+ type CompressedData = Uint8Array;
12
+ /**
13
+ * The encoded data to send to a client / received by a client
14
+ * @ignore
15
+ */
16
+ type HashProtectedData<DataType> = Readonly<DataType & {
17
+ validationHash: string;
18
+ }>;
19
+ /**
20
+ * Represent a key provider used for the hashed and secure compression
21
+ * @ignore
22
+ */
23
+ type KeyProvider<DataType> = (value: DataType) => string[];
24
+ //#endregion
25
+ //#region src/clients/createIFrameFrakClient.d.ts
26
+ /**
27
+ * Create a new iframe Frak client
28
+ * @param args
29
+ * @param args.config - The configuration to use for the Frak Wallet SDK
30
+ * @param args.iframe - The iframe to use for the communication
31
+ * @returns The created Frak Client
32
+ *
33
+ * @example
34
+ * const frakConfig: FrakWalletSdkConfig = {
35
+ * metadata: {
36
+ * name: "My app title",
37
+ * },
38
+ * }
39
+ * const iframe = await createIframe({ config: frakConfig });
40
+ * const client = createIFrameFrakClient({ config: frakConfig, iframe });
41
+ */
42
+ declare function createIFrameFrakClient({
43
+ config,
44
+ iframe
45
+ }: {
46
+ config: FrakWalletSdkConfig;
47
+ iframe: HTMLIFrameElement;
48
+ }): FrakClient;
49
+ //#endregion
50
+ //#region src/clients/DebugInfo.d.ts
51
+ /** @ignore */
52
+ declare class DebugInfoGatherer {
53
+ private config?;
54
+ private iframe?;
55
+ private isSetupDone;
56
+ private lastResponse;
57
+ private lastRequest;
58
+ constructor(config?: FrakWalletSdkConfig, iframe?: HTMLIFrameElement);
59
+ setLastResponse(message: RpcMessage, response: RpcResponse): void;
60
+ setLastRequest(event: RpcMessage): void;
61
+ updateSetupStatus(status: boolean): void;
62
+ private base64Encode;
63
+ /**
64
+ * Extract information from the iframe status
65
+ */
66
+ private getIframeStatus;
67
+ private getNavigatorInfo;
68
+ private gatherDebugInfo;
69
+ static empty(): DebugInfoGatherer;
70
+ /**
71
+ * Format Frak debug information
72
+ */
73
+ formatDebugInfo(error: Error | unknown | string): string;
74
+ }
75
+ //#endregion
76
+ //#region src/clients/setupClient.d.ts
77
+ /**
78
+ * Directly setup the Frak client with an iframe
79
+ * Return when the FrakClient is ready (setup and communication estbalished with the wallet)
80
+ *
81
+ * @param config - The configuration to use for the Frak Wallet SDK
82
+ * @returns a Promise with the Frak Client
83
+ *
84
+ * @example
85
+ * const frakConfig: FrakWalletSdkConfig = {
86
+ * metadata: {
87
+ * name: "My app title",
88
+ * },
89
+ * }
90
+ * const client = await setupClient({ config: frakConfig });
91
+ */
92
+ declare function setupClient({
93
+ config
94
+ }: {
95
+ config: FrakWalletSdkConfig;
96
+ }): Promise<FrakClient | undefined>;
97
+ //#endregion
98
+ //#region src/constants/locales.d.ts
99
+ /**
100
+ * The keys for each locales
101
+ * @inline
102
+ */
103
+ type LocalesKey = keyof typeof locales;
104
+ /**
105
+ * Map the currency to the locale
106
+ */
107
+ declare const locales: {
108
+ readonly eur: "fr-FR";
109
+ readonly usd: "en-US";
110
+ readonly gbp: "en-GB";
111
+ };
112
+ //#endregion
113
+ //#region src/utils/compression/b64.d.ts
114
+ /**
115
+ * Encode a buffer to a base64url encoded string
116
+ * @param buffer The buffer to encode
117
+ * @returns The encoded string
118
+ */
119
+ declare function base64urlEncode(buffer: Uint8Array): string;
120
+ /**
121
+ * Decode a base64url encoded string
122
+ * @param value The value to decode
123
+ * @returns The decoded value
124
+ */
125
+ declare function base64urlDecode(value: string): Uint8Array;
126
+ //#endregion
127
+ //#region src/utils/compression/compress.d.ts
128
+ /**
129
+ * Compress json data
130
+ * @param data
131
+ * @ignore
132
+ */
133
+ declare function compressJsonToB64(data: unknown): string;
134
+ //#endregion
135
+ //#region src/utils/compression/decompress.d.ts
136
+ /**
137
+ * Decompress json data
138
+ * @param data
139
+ * @ignore
140
+ */
141
+ declare function decompressJsonFromB64<T>(data: string): T | null;
142
+ //#endregion
143
+ //#region src/utils/FrakContext.d.ts
144
+ /**
145
+ * Compress the current Frak context
146
+ * @param context - The context to be compressed
147
+ * @returns A compressed string containing the Frak context
148
+ */
149
+ declare function compress(context?: Partial<FrakContext>): string | undefined;
150
+ /**
151
+ * Decompress the given Frak context
152
+ * @param context - The raw context to be decompressed into a `FrakContext`
153
+ * @returns The decompressed Frak context, or undefined if it fails
154
+ */
155
+ declare function decompress(context?: string): FrakContext | undefined;
156
+ /**
157
+ * Parse the current URL into a Frak Context
158
+ * @param args
159
+ * @param args.url - The url to parse
160
+ * @returns The parsed Frak context
161
+ */
162
+ declare function parse({
163
+ url
164
+ }: {
165
+ url: string;
166
+ }): FrakContext | null | undefined;
167
+ /**
168
+ * Populate the current url with the given Frak context
169
+ * @param args
170
+ * @param args.url - The url to update
171
+ * @param args.context - The context to update
172
+ * @returns The new url with the Frak context
173
+ */
174
+ declare function update({
175
+ url,
176
+ context
177
+ }: {
178
+ url?: string;
179
+ context: Partial<FrakContext>;
180
+ }): string | null;
181
+ /**
182
+ * Remove Frak context from current url
183
+ * @param url - The url to update
184
+ * @returns The new url without the Frak context
185
+ */
186
+ declare function remove(url: string): string;
187
+ /**
188
+ * Replace the current url with the given Frak context
189
+ * @param args
190
+ * @param args.url - The url to update
191
+ * @param args.context - The context to update
192
+ */
193
+ declare function replaceUrl({
194
+ url: baseUrl,
195
+ context
196
+ }: {
197
+ url?: string;
198
+ context: Partial<FrakContext> | null;
199
+ }): void;
200
+ /**
201
+ * Export our frak context
202
+ */
203
+ declare const FrakContextManager: {
204
+ compress: typeof compress;
205
+ decompress: typeof decompress;
206
+ parse: typeof parse;
207
+ update: typeof update;
208
+ remove: typeof remove;
209
+ replaceUrl: typeof replaceUrl;
210
+ };
211
+ //#endregion
212
+ //#region src/utils/formatAmount.d.ts
213
+ declare function formatAmount(amount: number, currency?: Currency): string;
214
+ //#endregion
215
+ //#region src/utils/getCurrencyAmountKey.d.ts
216
+ /**
217
+ * Get the currency amount key for a given currency
218
+ * @param currency - The currency to use
219
+ * @returns The currency amount key
220
+ */
221
+ declare function getCurrencyAmountKey(currency?: Currency): keyof TokenAmountType;
222
+ //#endregion
223
+ //#region src/utils/getSupportedCurrency.d.ts
224
+ /**
225
+ * Get the supported currency for a given currency
226
+ * @param currency - The currency to use
227
+ * @returns The supported currency
228
+ */
229
+ declare function getSupportedCurrency(currency?: Currency): Currency;
230
+ //#endregion
231
+ //#region src/utils/getSupportedLocale.d.ts
232
+ /**
233
+ * Get the supported locale for a given currency
234
+ * @param currency - The currency to use
235
+ * @returns The supported locale
236
+ */
237
+ declare function getSupportedLocale(currency?: Currency): (typeof locales)[LocalesKey];
238
+ //#endregion
239
+ //#region src/utils/iframeHelper.d.ts
240
+ /**
241
+ * Base props for the iframe
242
+ * @ignore
243
+ */
244
+ declare const baseIframeProps: {
245
+ id: string;
246
+ name: string;
247
+ title: string;
248
+ allow: string;
249
+ style: {
250
+ width: string;
251
+ height: string;
252
+ border: string;
253
+ position: string;
254
+ zIndex: number;
255
+ top: string;
256
+ left: string;
257
+ colorScheme: string;
258
+ };
259
+ };
260
+ /**
261
+ * Create the Frak iframe
262
+ * @param args
263
+ * @param args.walletBaseUrl - Use `config.walletUrl` instead. Will be removed in future versions.
264
+ * @param args.config - The configuration object containing iframe options, including the replacement for `walletBaseUrl`.
265
+ */
266
+ declare function createIframe({
267
+ walletBaseUrl,
268
+ config
269
+ }: {
270
+ walletBaseUrl?: string;
271
+ config?: FrakWalletSdkConfig;
272
+ }): Promise<HTMLIFrameElement | undefined>;
273
+ /**
274
+ * Find an iframe within window.opener by pathname
275
+ *
276
+ * When a popup is opened via window.open from an iframe, window.opener points to
277
+ * the parent window, not the iframe itself. This utility searches through all frames
278
+ * in window.opener to find an iframe matching the specified pathname.
279
+ *
280
+ * @param pathname - The pathname to search for (default: "/listener")
281
+ * @returns The matching iframe window, or null if not found
282
+ *
283
+ * @example
284
+ * ```typescript
285
+ * // Find the default /listener iframe
286
+ * const listenerIframe = findIframeInOpener();
287
+ *
288
+ * // Find a custom iframe
289
+ * const customIframe = findIframeInOpener("/my-custom-iframe");
290
+ * ```
291
+ */
292
+ declare function findIframeInOpener(pathname?: string): Window | null;
293
+ //#endregion
294
+ //#region src/utils/sso.d.ts
295
+ type AppSpecificSsoMetadata = SsoMetadata & {
296
+ name: string;
297
+ css?: string;
298
+ };
299
+ /**
300
+ * The full SSO params that will be used for compression
301
+ */
302
+ type FullSsoParams = Omit<PrepareSsoParamsType, "metadata"> & {
303
+ metadata: AppSpecificSsoMetadata;
304
+ productId: Hex;
305
+ };
306
+ /**
307
+ * Generate SSO URL with compressed parameters
308
+ * This mirrors the wallet's getOpenSsoLink() function
309
+ *
310
+ * @param walletUrl - Base wallet URL (e.g., "https://wallet.frak.id")
311
+ * @param params - SSO parameters
312
+ * @param productId - Product identifier
313
+ * @param name - Application name
314
+ * @param css - Optional custom CSS
315
+ * @returns Complete SSO URL ready to open in popup or redirect
316
+ *
317
+ * @example
318
+ * ```ts
319
+ * const ssoUrl = generateSsoUrl(
320
+ * "https://wallet.frak.id",
321
+ * { metadata: { logoUrl: "..." }, directExit: true },
322
+ * "0x123...",
323
+ * "My App"
324
+ * );
325
+ * // Returns: https://wallet.frak.id/sso?p=<compressed_base64>
326
+ * ```
327
+ */
328
+ declare function generateSsoUrl(walletUrl: string, params: PrepareSsoParamsType, productId: Hex, name: string, css?: string): string;
329
+ /**
330
+ * Type of compressed the sso data
331
+ */
332
+ type CompressedSsoData = {
333
+ id?: Hex;
334
+ r?: string;
335
+ d?: boolean;
336
+ l?: "en" | "fr";
337
+ p: Hex;
338
+ m: {
339
+ n: string;
340
+ css?: string;
341
+ l?: string;
342
+ h?: string;
343
+ };
344
+ };
345
+ //#endregion
346
+ //#region src/utils/trackEvent.d.ts
347
+ type FrakEvent = "share_button_clicked" | "wallet_button_clicked" | "share_modal_error" | "user_referred";
348
+ type EventProps = Record<string, unknown>;
349
+ declare function trackEvent(client: FrakClient | undefined, event: FrakEvent, props?: EventProps): void;
350
+ //#endregion
351
+ export { CompressedData as C, createIFrameFrakClient as S, KeyProvider as T, base64urlEncode as _, generateSsoUrl as a, setupClient as b, findIframeInOpener as c, getCurrencyAmountKey as d, formatAmount as f, base64urlDecode as g, compressJsonToB64 as h, FullSsoParams as i, getSupportedLocale as l, decompressJsonFromB64 as m, AppSpecificSsoMetadata as n, baseIframeProps as o, FrakContextManager as p, CompressedSsoData as r, createIframe as s, trackEvent as t, getSupportedCurrency as u, LocalesKey as v, HashProtectedData as w, DebugInfoGatherer as x, locales as y };
@@ -0,0 +1,195 @@
1
+ import { t as PreparedInteraction } from "./interaction-DMJ3ZfaF.cjs";
2
+ import { Address, Hex } from "viem";
3
+
4
+ //#region src/interactions/pressEncoder.d.ts
5
+
6
+ /**
7
+ * Press interactions allow you to track user engagement with articles or other press content on your platform.
8
+ * After setting up these interactions, you can create acquisition campaign based on the user engagement with your press content.
9
+ *
10
+ * :::info
11
+ * To properly handle press interactions, ensure that the "Press" product type is enabled in your Business dashboard.
12
+ * :::
13
+ *
14
+ * @description Encode press related user interactions
15
+ *
16
+ * @group Interactions Encoder
17
+ *
18
+ * @see {@link PreparedInteraction} The prepared interaction object that can be sent
19
+ * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
20
+ */
21
+ declare const PressInteractionEncoder: {
22
+ /**
23
+ * Encode an open article interaction
24
+ * @param args
25
+ * @param args.articleId - The id of the article the user opened (32 bytes), could be a `keccak256` hash of the article slug, or your internal id
26
+ */
27
+ openArticle({
28
+ articleId
29
+ }: {
30
+ articleId: Hex;
31
+ }): PreparedInteraction;
32
+ /**
33
+ * Encode a read article interaction
34
+ * @param args
35
+ * @param args.articleId - The id of the article the user opened (32 bytes), could be a `keccak256` hash of the article slug, or your internal id
36
+ */
37
+ readArticle({
38
+ articleId
39
+ }: {
40
+ articleId: Hex;
41
+ }): PreparedInteraction;
42
+ };
43
+ //#endregion
44
+ //#region src/interactions/purchaseEncoder.d.ts
45
+ /**
46
+ * Purchase interactions allow you to track user purchases on your platform.
47
+ * After setting up these interactions, you can create acquisition campaign based on the user purchase (starting a new one, completed, or even purchase dropped).
48
+ *
49
+ * :::info
50
+ * To properly handle purchase interactions, ensure that the "Purchase" product type is enabled in your Business dashboard, and that you have set up everything correctly in the `Purchasetracker` section.
51
+ * :::
52
+ *
53
+ * :::note
54
+ * The `purchaseId` is used on both interactions. It can be computed like this:
55
+ *
56
+ * ```ts
57
+ * const purchaseId = keccak256(concatHex([productId, toHex(externalPurchaseId)]));
58
+ * ```
59
+ *
60
+ * With:
61
+ * - `productId`: The id of your product, you can find it in the product dashboard.
62
+ * - `externalPurchaseId`: The id of the purchase in your system (e.g. the shopify `order_id`).
63
+ * :::
64
+ *
65
+ * @description Encode purchase related user interactions
66
+ *
67
+ * @group Interactions Encoder
68
+ *
69
+ * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
70
+ * @see {@link PreparedInteraction} The prepared interaction object that can be sent
71
+ * @see {@link !actions.trackPurchaseStatus | `trackPurchaseStatus()`} Action that will automatically send the purchase upon completion
72
+ * @see [Purchase Webhooks](/wallet-sdk/references-api/webhook) Webhooks to be implemented on your side to confirm a purchase
73
+ * @see [Purchase Proof](/wallet-sdk/references-api/purchaseProof) Get a merklee proof for the purchase
74
+ */
75
+ declare const PurchaseInteractionEncoder: {
76
+ /**
77
+ * Encode a start purchase interaction
78
+ * @param args
79
+ * @param args.purchaseId - The id of the purchase that is being started.
80
+ */
81
+ startPurchase({
82
+ purchaseId
83
+ }: {
84
+ purchaseId: Hex;
85
+ }): PreparedInteraction;
86
+ /**
87
+ * Encode a complete purchase interaction
88
+ * @param args
89
+ * @param args.purchaseId - The id of the purchase that is being completed.
90
+ * @param args.proof - The merkle proof that the user has completed the purchase (see [Purchase Webhooks](/wallet-sdk/references-api/webhook) for more details).
91
+ */
92
+ completedPurchase({
93
+ purchaseId,
94
+ proof
95
+ }: {
96
+ purchaseId: Hex;
97
+ proof: Hex[];
98
+ }): PreparedInteraction;
99
+ /**
100
+ * Encode an unsafe complete purchase interaction (when we can't provide the proof)
101
+ * @param args
102
+ * @param args.purchaseId - The id of the purchase that is being completed.
103
+ */
104
+ unsafeCompletedPurchase({
105
+ purchaseId
106
+ }: {
107
+ purchaseId: Hex;
108
+ }): PreparedInteraction;
109
+ };
110
+ //#endregion
111
+ //#region src/interactions/referralEncoder.d.ts
112
+ /**
113
+ * Referral interactions allow you to track user sharing activities.
114
+ * These interactions are essential for platforms looking to grow their user base through user-to-user referrals and reward systems.
115
+ *
116
+ * :::info
117
+ * To properly handle referral interactions, ensure that the "Referral" product type is enabled in your Business dashboard.
118
+ * :::
119
+ *
120
+ * @description Encode referral related user interactions
121
+ *
122
+ * @group Interactions Encoder
123
+ *
124
+ * @see {@link PreparedInteraction} The prepared interaction object that can be sent
125
+ * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
126
+ */
127
+ declare const ReferralInteractionEncoder: {
128
+ /**
129
+ * Records the event of a user creating a referral link. Note that this interaction doesn't actually create the link itself; it only sends an event to track that a link was created.
130
+ */
131
+ createLink(): PreparedInteraction;
132
+ /**
133
+ * Encode a referred interaction
134
+ * @param args
135
+ * @param args.referrer - The Ethereum address of the user who made the referral
136
+ */
137
+ referred({
138
+ referrer
139
+ }: {
140
+ referrer: Address;
141
+ }): PreparedInteraction;
142
+ };
143
+ //#endregion
144
+ //#region src/interactions/retailEncoder.d.ts
145
+ /**
146
+ * Retail interactions allow you to track user activities on your retails products.
147
+ *
148
+ * :::info
149
+ * To properly handle retail interactions, ensure that the "Retail" product type is enabled in your Business dashboard.
150
+ * :::
151
+ *
152
+ * @description Encode retail related user interactions
153
+ *
154
+ * @group Interactions Encoder
155
+ *
156
+ * @see {@link PreparedInteraction} The prepared interaction object that can be sent
157
+ * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
158
+ */
159
+ declare const RetailInteractionEncoder: {
160
+ /**
161
+ * Encode a customer meeting retail interaction
162
+ * @param args
163
+ * @param args.agencyId - The id of the agency that the customer is meeting with
164
+ *
165
+ */
166
+ customerMeeting({
167
+ agencyId
168
+ }: {
169
+ agencyId: Hex;
170
+ }): PreparedInteraction;
171
+ };
172
+ //#endregion
173
+ //#region src/interactions/webshopEncoder.d.ts
174
+ /**
175
+ * Webshop interactions allow you to track user activities on your webshop.
176
+ *
177
+ * :::info
178
+ * To properly handle webshop interactions, ensure that the "WebShop" product type is enabled in your Business dashboard.
179
+ * :::
180
+ *
181
+ * @description Encode webshop related user interactions
182
+ *
183
+ * @group Interactions Encoder
184
+ *
185
+ * @see {@link PreparedInteraction} The prepared interaction object that can be sent
186
+ * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
187
+ */
188
+ declare const WebShopInteractionEncoder: {
189
+ /**
190
+ * Encode an open webshop interaction
191
+ */
192
+ open(): PreparedInteraction;
193
+ };
194
+ //#endregion
195
+ export { PressInteractionEncoder as a, PurchaseInteractionEncoder as i, RetailInteractionEncoder as n, ReferralInteractionEncoder as r, WebShopInteractionEncoder as t };
package/dist/index.cjs CHANGED
@@ -1,13 +1 @@
1
- "use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{decompressJsonFromB64:()=>decompressJsonFromB64,productTypesMask:()=>productTypesMask,findIframeInOpener:()=>findIframeInOpener,createIFrameFrakClient:()=>createIFrameFrakClient,generateSsoUrl:()=>sso_generateSsoUrl,getCurrencyAmountKey:()=>getCurrencyAmountKey,getSupportedCurrency:()=>getSupportedCurrency,interactionTypes:()=>interactionTypes,FrakContextManager:()=>FrakContextManager,formatAmount:()=>formatAmount,getSupportedLocale:()=>getSupportedLocale,trackEvent:()=>trackEvent,compressJsonToB64:()=>compressJsonToB64,base64urlDecode:()=>base64urlDecode,baseIframeProps:()=>baseIframeProps,DebugInfoGatherer:()=>DebugInfoGatherer,base64urlEncode:()=>base64urlEncode,ssoPopupFeatures:()=>ssoPopupFeatures,productTypes:()=>productTypes,setupClient:()=>setupClient,createIframe:()=>createIframe,ssoPopupName:()=>ssoPopupName,locales:()=>locales});let frame_connector_namespaceObject=require("@frak-labs/frame-connector"),middleware_namespaceObject=require("@frak-labs/frame-connector/middleware"),web_namespaceObject=require("@openpanel/web"),BACKUP_KEY="nexus-wallet-backup";function setupSsoUrlListener(e,t){if("undefined"==typeof window)return;let r=new URL(window.location.href),o=r.searchParams.get("sso");o&&(t.then(()=>{e.sendLifecycle({clientLifecycle:"sso-redirect-complete",data:{compressed:o}}),console.log("[SSO URL Listener] Forwarded compressed SSO data to iframe")}).catch(e=>{console.error("[SSO URL Listener] Failed to forward SSO data:",e)}),r.searchParams.delete("sso"),window.history.replaceState({},"",r.toString()),console.log("[SSO URL Listener] SSO parameter detected and URL cleaned"))}class DebugInfoGatherer{config;iframe;isSetupDone=!1;lastResponse=null;lastRequest=null;constructor(e,t){this.config=e,this.iframe=t,this.lastRequest=null,this.lastResponse=null}setLastResponse(e,t){this.lastResponse={message:e,response:t,timestamp:Date.now()}}setLastRequest(e){this.lastRequest={event:e,timestamp:Date.now()}}updateSetupStatus(e){this.isSetupDone=e}base64Encode(e){try{return btoa(JSON.stringify(e))}catch(e){return console.warn("Failed to encode debug data",e),btoa("Failed to encode data")}}getIframeStatus(){return this.iframe?{loading:this.iframe.hasAttribute("loading"),url:this.iframe.src,readyState:this.iframe.contentDocument?.readyState?+("complete"===this.iframe.contentDocument.readyState):-1,contentWindow:!!this.iframe.contentWindow,isConnected:this.iframe.isConnected}:null}getNavigatorInfo(){return navigator?{userAgent:navigator.userAgent,language:navigator.language,onLine:navigator.onLine,screenWidth:window.screen.width,screenHeight:window.screen.height,pixelRatio:window.devicePixelRatio}:null}gatherDebugInfo(e){let t=this.getIframeStatus(),r=this.getNavigatorInfo(),o="Unknown";return e instanceof frame_connector_namespaceObject.FrakRpcError?o=`FrakRpcError: ${e.code} '${e.message}'`:e instanceof Error?o=e.message:"string"==typeof e&&(o=e),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):"no-config",navigatorInfo:r?this.base64Encode(r):"no-navigator",iframeStatus:t?this.base64Encode(t):"not-iframe",lastRequest:this.lastRequest?this.base64Encode(this.lastRequest):"No Frak request logged",lastResponse:this.lastResponse?this.base64Encode(this.lastResponse):"No Frak response logged",clientStatus:this.isSetupDone?"setup":"not-setup",error:o}}static empty(){return new DebugInfoGatherer}formatDebugInfo(e){let t=this.gatherDebugInfo(e);return`
2
- Debug Information:
3
- -----------------
4
- Timestamp: ${t.timestamp}
5
- URL: ${t.encodedUrl}
6
- Config: ${t.encodedConfig}
7
- Navigator Info: ${t.navigatorInfo}
8
- IFrame Status: ${t.iframeStatus}
9
- Last Request: ${t.lastRequest}
10
- Last Response: ${t.lastResponse}
11
- Client Status: ${t.clientStatus}
12
- Error: ${t.error}
13
- `.trim()}}let baseIframeProps={id:"frak-wallet",name:"frak-wallet",title:"Frak Wallet",allow:"publickey-credentials-get *; clipboard-write; web-share *",style:{width:"0",height:"0",border:"0",position:"absolute",zIndex:2000001,top:"-1000px",left:"-1000px",colorScheme:"auto"}};function createIframe({walletBaseUrl:e,config:t}){let r=document.querySelector("#frak-wallet");r&&r.remove();let o=document.createElement("iframe");return o.id=baseIframeProps.id,o.name=baseIframeProps.name,o.allow=baseIframeProps.allow,o.style.zIndex=baseIframeProps.style.zIndex.toString(),changeIframeVisibility({iframe:o,isVisible:!1}),document.body.appendChild(o),new Promise(r=>{o?.addEventListener("load",()=>r(o)),o.src=`${t?.walletUrl??e??"https://wallet.frak.id"}/listener`})}function changeIframeVisibility({iframe:e,isVisible:t}){if(!t){e.style.width="0",e.style.height="0",e.style.border="0",e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px";return}e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.pointerEvents="auto"}function findIframeInOpener(e="/listener"){if(!window.opener)return null;let t=t=>{try{return t.location.origin===window.location.origin&&t.location.pathname===e}catch{return!1}};try{let e=window.opener.frames;for(let r=0;r<e.length;r++)if(t(e[r]))return e[r];return null}catch(t){return console.error(`[findIframeInOpener] Error finding iframe with pathname ${e}:`,t),null}}function createIFrameLifecycleManager({iframe:e}){let t=new frame_connector_namespaceObject.Deferred;return{handleEvent:async r=>{if(!("iframeLifecycle"in r))return;let{iframeLifecycle:o,data:a}=r;switch(o){case"connected":t.resolve(!0);break;case"do-backup":a.backup?localStorage.setItem(BACKUP_KEY,a.backup):localStorage.removeItem(BACKUP_KEY);break;case"remove-backup":localStorage.removeItem(BACKUP_KEY);break;case"show":case"hide":changeIframeVisibility({iframe:e,isVisible:"show"===o});break;case"handshake":e.contentWindow?.postMessage({clientLifecycle:"handshake-response",data:{token:a.token,currentUrl:window.location.href}},"*");break;case"redirect":{let e=new URL(a.baseRedirectUrl);e.searchParams.has("u")?(e.searchParams.delete("u"),e.searchParams.append("u",window.location.href),window.location.href=e.toString()):window.location.href=a.baseRedirectUrl}}},isConnected:t.promise}}function createIFrameFrakClient({config:e,iframe:t}){let r,o=e?.walletUrl??"https://wallet.frak.id",a=createIFrameLifecycleManager({iframe:t}),n=new DebugInfoGatherer(e,t);if(!t.contentWindow)throw new frame_connector_namespaceObject.FrakRpcError(frame_connector_namespaceObject.RpcErrorCodes.configError,"The iframe does not have a content window");let s=(0,frame_connector_namespaceObject.createRpcClient)({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:o,middleware:[{async onRequest(e,t){if(!await a.isConnected)throw new frame_connector_namespaceObject.FrakRpcError(frame_connector_namespaceObject.RpcErrorCodes.clientNotConnected,"The iframe provider isn't connected yet");return t}},(0,middleware_namespaceObject.createClientCompressionMiddleware)(),{onRequest:(e,t)=>(n.setLastRequest(e),t),onResponse:(e,t)=>(n.setLastResponse(e,t),t)}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await a.handleEvent(e)}}}),c=setupHeartbeat(s,a),i=async()=>{c(),s.cleanup(),t.remove()};console.log("[Frak SDK] Initializing OpenPanel"),(r=new web_namespaceObject.OpenPanel({apiUrl:"https://op-api.gcp.frak.id",clientId:"6eacc8d7-49ac-4936-95e9-81ef29449570",trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>!("track"===e&&t?.properties)||("sdkVersion"in t.properties||(t.properties={...t.properties,sdkVersion:"0.1.0"}),!0)})).setGlobalProperties({sdkVersion:"0.1.0"}),r.init();let p=postConnectionSetup({config:e,rpcClient:s,lifecycleManager:a}).then(()=>n.updateSetupStatus(!0));return{config:e,debugInfo:n,waitForConnection:a.isConnected,waitForSetup:p,request:s.request,listenerRequest:s.listen,destroy:i,openPanel:r}}function setupHeartbeat(e,t){let r,o,a=()=>e.sendLifecycle({clientLifecycle:"heartbeat"});function n(){r&&clearInterval(r),o&&clearTimeout(o)}return async function(){a(),r=setInterval(a,1e3),o=setTimeout(()=>{n(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,n()}(),n}async function postConnectionSetup({config:e,rpcClient:t,lifecycleManager:r}){async function o(){let r=e.customizations?.css;r&&t.sendLifecycle({clientLifecycle:"modal-css",data:{cssLink:r}})}async function a(){let r=e.customizations?.i18n;r&&t.sendLifecycle({clientLifecycle:"modal-i18n",data:{i18n:r}})}async function n(){if("undefined"==typeof window)return;let e=window.localStorage.getItem(BACKUP_KEY);e&&t.sendLifecycle({clientLifecycle:"restore-backup",data:{backup:e}})}await r.isConnected,setupSsoUrlListener(t,r.isConnected),await Promise.allSettled([o(),a(),n()])}let locales={eur:"fr-FR",usd:"en-US",gbp:"en-GB"};function getSupportedCurrency(e){return e&&e in locales?e:"eur"}async function setupClient({config:e}){let t=prepareConfig(e),r=await createIframe({config:t});if(!r)return void console.error("Failed to create iframe");let o=createIFrameFrakClient({config:t,iframe:r});return(await o.waitForSetup,await o.waitForConnection)?o:void console.error("Failed to connect to client")}function prepareConfig(e){let t=getSupportedCurrency(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}function base64urlEncode(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function base64urlDecode(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(0===t?0:4-t),"=")),e=>e.charCodeAt(0))}function compressJsonToB64(e){return base64urlEncode((0,frame_connector_namespaceObject.compressJson)(e))}function decompressJsonFromB64(e){return(0,frame_connector_namespaceObject.decompressJson)(base64urlDecode(e))}let external_viem_namespaceObject=require("viem"),contextKey="fCtx";function compress(e){if(e?.r)try{let t=(0,external_viem_namespaceObject.hexToBytes)(e.r);return base64urlEncode(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function decompress(e){if(e&&0!==e.length)try{let t=base64urlDecode(e);return{r:(0,external_viem_namespaceObject.bytesToHex)(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function parse({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(contextKey);return t?decompress(t):null}function update({url:e,context:t}){if(!e)return null;let r=parse({url:e}),o=r?{...r,...t}:t;if(!o.r)return null;let a=compress(o);if(!a)return null;let n=new URL(e);return n.searchParams.set(contextKey,a),n.toString()}function remove(e){let t=new URL(e);return t.searchParams.delete(contextKey),t.toString()}function replaceUrl({url:e,context:t}){let r;if(!window.location?.href||"undefined"==typeof window)return void console.error("No window found, can't update context");let o=e??window.location.href;(r=null!==t?update({url:o,context:t}):remove(o))&&window.history.replaceState(null,"",r.toString())}let FrakContextManager={compress,decompress,parse,update,remove,replaceUrl};function getSupportedLocale(e){return e?locales[e]??locales.eur:locales.eur}function getCurrencyAmountKey(e){return e?`${e}Amount`:"eurAmount"}function formatAmount(e,t){let r=getSupportedLocale(t),o=getSupportedCurrency(t);return e.toLocaleString(r,{style:"currency",currency:o,minimumFractionDigits:0,maximumFractionDigits:2})}function trackEvent(e,t,r={}){if(!e)return void console.debug("[Frak] No client provided, skipping event tracking");try{e.openPanel?.track(t,r)}catch(e){console.debug("[Frak] Failed to track event:",t,e)}}function sso_generateSsoUrl(e,t,r,o,a){let n=compressJsonToB64(ssoParamsToCompressed({redirectUrl:t.redirectUrl,directExit:t.directExit,lang:t.lang,productId:r,metadata:{name:o,css:a,logoUrl:t.metadata?.logoUrl,homepageLink:t.metadata?.homepageLink}})),s=new URL(e);return s.pathname="/sso",s.searchParams.set("p",n),s.toString()}function ssoParamsToCompressed(e){return{r:e.redirectUrl,d:e.directExit,l:e.lang,p:e.productId,m:{n:e.metadata?.name,css:e.metadata?.css,l:e.metadata?.logoUrl,h:e.metadata?.homepageLink}}}let productTypes={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},productTypesMask=Object.entries(productTypes).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{}),interactionTypes={press:{openArticle:"0xc0a24ffb",readArticle:"0xd5bd0fbe"},dapp:{proofVerifiableStorageUpdate:"0x2ab2aeef",callableVerifiableStorageUpdate:"0xa07da986"},webshop:{open:"0xb311798f"},referral:{referred:"0x010cc3b9",createLink:"0xb2c0f17c"},purchase:{started:"0xd87e90c3",completed:"0x8403aeb4",unsafeCompleted:"0x4d5b14e0"},retail:{customerMeeting:"0x74489004"}},ssoPopupFeatures="menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800",ssoPopupName="frak-sso";async function openSso(e,t){let{metadata:r,customizations:o,walletUrl:a}=e.config;if(t.openInSameWindow??!!t.redirectUrl)return await e.request({method:"frak_openSso",params:[t,r.name,o?.css]});let n=t.ssoPopupUrl??generateSsoUrl(a??"https://wallet.frak.id",t,computeProductId(),r.name,o?.css),s=window.open(n,ssoPopupName,ssoPopupFeatures);if(!s)throw Error("Popup was blocked. Please allow popups for this site.");return s.focus(),await e.request({method:"frak_openSso",params:[t,r.name,o?.css]})??{}}for(var __webpack_i__ in exports.DebugInfoGatherer=__webpack_exports__.DebugInfoGatherer,exports.FrakContextManager=__webpack_exports__.FrakContextManager,exports.base64urlDecode=__webpack_exports__.base64urlDecode,exports.base64urlEncode=__webpack_exports__.base64urlEncode,exports.baseIframeProps=__webpack_exports__.baseIframeProps,exports.compressJsonToB64=__webpack_exports__.compressJsonToB64,exports.createIFrameFrakClient=__webpack_exports__.createIFrameFrakClient,exports.createIframe=__webpack_exports__.createIframe,exports.decompressJsonFromB64=__webpack_exports__.decompressJsonFromB64,exports.findIframeInOpener=__webpack_exports__.findIframeInOpener,exports.formatAmount=__webpack_exports__.formatAmount,exports.generateSsoUrl=__webpack_exports__.generateSsoUrl,exports.getCurrencyAmountKey=__webpack_exports__.getCurrencyAmountKey,exports.getSupportedCurrency=__webpack_exports__.getSupportedCurrency,exports.getSupportedLocale=__webpack_exports__.getSupportedLocale,exports.interactionTypes=__webpack_exports__.interactionTypes,exports.locales=__webpack_exports__.locales,exports.productTypes=__webpack_exports__.productTypes,exports.productTypesMask=__webpack_exports__.productTypesMask,exports.setupClient=__webpack_exports__.setupClient,exports.ssoPopupFeatures=__webpack_exports__.ssoPopupFeatures,exports.ssoPopupName=__webpack_exports__.ssoPopupName,exports.trackEvent=__webpack_exports__.trackEvent,__webpack_exports__)-1===["DebugInfoGatherer","FrakContextManager","base64urlDecode","base64urlEncode","baseIframeProps","compressJsonToB64","createIFrameFrakClient","createIframe","decompressJsonFromB64","findIframeInOpener","formatAmount","generateSsoUrl","getCurrencyAmountKey","getSupportedCurrency","getSupportedLocale","interactionTypes","locales","productTypes","productTypesMask","setupClient","ssoPopupFeatures","ssoPopupName","trackEvent"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
1
+ const e=require(`./trackEvent-GuQm_1Nm.cjs`),t=require(`./src-B_xO0AR6.cjs`),n=require(`./productTypes-BUkXJKZ7.cjs`);exports.DebugInfoGatherer=t.f,exports.FrakContextManager=e.n,exports.base64urlDecode=e.c,exports.base64urlEncode=e.l,exports.baseIframeProps=t.l,exports.compressJsonToB64=e.s,exports.createIFrameFrakClient=t.c,exports.createIframe=t.u,exports.decompressJsonFromB64=t.s,exports.findIframeInOpener=t.d,exports.formatAmount=t.r,exports.generateSsoUrl=e.o,exports.getCurrencyAmountKey=t.n,exports.getSupportedCurrency=t.a,exports.getSupportedLocale=t.i,exports.interactionTypes=n.r,exports.locales=t.o,exports.productTypes=n.t,exports.productTypesMask=n.n,exports.setupClient=t.t,exports.ssoPopupFeatures=e.i,exports.ssoPopupName=e.a,exports.trackEvent=e.t;