shogun-button-react 1.5.34 → 1.5.36
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 +34 -17
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/package.json +2 -2
- package/CHANGELOG.md +0 -54
|
@@ -112,22 +112,28 @@ export function ShogunButtonProvider({ children, sdk, options, onLoginSuccess, o
|
|
|
112
112
|
throw new Error("Invalid pair data provided");
|
|
113
113
|
}
|
|
114
114
|
console.log(`🔧 Pair login with pub: ${(_a = pair.pub) === null || _a === void 0 ? void 0 : _a.slice(0, 8)}...`);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
115
|
+
// Prefer official API from shogun-core when available
|
|
116
|
+
if (typeof sdk.loginWithPair === "function") {
|
|
117
|
+
result = await sdk.loginWithPair(pair);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
result = await new Promise((resolve, reject) => {
|
|
121
|
+
sdk.gun.user().auth(pair, (ack) => {
|
|
122
|
+
if (ack.err) {
|
|
123
|
+
reject(new Error(`Pair authentication failed: ${ack.err}`));
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const pub = ack.pub || pair.pub;
|
|
127
|
+
const alias = ack.alias || `user_${pub === null || pub === void 0 ? void 0 : pub.substring(0, 8)}`;
|
|
128
|
+
resolve({
|
|
129
|
+
success: true,
|
|
130
|
+
userPub: pub,
|
|
131
|
+
alias: alias,
|
|
132
|
+
method: "pair",
|
|
133
|
+
});
|
|
128
134
|
});
|
|
129
135
|
});
|
|
130
|
-
}
|
|
136
|
+
}
|
|
131
137
|
username = result.alias;
|
|
132
138
|
authMethod = "pair";
|
|
133
139
|
break;
|
|
@@ -351,11 +357,22 @@ export function ShogunButtonProvider({ children, sdk, options, onLoginSuccess, o
|
|
|
351
357
|
throw new Error("User not authenticated");
|
|
352
358
|
}
|
|
353
359
|
try {
|
|
354
|
-
|
|
355
|
-
|
|
360
|
+
// Prefer SDK export if available, fallback to storage
|
|
361
|
+
let pairJson = null;
|
|
362
|
+
if (typeof sdk.exportPair === "function") {
|
|
363
|
+
pairJson = sdk.exportPair();
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
const stored = sessionStorage.getItem("gun/pair") ||
|
|
367
|
+
sessionStorage.getItem("pair") ||
|
|
368
|
+
null;
|
|
369
|
+
// Stored value is already a JSON stringified pair; don't double-encode
|
|
370
|
+
pairJson = stored;
|
|
371
|
+
}
|
|
372
|
+
if (!pairJson) {
|
|
356
373
|
throw new Error("No Gun pair available for current user");
|
|
357
374
|
}
|
|
358
|
-
let pairData =
|
|
375
|
+
let pairData = pairJson;
|
|
359
376
|
// If password provided, encrypt the pair
|
|
360
377
|
if (password && password.trim()) {
|
|
361
378
|
// Use Gun's SEA for encryption if available
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ShogunButton, ShogunButtonProvider, useShogun } from
|
|
2
|
-
import { ShogunConnectorOptions, ShogunConnectorResult } from
|
|
3
|
-
import { shogunConnector } from
|
|
1
|
+
import { ShogunButton, ShogunButtonProvider, useShogun } from "./components/ShogunButton";
|
|
2
|
+
import { ShogunConnectorOptions, ShogunConnectorResult } from "./types/connector-options";
|
|
3
|
+
import { shogunConnector } from "./connector";
|
|
4
4
|
export { ShogunButton, ShogunButtonProvider, useShogun };
|
|
5
5
|
export { shogunConnector };
|
|
6
6
|
export { ShogunConnectorOptions, ShogunConnectorResult };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ShogunButton, ShogunButtonProvider, useShogun } from
|
|
2
|
-
import { shogunConnector } from
|
|
1
|
+
import { ShogunButton, ShogunButtonProvider, useShogun, } from "./components/ShogunButton";
|
|
2
|
+
import { shogunConnector } from "./connector";
|
|
3
3
|
// Export components
|
|
4
4
|
export { ShogunButton, ShogunButtonProvider, useShogun };
|
|
5
5
|
// Export connector function
|
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.
|
|
4
|
+
"version": "1.5.36",
|
|
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.
|
|
37
|
+
"shogun-core": "^1.7.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": "^18.0.0",
|
package/CHANGELOG.md
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
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
|