@paywithglide/glide-react 0.0.32 → 0.0.34

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.
@@ -115,6 +115,7 @@ export type GlideDepositOptions = {
115
115
  onSetMode?: (mode: "deposit" | "withdraw") => void;
116
116
  autoCloseOnSuccess?: boolean;
117
117
  container?: HTMLElement;
118
+ disableWithdrawToSelfSuggestion?: boolean;
118
119
  theme?: GlideWidgetTheme;
119
120
  popupsBlocked?: boolean;
120
121
  baseUrl?: string;
package/dist/glide.js CHANGED
@@ -1,17 +1,17 @@
1
- var Z = Object.defineProperty;
2
- var _ = (s, t, e) => t in s ? Z(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var k = (s, t, e) => _(s, typeof t != "symbol" ? t + "" : t, e);
4
- import { useMemo as U } from "react";
5
- function ee(s, { strict: t = !0 } = {}) {
1
+ var _ = Object.defineProperty;
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";
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
  }
8
- function R(s) {
9
- return ee(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
8
+ function N(s) {
9
+ return te(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
10
10
  }
11
- const N = "2.21.51";
12
- let E = {
11
+ const K = "2.21.51";
12
+ let k = {
13
13
  getDocsUrl: ({ docsBaseUrl: s, docsPath: t = "", docsSlug: e }) => t ? `${s ?? "https://viem.sh"}${t}${e ? `#${e}` : ""}` : void 0,
14
- version: `viem@${N}`
14
+ version: `viem@${K}`
15
15
  };
16
16
  class x extends Error {
17
17
  constructor(t, e = {}) {
@@ -19,13 +19,13 @@ class x extends Error {
19
19
  const i = (() => {
20
20
  var n;
21
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 = E.getDocsUrl) == null ? void 0 : a.call(E, { ...e, docsPath: r }), c = [
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 = [
23
23
  t || "An error occurred.",
24
24
  "",
25
25
  ...e.metaMessages ? [...e.metaMessages, ""] : [],
26
26
  ...o ? [`Docs: ${o}`] : [],
27
27
  ...i ? [`Details: ${i}`] : [],
28
- ...E.version ? [`Version: ${E.version}`] : []
28
+ ...k.version ? [`Version: ${k.version}`] : []
29
29
  ].join(`
30
30
  `);
31
31
  super(c, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
@@ -58,40 +58,40 @@ 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 = N;
61
+ }), this.details = i, this.docsPath = r, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version = K;
62
62
  }
63
63
  walk(t) {
64
- return K(this, t);
64
+ return F(this, t);
65
65
  }
66
66
  }
67
- function K(s, t) {
68
- return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? K(s.cause, t) : t ? null : s;
67
+ function F(s, t) {
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 F extends x {
70
+ class V extends x {
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
75
  function A(s, { dir: t, size: e = 32 } = {}) {
76
- return typeof s == "string" ? te(s, { dir: t, size: e }) : se(s, { dir: t, size: e });
76
+ return typeof s == "string" ? se(s, { dir: t, size: e }) : ie(s, { dir: t, size: e });
77
77
  }
78
- function te(s, { dir: t, size: e = 32 } = {}) {
78
+ function se(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 F({
83
+ throw new V({
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 se(s, { dir: t, size: e = 32 } = {}) {
90
+ function ie(s, { dir: t, size: e = 32 } = {}) {
91
91
  if (e === null)
92
92
  return s;
93
93
  if (s.length > e)
94
- throw new F({
94
+ throw new V({
95
95
  size: s.length,
96
96
  targetSize: e,
97
97
  type: "bytes"
@@ -103,46 +103,46 @@ function se(s, { dir: t, size: e = 32 } = {}) {
103
103
  }
104
104
  return i;
105
105
  }
106
- class ie extends x {
106
+ class re extends x {
107
107
  constructor({ max: t, min: e, signed: i, size: r, value: o }) {
108
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" });
109
109
  }
110
110
  }
111
- class re extends x {
111
+ class oe extends x {
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 V(s, { size: t }) {
117
- if (R(s) > t)
118
- throw new re({
119
- givenSize: R(s),
116
+ function q(s, { size: t }) {
117
+ if (N(s) > t)
118
+ throw new oe({
119
+ givenSize: N(s),
120
120
  maxSize: t
121
121
  });
122
122
  }
123
- const oe = /* @__PURE__ */ Array.from({ length: 256 }, (s, t) => t.toString(16).padStart(2, "0"));
124
- function ne(s, t = {}) {
125
- return typeof s == "number" || typeof s == "bigint" ? ce(s, t) : typeof s == "string" ? le(s, t) : typeof s == "boolean" ? ae(s, t) : q(s, t);
126
- }
123
+ const ne = /* @__PURE__ */ Array.from({ length: 256 }, (s, t) => t.toString(16).padStart(2, "0"));
127
124
  function ae(s, t = {}) {
125
+ return typeof s == "number" || typeof s == "bigint" ? de(s, t) : typeof s == "string" ? pe(s, t) : typeof s == "boolean" ? ce(s, t) : J(s, t);
126
+ }
127
+ function ce(s, t = {}) {
128
128
  const e = `0x${Number(s)}`;
129
- return typeof t.size == "number" ? (V(e, { size: t.size }), A(e, { size: t.size })) : e;
129
+ return typeof t.size == "number" ? (q(e, { size: t.size }), A(e, { size: t.size })) : e;
130
130
  }
131
- function q(s, t = {}) {
131
+ function J(s, t = {}) {
132
132
  let e = "";
133
133
  for (let r = 0; r < s.length; r++)
134
- e += oe[s[r]];
134
+ e += ne[s[r]];
135
135
  const i = `0x${e}`;
136
- return typeof t.size == "number" ? (V(i, { size: t.size }), A(i, { dir: "right", size: t.size })) : i;
136
+ return typeof t.size == "number" ? (q(i, { size: t.size }), A(i, { dir: "right", size: t.size })) : i;
137
137
  }
138
- function ce(s, t = {}) {
138
+ function de(s, t = {}) {
139
139
  const { signed: e, size: i } = t, r = BigInt(s);
140
140
  let o;
141
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
142
  const c = typeof o == "bigint" && e ? -o - 1n : 0;
143
143
  if (o && r > o || r < c) {
144
144
  const n = typeof s == "bigint" ? "n" : "";
145
- throw new ie({
145
+ throw new re({
146
146
  max: o ? `${o}${n}` : void 0,
147
147
  min: `${c}${n}`,
148
148
  signed: e,
@@ -153,15 +153,15 @@ function ce(s, t = {}) {
153
153
  const a = `0x${(e && r < 0 ? (1n << BigInt(i * 8)) + BigInt(r) : r).toString(16)}`;
154
154
  return i ? A(a, { size: i }) : a;
155
155
  }
156
- const de = /* @__PURE__ */ new TextEncoder();
157
- function le(s, t = {}) {
158
- const e = de.encode(s);
159
- return q(e, t);
156
+ const le = /* @__PURE__ */ new TextEncoder();
157
+ function pe(s, t = {}) {
158
+ const e = le.encode(s);
159
+ return J(e, t);
160
160
  }
161
- class z {
161
+ class T {
162
162
  constructor(t) {
163
- k(this, "opts");
164
- k(this, "open", () => {
163
+ U(this, "opts");
164
+ U(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,21 +172,21 @@ class z {
172
172
  this.openUrl(`${this.baseUrl}${this.opts.app}?init=true&embed=true`), this.initialize();
173
173
  }
174
174
  });
175
- k(this, "iframeEventHandler", async (t) => {
176
- var i, r, o, c, a, n, h, u, m, f, g, y, l, w, d, b, v, I, P, S, $, M, T, D, C, G, j, B, W, H, L, O;
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;
177
177
  const e = t.data;
178
178
  switch (e.type) {
179
179
  case "sendInit": {
180
- const p = this.opts.recipient, J = (i = this.opts.walletProvider) == null ? void 0 : i.address, X = (r = this.opts.walletProvider) == null ? void 0 : r.availableChainIds, Q = (o = this.opts.walletProvider) == null ? void 0 : o.currentChainId, Y = this.opts.preferGaslessPayment || !!((c = this.opts.walletProvider) != null && c.signTypedDataAsync);
181
- (n = (a = this.iframe) == null ? void 0 : a.contentWindow) == null || n.postMessage(
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(
182
182
  {
183
183
  type: "initialize",
184
184
  sessionId: this.opts.sessionId,
185
- recipient: p,
186
- connectedWalletAddress: J,
187
- availableChainIds: X,
188
- currentChainId: Q,
189
- preferGaslessPayment: Y,
185
+ recipient: h,
186
+ connectedWalletAddress: X,
187
+ availableChainIds: Q,
188
+ currentChainId: Y,
189
+ preferGaslessPayment: Z,
190
190
  excludeChainIds: this.opts.excludeChainIds,
191
191
  excludeCurrencyTiers: this.opts.excludeCurrencyTiers,
192
192
  excludeFundingSources: this.opts.excludeFundingSources,
@@ -198,24 +198,32 @@ class z {
198
198
  tokenApproval: this.opts.approval,
199
199
  sessionMetadata: this.opts.sessionMetadata,
200
200
  autoCloseOnSuccess: this.opts.autoCloseOnSuccess,
201
- theme: this.opts.theme,
201
+ disableWithdrawToSelfSuggestion: this.opts.disableWithdrawToSelfSuggestion,
202
+ theme: {
203
+ ...this.opts.theme || {},
204
+ colorScheme: ((n = this.opts.theme) == null ? void 0 : n.colorScheme) || getComputedStyle(document.documentElement).colorScheme || ""
205
+ },
202
206
  didProvideLocalStorage: !!this.opts.localStorageProvider,
203
207
  debug: this.opts.debug,
204
208
  popupsBlocked: this.opts.popupsBlocked,
205
209
  gasRefuelAmountPerChain: this.opts.gasRefuelAmountPerChain
206
210
  },
207
211
  new URL(this.baseUrl).origin
208
- ), this.iframe.style.opacity = "1", (u = (h = this.opts).onOpen) == null || u.call(h);
212
+ );
213
+ break;
214
+ }
215
+ case "didOpen": {
216
+ this.iframe.style.opacity = "1", (g = (m = this.opts).onOpen) == null || g.call(m);
209
217
  break;
210
218
  }
211
219
  case "localStorage.getKeys": {
212
220
  if (!this.opts.localStorageProvider)
213
221
  throw new Error("localStorageProvider is not set");
214
- const p = await this.opts.localStorageProvider.getKeys();
215
- (f = (m = this.iframe) == null ? void 0 : m.contentWindow) == null || f.postMessage(
222
+ const h = await this.opts.localStorageProvider.getKeys();
223
+ (y = (f = this.iframe) == null ? void 0 : f.contentWindow) == null || y.postMessage(
216
224
  {
217
225
  type: "localStorage.didGetKeys",
218
- keys: p
226
+ keys: h
219
227
  },
220
228
  this.baseUrl
221
229
  );
@@ -237,22 +245,22 @@ class z {
237
245
  case "localStorage.getItem": {
238
246
  if (!this.opts.localStorageProvider)
239
247
  throw new Error("localStorageProvider is not set");
240
- const p = await this.opts.localStorageProvider.getItem(e.key);
241
- (y = (g = this.iframe) == null ? void 0 : g.contentWindow) == null || y.postMessage(
248
+ const h = await this.opts.localStorageProvider.getItem(e.key);
249
+ (b = (w = this.iframe) == null ? void 0 : w.contentWindow) == null || b.postMessage(
242
250
  {
243
251
  type: "localStorage.didGetItem",
244
252
  key: e.key,
245
- value: p
253
+ value: h
246
254
  },
247
255
  this.baseUrl
248
256
  );
249
257
  break;
250
258
  }
251
259
  case "success":
252
- (w = (l = this.opts) == null ? void 0 : l.onSuccess) == null || w.call(l, e.hash, e.session);
260
+ (l = (d = this.opts) == null ? void 0 : d.onSuccess) == null || l.call(d, e.hash, e.session);
253
261
  break;
254
262
  case "close":
255
- this.removeIframe(), this.destroy(), (b = (d = this.opts) == null ? void 0 : d.onClose) == null || b.call(d);
263
+ this.removeIframe(), this.destroy(), (S = (p = this.opts) == null ? void 0 : p.onClose) == null || S.call(p);
256
264
  break;
257
265
  case "setMode":
258
266
  (I = (v = this.opts) == null ? void 0 : v.onSetMode) == null || I.call(v, e.mode);
@@ -263,7 +271,7 @@ class z {
263
271
  try {
264
272
  await this.opts.walletProvider.switchChainAsync({
265
273
  chainId: e.chainId
266
- }), (S = (P = this.iframe) == null ? void 0 : P.contentWindow) == null || S.postMessage(
274
+ }), (E = (P = this.iframe) == null ? void 0 : P.contentWindow) == null || E.postMessage(
267
275
  {
268
276
  type: "didSwitchChain",
269
277
  success: !0,
@@ -271,12 +279,12 @@ class z {
271
279
  },
272
280
  this.baseUrl
273
281
  );
274
- } catch (p) {
282
+ } catch (h) {
275
283
  (M = ($ = this.iframe) == null ? void 0 : $.contentWindow) == null || M.postMessage(
276
284
  {
277
285
  type: "didSwitchChain",
278
286
  success: !1,
279
- error: p
287
+ error: h
280
288
  },
281
289
  this.baseUrl
282
290
  );
@@ -287,23 +295,23 @@ class z {
287
295
  if (!this.opts.walletProvider)
288
296
  throw new Error("walletProvider is not set");
289
297
  try {
290
- const p = await this.opts.walletProvider.sendTransactionAsync(
298
+ const h = await this.opts.walletProvider.sendTransactionAsync(
291
299
  e.tx
292
300
  );
293
- (D = (T = this.iframe) == null ? void 0 : T.contentWindow) == null || D.postMessage(
301
+ (C = (D = this.iframe) == null ? void 0 : D.contentWindow) == null || C.postMessage(
294
302
  {
295
303
  type: "didSendTransaction",
296
304
  success: !0,
297
- txHash: p
305
+ txHash: h
298
306
  },
299
307
  this.baseUrl
300
308
  );
301
- } catch (p) {
302
- (G = (C = this.iframe) == null ? void 0 : C.contentWindow) == null || G.postMessage(
309
+ } catch (h) {
310
+ (W = (G = this.iframe) == null ? void 0 : G.contentWindow) == null || W.postMessage(
303
311
  {
304
312
  type: "didSendTransaction",
305
313
  success: !1,
306
- error: p
314
+ error: h
307
315
  },
308
316
  this.baseUrl
309
317
  );
@@ -326,23 +334,23 @@ class z {
326
334
  return;
327
335
  }
328
336
  try {
329
- const p = await this.opts.walletProvider.signTypedDataAsync(
337
+ const h = await this.opts.walletProvider.signTypedDataAsync(
330
338
  e.data
331
339
  );
332
- (H = (W = this.iframe) == null ? void 0 : W.contentWindow) == null || H.postMessage(
340
+ (O = (H = this.iframe) == null ? void 0 : H.contentWindow) == null || O.postMessage(
333
341
  {
334
342
  type: "didSignTypedData",
335
343
  success: !0,
336
- signature: p
344
+ signature: h
337
345
  },
338
346
  this.baseUrl
339
347
  );
340
- } catch (p) {
341
- (O = (L = this.iframe) == null ? void 0 : L.contentWindow) == null || O.postMessage(
348
+ } catch (h) {
349
+ (R = (L = this.iframe) == null ? void 0 : L.contentWindow) == null || R.postMessage(
342
350
  {
343
351
  type: "didSignTypedData",
344
352
  success: !1,
345
- error: p
353
+ error: h
346
354
  },
347
355
  this.baseUrl
348
356
  );
@@ -355,9 +363,9 @@ class z {
355
363
  }
356
364
  get externalUrl() {
357
365
  var t, e, i;
358
- 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=${ne(
366
+ 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(
359
367
  this.opts.evm.value || 0n
360
- )}` : ""}${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.gasRefuelAmountPerChain ? `&gasRefuelAmountPerChain=${encodeURIComponent(JSON.stringify(this.opts.gasRefuelAmountPerChain))}` : ""}`;
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))}` : ""}`;
361
369
  }
362
370
  initialize() {
363
371
  window.addEventListener("message", this.iframeEventHandler);
@@ -392,7 +400,7 @@ class z {
392
400
  t && (t.remove(), document.body.classList.remove("glide-deposit-open"));
393
401
  }
394
402
  }
395
- const ue = ({
403
+ const me = ({
396
404
  app: s,
397
405
  recipient: t,
398
406
  chainId: e,
@@ -402,22 +410,23 @@ const ue = ({
402
410
  preferGaslessPayment: c,
403
411
  excludeChainIds: a,
404
412
  excludeCurrencyTiers: n,
405
- excludeFundingSources: h,
406
- mode: u,
407
- sessionId: m,
413
+ excludeFundingSources: u,
414
+ mode: m,
415
+ sessionId: g,
408
416
  sessionMetadata: f,
409
- theme: g,
410
- walletProvider: y,
411
- localStorageProvider: l,
412
- onOpen: w,
413
- onSuccess: d,
414
- onClose: b,
417
+ disableWithdrawToSelfSuggestion: y,
418
+ theme: w,
419
+ walletProvider: b,
420
+ localStorageProvider: d,
421
+ onOpen: l,
422
+ onSuccess: p,
423
+ onClose: S,
415
424
  autoCloseOnSuccess: v,
416
425
  popupsBlocked: I,
417
426
  baseUrl: P,
418
- debug: S
427
+ debug: E
419
428
  }) => {
420
- const $ = U(() => new z({
429
+ const $ = z(() => new T({
421
430
  app: s,
422
431
  recipient: t,
423
432
  chainId: e,
@@ -427,20 +436,21 @@ const ue = ({
427
436
  preferGaslessPayment: c,
428
437
  excludeChainIds: a,
429
438
  excludeCurrencyTiers: n,
430
- excludeFundingSources: h,
431
- mode: u,
432
- sessionId: m,
439
+ excludeFundingSources: u,
440
+ mode: m,
441
+ sessionId: g,
433
442
  sessionMetadata: f,
434
- theme: g,
435
- walletProvider: y,
436
- localStorageProvider: l,
437
- onOpen: w,
438
- onSuccess: d,
439
- onClose: b,
443
+ disableWithdrawToSelfSuggestion: y,
444
+ theme: w,
445
+ walletProvider: b,
446
+ localStorageProvider: d,
447
+ onOpen: l,
448
+ onSuccess: p,
449
+ onClose: S,
440
450
  autoCloseOnSuccess: v,
441
451
  popupsBlocked: I,
442
452
  baseUrl: P,
443
- debug: S
453
+ debug: E
444
454
  }), [
445
455
  s,
446
456
  t,
@@ -451,27 +461,28 @@ const ue = ({
451
461
  c,
452
462
  a,
453
463
  n,
454
- h,
455
464
  u,
456
465
  m,
457
- f,
458
466
  g,
467
+ f,
459
468
  y,
460
- l,
461
469
  w,
462
- d,
463
470
  b,
471
+ d,
472
+ l,
473
+ p,
474
+ S,
464
475
  v,
465
476
  I,
466
477
  P,
467
- S
478
+ E
468
479
  ]);
469
480
  return {
470
481
  openGlideDeposit: $.open,
471
482
  externalUrl: $.externalUrl,
472
483
  opts: $.opts
473
484
  };
474
- }, me = ({
485
+ }, ge = ({
475
486
  app: s,
476
487
  preferGaslessPayment: t,
477
488
  excludeChainIds: e,
@@ -481,17 +492,17 @@ const ue = ({
481
492
  sessionId: c,
482
493
  sessionMetadata: a,
483
494
  theme: n,
484
- walletProvider: h,
485
- localStorageProvider: u,
486
- onOpen: m,
495
+ walletProvider: u,
496
+ localStorageProvider: m,
497
+ onOpen: g,
487
498
  onSuccess: f,
488
- onClose: g,
489
- autoCloseOnSuccess: y,
490
- popupsBlocked: l,
491
- baseUrl: w,
492
- debug: d
499
+ onClose: y,
500
+ autoCloseOnSuccess: w,
501
+ popupsBlocked: b,
502
+ baseUrl: d,
503
+ debug: l
493
504
  }) => {
494
- const b = U(() => new z({
505
+ const p = z(() => new T({
495
506
  app: s,
496
507
  preferGaslessPayment: t,
497
508
  excludeChainIds: e,
@@ -502,15 +513,15 @@ const ue = ({
502
513
  amount: o,
503
514
  sessionMetadata: a,
504
515
  theme: n,
505
- walletProvider: h,
506
- localStorageProvider: u,
507
- onOpen: m,
516
+ walletProvider: u,
517
+ localStorageProvider: m,
518
+ onOpen: g,
508
519
  onSuccess: f,
509
- onClose: g,
510
- autoCloseOnSuccess: y,
511
- popupsBlocked: l,
512
- baseUrl: w,
513
- debug: d
520
+ onClose: y,
521
+ autoCloseOnSuccess: w,
522
+ popupsBlocked: b,
523
+ baseUrl: d,
524
+ debug: l
514
525
  }), [
515
526
  s,
516
527
  t,
@@ -521,20 +532,20 @@ const ue = ({
521
532
  o,
522
533
  a,
523
534
  n,
524
- h,
525
535
  u,
526
536
  m,
527
- f,
528
537
  g,
538
+ f,
529
539
  y,
530
- l,
531
540
  w,
532
- d
541
+ b,
542
+ d,
543
+ l
533
544
  ]);
534
545
  return {
535
- openGlidePay: b.open,
536
- externalUrl: b.externalUrl,
537
- opts: b.opts
546
+ openGlidePay: p.open,
547
+ externalUrl: p.externalUrl,
548
+ opts: p.opts
538
549
  };
539
550
  }, fe = ({
540
551
  app: s,
@@ -546,17 +557,17 @@ const ue = ({
546
557
  excludeFundingSources: c,
547
558
  sessionMetadata: a,
548
559
  theme: n,
549
- walletProvider: h,
550
- localStorageProvider: u,
551
- onOpen: m,
560
+ walletProvider: u,
561
+ localStorageProvider: m,
562
+ onOpen: g,
552
563
  onSuccess: f,
553
- onClose: g,
554
- autoCloseOnSuccess: y,
555
- popupsBlocked: l,
556
- baseUrl: w,
557
- debug: d
564
+ onClose: y,
565
+ autoCloseOnSuccess: w,
566
+ popupsBlocked: b,
567
+ baseUrl: d,
568
+ debug: l
558
569
  }) => {
559
- const b = U(() => new z({
570
+ const p = z(() => new T({
560
571
  app: s,
561
572
  evm: t,
562
573
  approval: e,
@@ -567,15 +578,15 @@ const ue = ({
567
578
  sessionMetadata: a,
568
579
  mode: "call",
569
580
  theme: n,
570
- walletProvider: h,
571
- localStorageProvider: u,
572
- onOpen: m,
581
+ walletProvider: u,
582
+ localStorageProvider: m,
583
+ onOpen: g,
573
584
  onSuccess: f,
574
- onClose: g,
575
- autoCloseOnSuccess: y,
576
- popupsBlocked: l,
577
- baseUrl: w,
578
- debug: d
585
+ onClose: y,
586
+ autoCloseOnSuccess: w,
587
+ popupsBlocked: b,
588
+ baseUrl: d,
589
+ debug: l
579
590
  }), [
580
591
  s,
581
592
  t,
@@ -586,22 +597,22 @@ const ue = ({
586
597
  c,
587
598
  a,
588
599
  n,
589
- h,
590
600
  u,
591
601
  m,
592
- f,
593
602
  g,
603
+ f,
594
604
  y,
595
- l,
596
605
  w,
597
- d
606
+ b,
607
+ d,
608
+ l
598
609
  ]);
599
610
  return {
600
- openGlideCall: b.open,
601
- externalUrl: b.externalUrl,
602
- opts: b.opts
611
+ openGlideCall: p.open,
612
+ externalUrl: p.externalUrl,
613
+ opts: p.opts
603
614
  };
604
- }, ge = ({
615
+ }, ye = ({
605
616
  app: s,
606
617
  recipient: t,
607
618
  chainId: e,
@@ -611,16 +622,16 @@ const ue = ({
611
622
  excludeCurrencyTiers: c,
612
623
  excludeFundingSources: a,
613
624
  sessionMetadata: n,
614
- theme: h,
615
- walletProvider: u,
616
- localStorageProvider: m,
625
+ theme: u,
626
+ walletProvider: m,
627
+ localStorageProvider: g,
617
628
  onOpen: f,
618
- onSuccess: g,
619
- onClose: y,
620
- autoCloseOnSuccess: l,
621
- baseUrl: w
629
+ onSuccess: y,
630
+ onClose: w,
631
+ autoCloseOnSuccess: b,
632
+ baseUrl: d
622
633
  }) => {
623
- const d = U(() => new z({
634
+ const l = z(() => new T({
624
635
  app: s,
625
636
  recipient: t,
626
637
  chainId: e,
@@ -631,14 +642,14 @@ const ue = ({
631
642
  excludeFundingSources: a,
632
643
  sessionMetadata: n,
633
644
  mode: "buy",
634
- theme: h,
635
- walletProvider: u,
636
- localStorageProvider: m,
645
+ theme: u,
646
+ walletProvider: m,
647
+ localStorageProvider: g,
637
648
  onOpen: f,
638
- onSuccess: g,
639
- onClose: y,
640
- autoCloseOnSuccess: l,
641
- baseUrl: w
649
+ onSuccess: y,
650
+ onClose: w,
651
+ autoCloseOnSuccess: b,
652
+ baseUrl: d
642
653
  }), [
643
654
  s,
644
655
  t,
@@ -649,21 +660,21 @@ const ue = ({
649
660
  c,
650
661
  a,
651
662
  n,
652
- h,
653
663
  u,
654
664
  m,
655
- f,
656
665
  g,
666
+ f,
657
667
  y,
658
- l,
659
- w
668
+ w,
669
+ b,
670
+ d
660
671
  ]);
661
672
  return {
662
- openGlideBuy: d.open,
663
- externalUrl: d.externalUrl,
664
- opts: d.opts
673
+ openGlideBuy: l.open,
674
+ externalUrl: l.externalUrl,
675
+ opts: l.opts
665
676
  };
666
- }, ye = Object.freeze({
677
+ }, we = Object.freeze({
667
678
  getItem: (s) => new Promise((t, e) => {
668
679
  try {
669
680
  const i = localStorage.getItem(s);
@@ -696,10 +707,10 @@ const ue = ({
696
707
  })
697
708
  });
698
709
  export {
699
- z as GlideDeposit,
700
- ye as browserLocalStorageProvider,
701
- ge as useGlideBuy,
710
+ T as GlideDeposit,
711
+ we as browserLocalStorageProvider,
712
+ ye as useGlideBuy,
702
713
  fe as useGlideCall,
703
- ue as useGlideDeposit,
704
- me as useGlidePay
714
+ me as useGlideDeposit,
715
+ ge as useGlidePay
705
716
  };
package/dist/theme.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export type GlideWidgetTheme = {
2
+ colorScheme?: string;
2
3
  fontSrcCss?: string;
3
4
  fontFamily?: string;
4
5
  modalBorderWidth?: string;
@@ -13,8 +13,10 @@ interface UseGlideDepositProps {
13
13
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
14
14
  excludeFundingSources?: FundingSource[];
15
15
  mode?: "deposit" | "withdraw";
16
+ hideWithdrawAddress?: boolean;
16
17
  sessionId?: string;
17
18
  sessionMetadata?: string;
19
+ disableWithdrawToSelfSuggestion?: boolean;
18
20
  theme?: GlideWidgetTheme;
19
21
  walletProvider?: GlideDepositWalletProvider;
20
22
  localStorageProvider?: GlideLocalStorageProvider;
@@ -26,7 +28,7 @@ interface UseGlideDepositProps {
26
28
  baseUrl?: string;
27
29
  debug?: boolean;
28
30
  }
29
- export declare const useGlideDeposit: ({ app, recipient, chainId, currencyId, amount, gasRefuelAmountPerChain, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, mode, sessionId, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
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) => {
30
32
  openGlideDeposit: () => void;
31
33
  externalUrl: string;
32
34
  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.32",
3
+ "version": "0.0.34",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"