wallet-connect-button-react 1.0.4 → 1.1.1

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
@@ -530,9 +530,9 @@ function useSearchParams() {
530
530
  return [searchParams, setSearchParams, removeSearchParam];
531
531
  }
532
532
 
533
- function NLWalletButton(_a) {
533
+ function WalletConnectButton(_a) {
534
534
  var _this = this;
535
- var children = _a.children, clientId = _a.clientId, onSuccess = _a.onSuccess, apiKey = _a.apiKey, walletConnectHost = _a.walletConnectHost;
535
+ var children = _a.children, clientId = _a.clientId, onSuccess = _a.onSuccess, apiKey = _a.apiKey, walletConnectHost = _a.walletConnectHost, lang = _a.lang;
536
536
  var _b = useSearchParams(), searchParams = _b[0], setSearchParams = _b[1], removeSearchParam = _b[2];
537
537
  var _c = require$$0.useState(false), loading = _c[0], setLoading = _c[1];
538
538
  var _d = require$$0.useState(null), error = _d[0], setError = _d[1];
@@ -596,29 +596,10 @@ function NLWalletButton(_a) {
596
596
  if (!session_token)
597
597
  return;
598
598
  setLoading(true);
599
- var baseUrl = walletConnectHost || "https://wallet-connect.eu";
600
- var url = baseUrl + "/disclosed-attributes?session_token=".concat(session_token, "&client_id=").concat(clientId);
599
+ var baseUrl = apiKey ? (walletConnectHost || "https://wallet-connect.eu") : "";
600
+ var url = baseUrl + "/api/disclosed-attributes?session_token=".concat(session_token, "&client_id=").concat(clientId);
601
601
  if (nonce)
602
602
  url = "".concat(url, "&nonce=").concat(nonce);
603
- // Example response structure
604
- // {
605
- // "attributes": {
606
- // "urn:eudi:pid:nl:1": {
607
- // "attributes": {
608
- // "urn:eudi:pid:nl:1": {
609
- // "age_over_18": true
610
- // }
611
- // },
612
- // "issuerUri": "https://cert.issuer.example.com/",
613
- // "ca": "ca.issuer.example.com",
614
- // "validityInfo": {
615
- // "signed": "2025-07-22T12:08:12Z",
616
- // "validFrom": "2025-07-22T00:00:00Z",
617
- // "validUntil": "2026-07-22T00:00:00Z"
618
- // }
619
- // }
620
- // }
621
- // }
622
603
  var headers = apiKey ? { 'Authorization': "Bearer ".concat(apiKey) } : {};
623
604
  axios
624
605
  .get(url, { headers: headers })
@@ -634,6 +615,10 @@ function NLWalletButton(_a) {
634
615
  .catch(function (error) {
635
616
  console.log(error.message);
636
617
  setError(error.message);
618
+ // Remove session_token from URL after failed request
619
+ removeSearchParam('session_token');
620
+ if (nonce)
621
+ removeSearchParam('nonce');
637
622
  setLoading(false);
638
623
  });
639
624
  }, [searchParams, onSuccess]);
@@ -643,7 +628,7 @@ function NLWalletButton(_a) {
643
628
  if (error) {
644
629
  return (jsxRuntimeExports.jsx("div", { className: "attributes", children: jsxRuntimeExports.jsxs("div", { className: "verification-card", children: [jsxRuntimeExports.jsx("h2", { children: "Error" }), jsxRuntimeExports.jsxs("p", { children: ["An error occurred while verifying your attributes: ", error] })] }) }));
645
630
  }
646
- return (jsxRuntimeExports.jsx("nl-wallet-button", { ref: buttonRef, text: children, usecase: clientId, "start-url": "".concat(walletConnectHost || "https://wallet-connect.eu", "/create-session?lang=en&return_url=").concat(encodeURIComponent(window.location.href)), lang: "nl" }));
631
+ return (jsxRuntimeExports.jsx("nl-wallet-button", { ref: buttonRef, text: children, usecase: clientId, "start-url": "".concat(walletConnectHost || "https://wallet-connect.eu", "/api/create-session?lang=en&return_url=").concat(encodeURIComponent(window.location.href)), lang: lang || "nl" }));
647
632
  }
648
633
 
649
634
  var nlWalletWeb$1 = {};
@@ -7722,6 +7707,6 @@ var nlWalletWeb = /*#__PURE__*/_mergeNamespaces({
7722
7707
  default: nlWalletWeb$1
7723
7708
  }, [nlWalletWeb$1]);
7724
7709
 
7725
- exports.NLWalletButton = NLWalletButton;
7726
- exports.default = NLWalletButton;
7710
+ exports.WalletConnectButton = WalletConnectButton;
7711
+ exports.default = WalletConnectButton;
7727
7712
  //# sourceMappingURL=index.js.map