@frak-labs/core-sdk 0.0.19 → 0.1.0-beta.8d103039

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 (85) hide show
  1. package/cdn/bundle.js +5 -5
  2. package/dist/actions.cjs +1 -1
  3. package/dist/actions.d.cts +154 -73
  4. package/dist/actions.d.ts +154 -73
  5. package/dist/actions.js +1 -1
  6. package/dist/bundle.cjs +2 -2
  7. package/dist/bundle.d.cts +257 -192
  8. package/dist/bundle.d.ts +257 -192
  9. package/dist/bundle.js +2 -2
  10. package/dist/index.cjs +11 -11
  11. package/dist/index.d.cts +199 -185
  12. package/dist/index.d.ts +199 -185
  13. package/dist/index.js +2 -2
  14. package/package.json +7 -2
  15. package/src/actions/displayEmbeddedWallet.ts +20 -0
  16. package/src/actions/displayModal.ts +131 -0
  17. package/src/actions/getProductInformation.ts +14 -0
  18. package/src/actions/index.ts +29 -0
  19. package/src/actions/openSso.ts +116 -0
  20. package/src/actions/prepareSso.ts +48 -0
  21. package/src/actions/referral/processReferral.ts +230 -0
  22. package/src/actions/referral/referralInteraction.ts +57 -0
  23. package/src/actions/sendInteraction.ts +32 -0
  24. package/src/actions/trackPurchaseStatus.ts +53 -0
  25. package/src/actions/watchWalletStatus.ts +94 -0
  26. package/src/actions/wrapper/modalBuilder.ts +212 -0
  27. package/src/actions/wrapper/sendTransaction.ts +62 -0
  28. package/src/actions/wrapper/siweAuthenticate.ts +94 -0
  29. package/src/bundle.ts +3 -0
  30. package/src/clients/DebugInfo.ts +182 -0
  31. package/src/clients/createIFrameFrakClient.ts +287 -0
  32. package/src/clients/index.ts +3 -0
  33. package/src/clients/setupClient.ts +71 -0
  34. package/src/clients/transports/iframeLifecycleManager.ts +88 -0
  35. package/src/constants/interactionTypes.ts +44 -0
  36. package/src/constants/locales.ts +14 -0
  37. package/src/constants/productTypes.ts +33 -0
  38. package/src/index.ts +103 -0
  39. package/src/interactions/index.ts +5 -0
  40. package/src/interactions/pressEncoder.ts +53 -0
  41. package/src/interactions/purchaseEncoder.ts +94 -0
  42. package/src/interactions/referralEncoder.ts +47 -0
  43. package/src/interactions/retailEncoder.ts +37 -0
  44. package/src/interactions/webshopEncoder.ts +30 -0
  45. package/src/types/client.ts +14 -0
  46. package/src/types/compression.ts +22 -0
  47. package/src/types/config.ts +111 -0
  48. package/src/types/context.ts +13 -0
  49. package/src/types/index.ts +70 -0
  50. package/src/types/lifecycle/client.ts +46 -0
  51. package/src/types/lifecycle/iframe.ts +35 -0
  52. package/src/types/lifecycle/index.ts +2 -0
  53. package/src/types/rpc/displayModal.ts +84 -0
  54. package/src/types/rpc/embedded/index.ts +68 -0
  55. package/src/types/rpc/embedded/loggedIn.ts +55 -0
  56. package/src/types/rpc/embedded/loggedOut.ts +28 -0
  57. package/src/types/rpc/interaction.ts +43 -0
  58. package/src/types/rpc/modal/final.ts +46 -0
  59. package/src/types/rpc/modal/generic.ts +46 -0
  60. package/src/types/rpc/modal/index.ts +20 -0
  61. package/src/types/rpc/modal/login.ts +32 -0
  62. package/src/types/rpc/modal/openSession.ts +25 -0
  63. package/src/types/rpc/modal/siweAuthenticate.ts +37 -0
  64. package/src/types/rpc/modal/transaction.ts +33 -0
  65. package/src/types/rpc/productInformation.ts +59 -0
  66. package/src/types/rpc/sso.ts +80 -0
  67. package/src/types/rpc/walletStatus.ts +35 -0
  68. package/src/types/rpc.ts +158 -0
  69. package/src/types/transport.ts +34 -0
  70. package/src/utils/FrakContext.ts +152 -0
  71. package/src/utils/compression/b64.ts +29 -0
  72. package/src/utils/compression/compress.ts +11 -0
  73. package/src/utils/compression/decompress.ts +11 -0
  74. package/src/utils/compression/index.ts +3 -0
  75. package/src/utils/computeProductId.ts +11 -0
  76. package/src/utils/constants.ts +4 -0
  77. package/src/utils/formatAmount.ts +18 -0
  78. package/src/utils/getCurrencyAmountKey.ts +15 -0
  79. package/src/utils/getSupportedCurrency.ts +14 -0
  80. package/src/utils/getSupportedLocale.ts +16 -0
  81. package/src/utils/iframeHelper.ts +142 -0
  82. package/src/utils/index.ts +21 -0
  83. package/src/utils/sso.ts +119 -0
  84. package/src/utils/ssoUrlListener.ts +60 -0
  85. package/src/utils/trackEvent.ts +26 -0
