wallet-connect-button-react 1.1.4 → 1.1.6

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.
@@ -10,9 +10,8 @@ export interface WalletConnectButtonProps {
10
10
  apiKey?: string;
11
11
  walletConnectHost?: string;
12
12
  lang?: string;
13
- sameDeviceUl?: string;
14
- crossDeviceUl?: string;
15
13
  helpBaseUrl?: string;
14
+ issuance?: boolean;
16
15
  }
17
16
  declare global {
18
17
  namespace JSX {
@@ -30,5 +29,5 @@ declare global {
30
29
  }
31
30
  }
32
31
  }
33
- declare function WalletConnectButton({ label, clientId, onSuccess, apiKey, walletConnectHost, lang, sameDeviceUl, crossDeviceUl, helpBaseUrl }: WalletConnectButtonProps): import("react/jsx-runtime").JSX.Element;
32
+ declare function WalletConnectButton({ label, clientId, onSuccess, apiKey, walletConnectHost, lang, helpBaseUrl, issuance }: WalletConnectButtonProps): import("react/jsx-runtime").JSX.Element;
34
33
  export default WalletConnectButton;
package/dist/index.esm.js CHANGED
@@ -1,4 +1,5 @@
1
- import require$$0, { useState, useCallback, useEffect, useRef } from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { useState, useCallback, useEffect, useRef } from 'react';
2
3
  import axios from 'axios';
3
4
 
4
5
  function _mergeNamespaces(n, m) {
@@ -76,427 +77,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
76
77
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
77
78
  };
78
79
 
