cilantro-react 0.1.0 → 0.1.2
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/README.md +155 -2
- package/dist/index.d.mts +177 -27
- package/dist/index.d.ts +177 -27
- package/dist/index.js +732 -379
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +684 -337
- package/dist/index.mjs.map +1 -1
- package/dist/themes/default.css +43 -0
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -194,25 +194,34 @@ function CilantroAuthProvider({
|
|
|
194
194
|
const login = async (usernameOrEmail, password) => {
|
|
195
195
|
try {
|
|
196
196
|
const result = await cilantroLogin({ usernameOrEmail, password });
|
|
197
|
-
const
|
|
198
|
-
if (!
|
|
199
|
-
const jwt =
|
|
200
|
-
const userType =
|
|
197
|
+
const data = result && typeof result === "object" && "data" in result ? result.data : void 0;
|
|
198
|
+
if (!data?.jwt) throw new Error("No JWT token received from server");
|
|
199
|
+
const jwt = data.jwt;
|
|
200
|
+
const userType = data.userType;
|
|
201
201
|
setToken(jwt);
|
|
202
202
|
setSdkAuth(jwt);
|
|
203
203
|
if (typeof window !== "undefined") {
|
|
204
204
|
localStorage.setItem(jwtStorageKey, jwt);
|
|
205
205
|
document.cookie = `cilantro_jwt=${jwt}; path=/; max-age=${60 * 60 * 24 * 7}`;
|
|
206
206
|
}
|
|
207
|
-
|
|
208
|
-
const
|
|
207
|
+
if (data.user && typeof data.user === "object") {
|
|
208
|
+
const u = data.user;
|
|
209
209
|
setUser({
|
|
210
|
-
username:
|
|
211
|
-
email:
|
|
212
|
-
userType: userType ??
|
|
210
|
+
username: u.username,
|
|
211
|
+
email: u.email,
|
|
212
|
+
userType: userType ?? u.userType
|
|
213
213
|
});
|
|
214
|
-
}
|
|
215
|
-
|
|
214
|
+
} else {
|
|
215
|
+
try {
|
|
216
|
+
const payload = JSON.parse(atob(jwt.split(".")[1]));
|
|
217
|
+
setUser({
|
|
218
|
+
username: payload.username,
|
|
219
|
+
email: payload.email,
|
|
220
|
+
userType: userType ?? payload.userType
|
|
221
|
+
});
|
|
222
|
+
} catch {
|
|
223
|
+
setUser({ userType });
|
|
224
|
+
}
|
|
216
225
|
}
|
|
217
226
|
onLoginSuccess?.();
|
|
218
227
|
} catch (error) {
|
|
@@ -295,12 +304,12 @@ function WalletProvider({ children, storageKey = DEFAULT_STORAGE_KEY }) {
|
|
|
295
304
|
setSelectedWallet(wallet);
|
|
296
305
|
} else {
|
|
297
306
|
setSelectedWallet(wallets[0]);
|
|
298
|
-
if (typeof window !== "undefined") localStorage.setItem(storageKey, wallets[0].id);
|
|
307
|
+
if (typeof window !== "undefined") localStorage.setItem(storageKey, wallets[0].id ?? wallets[0].walletId);
|
|
299
308
|
}
|
|
300
309
|
} else {
|
|
301
310
|
if (wallets.length > 0) {
|
|
302
311
|
setSelectedWallet(wallets[0]);
|
|
303
|
-
if (typeof window !== "undefined") localStorage.setItem(storageKey, wallets[0].id);
|
|
312
|
+
if (typeof window !== "undefined") localStorage.setItem(storageKey, wallets[0].id ?? wallets[0].walletId);
|
|
304
313
|
}
|
|
305
314
|
}
|
|
306
315
|
} else if (wallets.length === 0) {
|
|
@@ -314,19 +323,13 @@ function WalletProvider({ children, storageKey = DEFAULT_STORAGE_KEY }) {
|
|
|
314
323
|
if (token) setSdkAuth(token);
|
|
315
324
|
const result = await findAllWallets();
|
|
316
325
|
const walletsList = extractResponseData(result) ?? [];
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
walletAddress: w.walletAddress ?? w.address ?? "",
|
|
325
|
-
chain: w.chain ?? "solana",
|
|
326
|
-
active: w.active !== false,
|
|
327
|
-
...w
|
|
328
|
-
};
|
|
329
|
-
}) : [];
|
|
326
|
+
const list = Array.isArray(walletsList) ? walletsList : [];
|
|
327
|
+
const formattedWallets = list.map((w) => ({
|
|
328
|
+
...w,
|
|
329
|
+
id: w.walletId,
|
|
330
|
+
address: w.walletAddress,
|
|
331
|
+
active: w.isActive
|
|
332
|
+
}));
|
|
330
333
|
setWallets(formattedWallets);
|
|
331
334
|
} catch (error) {
|
|
332
335
|
console.error("Failed to load wallets:", error);
|
|
@@ -339,7 +342,7 @@ function WalletProvider({ children, storageKey = DEFAULT_STORAGE_KEY }) {
|
|
|
339
342
|
const wallet = wallets.find((w) => w.id === walletId || w.walletId === walletId);
|
|
340
343
|
if (wallet) {
|
|
341
344
|
setSelectedWallet(wallet);
|
|
342
|
-
if (typeof window !== "undefined") localStorage.setItem(storageKey, wallet.id);
|
|
345
|
+
if (typeof window !== "undefined") localStorage.setItem(storageKey, wallet.id ?? wallet.walletId);
|
|
343
346
|
}
|
|
344
347
|
};
|
|
345
348
|
const refreshWallets = async () => {
|
|
@@ -423,6 +426,18 @@ function CilantroProvider({
|
|
|
423
426
|
);
|
|
424
427
|
}
|
|
425
428
|
|
|
429
|
+
// src/hooks/useSelectedWallet.ts
|
|
430
|
+
function useSelectedWallet() {
|
|
431
|
+
const { selectedWallet, isLoading, refreshWallets } = useWallets();
|
|
432
|
+
return { selectedWallet, isLoading, refreshWallets };
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// src/hooks/useWalletAddress.ts
|
|
436
|
+
function useWalletAddress() {
|
|
437
|
+
const { selectedWallet } = useWallets();
|
|
438
|
+
return selectedWallet?.address ?? selectedWallet?.walletAddress ?? null;
|
|
439
|
+
}
|
|
440
|
+
|
|
426
441
|
// src/hooks/useSigners.ts
|
|
427
442
|
import { useState as useState3, useEffect as useEffect4, useCallback } from "react";
|
|
428
443
|
|
|
@@ -570,8 +585,119 @@ function useSigners(options = {}) {
|
|
|
570
585
|
return { signers, isLoading, error, refresh };
|
|
571
586
|
}
|
|
572
587
|
|
|
573
|
-
// src/hooks/
|
|
588
|
+
// src/hooks/useSignersRaw.ts
|
|
574
589
|
import { useState as useState4, useEffect as useEffect5, useCallback as useCallback2 } from "react";
|
|
590
|
+
import { listSigners as listSigners2 } from "cilantro-sdk/wallet";
|
|
591
|
+
function useSignersRaw(options = {}) {
|
|
592
|
+
const { walletId } = options;
|
|
593
|
+
const { token } = useCilantroAuth();
|
|
594
|
+
const [signersRaw, setSignersRaw] = useState4(null);
|
|
595
|
+
const [isLoading, setIsLoading] = useState4(false);
|
|
596
|
+
const [error, setError] = useState4(null);
|
|
597
|
+
const load = useCallback2(async () => {
|
|
598
|
+
if (!walletId) {
|
|
599
|
+
setSignersRaw(null);
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
setIsLoading(true);
|
|
603
|
+
setError(null);
|
|
604
|
+
try {
|
|
605
|
+
if (token) setSdkAuth(token);
|
|
606
|
+
const result = await listSigners2(walletId);
|
|
607
|
+
setSignersRaw(result);
|
|
608
|
+
} catch (err) {
|
|
609
|
+
setSignersRaw(null);
|
|
610
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
611
|
+
} finally {
|
|
612
|
+
setIsLoading(false);
|
|
613
|
+
}
|
|
614
|
+
}, [walletId, token]);
|
|
615
|
+
useEffect5(() => {
|
|
616
|
+
if (!walletId) {
|
|
617
|
+
setSignersRaw(null);
|
|
618
|
+
setError(null);
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
load();
|
|
622
|
+
}, [walletId, load]);
|
|
623
|
+
const refresh = useCallback2(async () => {
|
|
624
|
+
if (walletId) await load();
|
|
625
|
+
}, [walletId, load]);
|
|
626
|
+
return {
|
|
627
|
+
signersRaw: walletId ? signersRaw : null,
|
|
628
|
+
isLoading,
|
|
629
|
+
error,
|
|
630
|
+
refresh
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
// src/hooks/useSignersForSelectedWallet.ts
|
|
635
|
+
function useSignersForSelectedWallet(options = {}) {
|
|
636
|
+
const { walletId: walletIdOverride } = options;
|
|
637
|
+
const { selectedWallet } = useWallets();
|
|
638
|
+
const effectiveWalletId = walletIdOverride ?? selectedWallet?.id ?? selectedWallet?.walletId ?? null;
|
|
639
|
+
return useSigners({ walletId: effectiveWalletId });
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// src/hooks/useDelegatedKeys.ts
|
|
643
|
+
import { useState as useState5, useEffect as useEffect6, useCallback as useCallback3 } from "react";
|
|
644
|
+
import { findAll } from "cilantro-sdk/delegated-keys";
|
|
645
|
+
function normalizeKeys(list) {
|
|
646
|
+
return list.map((k) => ({
|
|
647
|
+
...k,
|
|
648
|
+
id: k.delegatedKeyId
|
|
649
|
+
}));
|
|
650
|
+
}
|
|
651
|
+
function useDelegatedKeys(options = {}) {
|
|
652
|
+
const { walletId, filterActive = true } = options;
|
|
653
|
+
const { token } = useCilantroAuth();
|
|
654
|
+
const [keys, setKeys] = useState5([]);
|
|
655
|
+
const [isLoading, setIsLoading] = useState5(false);
|
|
656
|
+
const [error, setError] = useState5(null);
|
|
657
|
+
const loadKeys = useCallback3(async () => {
|
|
658
|
+
if (!walletId) {
|
|
659
|
+
setKeys([]);
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
setIsLoading(true);
|
|
663
|
+
setError(null);
|
|
664
|
+
try {
|
|
665
|
+
if (token) setSdkAuth(token);
|
|
666
|
+
const result = await findAll(walletId);
|
|
667
|
+
const keysData = extractResponseData(result) ?? [];
|
|
668
|
+
const list = Array.isArray(keysData) ? keysData : [];
|
|
669
|
+
const valid = list.filter(
|
|
670
|
+
(k) => k != null && typeof k === "object" && "delegatedKeyId" in k
|
|
671
|
+
);
|
|
672
|
+
let loaded = normalizeKeys(valid);
|
|
673
|
+
if (filterActive) {
|
|
674
|
+
const now = Date.now();
|
|
675
|
+
loaded = loaded.filter((key) => {
|
|
676
|
+
if (!key.isActive) return false;
|
|
677
|
+
const raw = key.expiresAt;
|
|
678
|
+
const exp = raw != null && (typeof raw === "string" || typeof raw === "number") ? new Date(raw).getTime() : null;
|
|
679
|
+
return exp === null || exp > now;
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
setKeys(loaded);
|
|
683
|
+
} catch (err) {
|
|
684
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
685
|
+
setKeys([]);
|
|
686
|
+
} finally {
|
|
687
|
+
setIsLoading(false);
|
|
688
|
+
}
|
|
689
|
+
}, [walletId, token, filterActive]);
|
|
690
|
+
useEffect6(() => {
|
|
691
|
+
loadKeys();
|
|
692
|
+
}, [loadKeys]);
|
|
693
|
+
const refresh = useCallback3(async () => {
|
|
694
|
+
if (walletId) await loadKeys();
|
|
695
|
+
}, [walletId, loadKeys]);
|
|
696
|
+
return { keys, isLoading, error, refresh };
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// src/hooks/useSignerSelection.ts
|
|
700
|
+
import { useState as useState6, useEffect as useEffect7, useCallback as useCallback4 } from "react";
|
|
575
701
|
function useSignerSelection(options = {}) {
|
|
576
702
|
const { walletId: walletIdOverride, signingMethod = "sdk-signer" } = options;
|
|
577
703
|
const { selectedWallet } = useWallets();
|
|
@@ -579,17 +705,17 @@ function useSignerSelection(options = {}) {
|
|
|
579
705
|
const { signers: availableSigners, isLoading: isLoadingSigners } = useSigners({
|
|
580
706
|
walletId: effectiveWalletId || null
|
|
581
707
|
});
|
|
582
|
-
const [selectedWalletId, setSelectedWalletId] =
|
|
583
|
-
const [selectedSigner, setSelectedSigner] =
|
|
584
|
-
|
|
708
|
+
const [selectedWalletId, setSelectedWalletId] = useState6(effectiveWalletId);
|
|
709
|
+
const [selectedSigner, setSelectedSigner] = useState6(null);
|
|
710
|
+
useEffect7(() => {
|
|
585
711
|
setSelectedWalletId(effectiveWalletId);
|
|
586
712
|
}, [effectiveWalletId]);
|
|
587
|
-
|
|
713
|
+
useEffect7(() => {
|
|
588
714
|
if (signingMethod !== "sdk-signer") {
|
|
589
715
|
setSelectedSigner(null);
|
|
590
716
|
}
|
|
591
717
|
}, [signingMethod]);
|
|
592
|
-
const reset =
|
|
718
|
+
const reset = useCallback4(() => {
|
|
593
719
|
setSelectedWalletId("");
|
|
594
720
|
setSelectedSigner(null);
|
|
595
721
|
}, []);
|
|
@@ -604,8 +730,43 @@ function useSignerSelection(options = {}) {
|
|
|
604
730
|
};
|
|
605
731
|
}
|
|
606
732
|
|
|
733
|
+
// src/hooks/useCanSign.ts
|
|
734
|
+
import { useMemo } from "react";
|
|
735
|
+
function useCanSign(options = {}) {
|
|
736
|
+
const {
|
|
737
|
+
signingMethod = "sdk-signer",
|
|
738
|
+
requireSigner = true,
|
|
739
|
+
walletAdapterConnected
|
|
740
|
+
} = options;
|
|
741
|
+
const { token } = useCilantroAuth();
|
|
742
|
+
const { selectedWallet } = useWallets();
|
|
743
|
+
const { selectedSigner } = useSignerSelection({ signingMethod });
|
|
744
|
+
return useMemo(() => {
|
|
745
|
+
const hasToken = !!token;
|
|
746
|
+
const hasWallet = !!selectedWallet?.id || !!selectedWallet?.walletId;
|
|
747
|
+
const isSdkSigner = signingMethod === "sdk-signer";
|
|
748
|
+
const hasSigner = isSdkSigner ? !!selectedSigner : walletAdapterConnected !== void 0 ? walletAdapterConnected : hasWallet;
|
|
749
|
+
const canSign = hasToken && hasWallet && (requireSigner ? hasSigner : true);
|
|
750
|
+
return {
|
|
751
|
+
hasToken,
|
|
752
|
+
hasWallet,
|
|
753
|
+
hasSigner,
|
|
754
|
+
canSignMessage: canSign,
|
|
755
|
+
canSignTransaction: canSign
|
|
756
|
+
};
|
|
757
|
+
}, [
|
|
758
|
+
token,
|
|
759
|
+
selectedWallet?.id,
|
|
760
|
+
selectedWallet?.walletId,
|
|
761
|
+
selectedSigner,
|
|
762
|
+
signingMethod,
|
|
763
|
+
requireSigner,
|
|
764
|
+
walletAdapterConnected
|
|
765
|
+
]);
|
|
766
|
+
}
|
|
767
|
+
|
|
607
768
|
// src/hooks/useMessageSigning.ts
|
|
608
|
-
import { useState as
|
|
769
|
+
import { useState as useState7 } from "react";
|
|
609
770
|
|
|
610
771
|
// src/core/signer-signing/core.ts
|
|
611
772
|
import { PublicKey } from "@solana/web3.js";
|
|
@@ -685,7 +846,9 @@ import {
|
|
|
685
846
|
registerPasskeyComplete,
|
|
686
847
|
signWithPasskeySigner
|
|
687
848
|
} from "cilantro-sdk/helpers";
|
|
688
|
-
import {
|
|
849
|
+
import {
|
|
850
|
+
sendRawPasskeyTransaction
|
|
851
|
+
} from "cilantro-sdk/transactions";
|
|
689
852
|
import { createExternalWalletSigner, startPasskeyAuthentication } from "cilantro-sdk/wallet";
|
|
690
853
|
async function createEmailSignerHelper(walletId, email) {
|
|
691
854
|
const trimmedEmail = email.trim();
|
|
@@ -747,9 +910,10 @@ async function signAndSendPasskeyTransaction(walletId, signerId, transaction, op
|
|
|
747
910
|
});
|
|
748
911
|
}
|
|
749
912
|
const unsignedTransaction = transaction.serialize({ verifySignatures: false }).toString("base64");
|
|
750
|
-
const authOptions = await startPasskeyAuthentication(
|
|
751
|
-
|
|
752
|
-
|
|
913
|
+
const authOptions = await startPasskeyAuthentication(
|
|
914
|
+
walletId,
|
|
915
|
+
{ credentialId: options?.credentialId }
|
|
916
|
+
);
|
|
753
917
|
const authData = extractResponseData(authOptions);
|
|
754
918
|
if (!authData) throw new Error("Failed to get authentication options");
|
|
755
919
|
const authDataValue = authData && typeof authData === "object" && "data" in authData ? authData.data : authData;
|
|
@@ -768,7 +932,10 @@ async function signAndSendPasskeyTransaction(walletId, signerId, transaction, op
|
|
|
768
932
|
};
|
|
769
933
|
const result = await sendRawPasskeyTransaction(dto);
|
|
770
934
|
const resultData = extractResponseData(result);
|
|
771
|
-
return {
|
|
935
|
+
return {
|
|
936
|
+
signature: resultData?.signature ?? "",
|
|
937
|
+
status: resultData?.status
|
|
938
|
+
};
|
|
772
939
|
}
|
|
773
940
|
|
|
774
941
|
// src/core/signer-signing/errors.ts
|
|
@@ -839,10 +1006,11 @@ async function signMessageWithSigner(walletId, signer, messageText) {
|
|
|
839
1006
|
validateSignerActive(signer, signerType);
|
|
840
1007
|
const storageOptions = getStorageOptions();
|
|
841
1008
|
try {
|
|
842
|
-
const
|
|
1009
|
+
const signatureBytes = await signWithEmailSigner(walletId, signerId, message, storageOptions);
|
|
843
1010
|
const keypair = await getEmailSignerKeypair2(walletId, signerId, storageOptions);
|
|
844
1011
|
return {
|
|
845
|
-
signature: Buffer.from(
|
|
1012
|
+
signature: Buffer.from(signatureBytes).toString("base64"),
|
|
1013
|
+
message: messageText,
|
|
846
1014
|
publicKey: Buffer.from(keypair.publicKey).toString("hex"),
|
|
847
1015
|
signerType: SIGNER_TYPES.EMAIL
|
|
848
1016
|
};
|
|
@@ -854,10 +1022,11 @@ async function signMessageWithSigner(walletId, signer, messageText) {
|
|
|
854
1022
|
validateSignerActive(signer, signerType);
|
|
855
1023
|
const storageOptions = getStorageOptions();
|
|
856
1024
|
try {
|
|
857
|
-
const
|
|
1025
|
+
const signatureBytes = await signWithPhoneSigner(walletId, signerId, message, storageOptions);
|
|
858
1026
|
const keypair = await getPhoneSignerKeypair2(walletId, signerId, storageOptions);
|
|
859
1027
|
return {
|
|
860
|
-
signature: Buffer.from(
|
|
1028
|
+
signature: Buffer.from(signatureBytes).toString("base64"),
|
|
1029
|
+
message: messageText,
|
|
861
1030
|
publicKey: Buffer.from(keypair.publicKey).toString("hex"),
|
|
862
1031
|
signerType: SIGNER_TYPES.PHONE
|
|
863
1032
|
};
|
|
@@ -867,8 +1036,10 @@ async function signMessageWithSigner(walletId, signer, messageText) {
|
|
|
867
1036
|
}
|
|
868
1037
|
if (signerType === SIGNER_TYPES.PASSKEY) {
|
|
869
1038
|
const signResult = await signWithPasskey(walletId, signerId, messageText, { useBrowserAutofill: false });
|
|
1039
|
+
const signatureBase64 = Buffer.from(signResult.signature, "hex").toString("base64");
|
|
870
1040
|
return {
|
|
871
|
-
signature:
|
|
1041
|
+
signature: signatureBase64,
|
|
1042
|
+
message: messageText,
|
|
872
1043
|
signerType: SIGNER_TYPES.PASSKEY,
|
|
873
1044
|
signer: signResult.signer
|
|
874
1045
|
};
|
|
@@ -876,10 +1047,11 @@ async function signMessageWithSigner(walletId, signer, messageText) {
|
|
|
876
1047
|
if (signerType === SIGNER_TYPES.EXTERNAL || signerType === SIGNER_TYPES.API_KEY) {
|
|
877
1048
|
validateSignerActive(signer, signerType);
|
|
878
1049
|
const storageOptions = getStorageOptions();
|
|
879
|
-
const
|
|
1050
|
+
const signatureBytes = await signWithSigner(walletId, signerId, signerType, message, storageOptions);
|
|
880
1051
|
const keypair = await deriveSignerKeypair2(walletId, signerId, signerType, storageOptions);
|
|
881
1052
|
return {
|
|
882
|
-
signature: Buffer.from(
|
|
1053
|
+
signature: Buffer.from(signatureBytes).toString("base64"),
|
|
1054
|
+
message: messageText,
|
|
883
1055
|
publicKey: Buffer.from(keypair.publicKey).toString("base64"),
|
|
884
1056
|
signerType
|
|
885
1057
|
};
|
|
@@ -1006,9 +1178,11 @@ async function submitSignedTransaction(walletId, signedTransactionBase64) {
|
|
|
1006
1178
|
});
|
|
1007
1179
|
const resultData = extractResponseData(submitResult);
|
|
1008
1180
|
if (!resultData?.signature) throw new Error("Server did not return a transaction signature");
|
|
1181
|
+
const status = resultData.status ?? "pending";
|
|
1009
1182
|
return {
|
|
1010
1183
|
signature: resultData.signature,
|
|
1011
|
-
|
|
1184
|
+
status,
|
|
1185
|
+
confirmationStatus: status
|
|
1012
1186
|
};
|
|
1013
1187
|
}
|
|
1014
1188
|
async function handlePasskeyTransaction(walletId, signerId, transaction, connection) {
|
|
@@ -1021,7 +1195,7 @@ async function handlePasskeyTransaction(walletId, signerId, transaction, connect
|
|
|
1021
1195
|
const result = await signAndSendPasskeyTransaction(walletId, signerId, transaction, {
|
|
1022
1196
|
useBrowserAutofill: false
|
|
1023
1197
|
});
|
|
1024
|
-
let
|
|
1198
|
+
let status = "confirmed";
|
|
1025
1199
|
try {
|
|
1026
1200
|
await connection.confirmTransaction({
|
|
1027
1201
|
signature: result.signature,
|
|
@@ -1031,12 +1205,12 @@ async function handlePasskeyTransaction(walletId, signerId, transaction, connect
|
|
|
1031
1205
|
} catch (error) {
|
|
1032
1206
|
const errorMsg = extractErrorMessage(error);
|
|
1033
1207
|
if (errorMsg.includes("block height exceeded") || errorMsg.includes("expired") || errorMsg.includes("timeout")) {
|
|
1034
|
-
|
|
1208
|
+
status = "pending";
|
|
1035
1209
|
} else {
|
|
1036
1210
|
throw new Error(`Transaction confirmation failed: ${errorMsg}. Signature: ${result.signature}`);
|
|
1037
1211
|
}
|
|
1038
1212
|
}
|
|
1039
|
-
return { signature: result.signature, confirmationStatus };
|
|
1213
|
+
return { signature: result.signature, status, confirmationStatus: status };
|
|
1040
1214
|
}
|
|
1041
1215
|
async function handleEmailOrPhoneTransaction(walletId, signer, signerType, signerId, transaction) {
|
|
1042
1216
|
validateSignerActive(signer, signerType);
|
|
@@ -1153,19 +1327,12 @@ async function getWalletData(walletId) {
|
|
|
1153
1327
|
const walletDataResponse = await findOneWallet(walletId);
|
|
1154
1328
|
const walletData = extractResponseData(walletDataResponse);
|
|
1155
1329
|
if (!walletData) throw new Error("Wallet data is empty");
|
|
1156
|
-
const address = String(
|
|
1157
|
-
|
|
1158
|
-
).trim();
|
|
1159
|
-
if (!address) throw new Error(`No wallet address found. Available fields: ${Object.keys(walletData).join(", ")}`);
|
|
1330
|
+
const address = String(walletData.walletAddress ?? "").trim();
|
|
1331
|
+
if (!address) throw new Error("No wallet address found (walletAddress is empty).");
|
|
1160
1332
|
const walletPublicKey = new PublicKey4(address);
|
|
1161
|
-
const
|
|
1162
|
-
const adminPubkey = String(
|
|
1163
|
-
walletData.adminSignerPubkey ?? walletData.adminSigner ?? adminData?.publicKey ?? ""
|
|
1164
|
-
).trim();
|
|
1333
|
+
const adminPubkey = String(walletData.adminSignerPubkey ?? "").trim();
|
|
1165
1334
|
if (!adminPubkey) {
|
|
1166
|
-
throw new Error(
|
|
1167
|
-
`adminSignerPubkey not found in wallet data. Available fields: ${Object.keys(walletData).join(", ")}`
|
|
1168
|
-
);
|
|
1335
|
+
throw new Error("adminSignerPubkey not found in wallet data.");
|
|
1169
1336
|
}
|
|
1170
1337
|
const adminSignerPubkey = new PublicKey4(adminPubkey);
|
|
1171
1338
|
return { walletPublicKey, adminSignerPubkey };
|
|
@@ -1181,9 +1348,9 @@ function useMessageSigning(options) {
|
|
|
1181
1348
|
walletAdapterSignMessage,
|
|
1182
1349
|
walletAdapterPublicKey
|
|
1183
1350
|
} = options;
|
|
1184
|
-
const [messageText, setMessageText] =
|
|
1185
|
-
const [signResultState, setSignResultState] =
|
|
1186
|
-
const [isSigning, setIsSigning] =
|
|
1351
|
+
const [messageText, setMessageText] = useState7("Hello, Solana!");
|
|
1352
|
+
const [signResultState, setSignResultState] = useState7({ status: "idle" });
|
|
1353
|
+
const [isSigning, setIsSigning] = useState7(false);
|
|
1187
1354
|
const handleSign = async () => {
|
|
1188
1355
|
setIsSigning(true);
|
|
1189
1356
|
setSignResultState({ status: "loading" });
|
|
@@ -1213,7 +1380,7 @@ function useMessageSigning(options) {
|
|
|
1213
1380
|
setSignResultState({
|
|
1214
1381
|
status: "success",
|
|
1215
1382
|
message: `Message signed successfully with ${signerType} signer!`,
|
|
1216
|
-
detail: {
|
|
1383
|
+
detail: { ...result }
|
|
1217
1384
|
});
|
|
1218
1385
|
} catch (error) {
|
|
1219
1386
|
const errorMsg = extractErrorMessage(error);
|
|
@@ -1241,7 +1408,7 @@ function useMessageSigning(options) {
|
|
|
1241
1408
|
}
|
|
1242
1409
|
|
|
1243
1410
|
// src/hooks/useTransactionSigning.ts
|
|
1244
|
-
import { useState as
|
|
1411
|
+
import { useState as useState8 } from "react";
|
|
1245
1412
|
function useTransactionSigning(options) {
|
|
1246
1413
|
const {
|
|
1247
1414
|
token,
|
|
@@ -1252,9 +1419,9 @@ function useTransactionSigning(options) {
|
|
|
1252
1419
|
walletAdapterPublicKey,
|
|
1253
1420
|
connection
|
|
1254
1421
|
} = options;
|
|
1255
|
-
const [transactionResultState, setTransactionResultState] =
|
|
1256
|
-
const [isSigningTransaction, setIsSigningTransaction] =
|
|
1257
|
-
const [isSendingTransaction, setIsSendingTransaction] =
|
|
1422
|
+
const [transactionResultState, setTransactionResultState] = useState8({ status: "idle" });
|
|
1423
|
+
const [isSigningTransaction, setIsSigningTransaction] = useState8(false);
|
|
1424
|
+
const [isSendingTransaction, setIsSendingTransaction] = useState8(false);
|
|
1258
1425
|
const signTransaction = async (transaction) => {
|
|
1259
1426
|
setIsSigningTransaction(true);
|
|
1260
1427
|
setTransactionResultState({ status: "loading" });
|
|
@@ -1332,6 +1499,7 @@ function useTransactionSigning(options) {
|
|
|
1332
1499
|
message: `Transaction sent with ${signerType} signer!`,
|
|
1333
1500
|
detail: {
|
|
1334
1501
|
signature: result.signature,
|
|
1502
|
+
status: result.status,
|
|
1335
1503
|
confirmationStatus: result.confirmationStatus,
|
|
1336
1504
|
explorerUrl: `https://solscan.io/tx/${result.signature}?cluster=devnet`
|
|
1337
1505
|
}
|
|
@@ -1433,14 +1601,30 @@ var SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /*
|
|
|
1433
1601
|
));
|
|
1434
1602
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
1435
1603
|
|
|
1604
|
+
// src/ui/skeleton.tsx
|
|
1605
|
+
import * as React2 from "react";
|
|
1606
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1607
|
+
var Skeleton = React2.forwardRef(
|
|
1608
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx5(
|
|
1609
|
+
"div",
|
|
1610
|
+
{
|
|
1611
|
+
ref,
|
|
1612
|
+
className: cn("rounded-md bg-muted animate-pulse", className),
|
|
1613
|
+
...props
|
|
1614
|
+
}
|
|
1615
|
+
)
|
|
1616
|
+
);
|
|
1617
|
+
Skeleton.displayName = "Skeleton";
|
|
1618
|
+
|
|
1436
1619
|
// src/components/WalletSelector.tsx
|
|
1437
|
-
import { Fragment, jsx as
|
|
1620
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1438
1621
|
function WalletSelector(props) {
|
|
1439
1622
|
const {
|
|
1440
1623
|
value,
|
|
1441
1624
|
onWalletChange,
|
|
1442
1625
|
className,
|
|
1443
1626
|
classNames,
|
|
1627
|
+
useSkeleton = true,
|
|
1444
1628
|
placeholder = "Select a wallet",
|
|
1445
1629
|
renderTrigger,
|
|
1446
1630
|
renderList,
|
|
@@ -1450,15 +1634,16 @@ function WalletSelector(props) {
|
|
|
1450
1634
|
const effectiveValue = value ?? selectedWallet?.id ?? selectedWallet?.walletId ?? "";
|
|
1451
1635
|
const selected = wallets.find((w) => w.id === effectiveValue || w.walletId === effectiveValue) ?? selectedWallet;
|
|
1452
1636
|
const handleSelect = (wallet) => {
|
|
1453
|
-
|
|
1454
|
-
|
|
1637
|
+
const id = wallet.id ?? wallet.walletId;
|
|
1638
|
+
selectWallet(id);
|
|
1639
|
+
onWalletChange?.(id, wallet);
|
|
1455
1640
|
};
|
|
1456
1641
|
const handleValueChange = (id) => {
|
|
1457
1642
|
selectWallet(id);
|
|
1458
1643
|
onWalletChange?.(id, wallets.find((w) => w.id === id || w.walletId === id) ?? null);
|
|
1459
1644
|
};
|
|
1460
1645
|
if (children) {
|
|
1461
|
-
return /* @__PURE__ */
|
|
1646
|
+
return /* @__PURE__ */ jsx6(Fragment, { children: children({
|
|
1462
1647
|
wallets,
|
|
1463
1648
|
selectedWallet: selected,
|
|
1464
1649
|
selectWallet: (id) => {
|
|
@@ -1476,17 +1661,41 @@ function WalletSelector(props) {
|
|
|
1476
1661
|
renderList?.({ wallets, selectedWallet: selected, onSelect: handleSelect, isLoading })
|
|
1477
1662
|
] });
|
|
1478
1663
|
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1664
|
+
if (isLoading && useSkeleton) {
|
|
1665
|
+
return /* @__PURE__ */ jsx6(
|
|
1666
|
+
"div",
|
|
1667
|
+
{
|
|
1668
|
+
className: cn(className, classNames?.root, classNames?.loading),
|
|
1669
|
+
"data-cilantro-wallet-selector": true,
|
|
1670
|
+
"aria-busy": "true",
|
|
1671
|
+
"aria-live": "polite",
|
|
1672
|
+
children: /* @__PURE__ */ jsx6(
|
|
1673
|
+
"div",
|
|
1674
|
+
{
|
|
1675
|
+
className: cn(
|
|
1676
|
+
"flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2",
|
|
1677
|
+
classNames?.trigger
|
|
1678
|
+
),
|
|
1679
|
+
children: /* @__PURE__ */ jsx6(Skeleton, { className: cn("h-4 flex-1 rounded", classNames?.skeleton) })
|
|
1680
|
+
}
|
|
1681
|
+
)
|
|
1682
|
+
}
|
|
1683
|
+
);
|
|
1684
|
+
}
|
|
1685
|
+
return /* @__PURE__ */ jsx6("div", { className: cn(className, classNames?.root), "data-cilantro-wallet-selector": true, children: /* @__PURE__ */ jsxs2(Select, { value: effectiveValue || void 0, onValueChange: handleValueChange, disabled: isLoading, children: [
|
|
1686
|
+
/* @__PURE__ */ jsx6(SelectTrigger, { className: classNames?.trigger, "aria-label": "Select wallet", children: /* @__PURE__ */ jsx6(SelectValue, { placeholder: isLoading ? "Loading..." : placeholder }) }),
|
|
1687
|
+
/* @__PURE__ */ jsx6(SelectContent, { className: classNames?.content, children: wallets.map((w) => {
|
|
1688
|
+
const id = w.id ?? w.walletId;
|
|
1689
|
+
return /* @__PURE__ */ jsx6(SelectItem, { value: id, className: classNames?.item, children: w.walletName || id }, id);
|
|
1690
|
+
}) })
|
|
1482
1691
|
] }) });
|
|
1483
1692
|
}
|
|
1484
1693
|
|
|
1485
1694
|
// src/ui/button.tsx
|
|
1486
|
-
import * as
|
|
1695
|
+
import * as React3 from "react";
|
|
1487
1696
|
import { Slot } from "@radix-ui/react-slot";
|
|
1488
1697
|
import { cva } from "class-variance-authority";
|
|
1489
|
-
import { jsx as
|
|
1698
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1490
1699
|
var buttonVariants = cva(
|
|
1491
1700
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
1492
1701
|
{
|
|
@@ -1503,7 +1712,8 @@ var buttonVariants = cva(
|
|
|
1503
1712
|
default: "h-10 px-4 py-2",
|
|
1504
1713
|
sm: "h-9 rounded-md px-3",
|
|
1505
1714
|
lg: "h-11 rounded-md px-8",
|
|
1506
|
-
icon: "h-10 w-10"
|
|
1715
|
+
icon: "h-10 w-10",
|
|
1716
|
+
touch: "h-12 min-h-[44px] min-w-[44px] rounded-md px-4"
|
|
1507
1717
|
}
|
|
1508
1718
|
},
|
|
1509
1719
|
defaultVariants: {
|
|
@@ -1512,16 +1722,16 @@ var buttonVariants = cva(
|
|
|
1512
1722
|
}
|
|
1513
1723
|
}
|
|
1514
1724
|
);
|
|
1515
|
-
var Button =
|
|
1725
|
+
var Button = React3.forwardRef(
|
|
1516
1726
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
1517
1727
|
const Comp = asChild ? Slot : "button";
|
|
1518
|
-
return /* @__PURE__ */
|
|
1728
|
+
return /* @__PURE__ */ jsx7(Comp, { className: cn(buttonVariants({ variant, size, className })), ref, ...props });
|
|
1519
1729
|
}
|
|
1520
1730
|
);
|
|
1521
1731
|
Button.displayName = "Button";
|
|
1522
1732
|
|
|
1523
1733
|
// src/components/SignerSelector.tsx
|
|
1524
|
-
import { Fragment as Fragment2, jsx as
|
|
1734
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1525
1735
|
function SignerSelector({
|
|
1526
1736
|
selectedWalletId,
|
|
1527
1737
|
availableSigners,
|
|
@@ -1530,15 +1740,16 @@ function SignerSelector({
|
|
|
1530
1740
|
onSignerSelect,
|
|
1531
1741
|
className,
|
|
1532
1742
|
classNames,
|
|
1743
|
+
useSkeleton = true,
|
|
1533
1744
|
renderList,
|
|
1534
1745
|
children
|
|
1535
1746
|
}) {
|
|
1536
1747
|
if (!selectedWalletId) return null;
|
|
1537
1748
|
if (children) {
|
|
1538
|
-
return /* @__PURE__ */
|
|
1749
|
+
return /* @__PURE__ */ jsx8(Fragment2, { children: children({ signers: availableSigners, selectedSigner, onSignerSelect, isLoading: isLoadingSigners }) });
|
|
1539
1750
|
}
|
|
1540
1751
|
if (renderList) {
|
|
1541
|
-
return /* @__PURE__ */
|
|
1752
|
+
return /* @__PURE__ */ jsx8("div", { className: cn(className, classNames?.root), "data-cilantro-signer-selector": true, children: renderList({
|
|
1542
1753
|
signers: availableSigners,
|
|
1543
1754
|
selectedSigner,
|
|
1544
1755
|
onSelect: onSignerSelect,
|
|
@@ -1548,29 +1759,53 @@ function SignerSelector({
|
|
|
1548
1759
|
getSignerUniqueId
|
|
1549
1760
|
}) });
|
|
1550
1761
|
}
|
|
1551
|
-
|
|
1552
|
-
|
|
1762
|
+
const loadingContent = isLoadingSigners && useSkeleton ? /* @__PURE__ */ jsx8(
|
|
1763
|
+
"div",
|
|
1764
|
+
{
|
|
1765
|
+
className: cn("space-y-1", classNames?.loading),
|
|
1766
|
+
"aria-busy": "true",
|
|
1767
|
+
"aria-live": "polite",
|
|
1768
|
+
children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx8(
|
|
1769
|
+
Skeleton,
|
|
1770
|
+
{
|
|
1771
|
+
className: cn("h-8 w-full rounded-md", classNames?.skeleton)
|
|
1772
|
+
},
|
|
1773
|
+
i
|
|
1774
|
+
))
|
|
1775
|
+
}
|
|
1776
|
+
) : isLoadingSigners ? /* @__PURE__ */ jsx8("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "Loading signers..." }) : null;
|
|
1777
|
+
return /* @__PURE__ */ jsx8(
|
|
1778
|
+
"div",
|
|
1553
1779
|
{
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
"aria-
|
|
1560
|
-
children:
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1780
|
+
className: cn(className, classNames?.root),
|
|
1781
|
+
"data-cilantro-signer-selector": true,
|
|
1782
|
+
role: "listbox",
|
|
1783
|
+
"aria-label": "Select signer",
|
|
1784
|
+
"aria-busy": isLoadingSigners,
|
|
1785
|
+
"aria-live": "polite",
|
|
1786
|
+
children: loadingContent ?? (availableSigners.length === 0 ? /* @__PURE__ */ jsx8("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "No signers for this wallet." }) : /* @__PURE__ */ jsx8("ul", { className: cn("space-y-1", classNames?.list), children: availableSigners.map((signer) => /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsxs3(
|
|
1787
|
+
Button,
|
|
1788
|
+
{
|
|
1789
|
+
type: "button",
|
|
1790
|
+
variant: selectedSigner?.id === signer.id ? "secondary" : "ghost",
|
|
1791
|
+
size: "sm",
|
|
1792
|
+
className: cn("w-full justify-start", classNames?.item),
|
|
1793
|
+
onClick: () => onSignerSelect(signer),
|
|
1794
|
+
"aria-pressed": selectedSigner?.id === signer.id,
|
|
1795
|
+
children: [
|
|
1796
|
+
getSignerDisplayName(signer),
|
|
1797
|
+
" (",
|
|
1798
|
+
getSignerTypeLabel(signer.type || signer.signerType || ""),
|
|
1799
|
+
")"
|
|
1800
|
+
]
|
|
1801
|
+
}
|
|
1802
|
+
) }, signer.id)) }))
|
|
1566
1803
|
}
|
|
1567
|
-
)
|
|
1804
|
+
);
|
|
1568
1805
|
}
|
|
1569
1806
|
|
|
1570
1807
|
// src/components/DelegatedKeySelector.tsx
|
|
1571
|
-
import {
|
|
1572
|
-
import { findAll } from "cilantro-sdk/delegated-keys";
|
|
1573
|
-
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1808
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1574
1809
|
function DelegatedKeySelector(props) {
|
|
1575
1810
|
const {
|
|
1576
1811
|
walletId,
|
|
@@ -1579,79 +1814,75 @@ function DelegatedKeySelector(props) {
|
|
|
1579
1814
|
filterActive = true,
|
|
1580
1815
|
className,
|
|
1581
1816
|
classNames,
|
|
1817
|
+
useSkeleton = true,
|
|
1582
1818
|
placeholder = "Select a delegated key",
|
|
1583
1819
|
children
|
|
1584
1820
|
} = props;
|
|
1585
|
-
const {
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
const loadKeys = useCallback3(async () => {
|
|
1590
|
-
if (!walletId) {
|
|
1591
|
-
setKeys([]);
|
|
1592
|
-
return;
|
|
1593
|
-
}
|
|
1594
|
-
setIsLoading(true);
|
|
1595
|
-
setError(null);
|
|
1596
|
-
try {
|
|
1597
|
-
if (token) setSdkAuth(token);
|
|
1598
|
-
const result = await findAll(walletId);
|
|
1599
|
-
const keysData = extractResponseData(result) ?? [];
|
|
1600
|
-
const list = Array.isArray(keysData) ? keysData : [];
|
|
1601
|
-
let loaded = list.filter((k) => k != null && typeof k === "object" && "id" in k).map((k) => ({
|
|
1602
|
-
id: String(k.id ?? ""),
|
|
1603
|
-
walletId: String(k.walletId ?? ""),
|
|
1604
|
-
name: k.name,
|
|
1605
|
-
publicKey: String(k.publicKey ?? ""),
|
|
1606
|
-
permissions: k.permissions ?? {},
|
|
1607
|
-
isActive: k.isActive !== false,
|
|
1608
|
-
createdAt: k.createdAt,
|
|
1609
|
-
expiresAt: k.expiresAt,
|
|
1610
|
-
...k
|
|
1611
|
-
}));
|
|
1612
|
-
if (filterActive) {
|
|
1613
|
-
const now = Date.now();
|
|
1614
|
-
loaded = loaded.filter((key) => {
|
|
1615
|
-
if (!key.isActive) return false;
|
|
1616
|
-
const exp = key.expiresAt ? new Date(key.expiresAt).getTime() : null;
|
|
1617
|
-
return exp === null || exp > now;
|
|
1618
|
-
});
|
|
1619
|
-
}
|
|
1620
|
-
setKeys(loaded);
|
|
1621
|
-
} catch (err) {
|
|
1622
|
-
setError(err instanceof Error ? err.message : String(err));
|
|
1623
|
-
setKeys([]);
|
|
1624
|
-
} finally {
|
|
1625
|
-
setIsLoading(false);
|
|
1626
|
-
}
|
|
1627
|
-
}, [walletId, token, filterActive]);
|
|
1628
|
-
useEffect6(() => {
|
|
1629
|
-
loadKeys();
|
|
1630
|
-
}, [loadKeys]);
|
|
1821
|
+
const { keys, isLoading, error, refresh: loadKeys } = useDelegatedKeys({
|
|
1822
|
+
walletId,
|
|
1823
|
+
filterActive
|
|
1824
|
+
});
|
|
1631
1825
|
const onSelect = (key) => {
|
|
1632
|
-
|
|
1826
|
+
const id = key.id ?? key.delegatedKeyId;
|
|
1827
|
+
onChange?.(id, key);
|
|
1633
1828
|
};
|
|
1634
1829
|
const handleValueChange = (id) => {
|
|
1635
|
-
const key = keys.find((k) => k.id === id) ?? null;
|
|
1830
|
+
const key = keys.find((k) => (k.id ?? k.delegatedKeyId) === id) ?? null;
|
|
1636
1831
|
onChange?.(id, key);
|
|
1637
1832
|
};
|
|
1638
1833
|
if (children) {
|
|
1639
|
-
return /* @__PURE__ */
|
|
1834
|
+
return /* @__PURE__ */ jsx9(Fragment3, { children: children({ keys, selectedKeyId: value, onSelect, isLoading, error, refresh: loadKeys }) });
|
|
1640
1835
|
}
|
|
1641
1836
|
if (!walletId) {
|
|
1642
|
-
return /* @__PURE__ */
|
|
1837
|
+
return /* @__PURE__ */ jsx9("div", { className: cn(className, classNames?.root, "text-sm text-muted-foreground"), children: "Select a wallet first" });
|
|
1643
1838
|
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1839
|
+
if (isLoading && useSkeleton) {
|
|
1840
|
+
return /* @__PURE__ */ jsx9(
|
|
1841
|
+
"div",
|
|
1842
|
+
{
|
|
1843
|
+
className: cn(className, classNames?.root, classNames?.loading),
|
|
1844
|
+
"data-cilantro-delegated-key-selector": true,
|
|
1845
|
+
"aria-busy": "true",
|
|
1846
|
+
"aria-live": "polite",
|
|
1847
|
+
children: /* @__PURE__ */ jsx9(
|
|
1848
|
+
"div",
|
|
1849
|
+
{
|
|
1850
|
+
className: cn(
|
|
1851
|
+
"flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2",
|
|
1852
|
+
classNames?.trigger
|
|
1853
|
+
),
|
|
1854
|
+
children: /* @__PURE__ */ jsx9(Skeleton, { className: cn("h-4 flex-1 rounded", classNames?.skeleton) })
|
|
1855
|
+
}
|
|
1856
|
+
)
|
|
1857
|
+
}
|
|
1858
|
+
);
|
|
1859
|
+
}
|
|
1860
|
+
return /* @__PURE__ */ jsx9(
|
|
1861
|
+
"div",
|
|
1862
|
+
{
|
|
1863
|
+
className: cn(className, classNames?.root),
|
|
1864
|
+
"data-cilantro-delegated-key-selector": true,
|
|
1865
|
+
"aria-busy": isLoading,
|
|
1866
|
+
"aria-live": "polite",
|
|
1867
|
+
children: isLoading ? /* @__PURE__ */ jsx9("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "Loading delegated keys..." }) : error ? /* @__PURE__ */ jsx9("p", { className: cn("text-sm text-destructive", classNames?.message), role: "alert", children: error }) : keys.length === 0 ? /* @__PURE__ */ jsx9("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "No delegated keys found." }) : /* @__PURE__ */ jsxs4(Select, { value: (value ?? "") || void 0, onValueChange: handleValueChange, children: [
|
|
1868
|
+
/* @__PURE__ */ jsx9(SelectTrigger, { className: classNames?.trigger, "aria-label": "Select delegated key", children: /* @__PURE__ */ jsx9(SelectValue, { placeholder }) }),
|
|
1869
|
+
/* @__PURE__ */ jsx9(SelectContent, { className: classNames?.content, children: keys.map((k) => {
|
|
1870
|
+
const id = k.id ?? k.delegatedKeyId;
|
|
1871
|
+
return /* @__PURE__ */ jsxs4(SelectItem, { value: id, className: classNames?.item, children: [
|
|
1872
|
+
k.publicKey.slice(0, 8),
|
|
1873
|
+
"..."
|
|
1874
|
+
] }, id);
|
|
1875
|
+
}) })
|
|
1876
|
+
] })
|
|
1877
|
+
}
|
|
1878
|
+
);
|
|
1648
1879
|
}
|
|
1649
1880
|
|
|
1650
1881
|
// src/ui/textarea.tsx
|
|
1651
|
-
import * as
|
|
1652
|
-
import { jsx as
|
|
1653
|
-
var Textarea =
|
|
1654
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1882
|
+
import * as React4 from "react";
|
|
1883
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1884
|
+
var Textarea = React4.forwardRef(
|
|
1885
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
1655
1886
|
"textarea",
|
|
1656
1887
|
{
|
|
1657
1888
|
className: cn(
|
|
@@ -1666,21 +1897,21 @@ var Textarea = React3.forwardRef(
|
|
|
1666
1897
|
Textarea.displayName = "Textarea";
|
|
1667
1898
|
|
|
1668
1899
|
// src/ui/label.tsx
|
|
1669
|
-
import * as
|
|
1900
|
+
import * as React5 from "react";
|
|
1670
1901
|
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
1671
1902
|
import { cva as cva2 } from "class-variance-authority";
|
|
1672
|
-
import { jsx as
|
|
1903
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1673
1904
|
var labelVariants = cva2(
|
|
1674
1905
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
1675
1906
|
);
|
|
1676
|
-
var Label =
|
|
1907
|
+
var Label = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
|
|
1677
1908
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
1678
1909
|
|
|
1679
1910
|
// src/ui/card.tsx
|
|
1680
|
-
import * as
|
|
1681
|
-
import { jsx as
|
|
1682
|
-
var Card =
|
|
1683
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1911
|
+
import * as React6 from "react";
|
|
1912
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1913
|
+
var Card = React6.forwardRef(
|
|
1914
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
1684
1915
|
"div",
|
|
1685
1916
|
{
|
|
1686
1917
|
ref,
|
|
@@ -1690,12 +1921,12 @@ var Card = React5.forwardRef(
|
|
|
1690
1921
|
)
|
|
1691
1922
|
);
|
|
1692
1923
|
Card.displayName = "Card";
|
|
1693
|
-
var CardHeader =
|
|
1694
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1924
|
+
var CardHeader = React6.forwardRef(
|
|
1925
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx12("div", { ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })
|
|
1695
1926
|
);
|
|
1696
1927
|
CardHeader.displayName = "CardHeader";
|
|
1697
|
-
var CardTitle =
|
|
1698
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1928
|
+
var CardTitle = React6.forwardRef(
|
|
1929
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
1699
1930
|
"h3",
|
|
1700
1931
|
{
|
|
1701
1932
|
ref,
|
|
@@ -1705,19 +1936,19 @@ var CardTitle = React5.forwardRef(
|
|
|
1705
1936
|
)
|
|
1706
1937
|
);
|
|
1707
1938
|
CardTitle.displayName = "CardTitle";
|
|
1708
|
-
var CardDescription =
|
|
1939
|
+
var CardDescription = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
1709
1940
|
CardDescription.displayName = "CardDescription";
|
|
1710
|
-
var CardContent =
|
|
1711
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1941
|
+
var CardContent = React6.forwardRef(
|
|
1942
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx12("div", { ref, className: cn("p-6 pt-0", className), ...props })
|
|
1712
1943
|
);
|
|
1713
1944
|
CardContent.displayName = "CardContent";
|
|
1714
|
-
var CardFooter =
|
|
1715
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
1945
|
+
var CardFooter = React6.forwardRef(
|
|
1946
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx12("div", { ref, className: cn("flex items-center p-6 pt-0", className), ...props })
|
|
1716
1947
|
);
|
|
1717
1948
|
CardFooter.displayName = "CardFooter";
|
|
1718
1949
|
|
|
1719
1950
|
// src/components/MessageSigningForm.tsx
|
|
1720
|
-
import { jsx as
|
|
1951
|
+
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1721
1952
|
function MessageSigningForm({
|
|
1722
1953
|
token: tokenOverride,
|
|
1723
1954
|
selectedWalletId: walletIdOverride,
|
|
@@ -1749,7 +1980,7 @@ function MessageSigningForm({
|
|
|
1749
1980
|
walletAdapterPublicKey
|
|
1750
1981
|
});
|
|
1751
1982
|
if (children) {
|
|
1752
|
-
return /* @__PURE__ */
|
|
1983
|
+
return /* @__PURE__ */ jsx13("div", { className: cn(className, classNames?.root), "data-cilantro-message-signing-form": true, children: children({
|
|
1753
1984
|
messageText: signing.messageText,
|
|
1754
1985
|
setMessageText: signing.setMessageText,
|
|
1755
1986
|
signResultState: signing.signResultState,
|
|
@@ -1763,8 +1994,8 @@ function MessageSigningForm({
|
|
|
1763
1994
|
const isError = resultStatus === "error";
|
|
1764
1995
|
return /* @__PURE__ */ jsxs5(Card, { className: cn(className, classNames?.root), "data-cilantro-message-signing-form": true, children: [
|
|
1765
1996
|
/* @__PURE__ */ jsxs5(CardHeader, { className: classNames?.header, children: [
|
|
1766
|
-
/* @__PURE__ */
|
|
1767
|
-
/* @__PURE__ */
|
|
1997
|
+
/* @__PURE__ */ jsx13(CardTitle, { className: cn("text-lg", classNames?.title), children: "Sign message" }),
|
|
1998
|
+
/* @__PURE__ */ jsx13(CardDescription, { className: classNames?.description, children: "Sign a message with your selected wallet or signer. The signature proves you control the key." }),
|
|
1768
1999
|
showContext && (selectedWalletId || selectedSigner) && /* @__PURE__ */ jsxs5("p", { className: cn("mt-1 text-xs text-muted-foreground", classNames?.context), children: [
|
|
1769
2000
|
selectedWalletId && /* @__PURE__ */ jsxs5("span", { children: [
|
|
1770
2001
|
"Wallet: ",
|
|
@@ -1782,8 +2013,8 @@ function MessageSigningForm({
|
|
|
1782
2013
|
] }),
|
|
1783
2014
|
/* @__PURE__ */ jsxs5(CardContent, { className: "space-y-4", children: [
|
|
1784
2015
|
/* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
|
|
1785
|
-
/* @__PURE__ */
|
|
1786
|
-
/* @__PURE__ */
|
|
2016
|
+
/* @__PURE__ */ jsx13(Label, { htmlFor: "cilantro-message-text", className: classNames?.label, children: "Message" }),
|
|
2017
|
+
/* @__PURE__ */ jsx13(
|
|
1787
2018
|
Textarea,
|
|
1788
2019
|
{
|
|
1789
2020
|
id: "cilantro-message-text",
|
|
@@ -1801,17 +2032,18 @@ function MessageSigningForm({
|
|
|
1801
2032
|
] })
|
|
1802
2033
|
] }),
|
|
1803
2034
|
/* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-center", children: [
|
|
1804
|
-
/* @__PURE__ */
|
|
2035
|
+
/* @__PURE__ */ jsx13(
|
|
1805
2036
|
Button,
|
|
1806
2037
|
{
|
|
1807
2038
|
type: "button",
|
|
2039
|
+
size: "touch",
|
|
1808
2040
|
className: cn("w-full sm:w-auto", classNames?.button),
|
|
1809
2041
|
onClick: signing.handleSign,
|
|
1810
2042
|
disabled: signing.isSigning || !signing.messageText.trim(),
|
|
1811
2043
|
children: signing.isSigning ? "Signing..." : "Sign message"
|
|
1812
2044
|
}
|
|
1813
2045
|
),
|
|
1814
|
-
/* @__PURE__ */
|
|
2046
|
+
/* @__PURE__ */ jsx13(
|
|
1815
2047
|
Button,
|
|
1816
2048
|
{
|
|
1817
2049
|
type: "button",
|
|
@@ -1826,6 +2058,9 @@ function MessageSigningForm({
|
|
|
1826
2058
|
resultStatus !== "idle" && /* @__PURE__ */ jsxs5(
|
|
1827
2059
|
"div",
|
|
1828
2060
|
{
|
|
2061
|
+
role: "status",
|
|
2062
|
+
"aria-live": isError ? "assertive" : "polite",
|
|
2063
|
+
"aria-busy": resultStatus === "loading",
|
|
1829
2064
|
className: cn(
|
|
1830
2065
|
"rounded-lg border px-3 py-2 text-sm",
|
|
1831
2066
|
isSuccess && cn("border-green-500/50 bg-green-500/10 text-green-700 dark:text-green-400", classNames?.resultSuccess),
|
|
@@ -1836,7 +2071,7 @@ function MessageSigningForm({
|
|
|
1836
2071
|
"data-status": resultStatus,
|
|
1837
2072
|
children: [
|
|
1838
2073
|
signing.signResultState.message,
|
|
1839
|
-
signing.signResultState.detail != null && /* @__PURE__ */
|
|
2074
|
+
signing.signResultState.detail != null && /* @__PURE__ */ jsx13("pre", { className: cn("mt-2 overflow-auto rounded-md bg-muted/80 p-2 text-xs", classNames?.resultPre), children: JSON.stringify(signing.signResultState.detail, null, 2) })
|
|
1840
2075
|
]
|
|
1841
2076
|
}
|
|
1842
2077
|
)
|
|
@@ -1845,7 +2080,7 @@ function MessageSigningForm({
|
|
|
1845
2080
|
}
|
|
1846
2081
|
|
|
1847
2082
|
// src/components/TransactionSigningForm.tsx
|
|
1848
|
-
import { jsx as
|
|
2083
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1849
2084
|
function TransactionSigningForm({
|
|
1850
2085
|
token: tokenOverride,
|
|
1851
2086
|
selectedWalletId: walletIdOverride,
|
|
@@ -1878,7 +2113,7 @@ function TransactionSigningForm({
|
|
|
1878
2113
|
connection
|
|
1879
2114
|
});
|
|
1880
2115
|
if (children) {
|
|
1881
|
-
return /* @__PURE__ */
|
|
2116
|
+
return /* @__PURE__ */ jsx14("div", { className: cn(className, classNames?.root), "data-cilantro-transaction-signing-form": true, children: children({
|
|
1882
2117
|
transactionResultState: signing.transactionResultState,
|
|
1883
2118
|
isSigningTransaction: signing.isSigningTransaction,
|
|
1884
2119
|
isSendingTransaction: signing.isSendingTransaction,
|
|
@@ -1892,12 +2127,12 @@ function TransactionSigningForm({
|
|
|
1892
2127
|
const isError = resultStatus === "error";
|
|
1893
2128
|
return /* @__PURE__ */ jsxs6(Card, { className: cn(className, classNames?.root), "data-cilantro-transaction-signing-form": true, children: [
|
|
1894
2129
|
/* @__PURE__ */ jsxs6(CardHeader, { className: classNames?.header, children: [
|
|
1895
|
-
/* @__PURE__ */
|
|
2130
|
+
/* @__PURE__ */ jsx14(CardTitle, { className: cn("text-lg", classNames?.title), children: "Sign transaction" }),
|
|
1896
2131
|
/* @__PURE__ */ jsxs6(CardDescription, { className: classNames?.description, children: [
|
|
1897
2132
|
"Build a transaction in your app, then pass it to ",
|
|
1898
|
-
/* @__PURE__ */
|
|
2133
|
+
/* @__PURE__ */ jsx14("code", { className: "text-xs", children: "signTransaction(tx)" }),
|
|
1899
2134
|
" to sign only, or ",
|
|
1900
|
-
/* @__PURE__ */
|
|
2135
|
+
/* @__PURE__ */ jsx14("code", { className: "text-xs", children: "signAndSendTransaction(tx)" }),
|
|
1901
2136
|
" to sign and send. Use the render props (children) to wire your own UI."
|
|
1902
2137
|
] }),
|
|
1903
2138
|
showContext && (selectedWalletId || selectedSigner) && /* @__PURE__ */ jsxs6("p", { className: cn("mt-1 text-xs text-muted-foreground", classNames?.context), children: [
|
|
@@ -1916,7 +2151,7 @@ function TransactionSigningForm({
|
|
|
1916
2151
|
] })
|
|
1917
2152
|
] }),
|
|
1918
2153
|
/* @__PURE__ */ jsxs6(CardContent, { className: "space-y-4", children: [
|
|
1919
|
-
/* @__PURE__ */
|
|
2154
|
+
/* @__PURE__ */ jsx14(
|
|
1920
2155
|
Button,
|
|
1921
2156
|
{
|
|
1922
2157
|
type: "button",
|
|
@@ -1930,6 +2165,9 @@ function TransactionSigningForm({
|
|
|
1930
2165
|
resultStatus !== "idle" && /* @__PURE__ */ jsxs6(
|
|
1931
2166
|
"div",
|
|
1932
2167
|
{
|
|
2168
|
+
role: "status",
|
|
2169
|
+
"aria-live": isError ? "assertive" : "polite",
|
|
2170
|
+
"aria-busy": resultStatus === "loading",
|
|
1933
2171
|
className: cn(
|
|
1934
2172
|
"rounded-lg border px-3 py-2 text-sm",
|
|
1935
2173
|
isSuccess && cn("border-green-500/50 bg-green-500/10 text-green-700 dark:text-green-400", classNames?.resultSuccess),
|
|
@@ -1940,7 +2178,7 @@ function TransactionSigningForm({
|
|
|
1940
2178
|
"data-status": resultStatus,
|
|
1941
2179
|
children: [
|
|
1942
2180
|
signing.transactionResultState.message,
|
|
1943
|
-
signing.transactionResultState.detail != null && /* @__PURE__ */
|
|
2181
|
+
signing.transactionResultState.detail != null && /* @__PURE__ */ jsx14("pre", { className: cn("mt-2 overflow-auto rounded-md bg-muted/80 p-2 text-xs", classNames?.resultPre), children: JSON.stringify(signing.transactionResultState.detail, null, 2) })
|
|
1944
2182
|
]
|
|
1945
2183
|
}
|
|
1946
2184
|
)
|
|
@@ -1949,14 +2187,14 @@ function TransactionSigningForm({
|
|
|
1949
2187
|
}
|
|
1950
2188
|
|
|
1951
2189
|
// src/components/LoginForm.tsx
|
|
1952
|
-
import { useState as
|
|
2190
|
+
import { useState as useState9 } from "react";
|
|
1953
2191
|
|
|
1954
2192
|
// src/ui/input.tsx
|
|
1955
|
-
import * as
|
|
1956
|
-
import { jsx as
|
|
1957
|
-
var Input =
|
|
2193
|
+
import * as React7 from "react";
|
|
2194
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2195
|
+
var Input = React7.forwardRef(
|
|
1958
2196
|
({ className, type, ...props }, ref) => {
|
|
1959
|
-
return /* @__PURE__ */
|
|
2197
|
+
return /* @__PURE__ */ jsx15(
|
|
1960
2198
|
"input",
|
|
1961
2199
|
{
|
|
1962
2200
|
type,
|
|
@@ -1973,7 +2211,7 @@ var Input = React6.forwardRef(
|
|
|
1973
2211
|
Input.displayName = "Input";
|
|
1974
2212
|
|
|
1975
2213
|
// src/components/LoginForm.tsx
|
|
1976
|
-
import { jsx as
|
|
2214
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1977
2215
|
function LoginForm({
|
|
1978
2216
|
className,
|
|
1979
2217
|
classNames,
|
|
@@ -1985,9 +2223,9 @@ function LoginForm({
|
|
|
1985
2223
|
renderSwitchToRegister
|
|
1986
2224
|
}) {
|
|
1987
2225
|
const { login, isLoading } = useCilantroAuth();
|
|
1988
|
-
const [usernameOrEmail, setUsernameOrEmail] =
|
|
1989
|
-
const [password, setPassword] =
|
|
1990
|
-
const [error, setError] =
|
|
2226
|
+
const [usernameOrEmail, setUsernameOrEmail] = useState9("");
|
|
2227
|
+
const [password, setPassword] = useState9("");
|
|
2228
|
+
const [error, setError] = useState9(null);
|
|
1991
2229
|
const handleSubmit = async (e) => {
|
|
1992
2230
|
e.preventDefault();
|
|
1993
2231
|
setError(null);
|
|
@@ -2002,13 +2240,13 @@ function LoginForm({
|
|
|
2002
2240
|
};
|
|
2003
2241
|
return /* @__PURE__ */ jsxs7(Card, { className: cn(className, classNames?.root), "data-cilantro-login-form": true, children: [
|
|
2004
2242
|
/* @__PURE__ */ jsxs7(CardHeader, { className: classNames?.header, children: [
|
|
2005
|
-
/* @__PURE__ */
|
|
2006
|
-
description != null && /* @__PURE__ */
|
|
2243
|
+
/* @__PURE__ */ jsx16(CardTitle, { className: classNames?.title, children: title }),
|
|
2244
|
+
description != null && /* @__PURE__ */ jsx16(CardDescription, { className: classNames?.description, children: description })
|
|
2007
2245
|
] }),
|
|
2008
|
-
/* @__PURE__ */
|
|
2246
|
+
/* @__PURE__ */ jsx16(CardContent, { children: /* @__PURE__ */ jsxs7("form", { onSubmit: handleSubmit, className: cn("space-y-4", classNames?.form), children: [
|
|
2009
2247
|
/* @__PURE__ */ jsxs7("div", { className: "space-y-2", children: [
|
|
2010
|
-
/* @__PURE__ */
|
|
2011
|
-
/* @__PURE__ */
|
|
2248
|
+
/* @__PURE__ */ jsx16(Label, { htmlFor: "cilantro-login-username", className: classNames?.label, children: "Username or email" }),
|
|
2249
|
+
/* @__PURE__ */ jsx16(
|
|
2012
2250
|
Input,
|
|
2013
2251
|
{
|
|
2014
2252
|
id: "cilantro-login-username",
|
|
@@ -2024,8 +2262,8 @@ function LoginForm({
|
|
|
2024
2262
|
)
|
|
2025
2263
|
] }),
|
|
2026
2264
|
/* @__PURE__ */ jsxs7("div", { className: "space-y-2", children: [
|
|
2027
|
-
/* @__PURE__ */
|
|
2028
|
-
/* @__PURE__ */
|
|
2265
|
+
/* @__PURE__ */ jsx16(Label, { htmlFor: "cilantro-login-password", className: classNames?.label, children: "Password" }),
|
|
2266
|
+
/* @__PURE__ */ jsx16(
|
|
2029
2267
|
Input,
|
|
2030
2268
|
{
|
|
2031
2269
|
id: "cilantro-login-password",
|
|
@@ -2040,7 +2278,7 @@ function LoginForm({
|
|
|
2040
2278
|
}
|
|
2041
2279
|
)
|
|
2042
2280
|
] }),
|
|
2043
|
-
error && /* @__PURE__ */
|
|
2281
|
+
error && /* @__PURE__ */ jsx16(
|
|
2044
2282
|
"div",
|
|
2045
2283
|
{
|
|
2046
2284
|
className: cn(
|
|
@@ -2051,23 +2289,24 @@ function LoginForm({
|
|
|
2051
2289
|
children: error
|
|
2052
2290
|
}
|
|
2053
2291
|
),
|
|
2054
|
-
/* @__PURE__ */
|
|
2292
|
+
/* @__PURE__ */ jsx16(
|
|
2055
2293
|
Button,
|
|
2056
2294
|
{
|
|
2057
2295
|
type: "submit",
|
|
2296
|
+
size: "touch",
|
|
2058
2297
|
className: cn("w-full", classNames?.submitButton),
|
|
2059
2298
|
disabled: isLoading || !usernameOrEmail.trim() || !password,
|
|
2060
2299
|
children: isLoading ? "Signing in..." : submitLabel
|
|
2061
2300
|
}
|
|
2062
2301
|
),
|
|
2063
|
-
renderSwitchToRegister && /* @__PURE__ */
|
|
2302
|
+
renderSwitchToRegister && /* @__PURE__ */ jsx16("div", { className: "text-center text-sm text-muted-foreground", children: renderSwitchToRegister() })
|
|
2064
2303
|
] }) })
|
|
2065
2304
|
] });
|
|
2066
2305
|
}
|
|
2067
2306
|
|
|
2068
2307
|
// src/components/RegisterForm.tsx
|
|
2069
|
-
import { useState as
|
|
2070
|
-
import { jsx as
|
|
2308
|
+
import { useState as useState10 } from "react";
|
|
2309
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2071
2310
|
function RegisterForm({
|
|
2072
2311
|
className,
|
|
2073
2312
|
classNames,
|
|
@@ -2080,10 +2319,10 @@ function RegisterForm({
|
|
|
2080
2319
|
renderSwitchToLogin
|
|
2081
2320
|
}) {
|
|
2082
2321
|
const { register, isLoading } = useCilantroAuth();
|
|
2083
|
-
const [username, setUsername] =
|
|
2084
|
-
const [email, setEmail] =
|
|
2085
|
-
const [password, setPassword] =
|
|
2086
|
-
const [error, setError] =
|
|
2322
|
+
const [username, setUsername] = useState10("");
|
|
2323
|
+
const [email, setEmail] = useState10("");
|
|
2324
|
+
const [password, setPassword] = useState10("");
|
|
2325
|
+
const [error, setError] = useState10(null);
|
|
2087
2326
|
const handleSubmit = async (e) => {
|
|
2088
2327
|
e.preventDefault();
|
|
2089
2328
|
setError(null);
|
|
@@ -2098,13 +2337,13 @@ function RegisterForm({
|
|
|
2098
2337
|
};
|
|
2099
2338
|
return /* @__PURE__ */ jsxs8(Card, { className: cn(className, classNames?.root), "data-cilantro-register-form": true, children: [
|
|
2100
2339
|
/* @__PURE__ */ jsxs8(CardHeader, { className: classNames?.header, children: [
|
|
2101
|
-
/* @__PURE__ */
|
|
2102
|
-
description != null && /* @__PURE__ */
|
|
2340
|
+
/* @__PURE__ */ jsx17(CardTitle, { className: classNames?.title, children: title }),
|
|
2341
|
+
description != null && /* @__PURE__ */ jsx17(CardDescription, { className: classNames?.description, children: description })
|
|
2103
2342
|
] }),
|
|
2104
|
-
/* @__PURE__ */
|
|
2343
|
+
/* @__PURE__ */ jsx17(CardContent, { children: /* @__PURE__ */ jsxs8("form", { onSubmit: handleSubmit, className: cn("space-y-4", classNames?.form), children: [
|
|
2105
2344
|
/* @__PURE__ */ jsxs8("div", { className: "space-y-2", children: [
|
|
2106
|
-
/* @__PURE__ */
|
|
2107
|
-
/* @__PURE__ */
|
|
2345
|
+
/* @__PURE__ */ jsx17(Label, { htmlFor: "cilantro-register-username", className: classNames?.label, children: "Username" }),
|
|
2346
|
+
/* @__PURE__ */ jsx17(
|
|
2108
2347
|
Input,
|
|
2109
2348
|
{
|
|
2110
2349
|
id: "cilantro-register-username",
|
|
@@ -2120,8 +2359,8 @@ function RegisterForm({
|
|
|
2120
2359
|
)
|
|
2121
2360
|
] }),
|
|
2122
2361
|
/* @__PURE__ */ jsxs8("div", { className: "space-y-2", children: [
|
|
2123
|
-
/* @__PURE__ */
|
|
2124
|
-
/* @__PURE__ */
|
|
2362
|
+
/* @__PURE__ */ jsx17(Label, { htmlFor: "cilantro-register-email", className: classNames?.label, children: "Email" }),
|
|
2363
|
+
/* @__PURE__ */ jsx17(
|
|
2125
2364
|
Input,
|
|
2126
2365
|
{
|
|
2127
2366
|
id: "cilantro-register-email",
|
|
@@ -2137,8 +2376,8 @@ function RegisterForm({
|
|
|
2137
2376
|
)
|
|
2138
2377
|
] }),
|
|
2139
2378
|
/* @__PURE__ */ jsxs8("div", { className: "space-y-2", children: [
|
|
2140
|
-
/* @__PURE__ */
|
|
2141
|
-
/* @__PURE__ */
|
|
2379
|
+
/* @__PURE__ */ jsx17(Label, { htmlFor: "cilantro-register-password", className: classNames?.label, children: "Password" }),
|
|
2380
|
+
/* @__PURE__ */ jsx17(
|
|
2142
2381
|
Input,
|
|
2143
2382
|
{
|
|
2144
2383
|
id: "cilantro-register-password",
|
|
@@ -2153,7 +2392,7 @@ function RegisterForm({
|
|
|
2153
2392
|
}
|
|
2154
2393
|
)
|
|
2155
2394
|
] }),
|
|
2156
|
-
error && /* @__PURE__ */
|
|
2395
|
+
error && /* @__PURE__ */ jsx17(
|
|
2157
2396
|
"div",
|
|
2158
2397
|
{
|
|
2159
2398
|
className: cn(
|
|
@@ -2164,23 +2403,24 @@ function RegisterForm({
|
|
|
2164
2403
|
children: error
|
|
2165
2404
|
}
|
|
2166
2405
|
),
|
|
2167
|
-
/* @__PURE__ */
|
|
2406
|
+
/* @__PURE__ */ jsx17(
|
|
2168
2407
|
Button,
|
|
2169
2408
|
{
|
|
2170
2409
|
type: "submit",
|
|
2410
|
+
size: "touch",
|
|
2171
2411
|
className: cn("w-full", classNames?.submitButton),
|
|
2172
2412
|
disabled: isLoading || !username.trim() || !email.trim() || !password,
|
|
2173
2413
|
children: isLoading ? "Creating account..." : submitLabel
|
|
2174
2414
|
}
|
|
2175
2415
|
),
|
|
2176
|
-
renderSwitchToLogin && /* @__PURE__ */
|
|
2416
|
+
renderSwitchToLogin && /* @__PURE__ */ jsx17("div", { className: "text-center text-sm text-muted-foreground", children: renderSwitchToLogin() })
|
|
2177
2417
|
] }) })
|
|
2178
2418
|
] });
|
|
2179
2419
|
}
|
|
2180
2420
|
|
|
2181
2421
|
// src/components/AuthForm.tsx
|
|
2182
|
-
import { useState as
|
|
2183
|
-
import { Fragment as Fragment4, jsx as
|
|
2422
|
+
import { useState as useState11 } from "react";
|
|
2423
|
+
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2184
2424
|
function AuthForm({
|
|
2185
2425
|
defaultMode = "login",
|
|
2186
2426
|
className,
|
|
@@ -2198,12 +2438,12 @@ function AuthForm({
|
|
|
2198
2438
|
isActive = true
|
|
2199
2439
|
}) {
|
|
2200
2440
|
const { login, register, isLoading } = useCilantroAuth();
|
|
2201
|
-
const [mode, setMode] =
|
|
2202
|
-
const [usernameOrEmail, setUsernameOrEmail] =
|
|
2203
|
-
const [username, setUsername] =
|
|
2204
|
-
const [email, setEmail] =
|
|
2205
|
-
const [password, setPassword] =
|
|
2206
|
-
const [error, setError] =
|
|
2441
|
+
const [mode, setMode] = useState11(defaultMode);
|
|
2442
|
+
const [usernameOrEmail, setUsernameOrEmail] = useState11("");
|
|
2443
|
+
const [username, setUsername] = useState11("");
|
|
2444
|
+
const [email, setEmail] = useState11("");
|
|
2445
|
+
const [password, setPassword] = useState11("");
|
|
2446
|
+
const [error, setError] = useState11(null);
|
|
2207
2447
|
const isLogin = mode === "login";
|
|
2208
2448
|
const handleSubmit = async (e) => {
|
|
2209
2449
|
e.preventDefault();
|
|
@@ -2228,14 +2468,14 @@ function AuthForm({
|
|
|
2228
2468
|
const canSubmit = isLogin ? usernameOrEmail.trim().length > 0 && password.length > 0 : username.trim().length > 0 && email.trim().length > 0 && password.length > 0;
|
|
2229
2469
|
return /* @__PURE__ */ jsxs9(Card, { className: cn("w-full max-w-sm", className, classNames?.root), "data-cilantro-auth-form": true, children: [
|
|
2230
2470
|
/* @__PURE__ */ jsxs9(CardHeader, { className: cn("space-y-1 text-center sm:text-left", classNames?.header), children: [
|
|
2231
|
-
/* @__PURE__ */
|
|
2232
|
-
/* @__PURE__ */
|
|
2471
|
+
/* @__PURE__ */ jsx18(CardTitle, { className: cn("text-xl", classNames?.title), children: isLogin ? loginTitle : registerTitle }),
|
|
2472
|
+
/* @__PURE__ */ jsx18(CardDescription, { className: classNames?.description, children: isLogin ? loginDescription : registerDescription })
|
|
2233
2473
|
] }),
|
|
2234
|
-
/* @__PURE__ */
|
|
2474
|
+
/* @__PURE__ */ jsx18(CardContent, { children: /* @__PURE__ */ jsxs9("form", { onSubmit: handleSubmit, className: cn("space-y-4", classNames?.form), children: [
|
|
2235
2475
|
isLogin ? /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
2236
2476
|
/* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
|
|
2237
|
-
/* @__PURE__ */
|
|
2238
|
-
/* @__PURE__ */
|
|
2477
|
+
/* @__PURE__ */ jsx18(Label, { htmlFor: "cilantro-auth-username", className: classNames?.label, children: "Username or email" }),
|
|
2478
|
+
/* @__PURE__ */ jsx18(
|
|
2239
2479
|
Input,
|
|
2240
2480
|
{
|
|
2241
2481
|
id: "cilantro-auth-username",
|
|
@@ -2251,8 +2491,8 @@ function AuthForm({
|
|
|
2251
2491
|
)
|
|
2252
2492
|
] }),
|
|
2253
2493
|
/* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
|
|
2254
|
-
/* @__PURE__ */
|
|
2255
|
-
/* @__PURE__ */
|
|
2494
|
+
/* @__PURE__ */ jsx18(Label, { htmlFor: "cilantro-auth-password", className: classNames?.label, children: "Password" }),
|
|
2495
|
+
/* @__PURE__ */ jsx18(
|
|
2256
2496
|
Input,
|
|
2257
2497
|
{
|
|
2258
2498
|
id: "cilantro-auth-password",
|
|
@@ -2269,8 +2509,8 @@ function AuthForm({
|
|
|
2269
2509
|
] })
|
|
2270
2510
|
] }) : /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
2271
2511
|
/* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
|
|
2272
|
-
/* @__PURE__ */
|
|
2273
|
-
/* @__PURE__ */
|
|
2512
|
+
/* @__PURE__ */ jsx18(Label, { htmlFor: "cilantro-auth-reg-username", className: classNames?.label, children: "Username" }),
|
|
2513
|
+
/* @__PURE__ */ jsx18(
|
|
2274
2514
|
Input,
|
|
2275
2515
|
{
|
|
2276
2516
|
id: "cilantro-auth-reg-username",
|
|
@@ -2286,8 +2526,8 @@ function AuthForm({
|
|
|
2286
2526
|
)
|
|
2287
2527
|
] }),
|
|
2288
2528
|
/* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
|
|
2289
|
-
/* @__PURE__ */
|
|
2290
|
-
/* @__PURE__ */
|
|
2529
|
+
/* @__PURE__ */ jsx18(Label, { htmlFor: "cilantro-auth-reg-email", className: classNames?.label, children: "Email" }),
|
|
2530
|
+
/* @__PURE__ */ jsx18(
|
|
2291
2531
|
Input,
|
|
2292
2532
|
{
|
|
2293
2533
|
id: "cilantro-auth-reg-email",
|
|
@@ -2303,8 +2543,8 @@ function AuthForm({
|
|
|
2303
2543
|
)
|
|
2304
2544
|
] }),
|
|
2305
2545
|
/* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
|
|
2306
|
-
/* @__PURE__ */
|
|
2307
|
-
/* @__PURE__ */
|
|
2546
|
+
/* @__PURE__ */ jsx18(Label, { htmlFor: "cilantro-auth-reg-password", className: classNames?.label, children: "Password" }),
|
|
2547
|
+
/* @__PURE__ */ jsx18(
|
|
2308
2548
|
Input,
|
|
2309
2549
|
{
|
|
2310
2550
|
id: "cilantro-auth-reg-password",
|
|
@@ -2320,7 +2560,7 @@ function AuthForm({
|
|
|
2320
2560
|
)
|
|
2321
2561
|
] })
|
|
2322
2562
|
] }),
|
|
2323
|
-
error && /* @__PURE__ */
|
|
2563
|
+
error && /* @__PURE__ */ jsx18(
|
|
2324
2564
|
"div",
|
|
2325
2565
|
{
|
|
2326
2566
|
className: cn(
|
|
@@ -2331,16 +2571,17 @@ function AuthForm({
|
|
|
2331
2571
|
children: error
|
|
2332
2572
|
}
|
|
2333
2573
|
),
|
|
2334
|
-
/* @__PURE__ */
|
|
2574
|
+
/* @__PURE__ */ jsx18(
|
|
2335
2575
|
Button,
|
|
2336
2576
|
{
|
|
2337
2577
|
type: "submit",
|
|
2578
|
+
size: "touch",
|
|
2338
2579
|
className: cn("w-full", classNames?.submitButton),
|
|
2339
2580
|
disabled: isLoading || !canSubmit,
|
|
2340
2581
|
children: isLoading ? isLogin ? "Signing in..." : "Creating account..." : isLogin ? loginSubmitLabel : registerSubmitLabel
|
|
2341
2582
|
}
|
|
2342
2583
|
),
|
|
2343
|
-
/* @__PURE__ */
|
|
2584
|
+
/* @__PURE__ */ jsx18("p", { className: cn("text-center text-sm text-muted-foreground", classNames?.toggle), children: /* @__PURE__ */ jsx18(
|
|
2344
2585
|
"button",
|
|
2345
2586
|
{
|
|
2346
2587
|
type: "button",
|
|
@@ -2355,35 +2596,49 @@ function AuthForm({
|
|
|
2355
2596
|
}
|
|
2356
2597
|
|
|
2357
2598
|
// src/components/AuthGuard.tsx
|
|
2358
|
-
import { Fragment as Fragment5, jsx as
|
|
2599
|
+
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2359
2600
|
function AuthGuard({
|
|
2360
2601
|
children,
|
|
2361
2602
|
fallback,
|
|
2362
2603
|
className,
|
|
2363
2604
|
classNames,
|
|
2364
|
-
showFallback = true
|
|
2605
|
+
showFallback = true,
|
|
2606
|
+
useSkeleton = false
|
|
2365
2607
|
}) {
|
|
2366
2608
|
const { isAuthenticated, isLoading } = useCilantroAuth();
|
|
2367
2609
|
if (isLoading) {
|
|
2368
|
-
return /* @__PURE__ */
|
|
2610
|
+
return /* @__PURE__ */ jsx19(
|
|
2611
|
+
"div",
|
|
2612
|
+
{
|
|
2613
|
+
className: cn(className, classNames?.root, classNames?.loading),
|
|
2614
|
+
"data-cilantro-auth-guard": true,
|
|
2615
|
+
"aria-busy": "true",
|
|
2616
|
+
"aria-live": "polite",
|
|
2617
|
+
children: useSkeleton ? /* @__PURE__ */ jsxs10("div", { className: cn("rounded-lg border border-input p-4 space-y-3 w-full max-w-sm", classNames?.fallback), children: [
|
|
2618
|
+
/* @__PURE__ */ jsx19(Skeleton, { className: cn("h-6 w-2/3 rounded", classNames?.skeleton) }),
|
|
2619
|
+
/* @__PURE__ */ jsx19(Skeleton, { className: cn("h-4 w-full rounded", classNames?.skeleton) }),
|
|
2620
|
+
/* @__PURE__ */ jsx19(Skeleton, { className: cn("h-4 w-[80%] rounded", classNames?.skeleton) })
|
|
2621
|
+
] }) : /* @__PURE__ */ jsx19("div", { className: cn("text-sm text-muted-foreground", classNames?.fallback), children: "Loading..." })
|
|
2622
|
+
}
|
|
2623
|
+
);
|
|
2369
2624
|
}
|
|
2370
2625
|
if (!isAuthenticated) {
|
|
2371
2626
|
if (!showFallback) return null;
|
|
2372
|
-
return /* @__PURE__ */
|
|
2627
|
+
return /* @__PURE__ */ jsx19("div", { className: cn(className, classNames?.root), "data-cilantro-auth-guard": true, children: fallback ?? /* @__PURE__ */ jsx19(LoginForm, { className: classNames?.fallback }) });
|
|
2373
2628
|
}
|
|
2374
|
-
return /* @__PURE__ */
|
|
2629
|
+
return /* @__PURE__ */ jsx19(Fragment5, { children });
|
|
2375
2630
|
}
|
|
2376
2631
|
|
|
2377
2632
|
// src/components/AddSignerForm.tsx
|
|
2378
|
-
import { useState as
|
|
2633
|
+
import { useState as useState12 } from "react";
|
|
2379
2634
|
|
|
2380
2635
|
// src/ui/dialog.tsx
|
|
2381
|
-
import * as
|
|
2636
|
+
import * as React8 from "react";
|
|
2382
2637
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
2383
|
-
import { jsx as
|
|
2638
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2384
2639
|
var Dialog = DialogPrimitive.Root;
|
|
2385
2640
|
var DialogPortal = DialogPrimitive.Portal;
|
|
2386
|
-
var DialogOverlay =
|
|
2641
|
+
var DialogOverlay = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2387
2642
|
DialogPrimitive.Overlay,
|
|
2388
2643
|
{
|
|
2389
2644
|
ref,
|
|
@@ -2395,14 +2650,14 @@ var DialogOverlay = React7.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
2395
2650
|
}
|
|
2396
2651
|
));
|
|
2397
2652
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
2398
|
-
var DialogContent =
|
|
2399
|
-
/* @__PURE__ */
|
|
2400
|
-
/* @__PURE__ */
|
|
2653
|
+
var DialogContent = React8.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs11(DialogPortal, { children: [
|
|
2654
|
+
/* @__PURE__ */ jsx20(DialogOverlay, {}),
|
|
2655
|
+
/* @__PURE__ */ jsx20(
|
|
2401
2656
|
DialogPrimitive.Content,
|
|
2402
2657
|
{
|
|
2403
2658
|
ref,
|
|
2404
2659
|
className: cn(
|
|
2405
|
-
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
2660
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg max-h-[100dvh] sm:max-h-[90vh] translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 overflow-y-auto data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
2406
2661
|
className
|
|
2407
2662
|
),
|
|
2408
2663
|
...props,
|
|
@@ -2411,9 +2666,9 @@ var DialogContent = React7.forwardRef(({ className, children, ...props }, ref) =
|
|
|
2411
2666
|
)
|
|
2412
2667
|
] }));
|
|
2413
2668
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
2414
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
2669
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
2415
2670
|
DialogHeader.displayName = "DialogHeader";
|
|
2416
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
2671
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx20(
|
|
2417
2672
|
"div",
|
|
2418
2673
|
{
|
|
2419
2674
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -2421,7 +2676,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx19(
|
|
|
2421
2676
|
}
|
|
2422
2677
|
);
|
|
2423
2678
|
DialogFooter.displayName = "DialogFooter";
|
|
2424
|
-
var DialogTitle =
|
|
2679
|
+
var DialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2425
2680
|
DialogPrimitive.Title,
|
|
2426
2681
|
{
|
|
2427
2682
|
ref,
|
|
@@ -2430,7 +2685,7 @@ var DialogTitle = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
2430
2685
|
}
|
|
2431
2686
|
));
|
|
2432
2687
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
2433
|
-
var DialogDescription =
|
|
2688
|
+
var DialogDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2434
2689
|
DialogPrimitive.Description,
|
|
2435
2690
|
{
|
|
2436
2691
|
ref,
|
|
@@ -2441,7 +2696,7 @@ var DialogDescription = React7.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
2441
2696
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
2442
2697
|
|
|
2443
2698
|
// src/components/AddSignerForm.tsx
|
|
2444
|
-
import { Fragment as Fragment6, jsx as
|
|
2699
|
+
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2445
2700
|
function AddSignerForm({
|
|
2446
2701
|
walletId,
|
|
2447
2702
|
open = true,
|
|
@@ -2453,12 +2708,12 @@ function AddSignerForm({
|
|
|
2453
2708
|
classNames,
|
|
2454
2709
|
asDialog = true
|
|
2455
2710
|
}) {
|
|
2456
|
-
const [signerType, setSignerType] =
|
|
2457
|
-
const [email, setEmail] =
|
|
2458
|
-
const [phone, setPhone] =
|
|
2459
|
-
const [address, setAddress] =
|
|
2460
|
-
const [isSubmitting, setIsSubmitting] =
|
|
2461
|
-
const [error, setError] =
|
|
2711
|
+
const [signerType, setSignerType] = useState12(null);
|
|
2712
|
+
const [email, setEmail] = useState12("");
|
|
2713
|
+
const [phone, setPhone] = useState12("");
|
|
2714
|
+
const [address, setAddress] = useState12("");
|
|
2715
|
+
const [isSubmitting, setIsSubmitting] = useState12(false);
|
|
2716
|
+
const [error, setError] = useState12(null);
|
|
2462
2717
|
const resetForm = () => {
|
|
2463
2718
|
setSignerType(null);
|
|
2464
2719
|
setEmail("");
|
|
@@ -2513,12 +2768,12 @@ function AddSignerForm({
|
|
|
2513
2768
|
onError?.(message);
|
|
2514
2769
|
}).finally(() => setIsSubmitting(false));
|
|
2515
2770
|
};
|
|
2516
|
-
const formContent = /* @__PURE__ */
|
|
2517
|
-
!signerType ? /* @__PURE__ */
|
|
2518
|
-
/* @__PURE__ */
|
|
2519
|
-
/* @__PURE__ */
|
|
2520
|
-
/* @__PURE__ */
|
|
2521
|
-
/* @__PURE__ */
|
|
2771
|
+
const formContent = /* @__PURE__ */ jsxs12("form", { onSubmit: handleSubmit, className: cn("space-y-4", classNames?.form), children: [
|
|
2772
|
+
!signerType ? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
2773
|
+
/* @__PURE__ */ jsxs12("div", { className: "space-y-2", role: "group", "aria-labelledby": "add-signer-type-label", children: [
|
|
2774
|
+
/* @__PURE__ */ jsx21(Label, { id: "add-signer-type-label", className: classNames?.label, children: "Signer type" }),
|
|
2775
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-2", children: [
|
|
2776
|
+
/* @__PURE__ */ jsx21(
|
|
2522
2777
|
Button,
|
|
2523
2778
|
{
|
|
2524
2779
|
type: "button",
|
|
@@ -2529,7 +2784,7 @@ function AddSignerForm({
|
|
|
2529
2784
|
children: "Email"
|
|
2530
2785
|
}
|
|
2531
2786
|
),
|
|
2532
|
-
/* @__PURE__ */
|
|
2787
|
+
/* @__PURE__ */ jsx21(
|
|
2533
2788
|
Button,
|
|
2534
2789
|
{
|
|
2535
2790
|
type: "button",
|
|
@@ -2540,7 +2795,7 @@ function AddSignerForm({
|
|
|
2540
2795
|
children: "Phone"
|
|
2541
2796
|
}
|
|
2542
2797
|
),
|
|
2543
|
-
/* @__PURE__ */
|
|
2798
|
+
/* @__PURE__ */ jsx21(
|
|
2544
2799
|
Button,
|
|
2545
2800
|
{
|
|
2546
2801
|
type: "button",
|
|
@@ -2551,7 +2806,7 @@ function AddSignerForm({
|
|
|
2551
2806
|
children: "Passkey"
|
|
2552
2807
|
}
|
|
2553
2808
|
),
|
|
2554
|
-
/* @__PURE__ */
|
|
2809
|
+
/* @__PURE__ */ jsx21(
|
|
2555
2810
|
Button,
|
|
2556
2811
|
{
|
|
2557
2812
|
type: "button",
|
|
@@ -2564,7 +2819,7 @@ function AddSignerForm({
|
|
|
2564
2819
|
)
|
|
2565
2820
|
] })
|
|
2566
2821
|
] }),
|
|
2567
|
-
asDialog && /* @__PURE__ */
|
|
2822
|
+
asDialog && /* @__PURE__ */ jsx21(DialogFooter, { className: "gap-2 sm:gap-0", children: /* @__PURE__ */ jsx21(
|
|
2568
2823
|
Button,
|
|
2569
2824
|
{
|
|
2570
2825
|
type: "button",
|
|
@@ -2575,10 +2830,10 @@ function AddSignerForm({
|
|
|
2575
2830
|
children: "Cancel"
|
|
2576
2831
|
}
|
|
2577
2832
|
) })
|
|
2578
|
-
] }) : signerType === "email" ? /* @__PURE__ */
|
|
2579
|
-
/* @__PURE__ */
|
|
2580
|
-
/* @__PURE__ */
|
|
2581
|
-
/* @__PURE__ */
|
|
2833
|
+
] }) : signerType === "email" ? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
2834
|
+
/* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
|
|
2835
|
+
/* @__PURE__ */ jsx21(Label, { htmlFor: "add-signer-email", className: classNames?.label, children: "Email" }),
|
|
2836
|
+
/* @__PURE__ */ jsx21(
|
|
2582
2837
|
Input,
|
|
2583
2838
|
{
|
|
2584
2839
|
id: "add-signer-email",
|
|
@@ -2593,8 +2848,8 @@ function AddSignerForm({
|
|
|
2593
2848
|
}
|
|
2594
2849
|
)
|
|
2595
2850
|
] }),
|
|
2596
|
-
asDialog && /* @__PURE__ */
|
|
2597
|
-
/* @__PURE__ */
|
|
2851
|
+
asDialog && /* @__PURE__ */ jsxs12(DialogFooter, { className: "gap-2 sm:gap-0", children: [
|
|
2852
|
+
/* @__PURE__ */ jsx21(
|
|
2598
2853
|
Button,
|
|
2599
2854
|
{
|
|
2600
2855
|
type: "button",
|
|
@@ -2605,10 +2860,10 @@ function AddSignerForm({
|
|
|
2605
2860
|
children: "Back"
|
|
2606
2861
|
}
|
|
2607
2862
|
),
|
|
2608
|
-
/* @__PURE__ */
|
|
2863
|
+
/* @__PURE__ */ jsx21(Button, { type: "submit", className: classNames?.submitButton, disabled: isSubmitting, children: isSubmitting ? "Adding..." : "Add signer" })
|
|
2609
2864
|
] }),
|
|
2610
|
-
!asDialog && /* @__PURE__ */
|
|
2611
|
-
/* @__PURE__ */
|
|
2865
|
+
!asDialog && /* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
|
|
2866
|
+
/* @__PURE__ */ jsx21(
|
|
2612
2867
|
Button,
|
|
2613
2868
|
{
|
|
2614
2869
|
type: "button",
|
|
@@ -2619,12 +2874,12 @@ function AddSignerForm({
|
|
|
2619
2874
|
children: "Back"
|
|
2620
2875
|
}
|
|
2621
2876
|
),
|
|
2622
|
-
/* @__PURE__ */
|
|
2877
|
+
/* @__PURE__ */ jsx21(Button, { type: "submit", className: classNames?.submitButton, disabled: isSubmitting, children: isSubmitting ? "Adding..." : "Add signer" })
|
|
2623
2878
|
] })
|
|
2624
|
-
] }) : signerType === "phone" ? /* @__PURE__ */
|
|
2625
|
-
/* @__PURE__ */
|
|
2626
|
-
/* @__PURE__ */
|
|
2627
|
-
/* @__PURE__ */
|
|
2879
|
+
] }) : signerType === "phone" ? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
2880
|
+
/* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
|
|
2881
|
+
/* @__PURE__ */ jsx21(Label, { htmlFor: "add-signer-phone", className: classNames?.label, children: "Phone number" }),
|
|
2882
|
+
/* @__PURE__ */ jsx21(
|
|
2628
2883
|
Input,
|
|
2629
2884
|
{
|
|
2630
2885
|
id: "add-signer-phone",
|
|
@@ -2639,8 +2894,8 @@ function AddSignerForm({
|
|
|
2639
2894
|
}
|
|
2640
2895
|
)
|
|
2641
2896
|
] }),
|
|
2642
|
-
asDialog && /* @__PURE__ */
|
|
2643
|
-
/* @__PURE__ */
|
|
2897
|
+
asDialog && /* @__PURE__ */ jsxs12(DialogFooter, { className: "gap-2 sm:gap-0", children: [
|
|
2898
|
+
/* @__PURE__ */ jsx21(
|
|
2644
2899
|
Button,
|
|
2645
2900
|
{
|
|
2646
2901
|
type: "button",
|
|
@@ -2651,10 +2906,10 @@ function AddSignerForm({
|
|
|
2651
2906
|
children: "Back"
|
|
2652
2907
|
}
|
|
2653
2908
|
),
|
|
2654
|
-
/* @__PURE__ */
|
|
2909
|
+
/* @__PURE__ */ jsx21(Button, { type: "submit", className: classNames?.submitButton, disabled: isSubmitting, children: isSubmitting ? "Adding..." : "Add signer" })
|
|
2655
2910
|
] }),
|
|
2656
|
-
!asDialog && /* @__PURE__ */
|
|
2657
|
-
/* @__PURE__ */
|
|
2911
|
+
!asDialog && /* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
|
|
2912
|
+
/* @__PURE__ */ jsx21(
|
|
2658
2913
|
Button,
|
|
2659
2914
|
{
|
|
2660
2915
|
type: "button",
|
|
@@ -2665,12 +2920,12 @@ function AddSignerForm({
|
|
|
2665
2920
|
children: "Back"
|
|
2666
2921
|
}
|
|
2667
2922
|
),
|
|
2668
|
-
/* @__PURE__ */
|
|
2923
|
+
/* @__PURE__ */ jsx21(Button, { type: "submit", className: classNames?.submitButton, disabled: isSubmitting, children: isSubmitting ? "Adding..." : "Add signer" })
|
|
2669
2924
|
] })
|
|
2670
|
-
] }) : signerType === "external" ? /* @__PURE__ */
|
|
2671
|
-
/* @__PURE__ */
|
|
2672
|
-
/* @__PURE__ */
|
|
2673
|
-
/* @__PURE__ */
|
|
2925
|
+
] }) : signerType === "external" ? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
2926
|
+
/* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
|
|
2927
|
+
/* @__PURE__ */ jsx21(Label, { htmlFor: "add-signer-address", className: classNames?.label, children: "Wallet address" }),
|
|
2928
|
+
/* @__PURE__ */ jsx21(
|
|
2674
2929
|
Input,
|
|
2675
2930
|
{
|
|
2676
2931
|
id: "add-signer-address",
|
|
@@ -2684,8 +2939,8 @@ function AddSignerForm({
|
|
|
2684
2939
|
}
|
|
2685
2940
|
)
|
|
2686
2941
|
] }),
|
|
2687
|
-
asDialog && /* @__PURE__ */
|
|
2688
|
-
/* @__PURE__ */
|
|
2942
|
+
asDialog && /* @__PURE__ */ jsxs12(DialogFooter, { className: "gap-2 sm:gap-0", children: [
|
|
2943
|
+
/* @__PURE__ */ jsx21(
|
|
2689
2944
|
Button,
|
|
2690
2945
|
{
|
|
2691
2946
|
type: "button",
|
|
@@ -2696,10 +2951,10 @@ function AddSignerForm({
|
|
|
2696
2951
|
children: "Back"
|
|
2697
2952
|
}
|
|
2698
2953
|
),
|
|
2699
|
-
/* @__PURE__ */
|
|
2954
|
+
/* @__PURE__ */ jsx21(Button, { type: "submit", className: classNames?.submitButton, disabled: isSubmitting, children: isSubmitting ? "Adding..." : "Add signer" })
|
|
2700
2955
|
] }),
|
|
2701
|
-
!asDialog && /* @__PURE__ */
|
|
2702
|
-
/* @__PURE__ */
|
|
2956
|
+
!asDialog && /* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
|
|
2957
|
+
/* @__PURE__ */ jsx21(
|
|
2703
2958
|
Button,
|
|
2704
2959
|
{
|
|
2705
2960
|
type: "button",
|
|
@@ -2710,44 +2965,45 @@ function AddSignerForm({
|
|
|
2710
2965
|
children: "Back"
|
|
2711
2966
|
}
|
|
2712
2967
|
),
|
|
2713
|
-
/* @__PURE__ */
|
|
2968
|
+
/* @__PURE__ */ jsx21(Button, { type: "submit", className: classNames?.submitButton, disabled: isSubmitting, children: isSubmitting ? "Adding..." : "Add signer" })
|
|
2714
2969
|
] })
|
|
2715
2970
|
] }) : null,
|
|
2716
|
-
error && /* @__PURE__ */
|
|
2971
|
+
error && /* @__PURE__ */ jsx21("div", { className: cn("text-sm text-destructive", classNames?.error), role: "alert", children: error })
|
|
2717
2972
|
] });
|
|
2718
2973
|
if (asDialog) {
|
|
2719
|
-
return /* @__PURE__ */
|
|
2720
|
-
/* @__PURE__ */
|
|
2721
|
-
/* @__PURE__ */
|
|
2722
|
-
/* @__PURE__ */
|
|
2974
|
+
return /* @__PURE__ */ jsx21(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs12(DialogContent, { className: cn(classNames?.dialog), children: [
|
|
2975
|
+
/* @__PURE__ */ jsxs12(DialogHeader, { children: [
|
|
2976
|
+
/* @__PURE__ */ jsx21(DialogTitle, { children: "Add signer" }),
|
|
2977
|
+
/* @__PURE__ */ jsx21(DialogDescription, { children: "Add a new signer to this wallet." })
|
|
2723
2978
|
] }),
|
|
2724
2979
|
formContent
|
|
2725
2980
|
] }) });
|
|
2726
2981
|
}
|
|
2727
|
-
return /* @__PURE__ */
|
|
2728
|
-
/* @__PURE__ */
|
|
2982
|
+
return /* @__PURE__ */ jsxs12("div", { className: cn(className, classNames?.root), "data-cilantro-add-signer-form": true, children: [
|
|
2983
|
+
/* @__PURE__ */ jsx21("h3", { className: "text-sm font-medium mb-2", children: "Add signer" }),
|
|
2729
2984
|
formContent
|
|
2730
2985
|
] });
|
|
2731
2986
|
}
|
|
2732
2987
|
|
|
2733
2988
|
// src/components/SignerList.tsx
|
|
2734
|
-
import { useState as
|
|
2735
|
-
import { Fragment as Fragment7, jsx as
|
|
2989
|
+
import { useState as useState13 } from "react";
|
|
2990
|
+
import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2736
2991
|
function SignerList({
|
|
2737
2992
|
walletId,
|
|
2738
2993
|
className,
|
|
2739
2994
|
classNames,
|
|
2740
2995
|
onSignerAdded,
|
|
2996
|
+
useSkeleton = true,
|
|
2741
2997
|
children
|
|
2742
2998
|
}) {
|
|
2743
2999
|
const { signers, isLoading, error, refresh } = useSigners({ walletId });
|
|
2744
|
-
const [addSignerOpen, setAddSignerOpen] =
|
|
3000
|
+
const [addSignerOpen, setAddSignerOpen] = useState13(false);
|
|
2745
3001
|
const handleAddSuccess = () => {
|
|
2746
3002
|
refresh();
|
|
2747
3003
|
onSignerAdded?.();
|
|
2748
3004
|
};
|
|
2749
3005
|
if (children) {
|
|
2750
|
-
return /* @__PURE__ */
|
|
3006
|
+
return /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
2751
3007
|
children({
|
|
2752
3008
|
signers,
|
|
2753
3009
|
isLoading,
|
|
@@ -2755,7 +3011,7 @@ function SignerList({
|
|
|
2755
3011
|
refresh,
|
|
2756
3012
|
openAddSigner: () => setAddSignerOpen(true)
|
|
2757
3013
|
}),
|
|
2758
|
-
/* @__PURE__ */
|
|
3014
|
+
/* @__PURE__ */ jsx22(
|
|
2759
3015
|
AddSignerForm,
|
|
2760
3016
|
{
|
|
2761
3017
|
walletId,
|
|
@@ -2768,31 +3024,46 @@ function SignerList({
|
|
|
2768
3024
|
] });
|
|
2769
3025
|
}
|
|
2770
3026
|
if (!walletId) {
|
|
2771
|
-
return /* @__PURE__ */
|
|
3027
|
+
return /* @__PURE__ */ jsx22("div", { className: cn(className, classNames?.root), "data-cilantro-signer-list": true, children: /* @__PURE__ */ jsx22("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "Select a wallet first." }) });
|
|
2772
3028
|
}
|
|
2773
|
-
return /* @__PURE__ */
|
|
2774
|
-
/* @__PURE__ */
|
|
2775
|
-
/* @__PURE__ */
|
|
2776
|
-
/* @__PURE__ */
|
|
3029
|
+
return /* @__PURE__ */ jsxs13("div", { className: cn(className, classNames?.root), "data-cilantro-signer-list": true, "aria-busy": isLoading, "aria-live": "polite", children: [
|
|
3030
|
+
/* @__PURE__ */ jsxs13("div", { className: cn("flex items-center justify-between gap-2 mb-2", classNames?.header), children: [
|
|
3031
|
+
/* @__PURE__ */ jsx22("span", { className: "text-sm font-medium", children: "Signers" }),
|
|
3032
|
+
/* @__PURE__ */ jsx22(
|
|
2777
3033
|
Button,
|
|
2778
3034
|
{
|
|
2779
3035
|
type: "button",
|
|
2780
|
-
size: "
|
|
3036
|
+
size: "touch",
|
|
2781
3037
|
variant: "outline",
|
|
2782
3038
|
className: classNames?.addButton,
|
|
2783
3039
|
onClick: () => setAddSignerOpen(true),
|
|
2784
3040
|
disabled: isLoading,
|
|
3041
|
+
"aria-label": "Add signer",
|
|
2785
3042
|
children: "Add signer"
|
|
2786
3043
|
}
|
|
2787
3044
|
)
|
|
2788
3045
|
] }),
|
|
2789
|
-
isLoading
|
|
3046
|
+
isLoading && useSkeleton ? /* @__PURE__ */ jsx22(
|
|
3047
|
+
"div",
|
|
3048
|
+
{
|
|
3049
|
+
className: cn("space-y-1", classNames?.loading),
|
|
3050
|
+
"aria-busy": "true",
|
|
3051
|
+
"aria-live": "polite",
|
|
3052
|
+
children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx22(
|
|
3053
|
+
Skeleton,
|
|
3054
|
+
{
|
|
3055
|
+
className: cn("h-5 w-full rounded-md", classNames?.skeleton)
|
|
3056
|
+
},
|
|
3057
|
+
i
|
|
3058
|
+
))
|
|
3059
|
+
}
|
|
3060
|
+
) : isLoading ? /* @__PURE__ */ jsx22("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "Loading signers..." }) : error ? /* @__PURE__ */ jsx22("p", { className: cn("text-sm text-destructive", classNames?.message), role: "alert", children: error }) : signers.length === 0 ? /* @__PURE__ */ jsx22("p", { className: cn("text-sm text-muted-foreground", classNames?.message), children: "No signers. Add one to get started." }) : /* @__PURE__ */ jsx22("ul", { className: cn("space-y-1", classNames?.list), role: "list", children: signers.map((signer) => /* @__PURE__ */ jsxs13("li", { className: cn("text-sm", classNames?.item), children: [
|
|
2790
3061
|
getSignerDisplayName(signer),
|
|
2791
3062
|
" (",
|
|
2792
3063
|
getSignerTypeLabel(signer.type || signer.signerType || ""),
|
|
2793
3064
|
")"
|
|
2794
3065
|
] }, signer.id)) }),
|
|
2795
|
-
/* @__PURE__ */
|
|
3066
|
+
/* @__PURE__ */ jsx22(
|
|
2796
3067
|
AddSignerForm,
|
|
2797
3068
|
{
|
|
2798
3069
|
walletId,
|
|
@@ -2804,6 +3075,74 @@ function SignerList({
|
|
|
2804
3075
|
)
|
|
2805
3076
|
] });
|
|
2806
3077
|
}
|
|
3078
|
+
|
|
3079
|
+
// src/ui/theme-provider.tsx
|
|
3080
|
+
import * as React9 from "react";
|
|
3081
|
+
import { Fragment as Fragment8, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3082
|
+
var DEFAULT_THEME_CSS = `
|
|
3083
|
+
:root,[data-theme="light"]{--background:0 0% 100%;--foreground:222.2 84% 4.9%;--primary:222.2 47.4% 11.2%;--primary-foreground:210 40% 98%;--muted:210 40% 96.1%;--muted-foreground:215.4 16.3% 46.9%;--border:214.3 31.8% 91.4%;--input:214.3 31.8% 91.4%;--ring:222.2 84% 4.9%;--destructive:0 84.2% 60.2%;--destructive-foreground:210 40% 98%;--accent:210 40% 96.1%;--accent-foreground:222.2 47.4% 11.2%;--popover:0 0% 100%;--popover-foreground:222.2 84% 4.9%;--card:0 0% 100%;--card-foreground:222.2 84% 4.9%}
|
|
3084
|
+
[data-theme="dark"]{--background:222.2 84% 4.9%;--foreground:210 40% 98%;--primary:210 40% 98%;--primary-foreground:222.2 47.4% 11.2%;--muted:217.2 32.6% 17.5%;--muted-foreground:215 20.2% 65.1%;--border:217.2 32.6% 17.5%;--input:217.2 32.6% 17.5%;--ring:212.7 26.8% 83.9%;--destructive:0 62.8% 30.6%;--destructive-foreground:210 40% 98%;--accent:217.2 32.6% 17.5%;--accent-foreground:210 40% 98%;--popover:222.2 84% 4.9%;--popover-foreground:210 40% 98%;--card:222.2 84% 4.9%;--card-foreground:210 40% 98%}
|
|
3085
|
+
`;
|
|
3086
|
+
function getSystemTheme() {
|
|
3087
|
+
if (typeof window === "undefined") return "dark";
|
|
3088
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
3089
|
+
}
|
|
3090
|
+
function ThemeProvider({
|
|
3091
|
+
theme = "system",
|
|
3092
|
+
defaultTheme = "dark",
|
|
3093
|
+
storageKey,
|
|
3094
|
+
className,
|
|
3095
|
+
children,
|
|
3096
|
+
injectStyles = true
|
|
3097
|
+
}) {
|
|
3098
|
+
const [resolved, setResolved] = React9.useState(() => {
|
|
3099
|
+
if (theme === "light") return "light";
|
|
3100
|
+
if (theme === "dark") return "dark";
|
|
3101
|
+
if (typeof window !== "undefined" && storageKey) {
|
|
3102
|
+
const stored = window.localStorage.getItem(storageKey);
|
|
3103
|
+
if (stored === "light" || stored === "dark") return stored;
|
|
3104
|
+
}
|
|
3105
|
+
return defaultTheme;
|
|
3106
|
+
});
|
|
3107
|
+
React9.useEffect(() => {
|
|
3108
|
+
if (theme === "light") {
|
|
3109
|
+
setResolved("light");
|
|
3110
|
+
return;
|
|
3111
|
+
}
|
|
3112
|
+
if (theme === "dark") {
|
|
3113
|
+
setResolved("dark");
|
|
3114
|
+
return;
|
|
3115
|
+
}
|
|
3116
|
+
const system = getSystemTheme();
|
|
3117
|
+
setResolved(system);
|
|
3118
|
+
const mql = window.matchMedia("(prefers-color-scheme: dark)");
|
|
3119
|
+
const listener = () => {
|
|
3120
|
+
const next = mql.matches ? "dark" : "light";
|
|
3121
|
+
setResolved(next);
|
|
3122
|
+
if (storageKey) window.localStorage.setItem(storageKey, next);
|
|
3123
|
+
};
|
|
3124
|
+
mql.addEventListener("change", listener);
|
|
3125
|
+
return () => mql.removeEventListener("change", listener);
|
|
3126
|
+
}, [theme, storageKey]);
|
|
3127
|
+
return /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
3128
|
+
injectStyles && /* @__PURE__ */ jsx23(
|
|
3129
|
+
"style",
|
|
3130
|
+
{
|
|
3131
|
+
dangerouslySetInnerHTML: { __html: DEFAULT_THEME_CSS },
|
|
3132
|
+
"data-cilantro-theme-styles": true
|
|
3133
|
+
}
|
|
3134
|
+
),
|
|
3135
|
+
/* @__PURE__ */ jsx23(
|
|
3136
|
+
"div",
|
|
3137
|
+
{
|
|
3138
|
+
className: cn(className),
|
|
3139
|
+
"data-theme": resolved,
|
|
3140
|
+
"data-cilantro-theme-provider": true,
|
|
3141
|
+
children
|
|
3142
|
+
}
|
|
3143
|
+
)
|
|
3144
|
+
] });
|
|
3145
|
+
}
|
|
2807
3146
|
export {
|
|
2808
3147
|
AddSignerForm,
|
|
2809
3148
|
AuthForm,
|
|
@@ -2817,6 +3156,8 @@ export {
|
|
|
2817
3156
|
SIGNER_TYPES,
|
|
2818
3157
|
SignerList,
|
|
2819
3158
|
SignerSelector,
|
|
3159
|
+
Skeleton,
|
|
3160
|
+
ThemeProvider,
|
|
2820
3161
|
TransactionSigningForm,
|
|
2821
3162
|
WalletProvider,
|
|
2822
3163
|
WalletSelector,
|
|
@@ -2827,11 +3168,17 @@ export {
|
|
|
2827
3168
|
signAndSendTransactionWithSigner,
|
|
2828
3169
|
signMessageWithSigner,
|
|
2829
3170
|
signTransactionWithSigner,
|
|
3171
|
+
useCanSign,
|
|
2830
3172
|
useCilantroAuth,
|
|
3173
|
+
useDelegatedKeys,
|
|
2831
3174
|
useMessageSigning,
|
|
3175
|
+
useSelectedWallet,
|
|
2832
3176
|
useSignerSelection,
|
|
2833
3177
|
useSigners,
|
|
3178
|
+
useSignersForSelectedWallet,
|
|
3179
|
+
useSignersRaw,
|
|
2834
3180
|
useTransactionSigning,
|
|
3181
|
+
useWalletAddress,
|
|
2835
3182
|
useWallets
|
|
2836
3183
|
};
|
|
2837
3184
|
//# sourceMappingURL=index.mjs.map
|