shogun-button-react 1.9.2 → 1.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ShogunButton.js +276 -238
- package/dist/connector.js +6 -3
- package/dist/index.js +9 -6
- package/dist/types/connector-options.js +2 -1
- package/package.json +1 -2
|
@@ -1,6 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ShogunButton = exports.useShogun = void 0;
|
|
37
|
+
exports.ShogunButtonProvider = ShogunButtonProvider;
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const rxjs_1 = require("rxjs");
|
|
40
|
+
require("../styles/index.css");
|
|
4
41
|
// Default context
|
|
5
42
|
const defaultShogunContext = {
|
|
6
43
|
sdk: null,
|
|
@@ -12,26 +49,27 @@ const defaultShogunContext = {
|
|
|
12
49
|
login: async () => ({}),
|
|
13
50
|
signUp: async () => ({}),
|
|
14
51
|
logout: () => { },
|
|
15
|
-
observe: () => new Observable(),
|
|
52
|
+
observe: () => new rxjs_1.Observable(),
|
|
16
53
|
hasPlugin: () => false,
|
|
17
54
|
getPlugin: () => undefined,
|
|
18
55
|
exportGunPair: async () => "",
|
|
19
56
|
importGunPair: async () => false,
|
|
20
57
|
};
|
|
21
58
|
// Create context using React's createContext directly
|
|
22
|
-
const ShogunContext = createContext(defaultShogunContext);
|
|
59
|
+
const ShogunContext = (0, react_1.createContext)(defaultShogunContext);
|
|
23
60
|
// Custom hook to access the context
|
|
24
|
-
|
|
61
|
+
const useShogun = () => (0, react_1.useContext)(ShogunContext);
|
|
62
|
+
exports.useShogun = useShogun;
|
|
25
63
|
// Provider component
|
|
26
|
-
|
|
64
|
+
function ShogunButtonProvider({ children, sdk, options, onLoginSuccess, onSignupSuccess, onError, onLogout, // AGGIUNTA
|
|
27
65
|
}) {
|
|
28
66
|
var _a, _b;
|
|
29
67
|
// Use React's useState directly
|
|
30
|
-
const [isLoggedIn, setIsLoggedIn] = useState(false);
|
|
31
|
-
const [userPub, setUserPub] = useState(null);
|
|
32
|
-
const [username, setUsername] = useState(null);
|
|
68
|
+
const [isLoggedIn, setIsLoggedIn] = (0, react_1.useState)(false);
|
|
69
|
+
const [userPub, setUserPub] = (0, react_1.useState)(null);
|
|
70
|
+
const [username, setUsername] = (0, react_1.useState)(null);
|
|
33
71
|
// Effetto per gestire l'inizializzazione e pulizia
|
|
34
|
-
useEffect(() => {
|
|
72
|
+
(0, react_1.useEffect)(() => {
|
|
35
73
|
var _a, _b;
|
|
36
74
|
console.log(`🔧 ShogunButtonProvider useEffect - SDK available:`, !!sdk);
|
|
37
75
|
if (!sdk)
|
|
@@ -85,7 +123,7 @@ export function ShogunButtonProvider({ children, sdk, options, onLoginSuccess, o
|
|
|
85
123
|
// RxJS observe method
|
|
86
124
|
const observe = (path) => {
|
|
87
125
|
if (!sdk) {
|
|
88
|
-
return new Observable();
|
|
126
|
+
return new rxjs_1.Observable();
|
|
89
127
|
}
|
|
90
128
|
return sdk.rx.observe(path);
|
|
91
129
|
};
|
|
@@ -453,7 +491,7 @@ export function ShogunButtonProvider({ children, sdk, options, onLoginSuccess, o
|
|
|
453
491
|
}
|
|
454
492
|
};
|
|
455
493
|
// Provide the context value to children
|
|
456
|
-
return (
|
|
494
|
+
return (react_1.default.createElement(ShogunContext.Provider, { value: {
|
|
457
495
|
sdk,
|
|
458
496
|
options,
|
|
459
497
|
isLoggedIn,
|
|
@@ -471,76 +509,76 @@ export function ShogunButtonProvider({ children, sdk, options, onLoginSuccess, o
|
|
|
471
509
|
} }, children));
|
|
472
510
|
}
|
|
473
511
|
// SVG Icons Components
|
|
474
|
-
const WalletIcon = () => (
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
const KeyIcon = () => (
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
const GoogleIcon = () => (
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
const NostrIcon = () => (
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
const WebAuthnIcon = () => (
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
const LogoutIcon = () => (
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
const UserIcon = () => (
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
const LockIcon = () => (
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
const CloseIcon = () => (
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
const ImportIcon = () => (
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
const ExportIcon = () => (
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
512
|
+
const WalletIcon = () => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
513
|
+
react_1.default.createElement("path", { d: "M21 12V7H5a2 2 0 0 1 0-4h14v4" }),
|
|
514
|
+
react_1.default.createElement("path", { d: "M3 5v14a2 2 0 0 0 2 2h16v-5" }),
|
|
515
|
+
react_1.default.createElement("path", { d: "M18 12a2 2 0 0 0 0 4h4v-4Z" })));
|
|
516
|
+
const KeyIcon = () => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
517
|
+
react_1.default.createElement("circle", { cx: "7.5", cy: "15.5", r: "5.5" }),
|
|
518
|
+
react_1.default.createElement("path", { d: "m21 2-9.6 9.6" }),
|
|
519
|
+
react_1.default.createElement("path", { d: "m15.5 7.5 3 3L22 7l-3-3" })));
|
|
520
|
+
const GoogleIcon = () => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor" },
|
|
521
|
+
react_1.default.createElement("path", { d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z", fill: "#4285F4" }),
|
|
522
|
+
react_1.default.createElement("path", { d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z", fill: "#34A853" }),
|
|
523
|
+
react_1.default.createElement("path", { d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z", fill: "#FBBC05" }),
|
|
524
|
+
react_1.default.createElement("path", { d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z", fill: "#EA4335" })));
|
|
525
|
+
const NostrIcon = () => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
526
|
+
react_1.default.createElement("path", { d: "M19.5 4.5 15 9l-3-3-4.5 4.5L9 12l-1.5 1.5L12 18l4.5-4.5L15 12l1.5-1.5L21 6l-1.5-1.5Z" }),
|
|
527
|
+
react_1.default.createElement("path", { d: "M12 12 6 6l-1.5 1.5L9 12l-4.5 4.5L6 18l6-6Z" })));
|
|
528
|
+
const WebAuthnIcon = () => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
529
|
+
react_1.default.createElement("path", { d: "M7 11v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1h-4" }),
|
|
530
|
+
react_1.default.createElement("path", { d: "M14 4V2a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h2" })));
|
|
531
|
+
const LogoutIcon = () => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
532
|
+
react_1.default.createElement("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
|
|
533
|
+
react_1.default.createElement("polyline", { points: "16 17 21 12 16 7" }),
|
|
534
|
+
react_1.default.createElement("line", { x1: "21", y1: "12", x2: "9", y2: "12" })));
|
|
535
|
+
const UserIcon = () => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
536
|
+
react_1.default.createElement("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
537
|
+
react_1.default.createElement("circle", { cx: "12", cy: "7", r: "4" })));
|
|
538
|
+
const LockIcon = () => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
539
|
+
react_1.default.createElement("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }),
|
|
540
|
+
react_1.default.createElement("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })));
|
|
541
|
+
const CloseIcon = () => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
542
|
+
react_1.default.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
543
|
+
react_1.default.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })));
|
|
544
|
+
const ImportIcon = () => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
545
|
+
react_1.default.createElement("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
546
|
+
react_1.default.createElement("polyline", { points: "14,2 14,8 20,8" }),
|
|
547
|
+
react_1.default.createElement("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
|
|
548
|
+
react_1.default.createElement("line", { x1: "12", y1: "17", x2: "12", y2: "9" })));
|
|
549
|
+
const ExportIcon = () => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
550
|
+
react_1.default.createElement("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
551
|
+
react_1.default.createElement("polyline", { points: "14,2 14,8 20,8" }),
|
|
552
|
+
react_1.default.createElement("line", { x1: "12", y1: "11", x2: "12", y2: "21" }),
|
|
553
|
+
react_1.default.createElement("polyline", { points: "16,15 12,11 8,15" })));
|
|
516
554
|
// Component for Shogun login button
|
|
517
|
-
|
|
555
|
+
exports.ShogunButton = (() => {
|
|
518
556
|
const Button = () => {
|
|
519
|
-
const { isLoggedIn, username, logout, login, signUp, sdk, options, exportGunPair, importGunPair, } = useShogun();
|
|
557
|
+
const { isLoggedIn, username, logout, login, signUp, sdk, options, exportGunPair, importGunPair, } = (0, exports.useShogun)();
|
|
520
558
|
// Form states
|
|
521
|
-
const [modalIsOpen, setModalIsOpen] = useState(false);
|
|
522
|
-
const [formUsername, setFormUsername] = useState("");
|
|
523
|
-
const [formPassword, setFormPassword] = useState("");
|
|
524
|
-
const [formPasswordConfirm, setFormPasswordConfirm] = useState("");
|
|
525
|
-
const [formHint, setFormHint] = useState("");
|
|
526
|
-
const [formSecurityQuestion] = useState("What is your favorite color?"); // Hardcoded for now
|
|
527
|
-
const [formSecurityAnswer, setFormSecurityAnswer] = useState("");
|
|
528
|
-
const [formMode, setFormMode] = useState("login");
|
|
529
|
-
const [authView, setAuthView] = useState("options");
|
|
530
|
-
const [error, setError] = useState("");
|
|
531
|
-
const [loading, setLoading] = useState(false);
|
|
532
|
-
const [dropdownOpen, setDropdownOpen] = useState(false);
|
|
533
|
-
const [recoveredHint, setRecoveredHint] = useState("");
|
|
534
|
-
const [exportPassword, setExportPassword] = useState("");
|
|
535
|
-
const [importPassword, setImportPassword] = useState("");
|
|
536
|
-
const [importPairData, setImportPairData] = useState("");
|
|
537
|
-
const [exportedPair, setExportedPair] = useState("");
|
|
538
|
-
const [showCopySuccess, setShowCopySuccess] = useState(false);
|
|
539
|
-
const [showImportSuccess, setShowImportSuccess] = useState(false);
|
|
540
|
-
const dropdownRef = useRef(null);
|
|
559
|
+
const [modalIsOpen, setModalIsOpen] = (0, react_1.useState)(false);
|
|
560
|
+
const [formUsername, setFormUsername] = (0, react_1.useState)("");
|
|
561
|
+
const [formPassword, setFormPassword] = (0, react_1.useState)("");
|
|
562
|
+
const [formPasswordConfirm, setFormPasswordConfirm] = (0, react_1.useState)("");
|
|
563
|
+
const [formHint, setFormHint] = (0, react_1.useState)("");
|
|
564
|
+
const [formSecurityQuestion] = (0, react_1.useState)("What is your favorite color?"); // Hardcoded for now
|
|
565
|
+
const [formSecurityAnswer, setFormSecurityAnswer] = (0, react_1.useState)("");
|
|
566
|
+
const [formMode, setFormMode] = (0, react_1.useState)("login");
|
|
567
|
+
const [authView, setAuthView] = (0, react_1.useState)("options");
|
|
568
|
+
const [error, setError] = (0, react_1.useState)("");
|
|
569
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
570
|
+
const [dropdownOpen, setDropdownOpen] = (0, react_1.useState)(false);
|
|
571
|
+
const [recoveredHint, setRecoveredHint] = (0, react_1.useState)("");
|
|
572
|
+
const [exportPassword, setExportPassword] = (0, react_1.useState)("");
|
|
573
|
+
const [importPassword, setImportPassword] = (0, react_1.useState)("");
|
|
574
|
+
const [importPairData, setImportPairData] = (0, react_1.useState)("");
|
|
575
|
+
const [exportedPair, setExportedPair] = (0, react_1.useState)("");
|
|
576
|
+
const [showCopySuccess, setShowCopySuccess] = (0, react_1.useState)(false);
|
|
577
|
+
const [showImportSuccess, setShowImportSuccess] = (0, react_1.useState)(false);
|
|
578
|
+
const dropdownRef = (0, react_1.useRef)(null);
|
|
541
579
|
// Rimuovi tutto ciò che riguarda oauthPin
|
|
542
580
|
// Handle click outside to close dropdown
|
|
543
|
-
useEffect(() => {
|
|
581
|
+
(0, react_1.useEffect)(() => {
|
|
544
582
|
const handleClickOutside = (event) => {
|
|
545
583
|
if (dropdownRef.current &&
|
|
546
584
|
!dropdownRef.current.contains(event.target)) {
|
|
@@ -556,30 +594,30 @@ export const ShogunButton = (() => {
|
|
|
556
594
|
}, [dropdownOpen]);
|
|
557
595
|
// If already logged in, show only logout button
|
|
558
596
|
if (isLoggedIn && username && !modalIsOpen) {
|
|
559
|
-
return (
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
597
|
+
return (react_1.default.createElement("div", { className: "shogun-logged-in-container" },
|
|
598
|
+
react_1.default.createElement("div", { className: "shogun-dropdown", ref: dropdownRef },
|
|
599
|
+
react_1.default.createElement("button", { className: "shogun-button shogun-logged-in", onClick: () => setDropdownOpen(!dropdownOpen) },
|
|
600
|
+
react_1.default.createElement("div", { className: "shogun-avatar" }, username.substring(0, 2).toUpperCase()),
|
|
601
|
+
react_1.default.createElement("span", { className: "shogun-username" }, username.length > 12
|
|
564
602
|
? `${username.substring(0, 6)}...${username.substring(username.length - 4)}`
|
|
565
603
|
: username)),
|
|
566
|
-
dropdownOpen && (
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
604
|
+
dropdownOpen && (react_1.default.createElement("div", { className: "shogun-dropdown-menu" },
|
|
605
|
+
react_1.default.createElement("div", { className: "shogun-dropdown-header" },
|
|
606
|
+
react_1.default.createElement("div", { className: "shogun-avatar-large" }, username.substring(0, 2).toUpperCase()),
|
|
607
|
+
react_1.default.createElement("div", { className: "shogun-user-info" },
|
|
608
|
+
react_1.default.createElement("span", { className: "shogun-username-full" }, username.length > 20
|
|
571
609
|
? `${username.substring(0, 10)}...${username.substring(username.length - 6)}`
|
|
572
610
|
: username))),
|
|
573
|
-
|
|
611
|
+
react_1.default.createElement("div", { className: "shogun-dropdown-item", onClick: () => {
|
|
574
612
|
setDropdownOpen(false);
|
|
575
613
|
setAuthView("export");
|
|
576
614
|
setModalIsOpen(true);
|
|
577
615
|
} },
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
616
|
+
react_1.default.createElement(ExportIcon, null),
|
|
617
|
+
react_1.default.createElement("span", null, "Export Pair")),
|
|
618
|
+
react_1.default.createElement("div", { className: "shogun-dropdown-item", onClick: logout },
|
|
619
|
+
react_1.default.createElement(LogoutIcon, null),
|
|
620
|
+
react_1.default.createElement("span", null, "Disconnect")))))));
|
|
583
621
|
}
|
|
584
622
|
// Event handlers
|
|
585
623
|
const handleAuth = async (method, ...args) => {
|
|
@@ -764,78 +802,78 @@ export const ShogunButton = (() => {
|
|
|
764
802
|
});
|
|
765
803
|
};
|
|
766
804
|
// Add buttons for both login and signup for alternative auth methods
|
|
767
|
-
const renderAuthOptions = () => (
|
|
768
|
-
options.showMetamask !== false && (sdk === null || sdk === void 0 ? void 0 : sdk.hasPlugin("web3")) && (
|
|
769
|
-
|
|
770
|
-
|
|
805
|
+
const renderAuthOptions = () => (react_1.default.createElement("div", { className: "shogun-auth-options" },
|
|
806
|
+
options.showMetamask !== false && (sdk === null || sdk === void 0 ? void 0 : sdk.hasPlugin("web3")) && (react_1.default.createElement("div", { className: "shogun-auth-option-group" },
|
|
807
|
+
react_1.default.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: () => handleAuth("web3"), disabled: loading },
|
|
808
|
+
react_1.default.createElement(WalletIcon, null),
|
|
771
809
|
formMode === "login"
|
|
772
810
|
? "Login with MetaMask"
|
|
773
811
|
: "Signup with MetaMask"))),
|
|
774
|
-
options.showWebauthn !== false && (sdk === null || sdk === void 0 ? void 0 : sdk.hasPlugin("webauthn")) && (
|
|
775
|
-
|
|
776
|
-
|
|
812
|
+
options.showWebauthn !== false && (sdk === null || sdk === void 0 ? void 0 : sdk.hasPlugin("webauthn")) && (react_1.default.createElement("div", { className: "shogun-auth-option-group" },
|
|
813
|
+
react_1.default.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: handleWebAuthnAuth, disabled: loading },
|
|
814
|
+
react_1.default.createElement(WebAuthnIcon, null),
|
|
777
815
|
formMode === "login"
|
|
778
816
|
? "Login with WebAuthn"
|
|
779
817
|
: "Signup with WebAuthn"))),
|
|
780
|
-
options.showNostr !== false && (sdk === null || sdk === void 0 ? void 0 : sdk.hasPlugin("nostr")) && (
|
|
781
|
-
|
|
782
|
-
|
|
818
|
+
options.showNostr !== false && (sdk === null || sdk === void 0 ? void 0 : sdk.hasPlugin("nostr")) && (react_1.default.createElement("div", { className: "shogun-auth-option-group" },
|
|
819
|
+
react_1.default.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: () => handleAuth("nostr"), disabled: loading },
|
|
820
|
+
react_1.default.createElement(NostrIcon, null),
|
|
783
821
|
formMode === "login" ? "Login with Nostr" : "Signup with Nostr"))),
|
|
784
|
-
options.showOauth !== false && (sdk === null || sdk === void 0 ? void 0 : sdk.hasPlugin("oauth")) && (
|
|
785
|
-
|
|
786
|
-
|
|
822
|
+
options.showOauth !== false && (sdk === null || sdk === void 0 ? void 0 : sdk.hasPlugin("oauth")) && (react_1.default.createElement("div", { className: "shogun-auth-option-group" },
|
|
823
|
+
react_1.default.createElement("button", { type: "button", className: "shogun-auth-option-button shogun-google-button", onClick: () => handleAuth("oauth", "google"), disabled: loading },
|
|
824
|
+
react_1.default.createElement(GoogleIcon, null),
|
|
787
825
|
formMode === "login"
|
|
788
826
|
? "Login with Google"
|
|
789
827
|
: "Signup with Google"))),
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
828
|
+
react_1.default.createElement("div", { className: "shogun-divider" },
|
|
829
|
+
react_1.default.createElement("span", null, "or")),
|
|
830
|
+
react_1.default.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: () => setAuthView("password"), disabled: loading },
|
|
831
|
+
react_1.default.createElement(LockIcon, null),
|
|
794
832
|
formMode === "login"
|
|
795
833
|
? "Login with Password"
|
|
796
834
|
: "Signup with Password"),
|
|
797
|
-
formMode === "login" && (
|
|
798
|
-
|
|
835
|
+
formMode === "login" && (react_1.default.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: () => setAuthView("import"), disabled: loading },
|
|
836
|
+
react_1.default.createElement(ImportIcon, null),
|
|
799
837
|
"Import Gun Pair"))));
|
|
800
|
-
const renderPasswordForm = () => (
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
formMode === "signup" && (
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
838
|
+
const renderPasswordForm = () => (react_1.default.createElement("form", { onSubmit: handleSubmit, className: "shogun-auth-form" },
|
|
839
|
+
react_1.default.createElement("div", { className: "shogun-form-group" },
|
|
840
|
+
react_1.default.createElement("label", { htmlFor: "username" },
|
|
841
|
+
react_1.default.createElement(UserIcon, null),
|
|
842
|
+
react_1.default.createElement("span", null, "Username")),
|
|
843
|
+
react_1.default.createElement("input", { type: "text", id: "username", value: formUsername, onChange: (e) => setFormUsername(e.target.value), disabled: loading, required: true, placeholder: "Enter your username" })),
|
|
844
|
+
react_1.default.createElement("div", { className: "shogun-form-group" },
|
|
845
|
+
react_1.default.createElement("label", { htmlFor: "password" },
|
|
846
|
+
react_1.default.createElement(LockIcon, null),
|
|
847
|
+
react_1.default.createElement("span", null, "Password")),
|
|
848
|
+
react_1.default.createElement("input", { type: "password", id: "password", value: formPassword, onChange: (e) => setFormPassword(e.target.value), disabled: loading, required: true, placeholder: "Enter your password" })),
|
|
849
|
+
formMode === "signup" && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
850
|
+
react_1.default.createElement("div", { className: "shogun-form-group" },
|
|
851
|
+
react_1.default.createElement("label", { htmlFor: "passwordConfirm" },
|
|
852
|
+
react_1.default.createElement(KeyIcon, null),
|
|
853
|
+
react_1.default.createElement("span", null, "Confirm Password")),
|
|
854
|
+
react_1.default.createElement("input", { type: "password", id: "passwordConfirm", value: formPasswordConfirm, onChange: (e) => setFormPasswordConfirm(e.target.value), disabled: loading, required: true, placeholder: "Confirm your password" })),
|
|
855
|
+
react_1.default.createElement("div", { className: "shogun-form-group" },
|
|
856
|
+
react_1.default.createElement("label", { htmlFor: "hint" },
|
|
857
|
+
react_1.default.createElement(UserIcon, null),
|
|
858
|
+
react_1.default.createElement("span", null, "Password Hint")),
|
|
859
|
+
react_1.default.createElement("input", { type: "text", id: "hint", value: formHint, onChange: (e) => setFormHint(e.target.value), disabled: loading, required: true, placeholder: "Enter your password hint" })),
|
|
860
|
+
react_1.default.createElement("div", { className: "shogun-form-group" },
|
|
861
|
+
react_1.default.createElement("label", { htmlFor: "securityQuestion" },
|
|
862
|
+
react_1.default.createElement(UserIcon, null),
|
|
863
|
+
react_1.default.createElement("span", null, "Security Question")),
|
|
864
|
+
react_1.default.createElement("input", { type: "text", id: "securityQuestion", value: formSecurityQuestion, disabled: true })),
|
|
865
|
+
react_1.default.createElement("div", { className: "shogun-form-group" },
|
|
866
|
+
react_1.default.createElement("label", { htmlFor: "securityAnswer" },
|
|
867
|
+
react_1.default.createElement(UserIcon, null),
|
|
868
|
+
react_1.default.createElement("span", null, "Security Answer")),
|
|
869
|
+
react_1.default.createElement("input", { type: "text", id: "securityAnswer", value: formSecurityAnswer, onChange: (e) => setFormSecurityAnswer(e.target.value), disabled: loading, required: true, placeholder: "Enter your security answer" })))),
|
|
870
|
+
react_1.default.createElement("button", { type: "submit", className: "shogun-submit-button", disabled: loading }, loading
|
|
833
871
|
? "Processing..."
|
|
834
872
|
: formMode === "login"
|
|
835
873
|
? "Sign In"
|
|
836
874
|
: "Create Account"),
|
|
837
|
-
|
|
838
|
-
|
|
875
|
+
react_1.default.createElement("div", { className: "shogun-form-footer" },
|
|
876
|
+
react_1.default.createElement("button", { type: "button", className: "shogun-toggle-mode shogun-prominent-toggle", onClick: () => {
|
|
839
877
|
console.log("🔧 Signup button clicked!");
|
|
840
878
|
console.log("🔧 Current formMode:", formMode);
|
|
841
879
|
console.log("🔧 Current loading:", loading);
|
|
@@ -844,86 +882,86 @@ export const ShogunButton = (() => {
|
|
|
844
882
|
}, disabled: loading }, formMode === "login"
|
|
845
883
|
? "Don't have an account? Sign up"
|
|
846
884
|
: "Already have an account? Log in"),
|
|
847
|
-
formMode === "login" && (
|
|
848
|
-
const renderWebAuthnUsernameForm = () => (
|
|
849
|
-
|
|
885
|
+
formMode === "login" && (react_1.default.createElement("button", { type: "button", className: "shogun-toggle-mode", onClick: () => setAuthView("recover"), disabled: loading }, "Forgot password?")))));
|
|
886
|
+
const renderWebAuthnUsernameForm = () => (react_1.default.createElement("div", { className: "shogun-auth-form" },
|
|
887
|
+
react_1.default.createElement("h3", null, formMode === "login"
|
|
850
888
|
? "Login with WebAuthn"
|
|
851
889
|
: "Sign Up with WebAuthn"),
|
|
852
|
-
|
|
890
|
+
react_1.default.createElement("div", { style: {
|
|
853
891
|
backgroundColor: "#f0f9ff",
|
|
854
892
|
padding: "12px",
|
|
855
893
|
borderRadius: "8px",
|
|
856
894
|
marginBottom: "16px",
|
|
857
895
|
border: "1px solid #0ea5e9",
|
|
858
896
|
} },
|
|
859
|
-
|
|
897
|
+
react_1.default.createElement("p", { style: {
|
|
860
898
|
fontSize: "14px",
|
|
861
899
|
color: "#0c4a6e",
|
|
862
900
|
margin: "0",
|
|
863
901
|
fontWeight: "500",
|
|
864
902
|
} }, "\uD83D\uDD11 WebAuthn Authentication"),
|
|
865
|
-
|
|
903
|
+
react_1.default.createElement("p", { style: { fontSize: "13px", color: "#075985", margin: "4px 0 0 0" } },
|
|
866
904
|
"Please enter your username to continue with WebAuthn",
|
|
867
905
|
" ",
|
|
868
906
|
formMode === "login" ? "login" : "registration",
|
|
869
907
|
".")),
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
const renderRecoveryForm = () => (
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
const renderHint = () => (
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
908
|
+
react_1.default.createElement("div", { className: "shogun-form-group" },
|
|
909
|
+
react_1.default.createElement("label", { htmlFor: "username" },
|
|
910
|
+
react_1.default.createElement(UserIcon, null),
|
|
911
|
+
react_1.default.createElement("span", null, "Username")),
|
|
912
|
+
react_1.default.createElement("input", { type: "text", id: "username", value: formUsername, onChange: (e) => setFormUsername(e.target.value), disabled: loading, required: true, placeholder: "Enter your username", autoFocus: true })),
|
|
913
|
+
react_1.default.createElement("button", { type: "button", className: "shogun-submit-button", onClick: () => handleAuth("webauthn", formUsername), disabled: loading || !formUsername.trim() }, loading ? "Processing..." : `Continue with WebAuthn`),
|
|
914
|
+
react_1.default.createElement("div", { className: "shogun-form-footer" },
|
|
915
|
+
react_1.default.createElement("button", { type: "button", className: "shogun-back-button", onClick: () => setAuthView("options"), disabled: loading }, "\u2190 Back to Options"))));
|
|
916
|
+
const renderRecoveryForm = () => (react_1.default.createElement("div", { className: "shogun-auth-form" },
|
|
917
|
+
react_1.default.createElement("div", { className: "shogun-form-group" },
|
|
918
|
+
react_1.default.createElement("label", { htmlFor: "username" },
|
|
919
|
+
react_1.default.createElement(UserIcon, null),
|
|
920
|
+
react_1.default.createElement("span", null, "Username")),
|
|
921
|
+
react_1.default.createElement("input", { type: "text", id: "username", value: formUsername, onChange: (e) => setFormUsername(e.target.value), disabled: loading, required: true, placeholder: "Enter your username" })),
|
|
922
|
+
react_1.default.createElement("div", { className: "shogun-form-group" },
|
|
923
|
+
react_1.default.createElement("label", null, "Security Question"),
|
|
924
|
+
react_1.default.createElement("p", null, formSecurityQuestion)),
|
|
925
|
+
react_1.default.createElement("div", { className: "shogun-form-group" },
|
|
926
|
+
react_1.default.createElement("label", { htmlFor: "securityAnswer" },
|
|
927
|
+
react_1.default.createElement(KeyIcon, null),
|
|
928
|
+
react_1.default.createElement("span", null, "Answer")),
|
|
929
|
+
react_1.default.createElement("input", { type: "text", id: "securityAnswer", value: formSecurityAnswer, onChange: (e) => setFormSecurityAnswer(e.target.value), disabled: loading, required: true, placeholder: "Enter your answer" })),
|
|
930
|
+
react_1.default.createElement("button", { type: "button", className: "shogun-submit-button", onClick: handleRecover, disabled: loading }, loading ? "Recovering..." : "Get Hint"),
|
|
931
|
+
react_1.default.createElement("div", { className: "shogun-form-footer" },
|
|
932
|
+
react_1.default.createElement("button", { className: "shogun-toggle-mode", onClick: () => setAuthView("password"), disabled: loading }, "Back to Login"))));
|
|
933
|
+
const renderHint = () => (react_1.default.createElement("div", { className: "shogun-auth-form" },
|
|
934
|
+
react_1.default.createElement("h3", null, "Your Password Hint"),
|
|
935
|
+
react_1.default.createElement("p", { className: "shogun-hint" }, recoveredHint),
|
|
936
|
+
react_1.default.createElement("button", { className: "shogun-submit-button", onClick: () => {
|
|
899
937
|
setAuthView("password");
|
|
900
938
|
resetForm();
|
|
901
939
|
setFormMode("login");
|
|
902
940
|
} }, "Back to Login")));
|
|
903
|
-
const renderExportForm = () => (
|
|
904
|
-
|
|
905
|
-
|
|
941
|
+
const renderExportForm = () => (react_1.default.createElement("div", { className: "shogun-auth-form" },
|
|
942
|
+
react_1.default.createElement("h3", null, "Export Gun Pair"),
|
|
943
|
+
react_1.default.createElement("div", { style: {
|
|
906
944
|
backgroundColor: "#f0f9ff",
|
|
907
945
|
padding: "12px",
|
|
908
946
|
borderRadius: "8px",
|
|
909
947
|
marginBottom: "16px",
|
|
910
948
|
border: "1px solid #0ea5e9",
|
|
911
949
|
} },
|
|
912
|
-
|
|
950
|
+
react_1.default.createElement("p", { style: {
|
|
913
951
|
fontSize: "14px",
|
|
914
952
|
color: "#0c4a6e",
|
|
915
953
|
margin: "0",
|
|
916
954
|
fontWeight: "500",
|
|
917
955
|
} }, "\uD83D\uDD12 Backup Your Account"),
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
exportedPair && (
|
|
925
|
-
|
|
926
|
-
showCopySuccess && (
|
|
956
|
+
react_1.default.createElement("p", { style: { fontSize: "13px", color: "#075985", margin: "4px 0 0 0" } }, "Export your Gun pair to backup your account. You can use this to login from another device or restore access if needed.")),
|
|
957
|
+
react_1.default.createElement("div", { className: "shogun-form-group" },
|
|
958
|
+
react_1.default.createElement("label", { htmlFor: "exportPassword" },
|
|
959
|
+
react_1.default.createElement(LockIcon, null),
|
|
960
|
+
react_1.default.createElement("span", null, "Encryption Password (optional but recommended)")),
|
|
961
|
+
react_1.default.createElement("input", { type: "password", id: "exportPassword", value: exportPassword, onChange: (e) => setExportPassword(e.target.value), disabled: loading, placeholder: "Leave empty to export unencrypted" })),
|
|
962
|
+
exportedPair && (react_1.default.createElement("div", { className: "shogun-form-group" },
|
|
963
|
+
react_1.default.createElement("label", null, "Your Gun Pair (copy this safely):"),
|
|
964
|
+
showCopySuccess && (react_1.default.createElement("div", { style: {
|
|
927
965
|
backgroundColor: "#dcfce7",
|
|
928
966
|
color: "#166534",
|
|
929
967
|
padding: "8px 12px",
|
|
@@ -932,7 +970,7 @@ export const ShogunButton = (() => {
|
|
|
932
970
|
fontSize: "14px",
|
|
933
971
|
border: "1px solid #22c55e",
|
|
934
972
|
} }, "\u2705 Copied to clipboard successfully!")),
|
|
935
|
-
|
|
973
|
+
react_1.default.createElement("textarea", { value: exportedPair, readOnly: true, rows: 6, style: {
|
|
936
974
|
fontFamily: "monospace",
|
|
937
975
|
fontSize: "12px",
|
|
938
976
|
width: "100%",
|
|
@@ -940,10 +978,10 @@ export const ShogunButton = (() => {
|
|
|
940
978
|
border: "1px solid #ccc",
|
|
941
979
|
borderRadius: "4px",
|
|
942
980
|
} }),
|
|
943
|
-
!navigator.clipboard && (
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
981
|
+
!navigator.clipboard && (react_1.default.createElement("p", { style: { fontSize: "12px", color: "#666", marginTop: "8px" } }, "\u26A0\uFE0F Auto-copy not available. Please manually copy the text above.")))),
|
|
982
|
+
react_1.default.createElement("button", { type: "button", className: "shogun-submit-button", onClick: handleExportPair, disabled: loading }, loading ? "Exporting..." : "Export Pair"),
|
|
983
|
+
react_1.default.createElement("div", { className: "shogun-form-footer" },
|
|
984
|
+
react_1.default.createElement("button", { className: "shogun-toggle-mode", onClick: () => {
|
|
947
985
|
if (isLoggedIn) {
|
|
948
986
|
// If user is logged in, close the modal instead of going to options
|
|
949
987
|
setModalIsOpen(false);
|
|
@@ -956,27 +994,27 @@ export const ShogunButton = (() => {
|
|
|
956
994
|
setExportedPair("");
|
|
957
995
|
}
|
|
958
996
|
}, disabled: loading }, "Back"))));
|
|
959
|
-
const renderImportForm = () => (
|
|
960
|
-
|
|
961
|
-
|
|
997
|
+
const renderImportForm = () => (react_1.default.createElement("div", { className: "shogun-auth-form" },
|
|
998
|
+
react_1.default.createElement("h3", null, "Import Gun Pair"),
|
|
999
|
+
react_1.default.createElement("div", { style: {
|
|
962
1000
|
backgroundColor: "#fef3c7",
|
|
963
1001
|
padding: "12px",
|
|
964
1002
|
borderRadius: "8px",
|
|
965
1003
|
marginBottom: "16px",
|
|
966
1004
|
border: "1px solid #f59e0b",
|
|
967
1005
|
} },
|
|
968
|
-
|
|
1006
|
+
react_1.default.createElement("p", { style: {
|
|
969
1007
|
fontSize: "14px",
|
|
970
1008
|
color: "#92400e",
|
|
971
1009
|
margin: "0",
|
|
972
1010
|
fontWeight: "500",
|
|
973
1011
|
} }, "\uD83D\uDD11 Restore Your Account"),
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1012
|
+
react_1.default.createElement("p", { style: { fontSize: "13px", color: "#a16207", margin: "4px 0 0 0" } }, "Import a Gun pair to login with your existing account from another device. Make sure you have your backup data ready.")),
|
|
1013
|
+
react_1.default.createElement("div", { className: "shogun-form-group" },
|
|
1014
|
+
react_1.default.createElement("label", { htmlFor: "importPairData" },
|
|
1015
|
+
react_1.default.createElement(ImportIcon, null),
|
|
1016
|
+
react_1.default.createElement("span", null, "Gun Pair Data")),
|
|
1017
|
+
react_1.default.createElement("textarea", { id: "importPairData", value: importPairData, onChange: (e) => setImportPairData(e.target.value), disabled: loading, placeholder: "Paste your Gun pair JSON here...", rows: 6, style: {
|
|
980
1018
|
fontFamily: "monospace",
|
|
981
1019
|
fontSize: "12px",
|
|
982
1020
|
width: "100%",
|
|
@@ -984,12 +1022,12 @@ export const ShogunButton = (() => {
|
|
|
984
1022
|
border: "1px solid #ccc",
|
|
985
1023
|
borderRadius: "4px",
|
|
986
1024
|
} })),
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
showImportSuccess && (
|
|
1025
|
+
react_1.default.createElement("div", { className: "shogun-form-group" },
|
|
1026
|
+
react_1.default.createElement("label", { htmlFor: "importPassword" },
|
|
1027
|
+
react_1.default.createElement(LockIcon, null),
|
|
1028
|
+
react_1.default.createElement("span", null, "Decryption Password (if encrypted)")),
|
|
1029
|
+
react_1.default.createElement("input", { type: "password", id: "importPassword", value: importPassword, onChange: (e) => setImportPassword(e.target.value), disabled: loading, placeholder: "Enter password if pair was encrypted" })),
|
|
1030
|
+
showImportSuccess && (react_1.default.createElement("div", { style: {
|
|
993
1031
|
backgroundColor: "#dcfce7",
|
|
994
1032
|
color: "#166534",
|
|
995
1033
|
padding: "12px",
|
|
@@ -999,26 +1037,26 @@ export const ShogunButton = (() => {
|
|
|
999
1037
|
border: "1px solid #22c55e",
|
|
1000
1038
|
textAlign: "center",
|
|
1001
1039
|
} }, "\u2705 Pair imported successfully! Logging you in...")),
|
|
1002
|
-
|
|
1040
|
+
react_1.default.createElement("button", { type: "button", className: "shogun-submit-button", onClick: handleImportPair, disabled: loading || showImportSuccess }, loading
|
|
1003
1041
|
? "Importing..."
|
|
1004
1042
|
: showImportSuccess
|
|
1005
1043
|
? "Success!"
|
|
1006
1044
|
: "Import and Login"),
|
|
1007
|
-
|
|
1008
|
-
|
|
1045
|
+
react_1.default.createElement("div", { className: "shogun-form-footer" },
|
|
1046
|
+
react_1.default.createElement("button", { className: "shogun-toggle-mode", onClick: () => {
|
|
1009
1047
|
setAuthView("options");
|
|
1010
1048
|
setImportPassword("");
|
|
1011
1049
|
setImportPairData("");
|
|
1012
1050
|
}, disabled: loading }, "Back to Login Options"))));
|
|
1013
1051
|
// Render logic
|
|
1014
|
-
return (
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
modalIsOpen && (
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1052
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
1053
|
+
react_1.default.createElement("button", { className: "shogun-connect-button", onClick: openModal },
|
|
1054
|
+
react_1.default.createElement(WalletIcon, null),
|
|
1055
|
+
react_1.default.createElement("span", null, "Login / Sign Up")),
|
|
1056
|
+
modalIsOpen && (react_1.default.createElement("div", { className: "shogun-modal-overlay", onClick: closeModal },
|
|
1057
|
+
react_1.default.createElement("div", { className: "shogun-modal", onClick: (e) => e.stopPropagation() },
|
|
1058
|
+
react_1.default.createElement("div", { className: "shogun-modal-header" },
|
|
1059
|
+
react_1.default.createElement("h2", null, authView === "recover"
|
|
1022
1060
|
? "Recover Password"
|
|
1023
1061
|
: authView === "showHint"
|
|
1024
1062
|
? "Password Hint"
|
|
@@ -1031,14 +1069,14 @@ export const ShogunButton = (() => {
|
|
|
1031
1069
|
: formMode === "login"
|
|
1032
1070
|
? "Login"
|
|
1033
1071
|
: "Sign Up"),
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
error &&
|
|
1038
|
-
authView === "options" && (
|
|
1072
|
+
react_1.default.createElement("button", { className: "shogun-close-button", onClick: closeModal, "aria-label": "Close" },
|
|
1073
|
+
react_1.default.createElement(CloseIcon, null))),
|
|
1074
|
+
react_1.default.createElement("div", { className: "shogun-modal-content" },
|
|
1075
|
+
error && react_1.default.createElement("div", { className: "shogun-error-message" }, error),
|
|
1076
|
+
authView === "options" && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
1039
1077
|
renderAuthOptions(),
|
|
1040
|
-
|
|
1041
|
-
|
|
1078
|
+
react_1.default.createElement("div", { className: "shogun-form-footer" },
|
|
1079
|
+
react_1.default.createElement("button", { type: "button", className: "shogun-toggle-mode shogun-prominent-toggle", onClick: () => {
|
|
1042
1080
|
console.log("🔧 Signup button clicked!");
|
|
1043
1081
|
console.log("🔧 Current formMode:", formMode);
|
|
1044
1082
|
console.log("🔧 Current loading:", loading);
|
|
@@ -1047,8 +1085,8 @@ export const ShogunButton = (() => {
|
|
|
1047
1085
|
}, disabled: loading }, formMode === "login"
|
|
1048
1086
|
? "Don't have an account? Sign up"
|
|
1049
1087
|
: "Already have an account? Log in")))),
|
|
1050
|
-
authView === "password" && (
|
|
1051
|
-
|
|
1088
|
+
authView === "password" && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
1089
|
+
react_1.default.createElement("button", { className: "shogun-back-button", onClick: () => setAuthView("options") }, "\u2190 Back"),
|
|
1052
1090
|
renderPasswordForm())),
|
|
1053
1091
|
authView === "recover" && renderRecoveryForm(),
|
|
1054
1092
|
authView === "showHint" && renderHint(),
|
|
@@ -1060,6 +1098,6 @@ export const ShogunButton = (() => {
|
|
|
1060
1098
|
Button.displayName = "ShogunButton";
|
|
1061
1099
|
return Object.assign(Button, {
|
|
1062
1100
|
Provider: ShogunButtonProvider,
|
|
1063
|
-
useShogun: useShogun,
|
|
1101
|
+
useShogun: exports.useShogun,
|
|
1064
1102
|
});
|
|
1065
1103
|
})();
|
package/dist/connector.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shogunConnector = shogunConnector;
|
|
4
|
+
const shogun_core_1 = require("shogun-core");
|
|
5
|
+
function shogunConnector(options) {
|
|
3
6
|
const { peers = ["https://gun-manhattan.herokuapp.com/gun"], appName, timeouts, oauth, showMetamask, showWebauthn, showNostr, showOauth, ...restOptions } = options;
|
|
4
7
|
// Build ShogunCore configuration with authentication plugins
|
|
5
8
|
const shogunConfig = {
|
|
@@ -42,7 +45,7 @@ export function shogunConnector(options) {
|
|
|
42
45
|
showNostr,
|
|
43
46
|
showOauth,
|
|
44
47
|
});
|
|
45
|
-
const sdk = new ShogunCore(shogunConfig);
|
|
48
|
+
const sdk = new shogun_core_1.ShogunCore(shogunConfig);
|
|
46
49
|
const registerPlugin = (plugin) => {
|
|
47
50
|
if (sdk && typeof sdk.register === "function") {
|
|
48
51
|
try {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shogunConnector = exports.useShogun = exports.ShogunButtonProvider = exports.ShogunButton = void 0;
|
|
4
|
+
const ShogunButton_1 = require("./components/ShogunButton");
|
|
5
|
+
Object.defineProperty(exports, "ShogunButton", { enumerable: true, get: function () { return ShogunButton_1.ShogunButton; } });
|
|
6
|
+
Object.defineProperty(exports, "ShogunButtonProvider", { enumerable: true, get: function () { return ShogunButton_1.ShogunButtonProvider; } });
|
|
7
|
+
Object.defineProperty(exports, "useShogun", { enumerable: true, get: function () { return ShogunButton_1.useShogun; } });
|
|
8
|
+
const connector_1 = require("./connector");
|
|
9
|
+
Object.defineProperty(exports, "shogunConnector", { enumerable: true, get: function () { return connector_1.shogunConnector; } });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shogun-button-react",
|
|
3
3
|
"description": "Shogun connector button",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.4",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"src/styles/index.css"
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
],
|
|
18
18
|
"author": "Scobru",
|
|
19
19
|
"license": "MIT",
|
|
20
|
-
"type": "module",
|
|
21
20
|
"exports": {
|
|
22
21
|
".": "./dist/index.js",
|
|
23
22
|
"./styles.css": "./dist/index.css"
|