@paywithglide/glide-react 0.0.37 → 0.0.39

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.
@@ -104,10 +104,12 @@ export type GlideDepositOptions = {
104
104
  gasRefuelAmountPerChain?: Record<CAIP2, string>;
105
105
  sessionMetadata?: string;
106
106
  preferGaslessPayment?: boolean;
107
+ chainIds?: CAIP2[];
107
108
  excludeChainIds?: CAIP2[];
108
109
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
109
110
  excludeFundingSources?: FundingSource[];
110
111
  fundingSources?: FundingSource[];
112
+ allowedPaymentCurrencies?: string[];
111
113
  walletProvider?: GlideDepositWalletProvider;
112
114
  localStorageProvider?: GlideLocalStorageProvider;
113
115
  onOpen?: () => void;
package/dist/glide.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var _ = Object.defineProperty;
2
2
  var ee = (s, t, e) => t in s ? _(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var T = (s, t, e) => ee(s, typeof t != "symbol" ? t + "" : t, e);
3
+ var C = (s, t, e) => ee(s, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { useMemo as A } from "react";
5
5
  function te(s, { strict: t = !0 } = {}) {
6
6
  return !s || typeof s != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(s) : s.startsWith("0x");
@@ -9,26 +9,26 @@ function N(s) {
9
9
  return te(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
10
10
  }
11
11
  const K = "2.21.51";
12
- let z = {
12
+ let T = {
13
13
  getDocsUrl: ({ docsBaseUrl: s, docsPath: t = "", docsSlug: e }) => t ? `${s ?? "https://viem.sh"}${t}${e ? `#${e}` : ""}` : void 0,
14
14
  version: `viem@${K}`
15
15
  };
16
- class S extends Error {
16
+ class I extends Error {
17
17
  constructor(t, e = {}) {
18
- var a;
18
+ var c;
19
19
  const i = (() => {
20
- var n;
21
- return e.cause instanceof S ? e.cause.details : (n = e.cause) != null && n.message ? e.cause.message : e.details;
22
- })(), o = e.cause instanceof S && e.cause.docsPath || e.docsPath, r = (a = z.getDocsUrl) == null ? void 0 : a.call(z, { ...e, docsPath: o }), c = [
20
+ var a;
21
+ return e.cause instanceof I ? e.cause.details : (a = e.cause) != null && a.message ? e.cause.message : e.details;
22
+ })(), o = e.cause instanceof I && e.cause.docsPath || e.docsPath, r = (c = T.getDocsUrl) == null ? void 0 : c.call(T, { ...e, docsPath: o }), n = [
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
- ...z.version ? [`Version: ${z.version}`] : []
28
+ ...T.version ? [`Version: ${T.version}`] : []
29
29
  ].join(`
30
30
  `);
31
- super(c, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
31
+ super(n, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
32
32
  enumerable: !0,
33
33
  configurable: !0,
34
34
  writable: !0,
@@ -67,7 +67,7 @@ class S extends Error {
67
67
  function F(s, t) {
68
68
  return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? F(s.cause, t) : t ? null : s;
69
69
  }
70
- class V extends S {
70
+ class V extends I {
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 ie(s, { dir: t, size: e = 32 } = {}) {
103
103
  }
104
104
  return i;
105
105
  }
106
- class oe extends S {
106
+ class oe extends I {
107
107
  constructor({ max: t, min: e, signed: i, size: o, value: r }) {
108
108
  super(`Number "${r}" is not in safe ${o ? `${o * 8}-bit ${i ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${e} to ${t})` : `(above ${e})`}`, { name: "IntegerOutOfRangeError" });
109
109
  }
110
110
  }
111
- class re extends S {
111
+ class re extends I {
112
112
  constructor({ givenSize: t, maxSize: e }) {
113
113
  super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
114
114
  }
@@ -139,19 +139,19 @@ function de(s, t = {}) {
139
139
  const { signed: e, size: i } = t, o = BigInt(s);
140
140
  let r;
141
141
  i ? e ? r = (1n << BigInt(i) * 8n - 1n) - 1n : r = 2n ** (BigInt(i) * 8n) - 1n : typeof s == "number" && (r = BigInt(Number.MAX_SAFE_INTEGER));
142
- const c = typeof r == "bigint" && e ? -r - 1n : 0;
143
- if (r && o > r || o < c) {
144
- const n = typeof s == "bigint" ? "n" : "";
142
+ const n = typeof r == "bigint" && e ? -r - 1n : 0;
143
+ if (r && o > r || o < n) {
144
+ const a = typeof s == "bigint" ? "n" : "";
145
145
  throw new oe({
146
- max: r ? `${r}${n}` : void 0,
147
- min: `${c}${n}`,
146
+ max: r ? `${r}${a}` : void 0,
147
+ min: `${n}${a}`,
148
148
  signed: e,
149
149
  size: i,
150
- value: `${s}${n}`
150
+ value: `${s}${a}`
151
151
  });
152
152
  }
153
- const a = `0x${(e && o < 0 ? (1n << BigInt(i * 8)) + BigInt(o) : o).toString(16)}`;
154
- return i ? D(a, { size: i }) : a;
153
+ const c = `0x${(e && o < 0 ? (1n << BigInt(i * 8)) + BigInt(o) : o).toString(16)}`;
154
+ return i ? D(c, { size: i }) : c;
155
155
  }
156
156
  const le = /* @__PURE__ */ new TextEncoder();
157
157
  function pe(s, t = {}) {
@@ -160,8 +160,8 @@ function pe(s, t = {}) {
160
160
  }
161
161
  class M {
162
162
  constructor(t) {
163
- T(this, "opts");
164
- T(this, "open", () => {
163
+ C(this, "opts");
164
+ C(this, "open", () => {
165
165
  if (!(!this.opts.container && document.body.classList.contains("glide-deposit-open"))) {
166
166
  if (this.opts.container || document.body.classList.add("glide-deposit-open"), (this.opts.mode === "deposit" || this.opts.mode === "buy") && !this.opts.recipient)
167
167
  throw new Error("recipient is required for deposit/buy mode");
@@ -172,13 +172,13 @@ class M {
172
172
  this.openUrl(`${this.baseUrl}${this.opts.app}?init=true&embed=true`), this.initialize();
173
173
  }
174
174
  });
175
- T(this, "iframeEventHandler", async (t) => {
176
- var i, o, r, c, a, n, h, u, m, g, f, y, w, d, l, b, $, v, I, P, E, k, U, x, C, G, W, j, B, H, O, L, R;
175
+ C(this, "iframeEventHandler", async (t) => {
176
+ var i, o, r, n, c, a, h, u, m, g, f, y, w, l, b, d, v, $, S, x, E, k, U, z, P, j, G, W, B, H, O, L, R;
177
177
  const e = t.data;
178
178
  switch (e.type) {
179
179
  case "sendInit": {
180
- const p = this.opts.recipient, X = (i = this.opts.walletProvider) == null ? void 0 : i.address, Q = (o = this.opts.walletProvider) == null ? void 0 : o.availableChainIds, Y = (r = this.opts.walletProvider) == null ? void 0 : r.currentChainId, Z = this.opts.preferGaslessPayment || !!((c = this.opts.walletProvider) != null && c.signTypedDataAsync);
181
- (h = (a = this.iframe) == null ? void 0 : a.contentWindow) == null || h.postMessage(
180
+ const p = this.opts.recipient, X = (i = this.opts.walletProvider) == null ? void 0 : i.address, Q = (o = this.opts.walletProvider) == null ? void 0 : o.availableChainIds, Y = (r = this.opts.walletProvider) == null ? void 0 : r.currentChainId, Z = this.opts.preferGaslessPayment || !!((n = this.opts.walletProvider) != null && n.signTypedDataAsync);
181
+ (h = (c = this.iframe) == null ? void 0 : c.contentWindow) == null || h.postMessage(
182
182
  {
183
183
  type: "initialize",
184
184
  sessionId: this.opts.sessionId,
@@ -187,10 +187,12 @@ class M {
187
187
  availableChainIds: Q,
188
188
  currentChainId: Y,
189
189
  preferGaslessPayment: Z,
190
+ chainIds: this.opts.chainIds,
190
191
  excludeChainIds: this.opts.excludeChainIds,
191
192
  excludeCurrencyTiers: this.opts.excludeCurrencyTiers,
192
193
  excludeFundingSources: this.opts.excludeFundingSources,
193
194
  fundingSources: this.opts.fundingSources,
195
+ allowedPaymentCurrencies: this.opts.allowedPaymentCurrencies,
194
196
  mode: this.opts.mode,
195
197
  amount: this.opts.amount,
196
198
  chainId: this.opts.chainId,
@@ -203,7 +205,7 @@ class M {
203
205
  hideSettlementCopy: this.opts.hideSettlementCopy,
204
206
  theme: {
205
207
  ...this.opts.theme || {},
206
- colorScheme: ((n = this.opts.theme) == null ? void 0 : n.colorScheme) || getComputedStyle(document.documentElement).colorScheme || ""
208
+ colorScheme: ((a = this.opts.theme) == null ? void 0 : a.colorScheme) || getComputedStyle(document.documentElement).colorScheme || ""
207
209
  },
208
210
  didProvideLocalStorage: !!this.opts.localStorageProvider,
209
211
  debug: this.opts.debug,
@@ -259,13 +261,13 @@ class M {
259
261
  break;
260
262
  }
261
263
  case "success":
262
- (l = (d = this.opts) == null ? void 0 : d.onSuccess) == null || l.call(d, e.hash, e.session);
264
+ (b = (l = this.opts) == null ? void 0 : l.onSuccess) == null || b.call(l, e.hash, e.session);
263
265
  break;
264
266
  case "close":
265
- this.removeIframe(), this.destroy(), ($ = (b = this.opts) == null ? void 0 : b.onClose) == null || $.call(b);
267
+ this.removeIframe(), this.destroy(), (v = (d = this.opts) == null ? void 0 : d.onClose) == null || v.call(d);
266
268
  break;
267
269
  case "setMode":
268
- (I = (v = this.opts) == null ? void 0 : v.onSetMode) == null || I.call(v, e.mode);
270
+ (S = ($ = this.opts) == null ? void 0 : $.onSetMode) == null || S.call($, e.mode);
269
271
  break;
270
272
  case "switchChain":
271
273
  if (!this.opts.walletProvider)
@@ -273,7 +275,7 @@ class M {
273
275
  try {
274
276
  await this.opts.walletProvider.switchChainAsync({
275
277
  chainId: e.chainId
276
- }), (E = (P = this.iframe) == null ? void 0 : P.contentWindow) == null || E.postMessage(
278
+ }), (E = (x = this.iframe) == null ? void 0 : x.contentWindow) == null || E.postMessage(
277
279
  {
278
280
  type: "didSwitchChain",
279
281
  success: !0,
@@ -300,7 +302,7 @@ class M {
300
302
  const p = await this.opts.walletProvider.sendTransactionAsync(
301
303
  e.tx
302
304
  );
303
- (C = (x = this.iframe) == null ? void 0 : x.contentWindow) == null || C.postMessage(
305
+ (P = (z = this.iframe) == null ? void 0 : z.contentWindow) == null || P.postMessage(
304
306
  {
305
307
  type: "didSendTransaction",
306
308
  success: !0,
@@ -309,7 +311,7 @@ class M {
309
311
  this.baseUrl
310
312
  );
311
313
  } catch (p) {
312
- (W = (G = this.iframe) == null ? void 0 : G.contentWindow) == null || W.postMessage(
314
+ (G = (j = this.iframe) == null ? void 0 : j.contentWindow) == null || G.postMessage(
313
315
  {
314
316
  type: "didSendTransaction",
315
317
  success: !1,
@@ -325,7 +327,7 @@ class M {
325
327
  if (!this.opts.walletProvider)
326
328
  throw new Error("walletProvider is not set");
327
329
  if (!this.opts.walletProvider.signTypedDataAsync) {
328
- (B = (j = this.iframe) == null ? void 0 : j.contentWindow) == null || B.postMessage(
330
+ (B = (W = this.iframe) == null ? void 0 : W.contentWindow) == null || B.postMessage(
329
331
  {
330
332
  type: "didSignTypedData",
331
333
  success: !1,
@@ -364,10 +366,10 @@ class M {
364
366
  this.opts = t;
365
367
  }
366
368
  get externalUrl() {
367
- var t, e, i, o;
369
+ var t, e, i, o, r, n;
368
370
  return `${this.baseUrl}${this.opts.app}?${this.opts.recipient ? `&recipient=${this.opts.recipient}` : ""}${this.opts.preferGaslessPayment ? "&preferGaslessPayment=true" : ""}${this.opts.mode ? `&mode=${this.opts.mode}` : ""}${this.opts.amount ? `&amount=${this.opts.amount}` : ""}${this.opts.chainId ? `&chainId=${this.opts.chainId}` : ""}${this.opts.currencyId ? `&currencyId=${this.opts.currencyId}` : ""}${this.opts.evm ? `&evm.chainId=${this.opts.evm.chainId}&evm.to=${this.opts.evm.to}&evm.data=${this.opts.evm.data || "0x0"}&evm.value=${ae(
369
371
  this.opts.evm.value || 0n
370
- )}` : ""}${this.opts.approval ? `&approval.token=${this.opts.approval.token}&approval.amount=${this.opts.approval.amount}` : ""}${this.opts.sessionMetadata ? `&metadata=${this.opts.sessionMetadata}` : ""}${this.opts.autoCloseOnSuccess ? "&autoCloseOnSuccess=true" : ""}${this.opts.sessionId ? `&sessionId=${this.opts.sessionId}` : ""}${(t = this.opts.excludeChainIds) != null && t.length ? `&excludeChainIds=${this.opts.excludeChainIds.join(",")}` : ""}${(e = this.opts.excludeCurrencyTiers) != null && e.length ? `&excludeCurrencyTiers=${this.opts.excludeCurrencyTiers.join(",")}` : ""}${(i = this.opts.excludeFundingSources) != null && i.length ? `&excludeFundingSources=${this.opts.excludeFundingSources.join(",")}` : ""}${(o = this.opts.fundingSources) != null && o.length ? `&fundingSources=${this.opts.fundingSources.join(",")}` : ""}${this.opts.debug ? "&debug=true" : ""}${this.opts.popupsBlocked ? "&popupsBlocked=true" : ""}${this.opts.disableWithdrawToSelfSuggestion ? "&disableWithdrawToSelfSuggestion=true" : ""}${this.opts.hideSettlementCopy ? "&hideSettlementCopy=true" : ""}${this.opts.gasRefuelAmountPerChain ? `&gasRefuelAmountPerChain=${encodeURIComponent(JSON.stringify(this.opts.gasRefuelAmountPerChain))}` : ""}`;
372
+ )}` : ""}${this.opts.approval ? `&approval.token=${this.opts.approval.token}&approval.amount=${this.opts.approval.amount}` : ""}${this.opts.sessionMetadata ? `&metadata=${this.opts.sessionMetadata}` : ""}${this.opts.autoCloseOnSuccess ? "&autoCloseOnSuccess=true" : ""}${this.opts.sessionId ? `&sessionId=${this.opts.sessionId}` : ""}${(t = this.opts.chainIds) != null && t.length ? `&chainIds=${this.opts.chainIds.join(",")}` : ""}${(e = this.opts.excludeChainIds) != null && e.length ? `&excludeChainIds=${this.opts.excludeChainIds.join(",")}` : ""}${(i = this.opts.excludeCurrencyTiers) != null && i.length ? `&excludeCurrencyTiers=${this.opts.excludeCurrencyTiers.join(",")}` : ""}${(o = this.opts.excludeFundingSources) != null && o.length ? `&excludeFundingSources=${this.opts.excludeFundingSources.join(",")}` : ""}${(r = this.opts.fundingSources) != null && r.length ? `&fundingSources=${this.opts.fundingSources.join(",")}` : ""}${(n = this.opts.allowedPaymentCurrencies) != null && n.length ? `&allowedPaymentCurrencies=${this.opts.allowedPaymentCurrencies.join(",")}` : ""}${this.opts.debug ? "&debug=true" : ""}${this.opts.popupsBlocked ? "&popupsBlocked=true" : ""}${this.opts.disableWithdrawToSelfSuggestion ? "&disableWithdrawToSelfSuggestion=true" : ""}${this.opts.hideSettlementCopy ? "&hideSettlementCopy=true" : ""}${this.opts.gasRefuelAmountPerChain ? `&gasRefuelAmountPerChain=${encodeURIComponent(JSON.stringify(this.opts.gasRefuelAmountPerChain))}` : ""}`;
371
373
  }
372
374
  initialize() {
373
375
  window.addEventListener("message", this.iframeEventHandler);
@@ -409,54 +411,56 @@ const me = ({
409
411
  currencyId: i,
410
412
  amount: o,
411
413
  gasRefuelAmountPerChain: r,
412
- preferGaslessPayment: c,
414
+ preferGaslessPayment: n,
415
+ chainIds: c,
413
416
  excludeChainIds: a,
414
- excludeCurrencyTiers: n,
415
- excludeFundingSources: h,
416
- fundingSources: u,
417
- mode: m,
418
- hideSettlementCopy: g,
419
- sessionId: f,
420
- sessionMetadata: y,
421
- disableWithdrawToSelfSuggestion: w,
422
- theme: d,
423
- walletProvider: l,
424
- localStorageProvider: b,
417
+ excludeCurrencyTiers: h,
418
+ excludeFundingSources: u,
419
+ fundingSources: m,
420
+ mode: g,
421
+ hideSettlementCopy: f,
422
+ sessionId: y,
423
+ sessionMetadata: w,
424
+ disableWithdrawToSelfSuggestion: l,
425
+ theme: b,
426
+ walletProvider: d,
427
+ localStorageProvider: v,
425
428
  onOpen: $,
426
- onSuccess: v,
427
- onClose: I,
428
- autoCloseOnSuccess: P,
429
- popupsBlocked: E,
430
- baseUrl: k,
431
- debug: U
429
+ onSuccess: S,
430
+ onClose: x,
431
+ autoCloseOnSuccess: E,
432
+ popupsBlocked: k,
433
+ baseUrl: U,
434
+ debug: z
432
435
  }) => {
433
- const x = A(() => new M({
436
+ const P = A(() => new M({
434
437
  app: s,
435
438
  recipient: t,
436
439
  chainId: e,
437
440
  currencyId: i,
438
441
  amount: o,
439
442
  gasRefuelAmountPerChain: r,
440
- preferGaslessPayment: c,
443
+ preferGaslessPayment: n,
444
+ chainIds: c,
441
445
  excludeChainIds: a,
442
- excludeCurrencyTiers: n,
443
- excludeFundingSources: h,
444
- fundingSources: u,
445
- mode: m,
446
- hideSettlementCopy: g,
447
- sessionId: f,
448
- sessionMetadata: y,
449
- disableWithdrawToSelfSuggestion: w,
450
- theme: d,
451
- walletProvider: l,
452
- localStorageProvider: b,
446
+ excludeCurrencyTiers: h,
447
+ excludeFundingSources: u,
448
+ fundingSources: m,
449
+ mode: g,
450
+ hideSettlementCopy: f,
451
+ sessionId: y,
452
+ sessionMetadata: w,
453
+ disableWithdrawToSelfSuggestion: l,
454
+ theme: b,
455
+ walletProvider: d,
456
+ localStorageProvider: v,
453
457
  onOpen: $,
454
- onSuccess: v,
455
- onClose: I,
456
- autoCloseOnSuccess: P,
457
- popupsBlocked: E,
458
- baseUrl: k,
459
- debug: U
458
+ onSuccess: S,
459
+ onClose: x,
460
+ autoCloseOnSuccess: E,
461
+ popupsBlocked: k,
462
+ baseUrl: U,
463
+ debug: z
460
464
  }), [
461
465
  s,
462
466
  t,
@@ -464,9 +468,9 @@ const me = ({
464
468
  i,
465
469
  o,
466
470
  r,
471
+ n,
467
472
  c,
468
473
  a,
469
- n,
470
474
  h,
471
475
  u,
472
476
  m,
@@ -474,66 +478,71 @@ const me = ({
474
478
  f,
475
479
  y,
476
480
  w,
477
- d,
478
481
  l,
479
482
  b,
480
- $,
483
+ d,
481
484
  v,
482
- I,
483
- P,
485
+ $,
486
+ S,
487
+ x,
484
488
  E,
485
489
  k,
486
- U
490
+ U,
491
+ z
487
492
  ]);
488
493
  return {
489
- openGlideDeposit: x.open,
490
- externalUrl: x.externalUrl,
491
- opts: x.opts
494
+ openGlideDeposit: P.open,
495
+ externalUrl: P.externalUrl,
496
+ opts: P.opts
492
497
  };
493
498
  }, ge = ({
494
499
  app: s,
495
500
  preferGaslessPayment: t,
496
- excludeChainIds: e,
497
- excludeCurrencyTiers: i,
498
- excludeFundingSources: o,
499
- fundingSources: r,
500
- hideSettlementCopy: c,
501
- amount: a,
502
- sessionId: n,
503
- sessionMetadata: h,
504
- theme: u,
505
- walletProvider: m,
506
- localStorageProvider: g,
507
- onOpen: f,
508
- onSuccess: y,
509
- onClose: w,
501
+ chainIds: e,
502
+ excludeChainIds: i,
503
+ excludeCurrencyTiers: o,
504
+ excludeFundingSources: r,
505
+ fundingSources: n,
506
+ allowedPaymentCurrencies: c,
507
+ hideSettlementCopy: a,
508
+ amount: h,
509
+ sessionId: u,
510
+ sessionMetadata: m,
511
+ theme: g,
512
+ walletProvider: f,
513
+ localStorageProvider: y,
514
+ onOpen: w,
515
+ onSuccess: l,
516
+ onClose: b,
510
517
  autoCloseOnSuccess: d,
511
- popupsBlocked: l,
512
- baseUrl: b,
513
- debug: $
518
+ popupsBlocked: v,
519
+ baseUrl: $,
520
+ debug: S
514
521
  }) => {
515
- const v = A(() => new M({
522
+ const x = A(() => new M({
516
523
  app: s,
517
524
  preferGaslessPayment: t,
518
- excludeChainIds: e,
519
- excludeCurrencyTiers: i,
520
- excludeFundingSources: o,
521
- fundingSources: r,
525
+ chainIds: e,
526
+ excludeChainIds: i,
527
+ excludeCurrencyTiers: o,
528
+ excludeFundingSources: r,
529
+ fundingSources: n,
530
+ allowedPaymentCurrencies: c,
522
531
  mode: "pay",
523
- hideSettlementCopy: c,
524
- sessionId: n,
525
- amount: a,
526
- sessionMetadata: h,
527
- theme: u,
528
- walletProvider: m,
529
- localStorageProvider: g,
530
- onOpen: f,
531
- onSuccess: y,
532
- onClose: w,
532
+ hideSettlementCopy: a,
533
+ sessionId: u,
534
+ amount: h,
535
+ sessionMetadata: m,
536
+ theme: g,
537
+ walletProvider: f,
538
+ localStorageProvider: y,
539
+ onOpen: w,
540
+ onSuccess: l,
541
+ onClose: b,
533
542
  autoCloseOnSuccess: d,
534
- popupsBlocked: l,
535
- baseUrl: b,
536
- debug: $
543
+ popupsBlocked: v,
544
+ baseUrl: $,
545
+ debug: S
537
546
  }), [
538
547
  s,
539
548
  t,
@@ -541,66 +550,70 @@ const me = ({
541
550
  i,
542
551
  o,
543
552
  r,
544
- c,
545
553
  n,
554
+ c,
546
555
  a,
547
- h,
548
556
  u,
557
+ h,
549
558
  m,
550
559
  g,
551
560
  f,
552
561
  y,
553
562
  w,
554
- d,
555
563
  l,
556
564
  b,
557
- $
565
+ d,
566
+ v,
567
+ $,
568
+ S
558
569
  ]);
559
570
  return {
560
- openGlidePay: v.open,
561
- externalUrl: v.externalUrl,
562
- opts: v.opts
571
+ openGlidePay: x.open,
572
+ externalUrl: x.externalUrl,
573
+ opts: x.opts
563
574
  };
564
575
  }, fe = ({
565
576
  app: s,
566
577
  evm: t,
567
578
  approval: e,
568
579
  preferGaslessPayment: i,
569
- excludeChainIds: o,
570
- excludeCurrencyTiers: r,
580
+ chainIds: o,
581
+ excludeChainIds: r,
582
+ excludeCurrencyTiers: n,
571
583
  excludeFundingSources: c,
572
584
  sessionMetadata: a,
573
- theme: n,
574
- walletProvider: h,
575
- localStorageProvider: u,
576
- onOpen: m,
577
- onSuccess: g,
578
- onClose: f,
579
- autoCloseOnSuccess: y,
580
- popupsBlocked: w,
581
- baseUrl: d,
582
- debug: l
585
+ theme: h,
586
+ walletProvider: u,
587
+ localStorageProvider: m,
588
+ onOpen: g,
589
+ onSuccess: f,
590
+ onClose: y,
591
+ autoCloseOnSuccess: w,
592
+ popupsBlocked: l,
593
+ baseUrl: b,
594
+ debug: d
583
595
  }) => {
584
- const b = A(() => new M({
596
+ const v = A(() => new M({
585
597
  app: s,
586
598
  evm: t,
587
599
  approval: e,
588
600
  preferGaslessPayment: i,
589
- excludeChainIds: o,
590
- excludeCurrencyTiers: r,
601
+ chainIds: o,
602
+ excludeChainIds: r,
603
+ excludeCurrencyTiers: n,
591
604
  excludeFundingSources: c,
592
605
  sessionMetadata: a,
593
606
  mode: "call",
594
- theme: n,
595
- walletProvider: h,
596
- localStorageProvider: u,
597
- onOpen: m,
598
- onSuccess: g,
599
- onClose: f,
600
- autoCloseOnSuccess: y,
601
- popupsBlocked: w,
602
- baseUrl: d,
603
- debug: l
607
+ theme: h,
608
+ walletProvider: u,
609
+ localStorageProvider: m,
610
+ onOpen: g,
611
+ onSuccess: f,
612
+ onClose: y,
613
+ autoCloseOnSuccess: w,
614
+ popupsBlocked: l,
615
+ baseUrl: b,
616
+ debug: d
604
617
  }), [
605
618
  s,
606
619
  t,
@@ -608,9 +621,9 @@ const me = ({
608
621
  i,
609
622
  o,
610
623
  r,
624
+ n,
611
625
  c,
612
626
  a,
613
- n,
614
627
  h,
615
628
  u,
616
629
  m,
@@ -618,13 +631,14 @@ const me = ({
618
631
  f,
619
632
  y,
620
633
  w,
621
- d,
622
- l
634
+ l,
635
+ b,
636
+ d
623
637
  ]);
624
638
  return {
625
- openGlideCall: b.open,
626
- externalUrl: b.externalUrl,
627
- opts: b.opts
639
+ openGlideCall: v.open,
640
+ externalUrl: v.externalUrl,
641
+ opts: v.opts
628
642
  };
629
643
  }, ye = ({
630
644
  app: s,
@@ -632,38 +646,40 @@ const me = ({
632
646
  chainId: e,
633
647
  currencyId: i,
634
648
  preferGaslessPayment: o,
635
- excludeChainIds: r,
649
+ chainIds: r,
650
+ excludeChainIds: n,
636
651
  excludeCurrencyTiers: c,
637
652
  excludeFundingSources: a,
638
- sessionMetadata: n,
639
- theme: h,
640
- walletProvider: u,
641
- localStorageProvider: m,
642
- onOpen: g,
643
- onSuccess: f,
644
- onClose: y,
645
- autoCloseOnSuccess: w,
646
- baseUrl: d
653
+ sessionMetadata: h,
654
+ theme: u,
655
+ walletProvider: m,
656
+ localStorageProvider: g,
657
+ onOpen: f,
658
+ onSuccess: y,
659
+ onClose: w,
660
+ autoCloseOnSuccess: l,
661
+ baseUrl: b
647
662
  }) => {
648
- const l = A(() => new M({
663
+ const d = A(() => new M({
649
664
  app: s,
650
665
  recipient: t,
651
666
  chainId: e,
652
667
  currencyId: i,
653
668
  preferGaslessPayment: o,
654
- excludeChainIds: r,
669
+ chainIds: r,
670
+ excludeChainIds: n,
655
671
  excludeCurrencyTiers: c,
656
672
  excludeFundingSources: a,
657
- sessionMetadata: n,
673
+ sessionMetadata: h,
658
674
  mode: "buy",
659
- theme: h,
660
- walletProvider: u,
661
- localStorageProvider: m,
662
- onOpen: g,
663
- onSuccess: f,
664
- onClose: y,
665
- autoCloseOnSuccess: w,
666
- baseUrl: d
675
+ theme: u,
676
+ walletProvider: m,
677
+ localStorageProvider: g,
678
+ onOpen: f,
679
+ onSuccess: y,
680
+ onClose: w,
681
+ autoCloseOnSuccess: l,
682
+ baseUrl: b
667
683
  }), [
668
684
  s,
669
685
  t,
@@ -671,9 +687,9 @@ const me = ({
671
687
  i,
672
688
  o,
673
689
  r,
690
+ n,
674
691
  c,
675
692
  a,
676
- n,
677
693
  h,
678
694
  u,
679
695
  m,
@@ -681,12 +697,13 @@ const me = ({
681
697
  f,
682
698
  y,
683
699
  w,
684
- d
700
+ l,
701
+ b
685
702
  ]);
686
703
  return {
687
- openGlideBuy: l.open,
688
- externalUrl: l.externalUrl,
689
- opts: l.opts
704
+ openGlideBuy: d.open,
705
+ externalUrl: d.externalUrl,
706
+ opts: d.opts
690
707
  };
691
708
  }, we = Object.freeze({
692
709
  getItem: (s) => new Promise((t, e) => {
@@ -7,6 +7,7 @@ interface UseGlideBuyProps {
7
7
  chainId?: CAIP2;
8
8
  currencyId?: string;
9
9
  preferGaslessPayment?: boolean;
10
+ chainIds?: CAIP2[];
10
11
  excludeChainIds?: CAIP2[];
11
12
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
12
13
  excludeFundingSources?: FundingSource[];
@@ -20,7 +21,7 @@ interface UseGlideBuyProps {
20
21
  autoCloseOnSuccess?: boolean;
21
22
  baseUrl?: string;
22
23
  }
23
- export declare const useGlideBuy: ({ app, recipient, chainId, currencyId, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideBuyProps) => {
24
+ export declare const useGlideBuy: ({ app, recipient, chainId, currencyId, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideBuyProps) => {
24
25
  openGlideBuy: () => void;
25
26
  externalUrl: string;
26
27
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
@@ -14,6 +14,7 @@ interface UseGlideCallProps {
14
14
  amount: bigint;
15
15
  };
16
16
  preferGaslessPayment?: boolean;
17
+ chainIds?: CAIP2[];
17
18
  excludeChainIds?: CAIP2[];
18
19
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
19
20
  excludeFundingSources?: FundingSource[];
@@ -29,7 +30,7 @@ interface UseGlideCallProps {
29
30
  baseUrl?: string;
30
31
  debug?: boolean;
31
32
  }
32
- export declare const useGlideCall: ({ app, evm, approval, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideCallProps) => {
33
+ export declare const useGlideCall: ({ app, evm, approval, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideCallProps) => {
33
34
  openGlideCall: () => void;
34
35
  externalUrl: string;
35
36
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
@@ -9,6 +9,7 @@ interface UseGlideDepositProps {
9
9
  amount?: string;
10
10
  gasRefuelAmountPerChain?: Record<CAIP2, string>;
11
11
  preferGaslessPayment?: boolean;
12
+ chainIds?: CAIP2[];
12
13
  excludeChainIds?: CAIP2[];
13
14
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
14
15
  excludeFundingSources?: FundingSource[];
@@ -30,7 +31,7 @@ interface UseGlideDepositProps {
30
31
  baseUrl?: string;
31
32
  debug?: boolean;
32
33
  }
33
- export declare const useGlideDeposit: ({ app, recipient, chainId, currencyId, amount, gasRefuelAmountPerChain, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, fundingSources, mode, hideSettlementCopy, sessionId, sessionMetadata, disableWithdrawToSelfSuggestion, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
34
+ export declare const useGlideDeposit: ({ app, recipient, chainId, currencyId, amount, gasRefuelAmountPerChain, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, fundingSources, mode, hideSettlementCopy, sessionId, sessionMetadata, disableWithdrawToSelfSuggestion, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
34
35
  openGlideDeposit: () => void;
35
36
  externalUrl: string;
36
37
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
@@ -5,10 +5,12 @@ type UseGlidePayProps = {
5
5
  app: string;
6
6
  amount?: string;
7
7
  preferGaslessPayment?: boolean;
8
+ chainIds?: CAIP2[];
8
9
  excludeChainIds?: CAIP2[];
9
10
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
10
11
  excludeFundingSources?: FundingSource[];
11
12
  fundingSources?: FundingSource[];
13
+ allowedPaymentCurrencies?: string[];
12
14
  hideSettlementCopy?: boolean;
13
15
  sessionId?: string;
14
16
  sessionMetadata?: string;
@@ -23,7 +25,7 @@ type UseGlidePayProps = {
23
25
  baseUrl?: string;
24
26
  debug?: boolean;
25
27
  };
26
- export declare const useGlidePay: ({ app, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, fundingSources, hideSettlementCopy, amount, sessionId, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlidePayProps) => {
28
+ export declare const useGlidePay: ({ app, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, fundingSources, allowedPaymentCurrencies, hideSettlementCopy, amount, sessionId, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlidePayProps) => {
27
29
  openGlidePay: () => void;
28
30
  externalUrl: string;
29
31
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paywithglide/glide-react",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -20,7 +20,7 @@
20
20
  "build": "tsc --p ./tsconfig.build.json && vite build",
21
21
  "build-web": "tsc --p ./tsconfig.build.json && vite build --mode web",
22
22
  "build-chromeext": "tsc --p ./tsconfig.build.json && vite build --mode chromeext:popup && vite build --mode chromeext:content && vite build --mode chromeext:background",
23
- "lint": "prettier --check . && eslint .",
23
+ "lint": "prettier --check . && eslint . --max-warnings 0 && tsc --p ./tsconfig.build.json",
24
24
  "preview": "vite preview",
25
25
  "prepublishOnly": "npm run build"
26
26
  },