shogun-button-react 1.3.42 → 1.3.43
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 +25 -16
- package/package.json +1 -1
|
@@ -536,11 +536,7 @@ export const ShogunButton = (() => {
|
|
|
536
536
|
setError("WebAuthn is not supported in your browser");
|
|
537
537
|
return;
|
|
538
538
|
}
|
|
539
|
-
|
|
540
|
-
setError("Username required for WebAuthn");
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
|
-
handleAuth("webauthn", formUsername);
|
|
539
|
+
setAuthView("webauthn-username");
|
|
544
540
|
};
|
|
545
541
|
const handleNostrAuth = () => handleAuth("nostr");
|
|
546
542
|
const handleOAuth = (provider) => handleAuth("oauth", provider);
|
|
@@ -653,13 +649,7 @@ export const ShogunButton = (() => {
|
|
|
653
649
|
React.createElement(WalletIcon, null),
|
|
654
650
|
formMode === "login" ? "Login with MetaMask" : "Signup with MetaMask"))),
|
|
655
651
|
options.showWebauthn !== false && (sdk === null || sdk === void 0 ? void 0 : sdk.hasPlugin("webauthn")) && (React.createElement("div", { className: "shogun-auth-option-group" },
|
|
656
|
-
React.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick:
|
|
657
|
-
if (!formUsername) {
|
|
658
|
-
setError("Username required for WebAuthn");
|
|
659
|
-
return;
|
|
660
|
-
}
|
|
661
|
-
handleAuth("webauthn", formUsername);
|
|
662
|
-
}, disabled: loading },
|
|
652
|
+
React.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: handleWebAuthnAuth, disabled: loading },
|
|
663
653
|
React.createElement(WebAuthnIcon, null),
|
|
664
654
|
formMode === "login" ? "Login with WebAuthn" : "Signup with WebAuthn"))),
|
|
665
655
|
options.showNostr !== false && (sdk === null || sdk === void 0 ? void 0 : sdk.hasPlugin("nostr")) && (React.createElement("div", { className: "shogun-auth-option-group" },
|
|
@@ -720,6 +710,22 @@ export const ShogunButton = (() => {
|
|
|
720
710
|
? "Don't have an account? Sign up"
|
|
721
711
|
: "Already have an account? Log in"),
|
|
722
712
|
formMode === "login" && (React.createElement("button", { type: "button", className: "shogun-toggle-mode", onClick: () => setAuthView("recover"), disabled: loading }, "Forgot password?")))));
|
|
713
|
+
const renderWebAuthnUsernameForm = () => (React.createElement("div", { className: "shogun-auth-form" },
|
|
714
|
+
React.createElement("h3", null, formMode === "login" ? "Login with WebAuthn" : "Sign Up with WebAuthn"),
|
|
715
|
+
React.createElement("div", { style: { backgroundColor: '#f0f9ff', padding: '12px', borderRadius: '8px', marginBottom: '16px', border: '1px solid #0ea5e9' } },
|
|
716
|
+
React.createElement("p", { style: { fontSize: '14px', color: '#0c4a6e', margin: '0', fontWeight: '500' } }, "\uD83D\uDD11 WebAuthn Authentication"),
|
|
717
|
+
React.createElement("p", { style: { fontSize: '13px', color: '#075985', margin: '4px 0 0 0' } },
|
|
718
|
+
"Please enter your username to continue with WebAuthn ",
|
|
719
|
+
formMode === "login" ? "login" : "registration",
|
|
720
|
+
".")),
|
|
721
|
+
React.createElement("div", { className: "shogun-form-group" },
|
|
722
|
+
React.createElement("label", { htmlFor: "username" },
|
|
723
|
+
React.createElement(UserIcon, null),
|
|
724
|
+
React.createElement("span", null, "Username")),
|
|
725
|
+
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 })),
|
|
726
|
+
React.createElement("button", { type: "button", className: "shogun-submit-button", onClick: () => handleAuth("webauthn", formUsername), disabled: loading || !formUsername.trim() }, loading ? "Processing..." : `Continue with WebAuthn`),
|
|
727
|
+
React.createElement("div", { className: "shogun-form-footer" },
|
|
728
|
+
React.createElement("button", { type: "button", className: "shogun-back-button", onClick: () => setAuthView("options"), disabled: loading }, "\u2190 Back to Options"))));
|
|
723
729
|
const renderRecoveryForm = () => (React.createElement("div", { className: "shogun-auth-form" },
|
|
724
730
|
React.createElement("div", { className: "shogun-form-group" },
|
|
725
731
|
React.createElement("label", { htmlFor: "username" },
|
|
@@ -845,9 +851,11 @@ export const ShogunButton = (() => {
|
|
|
845
851
|
? "Export Gun Pair"
|
|
846
852
|
: authView === "import"
|
|
847
853
|
? "Import Gun Pair"
|
|
848
|
-
:
|
|
849
|
-
? "
|
|
850
|
-
:
|
|
854
|
+
: authView === "webauthn-username"
|
|
855
|
+
? "WebAuthn"
|
|
856
|
+
: formMode === "login"
|
|
857
|
+
? "Login"
|
|
858
|
+
: "Sign Up"),
|
|
851
859
|
React.createElement("button", { className: "shogun-close-button", onClick: closeModal, "aria-label": "Close" },
|
|
852
860
|
React.createElement(CloseIcon, null))),
|
|
853
861
|
React.createElement("div", { className: "shogun-modal-content" },
|
|
@@ -864,7 +872,8 @@ export const ShogunButton = (() => {
|
|
|
864
872
|
authView === "recover" && renderRecoveryForm(),
|
|
865
873
|
authView === "showHint" && renderHint(),
|
|
866
874
|
authView === "export" && renderExportForm(),
|
|
867
|
-
authView === "import" && renderImportForm()
|
|
875
|
+
authView === "import" && renderImportForm(),
|
|
876
|
+
authView === "webauthn-username" && renderWebAuthnUsernameForm()))))));
|
|
868
877
|
};
|
|
869
878
|
Button.displayName = "ShogunButton";
|
|
870
879
|
return Object.assign(Button, {
|