shogun-button-react 4.3.4 → 4.3.6

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.
@@ -75,7 +75,9 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
75
75
  switch (method) {
76
76
  case "password":
77
77
  username = args[0];
78
+ console.log(`[DEBUG] ShogunButton: Calling core.login for username: ${username}`);
78
79
  result = await core.login(args[0], args[1]);
80
+ console.log(`[DEBUG] ShogunButton: core.login result:`, result);
79
81
  break;
80
82
  case "pair":
81
83
  // New pair authentication method
@@ -188,7 +190,17 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
188
190
  if (args[1] !== args[2]) {
189
191
  throw new Error("Passwords do not match");
190
192
  }
191
- result = await core.signUp(args[0], args[1]);
193
+ console.log(`[DEBUG] ShogunButton: Calling core.signUp for username: ${username}`);
194
+ console.log(`[DEBUG] ShogunButton: core object:`, core);
195
+ console.log(`[DEBUG] ShogunButton: core.signUp exists:`, typeof (core === null || core === void 0 ? void 0 : core.signUp));
196
+ try {
197
+ result = await core.signUp(args[0], args[1]);
198
+ console.log(`[DEBUG] ShogunButton: core.signUp result:`, result);
199
+ }
200
+ catch (error) {
201
+ console.error(`[DEBUG] ShogunButton: core.signUp error:`, error);
202
+ throw error;
203
+ }
192
204
  break;
193
205
  case "webauthn":
194
206
  username = args[0];
@@ -553,12 +565,15 @@ export const ShogunButton = (() => {
553
565
  }
554
566
  // Event handlers
555
567
  const handleAuth = async (method, ...args) => {
568
+ console.log(`[DEBUG] handleAuth called with method: ${method}, formMode: ${formMode}, args:`, args);
556
569
  setError("");
557
570
  setLoading(true);
558
571
  try {
559
572
  // Use formMode to determine whether to call login or signUp
560
573
  const action = formMode === "login" ? login : signUp;
574
+ console.log(`[DEBUG] handleAuth calling action: ${action.name}, method: ${method}`);
561
575
  const result = await action(method, ...args);
576
+ console.log(`[DEBUG] handleAuth result:`, result);
562
577
  if (result && !result.success && result.error) {
563
578
  setError(result.error);
564
579
  }
@@ -578,6 +593,7 @@ export const ShogunButton = (() => {
578
593
  };
579
594
  const handleSubmit = async (e) => {
580
595
  e.preventDefault();
596
+ console.log(`[DEBUG] handleSubmit called, formMode: ${formMode}, username: ${formUsername}`);
581
597
  setError("");
582
598
  setLoading(true);
583
599
  try {
@@ -614,7 +630,6 @@ export const ShogunButton = (() => {
614
630
  setLoading(false);
615
631
  }
616
632
  };
617
- const handleWeb3Auth = () => handleAuth("web3");
618
633
  const handleWebAuthnAuth = () => {
619
634
  if (!(core === null || core === void 0 ? void 0 : core.hasPlugin("webauthn"))) {
620
635
  setError("WebAuthn is not supported in your browser");
@@ -622,7 +637,6 @@ export const ShogunButton = (() => {
622
637
  }
623
638
  setAuthView("webauthn-username");
624
639
  };
625
- const handleNostrAuth = () => handleAuth("nostr");
626
640
  const handleZkProofAuth = () => {
627
641
  if (!(core === null || core === void 0 ? void 0 : core.hasPlugin("zkproof"))) {
628
642
  setError("ZK-Proof plugin not available");
package/dist/connector.js CHANGED
@@ -24,12 +24,12 @@ export async function shogunConnector(options) {
24
24
  }
25
25
  // Wait for core to initialize (plugins registration, etc.)
26
26
  try {
27
- if (typeof core.initialize === 'function') {
28
- await core.initialize();
29
- }
27
+ await core.initialize();
28
+ console.log(`[DEBUG] ShogunConnector: ShogunCore initialized`);
30
29
  }
31
30
  catch (error) {
32
31
  console.error("Error initializing ShogunCore:", error);
32
+ console.error(`[DEBUG] ShogunConnector: Error initializing ShogunCore: ${error}`);
33
33
  }
34
34
  const setProvider = (provider) => {
35
35
  var _a;