@paywithglide/glide-react 0.0.18 → 0.0.20

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.
@@ -76,6 +76,7 @@ export type GlideDepositWalletProvider = {
76
76
  sendTransactionAsync: (tx: EVMTransaction) => Promise<Hex>;
77
77
  signTypedDataAsync?: (args: PermitTypedData<bigint>) => Promise<Hex>;
78
78
  };
79
+ export type FundingSource = "transfer" | "coinbase" | "coinbase_app" | "interac" | "fiat";
79
80
  export type GlideDepositOptions = {
80
81
  app: string;
81
82
  recipient?: string;
@@ -96,8 +97,11 @@ export type GlideDepositOptions = {
96
97
  preferGaslessPayment?: boolean;
97
98
  excludeChainIds?: CAIP2[];
98
99
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
100
+ excludeFundingSources?: FundingSource[];
99
101
  walletProvider?: GlideDepositWalletProvider;
102
+ onOpen?: () => void;
100
103
  onSuccess?: (hash: Hex) => void;
104
+ onClose?: () => void;
101
105
  autoCloseOnSuccess?: boolean;
102
106
  theme?: GlideWidgetTheme;
103
107
  baseUrl?: string;
package/dist/glide.js CHANGED
@@ -1,31 +1,31 @@
1
- var A = Object.defineProperty;
2
- var M = (s, t, e) => t in s ? A(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var g = (s, t, e) => M(s, typeof t != "symbol" ? t + "" : t, e);
4
- import { useMemo as y } from "react";
5
- function k(s, { strict: t = !0 } = {}) {
1
+ var G = Object.defineProperty;
2
+ var j = (s, t, e) => t in s ? G(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var b = (s, t, e) => j(s, typeof t != "symbol" ? t + "" : t, e);
4
+ import { useMemo as $ } from "react";
5
+ function C(s, { strict: t = !0 } = {}) {
6
6
  return !s || typeof s != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(s) : s.startsWith("0x");
7
7
  }
8
8
  function T(s) {
9
- return k(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
9
+ return C(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
10
10
  }
11
- const U = "2.21.51";
12
- let m = {
11
+ const D = "2.21.51";
12
+ let w = {
13
13
  getDocsUrl: ({ docsBaseUrl: s, docsPath: t = "", docsSlug: e }) => t ? `${s ?? "https://viem.sh"}${t}${e ? `#${e}` : ""}` : void 0,
14
- version: `viem@${U}`
14
+ version: `viem@${D}`
15
15
  };
16
- class f extends Error {
16
+ class y extends Error {
17
17
  constructor(t, e = {}) {
18
18
  var a;
19
19
  const i = (() => {
20
20
  var o;
21
- return e.cause instanceof f ? e.cause.details : (o = e.cause) != null && o.message ? e.cause.message : e.details;
22
- })(), n = e.cause instanceof f && e.cause.docsPath || e.docsPath, r = (a = m.getDocsUrl) == null ? void 0 : a.call(m, { ...e, docsPath: n }), d = [
21
+ return e.cause instanceof y ? e.cause.details : (o = e.cause) != null && o.message ? e.cause.message : e.details;
22
+ })(), n = e.cause instanceof y && e.cause.docsPath || e.docsPath, r = (a = w.getDocsUrl) == null ? void 0 : a.call(w, { ...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
- ...m.version ? [`Version: ${m.version}`] : []
28
+ ...w.version ? [`Version: ${w.version}`] : []
29
29
  ].join(`
30
30
  `);
31
31
  super(d, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
@@ -58,40 +58,40 @@ class f 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 = U;
61
+ }), this.details = i, this.docsPath = n, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version = D;
62
62
  }
63
63
  walk(t) {
64
- return z(this, t);
64
+ return S(this, t);
65
65
  }
66
66
  }
67
- function z(s, t) {
68
- return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? z(s.cause, t) : t ? null : s;
67
+ function S(s, t) {
68
+ return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? S(s.cause, t) : t ? null : s;
69
69
  }
70
- class D extends f {
70
+ class A extends y {
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
  }
74
74
  }
75
- function b(s, { dir: t, size: e = 32 } = {}) {
76
- return typeof s == "string" ? G(s, { dir: t, size: e }) : H(s, { dir: t, size: e });
75
+ function x(s, { dir: t, size: e = 32 } = {}) {
76
+ return typeof s == "string" ? H(s, { dir: t, size: e }) : B(s, { dir: t, size: e });
77
77
  }
78
- function G(s, { dir: t, size: e = 32 } = {}) {
78
+ function H(s, { dir: t, size: e = 32 } = {}) {
79
79
  if (e === null)
80
80
  return s;
81
81
  const i = s.replace("0x", "");
82
82
  if (i.length > e * 2)
83
- throw new D({
83
+ throw new A({
84
84
  size: Math.ceil(i.length / 2),
85
85
  targetSize: e,
86
86
  type: "hex"
87
87
  });
88
88
  return `0x${i[t === "right" ? "padEnd" : "padStart"](e * 2, "0")}`;
89
89
  }
90
- function H(s, { dir: t, size: e = 32 } = {}) {
90
+ function B(s, { dir: t, size: e = 32 } = {}) {
91
91
  if (e === null)
92
92
  return s;
93
93
  if (s.length > e)
94
- throw new D({
94
+ throw new A({
95
95
  size: s.length,
96
96
  targetSize: e,
97
97
  type: "bytes"
@@ -103,46 +103,46 @@ function H(s, { dir: t, size: e = 32 } = {}) {
103
103
  }
104
104
  return i;
105
105
  }
106
- class j extends f {
106
+ class W extends y {
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 B extends f {
111
+ class L extends y {
112
112
  constructor({ givenSize: t, maxSize: e }) {
113
113
  super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
114
114
  }
115
115
  }
116
- function C(s, { size: t }) {
116
+ function M(s, { size: t }) {
117
117
  if (T(s) > t)
118
- throw new B({
118
+ throw new L({
119
119
  givenSize: T(s),
120
120
  maxSize: t
121
121
  });
122
122
  }
123
- const W = /* @__PURE__ */ Array.from({ length: 256 }, (s, t) => t.toString(16).padStart(2, "0"));
124
- function O(s, t = {}) {
125
- return typeof s == "number" || typeof s == "bigint" ? N(s, t) : typeof s == "string" ? V(s, t) : typeof s == "boolean" ? L(s, t) : S(s, t);
123
+ const O = /* @__PURE__ */ Array.from({ length: 256 }, (s, t) => t.toString(16).padStart(2, "0"));
124
+ function N(s, t = {}) {
125
+ return typeof s == "number" || typeof s == "bigint" ? F(s, t) : typeof s == "string" ? q(s, t) : typeof s == "boolean" ? R(s, t) : k(s, t);
126
126
  }
127
- function L(s, t = {}) {
127
+ function R(s, t = {}) {
128
128
  const e = `0x${Number(s)}`;
129
- return typeof t.size == "number" ? (C(e, { size: t.size }), b(e, { size: t.size })) : e;
129
+ return typeof t.size == "number" ? (M(e, { size: t.size }), x(e, { size: t.size })) : e;
130
130
  }
131
- function S(s, t = {}) {
131
+ function k(s, t = {}) {
132
132
  let e = "";
133
133
  for (let n = 0; n < s.length; n++)
134
- e += W[s[n]];
134
+ e += O[s[n]];
135
135
  const i = `0x${e}`;
136
- return typeof t.size == "number" ? (C(i, { size: t.size }), b(i, { dir: "right", size: t.size })) : i;
136
+ return typeof t.size == "number" ? (M(i, { size: t.size }), x(i, { dir: "right", size: t.size })) : i;
137
137
  }
138
- function N(s, t = {}) {
138
+ function F(s, t = {}) {
139
139
  const { signed: e, size: i } = t, n = 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
142
  const d = typeof r == "bigint" && e ? -r - 1n : 0;
143
143
  if (r && n > r || n < d) {
144
144
  const o = typeof s == "bigint" ? "n" : "";
145
- throw new j({
145
+ throw new W({
146
146
  max: r ? `${r}${o}` : void 0,
147
147
  min: `${d}${o}`,
148
148
  signed: e,
@@ -151,17 +151,17 @@ function N(s, t = {}) {
151
151
  });
152
152
  }
153
153
  const a = `0x${(e && n < 0 ? (1n << BigInt(i * 8)) + BigInt(n) : n).toString(16)}`;
154
- return i ? b(a, { size: i }) : a;
154
+ return i ? x(a, { size: i }) : a;
155
155
  }
156
- const R = /* @__PURE__ */ new TextEncoder();
157
- function V(s, t = {}) {
158
- const e = R.encode(s);
159
- return S(e, t);
156
+ const V = /* @__PURE__ */ new TextEncoder();
157
+ function q(s, t = {}) {
158
+ const e = V.encode(s);
159
+ return k(e, t);
160
160
  }
161
- class w {
161
+ class v {
162
162
  constructor(t) {
163
- g(this, "opts");
164
- g(this, "open", () => {
163
+ b(this, "opts");
164
+ b(this, "open", () => {
165
165
  if (!document.body.classList.contains("glide-deposit-open")) {
166
166
  if (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,15 +172,15 @@ class w {
172
172
  this.openUrl(`${this.baseUrl}${this.opts.app}?init=true&embed=true`), this.initialize();
173
173
  }
174
174
  });
175
- g(this, "iframeEventHandler", async (t) => {
176
- var i, n, r, d, a, o, l, p, c, u, v, $, x, I, P, E;
175
+ b(this, "iframeEventHandler", async (t) => {
176
+ var i, n, r, d, a, o, l, p, h, u, f, c, m, I, P, E, U, z;
177
177
  const e = t.data;
178
178
  switch (e.type) {
179
179
  case "success":
180
180
  (n = (i = this.opts) == null ? void 0 : i.onSuccess) == null || n.call(i, e.hash);
181
181
  break;
182
182
  case "close":
183
- this.removeIframe(), this.destroy();
183
+ this.removeIframe(), this.destroy(), (d = (r = this.opts) == null ? void 0 : r.onClose) == null || d.call(r);
184
184
  break;
185
185
  case "switchChain":
186
186
  if (!this.opts.walletProvider)
@@ -188,7 +188,7 @@ class w {
188
188
  try {
189
189
  await this.opts.walletProvider.switchChainAsync({
190
190
  chainId: e.chainId
191
- }), (d = (r = this.iframe) == null ? void 0 : r.contentWindow) == null || d.postMessage(
191
+ }), (o = (a = this.iframe) == null ? void 0 : a.contentWindow) == null || o.postMessage(
192
192
  {
193
193
  type: "didSwitchChain",
194
194
  success: !0,
@@ -196,12 +196,12 @@ class w {
196
196
  },
197
197
  this.baseUrl
198
198
  );
199
- } catch (h) {
200
- (o = (a = this.iframe) == null ? void 0 : a.contentWindow) == null || o.postMessage(
199
+ } catch (g) {
200
+ (p = (l = this.iframe) == null ? void 0 : l.contentWindow) == null || p.postMessage(
201
201
  {
202
202
  type: "didSwitchChain",
203
203
  success: !1,
204
- error: h
204
+ error: g
205
205
  },
206
206
  this.baseUrl
207
207
  );
@@ -212,23 +212,23 @@ class w {
212
212
  if (!this.opts.walletProvider)
213
213
  throw new Error("walletProvider is not set");
214
214
  try {
215
- const h = await this.opts.walletProvider.sendTransactionAsync(
215
+ const g = await this.opts.walletProvider.sendTransactionAsync(
216
216
  e.tx
217
217
  );
218
- (p = (l = this.iframe) == null ? void 0 : l.contentWindow) == null || p.postMessage(
218
+ (u = (h = this.iframe) == null ? void 0 : h.contentWindow) == null || u.postMessage(
219
219
  {
220
220
  type: "didSendTransaction",
221
221
  success: !0,
222
- txHash: h
222
+ txHash: g
223
223
  },
224
224
  this.baseUrl
225
225
  );
226
- } catch (h) {
227
- (u = (c = this.iframe) == null ? void 0 : c.contentWindow) == null || u.postMessage(
226
+ } catch (g) {
227
+ (c = (f = this.iframe) == null ? void 0 : f.contentWindow) == null || c.postMessage(
228
228
  {
229
229
  type: "didSendTransaction",
230
230
  success: !1,
231
- error: h
231
+ error: g
232
232
  },
233
233
  this.baseUrl
234
234
  );
@@ -240,7 +240,7 @@ class w {
240
240
  if (!this.opts.walletProvider)
241
241
  throw new Error("walletProvider is not set");
242
242
  if (!this.opts.walletProvider.signTypedDataAsync) {
243
- ($ = (v = this.iframe) == null ? void 0 : v.contentWindow) == null || $.postMessage(
243
+ (I = (m = this.iframe) == null ? void 0 : m.contentWindow) == null || I.postMessage(
244
244
  {
245
245
  type: "didSignTypedData",
246
246
  success: !1,
@@ -251,23 +251,23 @@ class w {
251
251
  return;
252
252
  }
253
253
  try {
254
- const h = await this.opts.walletProvider.signTypedDataAsync(
254
+ const g = await this.opts.walletProvider.signTypedDataAsync(
255
255
  e.data
256
256
  );
257
- (I = (x = this.iframe) == null ? void 0 : x.contentWindow) == null || I.postMessage(
257
+ (E = (P = this.iframe) == null ? void 0 : P.contentWindow) == null || E.postMessage(
258
258
  {
259
259
  type: "didSignTypedData",
260
260
  success: !0,
261
- signature: h
261
+ signature: g
262
262
  },
263
263
  this.baseUrl
264
264
  );
265
- } catch (h) {
266
- (E = (P = this.iframe) == null ? void 0 : P.contentWindow) == null || E.postMessage(
265
+ } catch (g) {
266
+ (z = (U = this.iframe) == null ? void 0 : U.contentWindow) == null || z.postMessage(
267
267
  {
268
268
  type: "didSignTypedData",
269
269
  success: !1,
270
- error: h
270
+ error: g
271
271
  },
272
272
  this.baseUrl
273
273
  );
@@ -279,8 +279,8 @@ class w {
279
279
  this.opts = t;
280
280
  }
281
281
  get externalUrl() {
282
- var t, e;
283
- 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.evm ? `&evm.chainId=${this.opts.evm.chainId}&evm.to=${this.opts.evm.to}&evm.data=${this.opts.evm.data || "0x0"}&evm.value=${O(this.opts.evm.value || 0n)}` : ""}${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(",")}` : ""}`;
282
+ var t, e, i;
283
+ 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.evm ? `&evm.chainId=${this.opts.evm.chainId}&evm.to=${this.opts.evm.to}&evm.data=${this.opts.evm.data || "0x0"}&evm.value=${N(this.opts.evm.value || 0n)}` : ""}${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(",")}` : ""}`;
284
284
  }
285
285
  initialize() {
286
286
  window.addEventListener("message", this.iframeEventHandler);
@@ -304,10 +304,10 @@ class w {
304
304
  "style",
305
305
  "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;"
306
306
  ), e.onload = () => {
307
- var o, l, p, c;
308
- const i = this.opts.recipient, n = (o = this.opts.walletProvider) == null ? void 0 : o.address, r = (l = this.opts.walletProvider) == null ? void 0 : l.availableChainIds, d = (p = this.opts.walletProvider) == null ? void 0 : p.currentChainId, a = this.opts.preferGaslessPayment || !!((c = this.opts.walletProvider) != null && c.signTypedDataAsync);
307
+ var o, l, p, h;
308
+ const i = this.opts.recipient, n = (o = this.opts.walletProvider) == null ? void 0 : o.address, r = (l = this.opts.walletProvider) == null ? void 0 : l.availableChainIds, d = (p = this.opts.walletProvider) == null ? void 0 : p.currentChainId, a = this.opts.preferGaslessPayment || !!((h = this.opts.walletProvider) != null && h.signTypedDataAsync);
309
309
  e.style.opacity = "1", setTimeout(() => {
310
- var u;
310
+ var u, f, c;
311
311
  (u = e == null ? void 0 : e.contentWindow) == null || u.postMessage(
312
312
  {
313
313
  type: "initialize",
@@ -319,6 +319,7 @@ class w {
319
319
  preferGaslessPayment: a,
320
320
  excludeChainIds: this.opts.excludeChainIds,
321
321
  excludeCurrencyTiers: this.opts.excludeCurrencyTiers,
322
+ excludeFundingSources: this.opts.excludeFundingSources,
322
323
  mode: this.opts.mode,
323
324
  amount: this.opts.amount,
324
325
  evmTx: this.opts.evm,
@@ -328,7 +329,7 @@ class w {
328
329
  theme: this.opts.theme
329
330
  },
330
331
  new URL(this.baseUrl).origin
331
- );
332
+ ), (c = (f = this.opts).onOpen) == null || c.call(f);
332
333
  }, 10);
333
334
  }, e.src = t, e.allow = "payment *; clipboard-write *", document.body.appendChild(e);
334
335
  }
@@ -337,32 +338,38 @@ class w {
337
338
  t && (t.remove(), document.body.classList.remove("glide-deposit-open"));
338
339
  }
339
340
  }
340
- const X = ({
341
+ const K = ({
341
342
  app: s,
342
343
  recipient: t,
343
344
  preferGaslessPayment: e,
344
345
  excludeChainIds: i,
345
346
  excludeCurrencyTiers: n,
346
- mode: r,
347
- sessionMetadata: d,
348
- theme: a,
349
- walletProvider: o,
350
- onSuccess: l,
351
- autoCloseOnSuccess: p,
347
+ excludeFundingSources: r,
348
+ mode: d,
349
+ sessionMetadata: a,
350
+ theme: o,
351
+ walletProvider: l,
352
+ onOpen: p,
353
+ onSuccess: h,
354
+ onClose: u,
355
+ autoCloseOnSuccess: f,
352
356
  baseUrl: c
353
357
  }) => {
354
- const u = y(() => new w({
358
+ const m = $(() => new v({
355
359
  app: s,
356
360
  recipient: t,
357
361
  preferGaslessPayment: e,
358
362
  excludeChainIds: i,
359
363
  excludeCurrencyTiers: n,
360
- mode: r,
361
- sessionMetadata: d,
362
- theme: a,
363
- walletProvider: o,
364
- onSuccess: l,
365
- autoCloseOnSuccess: p,
364
+ excludeFundingSources: r,
365
+ mode: d,
366
+ sessionMetadata: a,
367
+ theme: o,
368
+ walletProvider: l,
369
+ onOpen: p,
370
+ onSuccess: h,
371
+ onClose: u,
372
+ autoCloseOnSuccess: f,
366
373
  baseUrl: c
367
374
  }), [
368
375
  s,
@@ -376,139 +383,175 @@ const X = ({
376
383
  o,
377
384
  l,
378
385
  p,
386
+ h,
387
+ u,
388
+ f,
379
389
  c
380
390
  ]);
381
391
  return {
382
- openGlideDeposit: u.open,
383
- externalUrl: u.externalUrl,
384
- opts: u.opts
392
+ openGlideDeposit: m.open,
393
+ externalUrl: m.externalUrl,
394
+ opts: m.opts
385
395
  };
386
- }, J = ({
396
+ }, Q = ({
387
397
  app: s,
388
398
  preferGaslessPayment: t,
389
399
  excludeChainIds: e,
390
400
  excludeCurrencyTiers: i,
391
- amount: n,
392
- sessionId: r,
393
- sessionMetadata: d,
394
- theme: a,
395
- walletProvider: o,
396
- onSuccess: l,
397
- autoCloseOnSuccess: p,
401
+ excludeFundingSources: n,
402
+ amount: r,
403
+ sessionId: d,
404
+ sessionMetadata: a,
405
+ theme: o,
406
+ walletProvider: l,
407
+ onOpen: p,
408
+ onSuccess: h,
409
+ onClose: u,
410
+ autoCloseOnSuccess: f,
398
411
  baseUrl: c
399
412
  }) => {
400
- const u = y(() => new w({
413
+ const m = $(() => new v({
401
414
  app: s,
402
415
  preferGaslessPayment: t,
403
416
  excludeChainIds: e,
404
417
  excludeCurrencyTiers: i,
418
+ excludeFundingSources: n,
405
419
  mode: "pay",
406
- sessionId: r,
407
- amount: n,
408
- sessionMetadata: d,
409
- theme: a,
410
- walletProvider: o,
411
- onSuccess: l,
412
- autoCloseOnSuccess: p,
420
+ sessionId: d,
421
+ amount: r,
422
+ sessionMetadata: a,
423
+ theme: o,
424
+ walletProvider: l,
425
+ onOpen: p,
426
+ onSuccess: h,
427
+ onClose: u,
428
+ autoCloseOnSuccess: f,
413
429
  baseUrl: c
414
430
  }), [
415
431
  s,
416
432
  t,
417
- r,
433
+ e,
434
+ i,
418
435
  n,
419
436
  d,
437
+ r,
420
438
  a,
421
439
  o,
422
440
  l,
423
441
  p,
442
+ h,
443
+ u,
444
+ f,
424
445
  c
425
446
  ]);
426
447
  return {
427
- openGlidePay: u.open,
428
- externalUrl: u.externalUrl,
429
- opts: u.opts
448
+ openGlidePay: m.open,
449
+ externalUrl: m.externalUrl,
450
+ opts: m.opts
430
451
  };
431
- }, K = ({
452
+ }, Y = ({
432
453
  app: s,
433
454
  evm: t,
434
455
  approval: e,
435
456
  preferGaslessPayment: i,
436
457
  excludeChainIds: n,
437
458
  excludeCurrencyTiers: r,
438
- sessionMetadata: d,
439
- theme: a,
440
- walletProvider: o,
441
- onSuccess: l,
442
- autoCloseOnSuccess: p,
459
+ excludeFundingSources: d,
460
+ sessionMetadata: a,
461
+ theme: o,
462
+ walletProvider: l,
463
+ onOpen: p,
464
+ onSuccess: h,
465
+ onClose: u,
466
+ autoCloseOnSuccess: f,
443
467
  baseUrl: c
444
468
  }) => {
445
- const u = y(() => new w({
469
+ const m = $(() => new v({
446
470
  app: s,
447
471
  evm: t,
448
472
  approval: e,
449
473
  preferGaslessPayment: i,
450
474
  excludeChainIds: n,
451
475
  excludeCurrencyTiers: r,
452
- sessionMetadata: d,
476
+ excludeFundingSources: d,
477
+ sessionMetadata: a,
453
478
  mode: "call",
454
- theme: a,
455
- walletProvider: o,
456
- onSuccess: l,
457
- autoCloseOnSuccess: p,
479
+ theme: o,
480
+ walletProvider: l,
481
+ onOpen: p,
482
+ onSuccess: h,
483
+ onClose: u,
484
+ autoCloseOnSuccess: f,
458
485
  baseUrl: c
459
486
  }), [
460
487
  s,
461
488
  t,
462
489
  e,
463
490
  i,
491
+ n,
492
+ r,
464
493
  d,
465
494
  a,
466
495
  o,
467
496
  l,
468
497
  p,
498
+ h,
499
+ u,
500
+ f,
469
501
  c
470
502
  ]);
471
503
  return {
472
- openGlideCall: u.open,
473
- externalUrl: u.externalUrl,
474
- opts: u.opts
504
+ openGlideCall: m.open,
505
+ externalUrl: m.externalUrl,
506
+ opts: m.opts
475
507
  };
476
- }, Q = ({
508
+ }, Z = ({
477
509
  app: s,
478
510
  recipient: t,
479
511
  preferGaslessPayment: e,
480
512
  excludeChainIds: i,
481
513
  excludeCurrencyTiers: n,
482
- sessionMetadata: r,
483
- theme: d,
484
- walletProvider: a,
485
- onSuccess: o,
486
- autoCloseOnSuccess: l,
487
- baseUrl: p
514
+ excludeFundingSources: r,
515
+ sessionMetadata: d,
516
+ theme: a,
517
+ walletProvider: o,
518
+ onOpen: l,
519
+ onSuccess: p,
520
+ onClose: h,
521
+ autoCloseOnSuccess: u,
522
+ baseUrl: f
488
523
  }) => {
489
- const c = y(() => new w({
524
+ const c = $(() => new v({
490
525
  app: s,
491
526
  recipient: t,
492
527
  preferGaslessPayment: e,
493
528
  excludeChainIds: i,
494
529
  excludeCurrencyTiers: n,
495
- sessionMetadata: r,
530
+ excludeFundingSources: r,
531
+ sessionMetadata: d,
496
532
  mode: "buy",
497
- theme: d,
498
- walletProvider: a,
499
- onSuccess: o,
500
- autoCloseOnSuccess: l,
501
- baseUrl: p
533
+ theme: a,
534
+ walletProvider: o,
535
+ onOpen: l,
536
+ onSuccess: p,
537
+ onClose: h,
538
+ autoCloseOnSuccess: u,
539
+ baseUrl: f
502
540
  }), [
503
541
  s,
504
542
  t,
505
543
  e,
544
+ i,
545
+ n,
506
546
  r,
507
547
  d,
508
548
  a,
509
549
  o,
510
550
  l,
511
- p
551
+ p,
552
+ h,
553
+ u,
554
+ f
512
555
  ]);
513
556
  return {
514
557
  openGlideBuy: c.open,
@@ -517,9 +560,9 @@ const X = ({
517
560
  };
518
561
  };
519
562
  export {
520
- w as GlideDeposit,
521
- Q as useGlideBuy,
522
- K as useGlideCall,
523
- X as useGlideDeposit,
524
- J as useGlidePay
563
+ v as GlideDeposit,
564
+ Z as useGlideBuy,
565
+ Y as useGlideCall,
566
+ K as useGlideDeposit,
567
+ Q as useGlidePay
525
568
  };
@@ -1,4 +1,4 @@
1
- import { GlideDepositWalletProvider, Hex } from './GlideDeposit.ts';
1
+ import { FundingSource, GlideDepositWalletProvider, Hex } from './GlideDeposit.ts';
2
2
  import { GlideWidgetTheme } from './theme.ts';
3
3
  import { CAIP2 } from '@paywithglide/glide-js';
4
4
  interface UseGlideBuyProps {
@@ -7,14 +7,17 @@ interface UseGlideBuyProps {
7
7
  preferGaslessPayment?: boolean;
8
8
  excludeChainIds?: CAIP2[];
9
9
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
10
+ excludeFundingSources?: FundingSource[];
10
11
  sessionMetadata?: string;
11
12
  theme?: GlideWidgetTheme;
12
13
  walletProvider?: GlideDepositWalletProvider;
14
+ onOpen?: () => void;
13
15
  onSuccess?: (hash: Hex) => void;
16
+ onClose?: () => void;
14
17
  autoCloseOnSuccess?: boolean;
15
18
  baseUrl?: string;
16
19
  }
17
- export declare const useGlideBuy: ({ app, recipient, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, sessionMetadata, theme, walletProvider, onSuccess, autoCloseOnSuccess, baseUrl, }: UseGlideBuyProps) => {
20
+ export declare const useGlideBuy: ({ app, recipient, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideBuyProps) => {
18
21
  openGlideBuy: () => void;
19
22
  externalUrl: string;
20
23
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
@@ -1,4 +1,4 @@
1
- import { GlideDepositWalletProvider, Hex } from './GlideDeposit.ts';
1
+ import { FundingSource, GlideDepositWalletProvider, Hex } from './GlideDeposit.ts';
2
2
  import { GlideWidgetTheme } from './theme.ts';
3
3
  import { CAIP2 } from '@paywithglide/glide-js';
4
4
  interface UseGlideCallProps {
@@ -16,14 +16,17 @@ interface UseGlideCallProps {
16
16
  preferGaslessPayment?: boolean;
17
17
  excludeChainIds?: CAIP2[];
18
18
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
19
+ excludeFundingSources?: FundingSource[];
19
20
  sessionMetadata?: string;
20
21
  theme?: GlideWidgetTheme;
21
22
  walletProvider?: GlideDepositWalletProvider;
23
+ onOpen?: () => void;
22
24
  onSuccess?: (hash: Hex) => void;
25
+ onClose?: () => void;
23
26
  autoCloseOnSuccess?: boolean;
24
27
  baseUrl?: string;
25
28
  }
26
- export declare const useGlideCall: ({ app, evm, approval, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, sessionMetadata, theme, walletProvider, onSuccess, autoCloseOnSuccess, baseUrl, }: UseGlideCallProps) => {
29
+ export declare const useGlideCall: ({ app, evm, approval, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideCallProps) => {
27
30
  openGlideCall: () => void;
28
31
  externalUrl: string;
29
32
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
@@ -1,4 +1,4 @@
1
- import { GlideDepositWalletProvider } from './GlideDeposit.ts';
1
+ import { FundingSource, GlideDepositWalletProvider } from './GlideDeposit.ts';
2
2
  import { GlideWidgetTheme } from './theme.ts';
3
3
  import { CAIP2 } from '@paywithglide/glide-js';
4
4
  interface UseGlideDepositProps {
@@ -7,15 +7,18 @@ interface UseGlideDepositProps {
7
7
  preferGaslessPayment?: boolean;
8
8
  excludeChainIds?: CAIP2[];
9
9
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
10
+ excludeFundingSources?: FundingSource[];
10
11
  mode?: "deposit" | "withdraw";
11
12
  sessionMetadata?: string;
12
13
  theme?: GlideWidgetTheme;
13
14
  walletProvider?: GlideDepositWalletProvider;
15
+ onOpen?: () => void;
14
16
  onSuccess?: (hash: string) => void;
17
+ onClose?: () => void;
15
18
  autoCloseOnSuccess?: boolean;
16
19
  baseUrl?: string;
17
20
  }
18
- export declare const useGlideDeposit: ({ app, recipient, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, mode, sessionMetadata, theme, walletProvider, onSuccess, autoCloseOnSuccess, baseUrl, }: UseGlideDepositProps) => {
21
+ export declare const useGlideDeposit: ({ app, recipient, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, mode, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideDepositProps) => {
19
22
  openGlideDeposit: () => void;
20
23
  externalUrl: string;
21
24
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
@@ -1,4 +1,4 @@
1
- import { GlideDepositWalletProvider } from './GlideDeposit.ts';
1
+ import { FundingSource, GlideDepositWalletProvider } from './GlideDeposit.ts';
2
2
  import { GlideWidgetTheme } from './theme.ts';
3
3
  import { CAIP2 } from '@paywithglide/glide-js';
4
4
  type UseGlidePayProps = {
@@ -7,15 +7,18 @@ type UseGlidePayProps = {
7
7
  preferGaslessPayment?: boolean;
8
8
  excludeChainIds?: CAIP2[];
9
9
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
10
+ excludeFundingSources?: FundingSource[];
10
11
  sessionId?: string;
11
12
  sessionMetadata?: string;
12
13
  theme?: GlideWidgetTheme;
13
14
  walletProvider?: GlideDepositWalletProvider;
15
+ onOpen?: () => void;
14
16
  onSuccess?: (hash: string) => void;
17
+ onClose?: () => void;
15
18
  autoCloseOnSuccess?: boolean;
16
19
  baseUrl?: string;
17
20
  };
18
- export declare const useGlidePay: ({ app, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, amount, sessionId, sessionMetadata, theme, walletProvider, onSuccess, autoCloseOnSuccess, baseUrl, }: UseGlidePayProps) => {
21
+ export declare const useGlidePay: ({ app, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, amount, sessionId, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlidePayProps) => {
19
22
  openGlidePay: () => void;
20
23
  externalUrl: string;
21
24
  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.18",
3
+ "version": "0.0.20",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"