79
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
80
-
81
- var jsxRuntime = {exports: {}};
82
-
83
- var reactJsxRuntime_production = {};
84
-
85
- /**
86
- * @license React
87
- * react-jsx-runtime.production.js
88
- *
89
- * Copyright (c) Meta Platforms, Inc. and affiliates.
90
- *
91
- * This source code is licensed under the MIT license found in the
92
- * LICENSE file in the root directory of this source tree.
93
- */
94
-
95
- var hasRequiredReactJsxRuntime_production;
96
-
97
- function requireReactJsxRuntime_production () {
98
- if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
99
- hasRequiredReactJsxRuntime_production = 1;
100
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
101
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
102
- function jsxProd(type, config, maybeKey) {
103
- var key = null;
104
- void 0 !== maybeKey && (key = "" + maybeKey);
105
- void 0 !== config.key && (key = "" + config.key);
106
- if ("key" in config) {
107
- maybeKey = {};
108
- for (var propName in config)
109
- "key" !== propName && (maybeKey[propName] = config[propName]);
110
- } else maybeKey = config;
111
- config = maybeKey.ref;
112
- return {
113
- $$typeof: REACT_ELEMENT_TYPE,
114
- type: type,
115
- key: key,
116
- ref: void 0 !== config ? config : null,
117
- props: maybeKey
118
- };
119
- }
120
- reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
121
- reactJsxRuntime_production.jsx = jsxProd;
122
- reactJsxRuntime_production.jsxs = jsxProd;
123
- return reactJsxRuntime_production;
124
- }
125
-
126
- var reactJsxRuntime_development = {};
127
-
128
- /**
129
- * @license React
130
- * react-jsx-runtime.development.js
131
- *
132
- * Copyright (c) Meta Platforms, Inc. and affiliates.
133
- *
134
- * This source code is licensed under the MIT license found in the
135
- * LICENSE file in the root directory of this source tree.
136
- */
137
-
138
- var hasRequiredReactJsxRuntime_development;
139
-
140
- function requireReactJsxRuntime_development () {
141
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
142
- hasRequiredReactJsxRuntime_development = 1;
143
- "production" !== process.env.NODE_ENV &&
144
- (function () {
145
- function getComponentNameFromType(type) {
146
- if (null == type) return null;
147
- if ("function" === typeof type)
148
- return type.$$typeof === REACT_CLIENT_REFERENCE
149
- ? null
150
- : type.displayName || type.name || null;
151
- if ("string" === typeof type) return type;
152
- switch (type) {
153
- case REACT_FRAGMENT_TYPE:
154
- return "Fragment";
155
- case REACT_PROFILER_TYPE:
156
- return "Profiler";
157
- case REACT_STRICT_MODE_TYPE:
158
- return "StrictMode";
159
- case REACT_SUSPENSE_TYPE:
160
- return "Suspense";
161
- case REACT_SUSPENSE_LIST_TYPE:
162
- return "SuspenseList";
163
- case REACT_ACTIVITY_TYPE:
164
- return "Activity";
165
- }
166
- if ("object" === typeof type)
167
- switch (
168
- ("number" === typeof type.tag &&
169
- console.error(
170
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
171
- ),
172
- type.$$typeof)
173
- ) {
174
- case REACT_PORTAL_TYPE:
175
- return "Portal";
176
- case REACT_CONTEXT_TYPE:
177
- return (type.displayName || "Context") + ".Provider";
178
- case REACT_CONSUMER_TYPE:
179
- return (type._context.displayName || "Context") + ".Consumer";
180
- case REACT_FORWARD_REF_TYPE:
181
- var innerType = type.render;
182
- type = type.displayName;
183
- type ||
184
- ((type = innerType.displayName || innerType.name || ""),
185
- (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
186
- return type;
187
- case REACT_MEMO_TYPE:
188
- return (
189
- (innerType = type.displayName || null),
190
- null !== innerType
191
- ? innerType
192
- : getComponentNameFromType(type.type) || "Memo"
193
- );
194
- case REACT_LAZY_TYPE:
195
- innerType = type._payload;
196
- type = type._init;
197
- try {
198
- return getComponentNameFromType(type(innerType));
199
- } catch (x) {}
200
- }
201
- return null;
202
- }
203
- function testStringCoercion(value) {
204
- return "" + value;
205
- }
206
- function checkKeyStringCoercion(value) {
207
- try {
208
- testStringCoercion(value);
209
- var JSCompiler_inline_result = !1;
210
- } catch (e) {
211
- JSCompiler_inline_result = true;
212
- }
213
- if (JSCompiler_inline_result) {
214
- JSCompiler_inline_result = console;
215
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
216
- var JSCompiler_inline_result$jscomp$0 =
217
- ("function" === typeof Symbol &&
218
- Symbol.toStringTag &&
219
- value[Symbol.toStringTag]) ||
220
- value.constructor.name ||
221
- "Object";
222
- JSCompiler_temp_const.call(
223
- JSCompiler_inline_result,
224
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
225
- JSCompiler_inline_result$jscomp$0
226
- );
227
- return testStringCoercion(value);
228
- }
229
- }
230
- function getTaskName(type) {
231
- if (type === REACT_FRAGMENT_TYPE) return "<>";
232
- if (
233
- "object" === typeof type &&
234
- null !== type &&
235
- type.$$typeof === REACT_LAZY_TYPE
236
- )
237
- return "<...>";
238
- try {
239
- var name = getComponentNameFromType(type);
240
- return name ? "<" + name + ">" : "<...>";
241
- } catch (x) {
242
- return "<...>";
243
- }
244
- }
245
- function getOwner() {
246
- var dispatcher = ReactSharedInternals.A;
247
- return null === dispatcher ? null : dispatcher.getOwner();
248
- }
249
- function UnknownOwner() {
250
- return Error("react-stack-top-frame");
251
- }
252
- function hasValidKey(config) {
253
- if (hasOwnProperty.call(config, "key")) {
254
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
255
- if (getter && getter.isReactWarning) return false;
256
- }
257
- return void 0 !== config.key;
258
- }
259
- function defineKeyPropWarningGetter(props, displayName) {
260
- function warnAboutAccessingKey() {
261
- specialPropKeyWarningShown ||
262
- ((specialPropKeyWarningShown = true),
263
- console.error(
264
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
265
- displayName
266
- ));
267
- }
268
- warnAboutAccessingKey.isReactWarning = true;
269
- Object.defineProperty(props, "key", {
270
- get: warnAboutAccessingKey,
271
- configurable: true
272
- });
273
- }
274
- function elementRefGetterWithDeprecationWarning() {
275
- var componentName = getComponentNameFromType(this.type);
276
- didWarnAboutElementRef[componentName] ||
277
- ((didWarnAboutElementRef[componentName] = true),
278
- console.error(
279
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
280
- ));
281
- componentName = this.props.ref;
282
- return void 0 !== componentName ? componentName : null;
283
- }
284
- function ReactElement(
285
- type,
286
- key,
287
- self,
288
- source,
289
- owner,
290
- props,
291
- debugStack,
292
- debugTask
293
- ) {
294
- self = props.ref;
295
- type = {
296
- $$typeof: REACT_ELEMENT_TYPE,
297
- type: type,
298
- key: key,
299
- props: props,
300
- _owner: owner
301
- };
302
- null !== (void 0 !== self ? self : null)
303
- ? Object.defineProperty(type, "ref", {
304
- enumerable: false,
305
- get: elementRefGetterWithDeprecationWarning
306
- })
307
- : Object.defineProperty(type, "ref", { enumerable: false, value: null });
308
- type._store = {};
309
- Object.defineProperty(type._store, "validated", {
310
- configurable: false,
311
- enumerable: false,
312
- writable: true,
313
- value: 0
314
- });
315
- Object.defineProperty(type, "_debugInfo", {
316
- configurable: false,
317
- enumerable: false,
318
- writable: true,
319
- value: null
320
- });
321
- Object.defineProperty(type, "_debugStack", {
322
- configurable: false,
323
- enumerable: false,
324
- writable: true,
325
- value: debugStack
326
- });
327
- Object.defineProperty(type, "_debugTask", {
328
- configurable: false,
329
- enumerable: false,
330
- writable: true,
331
- value: debugTask
332
- });
333
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
334
- return type;
335
- }
336
- function jsxDEVImpl(
337
- type,
338
- config,
339
- maybeKey,
340
- isStaticChildren,
341
- source,
342
- self,
343
- debugStack,
344
- debugTask
345
- ) {
346
- var children = config.children;
347
- if (void 0 !== children)
348
- if (isStaticChildren)
349
- if (isArrayImpl(children)) {
350
- for (
351
- isStaticChildren = 0;
352
- isStaticChildren < children.length;
353
- isStaticChildren++
354
- )
355
- validateChildKeys(children[isStaticChildren]);
356
- Object.freeze && Object.freeze(children);
357
- } else
358
- console.error(
359
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
360
- );
361
- else validateChildKeys(children);
362
- if (hasOwnProperty.call(config, "key")) {
363
- children = getComponentNameFromType(type);
364
- var keys = Object.keys(config).filter(function (k) {
365
- return "key" !== k;
366
- });
367
- isStaticChildren =
368
- 0 < keys.length
369
- ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
370
- : "{key: someKey}";
371
- didWarnAboutKeySpread[children + isStaticChildren] ||
372
- ((keys =
373
- 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
374
- console.error(
375
- 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
376
- isStaticChildren,
377
- children,
378
- keys,
379
- children
380
- ),
381
- (didWarnAboutKeySpread[children + isStaticChildren] = true));
382
- }
383
- children = null;
384
- void 0 !== maybeKey &&
385
- (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
386
- hasValidKey(config) &&
387
- (checkKeyStringCoercion(config.key), (children = "" + config.key));
388
- if ("key" in config) {
389
- maybeKey = {};
390
- for (var propName in config)
391
- "key" !== propName && (maybeKey[propName] = config[propName]);
392
- } else maybeKey = config;
393
- children &&
394
- defineKeyPropWarningGetter(
395
- maybeKey,
396
- "function" === typeof type
397
- ? type.displayName || type.name || "Unknown"
398
- : type
399
- );
400
- return ReactElement(
401
- type,
402
- children,
403
- self,
404
- source,
405
- getOwner(),
406
- maybeKey,
407
- debugStack,
408
- debugTask
409
- );
410
- }
411
- function validateChildKeys(node) {
412
- "object" === typeof node &&
413
- null !== node &&
414
- node.$$typeof === REACT_ELEMENT_TYPE &&
415
- node._store &&
416
- (node._store.validated = 1);
417
- }
418
- var React = require$$0,
419
- REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
420
- REACT_PORTAL_TYPE = Symbol.for("react.portal"),
421
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
422
- REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
423
- REACT_PROFILER_TYPE = Symbol.for("react.profiler");
424
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
425
- REACT_CONTEXT_TYPE = Symbol.for("react.context"),
426
- REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
427
- REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
428
- REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
429
- REACT_MEMO_TYPE = Symbol.for("react.memo"),
430
- REACT_LAZY_TYPE = Symbol.for("react.lazy"),
431
- REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
432
- REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
433
- ReactSharedInternals =
434
- React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
435
- hasOwnProperty = Object.prototype.hasOwnProperty,
436
- isArrayImpl = Array.isArray,
437
- createTask = console.createTask
438
- ? console.createTask
439
- : function () {
440
- return null;
441
- };
442
- React = {
443
- "react-stack-bottom-frame": function (callStackForError) {
444
- return callStackForError();
445
- }
446
- };
447
- var specialPropKeyWarningShown;
448
- var didWarnAboutElementRef = {};
449
- var unknownOwnerDebugStack = React["react-stack-bottom-frame"].bind(
450
- React,
451
- UnknownOwner
452
- )();
453
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
454
- var didWarnAboutKeySpread = {};
455
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
456
- reactJsxRuntime_development.jsx = function (type, config, maybeKey, source, self) {
457
- var trackActualOwner =
458
- 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
459
- return jsxDEVImpl(
460
- type,
461
- config,
462
- maybeKey,
463
- false,
464
- source,
465
- self,
466
- trackActualOwner
467
- ? Error("react-stack-top-frame")
468
- : unknownOwnerDebugStack,
469
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
470
- );
471
- };
472
- reactJsxRuntime_development.jsxs = function (type, config, maybeKey, source, self) {
473
- var trackActualOwner =
474
- 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
475
- return jsxDEVImpl(
476
- type,
477
- config,
478
- maybeKey,
479
- true,
480
- source,
481
- self,
482
- trackActualOwner
483
- ? Error("react-stack-top-frame")
484
- : unknownOwnerDebugStack,
485
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
486
- );
487
- };
488
- })();
489
- return reactJsxRuntime_development;
490
- }
491
-
492
- if (process.env.NODE_ENV === 'production') {
493
- jsxRuntime.exports = requireReactJsxRuntime_production();
494
- } else {
495
- jsxRuntime.exports = requireReactJsxRuntime_development();
496
- }
497
-
498
- var jsxRuntimeExports = jsxRuntime.exports;
499
-
500
80
  function useSearchParams() {
501
81
  var _a = useState(function () {
502
82
  return new URLSearchParams(window.location.search);
@@ -526,13 +106,21 @@ function useSearchParams() {
526
106
  return [searchParams, setSearchParams, removeSearchParam];
527
107
  }
528
108
 
109
+ function constructURI(clientId, session_type) {
110
+ var request_uri = "https://issuance.wallet-connect.eu/disclosure/".concat(clientId, "/request_uri?session_type=").concat(session_type);
111
+ var request_uri_method = "post";
112
+ var client_id_uri = "".concat(clientId, ".example.com");
113
+ return "walletdebuginteraction://wallet.edi.rijksoverheid.nl/disclosure_based_issuance?request_uri=".concat(encodeURIComponent(request_uri), "&request_uri_method=").concat(request_uri_method, "&client_id=").concat(client_id_uri);
114
+ }
529
115
  function WalletConnectButton(_a) {
530
116
  var _this = this;
531
- var label = _a.label, clientId = _a.clientId, onSuccess = _a.onSuccess, apiKey = _a.apiKey, walletConnectHost = _a.walletConnectHost, lang = _a.lang, sameDeviceUl = _a.sameDeviceUl, crossDeviceUl = _a.crossDeviceUl, helpBaseUrl = _a.helpBaseUrl;
117
+ var label = _a.label, clientId = _a.clientId, onSuccess = _a.onSuccess, apiKey = _a.apiKey, walletConnectHost = _a.walletConnectHost, lang = _a.lang, helpBaseUrl = _a.helpBaseUrl, issuance = _a.issuance;
532
118
  var _b = useSearchParams(), searchParams = _b[0], setSearchParams = _b[1], removeSearchParam = _b[2];
533
119
  var _c = useState(false), loading = _c[0], setLoading = _c[1];
534
120
  var _d = useState(null), error = _d[0], setError = _d[1];
535
121
  var buttonRef = useRef(null);
122
+ var sameDeviceUl = constructURI(clientId, "same_device");
123
+ var crossDeviceUl = constructURI(clientId, "cross_device");
536
124
  useEffect(function () {
537
125
  // Dynamically import the web component
538
126
  var loadWebComponent = function () { return __awaiter(_this, void 0, void 0, function () {
@@ -621,14 +209,16 @@ function WalletConnectButton(_a) {
621
209
  });
622
210
  }, [searchParams, onSuccess]);
623
211
  if (loading) {
624
- return (jsxRuntimeExports.jsx("div", { className: "attributes", children: jsxRuntimeExports.jsxs("div", { className: "verification-card", children: [jsxRuntimeExports.jsx("h2", { children: "Checking attributes..." }), jsxRuntimeExports.jsx("p", { children: "Please wait while we verify your attributes." })] }) }));
212
+ return (jsx("div", { className: "attributes", children: jsxs("div", { className: "verification-card", children: [jsx("h2", { children: "Checking attributes..." }), jsx("p", { children: "Please wait while we verify your attributes." })] }) }));
625
213
  }
626
214
  if (error) {
627
- 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] })] }) }));
215
+ 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] })] }) }));
628
216
  }
629
- return (jsxRuntimeExports.jsx("nl-wallet-button", { ref: buttonRef, text: label, 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", "same-device-ul": sameDeviceUl, "cross-device-ul": crossDeviceUl, "help-base-url": helpBaseUrl }));
217
+ return (jsx("nl-wallet-button", { ref: buttonRef, text: label, usecase: issuance ? "" : clientId, "start-url": "".concat(walletConnectHost || "https://wallet-connect.eu", "/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 }));
630
218
  }
631
219
 
220
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
221
+
632
222
  var nlWalletWeb$1 = {};
633
223
 
634
224
  var di = Object.defineProperty;