@@ -0,0 +1,111 @@
1
+ /**
2
+ * All the currencies available
3
+ * @category Config
4
+ */
5
+ export type Currency = "eur" | "usd" | "gbp";
6
+
7
+ /**
8
+ * All the languages available
9
+ * @category Config
10
+ */
11
+ export type Language = "fr" | "en";
12
+
13
+ /**
14
+ * Configuration for the Frak Wallet SDK
15
+ * @category Config
16
+ */
17
+ export type FrakWalletSdkConfig = {
18
+ /**
19
+ * The Frak wallet url
20
+ * @defaultValue "https://wallet.frak.id"
21
+ */
22
+ walletUrl?: string;
23
+ /**
24
+ * Some metadata about your implementation of the Frak SDK
25
+ */
26
+ metadata: {
27
+ /**
28
+ * Your application name (will be displayed in a few modals and in SSO)
29
+ */
30
+ name: string;
31
+ /**
32
+ * Language to display in the modal
33
+ * If undefined, will default to the browser language
34
+ */
35
+ lang?: Language;
36
+ /**
37
+ * The currency to display in the modal
38
+ * @defaultValue `"eur"`
39
+ */
40
+ currency?: Currency;
41
+ /**
42
+ * The logo URL that will be displayed in a few components
43
+ */
44
+ logoUrl?: string;
45
+ /**
46
+ * The homepage link that could be displayed in a few components
47
+ */
48
+ homepageLink?: string;
49
+ };
50
+ /**
51
+ * Some customization for the modal
52
+ */
53
+ customizations?: {
54
+ /**
55
+ * Custom CSS styles to apply to the modals and components
56
+ */
57
+ css?: `${string}.css`;
58
+ /**
59
+ * Custom i18n configuration for the modal
60
+ */
61
+ i18n?: I18nConfig;
62
+ };
63
+ /**
64
+ * The domain name of your application
65
+ * @defaultValue window.location.host
66
+ */
67
+ domain?: string;
68
+ };
69
+
70
+ /**
71
+ * Custom i18n configuration for the modal
72
+ * See [i18next json format](https://www.i18next.com/misc/json-format#i18next-json-v4)
73
+ *
74
+ * Available variables
75
+ * - `{{ productName }}` : The name of your website (`metadata.name`)
76
+ * - `{{ productOrigin }}` : The origin url of your website
77
+ * - `{{ estimatedReward }}` : The estimated reward for the user (based on the specific `targetInteraction` you can specify, or the max referrer reward if no target interaction is specified)
78
+ *
79
+ * Context of the translation [see i18n context](https://www.i18next.com/translation-function/context)
80
+ * - For modal display, the key of the final action (`sharing`, `reward`, or undefined)
81
+ * - For embedded wallet display, the key of the logged in action (`sharing` or undefined)
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * // Multi language config
86
+ * const multiI18n = {
87
+ * fr: {
88
+ * "sdk.modal.title": "Titre de modal",
89
+ * "sdk.modal.description": "Description de modal, avec {{ estimatedReward }} de gains possible",
90
+ * },
91
+ * en: "https://example.com/en.json"
92
+ * }
93
+ *
94
+ * // Single language config
95
+ * const singleI18n = {
96
+ * "sdk.modal.title": "Modal title",
97
+ * "sdk.modal.description": "Modal description, with {{ estimatedReward }} of gains possible",
98
+ * }
99
+ * ```
100
+ *
101
+ * @category Config
102
+ */
103
+ export type I18nConfig =
104
+ | Record<Language, LocalizedI18nConfig>
105
+ | LocalizedI18nConfig;
106
+
107
+ /**
108
+ * A localized i18n config
109
+ * @category Config
110
+ */
111
+ export type LocalizedI18nConfig = `${string}.css` | { [key: string]: string };
@@ -0,0 +1,13 @@
1
+ import type { Address } from "viem";
2
+
3
+ /**
4
+ * The current Frak Context
5
+ *
6
+ * For now, only contain a referrer address.
7
+ *
8
+ * @ignore
9
+ */
10
+ export type FrakContext = {
11
+ // Referrer address
12
+ r: Address;
13
+ };
@@ -0,0 +1,70 @@
1
+ // Rpc related
2
+ export type { WalletStatusReturnType } from "./rpc/walletStatus";
3
+ export type {
4
+ DisplayEmbeddedWalletParamsType,
5
+ DisplayEmbeddedWalletResultType,
6
+ LoggedOutEmbeddedView,
7
+ LoggedInEmbeddedView,
8
+ EmbeddedViewActionReferred,
9
+ EmbeddedViewActionSharing,
10
+ } from "./rpc/embedded";
11
+ export type {
12
+ SsoMetadata,
13
+ OpenSsoParamsType,
14
+ OpenSsoReturnType,
15
+ PrepareSsoParamsType,
16
+ PrepareSsoReturnType,
17
+ } from "./rpc/sso";
18
+ export type {
19
+ TokenAmountType,
20
+ GetProductInformationReturnType,
21
+ } from "./rpc/productInformation";
22
+ export type {
23
+ PreparedInteraction,
24
+ SendInteractionParamsType,
25
+ SendInteractionReturnType,
26
+ } from "./rpc/interaction";
27
+ export type { IFrameRpcSchema } from "./rpc";
28
+ // Client related
29
+ export type { FrakClient } from "./client";
30
+ export type { IFrameTransport, FrakLifecycleEvent } from "./transport";
31
+ export type {
32
+ IFrameLifecycleEvent,
33
+ ClientLifecycleEvent,
34
+ } from "./lifecycle";
35
+ export type {
36
+ FrakWalletSdkConfig,
37
+ Currency,
38
+ Language,
39
+ I18nConfig,
40
+ LocalizedI18nConfig,
41
+ } from "./config";
42
+ export type {
43
+ CompressedData,
44
+ HashProtectedData,
45
+ KeyProvider,
46
+ } from "./compression";
47
+ // Modal related
48
+ export type {
49
+ ModalStepTypes,
50
+ ModalRpcStepsInput,
51
+ ModalRpcStepsResultType,
52
+ DisplayModalParamsType,
53
+ ModalRpcMetadata,
54
+ } from "./rpc/displayModal";
55
+ export type {
56
+ ModalStepMetadata,
57
+ LoginModalStepType,
58
+ SiweAuthenticateModalStepType,
59
+ SiweAuthenticationParams,
60
+ SiweAuthenticateReturnType,
61
+ SendTransactionTxType,
62
+ SendTransactionModalStepType,
63
+ SendTransactionReturnType,
64
+ OpenInteractionSessionReturnType,
65
+ OpenInteractionSessionModalStepType,
66
+ FinalModalStepType,
67
+ FinalActionType,
68
+ } from "./rpc/modal";
69
+ // Utils
70
+ export type { FrakContext } from "./context";
@@ -0,0 +1,46 @@
1
+ import type { I18nConfig } from "../config";
2
+
3
+ /**
4
+ * Event related to the iframe lifecycle
5
+ * @ignore
6
+ */
7
+ export type ClientLifecycleEvent =
8
+ | CustomCssEvent
9
+ | CustomI18nEvent
10
+ | RestoreBackupEvent
11
+ | HearbeatEvent
12
+ | HandshakeResponse
13
+ | SsoRedirectCompleteEvent;
14
+
15
+ type CustomCssEvent = {
16
+ clientLifecycle: "modal-css";
17
+ data: { cssLink: string };
18
+ };
19
+
20
+ type CustomI18nEvent = {
21
+ clientLifecycle: "modal-i18n";
22
+ data: { i18n: I18nConfig };
23
+ };
24
+
25
+ type RestoreBackupEvent = {
26
+ clientLifecycle: "restore-backup";
27
+ data: { backup: string };
28
+ };
29
+
30
+ type HearbeatEvent = {
31
+ clientLifecycle: "heartbeat";
32
+ data?: never;
33
+ };
34
+
35
+ type HandshakeResponse = {
36
+ clientLifecycle: "handshake-response";
37
+ data: {
38
+ token: string;
39
+ currentUrl: string;
40
+ };
41
+ };
42
+
43
+ type SsoRedirectCompleteEvent = {
44
+ clientLifecycle: "sso-redirect-complete";
45
+ data: { compressed: string };
46
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Event related to the iframe lifecycle
3
+ * @ignore
4
+ */
5
+ export type IFrameLifecycleEvent =
6
+ | {
7
+ iframeLifecycle: "connected" | "show" | "hide" | "remove-backup";
8
+ data?: never;
9
+ }
10
+ | DoBackupEvent
11
+ | HandshakeRequestEvent
12
+ | RedirectRequestEvent;
13
+
14
+ type DoBackupEvent = {
15
+ iframeLifecycle: "do-backup";
16
+ data: { backup?: string };
17
+ };
18
+
19
+ type HandshakeRequestEvent = {
20
+ iframeLifecycle: "handshake";
21
+ data: {
22
+ token: string;
23
+ };
24
+ };
25
+
26
+ type RedirectRequestEvent = {
27
+ iframeLifecycle: "redirect";
28
+ data: {
29
+ /**
30
+ * The base url to redirect to
31
+ * If it contain a query param `u`, the client need will suffix the current url to the base url
32
+ */
33
+ baseRedirectUrl: string;
34
+ };
35
+ };
@@ -0,0 +1,2 @@
1
+ export type { IFrameLifecycleEvent } from "./iframe";
2
+ export type { ClientLifecycleEvent } from "./client";
@@ -0,0 +1,84 @@
1
+ import type { FullInteractionTypesKey } from "../../constants/interactionTypes";
2
+ import type { I18nConfig } from "../config";
3
+ import type {
4
+ FinalModalStepType,
5
+ LoginModalStepType,
6
+ OpenInteractionSessionModalStepType,
7
+ SendTransactionModalStepType,
8
+ SiweAuthenticateModalStepType,
9
+ } from "./modal";
10
+
11
+ /**
12
+ * Generic type of steps we will display in the modal to the end user
13
+ * @group Modal Display
14
+ */
15
+ export type ModalStepTypes =
16
+ | LoginModalStepType
17
+ | SiweAuthenticateModalStepType
18
+ | SendTransactionModalStepType
19
+ | OpenInteractionSessionModalStepType
20
+ | FinalModalStepType;
21
+
22
+ /**
23
+ * Type for the result of a modal request
24
+ * Just the `returns` type of each `ModalStepTypes`
25
+ * @typeParam T - The list of modal steps we expect to have in the modal
26
+ * @group Modal Display
27
+ * @group RPC Schema
28
+ */
29
+ export type ModalRpcStepsResultType<
30
+ T extends ModalStepTypes[] = ModalStepTypes[],
31
+ > = {
32
+ [K in T[number]["key"]]: Extract<T[number], { key: K }>["returns"];
33
+ };
34
+
35
+ /**
36
+ * Type for the RPC input of a modal
37
+ * Just the `params` type of each `ModalStepTypes`
38
+ * @typeParam T - The list of modal steps we expect to have in the modal
39
+ * @group Modal Display
40
+ * @group RPC Schema
41
+ */
42
+ export type ModalRpcStepsInput<T extends ModalStepTypes[] = ModalStepTypes[]> =
43
+ {
44
+ [K in T[number]["key"]]?: Extract<T[number], { key: K }>["params"];
45
+ };
46
+
47
+ /**
48
+ * RPC metadata for the modal, used on top level modal configuration
49
+ * @group Modal Display
50
+ * @group RPC Schema
51
+ */
52
+ export type ModalRpcMetadata = {
53
+ header?: {
54
+ title?: string;
55
+ icon?: string;
56
+ };
57
+ targetInteraction?: FullInteractionTypesKey;
58
+ /**
59
+ * Some i18n override for the displayed modal (i.e. update the displayed text only for this modal)
60
+ */
61
+ i18n?: I18nConfig;
62
+ } & (
63
+ | {
64
+ isDismissible: true;
65
+ /**
66
+ * @deprecated Use `config.customizations.i18n` or `metadata.i18n` instead
67
+ */
68
+ dismissActionTxt?: string;
69
+ }
70
+ | {
71
+ isDismissible?: false;
72
+ dismissActionTxt?: never;
73
+ }
74
+ );
75
+
76
+ /**
77
+ * Params used to display a modal
78
+ * @typeParam T - The list of modal steps we expect to have in the modal
79
+ * @group Modal Display
80
+ */
81
+ export type DisplayModalParamsType<T extends ModalStepTypes[]> = {
82
+ steps: ModalRpcStepsInput<T>;
83
+ metadata?: ModalRpcMetadata;
84
+ };
@@ -0,0 +1,68 @@
1
+ import type { Address } from "viem";
2
+ import type { FullInteractionTypesKey } from "../../../constants/interactionTypes";
3
+ import type { I18nConfig } from "../../config";
4
+ import type {
5
+ EmbeddedViewActionReferred,
6
+ EmbeddedViewActionSharing,
7
+ LoggedInEmbeddedView,
8
+ } from "./loggedIn";
9
+ import type { LoggedOutEmbeddedView } from "./loggedOut";
10
+
11
+ export type {
12
+ EmbeddedViewActionSharing,
13
+ LoggedInEmbeddedView,
14
+ LoggedOutEmbeddedView,
15
+ EmbeddedViewActionReferred,
16
+ };
17
+
18
+ /**
19
+ * The params used to display the embedded wallet
20
+ *
21
+ * @group Embedded wallet
22
+ */
23
+ export type DisplayEmbeddedWalletParamsType = {
24
+ /**
25
+ * The embedded view to display once the user is logged in
26
+ */
27
+ loggedIn?: LoggedInEmbeddedView;
28
+ /**
29
+ * The embedded view to display once the user is logged out
30
+ */
31
+ loggedOut?: LoggedOutEmbeddedView;
32
+ /**
33
+ * Some metadata to customize the embedded view
34
+ */
35
+ metadata?: {
36
+ /**
37
+ * The logo to display on the embedded wallet
38
+ * If undefined, will default to no logo displayed
39
+ */
40
+ logo?: string;
41
+ /**
42
+ * Link to the homepage of the calling website
43
+ * If undefined, will default to the domain of the calling website
44
+ */
45
+ homepageLink?: string;
46
+ /**
47
+ * The target interaction behind this modal
48
+ */
49
+ targetInteraction?: FullInteractionTypesKey;
50
+ /**
51
+ * The position of the component
52
+ */
53
+ position?: "left" | "right";
54
+ /**
55
+ * Some i18n override for the displayed modal (i.e. update the displayed text only for this modal)
56
+ */
57
+ i18n?: I18nConfig;
58
+ };
59
+ };
60
+
61
+ /**
62
+ * The result of the display embedded wallet rpc request
63
+ *
64
+ * @group Embedded wallet
65
+ */
66
+ export type DisplayEmbeddedWalletResultType = {
67
+ wallet: Address;
68
+ };
@@ -0,0 +1,55 @@
1
+ /**
2
+ * The different type of action we can have on the embedded view (once the user is logged in)
3
+ *
4
+ * @group Embedded wallet
5
+ */
6
+ export type EmbeddedViewActionSharing = {
7
+ key: "sharing";
8
+
9
+ /**
10
+ * Some sharing options
11
+ */
12
+ options?: {
13
+ /**
14
+ * The title that will be displayed on the system popup once the system sharing window is open
15
+ * @deprecated Use the top level `config.metadata.i18n` instead
16
+ */
17
+ popupTitle?: string;
18
+ /**
19
+ * The text that will be shared alongside the link.
20
+ * Can contain the variable {LINK} to specify where the link is placed, otherwise it will be added at the end
21
+ * @deprecated Use the top level `config.metadata.i18n` instead
22
+ */
23
+ text?: string;
24
+ /**
25
+ * The link to be shared (will be suffixed with the Frak sharing context)
26
+ */
27
+ link?: string;
28
+ };
29
+ };
30
+
31
+ /**
32
+ * The action to display on the logged out embedded view when the user is referred
33
+ *
34
+ * @group Embedded wallet
35
+ */
36
+ export type EmbeddedViewActionReferred = {
37
+ key: "referred";
38
+
39
+ /**
40
+ * No options for a referred action
41
+ */
42
+ options?: never;
43
+ };
44
+
45
+ /**
46
+ * Some configuration options for the embedded view
47
+ *
48
+ * @group Embedded wallet
49
+ */
50
+ export type LoggedInEmbeddedView = {
51
+ /**
52
+ * The main action to display on the logged in embedded view
53
+ */
54
+ action?: EmbeddedViewActionSharing | EmbeddedViewActionReferred;
55
+ };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The view when a user is logged out
3
+ * @group Embedded wallet
4
+ */
5
+ export type LoggedOutEmbeddedView = {
6
+ /**
7
+ * Metadata option when displaying the embedded view
8
+ */
9
+ metadata?: {
10
+ /**
11
+ * The main CTA for the logged out view
12
+ * - can include some variable, available ones are:
13
+ * - {REWARD} -> The maximum reward a user can receive when interacting on your website
14
+ * - can be formatted in markdown
15
+ *
16
+ * If not set, it will default to a internationalized message
17
+ * @deprecated Use the top level `config.customizations.i18n`, or `metadata.i18n` instead
18
+ */
19
+ text?: string;
20
+ /**
21
+ * The text that will be displayed on the login button
22
+ *
23
+ * If not set, it will default to a internationalized message
24
+ * @deprecated Use the top level `config.customizations.i18n`, or `metadata.i18n` instead
25
+ */
26
+ buttonText?: string;
27
+ };
28
+ };
@@ -0,0 +1,43 @@
1
+ import type { Hex } from "viem";
2
+
3
+ /**
4
+ * Represent a prepared user interaction, ready to be sent on-chain via the wallet
5
+ */
6
+ export type PreparedInteraction = {
7
+ handlerTypeDenominator: Hex;
8
+ interactionData: Hex;
9
+ };
10
+
11
+ /**
12
+ * Parameters that will be used to send an interaction to the blockchain
13
+ * @inline
14
+ */
15
+ export type SendInteractionParamsType = {
16
+ /**
17
+ * The product id where this interaction has been made
18
+ * @defaultValue keccak256(toHex(window.location.host))
19
+ */
20
+ productId?: Hex;
21
+ /**
22
+ * The prepared interaction, built from an Interaction Encoder
23
+ */
24
+ interaction: PreparedInteraction;
25
+ /**
26
+ * A pre-computed interaction signature
27
+ * If none provided, the delegated interaction validator of your product will sign it (you can manage it in the business dashboard)
28
+ *
29
+ * @defaultValue undefined
30
+ */
31
+ validation?: Hex;
32
+ };
33
+
34
+ /**
35
+ * Return type of the send interaction rpc request
36
+ * @group RPC Schema
37
+ */
38
+ export type SendInteractionReturnType = {
39
+ /**
40
+ * The id of the interaction in the interaction pool
41
+ */
42
+ delegationId: string;
43
+ };
@@ -0,0 +1,46 @@
1
+ import type { GenericModalStepType, ModalStepMetadata } from "./generic";
2
+
3
+ /**
4
+ * The final modal step type, could be used to display sharing options or a success reward screen.
5
+ *
6
+ * **Input**: What type final step to display?
7
+ * **Output**: None
8
+ *
9
+ * @group Modal Display
10
+ */
11
+ export type FinalModalStepType = GenericModalStepType<
12
+ "final",
13
+ {
14
+ // Custom metadata in the case it was dismissed
15
+ dismissedMetadata?: ModalStepMetadata["metadata"];
16
+ // Action to perform on this final step
17
+ action: FinalActionType;
18
+ // Do we want to auto skip this step (don't display anything to the user, once we reached it we exit)
19
+ autoSkip?: boolean;
20
+ },
21
+ object
22
+ >;
23
+
24
+ /**
25
+ * The different types of final actions we can display in the final step
26
+ * @group Modal Display
27
+ */
28
+ export type FinalActionType =
29
+ | {
30
+ key: "sharing";
31
+ options?: {
32
+ /**
33
+ * @deprecated Use the top level `config.metadata.i18n` instead
34
+ */
35
+ popupTitle?: string;
36
+ /**
37
+ * @deprecated Use the top level `config.metadata.i18n` instead
38
+ */
39
+ text?: string;
40
+ link?: string;
41
+ };
42
+ }
43
+ | {
44
+ key: "reward";
45
+ options?: never;
46
+ };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Represent a generic modal step type
3
+ * @ignore
4
+ * @inline
5
+ */
6
+ export type GenericModalStepType<TKey, TParams, TReturns> = {
7
+ key: TKey;
8
+ params: TParams extends never
9
+ ? ModalStepMetadata
10
+ : ModalStepMetadata & TParams;
11
+ returns: TReturns;
12
+ };
13
+
14
+ /**
15
+ * Metadata that can be used to customize a modal step
16
+ * @group Modal Display
17
+ * @deprecated Use the top level `config.customizations.i18n`, or `metadata.i18n` instead
18
+ */
19
+ export type ModalStepMetadata = {
20
+ metadata?: {
21
+ /**
22
+ * Custom title for the step
23
+ * If none provided, it will use an internationalized text
24
+ * @deprecated Use the top level `config.customizations.i18n`, or `metadata.i18n` instead
25
+ */
26
+ title?: string;
27
+ /**
28
+ * Custom description for the step
29
+ * If none provided, it will use an internationalized text
30
+ * @deprecated Use the top level `config.customizations.i18n`, or `metadata.i18n` instead
31
+ */
32
+ description?: string;
33
+ /**
34
+ * Custom text for the primary action of the step
35
+ * If none provided, it will use an internationalized text
36
+ * @deprecated Use the top level `config.customizations.i18n`, or `metadata.i18n` instead
37
+ */
38
+ primaryActionText?: string;
39
+ /**
40
+ * Custom text for the secondary action of the step
41
+ * If none provided, it will use an internationalized text
42
+ * @deprecated Use the top level `config.customizations.i18n`, or `metadata.i18n` instead
43
+ */
44
+ secondaryActionText?: string;
45
+ };
46
+ };
@@ -0,0 +1,20 @@
1
+ export type { LoginModalStepType } from "./login";
2
+ export type {
3
+ SiweAuthenticateModalStepType,
4
+ SiweAuthenticationParams,
5
+ SiweAuthenticateReturnType,
6
+ } from "./siweAuthenticate";
7
+ export type {
8
+ SendTransactionModalStepType,
9
+ SendTransactionTxType,
10
+ SendTransactionReturnType,
11
+ } from "./transaction";
12
+ export type {
13
+ OpenInteractionSessionReturnType,
14
+ OpenInteractionSessionModalStepType,
15
+ } from "./openSession";
16
+ export type { ModalStepMetadata } from "./generic";
17
+ export type {
18
+ FinalModalStepType,
19
+ FinalActionType,
20
+ } from "./final";