@frak-labs/react-sdk 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -389
- package/dist/index.d.cts +342 -298
- package/dist/index.d.ts +342 -298
- package/dist/index.js +1 -389
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -1,389 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(
|
|
2
|
-
var _react = require('react');
|
|
3
|
-
var FrakConfigContext = _react.createContext.call(void 0,
|
|
4
|
-
void 0
|
|
5
|
-
);
|
|
6
|
-
function FrakConfigProvider(parameters) {
|
|
7
|
-
const { children, config } = parameters;
|
|
8
|
-
return _react.createElement.call(void 0,
|
|
9
|
-
FrakConfigContext.Provider,
|
|
10
|
-
{
|
|
11
|
-
value: {
|
|
12
|
-
...config,
|
|
13
|
-
walletUrl: _nullishCoalesce(config.walletUrl, () => ( "https://wallet.frak.id")),
|
|
14
|
-
domain: _nullishCoalesce(_nullishCoalesce(config.domain, () => ( (typeof window !== "undefined" ? _optionalChain([window, 'optionalAccess', _ => _.location, 'optionalAccess', _2 => _2.host]) : void 0))), () => ( "not-found"))
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
children
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// src/provider/FrakIFrameClientProvider.ts
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var _coresdk = require('@frak-labs/core-sdk');
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// src/hook/useFrakConfig.ts
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
function useFrakConfig() {
|
|
37
|
-
const config = _react.useContext.call(void 0, FrakConfigContext);
|
|
38
|
-
if (!config) {
|
|
39
|
-
throw new (0, _coresdk.FrakRpcError)(
|
|
40
|
-
_coresdk.RpcErrorCodes.configError,
|
|
41
|
-
"Frak config not found"
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
return config;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// src/hook/useFrakClient.ts
|
|
48
|
-
|
|
49
|
-
function useFrakClient() {
|
|
50
|
-
return _react.useContext.call(void 0, FrakIFrameClientContext);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// src/hook/useWalletStatus.ts
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var _actions = require('@frak-labs/core-sdk/actions');
|
|
58
|
-
var _reactquery = require('@tanstack/react-query');
|
|
59
|
-
|
|
60
|
-
function useWalletStatus() {
|
|
61
|
-
const queryClient = _reactquery.useQueryClient.call(void 0, );
|
|
62
|
-
const client = useFrakClient();
|
|
63
|
-
const newStatusUpdated = _react.useCallback.call(void 0,
|
|
64
|
-
(event) => {
|
|
65
|
-
queryClient.setQueryData(
|
|
66
|
-
["frak-sdk", "wallet-status-listener"],
|
|
67
|
-
event
|
|
68
|
-
);
|
|
69
|
-
},
|
|
70
|
-
[queryClient]
|
|
71
|
-
);
|
|
72
|
-
return _reactquery.useQuery.call(void 0, {
|
|
73
|
-
gcTime: 0,
|
|
74
|
-
staleTime: 0,
|
|
75
|
-
queryKey: ["frak-sdk", "wallet-status-listener"],
|
|
76
|
-
queryFn: async () => {
|
|
77
|
-
if (!client) {
|
|
78
|
-
throw new (0, _coresdk.ClientNotFound)();
|
|
79
|
-
}
|
|
80
|
-
return _actions.watchWalletStatus.call(void 0, client, newStatusUpdated);
|
|
81
|
-
},
|
|
82
|
-
enabled: !!client
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// src/hook/useSendTransaction.ts
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
function useSendTransactionAction({
|
|
95
|
-
mutations
|
|
96
|
-
} = {}) {
|
|
97
|
-
const client = useFrakClient();
|
|
98
|
-
return _reactquery.useMutation.call(void 0, {
|
|
99
|
-
...mutations,
|
|
100
|
-
mutationKey: ["frak-sdk", "send-transaction"],
|
|
101
|
-
mutationFn: async (params) => {
|
|
102
|
-
if (!client) {
|
|
103
|
-
throw new (0, _coresdk.ClientNotFound)();
|
|
104
|
-
}
|
|
105
|
-
return _actions.sendTransaction.call(void 0, client, params);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// src/hook/useSiweAuthenticate.ts
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
function useSiweAuthenticate({
|
|
119
|
-
mutations
|
|
120
|
-
} = {}) {
|
|
121
|
-
const client = useFrakClient();
|
|
122
|
-
return _reactquery.useMutation.call(void 0, {
|
|
123
|
-
...mutations,
|
|
124
|
-
mutationKey: [
|
|
125
|
-
"frak-sdk",
|
|
126
|
-
"siwe-authenticate",
|
|
127
|
-
_nullishCoalesce(_optionalChain([client, 'optionalAccess', _3 => _3.config, 'access', _4 => _4.domain]), () => ( "no-domain"))
|
|
128
|
-
],
|
|
129
|
-
mutationFn: async (params) => {
|
|
130
|
-
if (!client) {
|
|
131
|
-
throw new (0, _coresdk.ClientNotFound)();
|
|
132
|
-
}
|
|
133
|
-
return _actions.siweAuthenticate.call(void 0, client, params);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// src/hook/helper/useReferralInteraction.ts
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
// src/hook/utils/useFrakContext.ts
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
// src/hook/utils/useWindowLocation.ts
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
// src/hook/utils/useMounted.ts
|
|
156
|
-
|
|
157
|
-
function useMounted() {
|
|
158
|
-
const [mounted, setMounted] = _react.useState.call(void 0, false);
|
|
159
|
-
_react.useEffect.call(void 0, () => {
|
|
160
|
-
setMounted(true);
|
|
161
|
-
}, []);
|
|
162
|
-
return mounted;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// src/hook/utils/useWindowLocation.ts
|
|
166
|
-
function useWindowLocation() {
|
|
167
|
-
const isMounted = useMounted();
|
|
168
|
-
const [location, setLocation] = _react.useState.call(void 0,
|
|
169
|
-
isMounted ? window.location : void 0
|
|
170
|
-
);
|
|
171
|
-
_react.useEffect.call(void 0, () => {
|
|
172
|
-
if (!isMounted) return;
|
|
173
|
-
function setWindowLocation() {
|
|
174
|
-
setLocation(window.location);
|
|
175
|
-
}
|
|
176
|
-
if (!location) {
|
|
177
|
-
setWindowLocation();
|
|
178
|
-
}
|
|
179
|
-
window.addEventListener("popstate", setWindowLocation);
|
|
180
|
-
return () => {
|
|
181
|
-
window.removeEventListener("popstate", setWindowLocation);
|
|
182
|
-
};
|
|
183
|
-
}, [isMounted, location]);
|
|
184
|
-
const href = _react.useMemo.call(void 0, () => _optionalChain([location, 'optionalAccess', _5 => _5.href]), [_optionalChain([location, 'optionalAccess', _6 => _6.href])]);
|
|
185
|
-
return { location, href };
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// src/hook/utils/useFrakContext.ts
|
|
189
|
-
function useFrakContext() {
|
|
190
|
-
const { location } = useWindowLocation();
|
|
191
|
-
const frakContext = _react.useMemo.call(void 0, () => {
|
|
192
|
-
if (!_optionalChain([location, 'optionalAccess', _7 => _7.href])) return null;
|
|
193
|
-
return _coresdk.FrakContextManager.parse({ url: location.href });
|
|
194
|
-
}, [_optionalChain([location, 'optionalAccess', _8 => _8.href])]);
|
|
195
|
-
const updateContext = _react.useCallback.call(void 0,
|
|
196
|
-
(newContext) => {
|
|
197
|
-
console.log("Updating context", { newContext });
|
|
198
|
-
_coresdk.FrakContextManager.replaceUrl({
|
|
199
|
-
url: _optionalChain([location, 'optionalAccess', _9 => _9.href]),
|
|
200
|
-
context: newContext
|
|
201
|
-
});
|
|
202
|
-
},
|
|
203
|
-
[_optionalChain([location, 'optionalAccess', _10 => _10.href])]
|
|
204
|
-
);
|
|
205
|
-
return {
|
|
206
|
-
frakContext,
|
|
207
|
-
updateContext
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// src/hook/helper/useReferralInteraction.ts
|
|
212
|
-
function useReferralInteraction({
|
|
213
|
-
productId,
|
|
214
|
-
modalConfig,
|
|
215
|
-
options
|
|
216
|
-
} = {}) {
|
|
217
|
-
const client = useFrakClient();
|
|
218
|
-
const { frakContext } = useFrakContext();
|
|
219
|
-
const { data: walletStatus } = useWalletStatus();
|
|
220
|
-
const {
|
|
221
|
-
data: referralState,
|
|
222
|
-
error,
|
|
223
|
-
status
|
|
224
|
-
} = _reactquery.useQuery.call(void 0, {
|
|
225
|
-
gcTime: 0,
|
|
226
|
-
staleTime: 0,
|
|
227
|
-
queryKey: [
|
|
228
|
-
"frak-sdk",
|
|
229
|
-
"auto-referral-interaction",
|
|
230
|
-
_nullishCoalesce(_optionalChain([frakContext, 'optionalAccess', _11 => _11.r]), () => ( "no-referrer")),
|
|
231
|
-
_nullishCoalesce(_optionalChain([walletStatus, 'optionalAccess', _12 => _12.key]), () => ( "no-wallet-status")),
|
|
232
|
-
_nullishCoalesce(productId, () => ( "no-product-id"))
|
|
233
|
-
],
|
|
234
|
-
queryFn: () => {
|
|
235
|
-
if (!client) {
|
|
236
|
-
throw new (0, _coresdk.ClientNotFound)();
|
|
237
|
-
}
|
|
238
|
-
return _actions.processReferral.call(void 0, client, {
|
|
239
|
-
walletStatus,
|
|
240
|
-
frakContext,
|
|
241
|
-
modalConfig,
|
|
242
|
-
productId,
|
|
243
|
-
options
|
|
244
|
-
});
|
|
245
|
-
},
|
|
246
|
-
enabled: !!walletStatus
|
|
247
|
-
});
|
|
248
|
-
return _react.useMemo.call(void 0, () => {
|
|
249
|
-
if (status === "pending") return "processing";
|
|
250
|
-
if (status === "error") return error;
|
|
251
|
-
return referralState || "idle";
|
|
252
|
-
}, [referralState, status, error]);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// src/hook/useSendInteraction.ts
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
function useSendInteraction({
|
|
262
|
-
mutations
|
|
263
|
-
} = {}) {
|
|
264
|
-
const client = useFrakClient();
|
|
265
|
-
return _reactquery.useMutation.call(void 0, {
|
|
266
|
-
...mutations,
|
|
267
|
-
mutationKey: ["frak-sdk", "send-interaction"],
|
|
268
|
-
mutationFn: async (params) => {
|
|
269
|
-
if (!client) {
|
|
270
|
-
throw new (0, _coresdk.ClientNotFound)();
|
|
271
|
-
}
|
|
272
|
-
return _actions.sendInteraction.call(void 0, client, params);
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// src/hook/useDisplayModal.ts
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
function useDisplayModal({
|
|
284
|
-
mutations
|
|
285
|
-
} = {}) {
|
|
286
|
-
const client = useFrakClient();
|
|
287
|
-
return _reactquery.useMutation.call(void 0, {
|
|
288
|
-
...mutations,
|
|
289
|
-
mutationKey: ["frak-sdk", "display-modal"],
|
|
290
|
-
mutationFn: async (args) => {
|
|
291
|
-
if (!client) {
|
|
292
|
-
throw new (0, _coresdk.ClientNotFound)();
|
|
293
|
-
}
|
|
294
|
-
return _actions.displayModal.call(void 0, client, args);
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// src/hook/useOpenSso.ts
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
function useOpenSso({ mutations } = {}) {
|
|
306
|
-
const client = useFrakClient();
|
|
307
|
-
return _reactquery.useMutation.call(void 0, {
|
|
308
|
-
...mutations,
|
|
309
|
-
mutationKey: ["frak-sdk", "open-sso"],
|
|
310
|
-
mutationFn: async (params) => {
|
|
311
|
-
if (!client) {
|
|
312
|
-
throw new (0, _coresdk.ClientNotFound)();
|
|
313
|
-
}
|
|
314
|
-
return _actions.openSso.call(void 0, client, params);
|
|
315
|
-
}
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// src/hook/useGetProductInformation.ts
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
function useGetProductInformation({
|
|
326
|
-
query
|
|
327
|
-
} = {}) {
|
|
328
|
-
const client = useFrakClient();
|
|
329
|
-
return _reactquery.useQuery.call(void 0, {
|
|
330
|
-
...query,
|
|
331
|
-
queryKey: ["frak-sdk", "get-product-information"],
|
|
332
|
-
queryFn: async () => {
|
|
333
|
-
if (!client) {
|
|
334
|
-
throw new (0, _coresdk.ClientNotFound)();
|
|
335
|
-
}
|
|
336
|
-
return _actions.getProductInformation.call(void 0, client);
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
// src/provider/FrakIFrameClientProvider.ts
|
|
342
|
-
var FrakIFrameClientContext = _react.createContext.call(void 0,
|
|
343
|
-
void 0
|
|
344
|
-
);
|
|
345
|
-
function FrakIFrameClientProvider({
|
|
346
|
-
style,
|
|
347
|
-
children
|
|
348
|
-
}) {
|
|
349
|
-
const config = useFrakConfig();
|
|
350
|
-
const [client, setClient] = _react.useState.call(void 0, void 0);
|
|
351
|
-
const iFrame = _react.createElement.call(void 0, "iframe", {
|
|
352
|
-
..._coresdk.baseIframeProps,
|
|
353
|
-
src: `${config.walletUrl}/listener`,
|
|
354
|
-
style: _nullishCoalesce(style, () => ( _coresdk.baseIframeProps.style)),
|
|
355
|
-
ref: (iframe) => {
|
|
356
|
-
if (!iframe || client) {
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
setClient(
|
|
360
|
-
_coresdk.createIFrameFrakClient.call(void 0, {
|
|
361
|
-
iframe,
|
|
362
|
-
config
|
|
363
|
-
})
|
|
364
|
-
);
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
const providerComponent = _react.createElement.call(void 0,
|
|
368
|
-
FrakIFrameClientContext.Provider,
|
|
369
|
-
{ value: client },
|
|
370
|
-
children
|
|
371
|
-
);
|
|
372
|
-
return _react.createElement.call(void 0, _react.Fragment, null, iFrame, providerComponent);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
exports.FrakConfigContext = FrakConfigContext; exports.FrakConfigProvider = FrakConfigProvider; exports.FrakIFrameClientContext = FrakIFrameClientContext; exports.FrakIFrameClientProvider = FrakIFrameClientProvider; exports.useDisplayModal = useDisplayModal; exports.useFrakClient = useFrakClient; exports.useFrakConfig = useFrakConfig; exports.useGetProductInformation = useGetProductInformation; exports.useOpenSso = useOpenSso; exports.useReferralInteraction = useReferralInteraction; exports.useSendInteraction = useSendInteraction; exports.useSendTransactionAction = useSendTransactionAction; exports.useSiweAuthenticate = useSiweAuthenticate; exports.useWalletStatus = useWalletStatus;
|
|
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=function(e,t){for(var a in t)__webpack_require__.o(t,a)&&!__webpack_require__.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.r=function(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__,{useSiweAuthenticate:()=>useSiweAuthenticate,useFrakConfig:()=>useFrakConfig,useOpenSso:()=>useOpenSso,useWalletStatus:()=>useWalletStatus,FrakIFrameClientContext:()=>FrakIFrameClientContext,FrakIFrameClientProvider:()=>FrakIFrameClientProvider,useGetProductInformation:()=>useGetProductInformation,useDisplayModal:()=>useDisplayModal,FrakConfigProvider:()=>FrakConfigProvider,FrakConfigContext:()=>FrakConfigContext,useReferralInteraction:()=>useReferralInteraction,useFrakClient:()=>useFrakClient,useSendInteraction:()=>useSendInteraction,useSendTransactionAction:()=>useSendTransactionAction});let external_react_namespaceObject=require("react"),FrakConfigContext=(0,external_react_namespaceObject.createContext)(void 0);function FrakConfigProvider(e){let{children:t,config:a}=e;return(0,external_react_namespaceObject.createElement)(FrakConfigContext.Provider,{value:{...a,walletUrl:a.walletUrl??"https://wallet.frak.id",domain:a.domain??("undefined"!=typeof window?window?.location?.host:void 0)??"not-found"}},t)}let core_sdk_namespaceObject=require("@frak-labs/core-sdk");function useFrakConfig(){let e=(0,external_react_namespaceObject.useContext)(FrakConfigContext);if(!e)throw new core_sdk_namespaceObject.FrakRpcError(core_sdk_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 a=useFrakConfig(),[n,r]=(0,external_react_namespaceObject.useState)(void 0),c=(0,external_react_namespaceObject.createElement)("iframe",{...core_sdk_namespaceObject.baseIframeProps,src:`${a.walletUrl}/listener`,style:e??core_sdk_namespaceObject.baseIframeProps.style,ref:e=>{e&&!n&&r((0,core_sdk_namespaceObject.createIFrameFrakClient)({iframe:e,config:a}))}}),o=(0,external_react_namespaceObject.createElement)(FrakIFrameClientContext.Provider,{value:n},t);return(0,external_react_namespaceObject.createElement)(external_react_namespaceObject.Fragment,null,c,o)}let actions_namespaceObject=require("@frak-labs/core-sdk/actions"),react_query_namespaceObject=require("@tanstack/react-query");function useFrakClient(){return(0,external_react_namespaceObject.useContext)(FrakIFrameClientContext)}function useWalletStatus(){let e=(0,react_query_namespaceObject.useQueryClient)(),t=useFrakClient(),a=(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 core_sdk_namespaceObject.ClientNotFound;return(0,actions_namespaceObject.watchWalletStatus)(t,a)},enabled:!!t})}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,a]=(0,external_react_namespaceObject.useState)(e?window.location:void 0);(0,external_react_namespaceObject.useEffect)(()=>{if(e)return t||n(),window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)};function n(){a(window.location)}},[e,t]);let n=(0,external_react_namespaceObject.useMemo)(()=>t?.href,[t?.href]);return{location:t,href:n}}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:a}={}){let n=useFrakClient(),{frakContext:r}=useFrakContext(),{data:c}=useWalletStatus(),{data:o,error:s,status:u}=(0,react_query_namespaceObject.useQuery)({gcTime:0,staleTime:0,queryKey:["frak-sdk","auto-referral-interaction",r?.r??"no-referrer",c?.key??"no-wallet-status",e??"no-product-id"],queryFn:()=>{if(!n)throw new core_sdk_namespaceObject.ClientNotFound;return(0,actions_namespaceObject.processReferral)(n,{walletStatus:c,frakContext:r,modalConfig:t,productId:e,options:a})},enabled:!!c});return(0,external_react_namespaceObject.useMemo)(()=>"pending"===u?"processing":"error"===u?s:o||"idle",[o,u,s])}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 core_sdk_namespaceObject.ClientNotFound;return(0,actions_namespaceObject.getProductInformation)(t)}})}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 core_sdk_namespaceObject.ClientNotFound;return(0,actions_namespaceObject.siweAuthenticate)(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 core_sdk_namespaceObject.ClientNotFound;return(0,actions_namespaceObject.openSso)(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 core_sdk_namespaceObject.ClientNotFound;return(0,actions_namespaceObject.sendInteraction)(t,e)}})}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 core_sdk_namespaceObject.ClientNotFound;return(0,actions_namespaceObject.displayModal)(t,e)}})}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 core_sdk_namespaceObject.ClientNotFound;return(0,actions_namespaceObject.sendTransaction)(t,e)}})}var __webpack_export_target__=exports;for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__]=__webpack_exports__[__webpack_i__];__webpack_exports__.__esModule&&Object.defineProperty(__webpack_export_target__,"__esModule",{value:!0});
|