@frak-labs/react-sdk 0.2.1 → 1.0.0-beta.0cd79998
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/dist/index.cjs +1 -1
- package/dist/index.d.cts +163 -25
- package/dist/index.d.ts +163 -25
- package/dist/index.js +1 -1
- package/package.json +13 -14
- package/src/hook/helper/useReferralInteraction.test.ts +22 -191
- package/src/hook/helper/useReferralInteraction.ts +9 -27
- package/src/hook/index.ts +4 -0
- package/src/hook/useDisplayModal.ts +6 -4
- package/src/hook/useDisplaySharingPage.ts +64 -0
- package/src/hook/useGetMerchantInformation.ts +6 -1
- package/src/hook/useGetMergeToken.ts +59 -0
- package/src/hook/useGetUserReferralStatus.ts +63 -0
- package/src/hook/useSetupReferral.ts +35 -0
- package/src/index.ts +4 -0
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@frak-labs/core-sdk/actions`),t=require(`@frak-labs/frame-connector`),n=require(`@tanstack/react-query`),r=require(`react`),i=require(`@frak-labs/core-sdk`);const a=(0,r.createContext)(void 0);function o(e){let{children:t,config:n}=e;return(0,r.createElement)(a.Provider,{value:{...n,walletUrl:n.walletUrl??`https://wallet.frak.id`,domain:n.domain??(typeof window<`u`?window?.location?.host:void 0)??`not-found`}},t)}const s=(0,r.createContext)(void 0);function c({style:e,children:t}){let n=
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@frak-labs/core-sdk/actions`),t=require(`@frak-labs/frame-connector`),n=require(`@tanstack/react-query`),r=require(`react`),i=require(`@frak-labs/core-sdk`);const a=(0,r.createContext)(void 0);function o(e){let{children:t,config:n}=e;return(0,r.createElement)(a.Provider,{value:{...n,walletUrl:n.walletUrl??`https://wallet.frak.id`,domain:n.domain??(typeof window<`u`?window?.location?.host:void 0)??`not-found`}},t)}const s=(0,r.createContext)(void 0);function c({style:e,children:t}){let n=p(),[a,o]=(0,r.useState)(void 0);return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(`iframe`,{...i.baseIframeProps,src:`${n.walletUrl}/listener`,style:e??i.baseIframeProps.style,ref:e=>{!e||a||o((0,i.createIFrameFrakClient)({iframe:e,config:n}))}}),(0,r.createElement)(s.Provider,{value:a},t))}function l(){return(0,r.useContext)(s)}function u({options:i}={}){let a=l(),{data:o,error:s,status:c}=(0,n.useQuery)({queryKey:[`frak-sdk`,`auto-referral-interaction`],queryFn:async()=>{if(!a)throw new t.ClientNotFound;return(0,e.referralInteraction)(a,{options:i})},enabled:!!a,staleTime:1/0});return(0,r.useMemo)(()=>c===`pending`?`processing`:c===`error`?s:o||`idle`,[o,c,s])}function d({mutations:r}={}){let i=l();return(0,n.useMutation)({...r,mutationKey:[`frak-sdk`,`display-modal`],mutationFn:async({placement:n,...r})=>{if(!i)throw new t.ClientNotFound;return(0,e.displayModal)(i,r,n)}})}function f({mutations:r}={}){let i=l();return(0,n.useMutation)({...r,mutationKey:[`frak-sdk`,`display-sharing-page`],mutationFn:async({placement:n,...r})=>{if(!i)throw new t.ClientNotFound;return(0,e.displaySharingPage)(i,r,n)}})}function p(){let e=(0,r.useContext)(a);if(!e)throw new t.FrakRpcError(t.RpcErrorCodes.configError,`Frak config not found`);return e}function m({query:r,cacheTime:i}={}){let a=l();return(0,n.useQuery)({...r,queryKey:[`frak-sdk`,`get-merchant-information`],queryFn:async()=>{if(!a)throw new t.ClientNotFound;return(0,e.getMerchantInformation)(a,{cacheTime:i})}})}function h({query:r,cacheTime:i}={}){let a=l();return(0,n.useQuery)({...r,queryKey:[`frak-sdk`,`get-merge-token`],queryFn:async()=>{if(!a)throw new t.ClientNotFound;return(0,e.getMergeToken)(a,{cacheTime:i})}})}function g({query:r,cacheTime:i}={}){let a=l();return(0,n.useQuery)({...r,queryKey:[`frak-sdk`,`get-user-referral-status`],queryFn:async()=>{if(!a)throw new t.ClientNotFound;return(0,e.getUserReferralStatus)(a,{cacheTime:i})}})}function _({mutations:r}={}){let i=l();return(0,n.useMutation)({...r,mutationKey:[`frak-sdk`,`open-sso`],mutationFn:async n=>{if(!i)throw new t.ClientNotFound;return(0,e.openSso)(i,n)}})}function v(r){let i=l();return(0,n.useQuery)({queryKey:[`frak-sdk`,`prepare-sso`,r],queryFn:async()=>{if(!i)throw new t.ClientNotFound;return(0,e.prepareSso)(i,r)}})}function y({mutations:r}={}){let i=l();return(0,n.useMutation)({...r,mutationKey:[`frak-sdk`,`send-transaction`],mutationFn:async n=>{if(!i)throw new t.ClientNotFound;return(0,e.sendTransaction)(i,n)}})}function b(){let r=l();return(0,n.useQuery)({queryKey:[`frak-sdk`,`setup-referral`],queryFn:async()=>{if(!r)throw new t.ClientNotFound;return await(0,e.setupReferral)(r),null},enabled:!!r,staleTime:1/0})}function x({mutations:r}={}){let i=l();return(0,n.useMutation)({...r,mutationKey:[`frak-sdk`,`siwe-authenticate`,i?.config.domain??`no-domain`],mutationFn:async n=>{if(!i)throw new t.ClientNotFound;return(0,e.siweAuthenticate)(i,n)}})}function S(){let i=(0,n.useQueryClient)(),a=l(),o=(0,r.useCallback)(e=>{i.setQueryData([`frak-sdk`,`wallet-status-listener`],e)},[i]);return(0,n.useQuery)({gcTime:0,staleTime:0,queryKey:[`frak-sdk`,`wallet-status-listener`],queryFn:async()=>{if(!a)throw new t.ClientNotFound;return(0,e.watchWalletStatus)(a,o)},enabled:!!a})}exports.FrakConfigContext=a,exports.FrakConfigProvider=o,exports.FrakIFrameClientContext=s,exports.FrakIFrameClientProvider=c,exports.useDisplayModal=d,exports.useDisplaySharingPage=f,exports.useFrakClient=l,exports.useFrakConfig=p,exports.useGetMerchantInformation=m,exports.useGetMergeToken=h,exports.useGetUserReferralStatus=g,exports.useOpenSso=_,exports.usePrepareSso=v,exports.useReferralInteraction=u,exports.useSendTransactionAction=y,exports.useSetupReferral=b,exports.useSiweAuthenticate=x,exports.useWalletStatus=S;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { ProcessReferralOptions, SendTransactionParams, SiweAuthenticateModalParams } from "@frak-labs/core-sdk/actions";
|
|
2
|
-
import * as _tanstack_react_query0 from "@tanstack/react-query";
|
|
2
|
+
import * as _$_tanstack_react_query0 from "@tanstack/react-query";
|
|
3
3
|
import { UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
|
|
4
|
-
import * as _frak_labs_core_sdk0 from "@frak-labs/core-sdk";
|
|
5
|
-
import { DisplayModalParamsType, FrakClient, FrakWalletSdkConfig, GetMerchantInformationReturnType, ModalRpcStepsResultType, ModalStepTypes, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, SendTransactionReturnType, SiweAuthenticateReturnType, WalletStatusReturnType } from "@frak-labs/core-sdk";
|
|
4
|
+
import * as _$_frak_labs_core_sdk0 from "@frak-labs/core-sdk";
|
|
5
|
+
import { DisplayModalParamsType, DisplaySharingPageParamsType, DisplaySharingPageResultType, FrakClient, FrakWalletSdkConfig, GetMerchantInformationReturnType, ModalRpcStepsResultType, ModalStepTypes, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, SendTransactionReturnType, SiweAuthenticateReturnType, UserReferralStatusType, WalletStatusReturnType } from "@frak-labs/core-sdk";
|
|
6
6
|
import { FrakRpcError } from "@frak-labs/frame-connector";
|
|
7
|
-
import * as react from "react";
|
|
7
|
+
import * as _$react from "react";
|
|
8
8
|
import { CSSProperties, PropsWithChildren, ReactNode } from "react";
|
|
9
9
|
|
|
10
10
|
//#region src/hook/helper/useReferralInteraction.d.ts
|
|
11
11
|
/**
|
|
12
12
|
* Helper hook to automatically submit a referral interaction when detected
|
|
13
13
|
*
|
|
14
|
+
* Runs once when the Frak client becomes available.
|
|
15
|
+
*
|
|
14
16
|
* @group hooks
|
|
15
17
|
*
|
|
16
18
|
* @param args
|
|
@@ -20,23 +22,25 @@ import { CSSProperties, PropsWithChildren, ReactNode } from "react";
|
|
|
20
22
|
*
|
|
21
23
|
* @description This function will automatically handle the referral interaction process
|
|
22
24
|
*
|
|
23
|
-
* @see {@link @frak-labs/core-sdk!actions.
|
|
25
|
+
* @see {@link @frak-labs/core-sdk!actions.referralInteraction | `referralInteraction()`} for more details on the automatic referral handling process
|
|
24
26
|
*/
|
|
25
27
|
declare function useReferralInteraction({
|
|
26
28
|
options
|
|
27
29
|
}?: {
|
|
28
30
|
options?: ProcessReferralOptions;
|
|
29
|
-
}):
|
|
31
|
+
}): Error | "success" | "idle" | "processing" | "no-referrer" | "self-referral";
|
|
30
32
|
//#endregion
|
|
31
33
|
//#region src/hook/useDisplayModal.d.ts
|
|
32
34
|
/** @ignore */
|
|
33
|
-
type MutationOptions$
|
|
35
|
+
type MutationOptions$4<T extends ModalStepTypes[]> = Omit<UseMutationOptions<ModalRpcStepsResultType<T>, FrakRpcError, DisplayModalParamsType<T> & {
|
|
36
|
+
placement?: string;
|
|
37
|
+
}>, "mutationFn" | "mutationKey">;
|
|
34
38
|
/** @inline */
|
|
35
39
|
interface UseDisplayModalParams<T extends ModalStepTypes[] = ModalStepTypes[]> {
|
|
36
40
|
/**
|
|
37
41
|
* Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
|
|
38
42
|
*/
|
|
39
|
-
mutations?: MutationOptions$
|
|
43
|
+
mutations?: MutationOptions$4<T>;
|
|
40
44
|
}
|
|
41
45
|
/**
|
|
42
46
|
* Hook that return a mutation helping to display a modal to the user
|
|
@@ -62,7 +66,44 @@ interface UseDisplayModalParams<T extends ModalStepTypes[] = ModalStepTypes[]> {
|
|
|
62
66
|
*/
|
|
63
67
|
declare function useDisplayModal<T extends ModalStepTypes[] = ModalStepTypes[]>({
|
|
64
68
|
mutations
|
|
65
|
-
}?: UseDisplayModalParams<T>): _tanstack_react_query0.UseMutationResult<ModalRpcStepsResultType<T>, FrakRpcError<undefined>, DisplayModalParamsType<T
|
|
69
|
+
}?: UseDisplayModalParams<T>): _$_tanstack_react_query0.UseMutationResult<ModalRpcStepsResultType<T>, FrakRpcError<undefined>, DisplayModalParamsType<T> & {
|
|
70
|
+
placement?: string;
|
|
71
|
+
}, unknown>;
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/hook/useDisplaySharingPage.d.ts
|
|
74
|
+
/** @ignore */
|
|
75
|
+
type MutationOptions$3 = Omit<UseMutationOptions<DisplaySharingPageResultType, FrakRpcError, DisplaySharingPageParamsType & {
|
|
76
|
+
placement?: string;
|
|
77
|
+
}>, "mutationFn" | "mutationKey">;
|
|
78
|
+
/** @inline */
|
|
79
|
+
interface UseDisplaySharingPageParams {
|
|
80
|
+
/**
|
|
81
|
+
* Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
|
|
82
|
+
*/
|
|
83
|
+
mutations?: MutationOptions$3;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Hook that return a mutation helping to display a sharing page to the user
|
|
87
|
+
*
|
|
88
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.displaySharingPage | `displaySharingPage()`} action
|
|
89
|
+
*
|
|
90
|
+
* @param args - Optional config object with `mutations` for customizing the underlying {@link @tanstack/react-query!useMutation | `useMutation()`}
|
|
91
|
+
*
|
|
92
|
+
* @group hooks
|
|
93
|
+
*
|
|
94
|
+
* @returns
|
|
95
|
+
* The mutation hook wrapping the `displaySharingPage()` action
|
|
96
|
+
* The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.DisplaySharingPageParamsType | `DisplaySharingPageParamsType`} with optional `placement`
|
|
97
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.DisplaySharingPageResultType | `DisplaySharingPageResultType`}
|
|
98
|
+
*
|
|
99
|
+
* @see {@link @frak-labs/core-sdk!actions.displaySharingPage | `displaySharingPage()`} for more info about the underlying action
|
|
100
|
+
* @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
|
|
101
|
+
*/
|
|
102
|
+
declare function useDisplaySharingPage({
|
|
103
|
+
mutations
|
|
104
|
+
}?: UseDisplaySharingPageParams): _$_tanstack_react_query0.UseMutationResult<DisplaySharingPageResultType, FrakRpcError<undefined>, DisplaySharingPageParamsType & {
|
|
105
|
+
placement?: string;
|
|
106
|
+
}, unknown>;
|
|
66
107
|
//#endregion
|
|
67
108
|
//#region src/hook/useFrakClient.d.ts
|
|
68
109
|
/**
|
|
@@ -70,7 +111,7 @@ declare function useDisplayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(
|
|
|
70
111
|
*
|
|
71
112
|
* @group hooks
|
|
72
113
|
*/
|
|
73
|
-
declare function useFrakClient(): _frak_labs_core_sdk0.FrakClient | undefined;
|
|
114
|
+
declare function useFrakClient(): _$_frak_labs_core_sdk0.FrakClient | undefined;
|
|
74
115
|
//#endregion
|
|
75
116
|
//#region src/hook/useFrakConfig.d.ts
|
|
76
117
|
/**
|
|
@@ -81,17 +122,21 @@ declare function useFrakClient(): _frak_labs_core_sdk0.FrakClient | undefined;
|
|
|
81
122
|
* @see {@link @frak-labs/react-sdk!FrakConfigProvider | FrakConfigProvider} for the config provider
|
|
82
123
|
* @see {@link @frak-labs/core-sdk!index.FrakWalletSdkConfig | FrakWalletSdkConfig} for the config type
|
|
83
124
|
*/
|
|
84
|
-
declare function useFrakConfig(): _frak_labs_core_sdk0.FrakWalletSdkConfig;
|
|
125
|
+
declare function useFrakConfig(): _$_frak_labs_core_sdk0.FrakWalletSdkConfig;
|
|
85
126
|
//#endregion
|
|
86
127
|
//#region src/hook/useGetMerchantInformation.d.ts
|
|
87
128
|
/** @ignore */
|
|
88
|
-
type QueryOptions = Omit<UseQueryOptions<GetMerchantInformationReturnType, FrakRpcError, GetMerchantInformationReturnType>, "queryKey" | "queryFn">;
|
|
129
|
+
type QueryOptions$2 = Omit<UseQueryOptions<GetMerchantInformationReturnType, FrakRpcError, GetMerchantInformationReturnType>, "queryKey" | "queryFn">;
|
|
89
130
|
/** @inline */
|
|
90
131
|
interface UseGetMerchantInformationParams {
|
|
91
132
|
/**
|
|
92
133
|
* Optional query options, see {@link @tanstack/react-query!useQuery | `useQuery()`} for more infos
|
|
93
134
|
*/
|
|
94
|
-
query?: QueryOptions;
|
|
135
|
+
query?: QueryOptions$2;
|
|
136
|
+
/**
|
|
137
|
+
* Time in ms to cache the result at the core SDK level. Default: 30_000 (30s). Set to 0 to disable.
|
|
138
|
+
*/
|
|
139
|
+
cacheTime?: number;
|
|
95
140
|
}
|
|
96
141
|
/**
|
|
97
142
|
* Hook that return a query helping to get the current merchant information
|
|
@@ -110,8 +155,84 @@ interface UseGetMerchantInformationParams {
|
|
|
110
155
|
* @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery options and response
|
|
111
156
|
*/
|
|
112
157
|
declare function useGetMerchantInformation({
|
|
113
|
-
query
|
|
114
|
-
|
|
158
|
+
query,
|
|
159
|
+
cacheTime
|
|
160
|
+
}?: UseGetMerchantInformationParams): _$_tanstack_react_query0.UseQueryResult<GetMerchantInformationReturnType, FrakRpcError<undefined>>;
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/hook/useGetMergeToken.d.ts
|
|
163
|
+
/** @ignore */
|
|
164
|
+
type QueryOptions$1 = Omit<UseQueryOptions<string | null, FrakRpcError, string | null>, "queryKey" | "queryFn">;
|
|
165
|
+
/** @inline */
|
|
166
|
+
interface UseGetMergeTokenParams {
|
|
167
|
+
/**
|
|
168
|
+
* Optional query options, see {@link @tanstack/react-query!useQuery | `useQuery()`} for more infos
|
|
169
|
+
*/
|
|
170
|
+
query?: QueryOptions$1;
|
|
171
|
+
/**
|
|
172
|
+
* Time in ms to cache the result at the core SDK level. Default: 30_000 (30s). Set to 0 to disable.
|
|
173
|
+
*/
|
|
174
|
+
cacheTime?: number;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Hook that return a query to fetch a merge token for the current anonymous identity
|
|
178
|
+
*
|
|
179
|
+
* Used by in-app browser redirect flows to preserve identity
|
|
180
|
+
* when switching from a WebView to the system browser.
|
|
181
|
+
*
|
|
182
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.getMergeToken | `getMergeToken()`} action
|
|
183
|
+
*
|
|
184
|
+
* @param args - Optional config object with `query` for customizing the underlying {@link @tanstack/react-query!useQuery | `useQuery()`}
|
|
185
|
+
*
|
|
186
|
+
* @group hooks
|
|
187
|
+
*
|
|
188
|
+
* @returns
|
|
189
|
+
* The query hook wrapping the `getMergeToken()` action
|
|
190
|
+
* The `data` result is a `string | null`
|
|
191
|
+
*
|
|
192
|
+
* @see {@link @frak-labs/core-sdk!actions.getMergeToken | `getMergeToken()`} for more info about the underlying action
|
|
193
|
+
* @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery options and response
|
|
194
|
+
*/
|
|
195
|
+
declare function useGetMergeToken({
|
|
196
|
+
query,
|
|
197
|
+
cacheTime
|
|
198
|
+
}?: UseGetMergeTokenParams): _$_tanstack_react_query0.UseQueryResult<string | null, FrakRpcError<undefined>>;
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/hook/useGetUserReferralStatus.d.ts
|
|
201
|
+
/** @ignore */
|
|
202
|
+
type QueryOptions = Omit<UseQueryOptions<UserReferralStatusType | null, FrakRpcError, UserReferralStatusType | null>, "queryKey" | "queryFn">;
|
|
203
|
+
/** @inline */
|
|
204
|
+
interface UseGetUserReferralStatusParams {
|
|
205
|
+
/**
|
|
206
|
+
* Optional query options, see {@link @tanstack/react-query!useQuery | `useQuery()`} for more infos
|
|
207
|
+
*/
|
|
208
|
+
query?: QueryOptions;
|
|
209
|
+
/**
|
|
210
|
+
* Time in ms to cache the result at the core SDK level. Default: 30_000 (30s). Set to 0 to disable.
|
|
211
|
+
*/
|
|
212
|
+
cacheTime?: number;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Hook that return a query to fetch the current user's referral status on the current merchant
|
|
216
|
+
*
|
|
217
|
+
* Returns `null` when the user's identity cannot be resolved.
|
|
218
|
+
*
|
|
219
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.getUserReferralStatus | `getUserReferralStatus()`} action
|
|
220
|
+
*
|
|
221
|
+
* @param args - Optional config object with `query` for customizing the underlying {@link @tanstack/react-query!useQuery | `useQuery()`}
|
|
222
|
+
*
|
|
223
|
+
* @group hooks
|
|
224
|
+
*
|
|
225
|
+
* @returns
|
|
226
|
+
* The query hook wrapping the `getUserReferralStatus()` action
|
|
227
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.UserReferralStatusType | `UserReferralStatusType`} or `null`
|
|
228
|
+
*
|
|
229
|
+
* @see {@link @frak-labs/core-sdk!actions.getUserReferralStatus | `getUserReferralStatus()`} for more info about the underlying action
|
|
230
|
+
* @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery options and response
|
|
231
|
+
*/
|
|
232
|
+
declare function useGetUserReferralStatus({
|
|
233
|
+
query,
|
|
234
|
+
cacheTime
|
|
235
|
+
}?: UseGetUserReferralStatusParams): _$_tanstack_react_query0.UseQueryResult<UserReferralStatusType | null, FrakRpcError<undefined>>;
|
|
115
236
|
//#endregion
|
|
116
237
|
//#region src/hook/useOpenSso.d.ts
|
|
117
238
|
/** @ignore */
|
|
@@ -142,7 +263,7 @@ interface UseOpenSsoParams {
|
|
|
142
263
|
*/
|
|
143
264
|
declare function useOpenSso({
|
|
144
265
|
mutations
|
|
145
|
-
}?: UseOpenSsoParams): _tanstack_react_query0.UseMutationResult<OpenSsoReturnType, FrakRpcError<undefined>, OpenSsoParamsType, unknown>;
|
|
266
|
+
}?: UseOpenSsoParams): _$_tanstack_react_query0.UseMutationResult<OpenSsoReturnType, FrakRpcError<undefined>, OpenSsoParamsType, unknown>;
|
|
146
267
|
//#endregion
|
|
147
268
|
//#region src/hook/usePrepareSso.d.ts
|
|
148
269
|
/**
|
|
@@ -181,7 +302,7 @@ declare function useOpenSso({
|
|
|
181
302
|
* @see {@link @frak-labs/core-sdk!actions.prepareSso | `prepareSso()`} for the underlying action
|
|
182
303
|
* @see {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} for the recommended high-level API
|
|
183
304
|
*/
|
|
184
|
-
declare function usePrepareSso(params: PrepareSsoParamsType): _tanstack_react_query0.UseQueryResult<_frak_labs_core_sdk0.PrepareSsoReturnType, Error>;
|
|
305
|
+
declare function usePrepareSso(params: PrepareSsoParamsType): _$_tanstack_react_query0.UseQueryResult<_$_frak_labs_core_sdk0.PrepareSsoReturnType, Error>;
|
|
185
306
|
//#endregion
|
|
186
307
|
//#region src/hook/useSendTransaction.d.ts
|
|
187
308
|
/** @ignore */
|
|
@@ -212,7 +333,24 @@ interface UseSendTransactionParams {
|
|
|
212
333
|
*/
|
|
213
334
|
declare function useSendTransactionAction({
|
|
214
335
|
mutations
|
|
215
|
-
}?: UseSendTransactionParams): _tanstack_react_query0.UseMutationResult<SendTransactionReturnType, FrakRpcError<undefined>, SendTransactionParams, unknown>;
|
|
336
|
+
}?: UseSendTransactionParams): _$_tanstack_react_query0.UseMutationResult<SendTransactionReturnType, FrakRpcError<undefined>, SendTransactionParams, unknown>;
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region src/hook/useSetupReferral.d.ts
|
|
339
|
+
/**
|
|
340
|
+
* Hook that automatically processes referral context and emits a DOM event on success
|
|
341
|
+
*
|
|
342
|
+
* Runs once when the Frak client becomes available. Fire-and-forget — the referral
|
|
343
|
+
* result is tracked via a `"frak:referral-success"` DOM event on `window`, not via
|
|
344
|
+
* the returned query data.
|
|
345
|
+
*
|
|
346
|
+
* @group hooks
|
|
347
|
+
*
|
|
348
|
+
* @returns The query handle (data is not meaningful — listen for `REFERRAL_SUCCESS_EVENT` on `window` instead)
|
|
349
|
+
*
|
|
350
|
+
* @see {@link @frak-labs/core-sdk!actions.setupReferral | `setupReferral()`} for more info about the underlying action
|
|
351
|
+
* @see {@link @frak-labs/core-sdk!actions.REFERRAL_SUCCESS_EVENT | `REFERRAL_SUCCESS_EVENT`} for the event name constant
|
|
352
|
+
*/
|
|
353
|
+
declare function useSetupReferral(): _$_tanstack_react_query0.UseQueryResult<null, Error>;
|
|
216
354
|
//#endregion
|
|
217
355
|
//#region src/hook/useSiweAuthenticate.d.ts
|
|
218
356
|
/** @inline */
|
|
@@ -243,7 +381,7 @@ interface UseSiweAuthenticateParams {
|
|
|
243
381
|
*/
|
|
244
382
|
declare function useSiweAuthenticate({
|
|
245
383
|
mutations
|
|
246
|
-
}?: UseSiweAuthenticateParams): _tanstack_react_query0.UseMutationResult<SiweAuthenticateReturnType, FrakRpcError<undefined>, SiweAuthenticateModalParams, unknown>;
|
|
384
|
+
}?: UseSiweAuthenticateParams): _$_tanstack_react_query0.UseMutationResult<SiweAuthenticateReturnType, FrakRpcError<undefined>, SiweAuthenticateModalParams, unknown>;
|
|
247
385
|
//#endregion
|
|
248
386
|
//#region src/hook/useWalletStatus.d.ts
|
|
249
387
|
/**
|
|
@@ -260,14 +398,14 @@ declare function useSiweAuthenticate({
|
|
|
260
398
|
* @see {@link @frak-labs/core-sdk!actions.watchWalletStatus | `watchWalletStatus()`} for more info about the underlying action
|
|
261
399
|
* @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery response
|
|
262
400
|
*/
|
|
263
|
-
declare function useWalletStatus(): _tanstack_react_query0.UseQueryResult<WalletStatusReturnType, Error>;
|
|
401
|
+
declare function useWalletStatus(): _$_tanstack_react_query0.UseQueryResult<WalletStatusReturnType, Error>;
|
|
264
402
|
//#endregion
|
|
265
403
|
//#region src/provider/FrakConfigProvider.d.ts
|
|
266
404
|
/**
|
|
267
405
|
* The context that will keep the Frak Wallet SDK configuration
|
|
268
406
|
* @ignore
|
|
269
407
|
*/
|
|
270
|
-
declare const FrakConfigContext: react.Context<FrakWalletSdkConfig | undefined>;
|
|
408
|
+
declare const FrakConfigContext: _$react.Context<FrakWalletSdkConfig | undefined>;
|
|
271
409
|
/**
|
|
272
410
|
* Props to instantiate the Frak Wallet SDK configuration provider
|
|
273
411
|
*
|
|
@@ -289,14 +427,14 @@ type FrakConfigProviderProps = {
|
|
|
289
427
|
*
|
|
290
428
|
* @param parameters
|
|
291
429
|
*/
|
|
292
|
-
declare function FrakConfigProvider(parameters: PropsWithChildren<FrakConfigProviderProps>): react.FunctionComponentElement<react.ProviderProps<FrakWalletSdkConfig | undefined>>;
|
|
430
|
+
declare function FrakConfigProvider(parameters: PropsWithChildren<FrakConfigProviderProps>): _$react.FunctionComponentElement<_$react.ProviderProps<FrakWalletSdkConfig | undefined>>;
|
|
293
431
|
//#endregion
|
|
294
432
|
//#region src/provider/FrakIFrameClientProvider.d.ts
|
|
295
433
|
/**
|
|
296
434
|
* The context that will keep the Frak Wallet SDK client
|
|
297
435
|
* @ignore
|
|
298
436
|
*/
|
|
299
|
-
declare const FrakIFrameClientContext: react.Context<FrakClient | undefined>;
|
|
437
|
+
declare const FrakIFrameClientContext: _$react.Context<FrakClient | undefined>;
|
|
300
438
|
/**
|
|
301
439
|
* Props to instantiate the Frak Wallet SDK configuration provider
|
|
302
440
|
*
|
|
@@ -324,6 +462,6 @@ declare function FrakIFrameClientProvider({
|
|
|
324
462
|
}: {
|
|
325
463
|
style?: CSSProperties;
|
|
326
464
|
children?: ReactNode;
|
|
327
|
-
}): react.FunctionComponentElement<react.FragmentProps>;
|
|
465
|
+
}): _$react.FunctionComponentElement<_$react.FragmentProps>;
|
|
328
466
|
//#endregion
|
|
329
|
-
export { FrakConfigContext, FrakConfigProvider, type FrakConfigProviderProps, FrakIFrameClientContext, type FrakIFrameClientProps, FrakIFrameClientProvider, useDisplayModal, useFrakClient, useFrakConfig, useGetMerchantInformation, useOpenSso, usePrepareSso, useReferralInteraction, useSendTransactionAction, useSiweAuthenticate, useWalletStatus };
|
|
467
|
+
export { FrakConfigContext, FrakConfigProvider, type FrakConfigProviderProps, FrakIFrameClientContext, type FrakIFrameClientProps, FrakIFrameClientProvider, useDisplayModal, useDisplaySharingPage, useFrakClient, useFrakConfig, useGetMerchantInformation, useGetMergeToken, useGetUserReferralStatus, useOpenSso, usePrepareSso, useReferralInteraction, useSendTransactionAction, useSetupReferral, useSiweAuthenticate, useWalletStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { ProcessReferralOptions, SendTransactionParams, SiweAuthenticateModalParams } from "@frak-labs/core-sdk/actions";
|
|
2
2
|
import { FrakRpcError } from "@frak-labs/frame-connector";
|
|
3
|
-
import * as _tanstack_react_query0 from "@tanstack/react-query";
|
|
3
|
+
import * as _$_tanstack_react_query0 from "@tanstack/react-query";
|
|
4
4
|
import { UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
|
|
5
|
-
import * as react from "react";
|
|
5
|
+
import * as _$react from "react";
|
|
6
6
|
import { CSSProperties, PropsWithChildren, ReactNode } from "react";
|
|
7
|
-
import * as _frak_labs_core_sdk0 from "@frak-labs/core-sdk";
|
|
8
|
-
import { DisplayModalParamsType, FrakClient, FrakWalletSdkConfig, GetMerchantInformationReturnType, ModalRpcStepsResultType, ModalStepTypes, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, SendTransactionReturnType, SiweAuthenticateReturnType, WalletStatusReturnType } from "@frak-labs/core-sdk";
|
|
7
|
+
import * as _$_frak_labs_core_sdk0 from "@frak-labs/core-sdk";
|
|
8
|
+
import { DisplayModalParamsType, DisplaySharingPageParamsType, DisplaySharingPageResultType, FrakClient, FrakWalletSdkConfig, GetMerchantInformationReturnType, ModalRpcStepsResultType, ModalStepTypes, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, SendTransactionReturnType, SiweAuthenticateReturnType, UserReferralStatusType, WalletStatusReturnType } from "@frak-labs/core-sdk";
|
|
9
9
|
|
|
10
10
|
//#region src/hook/helper/useReferralInteraction.d.ts
|
|
11
11
|
/**
|
|
12
12
|
* Helper hook to automatically submit a referral interaction when detected
|
|
13
13
|
*
|
|
14
|
+
* Runs once when the Frak client becomes available.
|
|
15
|
+
*
|
|
14
16
|
* @group hooks
|
|
15
17
|
*
|
|
16
18
|
* @param args
|
|
@@ -20,23 +22,25 @@ import { DisplayModalParamsType, FrakClient, FrakWalletSdkConfig, GetMerchantInf
|
|
|
20
22
|
*
|
|
21
23
|
* @description This function will automatically handle the referral interaction process
|
|
22
24
|
*
|
|
23
|
-
* @see {@link @frak-labs/core-sdk!actions.
|
|
25
|
+
* @see {@link @frak-labs/core-sdk!actions.referralInteraction | `referralInteraction()`} for more details on the automatic referral handling process
|
|
24
26
|
*/
|
|
25
27
|
declare function useReferralInteraction({
|
|
26
28
|
options
|
|
27
29
|
}?: {
|
|
28
30
|
options?: ProcessReferralOptions;
|
|
29
|
-
}):
|
|
31
|
+
}): Error | "success" | "idle" | "processing" | "no-referrer" | "self-referral";
|
|
30
32
|
//#endregion
|
|
31
33
|
//#region src/hook/useDisplayModal.d.ts
|
|
32
34
|
/** @ignore */
|
|
33
|
-
type MutationOptions$
|
|
35
|
+
type MutationOptions$4<T extends ModalStepTypes[]> = Omit<UseMutationOptions<ModalRpcStepsResultType<T>, FrakRpcError, DisplayModalParamsType<T> & {
|
|
36
|
+
placement?: string;
|
|
37
|
+
}>, "mutationFn" | "mutationKey">;
|
|
34
38
|
/** @inline */
|
|
35
39
|
interface UseDisplayModalParams<T extends ModalStepTypes[] = ModalStepTypes[]> {
|
|
36
40
|
/**
|
|
37
41
|
* Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
|
|
38
42
|
*/
|
|
39
|
-
mutations?: MutationOptions$
|
|
43
|
+
mutations?: MutationOptions$4<T>;
|
|
40
44
|
}
|
|
41
45
|
/**
|
|
42
46
|
* Hook that return a mutation helping to display a modal to the user
|
|
@@ -62,7 +66,44 @@ interface UseDisplayModalParams<T extends ModalStepTypes[] = ModalStepTypes[]> {
|
|
|
62
66
|
*/
|
|
63
67
|
declare function useDisplayModal<T extends ModalStepTypes[] = ModalStepTypes[]>({
|
|
64
68
|
mutations
|
|
65
|
-
}?: UseDisplayModalParams<T>): _tanstack_react_query0.UseMutationResult<ModalRpcStepsResultType<T>, FrakRpcError<undefined>, DisplayModalParamsType<T
|
|
69
|
+
}?: UseDisplayModalParams<T>): _$_tanstack_react_query0.UseMutationResult<ModalRpcStepsResultType<T>, FrakRpcError<undefined>, DisplayModalParamsType<T> & {
|
|
70
|
+
placement?: string;
|
|
71
|
+
}, unknown>;
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/hook/useDisplaySharingPage.d.ts
|
|
74
|
+
/** @ignore */
|
|
75
|
+
type MutationOptions$3 = Omit<UseMutationOptions<DisplaySharingPageResultType, FrakRpcError, DisplaySharingPageParamsType & {
|
|
76
|
+
placement?: string;
|
|
77
|
+
}>, "mutationFn" | "mutationKey">;
|
|
78
|
+
/** @inline */
|
|
79
|
+
interface UseDisplaySharingPageParams {
|
|
80
|
+
/**
|
|
81
|
+
* Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
|
|
82
|
+
*/
|
|
83
|
+
mutations?: MutationOptions$3;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Hook that return a mutation helping to display a sharing page to the user
|
|
87
|
+
*
|
|
88
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.displaySharingPage | `displaySharingPage()`} action
|
|
89
|
+
*
|
|
90
|
+
* @param args - Optional config object with `mutations` for customizing the underlying {@link @tanstack/react-query!useMutation | `useMutation()`}
|
|
91
|
+
*
|
|
92
|
+
* @group hooks
|
|
93
|
+
*
|
|
94
|
+
* @returns
|
|
95
|
+
* The mutation hook wrapping the `displaySharingPage()` action
|
|
96
|
+
* The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.DisplaySharingPageParamsType | `DisplaySharingPageParamsType`} with optional `placement`
|
|
97
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.DisplaySharingPageResultType | `DisplaySharingPageResultType`}
|
|
98
|
+
*
|
|
99
|
+
* @see {@link @frak-labs/core-sdk!actions.displaySharingPage | `displaySharingPage()`} for more info about the underlying action
|
|
100
|
+
* @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
|
|
101
|
+
*/
|
|
102
|
+
declare function useDisplaySharingPage({
|
|
103
|
+
mutations
|
|
104
|
+
}?: UseDisplaySharingPageParams): _$_tanstack_react_query0.UseMutationResult<DisplaySharingPageResultType, FrakRpcError<undefined>, DisplaySharingPageParamsType & {
|
|
105
|
+
placement?: string;
|
|
106
|
+
}, unknown>;
|
|
66
107
|
//#endregion
|
|
67
108
|
//#region src/hook/useFrakClient.d.ts
|
|
68
109
|
/**
|
|
@@ -70,7 +111,7 @@ declare function useDisplayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(
|
|
|
70
111
|
*
|
|
71
112
|
* @group hooks
|
|
72
113
|
*/
|
|
73
|
-
declare function useFrakClient(): _frak_labs_core_sdk0.FrakClient | undefined;
|
|
114
|
+
declare function useFrakClient(): _$_frak_labs_core_sdk0.FrakClient | undefined;
|
|
74
115
|
//#endregion
|
|
75
116
|
//#region src/hook/useFrakConfig.d.ts
|
|
76
117
|
/**
|
|
@@ -81,17 +122,21 @@ declare function useFrakClient(): _frak_labs_core_sdk0.FrakClient | undefined;
|
|
|
81
122
|
* @see {@link @frak-labs/react-sdk!FrakConfigProvider | FrakConfigProvider} for the config provider
|
|
82
123
|
* @see {@link @frak-labs/core-sdk!index.FrakWalletSdkConfig | FrakWalletSdkConfig} for the config type
|
|
83
124
|
*/
|
|
84
|
-
declare function useFrakConfig(): _frak_labs_core_sdk0.FrakWalletSdkConfig;
|
|
125
|
+
declare function useFrakConfig(): _$_frak_labs_core_sdk0.FrakWalletSdkConfig;
|
|
85
126
|
//#endregion
|
|
86
127
|
//#region src/hook/useGetMerchantInformation.d.ts
|
|
87
128
|
/** @ignore */
|
|
88
|
-
type QueryOptions = Omit<UseQueryOptions<GetMerchantInformationReturnType, FrakRpcError, GetMerchantInformationReturnType>, "queryKey" | "queryFn">;
|
|
129
|
+
type QueryOptions$2 = Omit<UseQueryOptions<GetMerchantInformationReturnType, FrakRpcError, GetMerchantInformationReturnType>, "queryKey" | "queryFn">;
|
|
89
130
|
/** @inline */
|
|
90
131
|
interface UseGetMerchantInformationParams {
|
|
91
132
|
/**
|
|
92
133
|
* Optional query options, see {@link @tanstack/react-query!useQuery | `useQuery()`} for more infos
|
|
93
134
|
*/
|
|
94
|
-
query?: QueryOptions;
|
|
135
|
+
query?: QueryOptions$2;
|
|
136
|
+
/**
|
|
137
|
+
* Time in ms to cache the result at the core SDK level. Default: 30_000 (30s). Set to 0 to disable.
|
|
138
|
+
*/
|
|
139
|
+
cacheTime?: number;
|
|
95
140
|
}
|
|
96
141
|
/**
|
|
97
142
|
* Hook that return a query helping to get the current merchant information
|
|
@@ -110,8 +155,84 @@ interface UseGetMerchantInformationParams {
|
|
|
110
155
|
* @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery options and response
|
|
111
156
|
*/
|
|
112
157
|
declare function useGetMerchantInformation({
|
|
113
|
-
query
|
|
114
|
-
|
|
158
|
+
query,
|
|
159
|
+
cacheTime
|
|
160
|
+
}?: UseGetMerchantInformationParams): _$_tanstack_react_query0.UseQueryResult<GetMerchantInformationReturnType, FrakRpcError<undefined>>;
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/hook/useGetMergeToken.d.ts
|
|
163
|
+
/** @ignore */
|
|
164
|
+
type QueryOptions$1 = Omit<UseQueryOptions<string | null, FrakRpcError, string | null>, "queryKey" | "queryFn">;
|
|
165
|
+
/** @inline */
|
|
166
|
+
interface UseGetMergeTokenParams {
|
|
167
|
+
/**
|
|
168
|
+
* Optional query options, see {@link @tanstack/react-query!useQuery | `useQuery()`} for more infos
|
|
169
|
+
*/
|
|
170
|
+
query?: QueryOptions$1;
|
|
171
|
+
/**
|
|
172
|
+
* Time in ms to cache the result at the core SDK level. Default: 30_000 (30s). Set to 0 to disable.
|
|
173
|
+
*/
|
|
174
|
+
cacheTime?: number;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Hook that return a query to fetch a merge token for the current anonymous identity
|
|
178
|
+
*
|
|
179
|
+
* Used by in-app browser redirect flows to preserve identity
|
|
180
|
+
* when switching from a WebView to the system browser.
|
|
181
|
+
*
|
|
182
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.getMergeToken | `getMergeToken()`} action
|
|
183
|
+
*
|
|
184
|
+
* @param args - Optional config object with `query` for customizing the underlying {@link @tanstack/react-query!useQuery | `useQuery()`}
|
|
185
|
+
*
|
|
186
|
+
* @group hooks
|
|
187
|
+
*
|
|
188
|
+
* @returns
|
|
189
|
+
* The query hook wrapping the `getMergeToken()` action
|
|
190
|
+
* The `data` result is a `string | null`
|
|
191
|
+
*
|
|
192
|
+
* @see {@link @frak-labs/core-sdk!actions.getMergeToken | `getMergeToken()`} for more info about the underlying action
|
|
193
|
+
* @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery options and response
|
|
194
|
+
*/
|
|
195
|
+
declare function useGetMergeToken({
|
|
196
|
+
query,
|
|
197
|
+
cacheTime
|
|
198
|
+
}?: UseGetMergeTokenParams): _$_tanstack_react_query0.UseQueryResult<string | null, FrakRpcError<undefined>>;
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/hook/useGetUserReferralStatus.d.ts
|
|
201
|
+
/** @ignore */
|
|
202
|
+
type QueryOptions = Omit<UseQueryOptions<UserReferralStatusType | null, FrakRpcError, UserReferralStatusType | null>, "queryKey" | "queryFn">;
|
|
203
|
+
/** @inline */
|
|
204
|
+
interface UseGetUserReferralStatusParams {
|
|
205
|
+
/**
|
|
206
|
+
* Optional query options, see {@link @tanstack/react-query!useQuery | `useQuery()`} for more infos
|
|
207
|
+
*/
|
|
208
|
+
query?: QueryOptions;
|
|
209
|
+
/**
|
|
210
|
+
* Time in ms to cache the result at the core SDK level. Default: 30_000 (30s). Set to 0 to disable.
|
|
211
|
+
*/
|
|
212
|
+
cacheTime?: number;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Hook that return a query to fetch the current user's referral status on the current merchant
|
|
216
|
+
*
|
|
217
|
+
* Returns `null` when the user's identity cannot be resolved.
|
|
218
|
+
*
|
|
219
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.getUserReferralStatus | `getUserReferralStatus()`} action
|
|
220
|
+
*
|
|
221
|
+
* @param args - Optional config object with `query` for customizing the underlying {@link @tanstack/react-query!useQuery | `useQuery()`}
|
|
222
|
+
*
|
|
223
|
+
* @group hooks
|
|
224
|
+
*
|
|
225
|
+
* @returns
|
|
226
|
+
* The query hook wrapping the `getUserReferralStatus()` action
|
|
227
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.UserReferralStatusType | `UserReferralStatusType`} or `null`
|
|
228
|
+
*
|
|
229
|
+
* @see {@link @frak-labs/core-sdk!actions.getUserReferralStatus | `getUserReferralStatus()`} for more info about the underlying action
|
|
230
|
+
* @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery options and response
|
|
231
|
+
*/
|
|
232
|
+
declare function useGetUserReferralStatus({
|
|
233
|
+
query,
|
|
234
|
+
cacheTime
|
|
235
|
+
}?: UseGetUserReferralStatusParams): _$_tanstack_react_query0.UseQueryResult<UserReferralStatusType | null, FrakRpcError<undefined>>;
|
|
115
236
|
//#endregion
|
|
116
237
|
//#region src/hook/useOpenSso.d.ts
|
|
117
238
|
/** @ignore */
|
|
@@ -142,7 +263,7 @@ interface UseOpenSsoParams {
|
|
|
142
263
|
*/
|
|
143
264
|
declare function useOpenSso({
|
|
144
265
|
mutations
|
|
145
|
-
}?: UseOpenSsoParams): _tanstack_react_query0.UseMutationResult<OpenSsoReturnType, FrakRpcError<undefined>, OpenSsoParamsType, unknown>;
|
|
266
|
+
}?: UseOpenSsoParams): _$_tanstack_react_query0.UseMutationResult<OpenSsoReturnType, FrakRpcError<undefined>, OpenSsoParamsType, unknown>;
|
|
146
267
|
//#endregion
|
|
147
268
|
//#region src/hook/usePrepareSso.d.ts
|
|
148
269
|
/**
|
|
@@ -181,7 +302,7 @@ declare function useOpenSso({
|
|
|
181
302
|
* @see {@link @frak-labs/core-sdk!actions.prepareSso | `prepareSso()`} for the underlying action
|
|
182
303
|
* @see {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} for the recommended high-level API
|
|
183
304
|
*/
|
|
184
|
-
declare function usePrepareSso(params: PrepareSsoParamsType): _tanstack_react_query0.UseQueryResult<_frak_labs_core_sdk0.PrepareSsoReturnType, Error>;
|
|
305
|
+
declare function usePrepareSso(params: PrepareSsoParamsType): _$_tanstack_react_query0.UseQueryResult<_$_frak_labs_core_sdk0.PrepareSsoReturnType, Error>;
|
|
185
306
|
//#endregion
|
|
186
307
|
//#region src/hook/useSendTransaction.d.ts
|
|
187
308
|
/** @ignore */
|
|
@@ -212,7 +333,24 @@ interface UseSendTransactionParams {
|
|
|
212
333
|
*/
|
|
213
334
|
declare function useSendTransactionAction({
|
|
214
335
|
mutations
|
|
215
|
-
}?: UseSendTransactionParams): _tanstack_react_query0.UseMutationResult<SendTransactionReturnType, FrakRpcError<undefined>, SendTransactionParams, unknown>;
|
|
336
|
+
}?: UseSendTransactionParams): _$_tanstack_react_query0.UseMutationResult<SendTransactionReturnType, FrakRpcError<undefined>, SendTransactionParams, unknown>;
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region src/hook/useSetupReferral.d.ts
|
|
339
|
+
/**
|
|
340
|
+
* Hook that automatically processes referral context and emits a DOM event on success
|
|
341
|
+
*
|
|
342
|
+
* Runs once when the Frak client becomes available. Fire-and-forget — the referral
|
|
343
|
+
* result is tracked via a `"frak:referral-success"` DOM event on `window`, not via
|
|
344
|
+
* the returned query data.
|
|
345
|
+
*
|
|
346
|
+
* @group hooks
|
|
347
|
+
*
|
|
348
|
+
* @returns The query handle (data is not meaningful — listen for `REFERRAL_SUCCESS_EVENT` on `window` instead)
|
|
349
|
+
*
|
|
350
|
+
* @see {@link @frak-labs/core-sdk!actions.setupReferral | `setupReferral()`} for more info about the underlying action
|
|
351
|
+
* @see {@link @frak-labs/core-sdk!actions.REFERRAL_SUCCESS_EVENT | `REFERRAL_SUCCESS_EVENT`} for the event name constant
|
|
352
|
+
*/
|
|
353
|
+
declare function useSetupReferral(): _$_tanstack_react_query0.UseQueryResult<null, Error>;
|
|
216
354
|
//#endregion
|
|
217
355
|
//#region src/hook/useSiweAuthenticate.d.ts
|
|
218
356
|
/** @inline */
|
|
@@ -243,7 +381,7 @@ interface UseSiweAuthenticateParams {
|
|
|
243
381
|
*/
|
|
244
382
|
declare function useSiweAuthenticate({
|
|
245
383
|
mutations
|
|
246
|
-
}?: UseSiweAuthenticateParams): _tanstack_react_query0.UseMutationResult<SiweAuthenticateReturnType, FrakRpcError<undefined>, SiweAuthenticateModalParams, unknown>;
|
|
384
|
+
}?: UseSiweAuthenticateParams): _$_tanstack_react_query0.UseMutationResult<SiweAuthenticateReturnType, FrakRpcError<undefined>, SiweAuthenticateModalParams, unknown>;
|
|
247
385
|
//#endregion
|
|
248
386
|
//#region src/hook/useWalletStatus.d.ts
|
|
249
387
|
/**
|
|
@@ -260,14 +398,14 @@ declare function useSiweAuthenticate({
|
|
|
260
398
|
* @see {@link @frak-labs/core-sdk!actions.watchWalletStatus | `watchWalletStatus()`} for more info about the underlying action
|
|
261
399
|
* @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery response
|
|
262
400
|
*/
|
|
263
|
-
declare function useWalletStatus(): _tanstack_react_query0.UseQueryResult<WalletStatusReturnType, Error>;
|
|
401
|
+
declare function useWalletStatus(): _$_tanstack_react_query0.UseQueryResult<WalletStatusReturnType, Error>;
|
|
264
402
|
//#endregion
|
|
265
403
|
//#region src/provider/FrakConfigProvider.d.ts
|
|
266
404
|
/**
|
|
267
405
|
* The context that will keep the Frak Wallet SDK configuration
|
|
268
406
|
* @ignore
|
|
269
407
|
*/
|
|
270
|
-
declare const FrakConfigContext: react.Context<FrakWalletSdkConfig | undefined>;
|
|
408
|
+
declare const FrakConfigContext: _$react.Context<FrakWalletSdkConfig | undefined>;
|
|
271
409
|
/**
|
|
272
410
|
* Props to instantiate the Frak Wallet SDK configuration provider
|
|
273
411
|
*
|
|
@@ -289,14 +427,14 @@ type FrakConfigProviderProps = {
|
|
|
289
427
|
*
|
|
290
428
|
* @param parameters
|
|
291
429
|
*/
|
|
292
|
-
declare function FrakConfigProvider(parameters: PropsWithChildren<FrakConfigProviderProps>): react.FunctionComponentElement<react.ProviderProps<FrakWalletSdkConfig | undefined>>;
|
|
430
|
+
declare function FrakConfigProvider(parameters: PropsWithChildren<FrakConfigProviderProps>): _$react.FunctionComponentElement<_$react.ProviderProps<FrakWalletSdkConfig | undefined>>;
|
|
293
431
|
//#endregion
|
|
294
432
|
//#region src/provider/FrakIFrameClientProvider.d.ts
|
|
295
433
|
/**
|
|
296
434
|
* The context that will keep the Frak Wallet SDK client
|
|
297
435
|
* @ignore
|
|
298
436
|
*/
|
|
299
|
-
declare const FrakIFrameClientContext: react.Context<FrakClient | undefined>;
|
|
437
|
+
declare const FrakIFrameClientContext: _$react.Context<FrakClient | undefined>;
|
|
300
438
|
/**
|
|
301
439
|
* Props to instantiate the Frak Wallet SDK configuration provider
|
|
302
440
|
*
|
|
@@ -324,6 +462,6 @@ declare function FrakIFrameClientProvider({
|
|
|
324
462
|
}: {
|
|
325
463
|
style?: CSSProperties;
|
|
326
464
|
children?: ReactNode;
|
|
327
|
-
}): react.FunctionComponentElement<react.FragmentProps>;
|
|
465
|
+
}): _$react.FunctionComponentElement<_$react.FragmentProps>;
|
|
328
466
|
//#endregion
|
|
329
|
-
export { FrakConfigContext, FrakConfigProvider, type FrakConfigProviderProps, FrakIFrameClientContext, type FrakIFrameClientProps, FrakIFrameClientProvider, useDisplayModal, useFrakClient, useFrakConfig, useGetMerchantInformation, useOpenSso, usePrepareSso, useReferralInteraction, useSendTransactionAction, useSiweAuthenticate, useWalletStatus };
|
|
467
|
+
export { FrakConfigContext, FrakConfigProvider, type FrakConfigProviderProps, FrakIFrameClientContext, type FrakIFrameClientProps, FrakIFrameClientProvider, useDisplayModal, useDisplaySharingPage, useFrakClient, useFrakConfig, useGetMerchantInformation, useGetMergeToken, useGetUserReferralStatus, useOpenSso, usePrepareSso, useReferralInteraction, useSendTransactionAction, useSetupReferral, useSiweAuthenticate, useWalletStatus };
|