@paywithglide/glide-react 0.0.35 → 0.0.37

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.
@@ -82,7 +82,7 @@ export type GlideLocalStorageProvider = {
82
82
  removeItem: (key: string) => Promise<void>;
83
83
  getKeys: () => Promise<string[]>;
84
84
  };
85
- export type FundingSource = "transfer" | "coinbase" | "coinbase_app" | "interac" | "fiat";
85
+ export type FundingSource = "transfer" | "coinbase" | "coinbase_app" | "interac" | "fiat" | "wallet";
86
86
  export type GlideDepositOptions = {
87
87
  app: string;
88
88
  recipient?: string;
@@ -107,6 +107,7 @@ export type GlideDepositOptions = {
107
107
  excludeChainIds?: CAIP2[];
108
108
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
109
109
  excludeFundingSources?: FundingSource[];
110
+ fundingSources?: FundingSource[];
110
111
  walletProvider?: GlideDepositWalletProvider;
111
112
  localStorageProvider?: GlideLocalStorageProvider;
112
113
  onOpen?: () => void;
@@ -116,6 +117,7 @@ export type GlideDepositOptions = {
116
117
  autoCloseOnSuccess?: boolean;
117
118
  container?: HTMLElement;
118
119
  disableWithdrawToSelfSuggestion?: boolean;
120
+ hideSettlementCopy?: boolean;
119
121
  theme?: GlideWidgetTheme;
120
122
  popupsBlocked?: boolean;
121
123
  baseUrl?: string;
package/dist/glide.js CHANGED
@@ -1,7 +1,7 @@
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 U = (s, t, e) => ee(s, typeof t != "symbol" ? t + "" : t, e);
4
- import { useMemo as z } from "react";
3
+ var T = (s, t, e) => ee(s, typeof t != "symbol" ? t + "" : t, e);
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");
7
7
  }
@@ -9,23 +9,23 @@ 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 k = {
12
+ let z = {
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 x extends Error {
16
+ class S extends Error {
17
17
  constructor(t, e = {}) {
18
18
  var a;
19
19
  const i = (() => {
20
20
  var n;
21
- return e.cause instanceof x ? e.cause.details : (n = e.cause) != null && n.message ? e.cause.message : e.details;
22
- })(), r = e.cause instanceof x && e.cause.docsPath || e.docsPath, o = (a = k.getDocsUrl) == null ? void 0 : a.call(k, { ...e, docsPath: r }), c = [
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 = [
23
23
  t || "An error occurred.",
24
24
  "",
25
25
  ...e.metaMessages ? [...e.metaMessages, ""] : [],
26
- ...o ? [`Docs: ${o}`] : [],
26
+ ...r ? [`Docs: ${r}`] : [],
27
27
  ...i ? [`Details: ${i}`] : [],
28
- ...k.version ? [`Version: ${k.version}`] : []
28
+ ...z.version ? [`Version: ${z.version}`] : []
29
29
  ].join(`
30
30
  `);
31
31
  super(c, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
@@ -58,7 +58,7 @@ class x extends Error {
58
58
  configurable: !0,
59
59
  writable: !0,
60
60
  value: "BaseError"
61
- }), this.details = i, this.docsPath = r, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version = K;
61
+ }), this.details = i, this.docsPath = o, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version = K;
62
62
  }
63
63
  walk(t) {
64
64
  return F(this, t);
@@ -67,12 +67,12 @@ class x 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 x {
70
+ class V extends S {
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 A(s, { dir: t, size: e = 32 } = {}) {
75
+ function D(s, { dir: t, size: e = 32 } = {}) {
76
76
  return typeof s == "string" ? se(s, { dir: t, size: e }) : ie(s, { dir: t, size: e });
77
77
  }
78
78
  function se(s, { dir: t, size: e = 32 } = {}) {
@@ -97,25 +97,25 @@ function ie(s, { dir: t, size: e = 32 } = {}) {
97
97
  type: "bytes"
98
98
  });
99
99
  const i = new Uint8Array(e);
100
- for (let r = 0; r < e; r++) {
101
- const o = t === "right";
102
- i[o ? r : e - r - 1] = s[o ? r : s.length - r - 1];
100
+ for (let o = 0; o < e; o++) {
101
+ const r = t === "right";
102
+ i[r ? o : e - o - 1] = s[r ? o : s.length - o - 1];
103
103
  }
104
104
  return i;
105
105
  }
106
- class re extends x {
107
- constructor({ max: t, min: e, signed: i, size: r, value: o }) {
108
- super(`Number "${o}" is not in safe ${r ? `${r * 8}-bit ${i ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${e} to ${t})` : `(above ${e})`}`, { name: "IntegerOutOfRangeError" });
106
+ class oe extends S {
107
+ constructor({ max: t, min: e, signed: i, size: o, value: r }) {
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 oe extends x {
111
+ class re extends S {
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
116
  function q(s, { size: t }) {
117
117
  if (N(s) > t)
118
- throw new oe({
118
+ throw new re({
119
119
  givenSize: N(s),
120
120
  maxSize: t
121
121
  });
@@ -126,42 +126,42 @@ function ae(s, t = {}) {
126
126
  }
127
127
  function ce(s, t = {}) {
128
128
  const e = `0x${Number(s)}`;
129
- return typeof t.size == "number" ? (q(e, { size: t.size }), A(e, { size: t.size })) : e;
129
+ return typeof t.size == "number" ? (q(e, { size: t.size }), D(e, { size: t.size })) : e;
130
130
  }
131
131
  function J(s, t = {}) {
132
132
  let e = "";
133
- for (let r = 0; r < s.length; r++)
134
- e += ne[s[r]];
133
+ for (let o = 0; o < s.length; o++)
134
+ e += ne[s[o]];
135
135
  const i = `0x${e}`;
136
- return typeof t.size == "number" ? (q(i, { size: t.size }), A(i, { dir: "right", size: t.size })) : i;
136
+ return typeof t.size == "number" ? (q(i, { size: t.size }), D(i, { dir: "right", size: t.size })) : i;
137
137
  }
138
138
  function de(s, t = {}) {
139
- const { signed: e, size: i } = t, r = BigInt(s);
140
- let o;
141
- i ? e ? o = (1n << BigInt(i) * 8n - 1n) - 1n : o = 2n ** (BigInt(i) * 8n) - 1n : typeof s == "number" && (o = BigInt(Number.MAX_SAFE_INTEGER));
142
- const c = typeof o == "bigint" && e ? -o - 1n : 0;
143
- if (o && r > o || r < c) {
139
+ const { signed: e, size: i } = t, o = BigInt(s);
140
+ let r;
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
144
  const n = typeof s == "bigint" ? "n" : "";
145
- throw new re({
146
- max: o ? `${o}${n}` : void 0,
145
+ throw new oe({
146
+ max: r ? `${r}${n}` : void 0,
147
147
  min: `${c}${n}`,
148
148
  signed: e,
149
149
  size: i,
150
150
  value: `${s}${n}`
151
151
  });
152
152
  }
153
- const a = `0x${(e && r < 0 ? (1n << BigInt(i * 8)) + BigInt(r) : r).toString(16)}`;
154
- return i ? A(a, { size: i }) : a;
153
+ const a = `0x${(e && o < 0 ? (1n << BigInt(i * 8)) + BigInt(o) : o).toString(16)}`;
154
+ return i ? D(a, { size: i }) : a;
155
155
  }
156
156
  const le = /* @__PURE__ */ new TextEncoder();
157
157
  function pe(s, t = {}) {
158
158
  const e = le.encode(s);
159
159
  return J(e, t);
160
160
  }
161
- class T {
161
+ class M {
162
162
  constructor(t) {
163
- U(this, "opts");
164
- U(this, "open", () => {
163
+ T(this, "opts");
164
+ T(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,17 +172,17 @@ class T {
172
172
  this.openUrl(`${this.baseUrl}${this.opts.app}?init=true&embed=true`), this.initialize();
173
173
  }
174
174
  });
175
- U(this, "iframeEventHandler", async (t) => {
176
- var i, r, o, c, a, n, u, m, g, f, y, w, b, d, l, p, S, v, I, P, E, $, M, D, C, G, W, j, B, H, O, L, R;
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;
177
177
  const e = t.data;
178
178
  switch (e.type) {
179
179
  case "sendInit": {
180
- const h = this.opts.recipient, X = (i = this.opts.walletProvider) == null ? void 0 : i.address, Q = (r = this.opts.walletProvider) == null ? void 0 : r.availableChainIds, Y = (o = this.opts.walletProvider) == null ? void 0 : o.currentChainId, Z = this.opts.preferGaslessPayment || !!((c = this.opts.walletProvider) != null && c.signTypedDataAsync);
181
- (u = (a = this.iframe) == null ? void 0 : a.contentWindow) == null || u.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 || !!((c = this.opts.walletProvider) != null && c.signTypedDataAsync);
181
+ (h = (a = this.iframe) == null ? void 0 : a.contentWindow) == null || h.postMessage(
182
182
  {
183
183
  type: "initialize",
184
184
  sessionId: this.opts.sessionId,
185
- recipient: h,
185
+ recipient: p,
186
186
  connectedWalletAddress: X,
187
187
  availableChainIds: Q,
188
188
  currentChainId: Y,
@@ -190,6 +190,7 @@ class T {
190
190
  excludeChainIds: this.opts.excludeChainIds,
191
191
  excludeCurrencyTiers: this.opts.excludeCurrencyTiers,
192
192
  excludeFundingSources: this.opts.excludeFundingSources,
193
+ fundingSources: this.opts.fundingSources,
193
194
  mode: this.opts.mode,
194
195
  amount: this.opts.amount,
195
196
  chainId: this.opts.chainId,
@@ -199,6 +200,7 @@ class T {
199
200
  sessionMetadata: this.opts.sessionMetadata,
200
201
  autoCloseOnSuccess: this.opts.autoCloseOnSuccess,
201
202
  disableWithdrawToSelfSuggestion: this.opts.disableWithdrawToSelfSuggestion,
203
+ hideSettlementCopy: this.opts.hideSettlementCopy,
202
204
  theme: {
203
205
  ...this.opts.theme || {},
204
206
  colorScheme: ((n = this.opts.theme) == null ? void 0 : n.colorScheme) || getComputedStyle(document.documentElement).colorScheme || ""
@@ -213,17 +215,17 @@ class T {
213
215
  break;
214
216
  }
215
217
  case "didOpen": {
216
- this.iframe.style.opacity = "1", (g = (m = this.opts).onOpen) == null || g.call(m);
218
+ this.iframe.style.opacity = "1", (m = (u = this.opts).onOpen) == null || m.call(u);
217
219
  break;
218
220
  }
219
221
  case "localStorage.getKeys": {
220
222
  if (!this.opts.localStorageProvider)
221
223
  throw new Error("localStorageProvider is not set");
222
- const h = await this.opts.localStorageProvider.getKeys();
223
- (y = (f = this.iframe) == null ? void 0 : f.contentWindow) == null || y.postMessage(
224
+ const p = await this.opts.localStorageProvider.getKeys();
225
+ (f = (g = this.iframe) == null ? void 0 : g.contentWindow) == null || f.postMessage(
224
226
  {
225
227
  type: "localStorage.didGetKeys",
226
- keys: h
228
+ keys: p
227
229
  },
228
230
  this.baseUrl
229
231
  );
@@ -245,12 +247,12 @@ class T {
245
247
  case "localStorage.getItem": {
246
248
  if (!this.opts.localStorageProvider)
247
249
  throw new Error("localStorageProvider is not set");
248
- const h = await this.opts.localStorageProvider.getItem(e.key);
249
- (b = (w = this.iframe) == null ? void 0 : w.contentWindow) == null || b.postMessage(
250
+ const p = await this.opts.localStorageProvider.getItem(e.key);
251
+ (w = (y = this.iframe) == null ? void 0 : y.contentWindow) == null || w.postMessage(
250
252
  {
251
253
  type: "localStorage.didGetItem",
252
254
  key: e.key,
253
- value: h
255
+ value: p
254
256
  },
255
257
  this.baseUrl
256
258
  );
@@ -260,7 +262,7 @@ class T {
260
262
  (l = (d = this.opts) == null ? void 0 : d.onSuccess) == null || l.call(d, e.hash, e.session);
261
263
  break;
262
264
  case "close":
263
- this.removeIframe(), this.destroy(), (S = (p = this.opts) == null ? void 0 : p.onClose) == null || S.call(p);
265
+ this.removeIframe(), this.destroy(), ($ = (b = this.opts) == null ? void 0 : b.onClose) == null || $.call(b);
264
266
  break;
265
267
  case "setMode":
266
268
  (I = (v = this.opts) == null ? void 0 : v.onSetMode) == null || I.call(v, e.mode);
@@ -279,12 +281,12 @@ class T {
279
281
  },
280
282
  this.baseUrl
281
283
  );
282
- } catch (h) {
283
- (M = ($ = this.iframe) == null ? void 0 : $.contentWindow) == null || M.postMessage(
284
+ } catch (p) {
285
+ (U = (k = this.iframe) == null ? void 0 : k.contentWindow) == null || U.postMessage(
284
286
  {
285
287
  type: "didSwitchChain",
286
288
  success: !1,
287
- error: h
289
+ error: p
288
290
  },
289
291
  this.baseUrl
290
292
  );
@@ -295,23 +297,23 @@ class T {
295
297
  if (!this.opts.walletProvider)
296
298
  throw new Error("walletProvider is not set");
297
299
  try {
298
- const h = await this.opts.walletProvider.sendTransactionAsync(
300
+ const p = await this.opts.walletProvider.sendTransactionAsync(
299
301
  e.tx
300
302
  );
301
- (C = (D = this.iframe) == null ? void 0 : D.contentWindow) == null || C.postMessage(
303
+ (C = (x = this.iframe) == null ? void 0 : x.contentWindow) == null || C.postMessage(
302
304
  {
303
305
  type: "didSendTransaction",
304
306
  success: !0,
305
- txHash: h
307
+ txHash: p
306
308
  },
307
309
  this.baseUrl
308
310
  );
309
- } catch (h) {
311
+ } catch (p) {
310
312
  (W = (G = this.iframe) == null ? void 0 : G.contentWindow) == null || W.postMessage(
311
313
  {
312
314
  type: "didSendTransaction",
313
315
  success: !1,
314
- error: h
316
+ error: p
315
317
  },
316
318
  this.baseUrl
317
319
  );
@@ -334,23 +336,23 @@ class T {
334
336
  return;
335
337
  }
336
338
  try {
337
- const h = await this.opts.walletProvider.signTypedDataAsync(
339
+ const p = await this.opts.walletProvider.signTypedDataAsync(
338
340
  e.data
339
341
  );
340
342
  (O = (H = this.iframe) == null ? void 0 : H.contentWindow) == null || O.postMessage(
341
343
  {
342
344
  type: "didSignTypedData",
343
345
  success: !0,
344
- signature: h
346
+ signature: p
345
347
  },
346
348
  this.baseUrl
347
349
  );
348
- } catch (h) {
350
+ } catch (p) {
349
351
  (R = (L = this.iframe) == null ? void 0 : L.contentWindow) == null || R.postMessage(
350
352
  {
351
353
  type: "didSignTypedData",
352
354
  success: !1,
353
- error: h
355
+ error: p
354
356
  },
355
357
  this.baseUrl
356
358
  );
@@ -362,10 +364,10 @@ class T {
362
364
  this.opts = t;
363
365
  }
364
366
  get externalUrl() {
365
- var t, e, i;
367
+ var t, e, i, o;
366
368
  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(
367
369
  this.opts.evm.value || 0n
368
- )}` : ""}${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(",")}` : ""}${this.opts.debug ? "&debug=true" : ""}${this.opts.popupsBlocked ? "&popupsBlocked=true" : ""}${this.opts.disableWithdrawToSelfSuggestion ? "&disableWithdrawToSelfSuggestion=true" : ""}${this.opts.gasRefuelAmountPerChain ? `&gasRefuelAmountPerChain=${encodeURIComponent(JSON.stringify(this.opts.gasRefuelAmountPerChain))}` : ""}`;
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))}` : ""}`;
369
371
  }
370
372
  initialize() {
371
373
  window.addEventListener("message", this.iframeEventHandler);
@@ -405,186 +407,198 @@ const me = ({
405
407
  recipient: t,
406
408
  chainId: e,
407
409
  currencyId: i,
408
- amount: r,
409
- gasRefuelAmountPerChain: o,
410
+ amount: o,
411
+ gasRefuelAmountPerChain: r,
410
412
  preferGaslessPayment: c,
411
413
  excludeChainIds: a,
412
414
  excludeCurrencyTiers: n,
413
- excludeFundingSources: u,
415
+ excludeFundingSources: h,
416
+ fundingSources: u,
414
417
  mode: m,
415
- sessionId: g,
416
- sessionMetadata: f,
417
- disableWithdrawToSelfSuggestion: y,
418
- theme: w,
419
- walletProvider: b,
420
- localStorageProvider: d,
421
- onOpen: l,
422
- onSuccess: p,
423
- onClose: S,
424
- autoCloseOnSuccess: v,
425
- popupsBlocked: I,
426
- baseUrl: P,
427
- debug: E
418
+ hideSettlementCopy: g,
419
+ sessionId: f,
420
+ sessionMetadata: y,
421
+ disableWithdrawToSelfSuggestion: w,
422
+ theme: d,
423
+ walletProvider: l,
424
+ localStorageProvider: b,
425
+ onOpen: $,
426
+ onSuccess: v,
427
+ onClose: I,
428
+ autoCloseOnSuccess: P,
429
+ popupsBlocked: E,
430
+ baseUrl: k,
431
+ debug: U
428
432
  }) => {
429
- const $ = z(() => new T({
433
+ const x = A(() => new M({
430
434
  app: s,
431
435
  recipient: t,
432
436
  chainId: e,
433
437
  currencyId: i,
434
- amount: r,
435
- gasRefuelAmountPerChain: o,
438
+ amount: o,
439
+ gasRefuelAmountPerChain: r,
436
440
  preferGaslessPayment: c,
437
441
  excludeChainIds: a,
438
442
  excludeCurrencyTiers: n,
439
- excludeFundingSources: u,
443
+ excludeFundingSources: h,
444
+ fundingSources: u,
440
445
  mode: m,
441
- sessionId: g,
442
- sessionMetadata: f,
443
- disableWithdrawToSelfSuggestion: y,
444
- theme: w,
445
- walletProvider: b,
446
- localStorageProvider: d,
447
- onOpen: l,
448
- onSuccess: p,
449
- onClose: S,
450
- autoCloseOnSuccess: v,
451
- popupsBlocked: I,
452
- baseUrl: P,
453
- debug: E
446
+ hideSettlementCopy: g,
447
+ sessionId: f,
448
+ sessionMetadata: y,
449
+ disableWithdrawToSelfSuggestion: w,
450
+ theme: d,
451
+ walletProvider: l,
452
+ localStorageProvider: b,
453
+ onOpen: $,
454
+ onSuccess: v,
455
+ onClose: I,
456
+ autoCloseOnSuccess: P,
457
+ popupsBlocked: E,
458
+ baseUrl: k,
459
+ debug: U
454
460
  }), [
455
461
  s,
456
462
  t,
457
463
  e,
458
464
  i,
459
- r,
460
465
  o,
466
+ r,
461
467
  c,
462
468
  a,
463
469
  n,
470
+ h,
464
471
  u,
465
472
  m,
466
473
  g,
467
474
  f,
468
475
  y,
469
476
  w,
470
- b,
471
477
  d,
472
478
  l,
473
- p,
474
- S,
479
+ b,
480
+ $,
475
481
  v,
476
482
  I,
477
483
  P,
478
- E
484
+ E,
485
+ k,
486
+ U
479
487
  ]);
480
488
  return {
481
- openGlideDeposit: $.open,
482
- externalUrl: $.externalUrl,
483
- opts: $.opts
489
+ openGlideDeposit: x.open,
490
+ externalUrl: x.externalUrl,
491
+ opts: x.opts
484
492
  };
485
493
  }, ge = ({
486
494
  app: s,
487
495
  preferGaslessPayment: t,
488
496
  excludeChainIds: e,
489
497
  excludeCurrencyTiers: i,
490
- excludeFundingSources: r,
491
- amount: o,
492
- sessionId: c,
493
- sessionMetadata: a,
494
- theme: n,
495
- walletProvider: u,
496
- localStorageProvider: m,
497
- onOpen: g,
498
- onSuccess: f,
499
- onClose: y,
500
- autoCloseOnSuccess: w,
501
- popupsBlocked: b,
502
- baseUrl: d,
503
- debug: l
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,
510
+ autoCloseOnSuccess: d,
511
+ popupsBlocked: l,
512
+ baseUrl: b,
513
+ debug: $
504
514
  }) => {
505
- const p = z(() => new T({
515
+ const v = A(() => new M({
506
516
  app: s,
507
517
  preferGaslessPayment: t,
508
518
  excludeChainIds: e,
509
519
  excludeCurrencyTiers: i,
510
- excludeFundingSources: r,
520
+ excludeFundingSources: o,
521
+ fundingSources: r,
511
522
  mode: "pay",
512
- sessionId: c,
513
- amount: o,
514
- sessionMetadata: a,
515
- theme: n,
516
- walletProvider: u,
517
- localStorageProvider: m,
518
- onOpen: g,
519
- onSuccess: f,
520
- onClose: y,
521
- autoCloseOnSuccess: w,
522
- popupsBlocked: b,
523
- baseUrl: d,
524
- debug: l
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,
533
+ autoCloseOnSuccess: d,
534
+ popupsBlocked: l,
535
+ baseUrl: b,
536
+ debug: $
525
537
  }), [
526
538
  s,
527
539
  t,
528
540
  e,
529
541
  i,
542
+ o,
530
543
  r,
531
544
  c,
532
- o,
533
- a,
534
545
  n,
546
+ a,
547
+ h,
535
548
  u,
536
549
  m,
537
550
  g,
538
551
  f,
539
552
  y,
540
553
  w,
541
- b,
542
554
  d,
543
- l
555
+ l,
556
+ b,
557
+ $
544
558
  ]);
545
559
  return {
546
- openGlidePay: p.open,
547
- externalUrl: p.externalUrl,
548
- opts: p.opts
560
+ openGlidePay: v.open,
561
+ externalUrl: v.externalUrl,
562
+ opts: v.opts
549
563
  };
550
564
  }, fe = ({
551
565
  app: s,
552
566
  evm: t,
553
567
  approval: e,
554
568
  preferGaslessPayment: i,
555
- excludeChainIds: r,
556
- excludeCurrencyTiers: o,
569
+ excludeChainIds: o,
570
+ excludeCurrencyTiers: r,
557
571
  excludeFundingSources: c,
558
572
  sessionMetadata: a,
559
573
  theme: n,
560
- walletProvider: u,
561
- localStorageProvider: m,
562
- onOpen: g,
563
- onSuccess: f,
564
- onClose: y,
565
- autoCloseOnSuccess: w,
566
- popupsBlocked: b,
574
+ walletProvider: h,
575
+ localStorageProvider: u,
576
+ onOpen: m,
577
+ onSuccess: g,
578
+ onClose: f,
579
+ autoCloseOnSuccess: y,
580
+ popupsBlocked: w,
567
581
  baseUrl: d,
568
582
  debug: l
569
583
  }) => {
570
- const p = z(() => new T({
584
+ const b = A(() => new M({
571
585
  app: s,
572
586
  evm: t,
573
587
  approval: e,
574
588
  preferGaslessPayment: i,
575
- excludeChainIds: r,
576
- excludeCurrencyTiers: o,
589
+ excludeChainIds: o,
590
+ excludeCurrencyTiers: r,
577
591
  excludeFundingSources: c,
578
592
  sessionMetadata: a,
579
593
  mode: "call",
580
594
  theme: n,
581
- walletProvider: u,
582
- localStorageProvider: m,
583
- onOpen: g,
584
- onSuccess: f,
585
- onClose: y,
586
- autoCloseOnSuccess: w,
587
- popupsBlocked: b,
595
+ walletProvider: h,
596
+ localStorageProvider: u,
597
+ onOpen: m,
598
+ onSuccess: g,
599
+ onClose: f,
600
+ autoCloseOnSuccess: y,
601
+ popupsBlocked: w,
588
602
  baseUrl: d,
589
603
  debug: l
590
604
  }), [
@@ -592,81 +606,81 @@ const me = ({
592
606
  t,
593
607
  e,
594
608
  i,
595
- r,
596
609
  o,
610
+ r,
597
611
  c,
598
612
  a,
599
613
  n,
614
+ h,
600
615
  u,
601
616
  m,
602
617
  g,
603
618
  f,
604
619
  y,
605
620
  w,
606
- b,
607
621
  d,
608
622
  l
609
623
  ]);
610
624
  return {
611
- openGlideCall: p.open,
612
- externalUrl: p.externalUrl,
613
- opts: p.opts
625
+ openGlideCall: b.open,
626
+ externalUrl: b.externalUrl,
627
+ opts: b.opts
614
628
  };
615
629
  }, ye = ({
616
630
  app: s,
617
631
  recipient: t,
618
632
  chainId: e,
619
633
  currencyId: i,
620
- preferGaslessPayment: r,
621
- excludeChainIds: o,
634
+ preferGaslessPayment: o,
635
+ excludeChainIds: r,
622
636
  excludeCurrencyTiers: c,
623
637
  excludeFundingSources: a,
624
638
  sessionMetadata: n,
625
- theme: u,
626
- walletProvider: m,
627
- localStorageProvider: g,
628
- onOpen: f,
629
- onSuccess: y,
630
- onClose: w,
631
- autoCloseOnSuccess: b,
639
+ theme: h,
640
+ walletProvider: u,
641
+ localStorageProvider: m,
642
+ onOpen: g,
643
+ onSuccess: f,
644
+ onClose: y,
645
+ autoCloseOnSuccess: w,
632
646
  baseUrl: d
633
647
  }) => {
634
- const l = z(() => new T({
648
+ const l = A(() => new M({
635
649
  app: s,
636
650
  recipient: t,
637
651
  chainId: e,
638
652
  currencyId: i,
639
- preferGaslessPayment: r,
640
- excludeChainIds: o,
653
+ preferGaslessPayment: o,
654
+ excludeChainIds: r,
641
655
  excludeCurrencyTiers: c,
642
656
  excludeFundingSources: a,
643
657
  sessionMetadata: n,
644
658
  mode: "buy",
645
- theme: u,
646
- walletProvider: m,
647
- localStorageProvider: g,
648
- onOpen: f,
649
- onSuccess: y,
650
- onClose: w,
651
- autoCloseOnSuccess: b,
659
+ theme: h,
660
+ walletProvider: u,
661
+ localStorageProvider: m,
662
+ onOpen: g,
663
+ onSuccess: f,
664
+ onClose: y,
665
+ autoCloseOnSuccess: w,
652
666
  baseUrl: d
653
667
  }), [
654
668
  s,
655
669
  t,
656
670
  e,
657
671
  i,
658
- r,
659
672
  o,
673
+ r,
660
674
  c,
661
675
  a,
662
676
  n,
677
+ h,
663
678
  u,
664
679
  m,
665
680
  g,
666
681
  f,
667
682
  y,
668
683
  w,
669
- b,
670
684
  d
671
685
  ]);
672
686
  return {
@@ -686,8 +700,8 @@ const me = ({
686
700
  setItem: (s, t) => new Promise((e, i) => {
687
701
  try {
688
702
  localStorage.setItem(s, t), e();
689
- } catch (r) {
690
- i(r);
703
+ } catch (o) {
704
+ i(o);
691
705
  }
692
706
  }),
693
707
  removeItem: (s) => new Promise((t, e) => {
@@ -707,7 +721,7 @@ const me = ({
707
721
  })
708
722
  });
709
723
  export {
710
- T as GlideDeposit,
724
+ M as GlideDeposit,
711
725
  we as browserLocalStorageProvider,
712
726
  ye as useGlideBuy,
713
727
  fe as useGlideCall,
@@ -12,8 +12,10 @@ interface UseGlideDepositProps {
12
12
  excludeChainIds?: CAIP2[];
13
13
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
14
14
  excludeFundingSources?: FundingSource[];
15
+ fundingSources?: FundingSource[];
15
16
  mode?: "deposit" | "withdraw";
16
17
  hideWithdrawAddress?: boolean;
18
+ hideSettlementCopy?: boolean;
17
19
  sessionId?: string;
18
20
  sessionMetadata?: string;
19
21
  disableWithdrawToSelfSuggestion?: boolean;
@@ -28,7 +30,7 @@ interface UseGlideDepositProps {
28
30
  baseUrl?: string;
29
31
  debug?: boolean;
30
32
  }
31
- export declare const useGlideDeposit: ({ app, recipient, chainId, currencyId, amount, gasRefuelAmountPerChain, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, mode, sessionId, sessionMetadata, disableWithdrawToSelfSuggestion, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
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) => {
32
34
  openGlideDeposit: () => void;
33
35
  externalUrl: string;
34
36
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
@@ -8,6 +8,8 @@ type UseGlidePayProps = {
8
8
  excludeChainIds?: CAIP2[];
9
9
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
10
10
  excludeFundingSources?: FundingSource[];
11
+ fundingSources?: FundingSource[];
12
+ hideSettlementCopy?: boolean;
11
13
  sessionId?: string;
12
14
  sessionMetadata?: string;
13
15
  theme?: GlideWidgetTheme;
@@ -21,7 +23,7 @@ type UseGlidePayProps = {
21
23
  baseUrl?: string;
22
24
  debug?: boolean;
23
25
  };
24
- export declare const useGlidePay: ({ app, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, amount, sessionId, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlidePayProps) => {
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) => {
25
27
  openGlidePay: () => void;
26
28
  externalUrl: string;
27
29
  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.35",
3
+ "version": "0.0.37",
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": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
23
+ "lint": "prettier --check . && eslint .",
24
24
  "preview": "vite preview",
25
25
  "prepublishOnly": "npm run build"
26
26
  },
@@ -39,6 +39,7 @@
39
39
  "eslint-plugin-react-hooks": "^5.0.0",
40
40
  "eslint-plugin-react-refresh": "^0.4.14",
41
41
  "globals": "^15.12.0",
42
+ "prettier": "^3.6.2",
42
43
  "react": "^18.3.1",
43
44
  "react-dom": "^18.3.1",
44
45
  "typescript": "~5.6.2",