shogun-button-react 1.9.3 → 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.
@@ -1,6 +1,43 @@
1
- import React, { useContext, useState, createContext, useEffect, useRef, } from "react";
2
- import { Observable } from "rxjs";
3
- import "../styles/index.css";
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
- export const useShogun = () => useContext(ShogunContext);
61
+ const useShogun = () => (0, react_1.useContext)(ShogunContext);
62
+ exports.useShogun = useShogun;
25
63
  // Provider component
26
- export function ShogunButtonProvider({ children, sdk, options, onLoginSuccess, onSignupSuccess, onError, onLogout, // AGGIUNTA
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 (React.createElement(ShogunContext.Provider, { value: {
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 = () => (React.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" },
475
- React.createElement("path", { d: "M21 12V7H5a2 2 0 0 1 0-4h14v4" }),
476
- React.createElement("path", { d: "M3 5v14a2 2 0 0 0 2 2h16v-5" }),
477
- React.createElement("path", { d: "M18 12a2 2 0 0 0 0 4h4v-4Z" })));
478
- const KeyIcon = () => (React.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" },
479
- React.createElement("circle", { cx: "7.5", cy: "15.5", r: "5.5" }),
480
- React.createElement("path", { d: "m21 2-9.6 9.6" }),
481
- React.createElement("path", { d: "m15.5 7.5 3 3L22 7l-3-3" })));
482
- const GoogleIcon = () => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor" },
483
- React.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" }),
484
- React.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" }),
485
- React.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" }),
486
- React.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" })));
487
- const NostrIcon = () => (React.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" },
488
- React.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" }),
489
- React.createElement("path", { d: "M12 12 6 6l-1.5 1.5L9 12l-4.5 4.5L6 18l6-6Z" })));
490
- const WebAuthnIcon = () => (React.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" },
491
- React.createElement("path", { d: "M7 11v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1h-4" }),
492
- React.createElement("path", { d: "M14 4V2a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h2" })));
493
- const LogoutIcon = () => (React.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" },
494
- React.createElement("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
495
- React.createElement("polyline", { points: "16 17 21 12 16 7" }),
496
- React.createElement("line", { x1: "21", y1: "12", x2: "9", y2: "12" })));
497
- const UserIcon = () => (React.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" },
498
- React.createElement("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
499
- React.createElement("circle", { cx: "12", cy: "7", r: "4" })));
500
- const LockIcon = () => (React.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" },
501
- React.createElement("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }),
502
- React.createElement("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })));
503
- const CloseIcon = () => (React.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" },
504
- React.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
505
- React.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })));
506
- const ImportIcon = () => (React.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" },
507
- React.createElement("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
508
- React.createElement("polyline", { points: "14,2 14,8 20,8" }),
509
- React.createElement("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
510
- React.createElement("line", { x1: "12", y1: "17", x2: "12", y2: "9" })));
511
- const ExportIcon = () => (React.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" },
512
- React.createElement("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
513
- React.createElement("polyline", { points: "14,2 14,8 20,8" }),
514
- React.createElement("line", { x1: "12", y1: "11", x2: "12", y2: "21" }),
515
- React.createElement("polyline", { points: "16,15 12,11 8,15" })));
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
- export const ShogunButton = (() => {
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 (React.createElement("div", { className: "shogun-logged-in-container" },
560
- React.createElement("div", { className: "shogun-dropdown", ref: dropdownRef },
561
- React.createElement("button", { className: "shogun-button shogun-logged-in", onClick: () => setDropdownOpen(!dropdownOpen) },
562
- React.createElement("div", { className: "shogun-avatar" }, username.substring(0, 2).toUpperCase()),
563
- React.createElement("span", { className: "shogun-username" }, username.length > 12
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 && (React.createElement("div", { className: "shogun-dropdown-menu" },
567
- React.createElement("div", { className: "shogun-dropdown-header" },
568
- React.createElement("div", { className: "shogun-avatar-large" }, username.substring(0, 2).toUpperCase()),
569
- React.createElement("div", { className: "shogun-user-info" },
570
- React.createElement("span", { className: "shogun-username-full" }, username.length > 20
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
- React.createElement("div", { className: "shogun-dropdown-item", onClick: () => {
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
- React.createElement(ExportIcon, null),
579
- React.createElement("span", null, "Export Pair")),
580
- React.createElement("div", { className: "shogun-dropdown-item", onClick: logout },
581
- React.createElement(LogoutIcon, null),
582
- React.createElement("span", null, "Disconnect")))))));
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 = () => (React.createElement("div", { className: "shogun-auth-options" },
768
- options.showMetamask !== false && (sdk === null || sdk === void 0 ? void 0 : sdk.hasPlugin("web3")) && (React.createElement("div", { className: "shogun-auth-option-group" },
769
- React.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: () => handleAuth("web3"), disabled: loading },
770
- React.createElement(WalletIcon, null),
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")) && (React.createElement("div", { className: "shogun-auth-option-group" },
775
- React.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: handleWebAuthnAuth, disabled: loading },
776
- React.createElement(WebAuthnIcon, null),
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")) && (React.createElement("div", { className: "shogun-auth-option-group" },
781
- React.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: () => handleAuth("nostr"), disabled: loading },
782
- React.createElement(NostrIcon, null),
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")) && (React.createElement("div", { className: "shogun-auth-option-group" },
785
- React.createElement("button", { type: "button", className: "shogun-auth-option-button shogun-google-button", onClick: () => handleAuth("oauth", "google"), disabled: loading },
786
- React.createElement(GoogleIcon, null),
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
- React.createElement("div", { className: "shogun-divider" },
791
- React.createElement("span", null, "or")),
792
- React.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: () => setAuthView("password"), disabled: loading },
793
- React.createElement(LockIcon, null),
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" && (React.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: () => setAuthView("import"), disabled: loading },
798
- React.createElement(ImportIcon, null),
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 = () => (React.createElement("form", { onSubmit: handleSubmit, className: "shogun-auth-form" },
801
- React.createElement("div", { className: "shogun-form-group" },
802
- React.createElement("label", { htmlFor: "username" },
803
- React.createElement(UserIcon, null),
804
- React.createElement("span", null, "Username")),
805
- React.createElement("input", { type: "text", id: "username", value: formUsername, onChange: (e) => setFormUsername(e.target.value), disabled: loading, required: true, placeholder: "Enter your username" })),
806
- React.createElement("div", { className: "shogun-form-group" },
807
- React.createElement("label", { htmlFor: "password" },
808
- React.createElement(LockIcon, null),
809
- React.createElement("span", null, "Password")),
810
- React.createElement("input", { type: "password", id: "password", value: formPassword, onChange: (e) => setFormPassword(e.target.value), disabled: loading, required: true, placeholder: "Enter your password" })),
811
- formMode === "signup" && (React.createElement(React.Fragment, null,
812
- React.createElement("div", { className: "shogun-form-group" },
813
- React.createElement("label", { htmlFor: "passwordConfirm" },
814
- React.createElement(KeyIcon, null),
815
- React.createElement("span", null, "Confirm Password")),
816
- React.createElement("input", { type: "password", id: "passwordConfirm", value: formPasswordConfirm, onChange: (e) => setFormPasswordConfirm(e.target.value), disabled: loading, required: true, placeholder: "Confirm your password" })),
817
- React.createElement("div", { className: "shogun-form-group" },
818
- React.createElement("label", { htmlFor: "hint" },
819
- React.createElement(UserIcon, null),
820
- React.createElement("span", null, "Password Hint")),
821
- React.createElement("input", { type: "text", id: "hint", value: formHint, onChange: (e) => setFormHint(e.target.value), disabled: loading, required: true, placeholder: "Enter your password hint" })),
822
- React.createElement("div", { className: "shogun-form-group" },
823
- React.createElement("label", { htmlFor: "securityQuestion" },
824
- React.createElement(UserIcon, null),
825
- React.createElement("span", null, "Security Question")),
826
- React.createElement("input", { type: "text", id: "securityQuestion", value: formSecurityQuestion, disabled: true })),
827
- React.createElement("div", { className: "shogun-form-group" },
828
- React.createElement("label", { htmlFor: "securityAnswer" },
829
- React.createElement(UserIcon, null),
830
- React.createElement("span", null, "Security Answer")),
831
- React.createElement("input", { type: "text", id: "securityAnswer", value: formSecurityAnswer, onChange: (e) => setFormSecurityAnswer(e.target.value), disabled: loading, required: true, placeholder: "Enter your security answer" })))),
832
- React.createElement("button", { type: "submit", className: "shogun-submit-button", disabled: loading }, loading
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
- React.createElement("div", { className: "shogun-form-footer" },
838
- React.createElement("button", { type: "button", className: "shogun-toggle-mode shogun-prominent-toggle", onClick: () => {
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" && (React.createElement("button", { type: "button", className: "shogun-toggle-mode", onClick: () => setAuthView("recover"), disabled: loading }, "Forgot password?")))));
848
- const renderWebAuthnUsernameForm = () => (React.createElement("div", { className: "shogun-auth-form" },
849
- React.createElement("h3", null, formMode === "login"
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
- React.createElement("div", { style: {
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
- React.createElement("p", { style: {
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
- React.createElement("p", { style: { fontSize: "13px", color: "#075985", margin: "4px 0 0 0" } },
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
- React.createElement("div", { className: "shogun-form-group" },
871
- React.createElement("label", { htmlFor: "username" },
872
- React.createElement(UserIcon, null),
873
- React.createElement("span", null, "Username")),
874
- React.createElement("input", { type: "text", id: "username", value: formUsername, onChange: (e) => setFormUsername(e.target.value), disabled: loading, required: true, placeholder: "Enter your username", autoFocus: true })),
875
- React.createElement("button", { type: "button", className: "shogun-submit-button", onClick: () => handleAuth("webauthn", formUsername), disabled: loading || !formUsername.trim() }, loading ? "Processing..." : `Continue with WebAuthn`),
876
- React.createElement("div", { className: "shogun-form-footer" },
877
- React.createElement("button", { type: "button", className: "shogun-back-button", onClick: () => setAuthView("options"), disabled: loading }, "\u2190 Back to Options"))));
878
- const renderRecoveryForm = () => (React.createElement("div", { className: "shogun-auth-form" },
879
- React.createElement("div", { className: "shogun-form-group" },
880
- React.createElement("label", { htmlFor: "username" },
881
- React.createElement(UserIcon, null),
882
- React.createElement("span", null, "Username")),
883
- React.createElement("input", { type: "text", id: "username", value: formUsername, onChange: (e) => setFormUsername(e.target.value), disabled: loading, required: true, placeholder: "Enter your username" })),
884
- React.createElement("div", { className: "shogun-form-group" },
885
- React.createElement("label", null, "Security Question"),
886
- React.createElement("p", null, formSecurityQuestion)),
887
- React.createElement("div", { className: "shogun-form-group" },
888
- React.createElement("label", { htmlFor: "securityAnswer" },
889
- React.createElement(KeyIcon, null),
890
- React.createElement("span", null, "Answer")),
891
- React.createElement("input", { type: "text", id: "securityAnswer", value: formSecurityAnswer, onChange: (e) => setFormSecurityAnswer(e.target.value), disabled: loading, required: true, placeholder: "Enter your answer" })),
892
- React.createElement("button", { type: "button", className: "shogun-submit-button", onClick: handleRecover, disabled: loading }, loading ? "Recovering..." : "Get Hint"),
893
- React.createElement("div", { className: "shogun-form-footer" },
894
- React.createElement("button", { className: "shogun-toggle-mode", onClick: () => setAuthView("password"), disabled: loading }, "Back to Login"))));
895
- const renderHint = () => (React.createElement("div", { className: "shogun-auth-form" },
896
- React.createElement("h3", null, "Your Password Hint"),
897
- React.createElement("p", { className: "shogun-hint" }, recoveredHint),
898
- React.createElement("button", { className: "shogun-submit-button", onClick: () => {
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 = () => (React.createElement("div", { className: "shogun-auth-form" },
904
- React.createElement("h3", null, "Export Gun Pair"),
905
- React.createElement("div", { style: {
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
- React.createElement("p", { style: {
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
- React.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.")),
919
- React.createElement("div", { className: "shogun-form-group" },
920
- React.createElement("label", { htmlFor: "exportPassword" },
921
- React.createElement(LockIcon, null),
922
- React.createElement("span", null, "Encryption Password (optional but recommended)")),
923
- React.createElement("input", { type: "password", id: "exportPassword", value: exportPassword, onChange: (e) => setExportPassword(e.target.value), disabled: loading, placeholder: "Leave empty to export unencrypted" })),
924
- exportedPair && (React.createElement("div", { className: "shogun-form-group" },
925
- React.createElement("label", null, "Your Gun Pair (copy this safely):"),
926
- showCopySuccess && (React.createElement("div", { style: {
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
- React.createElement("textarea", { value: exportedPair, readOnly: true, rows: 6, style: {
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 && (React.createElement("p", { style: { fontSize: "12px", color: "#666", marginTop: "8px" } }, "\u26A0\uFE0F Auto-copy not available. Please manually copy the text above.")))),
944
- React.createElement("button", { type: "button", className: "shogun-submit-button", onClick: handleExportPair, disabled: loading }, loading ? "Exporting..." : "Export Pair"),
945
- React.createElement("div", { className: "shogun-form-footer" },
946
- React.createElement("button", { className: "shogun-toggle-mode", onClick: () => {
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 = () => (React.createElement("div", { className: "shogun-auth-form" },
960
- React.createElement("h3", null, "Import Gun Pair"),
961
- React.createElement("div", { style: {
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
- React.createElement("p", { style: {
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
- React.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.")),
975
- React.createElement("div", { className: "shogun-form-group" },
976
- React.createElement("label", { htmlFor: "importPairData" },
977
- React.createElement(ImportIcon, null),
978
- React.createElement("span", null, "Gun Pair Data")),
979
- React.createElement("textarea", { id: "importPairData", value: importPairData, onChange: (e) => setImportPairData(e.target.value), disabled: loading, placeholder: "Paste your Gun pair JSON here...", rows: 6, style: {
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
- React.createElement("div", { className: "shogun-form-group" },
988
- React.createElement("label", { htmlFor: "importPassword" },
989
- React.createElement(LockIcon, null),
990
- React.createElement("span", null, "Decryption Password (if encrypted)")),
991
- React.createElement("input", { type: "password", id: "importPassword", value: importPassword, onChange: (e) => setImportPassword(e.target.value), disabled: loading, placeholder: "Enter password if pair was encrypted" })),
992
- showImportSuccess && (React.createElement("div", { style: {
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
- React.createElement("button", { type: "button", className: "shogun-submit-button", onClick: handleImportPair, disabled: loading || showImportSuccess }, loading
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
- React.createElement("div", { className: "shogun-form-footer" },
1008
- React.createElement("button", { className: "shogun-toggle-mode", onClick: () => {
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 (React.createElement(React.Fragment, null,
1015
- React.createElement("button", { className: "shogun-connect-button", onClick: openModal },
1016
- React.createElement(WalletIcon, null),
1017
- React.createElement("span", null, "Login / Sign Up")),
1018
- modalIsOpen && (React.createElement("div", { className: "shogun-modal-overlay", onClick: closeModal },
1019
- React.createElement("div", { className: "shogun-modal", onClick: (e) => e.stopPropagation() },
1020
- React.createElement("div", { className: "shogun-modal-header" },
1021
- React.createElement("h2", null, authView === "recover"
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
- React.createElement("button", { className: "shogun-close-button", onClick: closeModal, "aria-label": "Close" },
1035
- React.createElement(CloseIcon, null))),
1036
- React.createElement("div", { className: "shogun-modal-content" },
1037
- error && React.createElement("div", { className: "shogun-error-message" }, error),
1038
- authView === "options" && (React.createElement(React.Fragment, null,
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
- React.createElement("div", { className: "shogun-form-footer" },
1041
- React.createElement("button", { type: "button", className: "shogun-toggle-mode shogun-prominent-toggle", onClick: () => {
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" && (React.createElement(React.Fragment, null,
1051
- React.createElement("button", { className: "shogun-back-button", onClick: () => setAuthView("options") }, "\u2190 Back"),
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
- import { ShogunCore } from "shogun-core";
2
- export function shogunConnector(options) {
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
- import { ShogunButton, ShogunButtonProvider, useShogun, } from "./components/ShogunButton";
2
- import { shogunConnector } from "./connector";
3
- // Export components
4
- export { ShogunButton, ShogunButtonProvider, useShogun };
5
- // Export connector function
6
- export { shogunConnector };
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
- export {};
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.3",
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"