wallet-connect-button-react 1.1.5 → 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.
package/dist/index.js CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var require$$0 = require('react');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var react = require('react');
6
7
  var axios = require('axios');
7
8
 
8
9
  function _mergeNamespaces(n, m) {
@@ -80,432 +81,11 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
80
81
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
81
82
  };
82
83
 
83
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
84
-
85
- var jsxRuntime = {exports: {}};
86
-
87
- var reactJsxRuntime_production = {};
88
-
89
- /**
90
- * @license React
91
- * react-jsx-runtime.production.js
92
- *
93
- * Copyright (c) Meta Platforms, Inc. and affiliates.
94
- *
95
- * This source code is licensed under the MIT license found in the
96
- * LICENSE file in the root directory of this source tree.
97
- */
98
-
99
- var hasRequiredReactJsxRuntime_production;
100
-
101
- function requireReactJsxRuntime_production () {
102
- if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
103
- hasRequiredReactJsxRuntime_production = 1;
104
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
105
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
106
- function jsxProd(type, config, maybeKey) {
107
- var key = null;
108
- void 0 !== maybeKey && (key = "" + maybeKey);
109
- void 0 !== config.key && (key = "" + config.key);
110
- if ("key" in config) {
111
- maybeKey = {};
112
- for (var propName in config)
113
- "key" !== propName && (maybeKey[propName] = config[propName]);
114
- } else maybeKey = config;
115
- config = maybeKey.ref;
116
- return {
117
- $$typeof: REACT_ELEMENT_TYPE,
118
- type: type,
119
- key: key,
120
- ref: void 0 !== config ? config : null,
121
- props: maybeKey
122
- };
123
- }
124
- reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
125
- reactJsxRuntime_production.jsx = jsxProd;
126
- reactJsxRuntime_production.jsxs = jsxProd;
127
- return reactJsxRuntime_production;
128
- }
129
-
130
- var reactJsxRuntime_development = {};
131
-
132
- /**
133
- * @license React
134
- * react-jsx-runtime.development.js
135
- *
136
- * Copyright (c) Meta Platforms, Inc. and affiliates.
137
- *
138
- * This source code is licensed under the MIT license found in the
139
- * LICENSE file in the root directory of this source tree.
140
- */
141
-
142
- var hasRequiredReactJsxRuntime_development;
143
-
144
- function requireReactJsxRuntime_development () {
145
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
146
- hasRequiredReactJsxRuntime_development = 1;
147
- "production" !== process.env.NODE_ENV &&
148
- (function () {
149
- function getComponentNameFromType(type) {
150
- if (null == type) return null;
151
- if ("function" === typeof type)
152
- return type.$$typeof === REACT_CLIENT_REFERENCE
153
- ? null
154
- : type.displayName || type.name || null;
155
- if ("string" === typeof type) return type;
156
- switch (type) {
157
- case REACT_FRAGMENT_TYPE:
158
- return "Fragment";
159
- case REACT_PROFILER_TYPE:
160
- return "Profiler";
161
- case REACT_STRICT_MODE_TYPE:
162
- return "StrictMode";
163
- case REACT_SUSPENSE_TYPE:
164
- return "Suspense";
165
- case REACT_SUSPENSE_LIST_TYPE:
166
- return "SuspenseList";
167
- case REACT_ACTIVITY_TYPE:
168
- return "Activity";
169
- }
170
- if ("object" === typeof type)
171
- switch (
172
- ("number" === typeof type.tag &&
173
- console.error(
174
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
175
- ),
176
- type.$$typeof)
177
- ) {
178
- case REACT_PORTAL_TYPE:
179
- return "Portal";
180
- case REACT_CONTEXT_TYPE:
181
- return (type.displayName || "Context") + ".Provider";
182
- case REACT_CONSUMER_TYPE:
183
- return (type._context.displayName || "Context") + ".Consumer";
184
- case REACT_FORWARD_REF_TYPE:
185
- var innerType = type.render;
186
- type = type.displayName;
187
- type ||
188
- ((type = innerType.displayName || innerType.name || ""),
189
- (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
190
- return type;
191
- case REACT_MEMO_TYPE:
192
- return (
193
- (innerType = type.displayName || null),
194
- null !== innerType
195
- ? innerType
196
- : getComponentNameFromType(type.type) || "Memo"
197
- );
198
- case REACT_LAZY_TYPE:
199
- innerType = type._payload;
200
- type = type._init;
201
- try {
202
- return getComponentNameFromType(type(innerType));
203
- } catch (x) {}
204
- }
205
- return null;
206
- }
207
- function testStringCoercion(value) {
208
- return "" + value;
209
- }
210
- function checkKeyStringCoercion(value) {
211
- try {
212
- testStringCoercion(value);
213
- var JSCompiler_inline_result = !1;
214
- } catch (e) {
215
- JSCompiler_inline_result = true;
216
- }
217
- if (JSCompiler_inline_result) {
218
- JSCompiler_inline_result = console;
219
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
220
- var JSCompiler_inline_result$jscomp$0 =
221
- ("function" === typeof Symbol &&
222
- Symbol.toStringTag &&
223
- value[Symbol.toStringTag]) ||
224
- value.constructor.name ||
225
- "Object";
226
- JSCompiler_temp_const.call(
227
- JSCompiler_inline_result,
228
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
229
- JSCompiler_inline_result$jscomp$0
230
- );
231
- return testStringCoercion(value);
232
- }
233
- }
234
- function getTaskName(type) {
235
- if (type === REACT_FRAGMENT_TYPE) return "<>";
236
- if (
237
- "object" === typeof type &&
238
- null !== type &&
239
- type.$$typeof === REACT_LAZY_TYPE
240
- )
241
- return "<...>";
242
- try {
243
- var name = getComponentNameFromType(type);
244
- return name ? "<" + name + ">" : "<...>";
245
- } catch (x) {
246
- return "<...>";
247
- }
248
- }
249
- function getOwner() {
250
- var dispatcher = ReactSharedInternals.A;
251
- return null === dispatcher ? null : dispatcher.getOwner();
252
- }
253
- function UnknownOwner() {
254
- return Error("react-stack-top-frame");
255
- }
256
- function hasValidKey(config) {
257
- if (hasOwnProperty.call(config, "key")) {
258
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
259
- if (getter && getter.isReactWarning) return false;
260
- }
261
- return void 0 !== config.key;
262
- }
263
- function defineKeyPropWarningGetter(props, displayName) {
264
- function warnAboutAccessingKey() {
265
- specialPropKeyWarningShown ||
266
- ((specialPropKeyWarningShown = true),
267
- console.error(
268
- "%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)",
269
- displayName
270
- ));
271
- }
272
- warnAboutAccessingKey.isReactWarning = true;
273
- Object.defineProperty(props, "key", {
274
- get: warnAboutAccessingKey,
275
- configurable: true
276
- });
277
- }
278
- function elementRefGetterWithDeprecationWarning() {
279
- var componentName = getComponentNameFromType(this.type);
280
- didWarnAboutElementRef[componentName] ||
281
- ((didWarnAboutElementRef[componentName] = true),
282
- console.error(
283
- "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."
284
- ));
285
- componentName = this.props.ref;
286
- return void 0 !== componentName ? componentName : null;
287
- }
288
- function ReactElement(
289
- type,
290
- key,
291
- self,
292
- source,
293
- owner,
294
- props,
295
- debugStack,
296
- debugTask
297
- ) {
298
- self = props.ref;
299
- type = {
300
- $$typeof: REACT_ELEMENT_TYPE,
301
- type: type,
302
- key: key,
303
- props: props,
304
- _owner: owner
305
- };
306
- null !== (void 0 !== self ? self : null)
307
- ? Object.defineProperty(type, "ref", {
308
- enumerable: false,
309
- get: elementRefGetterWithDeprecationWarning
310
- })
311
- : Object.defineProperty(type, "ref", { enumerable: false, value: null });
312
- type._store = {};
313
- Object.defineProperty(type._store, "validated", {
314
- configurable: false,
315
- enumerable: false,
316
- writable: true,
317
- value: 0
318
- });
319
- Object.defineProperty(type, "_debugInfo", {
320
- configurable: false,
321
- enumerable: false,
322
- writable: true,
323
- value: null
324
- });
325
- Object.defineProperty(type, "_debugStack", {
326
- configurable: false,
327
- enumerable: false,
328
- writable: true,
329
- value: debugStack
330
- });
331
- Object.defineProperty(type, "_debugTask", {
332
- configurable: false,
333
- enumerable: false,
334
- writable: true,
335
- value: debugTask
336
- });
337
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
338
- return type;
339
- }
340
- function jsxDEVImpl(
341
- type,
342
- config,
343
- maybeKey,
344
- isStaticChildren,
345
- source,
346
- self,
347
- debugStack,
348
- debugTask
349
- ) {
350
- var children = config.children;
351
- if (void 0 !== children)
352
- if (isStaticChildren)
353
- if (isArrayImpl(children)) {
354
- for (
355
- isStaticChildren = 0;
356
- isStaticChildren < children.length;
357
- isStaticChildren++
358
- )
359
- validateChildKeys(children[isStaticChildren]);
360
- Object.freeze && Object.freeze(children);
361
- } else
362
- console.error(
363
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
364
- );
365
- else validateChildKeys(children);
366
- if (hasOwnProperty.call(config, "key")) {
367
- children = getComponentNameFromType(type);
368
- var keys = Object.keys(config).filter(function (k) {
369
- return "key" !== k;
370
- });
371
- isStaticChildren =
372
- 0 < keys.length
373
- ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
374
- : "{key: someKey}";
375
- didWarnAboutKeySpread[children + isStaticChildren] ||
376
- ((keys =
377
- 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
378
- console.error(
379
- '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} />',
380
- isStaticChildren,
381
- children,
382
- keys,
383
- children
384
- ),
385
- (didWarnAboutKeySpread[children + isStaticChildren] = true));
386
- }
387
- children = null;
388
- void 0 !== maybeKey &&
389
- (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
390
- hasValidKey(config) &&
391
- (checkKeyStringCoercion(config.key), (children = "" + config.key));
392
- if ("key" in config) {
393
- maybeKey = {};
394
- for (var propName in config)
395
- "key" !== propName && (maybeKey[propName] = config[propName]);
396
- } else maybeKey = config;
397
- children &&
398
- defineKeyPropWarningGetter(
399
- maybeKey,
400
- "function" === typeof type
401
- ? type.displayName || type.name || "Unknown"
402
- : type
403
- );
404
- return ReactElement(
405
- type,
406
- children,
407
- self,
408
- source,
409
- getOwner(),
410
- maybeKey,
411
- debugStack,
412
- debugTask
413
- );
414
- }
415
- function validateChildKeys(node) {
416
- "object" === typeof node &&
417
- null !== node &&
418
- node.$$typeof === REACT_ELEMENT_TYPE &&
419
- node._store &&
420
- (node._store.validated = 1);
421
- }
422
- var React = require$$0,
423
- REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
424
- REACT_PORTAL_TYPE = Symbol.for("react.portal"),
425
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
426
- REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
427
- REACT_PROFILER_TYPE = Symbol.for("react.profiler");
428
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
429
- REACT_CONTEXT_TYPE = Symbol.for("react.context"),
430
- REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
431
- REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
432
- REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
433
- REACT_MEMO_TYPE = Symbol.for("react.memo"),
434
- REACT_LAZY_TYPE = Symbol.for("react.lazy"),
435
- REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
436
- REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
437
- ReactSharedInternals =
438
- React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
439
- hasOwnProperty = Object.prototype.hasOwnProperty,
440
- isArrayImpl = Array.isArray,
441
- createTask = console.createTask
442
- ? console.createTask
443
- : function () {
444
- return null;
445
- };
446
- React = {
447
- "react-stack-bottom-frame": function (callStackForError) {
448
- return callStackForError();
449
- }
450
- };
451
- var specialPropKeyWarningShown;
452
- var didWarnAboutElementRef = {};
453
- var unknownOwnerDebugStack = React["react-stack-bottom-frame"].bind(
454
- React,
455
- UnknownOwner
456
- )();
457
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
458
- var didWarnAboutKeySpread = {};
459
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
460
- reactJsxRuntime_development.jsx = function (type, config, maybeKey, source, self) {
461
- var trackActualOwner =
462
- 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
463
- return jsxDEVImpl(
464
- type,
465
- config,
466
- maybeKey,
467
- false,
468
- source,
469
- self,
470
- trackActualOwner
471
- ? Error("react-stack-top-frame")
472
- : unknownOwnerDebugStack,
473
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
474
- );
475
- };
476
- reactJsxRuntime_development.jsxs = function (type, config, maybeKey, source, self) {
477
- var trackActualOwner =
478
- 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
479
- return jsxDEVImpl(
480
- type,
481
- config,
482
- maybeKey,
483
- true,
484
- source,
485
- self,
486
- trackActualOwner
487
- ? Error("react-stack-top-frame")
488
- : unknownOwnerDebugStack,
489
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
490
- );
491
- };
492
- })();
493
- return reactJsxRuntime_development;
494
- }
495
-
496
- if (process.env.NODE_ENV === 'production') {
497
- jsxRuntime.exports = requireReactJsxRuntime_production();
498
- } else {
499
- jsxRuntime.exports = requireReactJsxRuntime_development();
500
- }
501
-
502
- var jsxRuntimeExports = jsxRuntime.exports;
503
-
504
84
  function useSearchParams() {
505
- var _a = require$$0.useState(function () {
85
+ var _a = react.useState(function () {
506
86
  return new URLSearchParams(window.location.search);
507
87
  }), searchParams = _a[0], setSearchParamsState = _a[1];
508
- var setSearchParams = require$$0.useCallback(function (params) {
88
+ var setSearchParams = react.useCallback(function (params) {
509
89
  var url = new URL(window.location.href);
510
90
  Object.entries(params).forEach(function (_a) {
511
91
  var key = _a[0], value = _a[1];
@@ -514,13 +94,13 @@ function useSearchParams() {
514
94
  window.history.replaceState({}, '', url.toString());
515
95
  setSearchParamsState(new URLSearchParams(url.search));
516
96
  }, []);
517
- var removeSearchParam = require$$0.useCallback(function (paramName) {
97
+ var removeSearchParam = react.useCallback(function (paramName) {
518
98
  var url = new URL(window.location.href);
519
99
  url.searchParams.delete(paramName);
520
100
  window.history.replaceState({}, '', url.toString());
521
101
  setSearchParamsState(new URLSearchParams(url.search));
522
102
  }, []);
523
- require$$0.useEffect(function () {
103
+ react.useEffect(function () {
524
104
  var handlePopState = function () {
525
105
  setSearchParamsState(new URLSearchParams(window.location.search));
526
106
  };
@@ -540,12 +120,12 @@ function WalletConnectButton(_a) {
540
120
  var _this = this;
541
121
  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;
542
122
  var _b = useSearchParams(), searchParams = _b[0], setSearchParams = _b[1], removeSearchParam = _b[2];
543
- var _c = require$$0.useState(false), loading = _c[0], setLoading = _c[1];
544
- var _d = require$$0.useState(null), error = _d[0], setError = _d[1];
545
- var buttonRef = require$$0.useRef(null);
123
+ var _c = react.useState(false), loading = _c[0], setLoading = _c[1];
124
+ var _d = react.useState(null), error = _d[0], setError = _d[1];
125
+ var buttonRef = react.useRef(null);
546
126
  var sameDeviceUl = constructURI(clientId, "same_device");
547
127
  var crossDeviceUl = constructURI(clientId, "cross_device");
548
- require$$0.useEffect(function () {
128
+ react.useEffect(function () {
549
129
  // Dynamically import the web component
550
130
  var loadWebComponent = function () { return __awaiter(_this, void 0, void 0, function () {
551
131
  var button, error_1;
@@ -598,7 +178,7 @@ function WalletConnectButton(_a) {
598
178
  var customEvent = e;
599
179
  console.log("Failed event received:", customEvent.detail);
600
180
  };
601
- require$$0.useEffect(function () {
181
+ react.useEffect(function () {
602
182
  var session_token = searchParams.get("session_token");
603
183
  var nonce = searchParams.get("nonce");
604
184
  if (!session_token)
@@ -633,14 +213,16 @@ function WalletConnectButton(_a) {
633
213
  });
634
214
  }, [searchParams, onSuccess]);
635
215
  if (loading) {
636
- 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." })] }) }));
216
+ return (jsxRuntime.jsx("div", { className: "attributes", children: jsxRuntime.jsxs("div", { className: "verification-card", children: [jsxRuntime.jsx("h2", { children: "Checking attributes..." }), jsxRuntime.jsx("p", { children: "Please wait while we verify your attributes." })] }) }));
637
217
  }
638
218
  if (error) {
639
- 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] })] }) }));
219
+ 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] })] }) }));
640
220
  }
641
- return (jsxRuntimeExports.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 }));
221
+ return (jsxRuntime.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 }));
642
222
  }
643
223
 
224
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
225
+
644
226
  var nlWalletWeb$1 = {};
645
227
 
646
228
  var di = Object.defineProperty;