shogun-button-react 5.0.0 → 6.0.2
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/README.md +752 -752
- package/dist/118.index.js +2 -0
- package/dist/118.index.js.LICENSE.txt +3 -0
- package/dist/122.index.js +2 -0
- package/dist/122.index.js.LICENSE.txt +1 -0
- package/dist/18.index.js +1 -0
- package/dist/195.index.js +2 -0
- package/dist/195.index.js.LICENSE.txt +1 -0
- package/dist/47.index.js +2 -0
- package/dist/47.index.js.LICENSE.txt +1 -0
- package/dist/508.index.js +2 -0
- package/dist/508.index.js.LICENSE.txt +1 -0
- package/dist/604.index.js +2 -0
- package/dist/604.index.js.LICENSE.txt +7 -0
- package/dist/619.index.js +2 -0
- package/dist/619.index.js.LICENSE.txt +1 -0
- package/dist/649.index.js +2 -0
- package/dist/649.index.js.LICENSE.txt +1 -0
- package/dist/695.index.js +1 -0
- package/dist/732.index.js +1 -0
- package/dist/794.index.js +2 -0
- package/dist/794.index.js.LICENSE.txt +1 -0
- package/dist/components/ShogunButton.d.ts +3 -3
- package/dist/components/ShogunButton.js +284 -131
- package/dist/connector.js +50 -41
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +0 -2
- package/dist/index.mjs +3 -0
- package/dist/interfaces/connector-options.d.ts +5 -6
- package/package.json +7 -3
package/dist/connector.js
CHANGED
|
@@ -1,50 +1,59 @@
|
|
|
1
|
-
import { ShogunCore } from "shogun-core";
|
|
1
|
+
import { ShogunCore, Gun, quickStart } from "shogun-core";
|
|
2
2
|
export async function shogunConnector(options) {
|
|
3
|
-
const { gunInstance, gunOptions,
|
|
3
|
+
const { gunInstance, gunOptions, appName, timeouts, webauthn, nostr, web3, zkproof, showWebauthn, showNostr, showMetamask, showZkProof, darkMode, enableGunDebug = true, enableConnectionMonitoring = true, defaultPageSize = 20, connectionTimeout = 10000, debounceInterval = 100, useQuickStart = false, ...restOptions } = options;
|
|
4
4
|
let core = null;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
core = new ShogunCore({
|
|
20
|
-
gunInstance: gunInstance,
|
|
21
|
-
webauthn,
|
|
22
|
-
nostr,
|
|
23
|
-
web3,
|
|
24
|
-
zkproof,
|
|
25
|
-
timeouts,
|
|
26
|
-
});
|
|
5
|
+
let gun = null;
|
|
6
|
+
// Create Gun instance if not provided
|
|
7
|
+
if (!gunInstance) {
|
|
8
|
+
if (gunOptions) {
|
|
9
|
+
gun = Gun(gunOptions);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
// Default Gun configuration
|
|
13
|
+
gun = Gun({
|
|
14
|
+
peers: ["https://shogunnode.scobrudot.dev/gun"],
|
|
15
|
+
radisk: false,
|
|
16
|
+
localStorage: false,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
27
19
|
}
|
|
28
20
|
else {
|
|
29
|
-
|
|
30
|
-
core = new ShogunCore({
|
|
31
|
-
gunOptions: gunOptions,
|
|
32
|
-
webauthn,
|
|
33
|
-
nostr,
|
|
34
|
-
web3,
|
|
35
|
-
zkproof,
|
|
36
|
-
timeouts,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
// Wait for core to initialize (plugins registration, etc.)
|
|
40
|
-
try {
|
|
41
|
-
await core.initialize();
|
|
42
|
-
console.log(`[DEBUG] ShogunConnector: ShogunCore initialized`);
|
|
21
|
+
gun = gunInstance;
|
|
43
22
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
23
|
+
// Use quickStart for simplified API if requested
|
|
24
|
+
if (useQuickStart) {
|
|
25
|
+
const quickStartInstance = quickStart(gun, appName || "shogun-app");
|
|
26
|
+
await quickStartInstance.init();
|
|
27
|
+
return {
|
|
28
|
+
core: quickStartInstance, // Type assertion for compatibility
|
|
29
|
+
options,
|
|
30
|
+
setProvider: () => false, // Not applicable for quickStart
|
|
31
|
+
getCurrentProviderUrl: () => null,
|
|
32
|
+
registerPlugin: () => false,
|
|
33
|
+
hasPlugin: () => false,
|
|
34
|
+
gunPlugin: null,
|
|
35
|
+
};
|
|
47
36
|
}
|
|
37
|
+
// Create ShogunCore with gunInstance (required in v2.0.0)
|
|
38
|
+
core = new ShogunCore({
|
|
39
|
+
gunInstance: gun,
|
|
40
|
+
webauthn: (webauthn === null || webauthn === void 0 ? void 0 : webauthn.enabled) ? {
|
|
41
|
+
enabled: true,
|
|
42
|
+
rpName: appName || "Shogun App",
|
|
43
|
+
rpId: typeof window !== "undefined" ? window.location.hostname : "localhost",
|
|
44
|
+
} : undefined,
|
|
45
|
+
web3: (web3 === null || web3 === void 0 ? void 0 : web3.enabled) ? { enabled: true } : undefined,
|
|
46
|
+
nostr: (nostr === null || nostr === void 0 ? void 0 : nostr.enabled) ? { enabled: true } : undefined,
|
|
47
|
+
zkproof: (zkproof === null || zkproof === void 0 ? void 0 : zkproof.enabled) ? {
|
|
48
|
+
enabled: true,
|
|
49
|
+
defaultGroupId: zkproof.defaultGroupId || "shogun-users",
|
|
50
|
+
} : undefined,
|
|
51
|
+
timeouts,
|
|
52
|
+
silent: false, // Enable console logs for debugging
|
|
53
|
+
});
|
|
54
|
+
// Note: ShogunCore v2.0.0 initializes automatically in constructor
|
|
55
|
+
// No need to call initialize() separately
|
|
56
|
+
console.log(`[DEBUG] ShogunConnector: ShogunCore initialized with gunInstance`);
|
|
48
57
|
const setProvider = (provider) => {
|
|
49
58
|
var _a;
|
|
50
59
|
if (!core) {
|