shogun-button-react 4.2.1 → 4.2.3

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/connector.js CHANGED
@@ -1,15 +1,27 @@
1
1
  import { ShogunCore } from "shogun-core";
2
2
  export function shogunConnector(options) {
3
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, ...restOptions } = options;
4
- const core = new ShogunCore({
5
- gunOptions: gunOptions || undefined,
6
- gunInstance: gunInstance || undefined,
7
- webauthn,
8
- nostr,
9
- web3,
10
- zkproof,
11
- timeouts,
12
- });
4
+ let core = null;
5
+ if (gunInstance !== undefined) {
6
+ core = new ShogunCore({
7
+ gunInstance: gunInstance,
8
+ webauthn,
9
+ nostr,
10
+ web3,
11
+ zkproof,
12
+ timeouts,
13
+ });
14
+ }
15
+ else {
16
+ core = new ShogunCore({
17
+ gunOptions: gunOptions,
18
+ webauthn,
19
+ nostr,
20
+ web3,
21
+ zkproof,
22
+ timeouts,
23
+ });
24
+ }
13
25
  const setProvider = (provider) => {
14
26
  var _a;
15
27
  if (!core) {
@@ -47,8 +59,8 @@ export function shogunConnector(options) {
47
59
  var _a;
48
60
  const gun = ((_a = core === null || core === void 0 ? void 0 : core.db) === null || _a === void 0 ? void 0 : _a.gun) || (core === null || core === void 0 ? void 0 : core.gun);
49
61
  try {
50
- const peersObj = gun && gun.back ? gun.back('opt.peers') : undefined;
51
- const urls = peersObj && typeof peersObj === 'object' ? Object.keys(peersObj) : [];
62
+ const peersObj = gun && gun.back ? gun.back("opt.peers") : undefined;
63
+ const urls = peersObj && typeof peersObj === "object" ? Object.keys(peersObj) : [];
52
64
  return urls.length > 0 ? urls[0] : null;
53
65
  }
54
66
  catch {