@frak-labs/react-sdk 0.1.0-beta.278e9605 → 0.1.0-beta.7e126d46

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 ADDED
@@ -0,0 +1 @@
1
+ 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=g(),[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(){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})}function d(){let[e,t]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{t(!0)},[]),e}function f(){let e=d(),[t,n]=(0,r.useState)(e?window.location:void 0);return(0,r.useEffect)(()=>{if(!e)return;function r(){n(window.location)}return t||r(),window.addEventListener(`popstate`,r),()=>{window.removeEventListener(`popstate`,r)}},[e,t]),{location:t,href:(0,r.useMemo)(()=>t?.href,[t?.href])}}function p(){let{location:e}=f();return{frakContext:(0,r.useMemo)(()=>e?.href?i.FrakContextManager.parse({url:e.href}):null,[e?.href]),updateContext:(0,r.useCallback)(t=>{console.log(`Updating context`,{newContext:t}),i.FrakContextManager.replaceUrl({url:e?.href,context:t})},[e?.href])}}function m({productId:i,modalConfig:a,options:o}={}){let s=l(),{frakContext:c}=p(),{data:d}=u(),{data:f,error:m,status:h}=(0,n.useQuery)({gcTime:0,staleTime:0,queryKey:[`frak-sdk`,`auto-referral-interaction`,c?.r??`no-referrer`,d?.key??`no-wallet-status`,i??`no-product-id`],queryFn:()=>{if(!s)throw new t.ClientNotFound;return(0,e.processReferral)(s,{walletStatus:d,frakContext:c,modalConfig:a,productId:i,options:o})},enabled:!!d});return(0,r.useMemo)(()=>h===`pending`?`processing`:h===`error`?m:f||`idle`,[f,h,m])}function h({mutations:r}={}){let i=l();return(0,n.useMutation)({...r,mutationKey:[`frak-sdk`,`display-modal`],mutationFn:async n=>{if(!i)throw new t.ClientNotFound;return(0,e.displayModal)(i,n)}})}function g(){let e=(0,r.useContext)(a);if(!e)throw new t.FrakRpcError(t.RpcErrorCodes.configError,`Frak config not found`);return e}function _({query:r}={}){let i=l();return(0,n.useQuery)({...r,queryKey:[`frak-sdk`,`get-product-information`],queryFn:async()=>{if(!i)throw new t.ClientNotFound;return(0,e.getProductInformation)(i)}})}function v({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 y(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 b({mutations:r}={}){let i=l();return(0,n.useMutation)({...r,mutationKey:[`frak-sdk`,`send-interaction`],mutationFn:async n=>{if(!i)throw new t.ClientNotFound;return(0,e.sendInteraction)(i,n)}})}function x({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 S({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)}})}exports.FrakConfigContext=a,exports.FrakConfigProvider=o,exports.FrakIFrameClientContext=s,exports.FrakIFrameClientProvider=c,exports.useDisplayModal=h,exports.useFrakClient=l,exports.useFrakConfig=g,exports.useGetProductInformation=_,exports.useOpenSso=v,exports.usePrepareSso=y,exports.useReferralInteraction=m,exports.useSendInteraction=b,exports.useSendTransactionAction=x,exports.useSiweAuthenticate=S,exports.useWalletStatus=u;
@@ -0,0 +1,368 @@
1
+ import * as _frak_labs_core_sdk1 from "@frak-labs/core-sdk";
2
+ import { DisplayEmbeddedWalletParamsType, DisplayModalParamsType, FrakClient, FrakWalletSdkConfig, GetProductInformationReturnType, ModalRpcStepsResultType, ModalStepTypes, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, SendInteractionParamsType, SendInteractionReturnType, SendTransactionReturnType, SiweAuthenticateReturnType, WalletStatusReturnType } from "@frak-labs/core-sdk";
3
+ import { ProcessReferralOptions, SendTransactionParams, SiweAuthenticateModalParams } from "@frak-labs/core-sdk/actions";
4
+ import { Hex } from "viem";
5
+ import * as _tanstack_react_query1 from "@tanstack/react-query";
6
+ import { UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
7
+ import { FrakRpcError } from "@frak-labs/frame-connector";
8
+ import * as react2 from "react";
9
+ import { CSSProperties, PropsWithChildren, ReactNode } from "react";
10
+
11
+ //#region src/hook/helper/useReferralInteraction.d.ts
12
+
13
+ /**
14
+ * Helper hook to automatically submit a referral interaction when detected
15
+ *
16
+ * @group hooks
17
+ *
18
+ * @param args
19
+ * @param args.productId - The product id to interact with (if not specified will be recomputed from the current domain)
20
+ * @param args.modalConfig - The modal configuration to display if the user is not logged in
21
+ * @param args.options - Some options for the referral interaction
22
+ *
23
+ * @returns The resulting referral state, or a potential error
24
+ *
25
+ * @description This function will automatically handle the referral interaction process
26
+ *
27
+ * @see {@link @frak-labs/core-sdk!actions.processReferral | `processReferral()`} for more details on the automatic referral handling process
28
+ */
29
+ declare function useReferralInteraction({
30
+ productId,
31
+ modalConfig,
32
+ options
33
+ }?: {
34
+ productId?: Hex;
35
+ modalConfig?: DisplayEmbeddedWalletParamsType;
36
+ options?: ProcessReferralOptions;
37
+ }): Error | ("error" | "processing" | "no-referrer" | "idle" | "success" | "no-wallet" | "no-session" | "self-referral");
38
+ //#endregion
39
+ //#region src/hook/useDisplayModal.d.ts
40
+ /** @ignore */
41
+ type MutationOptions$4<T extends ModalStepTypes[]> = Omit<UseMutationOptions<ModalRpcStepsResultType<T>, FrakRpcError, DisplayModalParamsType<T>>, "mutationFn" | "mutationKey">;
42
+ /** @inline */
43
+ interface UseDisplayModalParams<T extends ModalStepTypes[] = ModalStepTypes[]> {
44
+ /**
45
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
46
+ */
47
+ mutations?: MutationOptions$4<T>;
48
+ }
49
+ /**
50
+ * Hook that return a mutation helping to display a modal to the user
51
+ *
52
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.displayModal | `displayModal()`} action
53
+ *
54
+ * @param args
55
+ *
56
+ * @typeParam T
57
+ * The modal steps types to display (the result will correspond to the steps types asked in params)
58
+ * An array of {@link @frak-labs/core-sdk!index.ModalStepTypes | `ModalStepTypes`}
59
+ * If not provided, it will default to a generic array of `ModalStepTypes`
60
+ *
61
+ * @group hooks
62
+ *
63
+ * @returns
64
+ * The mutation hook wrapping the `displayModal()` action
65
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.DisplayModalParamsType | `DisplayModalParamsType<T>`}, with type params `T` being the modal steps types to display
66
+ * The `data` result is a {@link @frak-labs/core-sdk!index.ModalRpcStepsResultType | `ModalRpcStepsResultType`}
67
+ *
68
+ * @see {@link @frak-labs/core-sdk!actions.displayModal | `displayModal()`} for more info about the underlying action
69
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
70
+ */
71
+ declare function useDisplayModal<T extends ModalStepTypes[] = ModalStepTypes[]>({
72
+ mutations
73
+ }?: UseDisplayModalParams<T>): _tanstack_react_query1.UseMutationResult<ModalRpcStepsResultType<T>, FrakRpcError<undefined>, DisplayModalParamsType<T>, unknown>;
74
+ //#endregion
75
+ //#region src/hook/useFrakClient.d.ts
76
+ /**
77
+ * Get the current Frak client
78
+ *
79
+ * @group hooks
80
+ */
81
+ declare function useFrakClient(): _frak_labs_core_sdk1.FrakClient | undefined;
82
+ //#endregion
83
+ //#region src/hook/useFrakConfig.d.ts
84
+ /**
85
+ * Get the current Frak config
86
+ * @throws {FrakRpcError} if the config is not found (only if this hooks is used outside a FrakConfigProvider)
87
+ * @group hooks
88
+ *
89
+ * @see {@link @frak-labs/react-sdk!FrakConfigProvider | FrakConfigProvider} for the config provider
90
+ * @see {@link @frak-labs/core-sdk!index.FrakWalletSdkConfig | FrakWalletSdkConfig} for the config type
91
+ */
92
+ declare function useFrakConfig(): _frak_labs_core_sdk1.FrakWalletSdkConfig;
93
+ //#endregion
94
+ //#region src/hook/useGetProductInformation.d.ts
95
+ /** @ignore */
96
+ type QueryOptions = Omit<UseQueryOptions<GetProductInformationReturnType, FrakRpcError, undefined>, "queryKey" | "queryFn">;
97
+ /** @inline */
98
+ interface UseGetProductInformationParams {
99
+ /**
100
+ * Optional query options, see {@link @tanstack/react-query!useQuery | `useQuery()`} for more infos
101
+ */
102
+ query?: QueryOptions;
103
+ }
104
+ /**
105
+ * Hook that return a query helping to get the current product information
106
+ *
107
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.getProductInformation | `getProductInformation()`} action
108
+ *
109
+ * @param args
110
+ *
111
+ * @group hooks
112
+ *
113
+ * @returns
114
+ * The query hook wrapping the `getProductInformation()` action
115
+ * The `data` result is a {@link @frak-labs/core-sdk!index.GetProductInformationReturnType | `GetProductInformationReturnType`}
116
+ *
117
+ * @see {@link @frak-labs/core-sdk!actions.getProductInformation | `getProductInformation()`} for more info about the underlying action
118
+ * @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery options and response
119
+ */
120
+ declare function useGetProductInformation({
121
+ query
122
+ }?: UseGetProductInformationParams): _tanstack_react_query1.UseQueryResult<undefined, FrakRpcError<undefined>>;
123
+ //#endregion
124
+ //#region src/hook/useOpenSso.d.ts
125
+ /** @ignore */
126
+ type MutationOptions$3 = Omit<UseMutationOptions<OpenSsoReturnType, FrakRpcError, OpenSsoParamsType>, "mutationFn" | "mutationKey">;
127
+ /** @inline */
128
+ interface UseOpenSsoParams {
129
+ /**
130
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
131
+ */
132
+ mutations?: MutationOptions$3;
133
+ }
134
+ /**
135
+ * Hook that return a mutation helping to open the SSO page
136
+ *
137
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} action
138
+ *
139
+ * @param args
140
+ *
141
+ * @group hooks
142
+ *
143
+ * @returns
144
+ * The mutation hook wrapping the `openSso()` action
145
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.OpenSsoParamsType | `OpenSsoParamsType`}
146
+ * The mutation doesn't output any value
147
+ *
148
+ * @see {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} for more info about the underlying action
149
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
150
+ */
151
+ declare function useOpenSso({
152
+ mutations
153
+ }?: UseOpenSsoParams): _tanstack_react_query1.UseMutationResult<OpenSsoReturnType, FrakRpcError<undefined>, OpenSsoParamsType, unknown>;
154
+ //#endregion
155
+ //#region src/hook/usePrepareSso.d.ts
156
+ /**
157
+ * Hook that generates SSO URL for popup flow
158
+ *
159
+ * This is a **synchronous** hook (no async calls) that generates the SSO URL
160
+ * client-side without communicating with the wallet iframe.
161
+ *
162
+ * @param params - SSO parameters for URL generation
163
+ *
164
+ * @group hooks
165
+ *
166
+ * @returns
167
+ * Object containing:
168
+ * - `ssoUrl`: Generated SSO URL (or undefined if client not ready)
169
+ * - `isReady`: Boolean indicating if URL is available
170
+ *
171
+ * @example
172
+ * ```tsx
173
+ * function MyComponent() {
174
+ * const { data } = usePrepareSso({
175
+ * metadata: { logoUrl: "..." },
176
+ * directExit: true
177
+ * });
178
+ *
179
+ * const handleClick = () => {
180
+ * if (ssoUrl) {
181
+ * window.open(data?.ssoUrl, "_blank");
182
+ * }
183
+ * };
184
+ *
185
+ * return <button onClick={handleClick} disabled={!isReady}>Login</button>;
186
+ * }
187
+ * ```
188
+ *
189
+ * @see {@link @frak-labs/core-sdk!actions.prepareSso | `prepareSso()`} for the underlying action
190
+ * @see {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} for the recommended high-level API
191
+ */
192
+ declare function usePrepareSso(params: PrepareSsoParamsType): _tanstack_react_query1.UseQueryResult<_frak_labs_core_sdk1.PrepareSsoReturnType, Error>;
193
+ //#endregion
194
+ //#region src/hook/useSendInteraction.d.ts
195
+ /** @ignore */
196
+ type MutationOptions$2 = Omit<UseMutationOptions<SendInteractionReturnType, FrakRpcError, SendInteractionParamsType>, "mutationFn" | "mutationKey">;
197
+ /** @inline */
198
+ interface UseSendInteractionParams {
199
+ /**
200
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
201
+ */
202
+ mutations?: MutationOptions$2;
203
+ }
204
+ /**
205
+ * Hook that return a mutation helping to send a user interaction
206
+ *
207
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendInteraction | `sendInteraction()`} action
208
+ *
209
+ * @param args
210
+ *
211
+ * @group hooks
212
+ *
213
+ * @returns
214
+ * The mutation hook wrapping the `sendInteraction()` action
215
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.SendInteractionParamsType | `SendInteractionParamsType`}
216
+ * The `data` result is a {@link @frak-labs/core-sdk!index.SendInteractionReturnType | `SendInteractionReturnType`}
217
+ *
218
+ * @see {@link @frak-labs/core-sdk!actions.sendInteraction | `sendInteraction()`} for more info about the underlying action
219
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
220
+ */
221
+ declare function useSendInteraction({
222
+ mutations
223
+ }?: UseSendInteractionParams): _tanstack_react_query1.UseMutationResult<SendInteractionReturnType, FrakRpcError<undefined>, SendInteractionParamsType, unknown>;
224
+ //#endregion
225
+ //#region src/hook/useSendTransaction.d.ts
226
+ /** @ignore */
227
+ type MutationOptions$1 = Omit<UseMutationOptions<SendTransactionReturnType, FrakRpcError, SendTransactionParams>, "mutationFn" | "mutationKey">;
228
+ /** @inline */
229
+ interface UseSendTransactionParams {
230
+ /**
231
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
232
+ */
233
+ mutations?: MutationOptions$1;
234
+ }
235
+ /**
236
+ * Hook that return a mutation helping to send a transaction
237
+ *
238
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} action
239
+ *
240
+ * @param args
241
+ *
242
+ * @group hooks
243
+ *
244
+ * @returns
245
+ * The mutation hook wrapping the `sendTransaction()` action
246
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!actions.SendTransactionParams | `SendTransactionParams`}
247
+ * The `data` result is a {@link @frak-labs/core-sdk!index.SendTransactionReturnType | `SendTransactionReturnType`}
248
+ *
249
+ * @see {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} for more info about the underlying action
250
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
251
+ */
252
+ declare function useSendTransactionAction({
253
+ mutations
254
+ }?: UseSendTransactionParams): _tanstack_react_query1.UseMutationResult<SendTransactionReturnType, FrakRpcError<undefined>, SendTransactionParams, unknown>;
255
+ //#endregion
256
+ //#region src/hook/useSiweAuthenticate.d.ts
257
+ /** @inline */
258
+ type MutationOptions = Omit<UseMutationOptions<SiweAuthenticateReturnType, FrakRpcError, SiweAuthenticateModalParams>, "mutationFn" | "mutationKey">;
259
+ /** @ignore */
260
+ interface UseSiweAuthenticateParams {
261
+ /**
262
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
263
+ */
264
+ mutations?: MutationOptions;
265
+ }
266
+ /**
267
+ * Hook that return a mutation helping to send perform a SIWE authentication
268
+ *
269
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} action
270
+ *
271
+ * @param args
272
+ *
273
+ * @group hooks
274
+ *
275
+ * @returns
276
+ * The mutation hook wrapping the `siweAuthenticate()` action
277
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!actions.SiweAuthenticateModalParams | `SiweAuthenticateModalParams`}
278
+ * The `data` result is a {@link @frak-labs/core-sdk!index.SiweAuthenticateReturnType | `SiweAuthenticateReturnType`}
279
+ *
280
+ * @see {@link @frak-labs/core-sdk!actions.siweAuthenticate | `siweAuthenticate()`} for more info about the underlying action
281
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
282
+ */
283
+ declare function useSiweAuthenticate({
284
+ mutations
285
+ }?: UseSiweAuthenticateParams): _tanstack_react_query1.UseMutationResult<SiweAuthenticateReturnType, FrakRpcError<undefined>, SiweAuthenticateModalParams, unknown>;
286
+ //#endregion
287
+ //#region src/hook/useWalletStatus.d.ts
288
+ /**
289
+ * Hook that return a query helping to get the current wallet status.
290
+ *
291
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.watchWalletStatus | `watchWalletStatus()`} action
292
+ *
293
+ * @group hooks
294
+ *
295
+ * @returns
296
+ * The query hook wrapping the `watchWalletStatus()` action
297
+ * The `data` result is a {@link @frak-labs/core-sdk!index.WalletStatusReturnType | `WalletStatusReturnType`}
298
+ *
299
+ * @see {@link @frak-labs/core-sdk!actions.watchWalletStatus | `watchWalletStatus()`} for more info about the underlying action
300
+ * @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery response
301
+ */
302
+ declare function useWalletStatus(): _tanstack_react_query1.UseQueryResult<WalletStatusReturnType, Error>;
303
+ //#endregion
304
+ //#region src/provider/FrakConfigProvider.d.ts
305
+ /**
306
+ * The context that will keep the Frak Wallet SDK configuration
307
+ * @ignore
308
+ */
309
+ declare const FrakConfigContext: react2.Context<FrakWalletSdkConfig | undefined>;
310
+ /**
311
+ * Props to instantiate the Frak Wallet SDK configuration provider
312
+ *
313
+ * @group provider
314
+ */
315
+ type FrakConfigProviderProps = {
316
+ /**
317
+ * The wanted Frak configuration
318
+ * @see {@link @frak-labs/core-sdk!index.FrakWalletSdkConfig | FrakWalletSdkConfig}
319
+ */
320
+ config: FrakWalletSdkConfig;
321
+ };
322
+ /**
323
+ * Simple config provider for the Frak Wallet SDK
324
+ *
325
+ * Should be wrapped within a {@link @tanstack/react-query!QueryClientProvider | `QueryClientProvider`}
326
+ *
327
+ * @group provider
328
+ *
329
+ * @param parameters
330
+ */
331
+ declare function FrakConfigProvider(parameters: PropsWithChildren<FrakConfigProviderProps>): react2.FunctionComponentElement<react2.ProviderProps<FrakWalletSdkConfig | undefined>>;
332
+ //#endregion
333
+ //#region src/provider/FrakIFrameClientProvider.d.ts
334
+ /**
335
+ * The context that will keep the Frak Wallet SDK client
336
+ * @ignore
337
+ */
338
+ declare const FrakIFrameClientContext: react2.Context<FrakClient | undefined>;
339
+ /**
340
+ * Props to instantiate the Frak Wallet SDK configuration provider
341
+ *
342
+ * @group provider
343
+ */
344
+ type FrakIFrameClientProps = {
345
+ config: FrakWalletSdkConfig;
346
+ };
347
+ /**
348
+ * IFrame client provider for the Frak Wallet SDK
349
+ * It will automatically create the frak wallet iFrame (required for the wallet to communicate with the SDK securely), and provide it in the context
350
+ *
351
+ * @group provider
352
+ *
353
+ * @remarks
354
+ * This provider must be wrapped within a {@link FrakConfigProvider} to work properly
355
+ *
356
+ * @param args
357
+ * @param args.style - Some custom styles to apply to the iFrame
358
+ * @param args.children - Descedant components that will have access to the Frak Client
359
+ */
360
+ declare function FrakIFrameClientProvider({
361
+ style,
362
+ children
363
+ }: {
364
+ style?: CSSProperties;
365
+ children?: ReactNode;
366
+ }): react2.FunctionComponentElement<react2.FragmentProps>;
367
+ //#endregion
368
+ export { FrakConfigContext, FrakConfigProvider, type FrakConfigProviderProps, FrakIFrameClientContext, type FrakIFrameClientProps, FrakIFrameClientProvider, useDisplayModal, useFrakClient, useFrakConfig, useGetProductInformation, useOpenSso, usePrepareSso, useReferralInteraction, useSendInteraction, useSendTransactionAction, useSiweAuthenticate, useWalletStatus };
@@ -0,0 +1,368 @@
1
+ import { ProcessReferralOptions, SendTransactionParams, SiweAuthenticateModalParams } from "@frak-labs/core-sdk/actions";
2
+ import { FrakRpcError } from "@frak-labs/frame-connector";
3
+ import * as _tanstack_react_query0 from "@tanstack/react-query";
4
+ import { UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
5
+ import * as react2 from "react";
6
+ import { CSSProperties, PropsWithChildren, ReactNode } from "react";
7
+ import * as _frak_labs_core_sdk0 from "@frak-labs/core-sdk";
8
+ import { DisplayEmbeddedWalletParamsType, DisplayModalParamsType, FrakClient, FrakWalletSdkConfig, GetProductInformationReturnType, ModalRpcStepsResultType, ModalStepTypes, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, SendInteractionParamsType, SendInteractionReturnType, SendTransactionReturnType, SiweAuthenticateReturnType, WalletStatusReturnType } from "@frak-labs/core-sdk";
9
+ import { Hex } from "viem";
10
+
11
+ //#region src/hook/helper/useReferralInteraction.d.ts
12
+
13
+ /**
14
+ * Helper hook to automatically submit a referral interaction when detected
15
+ *
16
+ * @group hooks
17
+ *
18
+ * @param args
19
+ * @param args.productId - The product id to interact with (if not specified will be recomputed from the current domain)
20
+ * @param args.modalConfig - The modal configuration to display if the user is not logged in
21
+ * @param args.options - Some options for the referral interaction
22
+ *
23
+ * @returns The resulting referral state, or a potential error
24
+ *
25
+ * @description This function will automatically handle the referral interaction process
26
+ *
27
+ * @see {@link @frak-labs/core-sdk!actions.processReferral | `processReferral()`} for more details on the automatic referral handling process
28
+ */
29
+ declare function useReferralInteraction({
30
+ productId,
31
+ modalConfig,
32
+ options
33
+ }?: {
34
+ productId?: Hex;
35
+ modalConfig?: DisplayEmbeddedWalletParamsType;
36
+ options?: ProcessReferralOptions;
37
+ }): Error | ("error" | "processing" | "no-referrer" | "idle" | "success" | "no-wallet" | "no-session" | "self-referral");
38
+ //#endregion
39
+ //#region src/hook/useDisplayModal.d.ts
40
+ /** @ignore */
41
+ type MutationOptions$4<T extends ModalStepTypes[]> = Omit<UseMutationOptions<ModalRpcStepsResultType<T>, FrakRpcError, DisplayModalParamsType<T>>, "mutationFn" | "mutationKey">;
42
+ /** @inline */
43
+ interface UseDisplayModalParams<T extends ModalStepTypes[] = ModalStepTypes[]> {
44
+ /**
45
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
46
+ */
47
+ mutations?: MutationOptions$4<T>;
48
+ }
49
+ /**
50
+ * Hook that return a mutation helping to display a modal to the user
51
+ *
52
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.displayModal | `displayModal()`} action
53
+ *
54
+ * @param args
55
+ *
56
+ * @typeParam T
57
+ * The modal steps types to display (the result will correspond to the steps types asked in params)
58
+ * An array of {@link @frak-labs/core-sdk!index.ModalStepTypes | `ModalStepTypes`}
59
+ * If not provided, it will default to a generic array of `ModalStepTypes`
60
+ *
61
+ * @group hooks
62
+ *
63
+ * @returns
64
+ * The mutation hook wrapping the `displayModal()` action
65
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.DisplayModalParamsType | `DisplayModalParamsType<T>`}, with type params `T` being the modal steps types to display
66
+ * The `data` result is a {@link @frak-labs/core-sdk!index.ModalRpcStepsResultType | `ModalRpcStepsResultType`}
67
+ *
68
+ * @see {@link @frak-labs/core-sdk!actions.displayModal | `displayModal()`} for more info about the underlying action
69
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
70
+ */
71
+ declare function useDisplayModal<T extends ModalStepTypes[] = ModalStepTypes[]>({
72
+ mutations
73
+ }?: UseDisplayModalParams<T>): _tanstack_react_query0.UseMutationResult<ModalRpcStepsResultType<T>, FrakRpcError<undefined>, DisplayModalParamsType<T>, unknown>;
74
+ //#endregion
75
+ //#region src/hook/useFrakClient.d.ts
76
+ /**
77
+ * Get the current Frak client
78
+ *
79
+ * @group hooks
80
+ */
81
+ declare function useFrakClient(): _frak_labs_core_sdk0.FrakClient | undefined;
82
+ //#endregion
83
+ //#region src/hook/useFrakConfig.d.ts
84
+ /**
85
+ * Get the current Frak config
86
+ * @throws {FrakRpcError} if the config is not found (only if this hooks is used outside a FrakConfigProvider)
87
+ * @group hooks
88
+ *
89
+ * @see {@link @frak-labs/react-sdk!FrakConfigProvider | FrakConfigProvider} for the config provider
90
+ * @see {@link @frak-labs/core-sdk!index.FrakWalletSdkConfig | FrakWalletSdkConfig} for the config type
91
+ */
92
+ declare function useFrakConfig(): _frak_labs_core_sdk0.FrakWalletSdkConfig;
93
+ //#endregion
94
+ //#region src/hook/useGetProductInformation.d.ts
95
+ /** @ignore */
96
+ type QueryOptions = Omit<UseQueryOptions<GetProductInformationReturnType, FrakRpcError, undefined>, "queryKey" | "queryFn">;
97
+ /** @inline */
98
+ interface UseGetProductInformationParams {
99
+ /**
100
+ * Optional query options, see {@link @tanstack/react-query!useQuery | `useQuery()`} for more infos
101
+ */
102
+ query?: QueryOptions;
103
+ }
104
+ /**
105
+ * Hook that return a query helping to get the current product information
106
+ *
107
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.getProductInformation | `getProductInformation()`} action
108
+ *
109
+ * @param args
110
+ *
111
+ * @group hooks
112
+ *
113
+ * @returns
114
+ * The query hook wrapping the `getProductInformation()` action
115
+ * The `data` result is a {@link @frak-labs/core-sdk!index.GetProductInformationReturnType | `GetProductInformationReturnType`}
116
+ *
117
+ * @see {@link @frak-labs/core-sdk!actions.getProductInformation | `getProductInformation()`} for more info about the underlying action
118
+ * @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery options and response
119
+ */
120
+ declare function useGetProductInformation({
121
+ query
122
+ }?: UseGetProductInformationParams): _tanstack_react_query0.UseQueryResult<undefined, FrakRpcError<undefined>>;
123
+ //#endregion
124
+ //#region src/hook/useOpenSso.d.ts
125
+ /** @ignore */
126
+ type MutationOptions$3 = Omit<UseMutationOptions<OpenSsoReturnType, FrakRpcError, OpenSsoParamsType>, "mutationFn" | "mutationKey">;
127
+ /** @inline */
128
+ interface UseOpenSsoParams {
129
+ /**
130
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
131
+ */
132
+ mutations?: MutationOptions$3;
133
+ }
134
+ /**
135
+ * Hook that return a mutation helping to open the SSO page
136
+ *
137
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} action
138
+ *
139
+ * @param args
140
+ *
141
+ * @group hooks
142
+ *
143
+ * @returns
144
+ * The mutation hook wrapping the `openSso()` action
145
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.OpenSsoParamsType | `OpenSsoParamsType`}
146
+ * The mutation doesn't output any value
147
+ *
148
+ * @see {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} for more info about the underlying action
149
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
150
+ */
151
+ declare function useOpenSso({
152
+ mutations
153
+ }?: UseOpenSsoParams): _tanstack_react_query0.UseMutationResult<OpenSsoReturnType, FrakRpcError<undefined>, OpenSsoParamsType, unknown>;
154
+ //#endregion
155
+ //#region src/hook/usePrepareSso.d.ts
156
+ /**
157
+ * Hook that generates SSO URL for popup flow
158
+ *
159
+ * This is a **synchronous** hook (no async calls) that generates the SSO URL
160
+ * client-side without communicating with the wallet iframe.
161
+ *
162
+ * @param params - SSO parameters for URL generation
163
+ *
164
+ * @group hooks
165
+ *
166
+ * @returns
167
+ * Object containing:
168
+ * - `ssoUrl`: Generated SSO URL (or undefined if client not ready)
169
+ * - `isReady`: Boolean indicating if URL is available
170
+ *
171
+ * @example
172
+ * ```tsx
173
+ * function MyComponent() {
174
+ * const { data } = usePrepareSso({
175
+ * metadata: { logoUrl: "..." },
176
+ * directExit: true
177
+ * });
178
+ *
179
+ * const handleClick = () => {
180
+ * if (ssoUrl) {
181
+ * window.open(data?.ssoUrl, "_blank");
182
+ * }
183
+ * };
184
+ *
185
+ * return <button onClick={handleClick} disabled={!isReady}>Login</button>;
186
+ * }
187
+ * ```
188
+ *
189
+ * @see {@link @frak-labs/core-sdk!actions.prepareSso | `prepareSso()`} for the underlying action
190
+ * @see {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} for the recommended high-level API
191
+ */
192
+ declare function usePrepareSso(params: PrepareSsoParamsType): _tanstack_react_query0.UseQueryResult<_frak_labs_core_sdk0.PrepareSsoReturnType, Error>;
193
+ //#endregion
194
+ //#region src/hook/useSendInteraction.d.ts
195
+ /** @ignore */
196
+ type MutationOptions$2 = Omit<UseMutationOptions<SendInteractionReturnType, FrakRpcError, SendInteractionParamsType>, "mutationFn" | "mutationKey">;
197
+ /** @inline */
198
+ interface UseSendInteractionParams {
199
+ /**
200
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
201
+ */
202
+ mutations?: MutationOptions$2;
203
+ }
204
+ /**
205
+ * Hook that return a mutation helping to send a user interaction
206
+ *
207
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendInteraction | `sendInteraction()`} action
208
+ *
209
+ * @param args
210
+ *
211
+ * @group hooks
212
+ *
213
+ * @returns
214
+ * The mutation hook wrapping the `sendInteraction()` action
215
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.SendInteractionParamsType | `SendInteractionParamsType`}
216
+ * The `data` result is a {@link @frak-labs/core-sdk!index.SendInteractionReturnType | `SendInteractionReturnType`}
217
+ *
218
+ * @see {@link @frak-labs/core-sdk!actions.sendInteraction | `sendInteraction()`} for more info about the underlying action
219
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
220
+ */
221
+ declare function useSendInteraction({
222
+ mutations
223
+ }?: UseSendInteractionParams): _tanstack_react_query0.UseMutationResult<SendInteractionReturnType, FrakRpcError<undefined>, SendInteractionParamsType, unknown>;
224
+ //#endregion
225
+ //#region src/hook/useSendTransaction.d.ts
226
+ /** @ignore */
227
+ type MutationOptions$1 = Omit<UseMutationOptions<SendTransactionReturnType, FrakRpcError, SendTransactionParams>, "mutationFn" | "mutationKey">;
228
+ /** @inline */
229
+ interface UseSendTransactionParams {
230
+ /**
231
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
232
+ */
233
+ mutations?: MutationOptions$1;
234
+ }
235
+ /**
236
+ * Hook that return a mutation helping to send a transaction
237
+ *
238
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} action
239
+ *
240
+ * @param args
241
+ *
242
+ * @group hooks
243
+ *
244
+ * @returns
245
+ * The mutation hook wrapping the `sendTransaction()` action
246
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!actions.SendTransactionParams | `SendTransactionParams`}
247
+ * The `data` result is a {@link @frak-labs/core-sdk!index.SendTransactionReturnType | `SendTransactionReturnType`}
248
+ *
249
+ * @see {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} for more info about the underlying action
250
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
251
+ */
252
+ declare function useSendTransactionAction({
253
+ mutations
254
+ }?: UseSendTransactionParams): _tanstack_react_query0.UseMutationResult<SendTransactionReturnType, FrakRpcError<undefined>, SendTransactionParams, unknown>;
255
+ //#endregion
256
+ //#region src/hook/useSiweAuthenticate.d.ts
257
+ /** @inline */
258
+ type MutationOptions = Omit<UseMutationOptions<SiweAuthenticateReturnType, FrakRpcError, SiweAuthenticateModalParams>, "mutationFn" | "mutationKey">;
259
+ /** @ignore */
260
+ interface UseSiweAuthenticateParams {
261
+ /**
262
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
263
+ */
264
+ mutations?: MutationOptions;
265
+ }
266
+ /**
267
+ * Hook that return a mutation helping to send perform a SIWE authentication
268
+ *
269
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} action
270
+ *
271
+ * @param args
272
+ *
273
+ * @group hooks
274
+ *
275
+ * @returns
276
+ * The mutation hook wrapping the `siweAuthenticate()` action
277
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!actions.SiweAuthenticateModalParams | `SiweAuthenticateModalParams`}
278
+ * The `data` result is a {@link @frak-labs/core-sdk!index.SiweAuthenticateReturnType | `SiweAuthenticateReturnType`}
279
+ *
280
+ * @see {@link @frak-labs/core-sdk!actions.siweAuthenticate | `siweAuthenticate()`} for more info about the underlying action
281
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
282
+ */
283
+ declare function useSiweAuthenticate({
284
+ mutations
285
+ }?: UseSiweAuthenticateParams): _tanstack_react_query0.UseMutationResult<SiweAuthenticateReturnType, FrakRpcError<undefined>, SiweAuthenticateModalParams, unknown>;
286
+ //#endregion
287
+ //#region src/hook/useWalletStatus.d.ts
288
+ /**
289
+ * Hook that return a query helping to get the current wallet status.
290
+ *
291
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.watchWalletStatus | `watchWalletStatus()`} action
292
+ *
293
+ * @group hooks
294
+ *
295
+ * @returns
296
+ * The query hook wrapping the `watchWalletStatus()` action
297
+ * The `data` result is a {@link @frak-labs/core-sdk!index.WalletStatusReturnType | `WalletStatusReturnType`}
298
+ *
299
+ * @see {@link @frak-labs/core-sdk!actions.watchWalletStatus | `watchWalletStatus()`} for more info about the underlying action
300
+ * @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery response
301
+ */
302
+ declare function useWalletStatus(): _tanstack_react_query0.UseQueryResult<WalletStatusReturnType, Error>;
303
+ //#endregion
304
+ //#region src/provider/FrakConfigProvider.d.ts
305
+ /**
306
+ * The context that will keep the Frak Wallet SDK configuration
307
+ * @ignore
308
+ */
309
+ declare const FrakConfigContext: react2.Context<FrakWalletSdkConfig | undefined>;
310
+ /**
311
+ * Props to instantiate the Frak Wallet SDK configuration provider
312
+ *
313
+ * @group provider
314
+ */
315
+ type FrakConfigProviderProps = {
316
+ /**
317
+ * The wanted Frak configuration
318
+ * @see {@link @frak-labs/core-sdk!index.FrakWalletSdkConfig | FrakWalletSdkConfig}
319
+ */
320
+ config: FrakWalletSdkConfig;
321
+ };
322
+ /**
323
+ * Simple config provider for the Frak Wallet SDK
324
+ *
325
+ * Should be wrapped within a {@link @tanstack/react-query!QueryClientProvider | `QueryClientProvider`}
326
+ *
327
+ * @group provider
328
+ *
329
+ * @param parameters
330
+ */
331
+ declare function FrakConfigProvider(parameters: PropsWithChildren<FrakConfigProviderProps>): react2.FunctionComponentElement<react2.ProviderProps<FrakWalletSdkConfig | undefined>>;
332
+ //#endregion
333
+ //#region src/provider/FrakIFrameClientProvider.d.ts
334
+ /**
335
+ * The context that will keep the Frak Wallet SDK client
336
+ * @ignore
337
+ */
338
+ declare const FrakIFrameClientContext: react2.Context<FrakClient | undefined>;
339
+ /**
340
+ * Props to instantiate the Frak Wallet SDK configuration provider
341
+ *
342
+ * @group provider
343
+ */
344
+ type FrakIFrameClientProps = {
345
+ config: FrakWalletSdkConfig;
346
+ };
347
+ /**
348
+ * IFrame client provider for the Frak Wallet SDK
349
+ * It will automatically create the frak wallet iFrame (required for the wallet to communicate with the SDK securely), and provide it in the context
350
+ *
351
+ * @group provider
352
+ *
353
+ * @remarks
354
+ * This provider must be wrapped within a {@link FrakConfigProvider} to work properly
355
+ *
356
+ * @param args
357
+ * @param args.style - Some custom styles to apply to the iFrame
358
+ * @param args.children - Descedant components that will have access to the Frak Client
359
+ */
360
+ declare function FrakIFrameClientProvider({
361
+ style,
362
+ children
363
+ }: {
364
+ style?: CSSProperties;
365
+ children?: ReactNode;
366
+ }): react2.FunctionComponentElement<react2.FragmentProps>;
367
+ //#endregion
368
+ export { FrakConfigContext, FrakConfigProvider, type FrakConfigProviderProps, FrakIFrameClientContext, type FrakIFrameClientProps, FrakIFrameClientProvider, useDisplayModal, useFrakClient, useFrakConfig, useGetProductInformation, useOpenSso, usePrepareSso, useReferralInteraction, useSendInteraction, useSendTransactionAction, useSiweAuthenticate, useWalletStatus };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{displayModal as e,getProductInformation as t,openSso as n,prepareSso as r,processReferral as i,sendInteraction as a,sendTransaction as o,siweAuthenticate as s,watchWalletStatus as c}from"@frak-labs/core-sdk/actions";import{ClientNotFound as l,FrakRpcError as u,RpcErrorCodes as d}from"@frak-labs/frame-connector";import{useMutation as f,useQuery as p,useQueryClient as m}from"@tanstack/react-query";import{Fragment as h,createContext as g,createElement as _,useCallback as v,useContext as y,useEffect as b,useMemo as x,useState as S}from"react";import{FrakContextManager as C,baseIframeProps as w,createIFrameFrakClient as T}from"@frak-labs/core-sdk";const E=g(void 0);function D(e){let{children:t,config:n}=e;return _(E.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 O=g(void 0);function k({style:e,children:t}){let n=L(),[r,i]=S(void 0);return _(h,null,_(`iframe`,{...w,src:`${n.walletUrl}/listener`,style:e??w.style,ref:e=>{!e||r||i(T({iframe:e,config:n}))}}),_(O.Provider,{value:r},t))}function A(){return y(O)}function j(){let e=m(),t=A(),n=v(t=>{e.setQueryData([`frak-sdk`,`wallet-status-listener`],t)},[e]);return p({gcTime:0,staleTime:0,queryKey:[`frak-sdk`,`wallet-status-listener`],queryFn:async()=>{if(!t)throw new l;return c(t,n)},enabled:!!t})}function M(){let[e,t]=S(!1);return b(()=>{t(!0)},[]),e}function N(){let e=M(),[t,n]=S(e?window.location:void 0);return b(()=>{if(!e)return;function r(){n(window.location)}return t||r(),window.addEventListener(`popstate`,r),()=>{window.removeEventListener(`popstate`,r)}},[e,t]),{location:t,href:x(()=>t?.href,[t?.href])}}function P(){let{location:e}=N();return{frakContext:x(()=>e?.href?C.parse({url:e.href}):null,[e?.href]),updateContext:v(t=>{console.log(`Updating context`,{newContext:t}),C.replaceUrl({url:e?.href,context:t})},[e?.href])}}function F({productId:e,modalConfig:t,options:n}={}){let r=A(),{frakContext:a}=P(),{data:o}=j(),{data:s,error:c,status:u}=p({gcTime:0,staleTime:0,queryKey:[`frak-sdk`,`auto-referral-interaction`,a?.r??`no-referrer`,o?.key??`no-wallet-status`,e??`no-product-id`],queryFn:()=>{if(!r)throw new l;return i(r,{walletStatus:o,frakContext:a,modalConfig:t,productId:e,options:n})},enabled:!!o});return x(()=>u===`pending`?`processing`:u===`error`?c:s||`idle`,[s,u,c])}function I({mutations:t}={}){let n=A();return f({...t,mutationKey:[`frak-sdk`,`display-modal`],mutationFn:async t=>{if(!n)throw new l;return e(n,t)}})}function L(){let e=y(E);if(!e)throw new u(d.configError,`Frak config not found`);return e}function R({query:e}={}){let n=A();return p({...e,queryKey:[`frak-sdk`,`get-product-information`],queryFn:async()=>{if(!n)throw new l;return t(n)}})}function z({mutations:e}={}){let t=A();return f({...e,mutationKey:[`frak-sdk`,`open-sso`],mutationFn:async e=>{if(!t)throw new l;return n(t,e)}})}function B(e){let t=A();return p({queryKey:[`frak-sdk`,`prepare-sso`,e],queryFn:async()=>{if(!t)throw new l;return r(t,e)}})}function V({mutations:e}={}){let t=A();return f({...e,mutationKey:[`frak-sdk`,`send-interaction`],mutationFn:async e=>{if(!t)throw new l;return a(t,e)}})}function H({mutations:e}={}){let t=A();return f({...e,mutationKey:[`frak-sdk`,`send-transaction`],mutationFn:async e=>{if(!t)throw new l;return o(t,e)}})}function U({mutations:e}={}){let t=A();return f({...e,mutationKey:[`frak-sdk`,`siwe-authenticate`,t?.config.domain??`no-domain`],mutationFn:async e=>{if(!t)throw new l;return s(t,e)}})}export{E as FrakConfigContext,D as FrakConfigProvider,O as FrakIFrameClientContext,k as FrakIFrameClientProvider,I as useDisplayModal,A as useFrakClient,L as useFrakConfig,R as useGetProductInformation,z as useOpenSso,B as usePrepareSso,F as useReferralInteraction,V as useSendInteraction,H as useSendTransactionAction,U as useSiweAuthenticate,j as useWalletStatus};
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "url": "https://twitter.com/QNivelais"
12
12
  }
13
13
  ],
14
- "version": "0.1.0-beta.278e9605",
14
+ "version": "0.1.0-beta.7e126d46",
15
15
  "description": "React SDK of the Frak wallet, low level library to interact directly with the frak ecosystem.",
16
16
  "repository": {
17
17
  "url": "https://github.com/frak-id/wallet",
@@ -77,22 +77,23 @@
77
77
  "devDependencies": {
78
78
  "@arethetypeswrong/cli": "^0.18.2",
79
79
  "@frak-labs/dev-tooling": "0.0.0",
80
+ "@frak-labs/test-foundation": "0.1.0",
80
81
  "@frak-labs/wallet-shared": "0.0.0",
81
- "@tanstack/react-query": "^5.90.7",
82
+ "@tanstack/react-query": "^5.90.16",
82
83
  "@testing-library/jest-dom": "^6.9.1",
83
- "@testing-library/react": "^16.3.0",
84
+ "@testing-library/react": "^16.3.1",
84
85
  "@testing-library/react-hooks": "^8.0.1",
85
86
  "@testing-library/user-event": "^14.6.1",
86
87
  "@types/jsdom": "^27.0.0",
87
- "@types/node": "^24.10.0",
88
- "@types/react": "19.2.2",
89
- "@vitest/coverage-v8": "^4.0.8",
90
- "@vitest/ui": "^4.0.8",
91
- "jsdom": "^27.1.0",
92
- "react": "^19.2.0",
93
- "tsdown": "^0.16.1",
88
+ "@types/node": "^24.10.4",
89
+ "@types/react": "19.2.7",
90
+ "@vitest/coverage-v8": "^4.0.16",
91
+ "@vitest/ui": "^4.0.16",
92
+ "jsdom": "^27.3.0",
93
+ "react": "^19.2.3",
94
+ "tsdown": "^0.18.2",
94
95
  "typescript": "^5",
95
- "viem": "^2.38.6",
96
- "vitest": "^4.0.8"
96
+ "viem": "^2.39.0",
97
+ "vitest": "^4.0.16"
97
98
  }
98
99
  }