@frak-labs/nexus-sdk 0.0.22 → 0.0.24
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/{FrakContext-DBdWC7ls.d.cts → FrakContext-DKSVaeVb.d.cts} +62 -3
- package/dist/{FrakContext-CDVlUN75.d.ts → FrakContext-DjeuWC2U.d.ts} +62 -3
- package/dist/bundle/bundle.js +5 -5
- package/dist/{chunk-ZQSA2VQ4.js → chunk-2VNIEGOJ.js} +10 -6
- package/dist/{chunk-Q3SIIAX2.js → chunk-4MMSQL44.js} +147 -28
- package/dist/{chunk-4OJ2NPAS.cjs → chunk-4PVF24BB.cjs} +15 -15
- package/dist/{chunk-H3T2GAEC.js → chunk-BOGCLEPR.js} +2 -1
- package/dist/chunk-DE2KWQVP.cjs +351 -0
- package/dist/{chunk-P4QEVLVV.js → chunk-FETGS7X7.js} +1 -1
- package/dist/{chunk-F3F4BCGV.cjs → chunk-H4BK3CNV.cjs} +20 -16
- package/dist/{chunk-QSXZKZJA.cjs → chunk-P3J2BIUT.cjs} +2 -1
- package/dist/{chunk-QYOOKB34.cjs → chunk-QLM5NFMZ.cjs} +22 -22
- package/dist/{chunk-VVF4NKYR.js → chunk-YPQA63LW.js} +2 -2
- package/dist/core/actions/index.cjs +9 -5
- package/dist/core/actions/index.d.cts +51 -6
- package/dist/core/actions/index.d.ts +51 -6
- package/dist/core/actions/index.js +10 -6
- package/dist/core/index.cjs +4 -4
- package/dist/core/index.d.cts +13 -25
- package/dist/core/index.d.ts +13 -25
- package/dist/core/index.js +3 -3
- package/dist/core/interactions/index.cjs +3 -3
- package/dist/core/interactions/index.js +2 -2
- package/dist/{processReferral-CFyGAENf.d.ts → processReferral-CJI_Rc4K.d.ts} +1 -1
- package/dist/{processReferral-BWSIamn2.d.cts → processReferral-DUP8imQV.d.cts} +1 -1
- package/dist/react/index.cjs +52 -31
- package/dist/react/index.d.cts +20 -13
- package/dist/react/index.d.ts +20 -13
- package/dist/react/index.js +32 -11
- package/package.json +42 -19
- package/dist/chunk-4CWA7EWX.cjs +0 -232
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType,
|
|
1
|
+
import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType, G as GetProductInformationReturnType, k as SendTransactionModalStepType, o as FinalModalStepType, q as FinalActionType, L as LoginModalStepType, n as OpenInteractionSessionModalStepType, c as ModalRpcMetadata } from '../../FrakContext-DKSVaeVb.cjs';
|
|
2
2
|
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-BngPoHA0.cjs';
|
|
3
|
-
import { P as ProcessReferralOptions } from '../../processReferral-
|
|
4
|
-
export { S as SendTransactionParams, a as SiweAuthenticateModalParams, p as processReferral, b as sendTransaction, s as siweAuthenticate } from '../../processReferral-
|
|
3
|
+
import { P as ProcessReferralOptions } from '../../processReferral-DUP8imQV.cjs';
|
|
4
|
+
export { S as SendTransactionParams, a as SiweAuthenticateModalParams, p as processReferral, b as sendTransaction, s as siweAuthenticate } from '../../processReferral-DUP8imQV.cjs';
|
|
5
5
|
import { Hex } from 'viem';
|
|
6
6
|
import 'viem/chains';
|
|
7
7
|
import 'viem/siwe';
|
|
@@ -11,7 +11,7 @@ import 'viem/siwe';
|
|
|
11
11
|
* @param client
|
|
12
12
|
* @param callback
|
|
13
13
|
*/
|
|
14
|
-
declare function watchWalletStatus(client: NexusClient, callback
|
|
14
|
+
declare function watchWalletStatus(client: NexusClient, callback?: (status: WalletStatusReturnType) => void): Promise<WalletStatusReturnType>;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Function used to send an interaction
|
|
@@ -36,7 +36,52 @@ declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(cli
|
|
|
36
36
|
*/
|
|
37
37
|
declare function openSso(client: NexusClient, args: OpenSsoParamsType): Promise<void>;
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Function used to get the current product information
|
|
41
|
+
* @param client
|
|
42
|
+
*/
|
|
43
|
+
declare function getProductInformation(client: NexusClient): Promise<GetProductInformationReturnType>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Function used to track the status of a purchase
|
|
47
|
+
*/
|
|
48
|
+
declare function trackPurchaseStatus(args: {
|
|
49
|
+
customerId: string | number;
|
|
50
|
+
orderId: string | number;
|
|
51
|
+
token: string;
|
|
52
|
+
}): Promise<void>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Represent the type of the modal step builder
|
|
56
|
+
*/
|
|
57
|
+
type ModalStepBuilder<Steps extends ModalStepTypes[] = ModalStepTypes[]> = {
|
|
58
|
+
params: DisplayModalParamsType<Steps>;
|
|
59
|
+
sendTx: (options: SendTransactionModalStepType["params"]) => ModalStepBuilder<[...Steps, SendTransactionModalStepType]>;
|
|
60
|
+
reward: (options?: Omit<FinalModalStepType["params"], "action">) => ModalStepBuilder<[...Steps, FinalModalStepType]>;
|
|
61
|
+
sharing: (sharingOptions?: Extract<FinalActionType, {
|
|
62
|
+
key: "sharing";
|
|
63
|
+
}>["options"], options?: Omit<FinalModalStepType["params"], "action">) => ModalStepBuilder<[...Steps, FinalModalStepType]>;
|
|
64
|
+
display: () => Promise<ModalRpcStepsResultType<Steps>>;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Represent the output type of the modal builder
|
|
68
|
+
*/
|
|
69
|
+
type ModalBuilder = ModalStepBuilder<[
|
|
70
|
+
LoginModalStepType,
|
|
71
|
+
OpenInteractionSessionModalStepType
|
|
72
|
+
]>;
|
|
73
|
+
/**
|
|
74
|
+
* Simple modal builder params builder
|
|
75
|
+
* @param client
|
|
76
|
+
* @param metadata
|
|
77
|
+
* @param login
|
|
78
|
+
* @param openSession
|
|
79
|
+
*/
|
|
80
|
+
declare function modalBuilder(client: NexusClient, { metadata, login, openSession, }: {
|
|
81
|
+
metadata?: ModalRpcMetadata;
|
|
82
|
+
login?: LoginModalStepType["params"];
|
|
83
|
+
openSession?: OpenInteractionSessionModalStepType["params"];
|
|
84
|
+
}): ModalBuilder;
|
|
40
85
|
|
|
41
86
|
declare function referralInteraction(client: NexusClient, { productId, modalConfig, options, }?: {
|
|
42
87
|
productId?: Hex;
|
|
@@ -44,4 +89,4 @@ declare function referralInteraction(client: NexusClient, { productId, modalConf
|
|
|
44
89
|
options?: ProcessReferralOptions;
|
|
45
90
|
}): Promise<unknown>;
|
|
46
91
|
|
|
47
|
-
export { displayModal, openSso, referralInteraction, sendInteraction,
|
|
92
|
+
export { type ModalBuilder, type ModalStepBuilder, displayModal, getProductInformation, modalBuilder, openSso, referralInteraction, sendInteraction, trackPurchaseStatus, watchWalletStatus };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType,
|
|
1
|
+
import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType, G as GetProductInformationReturnType, k as SendTransactionModalStepType, o as FinalModalStepType, q as FinalActionType, L as LoginModalStepType, n as OpenInteractionSessionModalStepType, c as ModalRpcMetadata } from '../../FrakContext-DjeuWC2U.js';
|
|
2
2
|
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-BngPoHA0.js';
|
|
3
|
-
import { P as ProcessReferralOptions } from '../../processReferral-
|
|
4
|
-
export { S as SendTransactionParams, a as SiweAuthenticateModalParams, p as processReferral, b as sendTransaction, s as siweAuthenticate } from '../../processReferral-
|
|
3
|
+
import { P as ProcessReferralOptions } from '../../processReferral-CJI_Rc4K.js';
|
|
4
|
+
export { S as SendTransactionParams, a as SiweAuthenticateModalParams, p as processReferral, b as sendTransaction, s as siweAuthenticate } from '../../processReferral-CJI_Rc4K.js';
|
|
5
5
|
import { Hex } from 'viem';
|
|
6
6
|
import 'viem/chains';
|
|
7
7
|
import 'viem/siwe';
|
|
@@ -11,7 +11,7 @@ import 'viem/siwe';
|
|
|
11
11
|
* @param client
|
|
12
12
|
* @param callback
|
|
13
13
|
*/
|
|
14
|
-
declare function watchWalletStatus(client: NexusClient, callback
|
|
14
|
+
declare function watchWalletStatus(client: NexusClient, callback?: (status: WalletStatusReturnType) => void): Promise<WalletStatusReturnType>;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Function used to send an interaction
|
|
@@ -36,7 +36,52 @@ declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(cli
|
|
|
36
36
|
*/
|
|
37
37
|
declare function openSso(client: NexusClient, args: OpenSsoParamsType): Promise<void>;
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Function used to get the current product information
|
|
41
|
+
* @param client
|
|
42
|
+
*/
|
|
43
|
+
declare function getProductInformation(client: NexusClient): Promise<GetProductInformationReturnType>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Function used to track the status of a purchase
|
|
47
|
+
*/
|
|
48
|
+
declare function trackPurchaseStatus(args: {
|
|
49
|
+
customerId: string | number;
|
|
50
|
+
orderId: string | number;
|
|
51
|
+
token: string;
|
|
52
|
+
}): Promise<void>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Represent the type of the modal step builder
|
|
56
|
+
*/
|
|
57
|
+
type ModalStepBuilder<Steps extends ModalStepTypes[] = ModalStepTypes[]> = {
|
|
58
|
+
params: DisplayModalParamsType<Steps>;
|
|
59
|
+
sendTx: (options: SendTransactionModalStepType["params"]) => ModalStepBuilder<[...Steps, SendTransactionModalStepType]>;
|
|
60
|
+
reward: (options?: Omit<FinalModalStepType["params"], "action">) => ModalStepBuilder<[...Steps, FinalModalStepType]>;
|
|
61
|
+
sharing: (sharingOptions?: Extract<FinalActionType, {
|
|
62
|
+
key: "sharing";
|
|
63
|
+
}>["options"], options?: Omit<FinalModalStepType["params"], "action">) => ModalStepBuilder<[...Steps, FinalModalStepType]>;
|
|
64
|
+
display: () => Promise<ModalRpcStepsResultType<Steps>>;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Represent the output type of the modal builder
|
|
68
|
+
*/
|
|
69
|
+
type ModalBuilder = ModalStepBuilder<[
|
|
70
|
+
LoginModalStepType,
|
|
71
|
+
OpenInteractionSessionModalStepType
|
|
72
|
+
]>;
|
|
73
|
+
/**
|
|
74
|
+
* Simple modal builder params builder
|
|
75
|
+
* @param client
|
|
76
|
+
* @param metadata
|
|
77
|
+
* @param login
|
|
78
|
+
* @param openSession
|
|
79
|
+
*/
|
|
80
|
+
declare function modalBuilder(client: NexusClient, { metadata, login, openSession, }: {
|
|
81
|
+
metadata?: ModalRpcMetadata;
|
|
82
|
+
login?: LoginModalStepType["params"];
|
|
83
|
+
openSession?: OpenInteractionSessionModalStepType["params"];
|
|
84
|
+
}): ModalBuilder;
|
|
40
85
|
|
|
41
86
|
declare function referralInteraction(client: NexusClient, { productId, modalConfig, options, }?: {
|
|
42
87
|
productId?: Hex;
|
|
@@ -44,4 +89,4 @@ declare function referralInteraction(client: NexusClient, { productId, modalConf
|
|
|
44
89
|
options?: ProcessReferralOptions;
|
|
45
90
|
}): Promise<unknown>;
|
|
46
91
|
|
|
47
|
-
export { displayModal, openSso, referralInteraction, sendInteraction,
|
|
92
|
+
export { type ModalBuilder, type ModalStepBuilder, displayModal, getProductInformation, modalBuilder, openSso, referralInteraction, sendInteraction, trackPurchaseStatus, watchWalletStatus };
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
displayModal,
|
|
3
|
+
getProductInformation,
|
|
4
|
+
modalBuilder,
|
|
3
5
|
openSso,
|
|
4
6
|
processReferral,
|
|
5
7
|
referralInteraction,
|
|
6
8
|
sendInteraction,
|
|
7
9
|
sendTransaction,
|
|
8
10
|
siweAuthenticate,
|
|
9
|
-
|
|
11
|
+
trackPurchaseStatus,
|
|
10
12
|
watchWalletStatus
|
|
11
|
-
} from "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
13
|
+
} from "../../chunk-4MMSQL44.js";
|
|
14
|
+
import "../../chunk-2VNIEGOJ.js";
|
|
15
|
+
import "../../chunk-FETGS7X7.js";
|
|
16
|
+
import "../../chunk-BOGCLEPR.js";
|
|
15
17
|
export {
|
|
16
18
|
displayModal,
|
|
19
|
+
getProductInformation,
|
|
20
|
+
modalBuilder,
|
|
17
21
|
openSso,
|
|
18
22
|
processReferral,
|
|
19
23
|
referralInteraction,
|
|
20
24
|
sendInteraction,
|
|
21
25
|
sendTransaction,
|
|
22
26
|
siweAuthenticate,
|
|
23
|
-
|
|
27
|
+
trackPurchaseStatus,
|
|
24
28
|
watchWalletStatus
|
|
25
29
|
};
|
package/dist/core/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkQLM5NFMZcjs = require('../chunk-QLM5NFMZ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -11,12 +11,12 @@ var _chunkQYOOKB34cjs = require('../chunk-QYOOKB34.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkH4BK3CNVcjs = require('../chunk-H4BK3CNV.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkP3J2BIUTcjs = require('../chunk-P3J2BIUT.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -31,4 +31,4 @@ var _chunkQSXZKZJAcjs = require('../chunk-QSXZKZJA.cjs');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
exports.Deferred =
|
|
34
|
+
exports.Deferred = _chunkH4BK3CNVcjs.Deferred; exports.FrakContextManager = _chunkH4BK3CNVcjs.FrakContextManager; exports.FrakRpcError = _chunkH4BK3CNVcjs.FrakRpcError; exports.RpcErrorCodes = _chunkH4BK3CNVcjs.RpcErrorCodes; exports.compressJson = _chunkH4BK3CNVcjs.compressJson; exports.createIFrameNexusClient = _chunkQLM5NFMZcjs.createIFrameNexusClient; exports.createIframe = _chunkH4BK3CNVcjs.createIframe; exports.decompressDataAndCheckHash = _chunkH4BK3CNVcjs.decompressDataAndCheckHash; exports.decompressJson = _chunkH4BK3CNVcjs.decompressJson; exports.hashAndCompressData = _chunkH4BK3CNVcjs.hashAndCompressData; exports.interactionTypes = _chunkP3J2BIUTcjs.interactionTypes; exports.productTypes = _chunkP3J2BIUTcjs.productTypes; exports.productTypesMask = _chunkP3J2BIUTcjs.productTypesMask;
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NexusWalletSdkConfig, a as NexusClient, F as FrakContext } from '../FrakContext-
|
|
2
|
-
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc,
|
|
1
|
+
import { N as NexusWalletSdkConfig, a as NexusClient, F as FrakContext } from '../FrakContext-DKSVaeVb.cjs';
|
|
2
|
+
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, v as ExtractedReturnTypeFromRpc, q as FinalActionType, o as FinalModalStepType, G as GetProductInformationReturnType, t as IFrameEvent, u as IFrameLifecycleEvent, s as IFrameRpcEvent, I as IFrameRpcSchema, r as IFrameTransport, L as LoginModalStepType, c as ModalRpcMetadata, d as ModalRpcStepsInput, e as ModalRpcStepsResultType, f as ModalStepMetadata, M as ModalStepTypes, n as OpenInteractionSessionModalStepType, m as OpenInteractionSessionReturnType, O as OpenSsoParamsType, P as ProductTypesKey, R as RpcResponse, k as SendTransactionModalStepType, l as SendTransactionReturnType, j as SendTransactionTxType, g as SiweAuthenticateModalStepType, i as SiweAuthenticateReturnType, h as SiweAuthenticationParams, S as SsoMetadata, W as WalletStatusReturnType, p as productTypes, b as productTypesMask } from '../FrakContext-DKSVaeVb.cjs';
|
|
3
3
|
import { Address } from 'viem';
|
|
4
4
|
export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.cjs';
|
|
5
5
|
export { F as FrakRpcError, R as RpcErrorCodes } from '../error-Dflr3G5x.cjs';
|
|
@@ -35,11 +35,11 @@ declare function createIFrameNexusClient({ config, iframe, }: {
|
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Create the given iframe
|
|
38
|
-
* @param walletBaseUrl
|
|
38
|
+
* @param walletBaseUrl - @deprecated Use config.walletUrl instead. Will be removed in future versions.
|
|
39
39
|
* @param config
|
|
40
40
|
*/
|
|
41
41
|
declare function createIframe({ walletBaseUrl, config, }: {
|
|
42
|
-
walletBaseUrl
|
|
42
|
+
walletBaseUrl?: string;
|
|
43
43
|
config?: NexusWalletSdkConfig;
|
|
44
44
|
}): Promise<HTMLIFrameElement | undefined>;
|
|
45
45
|
|
|
@@ -127,30 +127,17 @@ declare class Deferred<T> {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
* The keys for each
|
|
131
|
-
*/
|
|
132
|
-
type ProductTypesKey = keyof typeof productTypes;
|
|
133
|
-
/**
|
|
134
|
-
* List of the product types per denominator
|
|
135
|
-
*/
|
|
136
|
-
declare const productTypes: {
|
|
137
|
-
dapp: number;
|
|
138
|
-
press: number;
|
|
139
|
-
webshop: number;
|
|
140
|
-
referral: number;
|
|
141
|
-
purchase: number;
|
|
142
|
-
};
|
|
143
|
-
/**
|
|
144
|
-
* Bitmask for each product types
|
|
145
|
-
*/
|
|
146
|
-
declare const productTypesMask: Record<ProductTypesKey, bigint>;
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* The keys for each interaction types
|
|
130
|
+
* The final keys for each interaction types (e.g. `openArticle`) -> interaction type
|
|
150
131
|
*/
|
|
151
132
|
type InteractionTypesKey = {
|
|
152
133
|
[K in keyof typeof interactionTypes]: keyof (typeof interactionTypes)[K];
|
|
153
134
|
}[keyof typeof interactionTypes];
|
|
135
|
+
/**
|
|
136
|
+
* The keys for each interaction types (e.g. `press.openArticle`) -> category_type.interaction_type
|
|
137
|
+
*/
|
|
138
|
+
type FullInteractionTypesKey = {
|
|
139
|
+
[Category in keyof typeof interactionTypes]: `${Category & string}.${keyof (typeof interactionTypes)[Category] & string}`;
|
|
140
|
+
}[keyof typeof interactionTypes];
|
|
154
141
|
/**
|
|
155
142
|
* Each interactions types according to the product types
|
|
156
143
|
*/
|
|
@@ -173,7 +160,8 @@ declare const interactionTypes: {
|
|
|
173
160
|
readonly purchase: {
|
|
174
161
|
readonly started: "0xd87e90c3";
|
|
175
162
|
readonly completed: "0x8403aeb4";
|
|
163
|
+
readonly unsafeCompleted: "0x4d5b14e0";
|
|
176
164
|
};
|
|
177
165
|
};
|
|
178
166
|
|
|
179
|
-
export { type CompressedData, Deferred, FrakContextManager, type HashProtectedData, type InteractionTypesKey, type KeyProvider, NexusClient, NexusWalletSdkConfig,
|
|
167
|
+
export { type CompressedData, Deferred, FrakContextManager, type FullInteractionTypesKey, type HashProtectedData, type InteractionTypesKey, type KeyProvider, NexusClient, NexusWalletSdkConfig, compressJson, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, decompressJson, hashAndCompressData, interactionTypes };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NexusWalletSdkConfig, a as NexusClient, F as FrakContext } from '../FrakContext-
|
|
2
|
-
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc,
|
|
1
|
+
import { N as NexusWalletSdkConfig, a as NexusClient, F as FrakContext } from '../FrakContext-DjeuWC2U.js';
|
|
2
|
+
export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, v as ExtractedReturnTypeFromRpc, q as FinalActionType, o as FinalModalStepType, G as GetProductInformationReturnType, t as IFrameEvent, u as IFrameLifecycleEvent, s as IFrameRpcEvent, I as IFrameRpcSchema, r as IFrameTransport, L as LoginModalStepType, c as ModalRpcMetadata, d as ModalRpcStepsInput, e as ModalRpcStepsResultType, f as ModalStepMetadata, M as ModalStepTypes, n as OpenInteractionSessionModalStepType, m as OpenInteractionSessionReturnType, O as OpenSsoParamsType, P as ProductTypesKey, R as RpcResponse, k as SendTransactionModalStepType, l as SendTransactionReturnType, j as SendTransactionTxType, g as SiweAuthenticateModalStepType, i as SiweAuthenticateReturnType, h as SiweAuthenticationParams, S as SsoMetadata, W as WalletStatusReturnType, p as productTypes, b as productTypesMask } from '../FrakContext-DjeuWC2U.js';
|
|
3
3
|
import { Address } from 'viem';
|
|
4
4
|
export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.js';
|
|
5
5
|
export { F as FrakRpcError, R as RpcErrorCodes } from '../error-Dflr3G5x.js';
|
|
@@ -35,11 +35,11 @@ declare function createIFrameNexusClient({ config, iframe, }: {
|
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Create the given iframe
|
|
38
|
-
* @param walletBaseUrl
|
|
38
|
+
* @param walletBaseUrl - @deprecated Use config.walletUrl instead. Will be removed in future versions.
|
|
39
39
|
* @param config
|
|
40
40
|
*/
|
|
41
41
|
declare function createIframe({ walletBaseUrl, config, }: {
|
|
42
|
-
walletBaseUrl
|
|
42
|
+
walletBaseUrl?: string;
|
|
43
43
|
config?: NexusWalletSdkConfig;
|
|
44
44
|
}): Promise<HTMLIFrameElement | undefined>;
|
|
45
45
|
|
|
@@ -127,30 +127,17 @@ declare class Deferred<T> {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
* The keys for each
|
|
131
|
-
*/
|
|
132
|
-
type ProductTypesKey = keyof typeof productTypes;
|
|
133
|
-
/**
|
|
134
|
-
* List of the product types per denominator
|
|
135
|
-
*/
|
|
136
|
-
declare const productTypes: {
|
|
137
|
-
dapp: number;
|
|
138
|
-
press: number;
|
|
139
|
-
webshop: number;
|
|
140
|
-
referral: number;
|
|
141
|
-
purchase: number;
|
|
142
|
-
};
|
|
143
|
-
/**
|
|
144
|
-
* Bitmask for each product types
|
|
145
|
-
*/
|
|
146
|
-
declare const productTypesMask: Record<ProductTypesKey, bigint>;
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* The keys for each interaction types
|
|
130
|
+
* The final keys for each interaction types (e.g. `openArticle`) -> interaction type
|
|
150
131
|
*/
|
|
151
132
|
type InteractionTypesKey = {
|
|
152
133
|
[K in keyof typeof interactionTypes]: keyof (typeof interactionTypes)[K];
|
|
153
134
|
}[keyof typeof interactionTypes];
|
|
135
|
+
/**
|
|
136
|
+
* The keys for each interaction types (e.g. `press.openArticle`) -> category_type.interaction_type
|
|
137
|
+
*/
|
|
138
|
+
type FullInteractionTypesKey = {
|
|
139
|
+
[Category in keyof typeof interactionTypes]: `${Category & string}.${keyof (typeof interactionTypes)[Category] & string}`;
|
|
140
|
+
}[keyof typeof interactionTypes];
|
|
154
141
|
/**
|
|
155
142
|
* Each interactions types according to the product types
|
|
156
143
|
*/
|
|
@@ -173,7 +160,8 @@ declare const interactionTypes: {
|
|
|
173
160
|
readonly purchase: {
|
|
174
161
|
readonly started: "0xd87e90c3";
|
|
175
162
|
readonly completed: "0x8403aeb4";
|
|
163
|
+
readonly unsafeCompleted: "0x4d5b14e0";
|
|
176
164
|
};
|
|
177
165
|
};
|
|
178
166
|
|
|
179
|
-
export { type CompressedData, Deferred, FrakContextManager, type HashProtectedData, type InteractionTypesKey, type KeyProvider, NexusClient, NexusWalletSdkConfig,
|
|
167
|
+
export { type CompressedData, Deferred, FrakContextManager, type FullInteractionTypesKey, type HashProtectedData, type InteractionTypesKey, type KeyProvider, NexusClient, NexusWalletSdkConfig, compressJson, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, decompressJson, hashAndCompressData, interactionTypes };
|
package/dist/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createIFrameNexusClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-YPQA63LW.js";
|
|
4
4
|
import {
|
|
5
5
|
Deferred,
|
|
6
6
|
FrakContextManager,
|
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
decompressDataAndCheckHash,
|
|
12
12
|
decompressJson,
|
|
13
13
|
hashAndCompressData
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-2VNIEGOJ.js";
|
|
15
15
|
import {
|
|
16
16
|
interactionTypes,
|
|
17
17
|
productTypes,
|
|
18
18
|
productTypesMask
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-BOGCLEPR.js";
|
|
20
20
|
export {
|
|
21
21
|
Deferred,
|
|
22
22
|
FrakContextManager,
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('../../chunk-
|
|
6
|
+
var _chunk4PVF24BBcjs = require('../../chunk-4PVF24BB.cjs');
|
|
7
|
+
require('../../chunk-P3J2BIUT.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
exports.PressInteractionEncoder =
|
|
13
|
+
exports.PressInteractionEncoder = _chunk4PVF24BBcjs.PressInteractionEncoder; exports.PurchaseInteractionEncoder = _chunk4PVF24BBcjs.PurchaseInteractionEncoder; exports.ReferralInteractionEncoder = _chunk4PVF24BBcjs.ReferralInteractionEncoder; exports.WebShopInteractionEncoder = _chunk4PVF24BBcjs.WebShopInteractionEncoder;
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
PurchaseInteractionEncoder,
|
|
4
4
|
ReferralInteractionEncoder,
|
|
5
5
|
WebShopInteractionEncoder
|
|
6
|
-
} from "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
} from "../../chunk-FETGS7X7.js";
|
|
7
|
+
import "../../chunk-BOGCLEPR.js";
|
|
8
8
|
export {
|
|
9
9
|
PressInteractionEncoder,
|
|
10
10
|
PurchaseInteractionEncoder,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as SiweAuthenticationParams, c as ModalRpcMetadata, a as NexusClient, i as SiweAuthenticateReturnType, k as SendTransactionModalStepType, l as SendTransactionReturnType, W as WalletStatusReturnType, F as FrakContext, D as DisplayModalParamsType, M as ModalStepTypes } from './FrakContext-DjeuWC2U.js';
|
|
2
2
|
import { Hex } from 'viem';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as SiweAuthenticationParams, c as ModalRpcMetadata, a as NexusClient, i as SiweAuthenticateReturnType, k as SendTransactionModalStepType, l as SendTransactionReturnType, W as WalletStatusReturnType, F as FrakContext, D as DisplayModalParamsType, M as ModalStepTypes } from './FrakContext-DKSVaeVb.cjs';
|
|
2
2
|
import { Hex } from 'viem';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/react/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkQLM5NFMZcjs = require('../chunk-QLM5NFMZ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -9,16 +9,17 @@ var _chunkQYOOKB34cjs = require('../chunk-QYOOKB34.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var _chunk4CWA7EWXcjs = require('../chunk-4CWA7EWX.cjs');
|
|
13
12
|
|
|
13
|
+
var _chunkDE2KWQVPcjs = require('../chunk-DE2KWQVP.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
require('../chunk-
|
|
21
|
-
require('../chunk-
|
|
19
|
+
|
|
20
|
+
var _chunkH4BK3CNVcjs = require('../chunk-H4BK3CNV.cjs');
|
|
21
|
+
require('../chunk-4PVF24BB.cjs');
|
|
22
|
+
require('../chunk-P3J2BIUT.cjs');
|
|
22
23
|
|
|
23
24
|
// src/react/provider/NexusConfigProvider.ts
|
|
24
25
|
var _react = require('react');
|
|
@@ -30,6 +31,7 @@ function NexusConfigProvider(parameters) {
|
|
|
30
31
|
{
|
|
31
32
|
value: {
|
|
32
33
|
...config,
|
|
34
|
+
walletUrl: _nullishCoalesce(config.walletUrl, () => ( "https://wallet.frak.id")),
|
|
33
35
|
domain: _nullishCoalesce(_nullishCoalesce(config.domain, () => ( (typeof window !== "undefined" ? _optionalChain([window, 'optionalAccess', _ => _.location, 'optionalAccess', _2 => _2.host]) : void 0))), () => ( "not-found"))
|
|
34
36
|
}
|
|
35
37
|
},
|
|
@@ -50,8 +52,8 @@ function NexusConfigProvider(parameters) {
|
|
|
50
52
|
function useNexusConfig() {
|
|
51
53
|
const config = _react.useContext.call(void 0, NexusConfigContext);
|
|
52
54
|
if (!config) {
|
|
53
|
-
throw new (0,
|
|
54
|
-
|
|
55
|
+
throw new (0, _chunkH4BK3CNVcjs.FrakRpcError)(
|
|
56
|
+
_chunkH4BK3CNVcjs.RpcErrorCodes.configError,
|
|
55
57
|
"Nexus config not found"
|
|
56
58
|
);
|
|
57
59
|
}
|
|
@@ -85,9 +87,9 @@ function useWalletStatus() {
|
|
|
85
87
|
queryKey: ["nexus-sdk", "wallet-status-listener"],
|
|
86
88
|
queryFn: async () => {
|
|
87
89
|
if (!client) {
|
|
88
|
-
throw new (0,
|
|
90
|
+
throw new (0, _chunkH4BK3CNVcjs.ClientNotFound)();
|
|
89
91
|
}
|
|
90
|
-
return
|
|
92
|
+
return _chunkDE2KWQVPcjs.watchWalletStatus.call(void 0, client, newStatusUpdated);
|
|
91
93
|
},
|
|
92
94
|
enabled: !!client
|
|
93
95
|
});
|
|
@@ -104,9 +106,9 @@ function useSendTransactionAction({
|
|
|
104
106
|
mutationKey: ["nexus-sdk", "send-transaction"],
|
|
105
107
|
mutationFn: async (params) => {
|
|
106
108
|
if (!client) {
|
|
107
|
-
throw new (0,
|
|
109
|
+
throw new (0, _chunkH4BK3CNVcjs.ClientNotFound)();
|
|
108
110
|
}
|
|
109
|
-
return
|
|
111
|
+
return _chunkDE2KWQVPcjs.sendTransaction.call(void 0, client, params);
|
|
110
112
|
}
|
|
111
113
|
});
|
|
112
114
|
}
|
|
@@ -126,9 +128,9 @@ function useSiweAuthenticate({
|
|
|
126
128
|
],
|
|
127
129
|
mutationFn: async (params) => {
|
|
128
130
|
if (!client) {
|
|
129
|
-
throw new (0,
|
|
131
|
+
throw new (0, _chunkH4BK3CNVcjs.ClientNotFound)();
|
|
130
132
|
}
|
|
131
|
-
return
|
|
133
|
+
return _chunkDE2KWQVPcjs.siweAuthenticate.call(void 0, client, params);
|
|
132
134
|
}
|
|
133
135
|
});
|
|
134
136
|
}
|
|
@@ -181,12 +183,12 @@ function useFrakContext() {
|
|
|
181
183
|
const { location } = useWindowLocation();
|
|
182
184
|
const frakContext = _react.useMemo.call(void 0, () => {
|
|
183
185
|
if (!_optionalChain([location, 'optionalAccess', _7 => _7.href])) return null;
|
|
184
|
-
return
|
|
186
|
+
return _chunkH4BK3CNVcjs.FrakContextManager.parse({ url: location.href });
|
|
185
187
|
}, [_optionalChain([location, 'optionalAccess', _8 => _8.href])]);
|
|
186
188
|
const updateContext = _react.useCallback.call(void 0,
|
|
187
189
|
(newContext) => {
|
|
188
190
|
console.log("Updating context", { newContext });
|
|
189
|
-
|
|
191
|
+
_chunkH4BK3CNVcjs.FrakContextManager.replaceUrl({
|
|
190
192
|
url: _optionalChain([location, 'optionalAccess', _9 => _9.href]),
|
|
191
193
|
context: newContext
|
|
192
194
|
});
|
|
@@ -207,7 +209,7 @@ function useReferralInteraction({
|
|
|
207
209
|
} = {}) {
|
|
208
210
|
const client = useNexusClient();
|
|
209
211
|
const { frakContext } = useFrakContext();
|
|
210
|
-
const { data:
|
|
212
|
+
const { data: walletStatus } = useWalletStatus();
|
|
211
213
|
const {
|
|
212
214
|
data: referralState,
|
|
213
215
|
error,
|
|
@@ -219,22 +221,22 @@ function useReferralInteraction({
|
|
|
219
221
|
"nexus-sdk",
|
|
220
222
|
"auto-referral-interaction",
|
|
221
223
|
_nullishCoalesce(_optionalChain([frakContext, 'optionalAccess', _11 => _11.r]), () => ( "no-referrer")),
|
|
222
|
-
_nullishCoalesce(_optionalChain([
|
|
224
|
+
_nullishCoalesce(_optionalChain([walletStatus, 'optionalAccess', _12 => _12.key]), () => ( "no-wallet-status")),
|
|
223
225
|
_nullishCoalesce(productId, () => ( "no-product-id"))
|
|
224
226
|
],
|
|
225
227
|
queryFn: () => {
|
|
226
228
|
if (!client) {
|
|
227
|
-
throw new (0,
|
|
229
|
+
throw new (0, _chunkH4BK3CNVcjs.ClientNotFound)();
|
|
228
230
|
}
|
|
229
|
-
return
|
|
230
|
-
walletStatus
|
|
231
|
+
return _chunkDE2KWQVPcjs.processReferral.call(void 0, client, {
|
|
232
|
+
walletStatus,
|
|
231
233
|
frakContext,
|
|
232
234
|
modalConfig,
|
|
233
235
|
productId,
|
|
234
236
|
options
|
|
235
237
|
});
|
|
236
238
|
},
|
|
237
|
-
enabled: !!
|
|
239
|
+
enabled: !!walletStatus
|
|
238
240
|
});
|
|
239
241
|
return _react.useMemo.call(void 0, () => {
|
|
240
242
|
if (status === "pending") return "processing";
|
|
@@ -254,9 +256,9 @@ function useSendInteraction({
|
|
|
254
256
|
mutationKey: ["nexus-sdk", "send-interaction"],
|
|
255
257
|
mutationFn: async (params) => {
|
|
256
258
|
if (!client) {
|
|
257
|
-
throw new (0,
|
|
259
|
+
throw new (0, _chunkH4BK3CNVcjs.ClientNotFound)();
|
|
258
260
|
}
|
|
259
|
-
return
|
|
261
|
+
return _chunkDE2KWQVPcjs.sendInteraction.call(void 0, client, params);
|
|
260
262
|
}
|
|
261
263
|
});
|
|
262
264
|
}
|
|
@@ -272,9 +274,9 @@ function useDisplayModal({
|
|
|
272
274
|
mutationKey: ["nexus-sdk", "display-modal"],
|
|
273
275
|
mutationFn: async (args) => {
|
|
274
276
|
if (!client) {
|
|
275
|
-
throw new (0,
|
|
277
|
+
throw new (0, _chunkH4BK3CNVcjs.ClientNotFound)();
|
|
276
278
|
}
|
|
277
|
-
return
|
|
279
|
+
return _chunkDE2KWQVPcjs.displayModal.call(void 0, client, args);
|
|
278
280
|
}
|
|
279
281
|
});
|
|
280
282
|
}
|
|
@@ -288,9 +290,27 @@ function useOpenSso({ mutations } = {}) {
|
|
|
288
290
|
mutationKey: ["nexus-sdk", "open-sso"],
|
|
289
291
|
mutationFn: async (params) => {
|
|
290
292
|
if (!client) {
|
|
291
|
-
throw new (0,
|
|
293
|
+
throw new (0, _chunkH4BK3CNVcjs.ClientNotFound)();
|
|
292
294
|
}
|
|
293
|
-
return
|
|
295
|
+
return _chunkDE2KWQVPcjs.openSso.call(void 0, client, params);
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// src/react/hook/useGetProductInformation.ts
|
|
301
|
+
|
|
302
|
+
function useGetProductInformation({
|
|
303
|
+
query
|
|
304
|
+
} = {}) {
|
|
305
|
+
const client = useNexusClient();
|
|
306
|
+
return _reactquery.useQuery.call(void 0, {
|
|
307
|
+
...query,
|
|
308
|
+
queryKey: ["nexus-sdk", "get-product-information"],
|
|
309
|
+
queryFn: async () => {
|
|
310
|
+
if (!client) {
|
|
311
|
+
throw new (0, _chunkH4BK3CNVcjs.ClientNotFound)();
|
|
312
|
+
}
|
|
313
|
+
return _chunkDE2KWQVPcjs.getProductInformation.call(void 0, client);
|
|
294
314
|
}
|
|
295
315
|
});
|
|
296
316
|
}
|
|
@@ -306,15 +326,15 @@ function NexusIFrameClientProvider({
|
|
|
306
326
|
const config = useNexusConfig();
|
|
307
327
|
const [client, setClient] = _react.useState.call(void 0, void 0);
|
|
308
328
|
const iFrame = _react.createElement.call(void 0, "iframe", {
|
|
309
|
-
...
|
|
329
|
+
..._chunkH4BK3CNVcjs.baseIframeProps,
|
|
310
330
|
src: `${config.walletUrl}/listener`,
|
|
311
|
-
style: _nullishCoalesce(style, () => (
|
|
331
|
+
style: _nullishCoalesce(style, () => ( _chunkH4BK3CNVcjs.baseIframeProps.style)),
|
|
312
332
|
ref: (iframe) => {
|
|
313
333
|
if (!iframe || client) {
|
|
314
334
|
return;
|
|
315
335
|
}
|
|
316
336
|
setClient(
|
|
317
|
-
|
|
337
|
+
_chunkQLM5NFMZcjs.createIFrameNexusClient.call(void 0, {
|
|
318
338
|
iframe,
|
|
319
339
|
config
|
|
320
340
|
})
|
|
@@ -342,4 +362,5 @@ function NexusIFrameClientProvider({
|
|
|
342
362
|
|
|
343
363
|
|
|
344
364
|
|
|
345
|
-
|
|
365
|
+
|
|
366
|
+
exports.NexusConfigContext = NexusConfigContext; exports.NexusConfigProvider = NexusConfigProvider; exports.NexusIFrameClientContext = NexusIFrameClientContext; exports.NexusIFrameClientProvider = NexusIFrameClientProvider; exports.useDisplayModal = useDisplayModal; exports.useGetProductInformation = useGetProductInformation; exports.useNexusClient = useNexusClient; exports.useNexusConfig = useNexusConfig; exports.useOpenSso = useOpenSso; exports.useReferralInteraction = useReferralInteraction; exports.useSendInteraction = useSendInteraction; exports.useSendTransactionAction = useSendTransactionAction; exports.useSiweAuthenticate = useSiweAuthenticate; exports.useWalletStatus = useWalletStatus;
|