shogun-button-react 1.5.2 → 1.5.10

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/CHANGELOG.md ADDED
@@ -0,0 +1,54 @@
1
+ # Changelog
2
+
3
+ ## Version 1.3.4 (Latest)
4
+
5
+ ### 🐛 Bug Fixes
6
+ - **Export Gun Pair Fix**: Fixed issue where "Export Pair" option was not accessible from user dropdown - now works correctly without requiring disconnect
7
+ - **Modal Logic Improvement**: Enhanced modal rendering logic to allow export functionality when user is already authenticated
8
+ - **UX Enhancement**: Improved back button behavior in export modal - now properly closes modal when user is logged in instead of showing unnecessary auth options
9
+
10
+ ### 🔧 Technical Changes
11
+ - Modified component render logic to show modal even when user is logged in
12
+ - Improved export form navigation for better user experience
13
+ - Reordered dropdown menu items for better flow (Export Pair before Disconnect)
14
+
15
+ ## Version 1.3.3
16
+
17
+ ### ✨ New Features
18
+ - **Import Gun Pair Login**: Aggiunta possibilità di effettuare login tramite importazione di un Gun pair esistente
19
+ - **Export Gun Pair**: Funzionalità per esportare il proprio Gun pair con opzione di crittografia tramite password
20
+ - **Improved UX**: Migliorata l'interfaccia utente con feedback visivi e messaggi informativi
21
+
22
+ ### 🔧 Improvements
23
+ - **Navigation Fix**: Il toggle "Don't have account? Sign up" ora porta alla selezione dei metodi di autenticazione invece che direttamente al form password
24
+ - **Visual Feedback**: Sostituiti gli alert con feedback visivi eleganti per export/import
25
+ - **Better Icons**: Aggiunte icone SVG personalizzate per import/export
26
+ - **Auto-copy**: L'export del pair viene automaticamente copiato negli appunti (quando supportato dal browser)
27
+ - **Enhanced Security**: Messaggi informativi per guidare l'utente nell'uso sicuro delle funzionalità
28
+
29
+ ### 🛠 Technical Changes
30
+ - Rimosso l'uso del metodo `on` non disponibile in ShogunCore
31
+ - Definiti tipi locali per `AuthResult` per compatibilità
32
+ - Migliorata gestione degli stati nel provider
33
+ - Aggiunto reset completo degli stati quando si chiude il modal
34
+
35
+ ### 🎨 UI/UX Enhancements
36
+ - Box informativi colorati per import/export
37
+ - Feedback di successo con timer automatico
38
+ - Indicatori di caricamento migliorati
39
+ - Messaggi di fallback per browser senza supporto clipboard
40
+
41
+ ## Version 1.3.2
42
+
43
+ ### Features
44
+ - Basic Gun pair export/import functionality
45
+ - Multi-authentication support (Password, MetaMask, WebAuthn, Nostr, OAuth)
46
+ - Dark mode support
47
+ - Responsive design
48
+
49
+ ## Version 1.3.1
50
+
51
+ ### Features
52
+ - Initial release
53
+ - Basic authentication flow
54
+ - Provider integration
@@ -132,7 +132,16 @@ export function ShogunButtonProvider({ children, sdk, options, onLoginSuccess, o
132
132
  if (!oauth)
133
133
  throw new Error("OAuth plugin not available");
134
134
  const provider = args[0] || "google";
135
- result = await oauth.login(provider);
135
+ // Se abbiamo code e state, significa che siamo in un callback
136
+ if (args[1] && args[2]) {
137
+ const code = args[1];
138
+ const state = args[2];
139
+ result = await oauth.handleOAuthCallback(provider, code, state);
140
+ }
141
+ else {
142
+ // Altrimenti iniziamo il flusso OAuth normale
143
+ result = await oauth.login(provider);
144
+ }
136
145
  authMethod = "oauth";
137
146
  if (result.redirectUrl) {
138
147
  return result;
@@ -218,8 +227,16 @@ export function ShogunButtonProvider({ children, sdk, options, onLoginSuccess, o
218
227
  if (!oauth)
219
228
  throw new Error("OAuth plugin not available");
220
229
  const provider = args[0] || "google";
221
- // NON serve più setPin passare il pin
222
- result = await oauth.signUp(provider);
230
+ // Se abbiamo code e state, significa che siamo in un callback
231
+ if (args[1] && args[2]) {
232
+ const code = args[1];
233
+ const state = args[2];
234
+ result = await oauth.handleOAuthCallback(provider, code, state);
235
+ }
236
+ else {
237
+ // Altrimenti iniziamo il flusso OAuth normale
238
+ result = await oauth.signUp(provider);
239
+ }
223
240
  authMethod = "oauth";
224
241
  if (result.redirectUrl) {
225
242
  return result;
@@ -491,8 +508,8 @@ export const ShogunButton = (() => {
491
508
  if (formMode === "signup") {
492
509
  const result = await signUp("password", formUsername, formPassword, formPasswordConfirm);
493
510
  if (result && result.success) {
494
- if (sdk === null || sdk === void 0 ? void 0 : sdk.gundb) {
495
- await sdk.gundb.setPasswordHint(formUsername, formPassword, formHint, [formSecurityQuestion], [formSecurityAnswer]);
511
+ if (sdk === null || sdk === void 0 ? void 0 : sdk.db) {
512
+ await sdk.db.setPasswordHint(formUsername, formPassword, formHint, [formSecurityQuestion], [formSecurityAnswer]);
496
513
  }
497
514
  setModalIsOpen(false);
498
515
  }
@@ -522,10 +539,10 @@ export const ShogunButton = (() => {
522
539
  setError("");
523
540
  setLoading(true);
524
541
  try {
525
- if (!(sdk === null || sdk === void 0 ? void 0 : sdk.gundb)) {
542
+ if (!(sdk === null || sdk === void 0 ? void 0 : sdk.db)) {
526
543
  throw new Error("SDK not ready");
527
544
  }
528
- const result = await sdk.gundb.forgotPassword(formUsername, [
545
+ const result = await sdk.db.forgotPassword(formUsername, [
529
546
  formSecurityAnswer,
530
547
  ]);
531
548
  if (result.success && result.hint) {
package/dist/connector.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ShogunCore } from "shogun-core";
1
+ import ShogunCore from "shogun-core";
2
2
  export function shogunConnector(options) {
3
3
  const { peers = ["https://gun-manhattan.herokuapp.com/gun"], appName, logging, timeouts, oauth, ...restOptions } = options;
4
4
  const sdk = new ShogunCore({
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.5.2",
4
+ "version": "1.5.10",
5
5
  "files": [
6
6
  "dist",
7
7
  "src/styles/index.css"
@@ -34,7 +34,7 @@
34
34
  "ethers": "^6.13.5",
35
35
  "prettier": "^3.5.3",
36
36
  "rxjs": "^7.8.1",
37
- "shogun-core": "^1.5.2"
37
+ "shogun-core": "^1.5.9"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "react": "^18.0.0",