wallet-connect-button-vue 1.0.12 → 1.0.14

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
@@ -49,7 +49,8 @@ const _sfc_main = {
49
49
  clientId: { type: String, required: true },
50
50
  onSuccess: { type: Function, required: false },
51
51
  apiKey: { type: String, required: false },
52
- walletConnectHost: { type: String, required: false },
52
+ useLocalWcServer: { type: Boolean, required: false, default: false },
53
+ business: { type: Boolean, required: false, default: false },
53
54
  lang: { type: String, required: false, default: 'nl' },
54
55
  helpBaseUrl: { type: String, required: false },
55
56
  issuance: { type: Boolean, required: false }
@@ -65,19 +66,42 @@ const loading = ref(false);
65
66
  const error = ref(null);
66
67
  const buttonRef = ref(null);
67
68
 
69
+ const getDefaultHost = () => {
70
+ // If useLocalWcServer is set, use local server
71
+ if (props.useLocalWcServer) {
72
+ if (props.business) {
73
+ return props.issuance ? 'http://localhost:4007' : 'http://bw.localhost:3021';
74
+ }
75
+
76
+ return props.issuance ? 'http://localhost:3007' : 'http://localhost:3021';
77
+ }
78
+
79
+ // Otherwise use remote servers
80
+ if (props.business) {
81
+ return props.issuance ? 'https://bw.issuance.wallet-connect.eu' : 'https://bw.wallet-connect.eu';
82
+ }
83
+
84
+ return props.issuance ? 'https://issuance.wallet-connect.eu' : 'https://wallet-connect.eu';
85
+ };
86
+
68
87
  const startUrl = computed(() => {
69
- const baseUrl = props.walletConnectHost || 'https://wallet-connect.eu';
88
+ const baseUrl = getDefaultHost();
70
89
  const returnUrl = typeof window !== 'undefined' ? window.location.href : '';
71
90
  return `${baseUrl}/api/create-session?lang=en&return_url=${encodeURIComponent(returnUrl)}`;
72
91
  });
73
92
 
74
93
  const constructURI = (session_type) => {
75
- const baseHost = props.walletConnectHost || "https://issuance.wallet-connect.eu";
76
- const request_uri = `${baseHost}/disclosure/${props.clientId}/request_uri?session_type=${session_type}`;
94
+ const request_uri = `${getDefaultHost()}/disclosure/${props.clientId}/request_uri?session_type=${session_type}`;
77
95
  const request_uri_method = "post";
78
96
  const client_id_uri = `${props.clientId}.example.com`;
79
-
80
- return `walletdebuginteraction://wallet.edi.rijksoverheid.nl/disclosure_based_issuance?request_uri=${encodeURIComponent(request_uri)}&request_uri_method=${request_uri_method}&client_id=${client_id_uri}`;
97
+
98
+ const deepLinkScheme = props.business
99
+ ? 'businesswalletdebuginteraction://wallet.kvk.rijksoverheid.nl'
100
+ : 'walletdebuginteraction://wallet.edi.rijksoverheid.nl';
101
+
102
+ return `${deepLinkScheme}/disclosure_based_issuance?request_uri=${encodeURIComponent(
103
+ request_uri
104
+ )}&request_uri_method=${request_uri_method}&client_id=${client_id_uri}`;
81
105
  };
82
106
 
83
107
  const sameDeviceUl = computed(() => constructURI("same_device"));
@@ -85,31 +109,31 @@ const crossDeviceUl = computed(() => constructURI("cross_device"));
85
109
 
86
110
  const fetchRequestedCredentials = async () => {
87
111
  if (!props.apiKey || !props.clientId) return [];
88
-
89
- const cacheKey = `${props.clientId}-${props.walletConnectHost || "default"}`;
90
-
112
+
113
+ const cacheKey = `${props.clientId}-${getDefaultHost()}`;
114
+
91
115
  // Check if we already have data in cache
92
116
  const cached = credentialsCache.get(cacheKey);
93
117
  if (cached?.data) {
94
118
  return cached.data;
95
119
  }
96
-
120
+
97
121
  // Check if there's already a request in progress
98
122
  if (cached?.promise) {
99
123
  return await cached.promise;
100
124
  }
101
-
125
+
102
126
  const fetchPromise = (async () => {
103
127
  try {
104
- const baseUrl = props.walletConnectHost || "https://wallet-connect.eu";
128
+ const baseUrl = getDefaultHost();
105
129
  const url = `${baseUrl}/api/client/${props.clientId}/requested-credentials`;
106
130
  const headers = { 'Authorization': `Bearer ${props.apiKey}` };
107
-
131
+
108
132
  const response = await axios.get(url, { headers });
109
-
133
+
110
134
  // Extract credentials from the response
111
135
  const credentials = response.data?.data?.requestedCredentials || [];
112
-
136
+
113
137
  // Cache the result
114
138
  credentialsCache.set(cacheKey, { data: credentials });
115
139
  return credentials;
@@ -119,10 +143,10 @@ const fetchRequestedCredentials = async () => {
119
143
  throw error;
120
144
  }
121
145
  })();
122
-
146
+
123
147
  // Cache the promise to prevent duplicate requests
124
148
  credentialsCache.set(cacheKey, { promise: fetchPromise });
125
-
149
+
126
150
  return await fetchPromise;
127
151
  };
128
152
 
@@ -259,12 +283,12 @@ const fetchDisclosedAttributes = async () => {
259
283
  if (!session_token) return;
260
284
 
261
285
  loading.value = true;
262
- const baseUrl = props.apiKey ? (props.walletConnectHost || "https://wallet-connect.eu") : "";
286
+ const baseUrl = props.apiKey ? getDefaultHost() : "";
263
287
  let url = baseUrl + `/api/disclosed-attributes?session_token=${session_token}&client_id=${props.clientId}`;
264
288
  if (nonce) url = `${url}&nonce=${nonce}`;
265
289
 
266
290
  const headers = props.apiKey ? { 'Authorization': `Bearer ${props.apiKey}` } : {};
267
-
291
+
268
292
  try {
269
293
  const { data } = await axios.get(url, { headers });
270
294
  console.log("Disclosed attributes:", data);
@@ -5618,8 +5642,8 @@ const {
5618
5642
  return (s) => t[s];
5619
5643
  }, pu = {
5620
5644
  en: {
5621
- wallet_button_text: "Login with NL Wallet",
5622
- modal_header: "NL Wallet",
5645
+ wallet_button_text: "Login with Wallet",
5646
+ modal_header: "Wallet",
5623
5647
  need_help: "Need help?",
5624
5648
  stop: "Stop",
5625
5649
  retry: "Try again",
@@ -5628,7 +5652,7 @@ const {
5628
5652
  no: "No",
5629
5653
  confirm_stop_title: "Are you sure you want to stop?",
5630
5654
  confirm_stop_body: "If you stop now, no data will be shared.",
5631
- device_choice_title: "Which device is your NL Wallet is installed?",
5655
+ device_choice_title: "Which device is your Wallet is installed?",
5632
5656
  device_choice_same_device: "On this device",
5633
5657
  device_choice_cross_device: "On another device",
5634
5658
  expired_title: "Sorry, time is over",
@@ -5639,19 +5663,19 @@ const {
5639
5663
  cancelled_body: "Because you have stopped, no data has been shared.",
5640
5664
  network_title: "Sorry, no internet connection",
5641
5665
  network_body: "Your internet connection seems to be down or too slow. Check your connection and try again.",
5642
- help_title: "No NL Wallet App yet? Or need help?",
5643
- help_to_website: "To NL Wallet website",
5644
- in_progress_title: "Follow the steps in your NL Wallet app",
5666
+ help_title: "No Wallet App yet? Or need help?",
5667
+ help_to_website: "To Wallet website",
5668
+ in_progress_title: "Follow the steps in your Wallet app",
5645
5669
  loading_title: "Please wait",
5646
5670
  loading_body: "Your request is being retrieved",
5647
- qr_code_title: "Scan the QR code with your NL Wallet app",
5671
+ qr_code_title: "Scan the QR code with your Wallet app",
5648
5672
  qr_code_label: "QR code",
5649
5673
  success_title: "Success!",
5650
5674
  success_body: "Close this page and continue in the new opened tab."
5651
5675
  },
5652
5676
  nl: {
5653
- wallet_button_text: "Inloggen met NL Wallet",
5654
- modal_header: "NL Wallet",
5677
+ wallet_button_text: "Inloggen met Wallet",
5678
+ modal_header: "Wallet",
5655
5679
  need_help: "Hulp nodig?",
5656
5680
  stop: "Stoppen",
5657
5681
  retry: "Probeer opnieuw",
@@ -5660,7 +5684,7 @@ const {
5660
5684
  no: "Nee",
5661
5685
  confirm_stop_title: "Weet je zeker dat je wilt stoppen?",
5662
5686
  confirm_stop_body: "Als je stopt worden er geen gegevens gedeeld.",
5663
- device_choice_title: "Op welk apparaat staat je NL Wallet app?",
5687
+ device_choice_title: "Op welk apparaat staat je Wallet app?",
5664
5688
  device_choice_same_device: "Op dit apparaat",
5665
5689
  device_choice_cross_device: "Op een ander apparaat",
5666
5690
  expired_title: "Sorry, de tijd is voorbij",
@@ -5671,12 +5695,12 @@ const {
5671
5695
  cancelled_body: "Omdat je bent gestopt zijn er geen gegevens gedeeld.",
5672
5696
  network_title: "Sorry, geen internet",
5673
5697
  network_body: "Je verbinding met het internet lijkt niet te werken of is te traag. Controleer je verbinding en probeer het opnieuw.",
5674
- help_title: "Nog geen NL Wallet app? Of hulp nodig?",
5675
- help_to_website: "Naar NL Wallet website",
5676
- in_progress_title: "Volg de stappen in de NL Wallet app",
5698
+ help_title: "Nog geen Wallet app? Of hulp nodig?",
5699
+ help_to_website: "Naar Wallet website",
5700
+ in_progress_title: "Volg de stappen in de Wallet app",
5677
5701
  loading_title: "Even geduld",
5678
5702
  loading_body: "De gegevens worden opgehaald",
5679
- qr_code_title: "Scan de QR-code met je NL Wallet app",
5703
+ qr_code_title: "Scan de QR-code met je Wallet app",
5680
5704
  qr_code_label: "QR code",
5681
5705
  success_title: "Gelukt!",
5682
5706
  success_body: "Sluit deze pagina en ga verder in het nieuw geopende tabblad."
@@ -7235,7 +7259,7 @@ const tf = /* @__PURE__ */ ai(qu, [["render", ef]]), sf = {
7235
7259
  x("aside", {
7236
7260
  "aria-modal": "true",
7237
7261
  role: "dialog",
7238
- "aria-label": "NL Wallet",
7262
+ "aria-label": "Wallet",
7239
7263
  class: ut(["modal", [i.value.kind, i.value.kind === "success" && i.value.session.sessionType]]),
7240
7264
  "data-testid": "wallet_modal"
7241
7265
  }, [
@@ -7290,7 +7314,7 @@ const tf = /* @__PURE__ */ ai(qu, [["render", ef]]), sf = {
7290
7314
  x("aside", {
7291
7315
  "aria-modal": "true",
7292
7316
  role: "dialog",
7293
- "aria-label": "NL Wallet",
7317
+ "aria-label": "Wallet",
7294
7318
  class: ut(["modal", [o.value.kind, o.value.kind === "success" && o.value.session.sessionType]]),
7295
7319
  "data-testid": "wallet_modal"
7296
7320
  }, [