@frak-labs/react-sdk 0.2.0-beta.514ef378 → 0.2.0-beta.7898df5b
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
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=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({
|
|
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({options:i}={}){let a=l(),{frakContext:o}=p(),{data:s}=u(),{data:c,error:d,status:f}=(0,n.useQuery)({gcTime:0,staleTime:0,queryKey:[`frak-sdk`,`auto-referral-interaction`,o?.r??`no-referrer`,s?.key??`no-wallet-status`],queryFn:()=>{if(!a)throw new t.ClientNotFound;return(0,e.processReferral)(a,{walletStatus:s,frakContext:o,options:i})},enabled:!!s});return(0,r.useMemo)(()=>f===`pending`?`processing`:f===`error`?d:c||`idle`,[c,f,d])}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,8 +1,8 @@
|
|
|
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
1
|
import { ProcessReferralOptions, SendTransactionParams, SiweAuthenticateModalParams } from "@frak-labs/core-sdk/actions";
|
|
4
2
|
import * as _tanstack_react_query0 from "@tanstack/react-query";
|
|
5
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";
|
|
6
6
|
import { FrakRpcError } from "@frak-labs/frame-connector";
|
|
7
7
|
import * as react from "react";
|
|
8
8
|
import { CSSProperties, PropsWithChildren, ReactNode } from "react";
|
|
@@ -14,7 +14,6 @@ import { CSSProperties, PropsWithChildren, ReactNode } from "react";
|
|
|
14
14
|
* @group hooks
|
|
15
15
|
*
|
|
16
16
|
* @param args
|
|
17
|
-
* @param args.modalConfig - The modal configuration to display if the user is not logged in
|
|
18
17
|
* @param args.options - Some options for the referral interaction
|
|
19
18
|
*
|
|
20
19
|
* @returns The resulting referral state, or a potential error
|
|
@@ -24,12 +23,10 @@ import { CSSProperties, PropsWithChildren, ReactNode } from "react";
|
|
|
24
23
|
* @see {@link @frak-labs/core-sdk!actions.processReferral | `processReferral()`} for more details on the automatic referral handling process
|
|
25
24
|
*/
|
|
26
25
|
declare function useReferralInteraction({
|
|
27
|
-
modalConfig,
|
|
28
26
|
options
|
|
29
27
|
}?: {
|
|
30
|
-
modalConfig?: DisplayEmbeddedWalletParamsType;
|
|
31
28
|
options?: ProcessReferralOptions;
|
|
32
|
-
}):
|
|
29
|
+
}): "processing" | Error | "no-referrer" | "idle" | "success" | "self-referral";
|
|
33
30
|
//#endregion
|
|
34
31
|
//#region src/hook/useDisplayModal.d.ts
|
|
35
32
|
/** @ignore */
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
|
|
|
5
5
|
import * as react from "react";
|
|
6
6
|
import { CSSProperties, PropsWithChildren, ReactNode } from "react";
|
|
7
7
|
import * as _frak_labs_core_sdk0 from "@frak-labs/core-sdk";
|
|
8
|
-
import {
|
|
8
|
+
import { DisplayModalParamsType, FrakClient, FrakWalletSdkConfig, GetMerchantInformationReturnType, ModalRpcStepsResultType, ModalStepTypes, OpenSsoParamsType, OpenSsoReturnType, PrepareSsoParamsType, SendTransactionReturnType, SiweAuthenticateReturnType, WalletStatusReturnType } from "@frak-labs/core-sdk";
|
|
9
9
|
|
|
10
10
|
//#region src/hook/helper/useReferralInteraction.d.ts
|
|
11
11
|
/**
|
|
@@ -14,7 +14,6 @@ import { DisplayEmbeddedWalletParamsType, DisplayModalParamsType, FrakClient, Fr
|
|
|
14
14
|
* @group hooks
|
|
15
15
|
*
|
|
16
16
|
* @param args
|
|
17
|
-
* @param args.modalConfig - The modal configuration to display if the user is not logged in
|
|
18
17
|
* @param args.options - Some options for the referral interaction
|
|
19
18
|
*
|
|
20
19
|
* @returns The resulting referral state, or a potential error
|
|
@@ -24,12 +23,10 @@ import { DisplayEmbeddedWalletParamsType, DisplayModalParamsType, FrakClient, Fr
|
|
|
24
23
|
* @see {@link @frak-labs/core-sdk!actions.processReferral | `processReferral()`} for more details on the automatic referral handling process
|
|
25
24
|
*/
|
|
26
25
|
declare function useReferralInteraction({
|
|
27
|
-
modalConfig,
|
|
28
26
|
options
|
|
29
27
|
}?: {
|
|
30
|
-
modalConfig?: DisplayEmbeddedWalletParamsType;
|
|
31
28
|
options?: ProcessReferralOptions;
|
|
32
|
-
}):
|
|
29
|
+
}): "processing" | Error | "no-referrer" | "idle" | "success" | "self-referral";
|
|
33
30
|
//#endregion
|
|
34
31
|
//#region src/hook/useDisplayModal.d.ts
|
|
35
32
|
/** @ignore */
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{displayModal as e,getMerchantInformation as t,openSso as n,prepareSso as r,processReferral as i,sendTransaction as a,siweAuthenticate as o,watchWalletStatus as s}from"@frak-labs/core-sdk/actions";import{ClientNotFound as c,FrakRpcError as l,RpcErrorCodes as u}from"@frak-labs/frame-connector";import{useMutation as d,useQuery as f,useQueryClient as p}from"@tanstack/react-query";import{Fragment as m,createContext as h,createElement as g,useCallback as _,useContext as v,useEffect as y,useMemo as b,useState as x}from"react";import{FrakContextManager as S,baseIframeProps as C,createIFrameFrakClient as w}from"@frak-labs/core-sdk";const T=h(void 0);function E(e){let{children:t,config:n}=e;return g(T.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 D=h(void 0);function O({style:e,children:t}){let n=I(),[r,i]=x(void 0);return g(m,null,g(`iframe`,{...C,src:`${n.walletUrl}/listener`,style:e??C.style,ref:e=>{!e||r||i(w({iframe:e,config:n}))}}),g(D.Provider,{value:r},t))}function k(){return v(D)}function A(){let e=p(),t=k(),n=_(t=>{e.setQueryData([`frak-sdk`,`wallet-status-listener`],t)},[e]);return f({gcTime:0,staleTime:0,queryKey:[`frak-sdk`,`wallet-status-listener`],queryFn:async()=>{if(!t)throw new c;return s(t,n)},enabled:!!t})}function j(){let[e,t]=x(!1);return y(()=>{t(!0)},[]),e}function M(){let e=j(),[t,n]=x(e?window.location:void 0);return y(()=>{if(!e)return;function r(){n(window.location)}return t||r(),window.addEventListener(`popstate`,r),()=>{window.removeEventListener(`popstate`,r)}},[e,t]),{location:t,href:b(()=>t?.href,[t?.href])}}function N(){let{location:e}=M();return{frakContext:b(()=>e?.href?S.parse({url:e.href}):null,[e?.href]),updateContext:_(t=>{console.log(`Updating context`,{newContext:t}),S.replaceUrl({url:e?.href,context:t})},[e?.href])}}function P({
|
|
1
|
+
import{displayModal as e,getMerchantInformation as t,openSso as n,prepareSso as r,processReferral as i,sendTransaction as a,siweAuthenticate as o,watchWalletStatus as s}from"@frak-labs/core-sdk/actions";import{ClientNotFound as c,FrakRpcError as l,RpcErrorCodes as u}from"@frak-labs/frame-connector";import{useMutation as d,useQuery as f,useQueryClient as p}from"@tanstack/react-query";import{Fragment as m,createContext as h,createElement as g,useCallback as _,useContext as v,useEffect as y,useMemo as b,useState as x}from"react";import{FrakContextManager as S,baseIframeProps as C,createIFrameFrakClient as w}from"@frak-labs/core-sdk";const T=h(void 0);function E(e){let{children:t,config:n}=e;return g(T.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 D=h(void 0);function O({style:e,children:t}){let n=I(),[r,i]=x(void 0);return g(m,null,g(`iframe`,{...C,src:`${n.walletUrl}/listener`,style:e??C.style,ref:e=>{!e||r||i(w({iframe:e,config:n}))}}),g(D.Provider,{value:r},t))}function k(){return v(D)}function A(){let e=p(),t=k(),n=_(t=>{e.setQueryData([`frak-sdk`,`wallet-status-listener`],t)},[e]);return f({gcTime:0,staleTime:0,queryKey:[`frak-sdk`,`wallet-status-listener`],queryFn:async()=>{if(!t)throw new c;return s(t,n)},enabled:!!t})}function j(){let[e,t]=x(!1);return y(()=>{t(!0)},[]),e}function M(){let e=j(),[t,n]=x(e?window.location:void 0);return y(()=>{if(!e)return;function r(){n(window.location)}return t||r(),window.addEventListener(`popstate`,r),()=>{window.removeEventListener(`popstate`,r)}},[e,t]),{location:t,href:b(()=>t?.href,[t?.href])}}function N(){let{location:e}=M();return{frakContext:b(()=>e?.href?S.parse({url:e.href}):null,[e?.href]),updateContext:_(t=>{console.log(`Updating context`,{newContext:t}),S.replaceUrl({url:e?.href,context:t})},[e?.href])}}function P({options:e}={}){let t=k(),{frakContext:n}=N(),{data:r}=A(),{data:a,error:o,status:s}=f({gcTime:0,staleTime:0,queryKey:[`frak-sdk`,`auto-referral-interaction`,n?.r??`no-referrer`,r?.key??`no-wallet-status`],queryFn:()=>{if(!t)throw new c;return i(t,{walletStatus:r,frakContext:n,options:e})},enabled:!!r});return b(()=>s===`pending`?`processing`:s===`error`?o:a||`idle`,[a,s,o])}function F({mutations:t}={}){let n=k();return d({...t,mutationKey:[`frak-sdk`,`display-modal`],mutationFn:async t=>{if(!n)throw new c;return e(n,t)}})}function I(){let e=v(T);if(!e)throw new l(u.configError,`Frak config not found`);return e}function L({query:e}={}){let n=k();return f({...e,queryKey:[`frak-sdk`,`get-merchant-information`],queryFn:async()=>{if(!n)throw new c;return t(n)}})}function R({mutations:e}={}){let t=k();return d({...e,mutationKey:[`frak-sdk`,`open-sso`],mutationFn:async e=>{if(!t)throw new c;return n(t,e)}})}function z(e){let t=k();return f({queryKey:[`frak-sdk`,`prepare-sso`,e],queryFn:async()=>{if(!t)throw new c;return r(t,e)}})}function B({mutations:e}={}){let t=k();return d({...e,mutationKey:[`frak-sdk`,`send-transaction`],mutationFn:async e=>{if(!t)throw new c;return a(t,e)}})}function V({mutations:e}={}){let t=k();return d({...e,mutationKey:[`frak-sdk`,`siwe-authenticate`,t?.config.domain??`no-domain`],mutationFn:async e=>{if(!t)throw new c;return o(t,e)}})}export{T as FrakConfigContext,E as FrakConfigProvider,D as FrakIFrameClientContext,O as FrakIFrameClientProvider,F as useDisplayModal,k as useFrakClient,I as useFrakConfig,L as useGetMerchantInformation,R as useOpenSso,z as usePrepareSso,P as useReferralInteraction,B as useSendTransactionAction,V as useSiweAuthenticate,A as useWalletStatus};
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "0.2.0-beta.
|
|
14
|
+
"version": "0.2.0-beta.7898df5b",
|
|
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",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"publish": "echo 'Publishing react...'"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@frak-labs/frame-connector": "0.2.0-beta.
|
|
71
|
-
"@frak-labs/core-sdk": "0.2.0-beta.
|
|
70
|
+
"@frak-labs/frame-connector": "0.2.0-beta.7898df5b",
|
|
71
|
+
"@frak-labs/core-sdk": "0.2.0-beta.7898df5b"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"viem": "^2.x",
|
|
@@ -82,59 +82,10 @@ describe("useReferralInteraction", () => {
|
|
|
82
82
|
expect(processReferral).toHaveBeenCalledWith(mockFrakClient, {
|
|
83
83
|
walletStatus: mockWalletStatus,
|
|
84
84
|
frakContext: mockFrakContext,
|
|
85
|
-
modalConfig: undefined,
|
|
86
85
|
options: undefined,
|
|
87
86
|
});
|
|
88
87
|
});
|
|
89
88
|
|
|
90
|
-
test("should process referral with modalConfig", async ({
|
|
91
|
-
queryWrapper,
|
|
92
|
-
mockFrakClient,
|
|
93
|
-
}) => {
|
|
94
|
-
const mockReferralState = "success";
|
|
95
|
-
|
|
96
|
-
const modalConfig = {
|
|
97
|
-
metadata: {
|
|
98
|
-
logo: "https://example.com/logo.png",
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const mockWalletStatus: WalletStatusReturnType = {
|
|
103
|
-
key: "connected",
|
|
104
|
-
wallet: "0x1234567890123456789012345678901234567890",
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
vi.mocked(useFrakClient).mockReturnValue(mockFrakClient);
|
|
108
|
-
vi.mocked(useFrakContext).mockReturnValue({
|
|
109
|
-
frakContext: { r: "0x4567890123456789012345678901234567890123" },
|
|
110
|
-
updateContext: vi.fn(),
|
|
111
|
-
});
|
|
112
|
-
vi.mocked(useWalletStatus).mockReturnValue({
|
|
113
|
-
data: mockWalletStatus,
|
|
114
|
-
isSuccess: true,
|
|
115
|
-
isPending: false,
|
|
116
|
-
} as ReturnType<typeof useWalletStatus>);
|
|
117
|
-
vi.mocked(processReferral).mockResolvedValue(mockReferralState);
|
|
118
|
-
|
|
119
|
-
const { result } = renderHook(
|
|
120
|
-
() => useReferralInteraction({ modalConfig }),
|
|
121
|
-
{
|
|
122
|
-
wrapper: queryWrapper.wrapper,
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
await waitFor(() => {
|
|
127
|
-
expect(result.current).toEqual(mockReferralState);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
expect(processReferral).toHaveBeenCalledWith(
|
|
131
|
-
mockFrakClient,
|
|
132
|
-
expect.objectContaining({
|
|
133
|
-
modalConfig,
|
|
134
|
-
})
|
|
135
|
-
);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
89
|
test("should process referral with options", async ({
|
|
139
90
|
queryWrapper,
|
|
140
91
|
mockFrakClient,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { DisplayEmbeddedWalletParamsType } from "@frak-labs/core-sdk";
|
|
2
1
|
import {
|
|
3
2
|
type ProcessReferralOptions,
|
|
4
3
|
processReferral,
|
|
@@ -16,7 +15,6 @@ import { useFrakContext } from "../utils/useFrakContext";
|
|
|
16
15
|
* @group hooks
|
|
17
16
|
*
|
|
18
17
|
* @param args
|
|
19
|
-
* @param args.modalConfig - The modal configuration to display if the user is not logged in
|
|
20
18
|
* @param args.options - Some options for the referral interaction
|
|
21
19
|
*
|
|
22
20
|
* @returns The resulting referral state, or a potential error
|
|
@@ -26,10 +24,8 @@ import { useFrakContext } from "../utils/useFrakContext";
|
|
|
26
24
|
* @see {@link @frak-labs/core-sdk!actions.processReferral | `processReferral()`} for more details on the automatic referral handling process
|
|
27
25
|
*/
|
|
28
26
|
export function useReferralInteraction({
|
|
29
|
-
modalConfig,
|
|
30
27
|
options,
|
|
31
28
|
}: {
|
|
32
|
-
modalConfig?: DisplayEmbeddedWalletParamsType;
|
|
33
29
|
options?: ProcessReferralOptions;
|
|
34
30
|
} = {}) {
|
|
35
31
|
// Get the frak client
|
|
@@ -63,7 +59,6 @@ export function useReferralInteraction({
|
|
|
63
59
|
return processReferral(client, {
|
|
64
60
|
walletStatus,
|
|
65
61
|
frakContext,
|
|
66
|
-
modalConfig,
|
|
67
62
|
options,
|
|
68
63
|
});
|
|
69
64
|
},
|