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.js CHANGED
@@ -113,8 +113,13 @@ function useSearchParams() {
113
113
  // Global cache to prevent duplicate requests
114
114
  var credentialsCache = new Map();
115
115
  function getDefaultHost(useLocalWcServer, business, issuance, nbwallet) {
116
+ // NB Wallet: nb-wallet-connect (connect.nbwallet.org); the issuance
117
+ // server has its own host.
116
118
  if (nbwallet) {
117
- return useLocalWcServer ? 'http://localhost:9070' : 'https://wc.nbwallet.org';
119
+ if (useLocalWcServer) {
120
+ return issuance ? 'http://localhost:5017' : 'http://localhost:5021';
121
+ }
122
+ return issuance ? 'https://issuance.connect.nbwallet.org' : 'https://connect.nbwallet.org';
118
123
  }
119
124
  // If useLocalWcServer is set, use local server
120
125
  if (useLocalWcServer) {
@@ -129,6 +134,19 @@ function getDefaultHost(useLocalWcServer, business, issuance, nbwallet) {
129
134
  }
130
135
  return issuance ? 'https://issuance.wallet-connect.eu' : 'https://wallet-connect.eu';
131
136
  }
137
+ // Per-wallet-type help-base-url. An explicit helpBaseUrl prop wins; otherwise
138
+ // fall back to the wallet's own help page (NP Wallet by default).
139
+ function getHelpBaseUrl(over18, business, nbwallet, helpBaseUrl) {
140
+ if (helpBaseUrl)
141
+ return helpBaseUrl;
142
+ if (nbwallet)
143
+ return 'https://nbwallet.org/download';
144
+ if (over18)
145
+ return 'https://18up.eu/nl/install/';
146
+ if (business)
147
+ return 'https://ebwallet.org/download';
148
+ return 'https://npwallet.org/';
149
+ }
132
150
  function constructURI(clientId, session_type, walletConnectHost, business, nbwallet) {
133
151
  var request_uri = "".concat(walletConnectHost, "/disclosure/").concat(clientId, "/request_uri?session_type=").concat(session_type);
134
152
  var request_uri_method = "post";
@@ -148,8 +166,13 @@ function WalletConnectButton(_a) {
148
166
  var _j = react.useState(null), error = _j[0], setError = _j[1];
149
167
  var buttonRef = react.useRef(null);
150
168
  var walletConnectHost = getDefaultHost(useLocalWcServer, business, issuance, nbwallet);
151
- var sameDeviceUl = nbwallet ? undefined : constructURI(clientId, "same_device", walletConnectHost, business, nbwallet);
152
- var crossDeviceUl = nbwallet ? undefined : constructURI(clientId, "cross_device", walletConnectHost, business, nbwallet);
169
+ var resolvedHelpBaseUrl = getHelpBaseUrl(over18, business, nbwallet, helpBaseUrl);
170
+ // Disclosure uses the dynamic strategy the modal creates the session and
171
+ // the status response carries the universal link — so only issuance needs
172
+ // the static same/cross-device links.
173
+ var useStaticLinks = issuance;
174
+ var sameDeviceUl = useStaticLinks ? constructURI(clientId, "same_device", walletConnectHost, business, nbwallet) : undefined;
175
+ var crossDeviceUl = useStaticLinks ? constructURI(clientId, "cross_device", walletConnectHost, business, nbwallet) : undefined;
153
176
  react.useEffect(function () {
154
177
  // Dynamically import the web component
155
178
  var loadWebComponent = function () { return __awaiter(_this, void 0, void 0, function () {
@@ -367,7 +390,7 @@ function WalletConnectButton(_a) {
367
390
  return (jsxRuntime.jsx("div", { className: "attributes", children: jsxRuntime.jsxs("div", { className: "verification-card", children: [jsxRuntime.jsx("h2", { children: "Error" }), jsxRuntime.jsxs("p", { children: ["An error occurred while verifying your attributes: ", error] })] }) }));
368
391
  }
369
392
  var startHost = apiKey ? walletConnectHost : "";
370
- return (jsxRuntime.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 }));
393
+ return (jsxRuntime.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 }));
371
394
  }
372
395
 
373
396
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};