wallet-connect-button-react 1.1.22 → 1.1.23

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/index.esm.js CHANGED
@@ -109,8 +109,13 @@ function useSearchParams() {
109
109
  // Global cache to prevent duplicate requests
110
110
  var credentialsCache = new Map();
111
111
  function getDefaultHost(useLocalWcServer, business, issuance, nbwallet) {
112
+ // NB Wallet: nb-wallet-connect (connect.nbwallet.org); the issuance
113
+ // server has its own host.
112
114
  if (nbwallet) {
113
- return useLocalWcServer ? 'http://localhost:9070' : 'https://wc.nbwallet.org';
115
+ if (useLocalWcServer) {
116
+ return issuance ? 'http://localhost:5017' : 'http://localhost:5021';
117
+ }
118
+ return issuance ? 'https://issuance.connect.nbwallet.org' : 'https://connect.nbwallet.org';
114
119
  }
115
120
  // If useLocalWcServer is set, use local server
116
121
  if (useLocalWcServer) {
@@ -125,6 +130,19 @@ function getDefaultHost(useLocalWcServer, business, issuance, nbwallet) {
125
130
  }
126
131
  return issuance ? 'https://issuance.wallet-connect.eu' : 'https://wallet-connect.eu';
127
132
  }
133
+ // Per-wallet-type help-base-url. An explicit helpBaseUrl prop wins; otherwise
134
+ // fall back to the wallet's own help page (NP Wallet by default).
135
+ function getHelpBaseUrl(over18, business, nbwallet, helpBaseUrl) {
136
+ if (helpBaseUrl)
137
+ return helpBaseUrl;
138
+ if (nbwallet)
139
+ return 'https://nbwallet.org/download';
140
+ if (over18)
141
+ return 'https://18up.eu/nl/install/';
142
+ if (business)
143
+ return 'https://ebwallet.org/download';
144
+ return 'https://npwallet.org/';
145
+ }
128
146
  function constructURI(clientId, session_type, walletConnectHost, business, nbwallet) {
129
147
  var request_uri = "".concat(walletConnectHost, "/disclosure/").concat(clientId, "/request_uri?session_type=").concat(session_type);
130
148
  var request_uri_method = "post";
@@ -144,8 +162,13 @@ function WalletConnectButton(_a) {
144
162
  var _j = useState(null), error = _j[0], setError = _j[1];
145
163
  var buttonRef = useRef(null);
146
164
  var walletConnectHost = getDefaultHost(useLocalWcServer, business, issuance, nbwallet);
147
- var sameDeviceUl = nbwallet ? undefined : constructURI(clientId, "same_device", walletConnectHost, business, nbwallet);
148
- var crossDeviceUl = nbwallet ? undefined : constructURI(clientId, "cross_device", walletConnectHost, business, nbwallet);
165
+ var resolvedHelpBaseUrl = getHelpBaseUrl(over18, business, nbwallet, helpBaseUrl);
166
+ // Disclosure uses the dynamic strategy the modal creates the session and
167
+ // the status response carries the universal link — so only issuance needs
168
+ // the static same/cross-device links.
169
+ var useStaticLinks = issuance;
170
+ var sameDeviceUl = useStaticLinks ? constructURI(clientId, "same_device", walletConnectHost, business, nbwallet) : undefined;
171
+ var crossDeviceUl = useStaticLinks ? constructURI(clientId, "cross_device", walletConnectHost, business, nbwallet) : undefined;
149
172
  useEffect(function () {
150
173
  // Dynamically import the web component
151
174
  var loadWebComponent = function () { return __awaiter(_this, void 0, void 0, function () {
@@ -363,7 +386,7 @@ function WalletConnectButton(_a) {
363
386
  return (jsx("div", { className: "attributes", children: jsxs("div", { className: "verification-card", children: [jsx("h2", { children: "Error" }), jsxs("p", { children: ["An error occurred while verifying your attributes: ", error] })] }) }));
364
387
  }
365
388
  var startHost = apiKey ? walletConnectHost : "";
366
- return (jsx("nl-wallet-button", { ref: buttonRef, text: label, usecase: issuance ? "" : clientId, "start-url": "".concat(startHost, "/api/create-session?lang=en&return_url=").concat(encodeURIComponent(window.location.href)), lang: lang || "nl", "same-device-ul": sameDeviceUl, "cross-device-ul": crossDeviceUl, "help-base-url": helpBaseUrl, business: business || undefined, over18: over18 || undefined, nbwallet: nbwallet || undefined, onClick: handleButtonClick }));
389
+ return (jsx("nl-wallet-button", { ref: buttonRef, text: label, usecase: issuance ? "" : clientId, "start-url": "".concat(startHost, "/api/create-session?lang=en&return_url=").concat(encodeURIComponent(window.location.href)), lang: lang || "nl", "same-device-ul": sameDeviceUl, "cross-device-ul": crossDeviceUl, "help-base-url": resolvedHelpBaseUrl, business: business || undefined, over18: over18 || undefined, nbwallet: nbwallet || undefined, onClick: handleButtonClick }));
367
390
  }
368
391
 
369
392
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};