@frak-labs/react-sdk 0.1.0-beta.de6e0d34 → 0.1.0-beta.f3715ed5

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