wallet-connect-button-vue 1.0.9 → 1.0.11

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
@@ -38,7 +38,7 @@ const _hoisted_2 = {
38
38
  class: "attributes"
39
39
  };
40
40
  const _hoisted_3 = { class: "verification-card" };
41
- const _hoisted_4 = ["text", "usecase", "start-url", "lang"];
41
+ const _hoisted_4 = ["text", "usecase", "start-url", "lang", "help-base-url", "same-device-ul", "cross-device-ul"];
42
42
 
43
43
 
44
44
  const _sfc_main = {
@@ -46,10 +46,12 @@ const _sfc_main = {
46
46
  props: {
47
47
  label: { type: String, required: false, default: 'Inloggen met NL Wallet' },
48
48
  clientId: { type: String, required: true },
49
- onSuccess: { type: Function, required: true },
49
+ onSuccess: { type: Function, required: false },
50
50
  apiKey: { type: String, required: false },
51
51
  walletConnectHost: { type: String, required: false },
52
- lang: { type: String, required: false, default: 'nl' }
52
+ lang: { type: String, required: false, default: 'nl' },
53
+ helpBaseUrl: { type: String, required: false },
54
+ issuance: { type: Boolean, required: false }
53
55
  },
54
56
  setup(__props) {
55
57
 
@@ -66,6 +68,17 @@ const startUrl = computed(() => {
66
68
  return `${baseUrl}/api/create-session?lang=en&return_url=${encodeURIComponent(returnUrl)}`;
67
69
  });
68
70
 
71
+ const constructURI = (session_type) => {
72
+ const request_uri = `https://issuance.wallet-connect.eu/disclosure/${props.clientId}/request_uri?session_type=${session_type}`;
73
+ const request_uri_method = "post";
74
+ const client_id_uri = `${props.clientId}.example.com`;
75
+
76
+ 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}`;
77
+ };
78
+
79
+ const sameDeviceUl = computed(() => constructURI("same_device"));
80
+ const crossDeviceUl = computed(() => constructURI("cross_device"));
81
+
69
82
  const handleSuccess = (e) => {
70
83
  const customEvent = e;
71
84
  if (customEvent.detail && customEvent.detail.length > 1) {
@@ -114,7 +127,9 @@ const fetchDisclosedAttributes = async () => {
114
127
  try {
115
128
  const { data } = await axios.get(url, { headers });
116
129
  console.log("Disclosed attributes:", data);
117
- props.onSuccess(data);
130
+ if (props.onSuccess) {
131
+ props.onSuccess(data);
132
+ }
118
133
  removeSearchParam('session_token');
119
134
  if (nonce) removeSearchParam('nonce');
120
135
  loading.value = false;
@@ -162,9 +177,12 @@ return (_ctx, _cache) => {
162
177
  ref_key: "buttonRef",
163
178
  ref: buttonRef,
164
179
  text: props.label,
165
- usecase: __props.clientId,
180
+ usecase: props.issuance ? '' : __props.clientId,
166
181
  "start-url": startUrl.value,
167
- lang: props.lang
182
+ lang: props.lang,
183
+ "help-base-url": props.helpBaseUrl,
184
+ "same-device-ul": sameDeviceUl.value,
185
+ "cross-device-ul": crossDeviceUl.value
168
186
  }, null, 8 /* PROPS */, _hoisted_4))
169
187
  }
170
188
  }