@paywithglide/glide-react 0.0.21 → 0.0.22

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.
Files changed (2) hide show
  1. package/dist/glide.js +50 -47
  2. package/package.json +1 -1
package/dist/glide.js CHANGED
@@ -8,24 +8,24 @@ function B(s, { strict: t = !0 } = {}) {
8
8
  function D(s) {
9
9
  return B(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
10
10
  }
11
- const M = "2.21.51";
12
- let w = {
11
+ const A = "2.21.51";
12
+ let y = {
13
13
  getDocsUrl: ({ docsBaseUrl: s, docsPath: t = "", docsSlug: e }) => t ? `${s ?? "https://viem.sh"}${t}${e ? `#${e}` : ""}` : void 0,
14
- version: `viem@${M}`
14
+ version: `viem@${A}`
15
15
  };
16
- class y extends Error {
16
+ class w extends Error {
17
17
  constructor(t, e = {}) {
18
18
  var o;
19
19
  const i = (() => {
20
20
  var a;
21
- return e.cause instanceof y ? e.cause.details : (a = e.cause) != null && a.message ? e.cause.message : e.details;
22
- })(), n = e.cause instanceof y && e.cause.docsPath || e.docsPath, r = (o = w.getDocsUrl) == null ? void 0 : o.call(w, { ...e, docsPath: n }), d = [
21
+ return e.cause instanceof w ? e.cause.details : (a = e.cause) != null && a.message ? e.cause.message : e.details;
22
+ })(), n = e.cause instanceof w && e.cause.docsPath || e.docsPath, r = (o = y.getDocsUrl) == null ? void 0 : o.call(y, { ...e, docsPath: n }), d = [
23
23
  t || "An error occurred.",
24
24
  "",
25
25
  ...e.metaMessages ? [...e.metaMessages, ""] : [],
26
26
  ...r ? [`Docs: ${r}`] : [],
27
27
  ...i ? [`Details: ${i}`] : [],
28
- ...w.version ? [`Version: ${w.version}`] : []
28
+ ...y.version ? [`Version: ${y.version}`] : []
29
29
  ].join(`
30
30
  `);
31
31
  super(d, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
@@ -58,16 +58,16 @@ class y extends Error {
58
58
  configurable: !0,
59
59
  writable: !0,
60
60
  value: "BaseError"
61
- }), this.details = i, this.docsPath = n, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version = M;
61
+ }), this.details = i, this.docsPath = n, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version = A;
62
62
  }
63
63
  walk(t) {
64
- return A(this, t);
64
+ return M(this, t);
65
65
  }
66
66
  }
67
- function A(s, t) {
68
- return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? A(s.cause, t) : t ? null : s;
67
+ function M(s, t) {
68
+ return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? M(s.cause, t) : t ? null : s;
69
69
  }
70
- class k extends y {
70
+ class k extends w {
71
71
  constructor({ size: t, targetSize: e, type: i }) {
72
72
  super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`, { name: "SizeExceedsPaddingSizeError" });
73
73
  }
@@ -103,12 +103,12 @@ function L(s, { dir: t, size: e = 32 } = {}) {
103
103
  }
104
104
  return i;
105
105
  }
106
- class O extends y {
106
+ class O extends w {
107
107
  constructor({ max: t, min: e, signed: i, size: n, value: r }) {
108
108
  super(`Number "${r}" is not in safe ${n ? `${n * 8}-bit ${i ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${e} to ${t})` : `(above ${e})`}`, { name: "IntegerOutOfRangeError" });
109
109
  }
110
110
  }
111
- class N extends y {
111
+ class N extends w {
112
112
  constructor({ givenSize: t, maxSize: e }) {
113
113
  super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
114
114
  }
@@ -173,7 +173,7 @@ class $ {
173
173
  }
174
174
  });
175
175
  b(this, "iframeEventHandler", async (t) => {
176
- var i, n, r, d, o, a, p, l, h, u, f, c, m, I, P, E, z, U, T, S;
176
+ var i, n, r, d, o, a, p, c, h, u, f, l, m, I, P, E, z, U, T, S;
177
177
  const e = t.data;
178
178
  switch (e.type) {
179
179
  case "success":
@@ -191,7 +191,7 @@ class $ {
191
191
  try {
192
192
  await this.opts.walletProvider.switchChainAsync({
193
193
  chainId: e.chainId
194
- }), (l = (p = this.iframe) == null ? void 0 : p.contentWindow) == null || l.postMessage(
194
+ }), (c = (p = this.iframe) == null ? void 0 : p.contentWindow) == null || c.postMessage(
195
195
  {
196
196
  type: "didSwitchChain",
197
197
  success: !0,
@@ -218,7 +218,7 @@ class $ {
218
218
  const g = await this.opts.walletProvider.sendTransactionAsync(
219
219
  e.tx
220
220
  );
221
- (c = (f = this.iframe) == null ? void 0 : f.contentWindow) == null || c.postMessage(
221
+ (l = (f = this.iframe) == null ? void 0 : f.contentWindow) == null || l.postMessage(
222
222
  {
223
223
  type: "didSendTransaction",
224
224
  success: !0,
@@ -303,7 +303,10 @@ class $ {
303
303
  createIframe(t) {
304
304
  this.removeIframe();
305
305
  const e = document.createElement("iframe");
306
- e.id = "glide-deposit-iframe";
306
+ e.id = "glide-deposit-iframe", e.setAttribute(
307
+ "sandbox",
308
+ "allow-popups allow-popups-to-escape-sandbox allow-scripts allow-forms allow-modals"
309
+ );
307
310
  const i = this.opts.container;
308
311
  i ? e.setAttribute(
309
312
  "style",
@@ -312,10 +315,10 @@ class $ {
312
315
  "style",
313
316
  "z-index: 2147483647; display: block; background-color: transparent; border: 0px none transparent; overflow-x: hidden; overflow-y: auto; visibility: visible; margin: 0px; padding: 0px; -webkit-tap-highlight-color: transparent; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; opacity: 0;"
314
317
  ), e.onload = () => {
315
- var p, l, h, u;
316
- const n = this.opts.recipient, r = (p = this.opts.walletProvider) == null ? void 0 : p.address, d = (l = this.opts.walletProvider) == null ? void 0 : l.availableChainIds, o = (h = this.opts.walletProvider) == null ? void 0 : h.currentChainId, a = this.opts.preferGaslessPayment || !!((u = this.opts.walletProvider) != null && u.signTypedDataAsync);
318
+ var p, c, h, u;
319
+ const n = this.opts.recipient, r = (p = this.opts.walletProvider) == null ? void 0 : p.address, d = (c = this.opts.walletProvider) == null ? void 0 : c.availableChainIds, o = (h = this.opts.walletProvider) == null ? void 0 : h.currentChainId, a = this.opts.preferGaslessPayment || !!((u = this.opts.walletProvider) != null && u.signTypedDataAsync);
317
320
  e.style.opacity = "1", setTimeout(() => {
318
- var f, c, m;
321
+ var f, l, m;
319
322
  (f = e == null ? void 0 : e.contentWindow) == null || f.postMessage(
320
323
  {
321
324
  type: "initialize",
@@ -337,7 +340,7 @@ class $ {
337
340
  theme: this.opts.theme
338
341
  },
339
342
  new URL(this.baseUrl).origin
340
- ), (m = (c = this.opts).onOpen) == null || m.call(c);
343
+ ), (m = (l = this.opts).onOpen) == null || m.call(l);
341
344
  }, 10);
342
345
  }, e.src = t, e.allow = "payment *; clipboard-write *", i ? i.appendChild(e) : document.body.appendChild(e);
343
346
  }
@@ -357,11 +360,11 @@ const Y = ({
357
360
  sessionMetadata: o,
358
361
  theme: a,
359
362
  walletProvider: p,
360
- onOpen: l,
363
+ onOpen: c,
361
364
  onSuccess: h,
362
365
  onClose: u,
363
366
  autoCloseOnSuccess: f,
364
- baseUrl: c
367
+ baseUrl: l
365
368
  }) => {
366
369
  const m = v(() => new $({
367
370
  app: s,
@@ -374,11 +377,11 @@ const Y = ({
374
377
  sessionMetadata: o,
375
378
  theme: a,
376
379
  walletProvider: p,
377
- onOpen: l,
380
+ onOpen: c,
378
381
  onSuccess: h,
379
382
  onClose: u,
380
383
  autoCloseOnSuccess: f,
381
- baseUrl: c
384
+ baseUrl: l
382
385
  }), [
383
386
  s,
384
387
  t,
@@ -390,11 +393,11 @@ const Y = ({
390
393
  o,
391
394
  a,
392
395
  p,
393
- l,
396
+ c,
394
397
  h,
395
398
  u,
396
399
  f,
397
- c
400
+ l
398
401
  ]);
399
402
  return {
400
403
  openGlideDeposit: m.open,
@@ -412,11 +415,11 @@ const Y = ({
412
415
  sessionMetadata: o,
413
416
  theme: a,
414
417
  walletProvider: p,
415
- onOpen: l,
418
+ onOpen: c,
416
419
  onSuccess: h,
417
420
  onClose: u,
418
421
  autoCloseOnSuccess: f,
419
- baseUrl: c
422
+ baseUrl: l
420
423
  }) => {
421
424
  const m = v(() => new $({
422
425
  app: s,
@@ -430,11 +433,11 @@ const Y = ({
430
433
  sessionMetadata: o,
431
434
  theme: a,
432
435
  walletProvider: p,
433
- onOpen: l,
436
+ onOpen: c,
434
437
  onSuccess: h,
435
438
  onClose: u,
436
439
  autoCloseOnSuccess: f,
437
- baseUrl: c
440
+ baseUrl: l
438
441
  }), [
439
442
  s,
440
443
  t,
@@ -446,11 +449,11 @@ const Y = ({
446
449
  o,
447
450
  a,
448
451
  p,
449
- l,
452
+ c,
450
453
  h,
451
454
  u,
452
455
  f,
453
- c
456
+ l
454
457
  ]);
455
458
  return {
456
459
  openGlidePay: m.open,
@@ -468,11 +471,11 @@ const Y = ({
468
471
  sessionMetadata: o,
469
472
  theme: a,
470
473
  walletProvider: p,
471
- onOpen: l,
474
+ onOpen: c,
472
475
  onSuccess: h,
473
476
  onClose: u,
474
477
  autoCloseOnSuccess: f,
475
- baseUrl: c
478
+ baseUrl: l
476
479
  }) => {
477
480
  const m = v(() => new $({
478
481
  app: s,
@@ -486,11 +489,11 @@ const Y = ({
486
489
  mode: "call",
487
490
  theme: a,
488
491
  walletProvider: p,
489
- onOpen: l,
492
+ onOpen: c,
490
493
  onSuccess: h,
491
494
  onClose: u,
492
495
  autoCloseOnSuccess: f,
493
- baseUrl: c
496
+ baseUrl: l
494
497
  }), [
495
498
  s,
496
499
  t,
@@ -502,11 +505,11 @@ const Y = ({
502
505
  o,
503
506
  a,
504
507
  p,
505
- l,
508
+ c,
506
509
  h,
507
510
  u,
508
511
  f,
509
- c
512
+ l
510
513
  ]);
511
514
  return {
512
515
  openGlideCall: m.open,
@@ -524,12 +527,12 @@ const Y = ({
524
527
  theme: o,
525
528
  walletProvider: a,
526
529
  onOpen: p,
527
- onSuccess: l,
530
+ onSuccess: c,
528
531
  onClose: h,
529
532
  autoCloseOnSuccess: u,
530
533
  baseUrl: f
531
534
  }) => {
532
- const c = v(() => new $({
535
+ const l = v(() => new $({
533
536
  app: s,
534
537
  recipient: t,
535
538
  preferGaslessPayment: e,
@@ -541,7 +544,7 @@ const Y = ({
541
544
  theme: o,
542
545
  walletProvider: a,
543
546
  onOpen: p,
544
- onSuccess: l,
547
+ onSuccess: c,
545
548
  onClose: h,
546
549
  autoCloseOnSuccess: u,
547
550
  baseUrl: f
@@ -556,15 +559,15 @@ const Y = ({
556
559
  o,
557
560
  a,
558
561
  p,
559
- l,
562
+ c,
560
563
  h,
561
564
  u,
562
565
  f
563
566
  ]);
564
567
  return {
565
- openGlideBuy: c.open,
566
- externalUrl: c.externalUrl,
567
- opts: c.opts
568
+ openGlideBuy: l.open,
569
+ externalUrl: l.externalUrl,
570
+ opts: l.opts
568
571
  };
569
572
  };
570
573
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paywithglide/glide-react",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"