@paywithglide/glide-react 0.0.18 → 0.0.19

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.
@@ -97,7 +97,9 @@ export type GlideDepositOptions = {
97
97
  excludeChainIds?: CAIP2[];
98
98
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
99
99
  walletProvider?: GlideDepositWalletProvider;
100
+ onOpen?: () => void;
100
101
  onSuccess?: (hash: Hex) => void;
102
+ onClose?: () => void;
101
103
  autoCloseOnSuccess?: boolean;
102
104
  theme?: GlideWidgetTheme;
103
105
  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 C = (s, t, e) => t in s ? G(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var w = (s, t, e) => C(s, typeof t != "symbol" ? t + "" : t, e);
4
+ import { useMemo as b } from "react";
5
+ function H(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 H(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 y = {
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 g 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 g ? e.cause.details : (o = e.cause) != null && o.message ? e.cause.message : e.details;
22
+ })(), n = e.cause instanceof g && e.cause.docsPath || e.docsPath, r = (a = y.getDocsUrl) == null ? void 0 : a.call(y, { ...e, docsPath: n }), d = [
23
23
  t || "An error occurred.",
24
24
  "",
25
25
  ...e.metaMessages ? [...e.metaMessages, ""] : [],
26
26
  ...r ? [`Docs: ${r}`] : [],
27
27
  ...i ? [`Details: ${i}`] : [],
28
- ...m.version ? [`Version: ${m.version}`] : []
28
+ ...y.version ? [`Version: ${y.version}`] : []
29
29
  ].join(`
30
30
  `);
31
31
  super(d, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
@@ -58,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 g {
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 $(s, { dir: t, size: e = 32 } = {}) {
76
+ return typeof s == "string" ? j(s, { dir: t, size: e }) : B(s, { dir: t, size: e });
77
77
  }
78
- function G(s, { dir: t, size: e = 32 } = {}) {
78
+ function j(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 g {
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 g {
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" ? V(s, t) : typeof s == "string" ? F(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 }), $(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 }), $(i, { dir: "right", size: t.size })) : i;
137
137
  }
138
- function N(s, t = {}) {
138
+ function V(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 ? $(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 q = /* @__PURE__ */ new TextEncoder();
157
+ function F(s, t = {}) {
158
+ const e = q.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
+ w(this, "opts");
164
+ w(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
+ w(this, "iframeEventHandler", async (t) => {
176
+ var i, n, r, d, a, o, l, p, u, h, c, f, x, 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 (m) {
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: m
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 m = 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
+ (h = (u = this.iframe) == null ? void 0 : u.contentWindow) == null || h.postMessage(
219
219
  {
220
220
  type: "didSendTransaction",
221
221
  success: !0,
222
- txHash: h
222
+ txHash: m
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 (m) {
227
+ (f = (c = this.iframe) == null ? void 0 : c.contentWindow) == null || f.postMessage(
228
228
  {
229
229
  type: "didSendTransaction",
230
230
  success: !1,
231
- error: h
231
+ error: m
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 = (x = this.iframe) == null ? void 0 : x.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 m = 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: m
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 (m) {
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: m
271
271
  },
272
272
  this.baseUrl
273
273
  );
@@ -280,7 +280,7 @@ class w {
280
280
  }
281
281
  get externalUrl() {
282
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(",")}` : ""}`;
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(",")}` : ""}`;
284
284
  }
285
285
  initialize() {
286
286
  window.addEventListener("message", this.iframeEventHandler);
@@ -304,11 +304,11 @@ 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, u;
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 || !!((u = this.opts.walletProvider) != null && u.signTypedDataAsync);
309
309
  e.style.opacity = "1", setTimeout(() => {
310
- var u;
311
- (u = e == null ? void 0 : e.contentWindow) == null || u.postMessage(
310
+ var h, c, f;
311
+ (h = e == null ? void 0 : e.contentWindow) == null || h.postMessage(
312
312
  {
313
313
  type: "initialize",
314
314
  sessionId: this.opts.sessionId,
@@ -328,7 +328,7 @@ class w {
328
328
  theme: this.opts.theme
329
329
  },
330
330
  new URL(this.baseUrl).origin
331
- );
331
+ ), (f = (c = this.opts).onOpen) == null || f.call(c);
332
332
  }, 10);
333
333
  }, e.src = t, e.allow = "payment *; clipboard-write *", document.body.appendChild(e);
334
334
  }
@@ -337,7 +337,7 @@ class w {
337
337
  t && (t.remove(), document.body.classList.remove("glide-deposit-open"));
338
338
  }
339
339
  }
340
- const X = ({
340
+ const K = ({
341
341
  app: s,
342
342
  recipient: t,
343
343
  preferGaslessPayment: e,
@@ -347,11 +347,13 @@ const X = ({
347
347
  sessionMetadata: d,
348
348
  theme: a,
349
349
  walletProvider: o,
350
- onSuccess: l,
351
- autoCloseOnSuccess: p,
350
+ onOpen: l,
351
+ onSuccess: p,
352
+ onClose: u,
353
+ autoCloseOnSuccess: h,
352
354
  baseUrl: c
353
355
  }) => {
354
- const u = y(() => new w({
356
+ const f = b(() => new v({
355
357
  app: s,
356
358
  recipient: t,
357
359
  preferGaslessPayment: e,
@@ -361,8 +363,10 @@ const X = ({
361
363
  sessionMetadata: d,
362
364
  theme: a,
363
365
  walletProvider: o,
364
- onSuccess: l,
365
- autoCloseOnSuccess: p,
366
+ onOpen: l,
367
+ onSuccess: p,
368
+ onClose: u,
369
+ autoCloseOnSuccess: h,
366
370
  baseUrl: c
367
371
  }), [
368
372
  s,
@@ -376,14 +380,16 @@ const X = ({
376
380
  o,
377
381
  l,
378
382
  p,
383
+ u,
384
+ h,
379
385
  c
380
386
  ]);
381
387
  return {
382
- openGlideDeposit: u.open,
383
- externalUrl: u.externalUrl,
384
- opts: u.opts
388
+ openGlideDeposit: f.open,
389
+ externalUrl: f.externalUrl,
390
+ opts: f.opts
385
391
  };
386
- }, J = ({
392
+ }, Q = ({
387
393
  app: s,
388
394
  preferGaslessPayment: t,
389
395
  excludeChainIds: e,
@@ -393,11 +399,13 @@ const X = ({
393
399
  sessionMetadata: d,
394
400
  theme: a,
395
401
  walletProvider: o,
396
- onSuccess: l,
397
- autoCloseOnSuccess: p,
402
+ onOpen: l,
403
+ onSuccess: p,
404
+ onClose: u,
405
+ autoCloseOnSuccess: h,
398
406
  baseUrl: c
399
407
  }) => {
400
- const u = y(() => new w({
408
+ const f = b(() => new v({
401
409
  app: s,
402
410
  preferGaslessPayment: t,
403
411
  excludeChainIds: e,
@@ -408,12 +416,16 @@ const X = ({
408
416
  sessionMetadata: d,
409
417
  theme: a,
410
418
  walletProvider: o,
411
- onSuccess: l,
412
- autoCloseOnSuccess: p,
419
+ onOpen: l,
420
+ onSuccess: p,
421
+ onClose: u,
422
+ autoCloseOnSuccess: h,
413
423
  baseUrl: c
414
424
  }), [
415
425
  s,
416
426
  t,
427
+ e,
428
+ i,
417
429
  r,
418
430
  n,
419
431
  d,
@@ -421,14 +433,16 @@ const X = ({
421
433
  o,
422
434
  l,
423
435
  p,
436
+ u,
437
+ h,
424
438
  c
425
439
  ]);
426
440
  return {
427
- openGlidePay: u.open,
428
- externalUrl: u.externalUrl,
429
- opts: u.opts
441
+ openGlidePay: f.open,
442
+ externalUrl: f.externalUrl,
443
+ opts: f.opts
430
444
  };
431
- }, K = ({
445
+ }, Y = ({
432
446
  app: s,
433
447
  evm: t,
434
448
  approval: e,
@@ -438,11 +452,13 @@ const X = ({
438
452
  sessionMetadata: d,
439
453
  theme: a,
440
454
  walletProvider: o,
441
- onSuccess: l,
442
- autoCloseOnSuccess: p,
455
+ onOpen: l,
456
+ onSuccess: p,
457
+ onClose: u,
458
+ autoCloseOnSuccess: h,
443
459
  baseUrl: c
444
460
  }) => {
445
- const u = y(() => new w({
461
+ const f = b(() => new v({
446
462
  app: s,
447
463
  evm: t,
448
464
  approval: e,
@@ -453,27 +469,33 @@ const X = ({
453
469
  mode: "call",
454
470
  theme: a,
455
471
  walletProvider: o,
456
- onSuccess: l,
457
- autoCloseOnSuccess: p,
472
+ onOpen: l,
473
+ onSuccess: p,
474
+ onClose: u,
475
+ autoCloseOnSuccess: h,
458
476
  baseUrl: c
459
477
  }), [
460
478
  s,
461
479
  t,
462
480
  e,
463
481
  i,
482
+ n,
483
+ r,
464
484
  d,
465
485
  a,
466
486
  o,
467
487
  l,
468
488
  p,
489
+ u,
490
+ h,
469
491
  c
470
492
  ]);
471
493
  return {
472
- openGlideCall: u.open,
473
- externalUrl: u.externalUrl,
474
- opts: u.opts
494
+ openGlideCall: f.open,
495
+ externalUrl: f.externalUrl,
496
+ opts: f.opts
475
497
  };
476
- }, Q = ({
498
+ }, Z = ({
477
499
  app: s,
478
500
  recipient: t,
479
501
  preferGaslessPayment: e,
@@ -482,11 +504,13 @@ const X = ({
482
504
  sessionMetadata: r,
483
505
  theme: d,
484
506
  walletProvider: a,
485
- onSuccess: o,
486
- autoCloseOnSuccess: l,
487
- baseUrl: p
507
+ onOpen: o,
508
+ onSuccess: l,
509
+ onClose: p,
510
+ autoCloseOnSuccess: u,
511
+ baseUrl: h
488
512
  }) => {
489
- const c = y(() => new w({
513
+ const c = b(() => new v({
490
514
  app: s,
491
515
  recipient: t,
492
516
  preferGaslessPayment: e,
@@ -496,19 +520,25 @@ const X = ({
496
520
  mode: "buy",
497
521
  theme: d,
498
522
  walletProvider: a,
499
- onSuccess: o,
500
- autoCloseOnSuccess: l,
501
- baseUrl: p
523
+ onOpen: o,
524
+ onSuccess: l,
525
+ onClose: p,
526
+ autoCloseOnSuccess: u,
527
+ baseUrl: h
502
528
  }), [
503
529
  s,
504
530
  t,
505
531
  e,
532
+ i,
533
+ n,
506
534
  r,
507
535
  d,
508
536
  a,
509
537
  o,
510
538
  l,
511
- p
539
+ p,
540
+ u,
541
+ h
512
542
  ]);
513
543
  return {
514
544
  openGlideBuy: c.open,
@@ -517,9 +547,9 @@ const X = ({
517
547
  };
518
548
  };
519
549
  export {
520
- w as GlideDeposit,
521
- Q as useGlideBuy,
522
- K as useGlideCall,
523
- X as useGlideDeposit,
524
- J as useGlidePay
550
+ v as GlideDeposit,
551
+ Z as useGlideBuy,
552
+ Y as useGlideCall,
553
+ K as useGlideDeposit,
554
+ Q as useGlidePay
525
555
  };
@@ -10,11 +10,13 @@ interface UseGlideBuyProps {
10
10
  sessionMetadata?: string;
11
11
  theme?: GlideWidgetTheme;
12
12
  walletProvider?: GlideDepositWalletProvider;
13
+ onOpen?: () => void;
13
14
  onSuccess?: (hash: Hex) => void;
15
+ onClose?: () => void;
14
16
  autoCloseOnSuccess?: boolean;
15
17
  baseUrl?: string;
16
18
  }
17
- export declare const useGlideBuy: ({ app, recipient, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, sessionMetadata, theme, walletProvider, onSuccess, autoCloseOnSuccess, baseUrl, }: UseGlideBuyProps) => {
19
+ export declare const useGlideBuy: ({ app, recipient, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideBuyProps) => {
18
20
  openGlideBuy: () => void;
19
21
  externalUrl: string;
20
22
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
@@ -19,11 +19,13 @@ interface UseGlideCallProps {
19
19
  sessionMetadata?: string;
20
20
  theme?: GlideWidgetTheme;
21
21
  walletProvider?: GlideDepositWalletProvider;
22
+ onOpen?: () => void;
22
23
  onSuccess?: (hash: Hex) => void;
24
+ onClose?: () => void;
23
25
  autoCloseOnSuccess?: boolean;
24
26
  baseUrl?: string;
25
27
  }
26
- export declare const useGlideCall: ({ app, evm, approval, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, sessionMetadata, theme, walletProvider, onSuccess, autoCloseOnSuccess, baseUrl, }: UseGlideCallProps) => {
28
+ export declare const useGlideCall: ({ app, evm, approval, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideCallProps) => {
27
29
  openGlideCall: () => void;
28
30
  externalUrl: string;
29
31
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
@@ -11,11 +11,13 @@ interface UseGlideDepositProps {
11
11
  sessionMetadata?: string;
12
12
  theme?: GlideWidgetTheme;
13
13
  walletProvider?: GlideDepositWalletProvider;
14
+ onOpen?: () => void;
14
15
  onSuccess?: (hash: string) => void;
16
+ onClose?: () => void;
15
17
  autoCloseOnSuccess?: boolean;
16
18
  baseUrl?: string;
17
19
  }
18
- export declare const useGlideDeposit: ({ app, recipient, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, mode, sessionMetadata, theme, walletProvider, onSuccess, autoCloseOnSuccess, baseUrl, }: UseGlideDepositProps) => {
20
+ export declare const useGlideDeposit: ({ app, recipient, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, mode, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideDepositProps) => {
19
21
  openGlideDeposit: () => void;
20
22
  externalUrl: string;
21
23
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
@@ -11,11 +11,13 @@ type UseGlidePayProps = {
11
11
  sessionMetadata?: string;
12
12
  theme?: GlideWidgetTheme;
13
13
  walletProvider?: GlideDepositWalletProvider;
14
+ onOpen?: () => void;
14
15
  onSuccess?: (hash: string) => void;
16
+ onClose?: () => void;
15
17
  autoCloseOnSuccess?: boolean;
16
18
  baseUrl?: string;
17
19
  };
18
- export declare const useGlidePay: ({ app, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, amount, sessionId, sessionMetadata, theme, walletProvider, onSuccess, autoCloseOnSuccess, baseUrl, }: UseGlidePayProps) => {
20
+ export declare const useGlidePay: ({ app, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, amount, sessionId, sessionMetadata, theme, walletProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlidePayProps) => {
19
21
  openGlidePay: () => void;
20
22
  externalUrl: string;
21
23
  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.19",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"